diff options
781 files changed, 7702 insertions, 3463 deletions
diff --git a/apct-tests/perftests/autofill/src/android/view/autofill/AutofillTestWatcher.java b/apct-tests/perftests/autofill/src/android/view/autofill/AutofillTestWatcher.java index f65067fe2d92..afdc36190066 100644 --- a/apct-tests/perftests/autofill/src/android/view/autofill/AutofillTestWatcher.java +++ b/apct-tests/perftests/autofill/src/android/view/autofill/AutofillTestWatcher.java @@ -174,7 +174,9 @@ final class AutofillTestWatcher extends TestWatcher { public static void onConnected() { Log.i(TAG, "onConnected: sServiceWatcher=" + sServiceWatcher); - + if (sServiceWatcher == null) { + sServiceWatcher = new ServiceWatcher(); + } sServiceWatcher.mConnected.countDown(); } diff --git a/cmds/screencap/Android.bp b/cmds/screencap/Android.bp index 16026eca2980..9f350b1d6054 100644 --- a/cmds/screencap/Android.bp +++ b/cmds/screencap/Android.bp @@ -7,25 +7,66 @@ package { default_applicable_licenses: ["frameworks_base_license"], } -cc_binary { - name: "screencap", +cc_defaults { + name: "screencap_defaults", - srcs: ["screencap.cpp"], + cflags: [ + "-Wall", + "-Werror", + "-Wunreachable-code", + "-Wunused", + ], shared_libs: [ - "libcutils", - "libutils", "libbinder", - "libjnigraphics", + "libcutils", + "libgui", "libhwui", + "libjnigraphics", "libui", - "libgui", + "libutils", ], +} - cflags: [ - "-Wall", - "-Werror", - "-Wunused", - "-Wunreachable-code", +cc_library { + name: "libscreencap", + + defaults: [ + "screencap_defaults", + ], + + srcs: ["screencap_utils.cpp"], +} + +cc_binary { + name: "screencap", + + defaults: [ + "screencap_defaults", + ], + + srcs: ["screencap.cpp"], + + static_libs: [ + "libscreencap", + ], +} + +cc_test { + name: "libscreencap_test", + + defaults: [ + "screencap_defaults", + ], + + test_suites: ["device-tests"], + + srcs: [ + "tests/screencap_test.cpp", + ], + + static_libs: [ + "libgmock", + "libscreencap", ], } diff --git a/cmds/screencap/TEST_MAPPING b/cmds/screencap/TEST_MAPPING new file mode 100644 index 000000000000..05c598e1e9cc --- /dev/null +++ b/cmds/screencap/TEST_MAPPING @@ -0,0 +1,12 @@ +{ + "presubmit": [ + { + "name": "libscreencap_test" + } + ], + "hwasan-presubmit": [ + { + "name": "libscreencap_test" + } + ] +}
\ No newline at end of file diff --git a/cmds/screencap/screencap.cpp b/cmds/screencap/screencap.cpp index d563ad3fd3db..9ff1161081fc 100644 --- a/cmds/screencap/screencap.cpp +++ b/cmds/screencap/screencap.cpp @@ -37,6 +37,9 @@ #include <ui/GraphicTypes.h> #include <ui/PixelFormat.h> +#include "utils/Errors.h" +#include "screencap_utils.h" + using namespace android; #define COLORSPACE_UNKNOWN 0 @@ -145,24 +148,6 @@ static status_t notifyMediaScanner(const char* fileName) { return NO_ERROR; } -status_t capture(const DisplayId displayId, - const gui::CaptureArgs& captureArgs, - ScreenCaptureResults& outResult) { - sp<SyncScreenCaptureListener> captureListener = new SyncScreenCaptureListener(); - ScreenshotClient::captureDisplay(displayId, captureArgs, captureListener); - - ScreenCaptureResults captureResults = captureListener->waitForResults(); - if (!captureResults.fenceResult.ok()) { - fprintf(stderr, "Failed to take screenshot. Status: %d\n", - fenceStatus(captureResults.fenceResult)); - return 1; - } - - outResult = captureResults; - - return 0; -} - status_t saveImage(const char* fn, std::optional<AndroidBitmapCompressFormat> format, const ScreenCaptureResults& captureResults) { void* base = nullptr; @@ -427,15 +412,12 @@ int main(int argc, char** argv) std::vector<ScreenCaptureResults> results; const size_t numDisplays = displaysToCapture.size(); - for (int i=0; i<numDisplays; i++) { - ScreenCaptureResults result; - + for (int i = 0; i < numDisplays; i++) { // 1. Capture the screen - if (const status_t captureStatus = - capture(displaysToCapture[i], captureArgs, result) != 0) { - - fprintf(stderr, "Capturing failed.\n"); - return captureStatus; + auto captureResult = screencap::capture(displaysToCapture[i], captureArgs); + if (!captureResult.ok()) { + fprintf(stderr, "%sCapturing failed.\n", captureResult.error().message().c_str()); + return 1; } // 2. Save the capture result as an image. @@ -453,7 +435,7 @@ int main(int argc, char** argv) if (!filename.empty()) { fn = filename.c_str(); } - if (const status_t saveImageStatus = saveImage(fn, format, result) != 0) { + if (const status_t saveImageStatus = saveImage(fn, format, captureResult.value()) != 0) { fprintf(stderr, "Saving image failed.\n"); return saveImageStatus; } diff --git a/cmds/screencap/screencap_utils.cpp b/cmds/screencap/screencap_utils.cpp new file mode 100644 index 000000000000..03ade73d0e30 --- /dev/null +++ b/cmds/screencap/screencap_utils.cpp @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2025 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. + */ + +#include "screencap_utils.h" + +#include "gui/SyncScreenCaptureListener.h" + +namespace android::screencap { + +base::Result<gui::ScreenCaptureResults> capture(const DisplayId displayId, + const gui::CaptureArgs& captureArgs) { + sp<SyncScreenCaptureListener> captureListener = new SyncScreenCaptureListener(); + auto captureDisplayStatus = + ScreenshotClient::captureDisplay(displayId, captureArgs, captureListener); + + gui::ScreenCaptureResults captureResults = captureListener->waitForResults(); + if (!captureResults.fenceResult.ok()) { + status_t captureStatus = fenceStatus(captureResults.fenceResult); + std::stringstream errorMsg; + errorMsg << "Failed to take take screenshot. "; + if (captureStatus == NAME_NOT_FOUND) { + errorMsg << "Display Id '" << displayId.value << "' is not valid.\n"; + } + return base::ResultError(errorMsg.str(), captureStatus); + } + + return captureResults; +} + +} // namespace android::screencap
\ No newline at end of file diff --git a/cmds/screencap/screencap_utils.h b/cmds/screencap/screencap_utils.h new file mode 100644 index 000000000000..6580e3fa5ff1 --- /dev/null +++ b/cmds/screencap/screencap_utils.h @@ -0,0 +1,28 @@ +/* + * Copyright (C) 2025 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. + */ + +#include <android-base/result.h> +#include <android/gui/DisplayCaptureArgs.h> + +#include "gui/ScreenCaptureResults.h" +#include "ui/DisplayId.h" + +#pragma once + +namespace android::screencap { +base::Result<gui::ScreenCaptureResults> capture(const DisplayId displayId, + const gui::CaptureArgs& captureArgs); +} // namespace android::screencap diff --git a/cmds/screencap/tests/screencap_test.cpp b/cmds/screencap/tests/screencap_test.cpp new file mode 100644 index 000000000000..b7bfca9ada65 --- /dev/null +++ b/cmds/screencap/tests/screencap_test.cpp @@ -0,0 +1,68 @@ +// Copyright (C) 2025 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. + +#include <binder/ProcessState.h> +#include <gmock/gmock.h> +#include <gtest/gtest.h> +#include <gui/SurfaceComposerClient.h> + +#include "android/gui/CaptureArgs.h" +#include "gmock/gmock.h" +#include "gui/ScreenCaptureResults.h" +#include "screencap_utils.h" +#include "ui/DisplayId.h" + +using ::android::DisplayId; +using ::android::OK; +using ::android::PhysicalDisplayId; +using ::android::ProcessState; +using ::android::SurfaceComposerClient; +using ::android::gui::CaptureArgs; +using ::android::gui::ScreenCaptureResults; +using ::testing::AllOf; +using ::testing::HasSubstr; + +class ScreenCapTest : public ::testing::Test { +protected: + static void SetUpTestSuite() { + // These lines are copied from screencap.cpp. They are necessary to call binder. + ProcessState::self()->setThreadPoolMaxThreadCount(0); + ProcessState::self()->startThreadPool(); + } +}; + +TEST_F(ScreenCapTest, Capture_InvalidDisplayNumber) { + DisplayId display; + display.value = -1; + + CaptureArgs args; + auto result = ::android::screencap::capture(display, args); + EXPECT_FALSE(result.ok()); + EXPECT_THAT(result.error().message(), + AllOf(HasSubstr("Display Id"), HasSubstr("is not valid."))); +} + +TEST_F(ScreenCapTest, Capture_SuccessWithPhysicalDisplay) { + const std::vector<PhysicalDisplayId> physicalDisplays = + SurfaceComposerClient::getPhysicalDisplayIds(); + + ASSERT_FALSE(physicalDisplays.empty()); + DisplayId display; + display.value = physicalDisplays.front().value; + + CaptureArgs args; + auto result = ::android::screencap::capture(display, args); + EXPECT_TRUE(result.ok()); + // TODO consider verifying actual captured image. +}
\ No newline at end of file diff --git a/core/api/system-current.txt b/core/api/system-current.txt index ab824119d643..9a848d423c9a 100644 --- a/core/api/system-current.txt +++ b/core/api/system-current.txt @@ -16052,7 +16052,7 @@ package android.telephony { method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean isLteCdmaEvdoGsmWcdmaEnabled(); method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean isMobileDataPolicyEnabled(int); method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean isNrDualConnectivityEnabled(); - method @FlaggedApi("com.android.internal.telephony.flags.enable_modem_cipher_transparency") @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean isNullCipherNotificationsEnabled(); + method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean isNullCipherNotificationsEnabled(); method @Deprecated @RequiresPermission(anyOf={android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, android.Manifest.permission.READ_PHONE_STATE}) public boolean isOffhook(); method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean isOpportunisticNetworkEnabled(); method @Deprecated @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean isPotentialEmergencyNumber(@NonNull String); @@ -16097,7 +16097,7 @@ package android.telephony { method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setMobileDataPolicyEnabled(int, boolean); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setMultiSimCarrierRestriction(boolean); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public int setNrDualConnectivityState(int); - method @FlaggedApi("com.android.internal.telephony.flags.enable_modem_cipher_transparency") @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setNullCipherNotificationsEnabled(boolean); + method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setNullCipherNotificationsEnabled(boolean); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean setOpportunisticNetworkState(boolean); method @Deprecated @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean setPreferredNetworkTypeBitmask(long); method @Deprecated @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean setRadio(boolean); diff --git a/core/api/test-current.txt b/core/api/test-current.txt index 0b0738ee14dc..5453e735ce17 100644 --- a/core/api/test-current.txt +++ b/core/api/test-current.txt @@ -478,8 +478,8 @@ package android.app { method public void destroy(); method @NonNull public java.util.Set<java.lang.String> getAdoptedShellPermissions(); method @Deprecated public boolean grantRuntimePermission(String, String, android.os.UserHandle); - method @Deprecated @FlaggedApi("com.android.input.flags.deprecate_uiautomation_input_injection") public boolean injectInputEvent(@NonNull android.view.InputEvent, boolean, boolean); - method @Deprecated @FlaggedApi("com.android.input.flags.deprecate_uiautomation_input_injection") public void injectInputEventToInputFilter(@NonNull android.view.InputEvent); + method public boolean injectInputEvent(@NonNull android.view.InputEvent, boolean, boolean); + method public void injectInputEventToInputFilter(@NonNull android.view.InputEvent); method public boolean isNodeInCache(@NonNull android.view.accessibility.AccessibilityNodeInfo); method public void removeOverridePermissionState(int, @NonNull String); method @Deprecated public boolean revokeRuntimePermission(String, String, android.os.UserHandle); @@ -1722,6 +1722,7 @@ package android.hardware.display { public final class DisplayManager { method public boolean areUserDisabledHdrTypesAllowed(); method @RequiresPermission(android.Manifest.permission.MODIFY_USER_PREFERRED_DISPLAY_MODE) public void clearGlobalUserPreferredDisplayMode(); + method @FlaggedApi("com.android.server.display.feature.flags.display_topology") @Nullable @RequiresPermission("android.permission.MANAGE_DISPLAYS") public android.hardware.display.DisplayTopology getDisplayTopology(); method @Nullable public android.view.Display.Mode getGlobalUserPreferredDisplayMode(); method @NonNull public android.hardware.display.HdrConversionMode getHdrConversionModeSetting(); method @NonNull public int[] getSupportedHdrOutputTypes(); @@ -1747,6 +1748,13 @@ package android.hardware.display { field public static final int VIRTUAL_DISPLAY_FLAG_SUPPORTS_TOUCH = 64; // 0x40 } + @FlaggedApi("com.android.server.display.feature.flags.display_topology") public final class DisplayTopology implements android.os.Parcelable { + method public int describeContents(); + method @NonNull public android.util.SparseArray<android.graphics.RectF> getAbsoluteBounds(); + method public void writeToParcel(@NonNull android.os.Parcel, int); + field @NonNull public static final android.os.Parcelable.Creator<android.hardware.display.DisplayTopology> CREATOR; + } + } package android.hardware.fingerprint { diff --git a/core/java/android/app/UiAutomation.java b/core/java/android/app/UiAutomation.java index ba8fbc121e8d..7b63ab80964d 100644 --- a/core/java/android/app/UiAutomation.java +++ b/core/java/android/app/UiAutomation.java @@ -18,8 +18,6 @@ package android.app; import static android.view.Display.DEFAULT_DISPLAY; -import static com.android.input.flags.Flags.FLAG_DEPRECATE_UIAUTOMATION_INPUT_INJECTION; - import android.accessibilityservice.AccessibilityGestureEvent; import android.accessibilityservice.AccessibilityService; import android.accessibilityservice.AccessibilityService.Callbacks; @@ -28,7 +26,6 @@ import android.accessibilityservice.AccessibilityServiceInfo; import android.accessibilityservice.IAccessibilityServiceClient; import android.accessibilityservice.IAccessibilityServiceConnection; import android.accessibilityservice.MagnificationConfig; -import android.annotation.FlaggedApi; import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.Nullable; @@ -111,10 +108,7 @@ import java.util.concurrent.TimeoutException; * client should be using a higher-level library or implement high-level functions. * For example, performing a tap on the screen requires construction and injecting * of a touch down and up events which have to be delivered to the system by a - * call to {@link #injectInputEvent(InputEvent, boolean)}. <strong>Note:</strong> For CTS tests, it - * is preferable to inject input events using uinput (com.android.cts.input.UinputDevice) or hid - * devices (com.android.cts.input.HidDevice). Alternatively, use InjectInputInProcess - * (com.android.cts.input.InjectInputInProcess) for in-process injection. + * call to {@link #injectInputEvent(InputEvent, boolean)}. * </p> * <p> * The APIs exposed by this class operate across applications enabling a client @@ -963,17 +957,9 @@ public final class UiAutomation { * <strong>Note:</strong> It is caller's responsibility to recycle the event. * </p> * - * <p> - * <strong>Note:</strong> Avoid this method when injecting input events in CTS tests. Instead - * use uinput (com.android.cts.input.UinputDevice) - * or hid devices (com.android.cts.input.HidDevice), as they provide a more accurate simulation - * of real device behavior. Alternatively, InjectInputInProcess - * (com.android.cts.input.InjectInputProcess) can be used for in-process injection. - * </p> - * - * @param event the event to inject - * @param sync whether to inject the event synchronously - * @return {@code true} if event injection succeeded + * @param event The event to inject. + * @param sync Whether to inject the event synchronously. + * @return Whether event injection succeeded. */ public boolean injectInputEvent(InputEvent event, boolean sync) { return injectInputEvent(event, sync, true /* waitForAnimations */); @@ -986,21 +972,15 @@ public final class UiAutomation { * <strong>Note:</strong> It is caller's responsibility to recycle the event. * </p> * - * @param event the event to inject - * @param sync whether to inject the event synchronously. - * @param waitForAnimations whether to wait for all window container animations and surface - * operations to complete - * @return {@code true} if event injection succeeded + * @param event The event to inject. + * @param sync Whether to inject the event synchronously. + * @param waitForAnimations Whether to wait for all window container animations and surface + * operations to complete. + * @return Whether event injection succeeded. * - * @deprecated for CTS tests prefer inject input events using uinput - * (com.android.cts.input.UinputDevice) or hid devices (com.android.cts.input.HidDevice). - * Alternatively, InjectInputInProcess (com.android.cts.input.InjectInputProcess) can be used - * for in-process injection. * @hide */ @TestApi - @Deprecated // Deprecated for CTS tests - @FlaggedApi(FLAG_DEPRECATE_UIAUTOMATION_INPUT_INJECTION) public boolean injectInputEvent(@NonNull InputEvent event, boolean sync, boolean waitForAnimations) { try { @@ -1023,15 +1003,9 @@ public final class UiAutomation { * Events injected to the input subsystem using the standard {@link #injectInputEvent} method * skip the accessibility input filter to avoid feedback loops. * - * @deprecated for CTS tests prefer inject input events using uinput - * (com.android.cts.input.UinputDevice) or hid devices (com.android.cts.input.HidDevice). - * Alternatively, InjectInputInProcess (com.android.cts.input.InjectInputProcess) can be used - * for in-process injection. * @hide */ @TestApi - @Deprecated - @FlaggedApi(FLAG_DEPRECATE_UIAUTOMATION_INPUT_INJECTION) public void injectInputEventToInputFilter(@NonNull InputEvent event) { try { mUiAutomationConnection.injectInputEventToInputFilter(event); diff --git a/core/java/android/app/supervision/SupervisionManager.java b/core/java/android/app/supervision/SupervisionManager.java index a4efd77fce75..d30705536045 100644 --- a/core/java/android/app/supervision/SupervisionManager.java +++ b/core/java/android/app/supervision/SupervisionManager.java @@ -33,7 +33,7 @@ import android.os.RemoteException; @SystemService(Context.SUPERVISION_SERVICE) public class SupervisionManager { private final Context mContext; - private final ISupervisionManager mService; + @Nullable private final ISupervisionManager mService; /** * Activity action: ask the human user to enable supervision for this user. Only the app that @@ -66,7 +66,7 @@ public class SupervisionManager { /** @hide */ @UnsupportedAppUsage - public SupervisionManager(Context context, ISupervisionManager service) { + public SupervisionManager(Context context, @Nullable ISupervisionManager service) { mContext = context; mService = service; } @@ -93,11 +93,14 @@ public class SupervisionManager { value = android.Manifest.permission.INTERACT_ACROSS_USERS, conditional = true) public boolean isSupervisionEnabledForUser(@UserIdInt int userId) { - try { - return mService.isSupervisionEnabledForUser(userId); - } catch (RemoteException e) { - throw e.rethrowFromSystemServer(); + if (mService != null) { + try { + return mService.isSupervisionEnabledForUser(userId); + } catch (RemoteException e) { + throw e.rethrowFromSystemServer(); + } } + return false; } /** @@ -122,10 +125,12 @@ public class SupervisionManager { value = android.Manifest.permission.INTERACT_ACROSS_USERS, conditional = true) public void setSupervisionEnabledForUser(@UserIdInt int userId, boolean enabled) { - try { - mService.setSupervisionEnabledForUser(userId, enabled); - } catch (RemoteException e) { - throw e.rethrowFromSystemServer(); + if (mService != null) { + try { + mService.setSupervisionEnabledForUser(userId, enabled); + } catch (RemoteException e) { + throw e.rethrowFromSystemServer(); + } } } @@ -138,10 +143,13 @@ public class SupervisionManager { @UserHandleAware @Nullable public String getActiveSupervisionAppPackage() { - try { - return mService.getActiveSupervisionAppPackage(mContext.getUserId()); - } catch (RemoteException e) { - throw e.rethrowFromSystemServer(); + if (mService != null) { + try { + return mService.getActiveSupervisionAppPackage(mContext.getUserId()); + } catch (RemoteException e) { + throw e.rethrowFromSystemServer(); + } } + return null; } } diff --git a/core/java/android/content/pm/PackageManager.java b/core/java/android/content/pm/PackageManager.java index 8c7e93a834b7..0369b7d9bc28 100644 --- a/core/java/android/content/pm/PackageManager.java +++ b/core/java/android/content/pm/PackageManager.java @@ -7967,7 +7967,7 @@ public abstract class PackageManager { * @param flags Additional option flags to modify the data returned. * @return Returns a List of ResolveInfo objects containing one entry for * each matching receiver, ordered from best to worst. If there are - * no matching receivers, an empty list or null is returned. + * no matching receivers, returns an empty list. */ @NonNull public abstract List<ResolveInfo> queryBroadcastReceivers(@NonNull Intent intent, int flags); @@ -7994,7 +7994,7 @@ public abstract class PackageManager { * @param userHandle UserHandle of the user being queried. * @return Returns a List of ResolveInfo objects containing one entry for * each matching receiver, ordered from best to worst. If there are - * no matching receivers, an empty list or null is returned. + * no matching receivers, returns an empty list. * @hide */ @SuppressWarnings("HiddenAbstractMethod") @@ -8111,8 +8111,8 @@ public abstract class PackageManager { * @return Returns a List of ResolveInfo objects containing one entry for * each matching service, ordered from best to worst. In other * words, the first item is what would be returned by - * {@link #resolveService}. If there are no matching services, an - * empty list or null is returned. + * {@link #resolveService}. If there are no matching services, + * returns an empty list. */ @NonNull public abstract List<ResolveInfo> queryIntentServices(@NonNull Intent intent, @@ -8140,8 +8140,8 @@ public abstract class PackageManager { * @return Returns a List of ResolveInfo objects containing one entry for * each matching service, ordered from best to worst. In other * words, the first item is what would be returned by - * {@link #resolveService}. If there are no matching services, an - * empty list or null is returned. + * {@link #resolveService}. If there are no matching services, + * returns an empty list. * @hide */ @SuppressWarnings("HiddenAbstractMethod") @@ -8173,8 +8173,8 @@ public abstract class PackageManager { * @return Returns a List of ResolveInfo objects containing one entry for * each matching service, ordered from best to worst. In other * words, the first item is what would be returned by - * {@link #resolveService}. If there are no matching services, an - * empty list or null is returned. + * {@link #resolveService}. If there are no matching services, + * returns an empty list. * @hide */ @NonNull @@ -8208,7 +8208,7 @@ public abstract class PackageManager { * @param userId The user id. * @return Returns a List of ResolveInfo objects containing one entry for * each matching provider, ordered from best to worst. If there are - * no matching services, an empty list or null is returned. + * no matching services, returns an empty list. * @hide */ @SuppressWarnings("HiddenAbstractMethod") @@ -8240,7 +8240,7 @@ public abstract class PackageManager { * @param user The user being queried. * @return Returns a List of ResolveInfo objects containing one entry for * each matching provider, ordered from best to worst. If there are - * no matching services, an empty list or null is returned. + * no matching services, returns an empty list. * @hide */ @NonNull @@ -8274,7 +8274,7 @@ public abstract class PackageManager { * @param flags Additional option flags to modify the data returned. * @return Returns a List of ResolveInfo objects containing one entry for * each matching provider, ordered from best to worst. If there are - * no matching services, an empty list or null is returned. + * no matching services, returns an empty list. */ @NonNull public abstract List<ResolveInfo> queryIntentContentProviders(@NonNull Intent intent, diff --git a/core/java/android/content/pm/multiuser.aconfig b/core/java/android/content/pm/multiuser.aconfig index 4e6fb8d3a8e7..e6082d0df1f8 100644 --- a/core/java/android/content/pm/multiuser.aconfig +++ b/core/java/android/content/pm/multiuser.aconfig @@ -615,3 +615,10 @@ flag { bug: "346553745" is_exported: true } + +flag { + namespace: "multi_user" + name: "logout_user_api" + description: "Add API to logout user" + bug: "350045389" +} diff --git a/core/java/android/hardware/display/DisplayManager.java b/core/java/android/hardware/display/DisplayManager.java index a96de4b050a3..fded88212127 100644 --- a/core/java/android/hardware/display/DisplayManager.java +++ b/core/java/android/hardware/display/DisplayManager.java @@ -1873,6 +1873,8 @@ public final class DisplayManager { */ @RequiresPermission(MANAGE_DISPLAYS) @Nullable + @TestApi + @FlaggedApi(Flags.FLAG_DISPLAY_TOPOLOGY) public DisplayTopology getDisplayTopology() { return mGlobal.getDisplayTopology(); } diff --git a/core/java/android/hardware/display/DisplayTopology.java b/core/java/android/hardware/display/DisplayTopology.java index 785a0e0adc48..4ed0fc056e7d 100644 --- a/core/java/android/hardware/display/DisplayTopology.java +++ b/core/java/android/hardware/display/DisplayTopology.java @@ -21,8 +21,10 @@ import static android.hardware.display.DisplayTopology.TreeNode.POSITION_LEFT; import static android.hardware.display.DisplayTopology.TreeNode.POSITION_RIGHT; import static android.hardware.display.DisplayTopology.TreeNode.POSITION_TOP; +import android.annotation.FlaggedApi; import android.annotation.IntDef; import android.annotation.Nullable; +import android.annotation.TestApi; import android.graphics.PointF; import android.graphics.RectF; import android.os.Parcel; @@ -39,6 +41,7 @@ import android.view.Display; import androidx.annotation.NonNull; import com.android.internal.annotations.VisibleForTesting; +import com.android.server.display.feature.flags.Flags; import java.io.PrintWriter; import java.io.StringWriter; @@ -59,6 +62,8 @@ import java.util.Queue; * * @hide */ +@TestApi +@FlaggedApi(Flags.FLAG_DISPLAY_TOPOLOGY) public final class DisplayTopology implements Parcelable { private static final String TAG = "DisplayTopology"; private static final float EPSILON = 0.0001f; @@ -82,6 +87,7 @@ public final class DisplayTopology implements Parcelable { * @param px The value in logical pixels * @param dpi The logical density of the display * @return The value in density-independent pixels + * @hide */ public static float pxToDp(float px, int dpi) { return px * DisplayMetrics.DENSITY_DEFAULT / dpi; @@ -91,6 +97,7 @@ public final class DisplayTopology implements Parcelable { * @param dp The value in density-independent pixels * @param dpi The logical density of the display * @return The value in logical pixels + * @hide */ public static float dpToPx(float dp, int dpi) { return dp * dpi / DisplayMetrics.DENSITY_DEFAULT; @@ -108,8 +115,14 @@ public final class DisplayTopology implements Parcelable { */ private int mPrimaryDisplayId = Display.INVALID_DISPLAY; + /** + * @hide + */ public DisplayTopology() {} + /** + * @hide + */ public DisplayTopology(@Nullable TreeNode root, int primaryDisplayId) { mRoot = root; if (mRoot != null) { @@ -124,15 +137,24 @@ public final class DisplayTopology implements Parcelable { mPrimaryDisplayId = primaryDisplayId; } + /** + * @hide + */ public DisplayTopology(Parcel source) { this(source.readTypedObject(TreeNode.CREATOR), source.readInt()); } + /** + * @hide + */ @Nullable public TreeNode getRoot() { return mRoot; } + /** + * @hide + */ public int getPrimaryDisplayId() { return mPrimaryDisplayId; } @@ -144,6 +166,7 @@ public final class DisplayTopology implements Parcelable { * @param displayId The logical display ID * @param width The width of the display * @param height The height of the display + * @hide */ public void addDisplay(int displayId, float width, float height) { addDisplay(displayId, width, height, /* shouldLog= */ true); @@ -155,6 +178,7 @@ public final class DisplayTopology implements Parcelable { * @param width The new width * @param height The new height * @return True if the topology has changed. + * @hide */ public boolean updateDisplay(int displayId, float width, float height) { TreeNode display = findDisplay(displayId, mRoot); @@ -178,6 +202,7 @@ public final class DisplayTopology implements Parcelable { * one by one. * @param displayId The logical display ID * @return True if the display was present in the topology and removed. + * @hide */ public boolean removeDisplay(int displayId) { if (findDisplay(displayId, mRoot) == null) { @@ -221,6 +246,7 @@ public final class DisplayTopology implements Parcelable { * are the display IDs. * @throws IllegalArgumentException if the keys in {@code positions} are not the exact display * IDs in this topology, no more, no less + * @hide */ public void rearrange(Map<Integer, PointF> newPos) { if (mRoot == null) { @@ -346,6 +372,7 @@ public final class DisplayTopology implements Parcelable { /** * Clamp offsets and remove any overlaps between displays. + * @hide */ public void normalize() { if (mRoot == null) { @@ -494,6 +521,7 @@ public final class DisplayTopology implements Parcelable { /** * @return A deep copy of the topology that will not be modified by the system. + * @hide */ public DisplayTopology copy() { TreeNode rootCopy = mRoot == null ? null : mRoot.copy(); @@ -505,6 +533,7 @@ public final class DisplayTopology implements Parcelable { * (0, 0). * @return Map from logical display ID to the display's absolute bounds */ + @NonNull public SparseArray<RectF> getAbsoluteBounds() { Map<TreeNode, RectF> bounds = new HashMap<>(); getInfo(bounds, /* depths= */ null, /* parents= */ null, mRoot, /* x= */ 0, /* y= */ 0, @@ -529,6 +558,7 @@ public final class DisplayTopology implements Parcelable { /** * Print the object's state and debug information into the given stream. + * @hide * @param pw The stream to dump information to. */ public void dump(PrintWriter pw) { @@ -629,6 +659,9 @@ public final class DisplayTopology implements Parcelable { return result; } + /** + * @hide + */ @Nullable public static TreeNode findDisplay(int displayId, @Nullable TreeNode startingNode) { if (startingNode == null) { @@ -725,6 +758,7 @@ public final class DisplayTopology implements Parcelable { * @param densityPerDisplay The logical display densities, indexed by logical display ID * @return The graph representation of the topology. If there is a corner adjacency, the same * display will appear twice in the list of adjacent displays with both possible placements. + * @hide */ @Nullable public DisplayTopologyGraph getGraph(SparseIntArray densityPerDisplay) { @@ -839,6 +873,9 @@ public final class DisplayTopology implements Parcelable { } } + /** + * @hide + */ public static final class TreeNode implements Parcelable { public static final int POSITION_LEFT = 0; public static final int POSITION_TOP = 1; diff --git a/core/java/android/os/IUserManager.aidl b/core/java/android/os/IUserManager.aidl index 18f9b2b9d74f..59bd9822c157 100644 --- a/core/java/android/os/IUserManager.aidl +++ b/core/java/android/os/IUserManager.aidl @@ -83,6 +83,8 @@ interface IUserManager { long getUserCreationTime(int userId); int getUserSwitchability(int userId); boolean isUserSwitcherEnabled(boolean showEvenIfNotActionable, int mUserId); + @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.MANAGE_USERS)") + int getUserLogoutability(int userId); boolean isRestricted(int userId); boolean canHaveRestrictedProfile(int userId); boolean canAddPrivateProfile(int userId); diff --git a/core/java/android/os/SharedMemory.java b/core/java/android/os/SharedMemory.java index 46ae9d8682ee..320641ded0f9 100644 --- a/core/java/android/os/SharedMemory.java +++ b/core/java/android/os/SharedMemory.java @@ -25,8 +25,6 @@ import android.system.OsConstants; import dalvik.system.VMRuntime; -import libcore.io.IoUtils; - import java.io.Closeable; import java.io.FileDescriptor; import java.io.IOException; @@ -65,7 +63,7 @@ public final class SharedMemory implements Parcelable, Closeable { mMemoryRegistration = new MemoryRegistration(mSize); mCleaner = Cleaner.create(mFileDescriptor, - new Closer(mFileDescriptor, mMemoryRegistration)); + new Closer(mFileDescriptor.getInt$(), mMemoryRegistration)); } /** @@ -278,6 +276,7 @@ public final class SharedMemory implements Parcelable, Closeable { */ @Override public void close() { + mFileDescriptor.setInt$(-1); if (mCleaner != null) { mCleaner.clean(); mCleaner = null; @@ -327,20 +326,21 @@ public final class SharedMemory implements Parcelable, Closeable { * Cleaner that closes the FD */ private static final class Closer implements Runnable { - private FileDescriptor mFd; + private int mFd; private MemoryRegistration mMemoryReference; - private Closer(FileDescriptor fd, MemoryRegistration memoryReference) { + private Closer(int fd, MemoryRegistration memoryReference) { mFd = fd; - IoUtils.setFdOwner(mFd, this); mMemoryReference = memoryReference; } @Override public void run() { - IoUtils.closeQuietly(mFd); - mFd = null; - + try { + FileDescriptor fd = new FileDescriptor(); + fd.setInt$(mFd); + Os.close(fd); + } catch (ErrnoException e) { /* swallow error */ } mMemoryReference.release(); mMemoryReference = null; } diff --git a/core/java/android/os/UserManager.java b/core/java/android/os/UserManager.java index ce93c71ac776..c00f31db1a38 100644 --- a/core/java/android/os/UserManager.java +++ b/core/java/android/os/UserManager.java @@ -2261,6 +2261,45 @@ public class UserManager { public @interface UserSwitchabilityResult {} /** + * Indicates that user can logout. + * @hide + */ + public static final int LOGOUTABILITY_STATUS_OK = 0; + + /** + * Indicates that user cannot logout because it is the system user. + * @hide + */ + public static final int LOGOUTABILITY_STATUS_CANNOT_LOGOUT_SYSTEM_USER = 1; + + /** + * Indicates that user cannot logout because there is no suitable user to logout to. This is + * generally applicable to Headless System User Mode devices that do not have an interactive + * system user. + * @hide + */ + public static final int LOGOUTABILITY_STATUS_NO_SUITABLE_USER_TO_LOGOUT_TO = 2; + + /** + * Indicates that user cannot logout because user switch cannot happen. + * @hide + */ + public static final int LOGOUTABILITY_STATUS_CANNOT_SWITCH = 3; + + /** + * Result returned in {@link #getUserLogoutability()} indicating user logoutability. + * @hide + */ + @Retention(RetentionPolicy.SOURCE) + @IntDef(flag = false, prefix = { "LOGOUTABILITY_STATUS_" }, value = { + LOGOUTABILITY_STATUS_OK, + LOGOUTABILITY_STATUS_CANNOT_LOGOUT_SYSTEM_USER, + LOGOUTABILITY_STATUS_NO_SUITABLE_USER_TO_LOGOUT_TO, + LOGOUTABILITY_STATUS_CANNOT_SWITCH + }) + public @interface UserLogoutability {} + + /** * A response code from {@link #removeUserWhenPossible(UserHandle, boolean)} indicating that * the specified user has been successfully removed. * @@ -2737,6 +2776,35 @@ public class UserManager { } /** + * Returns whether logging out is currently allowed for the context user. + * + * <p>Logging out is not allowed in the following cases: + * <ol> + * <li>the user is system user + * <li>there is no suitable user to logout to (if no interactive system user) + * <li>the user is in a phone call + * <li>{@link #DISALLOW_USER_SWITCH} is set + * <li>system user hasn't been unlocked yet + * </ol> + * + * @return A {@link UserLogoutability} flag indicating if the user can logout, + * one of {@link #LOGOUTABILITY_STATUS_OK}, + * {@link #LOGOUTABILITY_STATUS_CANNOT_LOGOUT_SYSTEM_USER}, + * {@link #LOGOUTABILITY_STATUS_NO_SUITABLE_USER_TO_LOGOUT_TO}, + * {@link #LOGOUTABILITY_STATUS_CANNOT_SWITCH}. + * @hide + */ + @UserHandleAware + @RequiresPermission(Manifest.permission.MANAGE_USERS) + public @UserLogoutability int getUserLogoutability() { + try { + return mService.getUserLogoutability(mUserId); + } catch (RemoteException re) { + throw re.rethrowFromSystemServer(); + } + } + + /** * Returns the userId for the context user. * * @return the userId of the context user. diff --git a/core/java/android/service/chooser/flags.aconfig b/core/java/android/service/chooser/flags.aconfig index 2b75493a369e..ae0b56e6f009 100644 --- a/core/java/android/service/chooser/flags.aconfig +++ b/core/java/android/service/chooser/flags.aconfig @@ -2,6 +2,16 @@ package: "android.service.chooser" container: "system" flag { + name: "announce_shortcuts_and_suggested_apps_legacy" + namespace: "intentresolver" + description: "Enable talkback announcement for the app shortcuts and the suggested apps target groups in the legacy sharesheet codebase." + bug: "380211084" + metadata { + purpose: PURPOSE_BUGFIX + } +} + +flag { name: "chooser_album_text" is_exported: true namespace: "intentresolver" diff --git a/core/java/android/view/DisplayInfo.java b/core/java/android/view/DisplayInfo.java index e75b1b0bd17a..ecdbaa3cd2f4 100644 --- a/core/java/android/view/DisplayInfo.java +++ b/core/java/android/view/DisplayInfo.java @@ -493,8 +493,6 @@ public final class DisplayInfo implements Parcelable { && logicalDensityDpi == other.logicalDensityDpi && physicalXDpi == other.physicalXDpi && physicalYDpi == other.physicalYDpi - && appVsyncOffsetNanos == other.appVsyncOffsetNanos - && presentationDeadlineNanos == other.presentationDeadlineNanos && state == other.state && committedState == other.committedState && ownerUid == other.ownerUid @@ -517,6 +515,8 @@ public final class DisplayInfo implements Parcelable { if (compareRefreshRate) { return isEqualWithoutRefreshRate && (getRefreshRate() == other.getRefreshRate()) + && appVsyncOffsetNanos == other.appVsyncOffsetNanos + && presentationDeadlineNanos == other.presentationDeadlineNanos && (modeId == other.modeId); } return isEqualWithoutRefreshRate; diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java index 23c43f56f2bc..900f22d2b37b 100644 --- a/core/java/android/view/ViewRootImpl.java +++ b/core/java/android/view/ViewRootImpl.java @@ -123,6 +123,7 @@ import static android.view.flags.Flags.toolkitFrameRateTouchBoost25q1; import static android.view.flags.Flags.toolkitFrameRateTypingReadOnly; import static android.view.flags.Flags.toolkitFrameRateVelocityMappingReadOnly; import static android.view.flags.Flags.toolkitFrameRateViewEnablingReadOnly; +import static android.view.flags.Flags.toolkitInitialTouchBoost; import static android.view.flags.Flags.toolkitMetricsForFrameRateDecision; import static android.view.flags.Flags.toolkitSetFrameRateReadOnly; import static android.view.inputmethod.InputMethodEditorTraceProto.InputMethodClientsTraceProto.ClientSideProto.IME_FOCUS_CONTROLLER; @@ -1113,9 +1114,13 @@ public final class ViewRootImpl implements ViewParent, private boolean mIsFrameRateConflicted = false; // Used to check whether SurfaceControl has been replaced. private boolean mSurfaceReplaced = false; + // Indicates whether a draw operation occurred during this frame while a touch event was active. + private boolean mTouchAndDrawn = false; // Used to set frame rate compatibility. @Surface.FrameRateCompatibility int mFrameRateCompatibility = FRAME_RATE_COMPATIBILITY_FIXED_SOURCE; + // time for initial touch boost period. + private static final int FRAME_RATE_INITIAL_TOUCH_BOOST_TIME = 30; // time for touch boost period. private static final int FRAME_RATE_TOUCH_BOOST_TIME = 3000; // Timeout for the other frame rate boosts other than touch boost. @@ -1213,6 +1218,7 @@ public final class ViewRootImpl implements ViewParent, private static boolean sSurfaceFlingerBugfixFlagValue = com.android.graphics.surfaceflinger.flags.Flags.vrrBugfix24q4(); private static final boolean sEnableVrr = ViewProperties.vrr_enabled().orElse(true); + private static final boolean sToolkitInitialTouchBoostFlagValue = toolkitInitialTouchBoost(); static { sToolkitSetFrameRateReadOnlyFlagValue = toolkitSetFrameRateReadOnly(); @@ -4435,6 +4441,10 @@ public final class ViewRootImpl implements ViewParent, // We set the preferred frame rate and frame rate category at the end of performTraversals // when the values are applicable. if (mDrawnThisFrame) { + if (sToolkitInitialTouchBoostFlagValue && mIsTouchBoosting) { + mTouchAndDrawn = true; + } + mDrawnThisFrame = false; if (!mInvalidationIdleMessagePosted && sSurfaceFlingerBugfixFlagValue) { mInvalidationIdleMessagePosted = true; @@ -6718,6 +6728,7 @@ public final class ViewRootImpl implements ViewParent, private static final int MSG_REFRESH_POINTER_ICON = 41; private static final int MSG_FRAME_RATE_SETTING = 42; private static final int MSG_SURFACE_REPLACED_TIMEOUT = 43; + private static final int MSG_INITIAL_TOUCH_BOOST_TIMEOUT = 44; final class ViewRootHandler extends Handler { @Override @@ -6791,6 +6802,8 @@ public final class ViewRootImpl implements ViewParent, return "MSG_FRAME_RATE_SETTING"; case MSG_SURFACE_REPLACED_TIMEOUT: return "MSG_SURFACE_REPLACED_TIMEOUT"; + case MSG_INITIAL_TOUCH_BOOST_TIMEOUT: + return "MSG_INITIAL_TOUCH_BOOST_TIMEOUT"; } return super.getMessageName(message); } @@ -7066,6 +7079,17 @@ public final class ViewRootImpl implements ViewParent, setPreferredFrameRateCategory(FRAME_RATE_CATEGORY_NO_PREFERENCE); } break; + case MSG_INITIAL_TOUCH_BOOST_TIMEOUT: + if (mTouchAndDrawn) { + mHandler.removeMessages(MSG_TOUCH_BOOST_TIMEOUT); + mHandler.sendEmptyMessageDelayed(MSG_TOUCH_BOOST_TIMEOUT, + FRAME_RATE_TOUCH_BOOST_TIME); + } else { + mIsTouchBoosting = false; + setPreferredFrameRateCategory(FRAME_RATE_CATEGORY_NO_PREFERENCE); + } + mTouchAndDrawn = false; + break; case MSG_REFRESH_POINTER_ICON: if (mPointerIconEvent == null) { break; @@ -8130,9 +8154,16 @@ public final class ViewRootImpl implements ViewParent, */ if (mIsTouchBoosting && (action == MotionEvent.ACTION_UP || action == MotionEvent.ACTION_CANCEL)) { - mHandler.removeMessages(MSG_TOUCH_BOOST_TIMEOUT); - mHandler.sendEmptyMessageDelayed(MSG_TOUCH_BOOST_TIMEOUT, - FRAME_RATE_TOUCH_BOOST_TIME); + + if (sToolkitInitialTouchBoostFlagValue) { + mHandler.removeMessages(MSG_INITIAL_TOUCH_BOOST_TIMEOUT); + mHandler.sendEmptyMessageDelayed(MSG_INITIAL_TOUCH_BOOST_TIMEOUT, + FRAME_RATE_INITIAL_TOUCH_BOOST_TIME); + } else { + mHandler.removeMessages(MSG_TOUCH_BOOST_TIMEOUT); + mHandler.sendEmptyMessageDelayed(MSG_TOUCH_BOOST_TIMEOUT, + FRAME_RATE_TOUCH_BOOST_TIME); + } } return handled ? FINISH_HANDLED : FORWARD; } @@ -9318,6 +9349,16 @@ public final class ViewRootImpl implements ViewParent, return mVibrator; } + /** + * Clears the system vibrator. + * + * <p>This method releases the reference to the system vibrator. It's crucial to call this + * method when the vibrator is no longer needed to prevent any potential memory leaks. + */ + public void clearSystemVibrator() { + mVibrator = null; + } + private @Nullable AutofillManager getAutofillManager() { if (mView instanceof ViewGroup) { ViewGroup decorView = (ViewGroup) mView; diff --git a/core/java/android/view/flags/refresh_rate_flags.aconfig b/core/java/android/view/flags/refresh_rate_flags.aconfig index 675e5a1b4804..3bc2205f8e1c 100644 --- a/core/java/android/view/flags/refresh_rate_flags.aconfig +++ b/core/java/android/view/flags/refresh_rate_flags.aconfig @@ -136,4 +136,11 @@ flag { description: "Feature flag to not suppress touch boost for specific windowTypes in VRR V QPR2" bug: "335874198" is_exported: true +} + +flag { + name: "toolkit_initial_touch_boost" + namespace: "toolkit" + description: "Feature flag to update initial touch boost logic" + bug: "393004744" }
\ No newline at end of file diff --git a/core/java/android/window/WindowContainerTransaction.java b/core/java/android/window/WindowContainerTransaction.java index 68b5a261f507..1156503cf8e8 100644 --- a/core/java/android/window/WindowContainerTransaction.java +++ b/core/java/android/window/WindowContainerTransaction.java @@ -1130,6 +1130,19 @@ public final class WindowContainerTransaction implements Parcelable { } /** + * Adds a hierarchy op for app compat reachability. + * + * @param container The token for the container Task + * @param taskId The id of the current task + * @hide + */ + public WindowContainerTransaction setReachabilityOffset( + @NonNull WindowContainerToken container, int taskId, int x, int y) { + mHierarchyOps.add(HierarchyOp.createForReachability(container.asBinder(), taskId, x, y)); + return this; + } + + /** * Merges another WCT into this one. * @param transfer When true, this will transfer everything from other potentially leaving * other in an unusable state. When false, other is left alone, but @@ -1590,6 +1603,7 @@ public final class WindowContainerTransaction implements Parcelable { public static final int HIERARCHY_OP_TYPE_SET_KEYGUARD_STATE = 22; public static final int HIERARCHY_OP_TYPE_SET_DISABLE_LAUNCH_ADJACENT = 23; public static final int HIERARCHY_OP_TYPE_REMOVE_ROOT_TASK = 24; + public static final int HIERARCHY_OP_TYPE_APP_COMPAT_REACHABILITY = 25; @IntDef(prefix = {"HIERARCHY_OP_TYPE_"}, value = { HIERARCHY_OP_TYPE_REPARENT, @@ -1617,6 +1631,7 @@ public final class WindowContainerTransaction implements Parcelable { HIERARCHY_OP_TYPE_SET_KEYGUARD_STATE, HIERARCHY_OP_TYPE_SET_DISABLE_LAUNCH_ADJACENT, HIERARCHY_OP_TYPE_REMOVE_ROOT_TASK, + HIERARCHY_OP_TYPE_APP_COMPAT_REACHABILITY, }) @Retention(RetentionPolicy.SOURCE) public @interface HierarchyOpType { @@ -1630,6 +1645,10 @@ public final class WindowContainerTransaction implements Parcelable { public static final String LAUNCH_KEY_SHORTCUT_CALLING_PACKAGE = "android:transaction.hop.shortcut_calling_package"; + // The following keys are used to define the reachability direction after a double tap. + public static final String REACHABILITY_EVENT_X = "android:transaction.reachability_x"; + public static final String REACHABILITY_EVENT_Y = "android:transaction.reachability_y"; + @HierarchyOpType private final int mType; @@ -1665,6 +1684,9 @@ public final class WindowContainerTransaction implements Parcelable { private Bundle mLaunchOptions; @Nullable + private Bundle mAppCompatOptions; + + @Nullable private Intent mActivityIntent; /** Used as options for {@link #addTaskFragmentOperation}. */ @@ -1833,7 +1855,21 @@ public final class WindowContainerTransaction implements Parcelable { .build(); } - /** Creates a hierarchy op for setting a task non-trimmable by recents. */ + /** Create a hierarchy op for app compat reachability. */ + @NonNull + public static HierarchyOp createForReachability(IBinder container, int taskId, int x, + int y) { + final Bundle appCompatOptions = new Bundle(); + appCompatOptions.putInt(LAUNCH_KEY_TASK_ID, taskId); + appCompatOptions.putInt(REACHABILITY_EVENT_X, x); + appCompatOptions.putInt(REACHABILITY_EVENT_Y, y); + return new HierarchyOp.Builder(HIERARCHY_OP_TYPE_APP_COMPAT_REACHABILITY) + .setAppCompatOptions(appCompatOptions) + .setContainer(container) + .build(); + } + + /** Create a hierarchy op for setting a task non-trimmable by recents. */ @NonNull @FlaggedApi(Flags.FLAG_ENABLE_DESKTOP_WINDOWING_WALLPAPER_ACTIVITY) public static HierarchyOp createForSetTaskTrimmableFromRecents(@NonNull IBinder container, @@ -1863,6 +1899,7 @@ public final class WindowContainerTransaction implements Parcelable { mWindowingModes = copy.mWindowingModes; mActivityTypes = copy.mActivityTypes; mLaunchOptions = copy.mLaunchOptions; + mAppCompatOptions = copy.mAppCompatOptions; mActivityIntent = copy.mActivityIntent; mTaskFragmentOperation = copy.mTaskFragmentOperation; mKeyguardState = copy.mKeyguardState; @@ -1889,6 +1926,7 @@ public final class WindowContainerTransaction implements Parcelable { mWindowingModes = in.createIntArray(); mActivityTypes = in.createIntArray(); mLaunchOptions = in.readBundle(); + mAppCompatOptions = in.readBundle(getClass().getClassLoader()); mActivityIntent = in.readTypedObject(Intent.CREATOR); mTaskFragmentOperation = in.readTypedObject(TaskFragmentOperation.CREATOR); mKeyguardState = in.readTypedObject(KeyguardState.CREATOR); @@ -1966,6 +2004,11 @@ public final class WindowContainerTransaction implements Parcelable { } @Nullable + public Bundle getAppCompatOptions() { + return mAppCompatOptions; + } + + @Nullable public Intent getActivityIntent() { return mActivityIntent; } @@ -2100,6 +2143,9 @@ public final class WindowContainerTransaction implements Parcelable { case HIERARCHY_OP_TYPE_LAUNCH_TASK: sb.append(mLaunchOptions); break; + case HIERARCHY_OP_TYPE_APP_COMPAT_REACHABILITY: + sb.append(mAppCompatOptions); + break; case HIERARCHY_OP_TYPE_SET_LAUNCH_ADJACENT_FLAG_ROOT: sb.append("container=").append(mContainer).append(" clearRoot=").append(mToTop); break; @@ -2182,6 +2228,7 @@ public final class WindowContainerTransaction implements Parcelable { dest.writeIntArray(mWindowingModes); dest.writeIntArray(mActivityTypes); dest.writeBundle(mLaunchOptions); + dest.writeBundle(mAppCompatOptions); dest.writeTypedObject(mActivityIntent, flags); dest.writeTypedObject(mTaskFragmentOperation, flags); dest.writeTypedObject(mKeyguardState, flags); @@ -2245,6 +2292,9 @@ public final class WindowContainerTransaction implements Parcelable { private Bundle mLaunchOptions; @Nullable + private Bundle mAppCompatOptions; + + @Nullable private Intent mActivityIntent; @Nullable @@ -2328,6 +2378,11 @@ public final class WindowContainerTransaction implements Parcelable { return this; } + Builder setAppCompatOptions(@Nullable Bundle appCompatOptions) { + mAppCompatOptions = appCompatOptions; + return this; + } + Builder setActivityIntent(@Nullable Intent activityIntent) { mActivityIntent = activityIntent; return this; @@ -2407,6 +2462,7 @@ public final class WindowContainerTransaction implements Parcelable { hierarchyOp.mToTop = mToTop; hierarchyOp.mReparentTopOnly = mReparentTopOnly; hierarchyOp.mLaunchOptions = mLaunchOptions; + hierarchyOp.mAppCompatOptions = mAppCompatOptions; hierarchyOp.mActivityIntent = mActivityIntent; hierarchyOp.mPendingIntent = mPendingIntent; hierarchyOp.mAlwaysOnTop = mAlwaysOnTop; diff --git a/core/java/android/window/flags/lse_desktop_experience.aconfig b/core/java/android/window/flags/lse_desktop_experience.aconfig index 6634ee0e1020..ef0e94fbc024 100644 --- a/core/java/android/window/flags/lse_desktop_experience.aconfig +++ b/core/java/android/window/flags/lse_desktop_experience.aconfig @@ -565,6 +565,13 @@ flag { } flag { + name: "enable_display_disconnect_interaction" + namespace: "lse_desktop_experience" + description: "Enables new interaction that occurs when a display is disconnected." + bug: "391652399" +} + +flag { name: "show_desktop_experience_dev_option" namespace: "lse_desktop_experience" description: "Replace the freeform windowing dev options with a desktop experience one." diff --git a/core/java/android/window/flags/windowing_frontend.aconfig b/core/java/android/window/flags/windowing_frontend.aconfig index 9f6ea42c6fc4..25dc6723aa78 100644 --- a/core/java/android/window/flags/windowing_frontend.aconfig +++ b/core/java/android/window/flags/windowing_frontend.aconfig @@ -460,4 +460,15 @@ flag { metadata { purpose: PURPOSE_BUGFIX } +} + +flag { + name: "clear_system_vibrator" + namespace: "windowing_frontend" + description: "Clears the system vibrator before attaching new window, to avoid leaks." + bug: "393190314" + is_fixed_read_only: true + metadata { + purpose: PURPOSE_BUGFIX + } }
\ No newline at end of file diff --git a/core/java/com/android/internal/app/ChooserGridLayoutManager.java b/core/java/com/android/internal/app/ChooserGridLayoutManager.java index c50ebd9562c9..69d2abc7d998 100644 --- a/core/java/com/android/internal/app/ChooserGridLayoutManager.java +++ b/core/java/com/android/internal/app/ChooserGridLayoutManager.java @@ -16,9 +16,20 @@ package com.android.internal.app; +import static android.service.chooser.Flags.announceShortcutsAndSuggestedAppsLegacy; + +import android.annotation.Nullable; import android.content.Context; import android.util.AttributeSet; +import android.view.View; +import android.view.ViewGroup; +import android.view.accessibility.AccessibilityNodeInfo; +import android.view.accessibility.AccessibilityNodeInfo.CollectionInfo; +import android.widget.GridView; +import android.widget.TextView; +import com.android.internal.R; +import com.android.internal.app.ChooserActivity.ChooserGridAdapter; import com.android.internal.widget.GridLayoutManager; import com.android.internal.widget.RecyclerView; @@ -28,6 +39,11 @@ import com.android.internal.widget.RecyclerView; */ public class ChooserGridLayoutManager extends GridLayoutManager { + private CharSequence mShortcutGroupTitle = ""; + private CharSequence mSuggestedAppsGroupTitle = ""; + private CharSequence mAllAppListGroupTitle = ""; + @Nullable + private RecyclerView mRecyclerView; private boolean mVerticalScrollEnabled = true; /** @@ -39,6 +55,9 @@ public class ChooserGridLayoutManager extends GridLayoutManager { public ChooserGridLayoutManager(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { super(context, attrs, defStyleAttr, defStyleRes); + if (announceShortcutsAndSuggestedAppsLegacy()) { + readGroupTitles(context); + } } /** @@ -49,6 +68,9 @@ public class ChooserGridLayoutManager extends GridLayoutManager { */ public ChooserGridLayoutManager(Context context, int spanCount) { super(context, spanCount); + if (announceShortcutsAndSuggestedAppsLegacy()) { + readGroupTitles(context); + } } /** @@ -61,6 +83,27 @@ public class ChooserGridLayoutManager extends GridLayoutManager { public ChooserGridLayoutManager(Context context, int spanCount, int orientation, boolean reverseLayout) { super(context, spanCount, orientation, reverseLayout); + if (announceShortcutsAndSuggestedAppsLegacy()) { + readGroupTitles(context); + } + } + + private void readGroupTitles(Context context) { + mShortcutGroupTitle = context.getString(R.string.shortcut_group_a11y_title); + mSuggestedAppsGroupTitle = context.getString(R.string.suggested_apps_group_a11y_title); + mAllAppListGroupTitle = context.getString(R.string.all_apps_group_a11y_title); + } + + @Override + public void onAttachedToWindow(RecyclerView view) { + super.onAttachedToWindow(view); + mRecyclerView = view; + } + + @Override + public void onDetachedFromWindow(RecyclerView view, RecyclerView.Recycler recycler) { + super.onDetachedFromWindow(view, recycler); + mRecyclerView = null; } @Override @@ -78,4 +121,89 @@ public class ChooserGridLayoutManager extends GridLayoutManager { public boolean canScrollVertically() { return mVerticalScrollEnabled && super.canScrollVertically(); } + + @Override + public void onInitializeAccessibilityNodeInfoForItem( + RecyclerView.Recycler recycler, + RecyclerView.State state, + View host, + AccessibilityNodeInfo info) { + super.onInitializeAccessibilityNodeInfoForItem(recycler, state, host, info); + if (announceShortcutsAndSuggestedAppsLegacy() && host instanceof ViewGroup) { + if (host.getId() == R.id.shortcuts_container) { + info.setClassName(GridView.class.getName()); + info.setContainerTitle(mShortcutGroupTitle); + info.setCollectionInfo(createShortcutsA11yCollectionInfo((ViewGroup) host)); + } else if (host.getId() == R.id.chooser_row) { + RecyclerView.Adapter adapter = + mRecyclerView == null ? null : mRecyclerView.getAdapter(); + ChooserListAdapter gridAdapter = adapter instanceof ChooserGridAdapter + ? ((ChooserGridAdapter) adapter).getListAdapter() + : null; + info.setClassName(GridView.class.getName()); + info.setCollectionInfo(createSuggestedAppsA11yCollectionInfo((ViewGroup) host)); + if (gridAdapter == null || gridAdapter.getAlphaTargetCount() > 0) { + info.setContainerTitle(mSuggestedAppsGroupTitle); + } else { + // if all applications fit into one row, they will be put into the suggested + // applications group. + info.setContainerTitle(mAllAppListGroupTitle); + } + } + } + } + + @Override + public void onInitializeAccessibilityNodeInfo(RecyclerView.Recycler recycler, + RecyclerView.State state, AccessibilityNodeInfo info) { + super.onInitializeAccessibilityNodeInfo(recycler, state, info); + if (announceShortcutsAndSuggestedAppsLegacy()) { + info.setContainerTitle(mAllAppListGroupTitle); + } + } + + @Override + public boolean isLayoutHierarchical(RecyclerView.Recycler recycler, RecyclerView.State state) { + return announceShortcutsAndSuggestedAppsLegacy() + || super.isLayoutHierarchical(recycler, state); + } + + private CollectionInfo createShortcutsA11yCollectionInfo(ViewGroup container) { + int rowCount = 0; + int columnCount = 0; + for (int i = 0; i < container.getChildCount(); i++) { + View row = container.getChildAt(i); + int rowColumnCount = 0; + if (row instanceof ViewGroup rowGroup && row.getVisibility() == View.VISIBLE) { + for (int j = 0; j < rowGroup.getChildCount(); j++) { + View v = rowGroup.getChildAt(j); + if (v != null && v.getVisibility() == View.VISIBLE) { + rowColumnCount++; + if (v instanceof TextView) { + // A special case of the no-targets message that also contains an + // off-screen item (which looks like a bug). + rowColumnCount = 1; + break; + } + } + } + } + if (rowColumnCount > 0) { + rowCount++; + columnCount = Math.max(columnCount, rowColumnCount); + } + } + return CollectionInfo.obtain(rowCount, columnCount, false); + } + + private CollectionInfo createSuggestedAppsA11yCollectionInfo(ViewGroup container) { + int columnCount = 0; + for (int i = 0; i < container.getChildCount(); i++) { + View v = container.getChildAt(i); + if (v.getVisibility() == View.VISIBLE) { + columnCount++; + } + } + return CollectionInfo.obtain(1, columnCount, false); + } } diff --git a/core/java/com/android/internal/os/BatteryStatsHistory.java b/core/java/com/android/internal/os/BatteryStatsHistory.java index f49c5f1c2b0f..036faef7aa65 100644 --- a/core/java/com/android/internal/os/BatteryStatsHistory.java +++ b/core/java/com/android/internal/os/BatteryStatsHistory.java @@ -34,45 +34,38 @@ import android.os.Build; import android.os.Parcel; import android.os.ParcelFormatException; import android.os.Process; -import android.os.StatFs; import android.os.SystemClock; import android.os.SystemProperties; import android.os.Trace; import android.util.ArraySet; -import android.util.AtomicFile; import android.util.Slog; import android.util.SparseArray; import com.android.internal.annotations.GuardedBy; import com.android.internal.annotations.VisibleForTesting; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayList; -import java.util.Collections; import java.util.ConcurrentModificationException; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.Set; import java.util.concurrent.locks.ReentrantLock; /** * BatteryStatsHistory encapsulates battery history files. * Battery history record is appended into buffer {@link #mHistoryBuffer} and backed up into - * {@link #mActiveFile}. - * When {@link #mHistoryBuffer} size reaches {@link BatteryStatsImpl.Constants#MAX_HISTORY_BUFFER}, + * {@link #mActiveFragment}. + * When {@link #mHistoryBuffer} size reaches {@link #mMaxHistoryBufferSize}, * current mActiveFile is closed and a new mActiveFile is open. * History files are under directory /data/system/battery-history/. - * History files have name battery-history-<num>.bin. The file number <num> starts from zero and - * grows sequentially. + * History files have name <num>.bf. The file number <num> corresponds to the + * monotonic time when the file was started. * The mActiveFile is always the highest numbered history file. * The lowest number file is always the oldest file. * The highest number file is always the newest file. - * The file number grows sequentially and we never skip number. - * When count of history files exceeds {@link BatteryStatsImpl.Constants#MAX_HISTORY_FILES}, + * The file number grows monotonically and we never skip number. + * When the total size of history files exceeds the maximum allowed value, * the lowest numbered file is deleted and a new file is open. * * All interfaces in BatteryStatsHistory should only be called by BatteryStatsImpl and protected by @@ -86,10 +79,6 @@ public class BatteryStatsHistory { // Current on-disk Parcel version. Must be updated when the format of the parcelable changes private static final int VERSION = 212; - private static final String HISTORY_DIR = "battery-history"; - private static final String FILE_SUFFIX = ".bh"; - private static final int MIN_FREE_SPACE = 100 * 1024 * 1024; - // Part of initial delta int that specifies the time delta. static final int DELTA_TIME_MASK = 0x7ffff; static final int DELTA_TIME_LONG = 0x7ffff; // The delta is a following long @@ -135,7 +124,7 @@ public class BatteryStatsHistory { // For state1, trace everything except the wakelock bit (which can race with // suspend) and the running bit (which isn't meaningful in traces). static final int STATE1_TRACE_MASK = ~(HistoryItem.STATE_WAKE_LOCK_FLAG - | HistoryItem.STATE_CPU_RUNNING_FLAG); + | HistoryItem.STATE_CPU_RUNNING_FLAG); // For state2, trace all bit changes. static final int STATE2_TRACE_MASK = ~0; @@ -146,22 +135,132 @@ public class BatteryStatsHistory { */ private static final int EXTRA_BUFFER_SIZE_WHEN_DIR_LOCKED = 100_000; + public abstract static class BatteryHistoryFragment + implements Comparable<BatteryHistoryFragment> { + public final long monotonicTimeMs; + + public BatteryHistoryFragment(long monotonicTimeMs) { + this.monotonicTimeMs = monotonicTimeMs; + } + + @Override + public int compareTo(BatteryHistoryFragment o) { + return Long.compare(monotonicTimeMs, o.monotonicTimeMs); + } + + @Override + public boolean equals(Object o) { + return monotonicTimeMs == ((BatteryHistoryFragment) o).monotonicTimeMs; + } + + @Override + public int hashCode() { + return Long.hashCode(monotonicTimeMs); + } + } + + /** + * Persistent storage for battery history fragments + */ + public interface BatteryHistoryStore { + /** + * Returns the table of contents, in the chronological order. + */ + List<BatteryHistoryFragment> getFragments(); + + /** + * Returns the earliest available fragment + */ + @Nullable + BatteryHistoryFragment getEarliestFragment(); + + /** + * Returns the latest available fragment + */ + @Nullable + BatteryHistoryFragment getLatestFragment(); + + /** + * Given a fragment, returns the earliest fragment that follows it whose monotonic + * start time falls within the specified range. `startTimeMs` is inclusive, `endTimeMs` + * is exclusive. + */ + @Nullable + BatteryHistoryFragment getNextFragment(BatteryHistoryFragment current, long startTimeMs, + long endTimeMs); + + /** + * Acquires a lock on the entire store. + */ + void lock(); + + /** + * Acquires a lock unless the store is already locked by a different thread. Returns true + * if the lock has been successfully acquired. + */ + boolean tryLock(); + + /** + * Unlocks the store. + */ + void unlock(); + + /** + * Returns true if the store is currently locked. + */ + boolean isLocked(); + + /** + * Returns the total amount of storage occupied by history fragments, in bytes. + */ + int getSize(); + + /** + * Returns true if the store contains any history fragments, excluding the currently + * active partial fragment. + */ + boolean hasCompletedFragments(); + + /** + * Creates a new empty history fragment starting at the specified time. + */ + BatteryHistoryFragment createFragment(long monotonicStartTime); + + /** + * Writes a fragment to disk as raw bytes. + * + * @param fragmentComplete indicates if this fragment is done or still partial. + */ + void writeFragment(BatteryHistoryFragment fragment, @NonNull byte[] bytes, + boolean fragmentComplete); + + /** + * Reads a fragment as raw bytes. + */ + @Nullable + byte[] readFragment(BatteryHistoryFragment fragment); + + /** + * Removes all persistent fragments + */ + void reset(); + } + private final Parcel mHistoryBuffer; - private final File mSystemDir; private final HistoryStepDetailsCalculator mStepDetailsCalculator; private final Clock mClock; private int mMaxHistoryBufferSize; /** - * The active history file that the history buffer is backed up into. + * The active history fragment that the history buffer is backed up into. */ - private AtomicFile mActiveFile; + private BatteryHistoryFragment mActiveFragment; /** - * A list of history files with increasing timestamps. + * Persistent storage of history files. */ - private final BatteryHistoryDirectory mHistoryDir; + private final BatteryHistoryStore mStore; /** * A list of small history parcels, used when BatteryStatsImpl object is created from @@ -172,7 +271,7 @@ public class BatteryStatsHistory { /** * When iterating history files, the current file index. */ - private BatteryHistoryFile mCurrentFile; + private BatteryHistoryFragment mCurrentFragment; /** * When iterating history files, the current file parcel. @@ -221,326 +320,6 @@ public class BatteryStatsHistory { private int mIteratorCookie; private final BatteryStatsHistory mWritableHistory; - private static class BatteryHistoryFile implements Comparable<BatteryHistoryFile> { - public final long monotonicTimeMs; - public final AtomicFile atomicFile; - - private BatteryHistoryFile(File directory, long monotonicTimeMs) { - this.monotonicTimeMs = monotonicTimeMs; - atomicFile = new AtomicFile(new File(directory, monotonicTimeMs + FILE_SUFFIX)); - } - - @Override - public int compareTo(BatteryHistoryFile o) { - return Long.compare(monotonicTimeMs, o.monotonicTimeMs); - } - - @Override - public boolean equals(Object o) { - return monotonicTimeMs == ((BatteryHistoryFile) o).monotonicTimeMs; - } - - @Override - public int hashCode() { - return Long.hashCode(monotonicTimeMs); - } - - @Override - public String toString() { - return atomicFile.getBaseFile().toString(); - } - } - - private static class BatteryHistoryDirectory { - private final File mDirectory; - private final MonotonicClock mMonotonicClock; - private int mMaxHistorySize; - private final List<BatteryHistoryFile> mHistoryFiles = new ArrayList<>(); - private final ReentrantLock mLock = new ReentrantLock(); - private boolean mCleanupNeeded; - - BatteryHistoryDirectory(File directory, MonotonicClock monotonicClock, int maxHistorySize) { - mDirectory = directory; - mMonotonicClock = monotonicClock; - mMaxHistorySize = maxHistorySize; - if (mMaxHistorySize == 0) { - Slog.w(TAG, "mMaxHistorySize should not be zero when writing history"); - } - } - - void setMaxHistorySize(int maxHistorySize) { - mMaxHistorySize = maxHistorySize; - cleanup(); - } - - void lock() { - mLock.lock(); - } - - boolean tryLock() { - return mLock.tryLock(); - } - - void unlock() { - mLock.unlock(); - if (mCleanupNeeded) { - cleanup(); - } - } - - boolean isLocked() { - return mLock.isLocked(); - } - - void load() { - Trace.asyncTraceBegin(TRACE_TAG_SYSTEM_SERVER, "BatteryStatsHistory.load", 0); - mDirectory.mkdirs(); - if (!mDirectory.exists()) { - Slog.wtf(TAG, "HistoryDir does not exist:" + mDirectory.getPath()); - } - - final List<File> toRemove = new ArrayList<>(); - final Set<BatteryHistoryFile> dedup = new ArraySet<>(); - mDirectory.listFiles((dir, name) -> { - final int b = name.lastIndexOf(FILE_SUFFIX); - if (b <= 0) { - toRemove.add(new File(dir, name)); - return false; - } - try { - long monotonicTime = Long.parseLong(name.substring(0, b)); - dedup.add(new BatteryHistoryFile(mDirectory, monotonicTime)); - } catch (NumberFormatException e) { - toRemove.add(new File(dir, name)); - return false; - } - return true; - }); - if (!dedup.isEmpty()) { - mHistoryFiles.addAll(dedup); - Collections.sort(mHistoryFiles); - } - if (!toRemove.isEmpty()) { - // Clear out legacy history files, which did not follow the X-Y.bin naming format. - BackgroundThread.getHandler().post(() -> { - lock(); - try { - for (File file : toRemove) { - file.delete(); - } - } finally { - unlock(); - Trace.asyncTraceEnd(TRACE_TAG_SYSTEM_SERVER, "BatteryStatsHistory.load", 0); - } - }); - } else { - Trace.asyncTraceEnd(TRACE_TAG_SYSTEM_SERVER, "BatteryStatsHistory.load", 0); - } - } - - List<String> getFileNames() { - lock(); - try { - List<String> names = new ArrayList<>(); - for (BatteryHistoryFile historyFile : mHistoryFiles) { - names.add(historyFile.atomicFile.getBaseFile().getName()); - } - return names; - } finally { - unlock(); - } - } - - @Nullable - BatteryHistoryFile getFirstFile() { - lock(); - try { - if (!mHistoryFiles.isEmpty()) { - return mHistoryFiles.get(0); - } - return null; - } finally { - unlock(); - } - } - - @Nullable - BatteryHistoryFile getLastFile() { - lock(); - try { - if (!mHistoryFiles.isEmpty()) { - return mHistoryFiles.get(mHistoryFiles.size() - 1); - } - return null; - } finally { - unlock(); - } - } - - @Nullable - BatteryHistoryFile getNextFile(BatteryHistoryFile current, long startTimeMs, - long endTimeMs) { - if (!mLock.isHeldByCurrentThread()) { - throw new IllegalStateException("Iterating battery history without a lock"); - } - - int nextFileIndex = 0; - int firstFileIndex = 0; - // skip the last file because its data is in history buffer. - int lastFileIndex = mHistoryFiles.size() - 2; - for (int i = lastFileIndex; i >= 0; i--) { - BatteryHistoryFile file = mHistoryFiles.get(i); - if (current != null && file.monotonicTimeMs == current.monotonicTimeMs) { - nextFileIndex = i + 1; - } - if (file.monotonicTimeMs > endTimeMs) { - lastFileIndex = i - 1; - } - if (file.monotonicTimeMs <= startTimeMs) { - firstFileIndex = i; - break; - } - } - - if (nextFileIndex < firstFileIndex) { - nextFileIndex = firstFileIndex; - } - - if (nextFileIndex <= lastFileIndex) { - return mHistoryFiles.get(nextFileIndex); - } - - return null; - } - - BatteryHistoryFile makeBatteryHistoryFile() { - BatteryHistoryFile file = new BatteryHistoryFile(mDirectory, - mMonotonicClock.monotonicTime()); - lock(); - try { - mHistoryFiles.add(file); - } finally { - unlock(); - } - return file; - } - - void writeToParcel(Parcel out, boolean useBlobs, - long preferredEarliestIncludedTimestampMs) { - Trace.traceBegin(TRACE_TAG_SYSTEM_SERVER, "BatteryStatsHistory.writeToParcel"); - lock(); - try { - final long start = SystemClock.uptimeMillis(); - for (int i = 0; i < mHistoryFiles.size() - 1; i++) { - long monotonicEndTime = Long.MAX_VALUE; - if (i < mHistoryFiles.size() - 1) { - monotonicEndTime = mHistoryFiles.get(i + 1).monotonicTimeMs; - } - - if (monotonicEndTime < preferredEarliestIncludedTimestampMs) { - continue; - } - - AtomicFile file = mHistoryFiles.get(i).atomicFile; - byte[] raw = new byte[0]; - try { - raw = file.readFully(); - } catch (Exception e) { - Slog.e(TAG, "Error reading file " + file.getBaseFile().getPath(), e); - } - - out.writeBoolean(true); - if (useBlobs) { - out.writeBlob(raw); - } else { - // Avoiding blobs in the check-in file for compatibility - out.writeByteArray(raw); - } - } - out.writeBoolean(false); - if (DEBUG) { - Slog.d(TAG, - "writeToParcel duration ms:" + (SystemClock.uptimeMillis() - start)); - } - } finally { - unlock(); - Trace.traceEnd(TRACE_TAG_SYSTEM_SERVER); - } - } - - int getFileCount() { - lock(); - try { - return mHistoryFiles.size(); - } finally { - unlock(); - } - } - - int getSize() { - lock(); - try { - int ret = 0; - for (int i = 0; i < mHistoryFiles.size() - 1; i++) { - ret += (int) mHistoryFiles.get(i).atomicFile.getBaseFile().length(); - } - return ret; - } finally { - unlock(); - } - } - - void reset() { - lock(); - try { - if (DEBUG) Slog.i(TAG, "********** CLEARING HISTORY!"); - for (BatteryHistoryFile file : mHistoryFiles) { - file.atomicFile.delete(); - } - mHistoryFiles.clear(); - } finally { - unlock(); - } - } - - private void cleanup() { - Trace.traceBegin(TRACE_TAG_SYSTEM_SERVER, "BatteryStatsHistory.cleanup"); - try { - if (mDirectory == null) { - return; - } - - if (!tryLock()) { - mCleanupNeeded = true; - return; - } - - mCleanupNeeded = false; - try { - // if free disk space is less than 100MB, delete oldest history file. - if (!hasFreeDiskSpace(mDirectory)) { - BatteryHistoryFile oldest = mHistoryFiles.remove(0); - oldest.atomicFile.delete(); - } - - // if there is more history stored than allowed, delete oldest history files. - int size = getSize(); - while (size > mMaxHistorySize) { - BatteryHistoryFile oldest = mHistoryFiles.get(0); - int length = (int) oldest.atomicFile.getBaseFile().length(); - oldest.atomicFile.delete(); - mHistoryFiles.remove(0); - size -= length; - } - } finally { - unlock(); - } - } finally { - Trace.traceEnd(TRACE_TAG_SYSTEM_SERVER); - } - } - } - /** * A delegate responsible for computing additional details for a step in battery history. */ @@ -621,24 +400,22 @@ public class BatteryStatsHistory { /** * Constructor * - * @param systemDir typically /data/system - * @param maxHistorySize the largest amount of battery history to keep on disk * @param maxHistoryBufferSize the most amount of RAM to used for buffering of history steps */ - public BatteryStatsHistory(Parcel historyBuffer, File systemDir, - int maxHistorySize, int maxHistoryBufferSize, - HistoryStepDetailsCalculator stepDetailsCalculator, Clock clock, - MonotonicClock monotonicClock, TraceDelegate tracer, EventLogger eventLogger) { - this(historyBuffer, systemDir, maxHistorySize, maxHistoryBufferSize, stepDetailsCalculator, + public BatteryStatsHistory(Parcel historyBuffer, int maxHistoryBufferSize, + @Nullable BatteryHistoryStore store, HistoryStepDetailsCalculator stepDetailsCalculator, + Clock clock, MonotonicClock monotonicClock, TraceDelegate tracer, + EventLogger eventLogger) { + this(historyBuffer, maxHistoryBufferSize, store, + stepDetailsCalculator, clock, monotonicClock, tracer, eventLogger, null); } - private BatteryStatsHistory(@Nullable Parcel historyBuffer, @Nullable File systemDir, - int maxHistorySize, int maxHistoryBufferSize, + private BatteryStatsHistory(@Nullable Parcel historyBuffer, int maxHistoryBufferSize, + @Nullable BatteryHistoryStore store, @NonNull HistoryStepDetailsCalculator stepDetailsCalculator, @NonNull Clock clock, @NonNull MonotonicClock monotonicClock, @NonNull TraceDelegate tracer, @NonNull EventLogger eventLogger, @Nullable BatteryStatsHistory writableHistory) { - mSystemDir = systemDir; mMaxHistoryBufferSize = maxHistoryBufferSize; mStepDetailsCalculator = stepDetailsCalculator; mTracer = tracer; @@ -659,18 +436,16 @@ public class BatteryStatsHistory { } if (writableHistory != null) { - mHistoryDir = writableHistory.mHistoryDir; - } else if (systemDir != null) { - mHistoryDir = new BatteryHistoryDirectory(new File(systemDir, HISTORY_DIR), - monotonicClock, maxHistorySize); - mHistoryDir.load(); - BatteryHistoryFile activeFile = mHistoryDir.getLastFile(); - if (activeFile == null) { - activeFile = mHistoryDir.makeBatteryHistoryFile(); - } - setActiveFile(activeFile); + mStore = writableHistory.mStore; } else { - mHistoryDir = null; + mStore = store; + if (mStore != null) { + BatteryHistoryFragment activeFile = mStore.getLatestFragment(); + if (activeFile == null) { + activeFile = mStore.createFragment(mMonotonicClock.monotonicTime()); + } + setActiveFragment(activeFile); + } } } @@ -681,8 +456,7 @@ public class BatteryStatsHistory { private BatteryStatsHistory(Parcel parcel) { mClock = Clock.SYSTEM_CLOCK; mTracer = null; - mSystemDir = null; - mHistoryDir = null; + mStore = null; mStepDetailsCalculator = null; mEventLogger = new EventLogger(); mWritableHistory = null; @@ -718,15 +492,6 @@ public class BatteryStatsHistory { } /** - * Changes the maximum amount of history to be kept on disk. - */ - public void setMaxHistorySize(int maxHistorySize) { - if (mHistoryDir != null) { - mHistoryDir.setMaxHistorySize(maxHistorySize); - } - } - - /** * Changes the maximum size of the history buffer, in bytes. */ public void setMaxHistoryBufferSize(int maxHistoryBufferSize) { @@ -745,8 +510,8 @@ public class BatteryStatsHistory { Parcel historyBufferCopy = Parcel.obtain(); historyBufferCopy.appendFrom(mHistoryBuffer, 0, mHistoryBuffer.dataSize()); - return new BatteryStatsHistory(historyBufferCopy, mSystemDir, 0, 0, null, null, - null, null, mEventLogger, this); + return new BatteryStatsHistory(historyBufferCopy, 0, mStore, null, + null, null, null, mEventLogger, this); } } finally { Trace.traceEnd(TRACE_TAG_SYSTEM_SERVER); @@ -757,45 +522,40 @@ public class BatteryStatsHistory { * Returns true if this instance only supports reading history. */ public boolean isReadOnly() { - return !mMutable || mActiveFile == null/* || mHistoryDir == null*/; + return !mMutable || mActiveFragment == null || mStore == null; } /** * Set the active file that mHistoryBuffer is backed up into. */ - private void setActiveFile(BatteryHistoryFile file) { - mActiveFile = file.atomicFile; + private void setActiveFragment(BatteryHistoryFragment file) { + mActiveFragment = file; if (DEBUG) { - Slog.d(TAG, "activeHistoryFile:" + mActiveFile.getBaseFile().getPath()); + Slog.d(TAG, "activeHistoryFile:" + mActiveFragment); } } /** - * When {@link #mHistoryBuffer} reaches {@link BatteryStatsImpl.Constants#MAX_HISTORY_BUFFER}, - * create next history file. + * When {@link #mHistoryBuffer} reaches {@link #mMaxHistoryBufferSize}, + * create next history fragment. */ - public void startNextFile(long elapsedRealtimeMs) { + public void startNextFragment(long elapsedRealtimeMs) { synchronized (this) { - startNextFileLocked(elapsedRealtimeMs); + startNextFragmentLocked(elapsedRealtimeMs); } } @GuardedBy("this") - private void startNextFileLocked(long elapsedRealtimeMs) { + private void startNextFragmentLocked(long elapsedRealtimeMs) { final long start = SystemClock.uptimeMillis(); - writeHistory(); + writeHistory(true /* fragmentComplete */); if (DEBUG) { Slog.d(TAG, "writeHistory took ms:" + (SystemClock.uptimeMillis() - start)); } - setActiveFile(mHistoryDir.makeBatteryHistoryFile()); - try { - mActiveFile.getBaseFile().createNewFile(); - } catch (IOException e) { - Slog.e(TAG, "Could not create history file: " + mActiveFile.getBaseFile()); - } - - mHistoryBufferStartTime = mMonotonicClock.monotonicTime(elapsedRealtimeMs); + long monotonicStartTime = mMonotonicClock.monotonicTime(elapsedRealtimeMs); + setActiveFragment(mStore.createFragment(monotonicStartTime)); + mHistoryBufferStartTime = monotonicStartTime; mHistoryBuffer.setDataSize(0); mHistoryBuffer.setDataPosition(0); mHistoryBuffer.setDataCapacity(mMaxHistoryBufferSize / 2); @@ -810,7 +570,6 @@ public class BatteryStatsHistory { } mWrittenPowerStatsDescriptors.clear(); - mHistoryDir.cleanup(); } /** @@ -818,7 +577,7 @@ public class BatteryStatsHistory { * currently being read. */ public boolean isResetEnabled() { - return mHistoryDir == null || !mHistoryDir.isLocked(); + return mStore == null || !mStore.isLocked(); } /** @@ -827,11 +586,11 @@ public class BatteryStatsHistory { */ public void reset() { synchronized (this) { - if (mHistoryDir != null) { - mHistoryDir.reset(); - setActiveFile(mHistoryDir.makeBatteryHistoryFile()); - } initHistoryBuffer(); + if (mStore != null) { + mStore.reset(); + setActiveFragment(mStore.createFragment(mHistoryBufferStartTime)); + } } } @@ -840,9 +599,9 @@ public class BatteryStatsHistory { */ public long getStartTime() { synchronized (this) { - BatteryHistoryFile file = mHistoryDir.getFirstFile(); - if (file != null) { - return file.monotonicTimeMs; + BatteryHistoryFragment firstFragment = mStore.getEarliestFragment(); + if (firstFragment != null) { + return firstFragment.monotonicTimeMs; } else { return mHistoryBufferStartTime; } @@ -863,10 +622,10 @@ public class BatteryStatsHistory { return copy().iterate(startTimeMs, endTimeMs); } - if (mHistoryDir != null) { - mHistoryDir.lock(); + if (mStore != null) { + mStore.lock(); } - mCurrentFile = null; + mCurrentFragment = null; mCurrentParcel = null; mCurrentParcelEnd = 0; mParcelIndex = 0; @@ -883,8 +642,8 @@ public class BatteryStatsHistory { */ void iteratorFinished() { mHistoryBuffer.setDataPosition(mHistoryBuffer.dataSize()); - if (mHistoryDir != null) { - mHistoryDir.unlock(); + if (mStore != null) { + mStore.unlock(); } Trace.asyncTraceEnd(TRACE_TAG_SYSTEM_SERVER, "BatteryStatsHistory.iterate", mIteratorCookie); @@ -918,27 +677,26 @@ public class BatteryStatsHistory { } } - if (mHistoryDir != null) { - BatteryHistoryFile nextFile = mHistoryDir.getNextFile(mCurrentFile, startTimeMs, + if (mStore != null) { + BatteryHistoryFragment next = mStore.getNextFragment(mCurrentFragment, startTimeMs, endTimeMs); - while (nextFile != null) { + while (next != null) { mCurrentParcel = null; mCurrentParcelEnd = 0; final Parcel p = Parcel.obtain(); - AtomicFile file = nextFile.atomicFile; - if (readFileToParcel(p, file)) { + if (readFragmentToParcel(p, next)) { int bufSize = p.readInt(); int curPos = p.dataPosition(); mCurrentParcelEnd = curPos + bufSize; mCurrentParcel = p; if (curPos < mCurrentParcelEnd) { - mCurrentFile = nextFile; + mCurrentFragment = next; return mCurrentParcel; } } else { p.recycle(); } - nextFile = mHistoryDir.getNextFile(nextFile, startTimeMs, endTimeMs); + next = mStore.getNextFragment(next, startTimeMs, endTimeMs); } } @@ -988,39 +746,26 @@ public class BatteryStatsHistory { * Read history file into a parcel. * * @param out the Parcel read into. - * @param file the File to read from. + * @param fragment the fragment to read from. * @return true if success, false otherwise. */ - public boolean readFileToParcel(Parcel out, AtomicFile file) { - Trace.traceBegin(TRACE_TAG_SYSTEM_SERVER, "BatteryStatsHistory.read"); - try { - byte[] raw = null; - try { - final long start = SystemClock.uptimeMillis(); - raw = file.readFully(); - if (DEBUG) { - Slog.d(TAG, "readFileToParcel:" + file.getBaseFile().getPath() - + " duration ms:" + (SystemClock.uptimeMillis() - start)); - } - } catch (Exception e) { - Slog.e(TAG, "Error reading file " + file.getBaseFile().getPath(), e); - return false; - } - out.unmarshall(raw, 0, raw.length); - out.setDataPosition(0); - if (!verifyVersion(out)) { - return false; - } - // skip monotonic time field. - out.readLong(); - // skip monotonic end time field - out.readLong(); - // skip monotonic size field - out.readLong(); - return true; - } finally { - Trace.traceEnd(TRACE_TAG_SYSTEM_SERVER); + public boolean readFragmentToParcel(Parcel out, BatteryHistoryFragment fragment) { + byte[] data = mStore.readFragment(fragment); + if (data == null) { + return false; + } + out.unmarshall(data, 0, data.length); + out.setDataPosition(0); + if (!verifyVersion(out)) { + return false; } + // skip monotonic time field. + out.readLong(); + // skip monotonic end time field + out.readLong(); + // skip monotonic size field + out.readLong(); + return true; } /** @@ -1106,9 +851,8 @@ public class BatteryStatsHistory { public void writeToParcel(Parcel out) { synchronized (this) { writeHistoryBuffer(out); - /* useBlobs */ - if (mHistoryDir != null) { - mHistoryDir.writeToParcel(out, false /* useBlobs */, 0); + if (mStore != null) { + writeToParcel(out, false /* useBlobs */, 0); } } } @@ -1122,13 +866,54 @@ public class BatteryStatsHistory { public void writeToBatteryUsageStatsParcel(Parcel out, long preferredHistoryDurationMs) { synchronized (this) { out.writeBlob(mHistoryBuffer.marshall()); - if (mHistoryDir != null) { - mHistoryDir.writeToParcel(out, true /* useBlobs */, + if (mStore != null) { + writeToParcel(out, true /* useBlobs */, mHistoryMonotonicEndTime - preferredHistoryDurationMs); } } } + private void writeToParcel(Parcel out, boolean useBlobs, + long preferredEarliestIncludedTimestampMs) { + Trace.traceBegin(TRACE_TAG_SYSTEM_SERVER, "BatteryStatsHistory.writeToParcel"); + mStore.lock(); + try { + final long start = SystemClock.uptimeMillis(); + List<BatteryHistoryFragment> fragments = mStore.getFragments(); + for (int i = 0; i < fragments.size() - 1; i++) { + long monotonicEndTime = Long.MAX_VALUE; + if (i < fragments.size() - 1) { + monotonicEndTime = fragments.get(i + 1).monotonicTimeMs; + } + + if (monotonicEndTime < preferredEarliestIncludedTimestampMs) { + continue; + } + + byte[] data = mStore.readFragment(fragments.get(i)); + if (data == null) { + Slog.e(TAG, "Error reading history fragment " + fragments.get(i)); + continue; + } + + out.writeBoolean(true); + if (useBlobs) { + out.writeBlob(data, 0, data.length); + } else { + // Avoiding blobs in the check-in file for compatibility + out.writeByteArray(data, 0, data.length); + } + } + out.writeBoolean(false); + if (DEBUG) { + Slog.d(TAG, "writeToParcel duration ms:" + (SystemClock.uptimeMillis() - start)); + } + } finally { + mStore.unlock(); + Trace.traceEnd(TRACE_TAG_SYSTEM_SERVER); + } + } + /** * Reads a BatteryStatsHistory from a parcel written with * the {@link #writeToBatteryUsageStatsParcel} method. @@ -1141,28 +926,21 @@ public class BatteryStatsHistory { * Read history from a check-in file. */ public boolean readSummary() { - if (mActiveFile == null) { + if (mActiveFragment == null) { Slog.w(TAG, "readSummary: no history file associated with this instance"); return false; } Parcel parcel = Parcel.obtain(); try { - final long start = SystemClock.uptimeMillis(); - if (mActiveFile.exists()) { - byte[] raw = mActiveFile.readFully(); - if (raw.length > 0) { - parcel.unmarshall(raw, 0, raw.length); - parcel.setDataPosition(0); - readHistoryBuffer(parcel); - } - if (DEBUG) { - Slog.d(TAG, "read history file::" - + mActiveFile.getBaseFile().getPath() - + " bytes:" + raw.length + " took ms:" + (SystemClock.uptimeMillis() - - start)); - } + byte[] data = mStore.readFragment(mActiveFragment); + if (data == null) { + return false; } + + parcel.unmarshall(data, 0, data.length); + parcel.setDataPosition(0); + readHistoryBuffer(parcel); } catch (Exception e) { Slog.e(TAG, "Error reading battery history", e); reset(); @@ -1201,41 +979,21 @@ public class BatteryStatsHistory { } } - /** - * @return true if there is more than 100MB free disk space left. - */ - @android.ravenwood.annotation.RavenwoodReplace - private static boolean hasFreeDiskSpace(File systemDir) { - final StatFs stats = new StatFs(systemDir.getAbsolutePath()); - return stats.getAvailableBytes() > MIN_FREE_SPACE; - } - - private static boolean hasFreeDiskSpace$ravenwood(File systemDir) { - return true; - } - @VisibleForTesting - public List<String> getFilesNames() { - return mHistoryDir.getFileNames(); + public BatteryHistoryStore getBatteryHistoryStore() { + return mStore; } @VisibleForTesting - public AtomicFile getActiveFile() { - return mActiveFile; - } - - /** - * Returns the maximum storage size allocated to battery history. - */ - public int getMaxHistorySize() { - return mHistoryDir.mMaxHistorySize; + public BatteryHistoryFragment getActiveFragment() { + return mActiveFragment; } /** * @return the total size of all history files and history buffer. */ public int getHistoryUsedSize() { - int ret = mHistoryDir.getSize(); + int ret = mStore.getSize(); ret += mHistoryBuffer.dataSize(); if (mHistoryParcels != null) { for (int i = 0; i < mHistoryParcels.size(); i++) { @@ -1293,7 +1051,7 @@ public class BatteryStatsHistory { */ public void continueRecordingHistory() { synchronized (this) { - if (mHistoryBuffer.dataPosition() <= 0 && mHistoryDir.getFileCount() <= 1) { + if (mHistoryBuffer.dataPosition() <= 0 && !mStore.hasCompletedFragments()) { return; } @@ -1852,7 +1610,7 @@ public class BatteryStatsHistory { } final long timeDiffMs = mMonotonicClock.monotonicTime(elapsedRealtimeMs) - - mHistoryLastWritten.time; + - mHistoryLastWritten.time; final int diffStates = mHistoryLastWritten.states ^ cur.states; final int diffStates2 = mHistoryLastWritten.states2 ^ cur.states2; final int lastDiffStates = mHistoryLastWritten.states ^ mHistoryLastLastWritten.states; @@ -1953,7 +1711,7 @@ public class BatteryStatsHistory { mMaxHistoryBufferSize = 1024; } - boolean successfullyLocked = mHistoryDir.tryLock(); + boolean successfullyLocked = mStore.tryLock(); if (!successfullyLocked) { // Already locked by another thread // If the buffer size is below the allowed overflow limit, just keep going if (dataSize < mMaxHistoryBufferSize + EXTRA_BUFFER_SIZE_WHEN_DIR_LOCKED) { @@ -1971,10 +1729,10 @@ public class BatteryStatsHistory { copy.setTo(cur); try { - startNextFile(elapsedRealtimeMs); + startNextFragment(elapsedRealtimeMs); } finally { if (successfullyLocked) { - mHistoryDir.unlock(); + mStore.unlock(); } } @@ -2095,6 +1853,7 @@ public class BatteryStatsHistory { Battery charge int: if F in the first token is set, an int representing the battery charge in coulombs follows. */ + /** * Writes the delta between the previous and current history items into history buffer. */ @@ -2376,9 +2135,13 @@ public class BatteryStatsHistory { } /** - * Saves the accumulated history buffer in the active file, see {@link #getActiveFile()} . + * Saves the accumulated history buffer in the active file, see {@link #getActiveFragment()} . */ public void writeHistory() { + writeHistory(false /* fragmentComplete */); + } + + private void writeHistory(boolean fragmentComplete) { synchronized (this) { if (isReadOnly()) { Slog.w(TAG, "writeHistory: this instance instance is read-only"); @@ -2397,7 +2160,7 @@ public class BatteryStatsHistory { Slog.d(TAG, "writeHistoryBuffer duration ms:" + (SystemClock.uptimeMillis() - start) + " bytes:" + p.dataSize()); } - writeParcelToFileLocked(p, mActiveFile); + writeParcelLocked(p, mActiveFragment, fragmentComplete); } finally { p.recycle(); } @@ -2457,30 +2220,18 @@ public class BatteryStatsHistory { } @GuardedBy("this") - private void writeParcelToFileLocked(Parcel p, AtomicFile file) { - FileOutputStream fos = null; + private void writeParcelLocked(Parcel p, BatteryHistoryFragment fragment, + boolean fragmentComplete) { mWriteLock.lock(); try { final long startTimeMs = SystemClock.uptimeMillis(); - fos = file.startWrite(); - fos.write(p.marshall()); - fos.flush(); - file.finishWrite(fos); - if (DEBUG) { - Slog.d(TAG, "writeParcelToFileLocked file:" + file.getBaseFile().getPath() - + " duration ms:" + (SystemClock.uptimeMillis() - startTimeMs) - + " bytes:" + p.dataSize()); - } + mStore.writeFragment(fragment, p.marshall(), fragmentComplete); mEventLogger.writeCommitSysConfigFile(startTimeMs); - } catch (IOException e) { - Slog.w(TAG, "Error writing battery statistics", e); - file.failWrite(fos); } finally { mWriteLock.unlock(); } } - /** * Returns the total number of history tags in the tag pool. */ diff --git a/core/java/com/android/internal/policy/PhoneWindow.java b/core/java/com/android/internal/policy/PhoneWindow.java index 90f8a0714a04..d73e2d47348b 100644 --- a/core/java/com/android/internal/policy/PhoneWindow.java +++ b/core/java/com/android/internal/policy/PhoneWindow.java @@ -436,6 +436,9 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { if (viewRoot != null) { // Clear the old callbacks and attach to the new window. viewRoot.getOnBackInvokedDispatcher().clear(); + if (Flags.clearSystemVibrator()) { + viewRoot.clearSystemVibrator(); + } onViewRootImplSet(viewRoot); } } diff --git a/core/jni/android_view_SurfaceControlActivePictureListener.cpp b/core/jni/android_view_SurfaceControlActivePictureListener.cpp index 15132db2a569..ee8efe19e15e 100644 --- a/core/jni/android_view_SurfaceControlActivePictureListener.cpp +++ b/core/jni/android_view_SurfaceControlActivePictureListener.cpp @@ -106,11 +106,13 @@ struct SurfaceControlActivePictureListener : public gui::BnActivePictureListener } status_t startListening() { - return SurfaceComposerClient::addActivePictureListener(this); + return SurfaceComposerClient::addActivePictureListener( + sp<SurfaceControlActivePictureListener>::fromExisting(this)); } status_t stopListening() { - return SurfaceComposerClient::removeActivePictureListener(this); + return SurfaceComposerClient::removeActivePictureListener( + sp<SurfaceControlActivePictureListener>::fromExisting(this)); } protected: diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml index c8ad7dae28d4..c9f4cdc8e3ce 100644 --- a/core/res/AndroidManifest.xml +++ b/core/res/AndroidManifest.xml @@ -9247,7 +9247,7 @@ android:permission="android.permission.BIND_JOB_SERVICE" > </service> - <service android:name="com.android.server.ZramMaintenance" + <service android:name="com.android.server.memory.ZramMaintenance" android:exported="false" android:permission="android.permission.BIND_JOB_SERVICE" > </service> diff --git a/core/res/res/layout/chooser_row.xml b/core/res/res/layout/chooser_row.xml index f5814c3251f6..8463bf4e07e5 100644 --- a/core/res/res/layout/chooser_row.xml +++ b/core/res/res/layout/chooser_row.xml @@ -17,6 +17,7 @@ */ --> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:id="@+id/chooser_row" android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="100dp" diff --git a/core/res/res/layout/chooser_row_direct_share.xml b/core/res/res/layout/chooser_row_direct_share.xml index d7e36eedfe92..53e666a629bb 100644 --- a/core/res/res/layout/chooser_row_direct_share.xml +++ b/core/res/res/layout/chooser_row_direct_share.xml @@ -17,6 +17,7 @@ */ --> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:id="@+id/shortcuts_container" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="200dp"> diff --git a/core/res/res/layout/notification_2025_reply_container.xml b/core/res/res/layout/notification_2025_reply_history_container.xml index 6923b59f34dc..6923b59f34dc 100644 --- a/core/res/res/layout/notification_2025_reply_container.xml +++ b/core/res/res/layout/notification_2025_reply_history_container.xml diff --git a/core/res/res/layout/notification_2025_template_expanded_base.xml b/core/res/res/layout/notification_2025_template_expanded_base.xml index d364c659d0db..e12db2783191 100644 --- a/core/res/res/layout/notification_2025_template_expanded_base.xml +++ b/core/res/res/layout/notification_2025_template_expanded_base.xml @@ -67,7 +67,7 @@ </FrameLayout> <ViewStub - android:layout="@layout/notification_2025_reply_container" + android:layout="@layout/notification_2025_reply_history_container" android:id="@+id/notification_material_reply_container" android:layout_width="match_parent" android:layout_height="wrap_content" diff --git a/core/res/res/layout/notification_2025_template_expanded_big_picture.xml b/core/res/res/layout/notification_2025_template_expanded_big_picture.xml index 12e11728f608..fac9d1c47f41 100644 --- a/core/res/res/layout/notification_2025_template_expanded_big_picture.xml +++ b/core/res/res/layout/notification_2025_template_expanded_big_picture.xml @@ -74,8 +74,8 @@ /> <ViewStub - android:layout="@layout/notification_material_reply_text" - android:id="@+id/notification_2025_reply_container" + android:layout="@layout/notification_2025_reply_history_container" + android:id="@+id/notification_material_reply_container" android:layout_width="match_parent" android:layout_height="wrap_content" /> diff --git a/core/res/res/layout/notification_2025_template_expanded_big_text.xml b/core/res/res/layout/notification_2025_template_expanded_big_text.xml index c9dd868795de..4a807cb674c6 100644 --- a/core/res/res/layout/notification_2025_template_expanded_big_text.xml +++ b/core/res/res/layout/notification_2025_template_expanded_big_text.xml @@ -73,8 +73,8 @@ </com.android.internal.widget.RemeasuringLinearLayout> <ViewStub - android:layout="@layout/notification_material_reply_text" - android:id="@+id/notification_2025_reply_container" + android:layout="@layout/notification_2025_reply_history_container" + android:id="@+id/notification_material_reply_container" android:layout_width="match_parent" android:layout_height="wrap_content" /> diff --git a/core/res/res/layout/notification_2025_template_expanded_inbox.xml b/core/res/res/layout/notification_2025_template_expanded_inbox.xml index 8434b3644f81..ccab02e312cc 100644 --- a/core/res/res/layout/notification_2025_template_expanded_inbox.xml +++ b/core/res/res/layout/notification_2025_template_expanded_inbox.xml @@ -116,10 +116,12 @@ android:layout_weight="1" /> </LinearLayout> - <ViewStub android:layout="@layout/notification_material_reply_text" - android:id="@+id/notification_2025_reply_container" - android:layout_width="match_parent" - android:layout_height="wrap_content" /> + <ViewStub + android:layout="@layout/notification_2025_reply_history_container" + android:id="@+id/notification_material_reply_container" + android:layout_width="match_parent" + android:layout_height="wrap_content" + /> <include layout="@layout/notification_template_smart_reply_container" android:layout_width="match_parent" android:layout_height="wrap_content" diff --git a/core/res/res/layout/notification_2025_template_expanded_progress.xml b/core/res/res/layout/notification_2025_template_expanded_progress.xml index 5d4fc4c87fac..87ded8975cb0 100644 --- a/core/res/res/layout/notification_2025_template_expanded_progress.xml +++ b/core/res/res/layout/notification_2025_template_expanded_progress.xml @@ -103,8 +103,8 @@ </FrameLayout> <ViewStub - android:layout="@layout/notification_material_reply_text" - android:id="@+id/notification_2025_reply_container" + android:layout="@layout/notification_2025_reply_history_container" + android:id="@+id/notification_material_reply_container" android:layout_width="match_parent" android:layout_height="wrap_content" /> diff --git a/core/res/res/values/attrs_manifest.xml b/core/res/res/values/attrs_manifest.xml index 3edc5c108083..aaf84201821f 100644 --- a/core/res/res/values/attrs_manifest.xml +++ b/core/res/res/values/attrs_manifest.xml @@ -1862,9 +1862,38 @@ <enum name="sync" value="2" /> </attr> - <!-- This attribute will be used to override app compatibility mode on 16 KB devices. - If set to enabled, Natives lib will be extracted from APK if they are not page aligned on - 16 KB device. 4 KB natives libs will be loaded app-compat mode if they are eligible. + <!-- This attribute overrides the user-set or platform-set 16 KB page size + compatibility mode, so that page agnostic compatibility is always enabled + or always disabled, rather than according to the user's preference. + + <p>On 4 KB systems, this attribute is ignored and apps are installed + normally. + + <p>On 16 KB systems, if an app is built for 16 KB page sizes, this + attribute is ignored and apps are installed normally. + + <p>This attribute only affects 16 KB systems for apps that are built + with 4 KB page size (old) options. + + <p>When page agnostic compatibility is enabled (either through this + flag or via the user's preference), the system specializes the app + installation process in ways known to improve compatibility of 4 KB + built apps on 16 KB systems. That is, apps which do not have aligned + libraries in APK files are extracted, requiring more space on the + device. An additional specialization when this option is enabled is + that the linker loads the application in a special mode intended + to allow 4 KB aligned program segments to load on a 16 KB page system. + + <p>Here are the situations where this attribute should be most useful: + <ul> + <li>If an app works on 16 KB mode, but is not built for it, enabling this + attribute forces the app to be installed in 16 KB mode without + the user having to set these options themself. + <li>If an app is fully working in 16 KB mode, you can set this + attribute to disabled, so that any regression causes a clear failure + and this compatibility mode is not used. + </ul> + @FlaggedApi(android.content.pm.Flags.FLAG_APP_COMPAT_OPTION_16KB) --> <attr name="pageSizeCompat"> <!-- value for enabled must match with diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml index 9399e2b9824e..ed86bd2ddc00 100644 --- a/core/res/res/values/strings.xml +++ b/core/res/res/values/strings.xml @@ -5744,6 +5744,16 @@ <string name="unpin_specific_target">Unpin <xliff:g id="label" example="Tweet">%1$s</xliff:g></string> <!-- View application info for a target. --> <string name="app_info">App info</string> + <!-- Accessibility announcement for the shortcut group (https://developer.android.com/training/sharing/direct-share-targets) + in the list of targets. [CHAR LIMIT=NONE]--> + <string name="shortcut_group_a11y_title">Direct share targets</string> + <!-- Accessibility announcement for the suggested application group in the list of targets. + [CHAR LIMIT=NONE] --> + <string name="suggested_apps_group_a11y_title">App suggestions</string> + <!-- Accessibility announcement for the all-applications group in the list of targets. + [CHAR LIMIT=NONE] --> + <string name="all_apps_group_a11y_title">App list</string> + <!-- The representation of a time duration when negative. An example is -1:14. This can be used with a countdown timer for example.--> <string name="negative_duration">\u2212<xliff:g id="time" example="1:14">%1$s</xliff:g></string> diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index f4004fa70623..f4b7a3ffa47d 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -4730,6 +4730,8 @@ <java-symbol type="id" name="resolver_empty_state_container" /> <java-symbol type="id" name="button_bar_container" /> <java-symbol type="id" name="title_container" /> + <java-symbol type="id" name="shortcuts_container" /> + <java-symbol type="id" name="chooser_row" /> <java-symbol type="string" name="resolver_cross_profile_blocked" /> <java-symbol type="string" name="resolver_cant_share_with_work_apps_explanation" /> <java-symbol type="string" name="resolver_cant_share_with_personal_apps_explanation" /> @@ -4739,6 +4741,9 @@ <java-symbol type="string" name="resolver_no_work_apps_available" /> <java-symbol type="string" name="resolver_no_personal_apps_available" /> <java-symbol type="string" name="resolver_switch_on_work" /> + <java-symbol type="string" name="shortcut_group_a11y_title" /> + <java-symbol type="string" name="suggested_apps_group_a11y_title" /> + <java-symbol type="string" name="all_apps_group_a11y_title" /> <java-symbol type="drawable" name="ic_screenshot_edit" /> <java-symbol type="dimen" name="resolver_empty_state_height" /> <java-symbol type="dimen" name="resolver_empty_state_height_with_tabs" /> diff --git a/core/tests/coretests/src/android/view/ViewFrameRateTest.java b/core/tests/coretests/src/android/view/ViewFrameRateTest.java index 8b4f714fbf65..45f1a096aa85 100644 --- a/core/tests/coretests/src/android/view/ViewFrameRateTest.java +++ b/core/tests/coretests/src/android/view/ViewFrameRateTest.java @@ -26,6 +26,7 @@ import static android.view.flags.Flags.FLAG_TOOLKIT_FRAME_RATE_ANIMATION_BUGFIX_ import static android.view.flags.Flags.FLAG_TOOLKIT_FRAME_RATE_VELOCITY_MAPPING_READ_ONLY; import static android.view.flags.Flags.FLAG_TOOLKIT_FRAME_RATE_TOUCH_BOOST_25Q1; import static android.view.flags.Flags.FLAG_TOOLKIT_FRAME_RATE_VIEW_ENABLING_READ_ONLY; +import static android.view.flags.Flags.FLAG_TOOLKIT_INITIAL_TOUCH_BOOST; import static android.view.flags.Flags.FLAG_TOOLKIT_SET_FRAME_RATE_READ_ONLY; import static android.view.flags.Flags.FLAG_VIEW_VELOCITY_API; import static android.view.flags.Flags.toolkitFrameRateBySizeReadOnly; @@ -34,6 +35,7 @@ import static android.view.flags.Flags.toolkitFrameRateSmallUsesPercentReadOnly; import static junit.framework.Assert.assertEquals; +import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import android.annotation.NonNull; @@ -180,6 +182,75 @@ public class ViewFrameRateTest { } @Test + @RequiresFlagsEnabled(FLAG_TOOLKIT_INITIAL_TOUCH_BOOST) + public void initialTouchBoost() throws Throwable { + if (!ViewProperties.vrr_enabled().orElse(true)) { + return; + } + + mActivityRule.runOnUiThread(() -> { + ViewGroup.LayoutParams layoutParams = mMovingView.getLayoutParams(); + layoutParams.width = ViewGroup.LayoutParams.MATCH_PARENT; + layoutParams.height = ViewGroup.LayoutParams.MATCH_PARENT; + mMovingView.setLayoutParams(layoutParams); + mMovingView.setOnClickListener((v) -> {}); + }); + waitForFrameRateCategoryToSettle(); + + int[] position = new int[2]; + mActivityRule.runOnUiThread(() -> { + mMovingView.getLocationOnScreen(position); + position[0] += mMovingView.getWidth() / 2; + position[1] += mMovingView.getHeight() / 2; + }); + final Instrumentation instrumentation = InstrumentationRegistry.getInstrumentation(); + + assertFalse(mViewRoot.getIsTouchBoosting()); + + long now = SystemClock.uptimeMillis(); + MotionEvent down = MotionEvent.obtain( + now, // downTime + now, // eventTime + MotionEvent.ACTION_DOWN, // action + position[0], // x + position[1], // y + 0 // metaState + ); + + mActivityRule.runOnUiThread(() -> { + mMovingView.getViewRootImpl().dispatchAppVisibility(false); + }); + + down.setSource(InputDevice.SOURCE_TOUCHSCREEN); + instrumentation.sendPointerSync(down); + down.recycle(); + + Thread.sleep(100); + // should have touch boost + assertTrue(mViewRoot.getIsTouchBoosting()); + + MotionEvent up = MotionEvent.obtain( + now, // downTime + now, // eventTime + MotionEvent.ACTION_UP, // action + position[0], // x + position[1], // y + 0 // metaState + ); + up.setSource(InputDevice.SOURCE_TOUCHSCREEN); + instrumentation.sendPointerSync(up); + up.recycle(); + + // Should not be boosted if nothing is drawn + Thread.sleep(30); + assertFalse(mViewRoot.getIsTouchBoosting()); + + mActivityRule.runOnUiThread(() -> { + mMovingView.getViewRootImpl().dispatchAppVisibility(true); + }); + } + + @Test @RequiresFlagsEnabled(FLAG_TOOLKIT_FRAME_RATE_VIEW_ENABLING_READ_ONLY) public void inputMethodWithContentMoves() throws Throwable { if (!ViewProperties.vrr_enabled().orElse(true)) { diff --git a/libs/WindowManager/Shell/res/drawable/ic_baseline_expand_more_16.xml b/libs/WindowManager/Shell/res/drawable/ic_baseline_expand_more_16.xml new file mode 100644 index 000000000000..c2a20b977b70 --- /dev/null +++ b/libs/WindowManager/Shell/res/drawable/ic_baseline_expand_more_16.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + ~ 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 + --> +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="16dp" + android:height="16dp" + android:viewportWidth="16" + android:viewportHeight="16" + android:tint="?android:attr/textColorSecondary"> + <path + android:fillColor="#FF000000" + android:pathData="M 8 11.375 L 2 5.375 L 3.4 3.975 L 8 8.575 L 12.6 3.975 L 14 5.375 L 8 11.375 Z" + /> +</vector> + diff --git a/libs/WindowManager/Shell/res/layout/desktop_mode_app_header.xml b/libs/WindowManager/Shell/res/layout/desktop_mode_app_header.xml index 87c520ca1b51..b898e4b06c14 100644 --- a/libs/WindowManager/Shell/res/layout/desktop_mode_app_header.xml +++ b/libs/WindowManager/Shell/res/layout/desktop_mode_app_header.xml @@ -64,7 +64,7 @@ android:id="@+id/expand_menu_button" android:layout_width="16dp" android:layout_height="16dp" - android:src="@drawable/ic_baseline_expand_more_24" + android:src="@drawable/ic_baseline_expand_more_16" android:background="@null" android:scaleType="fitCenter" android:clickable="false" @@ -101,7 +101,7 @@ android:layout_width="44dp" android:layout_height="40dp" android:layout_gravity="end" - android:layout_marginHorizontal="8dp" + android:layout_marginEnd="8dp" android:clickable="true" android:focusable="true"/> diff --git a/libs/WindowManager/Shell/res/values/dimen.xml b/libs/WindowManager/Shell/res/values/dimen.xml index 404bbd1d0a33..e23d5725e9c3 100644 --- a/libs/WindowManager/Shell/res/values/dimen.xml +++ b/libs/WindowManager/Shell/res/values/dimen.xml @@ -295,6 +295,10 @@ <dimen name="bubble_bar_dismiss_zone_width">192dp</dimen> <!-- Height of the box around bottom center of the screen where drag only leads to dismiss --> <dimen name="bubble_bar_dismiss_zone_height">242dp</dimen> + <!-- Height of the box at the corner of the screen where drag leads to app moving to bubble --> + <dimen name="bubble_transform_area_width">140dp</dimen> + <!-- Width of the box at the corner of the screen where drag leads to app moving to bubble --> + <dimen name="bubble_transform_area_height">140dp</dimen> <!-- Bottom and end margin for compat buttons. --> <dimen name="compat_button_margin">24dp</dimen> diff --git a/libs/WindowManager/Shell/res/values/strings_tv.xml b/libs/WindowManager/Shell/res/values/strings_tv.xml index 8f806cf56c9b..b50812f36e4b 100644 --- a/libs/WindowManager/Shell/res/values/strings_tv.xml +++ b/libs/WindowManager/Shell/res/values/strings_tv.xml @@ -59,5 +59,7 @@ <!-- Accessibility action: done with moving the PiP [CHAR LIMIT=30] --> <string name="a11y_action_pip_move_done">Done</string> + <string name="font_display_medium" translatable="false">sans-serif</string> + </resources> diff --git a/libs/WindowManager/Shell/res/values/styles.xml b/libs/WindowManager/Shell/res/values/styles.xml index 8a4a7023b8e8..4ebb7dc6ff37 100644 --- a/libs/WindowManager/Shell/res/values/styles.xml +++ b/libs/WindowManager/Shell/res/values/styles.xml @@ -75,15 +75,6 @@ <item name="android:background">@color/split_divider_background</item> </style> - <style name="TvPipEduText"> - <item name="android:fontFamily">@*android:string/config_headlineFontFamilyMedium</item> - <item name="android:textAllCaps">true</item> - <item name="android:textSize">10sp</item> - <item name="android:lineSpacingExtra">4sp</item> - <item name="android:lineHeight">16sp</item> - <item name="android:textColor">@color/tv_pip_edu_text</item> - </style> - <style name="LetterboxDialog" parent="@android:style/Theme.DeviceDefault.Dialog.Alert"> <item name="android:layout_width">wrap_content</item> <item name="android:layout_height">wrap_content</item> diff --git a/libs/WindowManager/Shell/res/values/styles_tv.xml b/libs/WindowManager/Shell/res/values/styles_tv.xml new file mode 100644 index 000000000000..a4f5edc7fa35 --- /dev/null +++ b/libs/WindowManager/Shell/res/values/styles_tv.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2025 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. +--> + +<resources xmlns:android="http://schemas.android.com/apk/res/android"> + + <style name="TvPipEduText"> + <item name="android:fontFamily">@string/font_display_medium</item> + <item name="android:textAllCaps">true</item> + <item name="android:textFontWeight">700</item> + <item name="android:textSize">10sp</item> + <item name="android:lineSpacingExtra">4sp</item> + <item name="android:lineHeight">16sp</item> + <item name="android:textColor">@color/tv_pip_edu_text</item> + </style> + +</resources>
\ No newline at end of file diff --git a/libs/WindowManager/Shell/shared/src/com/android/wm/shell/shared/bubbles/BubbleDropTargetBoundsProvider.kt b/libs/WindowManager/Shell/shared/src/com/android/wm/shell/shared/bubbles/BubbleDropTargetBoundsProvider.kt new file mode 100644 index 000000000000..9bee11a92430 --- /dev/null +++ b/libs/WindowManager/Shell/shared/src/com/android/wm/shell/shared/bubbles/BubbleDropTargetBoundsProvider.kt @@ -0,0 +1,29 @@ +/* + * Copyright (C) 2025 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.shared.bubbles + +import android.graphics.Rect + +/** + * Provide bounds for Bubbles drop targets that are shown when dragging over drag zones + */ +interface BubbleDropTargetBoundsProvider { + /** + * Get bubble bar expanded view visual drop target bounds on screen + */ + fun getBubbleBarExpandedViewDropTargetBounds(onLeft: Boolean): Rect +}
\ No newline at end of file diff --git a/libs/WindowManager/Shell/shared/src/com/android/wm/shell/shared/bubbles/DragZone.kt b/libs/WindowManager/Shell/shared/src/com/android/wm/shell/shared/bubbles/DragZone.kt new file mode 100644 index 000000000000..5d346c047123 --- /dev/null +++ b/libs/WindowManager/Shell/shared/src/com/android/wm/shell/shared/bubbles/DragZone.kt @@ -0,0 +1,59 @@ +/* + * Copyright (C) 2025 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.shared.bubbles + +import android.graphics.Rect + +/** + * Represents an invisible area on the screen that determines what happens to a dragged object if it + * is released in that area. + * + * [bounds] are the bounds of the drag zone. Drag zones have an associated drop target that serves + * as visual feedback hinting what would happen if the object is released. When a dragged object is + * dragged into a drag zone, the associated drop target will be displayed. Not all drag zones have + * drop targets; only those that are made visible by Bubbles do. + */ +sealed interface DragZone { + + /** The bounds of this drag zone. */ + val bounds: Rect + + fun contains(x: Int, y: Int) = bounds.contains(x, y) + + /** Represents the bubble drag area on the screen. */ + sealed class Bubble(override val bounds: Rect) : DragZone { + data class Left(override val bounds: Rect, val dropTarget: Rect) : Bubble(bounds) + data class Right(override val bounds: Rect, val dropTarget: Rect) : Bubble(bounds) + } + + /** Represents dragging to Desktop Window. */ + data class DesktopWindow(override val bounds: Rect, val dropTarget: Rect) : DragZone + + /** Represents dragging to Full Screen. */ + data class FullScreen(override val bounds: Rect, val dropTarget: Rect) : DragZone + + /** Represents dragging to dismiss. */ + data class Dismiss(override val bounds: Rect) : DragZone + + /** Represents dragging to enter Split or replace a Split app. */ + sealed class Split(override val bounds: Rect) : DragZone { + data class Left(override val bounds: Rect) : Split(bounds) + data class Right(override val bounds: Rect) : Split(bounds) + data class Top(override val bounds: Rect) : Split(bounds) + data class Bottom(override val bounds: Rect) : Split(bounds) + } +} diff --git a/libs/WindowManager/Shell/shared/src/com/android/wm/shell/shared/bubbles/DragZoneFactory.kt b/libs/WindowManager/Shell/shared/src/com/android/wm/shell/shared/bubbles/DragZoneFactory.kt new file mode 100644 index 000000000000..c2eef33881be --- /dev/null +++ b/libs/WindowManager/Shell/shared/src/com/android/wm/shell/shared/bubbles/DragZoneFactory.kt @@ -0,0 +1,450 @@ +/* + * Copyright (C) 2025 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.shared.bubbles + +import android.graphics.Rect +import com.android.wm.shell.shared.bubbles.DragZoneFactory.SplitScreenModeChecker.SplitScreenMode + +/** A class for creating drag zones for dragging bubble objects or dragging into bubbles. */ +class DragZoneFactory( + private val deviceConfig: DeviceConfig, + private val splitScreenModeChecker: SplitScreenModeChecker, + private val desktopWindowModeChecker: DesktopWindowModeChecker, +) { + + private val windowBounds: Rect + get() = deviceConfig.windowBounds + + // TODO b/393172431: move these to xml + private val dismissDragZoneSize = if (deviceConfig.isSmallTablet) 140 else 200 + private val bubbleDragZoneTabletSize = 200 + private val bubbleDragZoneFoldableSize = 140 + private val fullScreenDragZoneWidth = 512 + private val fullScreenDragZoneHeight = 44 + private val desktopWindowDragZoneWidth = 880 + private val desktopWindowDragZoneHeight = 300 + private val desktopWindowFromExpandedViewDragZoneWidth = 200 + private val desktopWindowFromExpandedViewDragZoneHeight = 350 + private val splitFromBubbleDragZoneHeight = 100 + private val splitFromBubbleDragZoneWidth = 60 + private val hSplitFromExpandedViewDragZoneWidth = 60 + private val vSplitFromExpandedViewDragZoneWidth = 200 + private val vSplitFromExpandedViewDragZoneHeightTablet = 285 + private val vSplitFromExpandedViewDragZoneHeightFold = 150 + private val vUnevenSplitFromExpandedViewDragZoneHeight = 96 + + /** + * Creates the list of drag zones for the dragged object. + * + * Drag zones may have overlap, but the list is sorted by priority where the first drag zone has + * the highest priority so it should be checked first. + */ + fun createSortedDragZones(draggedObject: DraggedObject): List<DragZone> { + val dragZones = mutableListOf<DragZone>() + when (draggedObject) { + is DraggedObject.BubbleBar -> { + dragZones.add(createDismissDragZone()) + dragZones.addAll(createBubbleDragZones()) + } + is DraggedObject.Bubble -> { + dragZones.add(createDismissDragZone()) + dragZones.addAll(createBubbleDragZones()) + dragZones.add(createFullScreenDragZone()) + if (shouldShowDesktopWindowDragZones()) { + dragZones.add(createDesktopWindowDragZoneForBubble()) + } + dragZones.addAll(createSplitScreenDragZonesForBubble()) + } + is DraggedObject.ExpandedView -> { + dragZones.add(createDismissDragZone()) + dragZones.add(createFullScreenDragZone()) + if (shouldShowDesktopWindowDragZones()) { + dragZones.add(createDesktopWindowDragZoneForExpandedView()) + } + if (deviceConfig.isSmallTablet) { + dragZones.addAll(createSplitScreenDragZonesForExpandedViewOnFoldable()) + } else { + dragZones.addAll(createSplitScreenDragZonesForExpandedViewOnTablet()) + } + createBubbleDragZonesForExpandedView() + } + } + return dragZones + } + + private fun createDismissDragZone(): DragZone { + return DragZone.Dismiss( + bounds = + Rect( + windowBounds.right / 2 - dismissDragZoneSize / 2, + windowBounds.bottom - dismissDragZoneSize, + windowBounds.right / 2 + dismissDragZoneSize / 2, + windowBounds.bottom + ) + ) + } + + private fun createBubbleDragZones(): List<DragZone> { + val dragZoneSize = + if (deviceConfig.isSmallTablet) { + bubbleDragZoneFoldableSize + } else { + bubbleDragZoneTabletSize + } + return listOf( + DragZone.Bubble.Left( + bounds = + Rect(0, windowBounds.bottom - dragZoneSize, dragZoneSize, windowBounds.bottom), + dropTarget = Rect(0, 0, 0, 0), + ), + DragZone.Bubble.Right( + bounds = + Rect( + windowBounds.right - dragZoneSize, + windowBounds.bottom - dragZoneSize, + windowBounds.right, + windowBounds.bottom, + ), + dropTarget = Rect(0, 0, 0, 0), + ) + ) + } + + private fun createBubbleDragZonesForExpandedView(): List<DragZone> { + return listOf( + DragZone.Bubble.Left( + bounds = Rect(0, 0, windowBounds.right / 2, windowBounds.bottom), + dropTarget = Rect(0, 0, 0, 0), + ), + DragZone.Bubble.Right( + bounds = + Rect( + windowBounds.right / 2, + 0, + windowBounds.right, + windowBounds.bottom, + ), + dropTarget = Rect(0, 0, 0, 0), + ) + ) + } + + private fun createFullScreenDragZone(): DragZone { + return DragZone.FullScreen( + bounds = + Rect( + windowBounds.right / 2 - fullScreenDragZoneWidth / 2, + 0, + windowBounds.right / 2 + fullScreenDragZoneWidth / 2, + fullScreenDragZoneHeight + ), + dropTarget = Rect(0, 0, 0, 0) + ) + } + + private fun shouldShowDesktopWindowDragZones() = + !deviceConfig.isSmallTablet && desktopWindowModeChecker.isSupported() + + private fun createDesktopWindowDragZoneForBubble(): DragZone { + return DragZone.DesktopWindow( + bounds = + if (deviceConfig.isLandscape) { + Rect( + windowBounds.right / 2 - desktopWindowDragZoneWidth / 2, + windowBounds.bottom / 2 - desktopWindowDragZoneHeight / 2, + windowBounds.right / 2 + desktopWindowDragZoneWidth / 2, + windowBounds.bottom / 2 + desktopWindowDragZoneHeight / 2 + ) + } else { + Rect( + 0, + windowBounds.bottom / 2 - desktopWindowDragZoneHeight / 2, + windowBounds.right, + windowBounds.bottom / 2 + desktopWindowDragZoneHeight / 2 + ) + }, + dropTarget = Rect(0, 0, 0, 0) + ) + } + + private fun createDesktopWindowDragZoneForExpandedView(): DragZone { + return DragZone.DesktopWindow( + bounds = + Rect( + windowBounds.right / 2 - desktopWindowFromExpandedViewDragZoneWidth / 2, + windowBounds.bottom / 2 - desktopWindowFromExpandedViewDragZoneHeight / 2, + windowBounds.right / 2 + desktopWindowFromExpandedViewDragZoneWidth / 2, + windowBounds.bottom / 2 + desktopWindowFromExpandedViewDragZoneHeight / 2 + ), + dropTarget = Rect(0, 0, 0, 0) + ) + } + + private fun createSplitScreenDragZonesForBubble(): List<DragZone> { + // for foldables in landscape mode or tables in portrait modes we have vertical split drag + // zones. otherwise we have horizontal split drag zones. + val isVerticalSplit = deviceConfig.isSmallTablet == deviceConfig.isLandscape + return if (isVerticalSplit) { + when (splitScreenModeChecker.getSplitScreenMode()) { + SplitScreenMode.SPLIT_50_50, + SplitScreenMode.NONE -> + listOf( + DragZone.Split.Top( + bounds = Rect(0, 0, windowBounds.right, windowBounds.bottom / 2), + ), + DragZone.Split.Bottom( + bounds = + Rect( + 0, + windowBounds.bottom / 2, + windowBounds.right, + windowBounds.bottom + ), + ) + ) + SplitScreenMode.SPLIT_90_10 -> { + listOf( + DragZone.Split.Top( + bounds = + Rect( + 0, + 0, + windowBounds.right, + windowBounds.bottom - splitFromBubbleDragZoneHeight + ), + ), + DragZone.Split.Bottom( + bounds = + Rect( + 0, + windowBounds.bottom - splitFromBubbleDragZoneHeight, + windowBounds.right, + windowBounds.bottom + ), + ) + ) + } + SplitScreenMode.SPLIT_10_90 -> { + listOf( + DragZone.Split.Top( + bounds = Rect(0, 0, windowBounds.right, splitFromBubbleDragZoneHeight), + ), + DragZone.Split.Bottom( + bounds = + Rect( + 0, + splitFromBubbleDragZoneHeight, + windowBounds.right, + windowBounds.bottom + ), + ) + ) + } + } + } else { + when (splitScreenModeChecker.getSplitScreenMode()) { + SplitScreenMode.SPLIT_50_50, + SplitScreenMode.NONE -> + listOf( + DragZone.Split.Left( + bounds = Rect(0, 0, windowBounds.right / 2, windowBounds.bottom), + ), + DragZone.Split.Right( + bounds = + Rect( + windowBounds.right / 2, + 0, + windowBounds.right, + windowBounds.bottom + ), + ) + ) + SplitScreenMode.SPLIT_90_10 -> + listOf( + DragZone.Split.Left( + bounds = + Rect( + 0, + 0, + windowBounds.right - splitFromBubbleDragZoneWidth, + windowBounds.bottom + ), + ), + DragZone.Split.Right( + bounds = + Rect( + windowBounds.right - splitFromBubbleDragZoneWidth, + 0, + windowBounds.right, + windowBounds.bottom + ), + ) + ) + SplitScreenMode.SPLIT_10_90 -> + listOf( + DragZone.Split.Left( + bounds = Rect(0, 0, splitFromBubbleDragZoneWidth, windowBounds.bottom), + ), + DragZone.Split.Right( + bounds = + Rect( + splitFromBubbleDragZoneWidth, + 0, + windowBounds.right, + windowBounds.bottom + ), + ) + ) + } + } + } + + private fun createSplitScreenDragZonesForExpandedViewOnTablet(): List<DragZone> { + return if (deviceConfig.isLandscape) { + createHorizontalSplitDragZonesForExpandedView() + } else { + // for tablets in portrait mode, split drag zones appear below the full screen drag zone + // for the top split zone, and above the dismiss zone. Both are horizontally centered. + val splitZoneLeft = windowBounds.right / 2 - vSplitFromExpandedViewDragZoneWidth / 2 + val splitZoneRight = splitZoneLeft + vSplitFromExpandedViewDragZoneWidth + val bottomSplitZoneBottom = windowBounds.bottom - dismissDragZoneSize + listOf( + DragZone.Split.Top( + bounds = + Rect( + splitZoneLeft, + fullScreenDragZoneHeight, + splitZoneRight, + fullScreenDragZoneHeight + vSplitFromExpandedViewDragZoneHeightTablet + ), + ), + DragZone.Split.Bottom( + bounds = + Rect( + splitZoneLeft, + bottomSplitZoneBottom - vSplitFromExpandedViewDragZoneHeightTablet, + splitZoneRight, + bottomSplitZoneBottom + ), + ) + ) + } + } + + private fun createSplitScreenDragZonesForExpandedViewOnFoldable(): List<DragZone> { + return if (deviceConfig.isLandscape) { + // vertical split drag zones are aligned with the full screen drag zone width + val splitZoneLeft = windowBounds.right / 2 - fullScreenDragZoneWidth / 2 + when (splitScreenModeChecker.getSplitScreenMode()) { + SplitScreenMode.SPLIT_50_50, + SplitScreenMode.NONE -> + listOf( + DragZone.Split.Top( + bounds = + Rect( + splitZoneLeft, + fullScreenDragZoneHeight, + splitZoneLeft + fullScreenDragZoneWidth, + fullScreenDragZoneHeight + + vSplitFromExpandedViewDragZoneHeightFold + ), + ), + DragZone.Split.Bottom( + bounds = + Rect( + splitZoneLeft, + windowBounds.bottom / 2, + splitZoneLeft + fullScreenDragZoneWidth, + windowBounds.bottom / 2 + + vSplitFromExpandedViewDragZoneHeightFold + ), + ) + ) + // TODO b/393172431: add this zone when it's defined + SplitScreenMode.SPLIT_10_90 -> listOf() + SplitScreenMode.SPLIT_90_10 -> + listOf( + DragZone.Split.Top( + bounds = + Rect( + splitZoneLeft, + fullScreenDragZoneHeight, + splitZoneLeft + fullScreenDragZoneWidth, + fullScreenDragZoneHeight + + vUnevenSplitFromExpandedViewDragZoneHeight + ), + ), + DragZone.Split.Bottom( + bounds = + Rect( + 0, + windowBounds.bottom - + vUnevenSplitFromExpandedViewDragZoneHeight, + windowBounds.right, + windowBounds.bottom + ), + ) + ) + } + } else { + // horizontal split drag zones + createHorizontalSplitDragZonesForExpandedView() + } + } + + private fun createHorizontalSplitDragZonesForExpandedView(): List<DragZone> { + // horizontal split drag zones for expanded view appear on the edges of the screen from the + // top down until the dismiss drag zone height + return listOf( + DragZone.Split.Left( + bounds = + Rect( + 0, + 0, + hSplitFromExpandedViewDragZoneWidth, + windowBounds.bottom - dismissDragZoneSize + ), + ), + DragZone.Split.Right( + bounds = + Rect( + windowBounds.right - hSplitFromExpandedViewDragZoneWidth, + 0, + windowBounds.right, + windowBounds.bottom - dismissDragZoneSize + ), + ) + ) + } + + /** Checks the current split screen mode. */ + fun interface SplitScreenModeChecker { + enum class SplitScreenMode { + NONE, + SPLIT_50_50, + SPLIT_10_90, + SPLIT_90_10 + } + + fun getSplitScreenMode(): SplitScreenMode + } + + /** Checks if desktop window mode is supported. */ + fun interface DesktopWindowModeChecker { + fun isSupported(): Boolean + } +} diff --git a/libs/WindowManager/Shell/shared/src/com/android/wm/shell/shared/bubbles/DraggedObject.kt b/libs/WindowManager/Shell/shared/src/com/android/wm/shell/shared/bubbles/DraggedObject.kt new file mode 100644 index 000000000000..028622798f34 --- /dev/null +++ b/libs/WindowManager/Shell/shared/src/com/android/wm/shell/shared/bubbles/DraggedObject.kt @@ -0,0 +1,27 @@ +/* + * Copyright (C) 2025 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.shared.bubbles + +/** A Bubble object being dragged. */ +sealed interface DraggedObject { + /** The initial location of the object at the start of the drag gesture. */ + val initialLocation: BubbleBarLocation + + data class Bubble(override val initialLocation: BubbleBarLocation) : DraggedObject + data class BubbleBar(override val initialLocation: BubbleBarLocation) : DraggedObject + data class ExpandedView(override val initialLocation: BubbleBarLocation) : DraggedObject +} 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 62ca5c687a2a..b1bc6e81e1bd 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 @@ -28,6 +28,7 @@ import android.graphics.Color; import android.graphics.Matrix; import android.graphics.Rect; import android.graphics.drawable.Drawable; +import android.hardware.HardwareBuffer; import android.util.TypedValue; import android.view.SurfaceControl; import android.window.TaskSnapshot; @@ -225,12 +226,17 @@ public abstract class PipContentOverlay { @Override public void attach(SurfaceControl.Transaction tx, SurfaceControl parentLeash) { + final HardwareBuffer buffer = mBitmap.getHardwareBuffer(); tx.show(mLeash); tx.setLayer(mLeash, Integer.MAX_VALUE); - tx.setBuffer(mLeash, mBitmap.getHardwareBuffer()); + tx.setBuffer(mLeash, buffer); tx.setAlpha(mLeash, 0f); tx.reparent(mLeash, parentLeash); tx.apply(); + // Cleanup the bitmap and buffer after setting up the leash + mBitmap.recycle(); + mBitmap = null; + buffer.close(); } @Override @@ -253,14 +259,6 @@ public abstract class PipContentOverlay { .setAlpha(mLeash, fraction < 0.5f ? 0 : (fraction - 0.5f) * 2); } - @Override - public void detach(SurfaceControl.Transaction tx) { - super.detach(tx); - if (mBitmap != null && !mBitmap.isRecycled()) { - mBitmap.recycle(); - } - } - private void prepareAppIconOverlay(Drawable appIcon) { final Canvas canvas = new Canvas(); canvas.setBitmap(mBitmap); @@ -282,7 +280,9 @@ public abstract class PipContentOverlay { mOverlayHalfSize + mAppIconSizePx / 2); appIcon.setBounds(appIconBounds); appIcon.draw(canvas); + Bitmap oldBitmap = mBitmap; mBitmap = mBitmap.copy(Bitmap.Config.HARDWARE, false /* mutable */); + oldBitmap.recycle(); } } } diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/Bubble.java b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/Bubble.java index 947dbd276d3a..d77c177437b8 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/Bubble.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/Bubble.java @@ -192,10 +192,10 @@ public class Bubble implements BubbleViewProvider { * that bubble being added back to the stack anyways. */ @Nullable - private PendingIntent mIntent; - private boolean mIntentActive; + private PendingIntent mPendingIntent; + private boolean mPendingIntentActive; @Nullable - private PendingIntent.CancelListener mIntentCancelListener; + private PendingIntent.CancelListener mPendingIntentCancelListener; /** * Sent when the bubble & notification are no longer visible to the user (i.e. no @@ -205,12 +205,10 @@ public class Bubble implements BubbleViewProvider { private PendingIntent mDeleteIntent; /** - * Used only for a special bubble in the stack that has {@link #mIsAppBubble} set to true. - * There can only be one of these bubbles in the stack and this intent will be populated for - * that bubble. + * Used for app & note bubbles. */ @Nullable - private Intent mAppIntent; + private Intent mIntent; /** * Set while preparing a transition for animation. Several steps are needed before animation @@ -275,7 +273,7 @@ public class Bubble implements BubbleViewProvider { mMainExecutor = mainExecutor; mBgExecutor = bgExecutor; mTaskId = INVALID_TASK_ID; - mAppIntent = intent; + mIntent = intent; mDesiredHeight = Integer.MAX_VALUE; mPackageName = intent.getPackage(); } @@ -294,7 +292,7 @@ public class Bubble implements BubbleViewProvider { mMainExecutor = mainExecutor; mBgExecutor = bgExecutor; mTaskId = INVALID_TASK_ID; - mAppIntent = null; + mIntent = null; mDesiredHeight = Integer.MAX_VALUE; mPackageName = info.getPackage(); mShortcutInfo = info; @@ -319,7 +317,7 @@ public class Bubble implements BubbleViewProvider { mMainExecutor = mainExecutor; mBgExecutor = bgExecutor; mTaskId = task.taskId; - mAppIntent = null; + mIntent = null; mDesiredHeight = Integer.MAX_VALUE; mPackageName = task.baseActivity.getPackageName(); } @@ -413,9 +411,9 @@ public class Bubble implements BubbleViewProvider { mGroupKey = entry.getGroupKey(); mLocusId = entry.getLocusId(); mBubbleMetadataFlagListener = listener; - mIntentCancelListener = intent -> { - if (mIntent != null) { - mIntent.unregisterCancelListener(mIntentCancelListener); + mPendingIntentCancelListener = intent -> { + if (mPendingIntent != null) { + mPendingIntent.unregisterCancelListener(mPendingIntentCancelListener); } mainExecutor.execute(() -> { intentCancelListener.onPendingIntentCanceled(this); @@ -601,10 +599,10 @@ public class Bubble implements BubbleViewProvider { if (cleanupTaskView) { cleanupTaskView(); } - if (mIntent != null) { - mIntent.unregisterCancelListener(mIntentCancelListener); + if (mPendingIntent != null) { + mPendingIntent.unregisterCancelListener(mPendingIntentCancelListener); } - mIntentActive = false; + mPendingIntentActive = false; } /** Cleans-up the taskview associated with this bubble (possibly removing the task from wm) */ @@ -874,19 +872,19 @@ public class Bubble implements BubbleViewProvider { mDesiredHeightResId = entry.getBubbleMetadata().getDesiredHeightResId(); mIcon = entry.getBubbleMetadata().getIcon(); - if (!mIntentActive || mIntent == null) { - if (mIntent != null) { - mIntent.unregisterCancelListener(mIntentCancelListener); + if (!mPendingIntentActive || mPendingIntent == null) { + if (mPendingIntent != null) { + mPendingIntent.unregisterCancelListener(mPendingIntentCancelListener); } - mIntent = entry.getBubbleMetadata().getIntent(); - if (mIntent != null) { - mIntent.registerCancelListener(mIntentCancelListener); + mPendingIntent = entry.getBubbleMetadata().getIntent(); + if (mPendingIntent != null) { + mPendingIntent.registerCancelListener(mPendingIntentCancelListener); } - } else if (mIntent != null && entry.getBubbleMetadata().getIntent() == null) { + } else if (mPendingIntent != null && entry.getBubbleMetadata().getIntent() == null) { // Was an intent bubble now it's a shortcut bubble... still unregister the listener - mIntent.unregisterCancelListener(mIntentCancelListener); - mIntentActive = false; - mIntent = null; + mPendingIntent.unregisterCancelListener(mPendingIntentCancelListener); + mPendingIntentActive = false; + mPendingIntent = null; } mDeleteIntent = entry.getBubbleMetadata().getDeleteIntent(); } @@ -926,12 +924,15 @@ public class Bubble implements BubbleViewProvider { * Sets if the intent used for this bubble is currently active (i.e. populating an * expanded view, expanded or not). */ - void setIntentActive() { - mIntentActive = true; + void setPendingIntentActive() { + mPendingIntentActive = true; } - boolean isIntentActive() { - return mIntentActive; + /** + * Whether the pending intent of this bubble is active (i.e. has been sent). + */ + boolean isPendingIntentActive() { + return mPendingIntentActive; } public InstanceId getInstanceId() { @@ -1118,9 +1119,12 @@ public class Bubble implements BubbleViewProvider { } } + /** + * Returns the pending intent used to populate the bubble. + */ @Nullable - PendingIntent getBubbleIntent() { - return mIntent; + PendingIntent getPendingIntent() { + return mPendingIntent; } /** @@ -1128,31 +1132,33 @@ public class Bubble implements BubbleViewProvider { * intent for an app. In this case we don't show a badge on the icon. */ public boolean isAppLaunchIntent() { - if (BubbleAnythingFlagHelper.enableCreateAnyBubble() && mAppIntent != null) { - return mAppIntent.hasCategory("android.intent.category.LAUNCHER"); + if (BubbleAnythingFlagHelper.enableCreateAnyBubble() && mIntent != null) { + return mIntent.hasCategory("android.intent.category.LAUNCHER"); } return false; } + /** + * Returns the pending intent to send when a bubble is dismissed (set via the notification API). + */ @Nullable PendingIntent getDeleteIntent() { return mDeleteIntent; } + /** + * Returns the intent used to populate the bubble. + */ @Nullable - @VisibleForTesting - public Intent getAppBubbleIntent() { - return mAppIntent; + public Intent getIntent() { + return mIntent; } /** - * Sets the intent for a bubble that is an app bubble (one for which {@link #mIsAppBubble} is - * true). - * - * @param appIntent The intent to set for the app bubble. + * Sets the intent used to populate the bubble. */ - void setAppBubbleIntent(Intent appIntent) { - mAppIntent = appIntent; + void setIntent(Intent intent) { + mIntent = intent; } /** diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleController.java b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleController.java index 9120e0894ccf..2c81945ffdbe 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleController.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleController.java @@ -116,6 +116,7 @@ import com.android.wm.shell.shared.annotations.ShellMainThread; import com.android.wm.shell.shared.bubbles.BubbleAnythingFlagHelper; import com.android.wm.shell.shared.bubbles.BubbleBarLocation; import com.android.wm.shell.shared.bubbles.BubbleBarUpdate; +import com.android.wm.shell.shared.bubbles.BubbleDropTargetBoundsProvider; import com.android.wm.shell.shared.bubbles.DeviceConfig; import com.android.wm.shell.sysui.ConfigurationChangeListener; import com.android.wm.shell.sysui.ShellCommandHandler; @@ -419,10 +420,11 @@ public class BubbleController implements ConfigurationChangeListener, mBubbleData.setSuppressionChangedListener(this::onBubbleMetadataFlagChanged); mDataRepository.setSuppressionChangedListener(this::onBubbleMetadataFlagChanged); mBubbleData.setPendingIntentCancelledListener(bubble -> { - if (bubble.getBubbleIntent() == null) { + if (bubble.getPendingIntent() == null) { return; } - if (bubble.isIntentActive() || mBubbleData.hasBubbleInStackWithKey(bubble.getKey())) { + if (bubble.isPendingIntentActive() + || mBubbleData.hasBubbleInStackWithKey(bubble.getKey())) { bubble.setPendingIntentCanceled(); return; } @@ -924,6 +926,11 @@ public class BubbleController implements ConfigurationChangeListener, return mBubblePositioner; } + /** Provides bounds for drag zone drop targets */ + public BubbleDropTargetBoundsProvider getBubbleDropTargetBoundsProvider() { + return mBubblePositioner; + } + BubbleIconFactory getIconFactory() { return mBubbleIconFactory; } @@ -1663,7 +1670,7 @@ public class BubbleController implements ConfigurationChangeListener, // It's in the overflow, so remove it & reinflate mBubbleData.dismissBubbleWithKey(noteBubbleKey, Bubbles.DISMISS_NOTIF_CANCEL); // Update the bubble entry in the overflow with the latest intent. - b.setAppBubbleIntent(intent); + b.setIntent(intent); } else { // Notes bubble does not exist, lets add and expand it b = Bubble.createNotesBubble(intent, user, icon, mMainExecutor, diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleExpandedView.java b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleExpandedView.java index ac74a42d1359..ad9ab7a722ee 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleExpandedView.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleExpandedView.java @@ -237,8 +237,7 @@ public class BubbleExpandedView extends LinearLayout { PendingIntent pi = PendingIntent.getActivity( context, /* requestCode= */ 0, - mBubble.getAppBubbleIntent() - .addFlags(FLAG_ACTIVITY_MULTIPLE_TASK), + mBubble.getIntent().addFlags(FLAG_ACTIVITY_MULTIPLE_TASK), PendingIntent.FLAG_IMMUTABLE | PendingIntent.FLAG_UPDATE_CURRENT, /* options= */ null); mTaskView.startActivity(pi, /* fillInIntent= */ null, options, @@ -252,7 +251,7 @@ public class BubbleExpandedView extends LinearLayout { } else { options.setLaunchedFromBubble(true); if (mBubble != null) { - mBubble.setIntentActive(); + mBubble.setPendingIntentActive(); } final Intent fillInIntent = new Intent(); // Apply flags to make behaviour match documentLaunchMode=always. @@ -920,7 +919,7 @@ public class BubbleExpandedView extends LinearLayout { }); if (isNew) { - mPendingIntent = mBubble.getBubbleIntent(); + mPendingIntent = mBubble.getPendingIntent(); if ((mPendingIntent != null || mBubble.hasMetadataShortcutId()) && mTaskView != null) { setContentVisibility(false); @@ -947,7 +946,7 @@ public class BubbleExpandedView extends LinearLayout { */ private boolean didBackingContentChange(Bubble newBubble) { boolean prevWasIntentBased = mBubble != null && mPendingIntent != null; - boolean newIsIntentBased = newBubble.getBubbleIntent() != null; + boolean newIsIntentBased = newBubble.getPendingIntent() != null; return prevWasIntentBased != newIsIntentBased; } diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubblePositioner.java b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubblePositioner.java index 8cf3f7afd46a..5273a7cf2432 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubblePositioner.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubblePositioner.java @@ -27,19 +27,21 @@ import android.graphics.RectF; import android.view.Surface; import android.view.WindowManager; +import androidx.annotation.NonNull; import androidx.annotation.VisibleForTesting; import com.android.internal.protolog.ProtoLog; import com.android.launcher3.icons.IconNormalizer; import com.android.wm.shell.R; import com.android.wm.shell.shared.bubbles.BubbleBarLocation; +import com.android.wm.shell.shared.bubbles.BubbleDropTargetBoundsProvider; import com.android.wm.shell.shared.bubbles.DeviceConfig; /** * Keeps track of display size, configuration, and specific bubble sizes. One place for all * placement and positioning calculations to refer to. */ -public class BubblePositioner { +public class BubblePositioner implements BubbleDropTargetBoundsProvider { /** The screen edge the bubble stack is pinned to */ public enum StackPinnedEdge { @@ -100,6 +102,7 @@ public class BubblePositioner { private int mManageButtonHeight; private int mOverflowHeight; private int mMinimumFlyoutWidthLargeScreen; + private int mBubbleBarExpandedViewDropTargetPadding; private PointF mRestingStackPosition; @@ -164,6 +167,8 @@ public class BubblePositioner { res.getDimensionPixelSize(R.dimen.bubble_bar_expanded_view_width), mPositionRect.width() - 2 * mExpandedViewPadding ); + mBubbleBarExpandedViewDropTargetPadding = res.getDimensionPixelSize( + R.dimen.bubble_bar_expanded_view_drop_target_padding); if (mShowingInBubbleBar) { mExpandedViewLargeScreenWidth = mExpandedViewBubbleBarWidth; @@ -965,4 +970,14 @@ public class BubblePositioner { int top = getExpandedViewBottomForBubbleBar() - height; out.offsetTo(left, top); } + + @NonNull + @Override + public Rect getBubbleBarExpandedViewDropTargetBounds(boolean onLeft) { + Rect bounds = new Rect(); + getBubbleBarExpandedViewBounds(onLeft, false, bounds); + bounds.inset(mBubbleBarExpandedViewDropTargetPadding, + mBubbleBarExpandedViewDropTargetPadding); + return bounds; + } } diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleTaskViewHelper.java b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleTaskViewHelper.java index 83d311ed6cd9..0d89bb260bf5 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleTaskViewHelper.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleTaskViewHelper.java @@ -119,7 +119,7 @@ public class BubbleTaskViewHelper { PendingIntent pi = PendingIntent.getActivity( context, /* requestCode= */ 0, - mBubble.getAppBubbleIntent() + mBubble.getIntent() .addFlags(FLAG_ACTIVITY_MULTIPLE_TASK), PendingIntent.FLAG_IMMUTABLE | PendingIntent.FLAG_UPDATE_CURRENT, /* options= */ null); @@ -133,7 +133,7 @@ public class BubbleTaskViewHelper { } else { options.setLaunchedFromBubble(true); if (mBubble != null) { - mBubble.setIntentActive(); + mBubble.setPendingIntentActive(); } final Intent fillInIntent = new Intent(); // Apply flags to make behaviour match documentLaunchMode=always. @@ -231,7 +231,7 @@ public class BubbleTaskViewHelper { boolean isNew = mBubble == null || didBackingContentChange(bubble); mBubble = bubble; if (isNew) { - mPendingIntent = mBubble.getBubbleIntent(); + mPendingIntent = mBubble.getPendingIntent(); return true; } return false; @@ -276,7 +276,7 @@ public class BubbleTaskViewHelper { */ private boolean didBackingContentChange(Bubble newBubble) { boolean prevWasIntentBased = mBubble != null && mPendingIntent != null; - boolean newIsIntentBased = newBubble.getBubbleIntent() != null; + boolean newIsIntentBased = newBubble.getPendingIntent() != null; return prevWasIntentBased != newIsIntentBased; } } diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/common/InputChannelSupplier.kt b/libs/WindowManager/Shell/src/com/android/wm/shell/common/InputChannelSupplier.kt new file mode 100644 index 000000000000..41382047945b --- /dev/null +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/common/InputChannelSupplier.kt @@ -0,0 +1,34 @@ +/* + * Copyright 2025 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.common + +import android.view.InputChannel +import com.android.wm.shell.dagger.WMSingleton +import java.util.function.Supplier +import javax.inject.Inject + +/** + * An Injectable [Supplier<InputChannel>]. This can be used in place of kotlin default + * parameters values [builder = ::InputChannel] which requires the [@JvmOverloads] annotation to + * make this available in Java. + * This can be used every time a component needs the dependency to the default [Supplier] for + * [InputChannel]s. + */ +@WMSingleton +class InputChannelSupplier @Inject constructor() : Supplier<InputChannel> { + override fun get(): InputChannel = InputChannel() +} diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/common/WindowSessionSupplier.kt b/libs/WindowManager/Shell/src/com/android/wm/shell/common/WindowSessionSupplier.kt new file mode 100644 index 000000000000..2c66e97f03e1 --- /dev/null +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/common/WindowSessionSupplier.kt @@ -0,0 +1,35 @@ +/* + * Copyright 2025 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.common + +import android.view.IWindowSession +import android.view.WindowManagerGlobal +import com.android.wm.shell.dagger.WMSingleton +import java.util.function.Supplier +import javax.inject.Inject + +/** + * An Injectable [Supplier<IWindowSession>]. This can be used in place of kotlin default + * parameters values [builder = WindowManagerGlobal::getWindowSession] which requires the + * [@JvmOverloads] annotation to make this available in Java. + * This can be used every time a component needs the dependency to the default [Supplier] for + * [IWindowSession]s. + */ +@WMSingleton +class WindowSessionSupplier @Inject constructor() : Supplier<IWindowSession> { + override fun get(): IWindowSession = WindowManagerGlobal.getWindowSession() +} diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/common/transition/SurfaceBuilderSupplier.kt b/libs/WindowManager/Shell/src/com/android/wm/shell/common/transition/SurfaceBuilderSupplier.kt new file mode 100644 index 000000000000..0b6c06ac5649 --- /dev/null +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/common/transition/SurfaceBuilderSupplier.kt @@ -0,0 +1,34 @@ +/* + * Copyright 2025 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.common.transition + +import android.view.SurfaceControl +import com.android.wm.shell.dagger.WMSingleton +import java.util.function.Supplier +import javax.inject.Inject + +/** + * An Injectable [Supplier<SurfaceControl.Builder>]. This can be used in place of kotlin default + * parameters values [builder = ::SurfaceControl.Builder] which requires the [@JvmOverloads] + * annotation to make this available in Java. + * This can be used every time a component needs the dependency to the default builder for + * [SurfaceControl]s. + */ +@WMSingleton +class SurfaceBuilderSupplier @Inject constructor() : Supplier<SurfaceControl.Builder> { + override fun get(): SurfaceControl.Builder = SurfaceControl.Builder() +} diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/common/transition/TransactionSupplier.kt b/libs/WindowManager/Shell/src/com/android/wm/shell/common/transition/TransactionSupplier.kt new file mode 100644 index 000000000000..2d9899b4fccf --- /dev/null +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/common/transition/TransactionSupplier.kt @@ -0,0 +1,34 @@ +/* + * Copyright 2025 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.common.transition + +import android.view.SurfaceControl +import com.android.wm.shell.dagger.WMSingleton +import java.util.function.Supplier +import javax.inject.Inject + +/** + * An Injectable [Supplier<SurfaceControl.Transaction>]. This can be used in place of kotlin default + * parameters values [builder = ::SurfaceControl.Transaction] which requires the [@JvmOverloads] + * annotation to make this available in Java. + * This can be used every time a component needs the dependency to the default builder for + * [SurfaceControl.Transaction]s. + */ +@WMSingleton +class TransactionSupplier @Inject constructor() : Supplier<SurfaceControl.Transaction> { + override fun get(): SurfaceControl.Transaction = SurfaceControl.Transaction() +} diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/compatui/letterbox/LetterboxGestureListener.kt b/libs/WindowManager/Shell/src/com/android/wm/shell/compatui/letterbox/LetterboxGestureListener.kt new file mode 100644 index 000000000000..f7afbb5bdaef --- /dev/null +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/compatui/letterbox/LetterboxGestureListener.kt @@ -0,0 +1,65 @@ +/* + * Copyright 2025 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.compatui.letterbox + +import android.view.GestureDetector.OnContextClickListener +import android.view.GestureDetector.OnDoubleTapListener +import android.view.GestureDetector.OnGestureListener +import android.view.MotionEvent + +/** + * Interface which unions all the interfaces related to gestures. + */ +interface LetterboxGestureListener : OnGestureListener, OnDoubleTapListener, OnContextClickListener + +/** + * Convenience class which provide an overrideable implementation of + * {@link LetterboxGestureListener}. + */ +object LetterboxGestureDelegate : LetterboxGestureListener { + override fun onDown(e: MotionEvent): Boolean = false + + override fun onShowPress(e: MotionEvent) { + } + + override fun onSingleTapUp(e: MotionEvent): Boolean = false + + override fun onScroll( + e1: MotionEvent?, + e2: MotionEvent, + distanceX: Float, + distanceY: Float + ): Boolean = false + + override fun onLongPress(e: MotionEvent) { + } + + override fun onFling( + e1: MotionEvent?, + e2: MotionEvent, + velocityX: Float, + velocityY: Float + ): Boolean = false + + override fun onSingleTapConfirmed(e: MotionEvent): Boolean = false + + override fun onDoubleTap(e: MotionEvent): Boolean = false + + override fun onDoubleTapEvent(e: MotionEvent): Boolean = false + + override fun onContextClick(e: MotionEvent): Boolean = false +} diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/compatui/letterbox/LetterboxInputController.kt b/libs/WindowManager/Shell/src/com/android/wm/shell/compatui/letterbox/LetterboxInputController.kt new file mode 100644 index 000000000000..afd8e1519d24 --- /dev/null +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/compatui/letterbox/LetterboxInputController.kt @@ -0,0 +1,113 @@ +/* + * Copyright 2025 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.compatui.letterbox + +import android.content.Context +import android.graphics.Rect +import android.graphics.Region +import android.os.Handler +import android.view.SurfaceControl +import android.view.SurfaceControl.Transaction +import com.android.internal.protolog.ProtoLog +import com.android.wm.shell.common.InputChannelSupplier +import com.android.wm.shell.common.WindowSessionSupplier +import com.android.wm.shell.compatui.letterbox.LetterboxUtils.Maps.runOnItem +import com.android.wm.shell.dagger.WMSingleton +import com.android.wm.shell.protolog.ShellProtoLogGroup.WM_SHELL_APP_COMPAT +import java.util.function.Supplier +import javax.inject.Inject + +/** + * [LetterboxController] implementation responsible for handling the spy [SurfaceControl] we use + * to detect letterbox events. + */ +@WMSingleton +class LetterboxInputController @Inject constructor( + private val context: Context, + private val handler: Handler, + private val inputSurfaceBuilder: LetterboxInputSurfaceBuilder, + private val listenerSupplier: Supplier<LetterboxGestureListener>, + private val windowSessionSupplier: WindowSessionSupplier, + private val inputChannelSupplier: InputChannelSupplier +) : LetterboxController { + + companion object { + @JvmStatic + private val TAG = "LetterboxInputController" + } + + private val inputDetectorMap = mutableMapOf<LetterboxKey, LetterboxInputDetector>() + + override fun createLetterboxSurface( + key: LetterboxKey, + transaction: Transaction, + parentLeash: SurfaceControl + ) { + inputDetectorMap.runOnItem(key, onMissed = { k, m -> + m[k] = + LetterboxInputDetector( + context, + handler, + listenerSupplier.get(), + inputSurfaceBuilder, + windowSessionSupplier, + inputChannelSupplier + ).apply { + start(transaction, parentLeash, key) + } + }) + } + + override fun destroyLetterboxSurface( + key: LetterboxKey, + transaction: Transaction + ) { + with(inputDetectorMap) { + runOnItem(key, onFound = { item -> + item.stop(transaction) + }) + remove(key) + } + } + + override fun updateLetterboxSurfaceVisibility( + key: LetterboxKey, + transaction: Transaction, + visible: Boolean + ) { + with(inputDetectorMap) { + runOnItem(key, onFound = { item -> + item.updateVisibility(transaction, visible) + }) + } + } + + override fun updateLetterboxSurfaceBounds( + key: LetterboxKey, + transaction: Transaction, + taskBounds: Rect, + activityBounds: Rect + ) { + inputDetectorMap.runOnItem(key, onFound = { item -> + item.updateTouchableRegion(transaction, Region(taskBounds)) + }) + } + + override fun dump() { + ProtoLog.v(WM_SHELL_APP_COMPAT, "%s: %s", TAG, "${inputDetectorMap.keys}") + } +} diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/compatui/letterbox/LetterboxInputDetector.kt b/libs/WindowManager/Shell/src/com/android/wm/shell/compatui/letterbox/LetterboxInputDetector.kt new file mode 100644 index 000000000000..812cc0161aae --- /dev/null +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/compatui/letterbox/LetterboxInputDetector.kt @@ -0,0 +1,230 @@ +/* + * Copyright 2025 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.compatui.letterbox + +import android.content.Context +import android.graphics.Region +import android.os.Binder +import android.os.Handler +import android.os.IBinder +import android.os.RemoteException +import android.view.GestureDetector +import android.view.IWindowSession +import android.view.InputChannel +import android.view.InputEvent +import android.view.InputEventReceiver +import android.view.MotionEvent +import android.view.SurfaceControl +import android.view.SurfaceControl.Transaction +import android.view.WindowManager +import android.window.InputTransferToken +import com.android.internal.protolog.ProtoLog +import com.android.wm.shell.common.InputChannelSupplier +import com.android.wm.shell.common.WindowSessionSupplier +import com.android.wm.shell.protolog.ShellProtoLogGroup.WM_SHELL_APP_COMPAT + +/** + * This is responsible for detecting events on a given [SurfaceControl]. + */ +class LetterboxInputDetector( + private val context: Context, + private val handler: Handler, + private val listener: LetterboxGestureListener, + private val inputSurfaceBuilder: LetterboxInputSurfaceBuilder, + private val windowSessionSupplier: WindowSessionSupplier, + private val inputChannelSupplier: InputChannelSupplier +) { + + companion object { + @JvmStatic + private val TAG = "LetterboxInputDetector" + } + + private var state: InputDetectorState? = null + + fun start(tx: Transaction, source: SurfaceControl, key: LetterboxKey) { + if (!isRunning()) { + val tmpState = + InputDetectorState( + context, + handler, + source, + key.displayId, + listener, + inputSurfaceBuilder, + windowSessionSupplier.get(), + inputChannelSupplier + ) + if (tmpState.start(tx)) { + state = tmpState + } else { + ProtoLog.v( + WM_SHELL_APP_COMPAT, + "%s not started for %s on %s", + TAG, + "$source", + "$key" + ) + } + } + } + + fun updateTouchableRegion(tx: Transaction, region: Region) { + if (isRunning()) { + state?.setTouchableRegion(tx, region) + } + } + + fun isRunning() = state != null + + fun updateVisibility(tx: Transaction, visible: Boolean) { + if (isRunning()) { + state?.updateVisibility(tx, visible) + } + } + + fun stop(tx: Transaction) { + if (isRunning()) { + state!!.stop(tx) + state = null + } + } + + /** + * The state for a {@link SurfaceControl} for a given displayId. + */ + private class InputDetectorState( + val context: Context, + val handler: Handler, + val source: SurfaceControl, + val displayId: Int, + val listener: LetterboxGestureListener, + val inputSurfaceBuilder: LetterboxInputSurfaceBuilder, + val windowSession: IWindowSession, + inputChannelSupplier: InputChannelSupplier + ) { + + private val inputToken: IBinder + private val inputChannel: InputChannel + private var receiver: EventReceiver? = null + private var inputSurface: SurfaceControl? = null + + init { + inputToken = Binder() + inputChannel = inputChannelSupplier.get() + } + + fun start(tx: Transaction): Boolean { + val inputTransferToken = InputTransferToken() + try { + inputSurface = + inputSurfaceBuilder.createInputSurface( + tx, + source, + "Sink for $source", + "$TAG creation" + ) + windowSession.grantInputChannel( + displayId, + inputSurface, + inputToken, + null, + WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE, + WindowManager.LayoutParams.PRIVATE_FLAG_TRUSTED_OVERLAY, + WindowManager.LayoutParams.INPUT_FEATURE_SPY, + WindowManager.LayoutParams.TYPE_INPUT_CONSUMER, + null, + inputTransferToken, + "$TAG of $source", + inputChannel + ) + + receiver = EventReceiver(context, inputChannel, handler, listener) + return true + } catch (e: RemoteException) { + e.rethrowFromSystemServer() + } + return false + } + + fun setTouchableRegion(tx: Transaction, region: Region) { + try { + tx.setWindowCrop(inputSurface, region.bounds.width(), region.bounds.height()) + + windowSession.updateInputChannel( + inputChannel.token, + displayId, + inputSurface, + WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE, + WindowManager.LayoutParams.PRIVATE_FLAG_TRUSTED_OVERLAY, + WindowManager.LayoutParams.INPUT_FEATURE_SPY, + region + ) + } catch (e: RemoteException) { + e.rethrowFromSystemServer() + } + } + + fun updateVisibility(tx: Transaction, visible: Boolean) { + inputSurface?.let { + tx.setVisibility(it, visible) + } + } + + fun stop(tx: Transaction) { + receiver?.dispose() + receiver = null + inputChannel.dispose() + windowSession.removeToken(inputToken) + inputSurface?.let { s -> + tx.remove(s) + } + } + + // Removes the provided token + private fun IWindowSession.removeToken(token: IBinder) { + try { + remove(token) + } catch (e: RemoteException) { + e.rethrowFromSystemServer() + } + } + } + + /** + * Reads from the provided {@link InputChannel} and identifies a specific event. + */ + private class EventReceiver( + context: Context, + inputChannel: InputChannel, + uiHandler: Handler, + listener: LetterboxGestureListener + ) : InputEventReceiver(inputChannel, uiHandler.looper) { + private val eventDetector: GestureDetector + + init { + eventDetector = GestureDetector( + context, listener, + uiHandler + ) + } + + override fun onInputEvent(event: InputEvent) { + finishInputEvent(event, eventDetector.onTouchEvent(event as MotionEvent)) + } + } +} diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/compatui/letterbox/LetterboxInputSurfaceBuilder.kt b/libs/WindowManager/Shell/src/com/android/wm/shell/compatui/letterbox/LetterboxInputSurfaceBuilder.kt new file mode 100644 index 000000000000..fd8d86576115 --- /dev/null +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/compatui/letterbox/LetterboxInputSurfaceBuilder.kt @@ -0,0 +1,58 @@ +/* + * Copyright 2025 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.compatui.letterbox + +import android.view.SurfaceControl +import android.view.SurfaceControl.Transaction +import com.android.wm.shell.common.transition.SurfaceBuilderSupplier +import com.android.wm.shell.dagger.WMSingleton +import javax.inject.Inject + +/** + * Component responsible for the actual creation of the Letterbox surfaces. + */ +@WMSingleton +class LetterboxInputSurfaceBuilder @Inject constructor( + private val surfaceBuilderSupplier: SurfaceBuilderSupplier +) { + + companion object { + /* + * Letterbox spy surfaces need to stay above the activity layer which is 0. + */ + // TODO(b/378673153): Consider adding this to [TaskConstants]. + @JvmStatic + private val TASK_CHILD_LAYER_LETTERBOX_SPY = 1000 + } + + fun createInputSurface( + tx: Transaction, + parentLeash: SurfaceControl, + surfaceName: String, + callSite: String + ) = surfaceBuilderSupplier.get() + .setName(surfaceName) + .setContainerLayer() + .setParent(parentLeash) + .setCallsite(callSite) + .build().apply { + tx.setLayer(this, TASK_CHILD_LAYER_LETTERBOX_SPY) + .setTrustedOverlay(this, true) + .show(this) + .apply() + } +} diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopModeVisualIndicator.java b/libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopModeVisualIndicator.java index 621ccba40db2..27aed17762ff 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopModeVisualIndicator.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopModeVisualIndicator.java @@ -60,6 +60,7 @@ import com.android.wm.shell.common.DisplayController; import com.android.wm.shell.common.DisplayLayout; import com.android.wm.shell.common.SyncTransactionQueue; import com.android.wm.shell.shared.bubbles.BubbleAnythingFlagHelper; +import com.android.wm.shell.shared.bubbles.BubbleDropTargetBoundsProvider; import com.android.wm.shell.shared.desktopmode.DesktopModeStatus; /** @@ -76,7 +77,11 @@ public class DesktopModeVisualIndicator { /** Indicates impending transition into split select on the left side */ TO_SPLIT_LEFT_INDICATOR, /** Indicates impending transition into split select on the right side */ - TO_SPLIT_RIGHT_INDICATOR + TO_SPLIT_RIGHT_INDICATOR, + /** Indicates impending transition into bubble on the left side */ + TO_BUBBLE_LEFT_INDICATOR, + /** Indicates impending transition into bubble on the right side */ + TO_BUBBLE_RIGHT_INDICATOR } /** @@ -115,6 +120,7 @@ public class DesktopModeVisualIndicator { private final RootTaskDisplayAreaOrganizer mRootTdaOrganizer; private final ActivityManager.RunningTaskInfo mTaskInfo; private final SurfaceControl mTaskSurface; + private final @Nullable BubbleDropTargetBoundsProvider mBubbleBoundsProvider; private SurfaceControl mLeash; private final SyncTransactionQueue mSyncQueue; @@ -129,13 +135,15 @@ public class DesktopModeVisualIndicator { ActivityManager.RunningTaskInfo taskInfo, DisplayController displayController, Context context, SurfaceControl taskSurface, RootTaskDisplayAreaOrganizer taskDisplayAreaOrganizer, - DragStartState dragStartState) { + DragStartState dragStartState, + @Nullable BubbleDropTargetBoundsProvider bubbleBoundsProvider) { mSyncQueue = syncQueue; mTaskInfo = taskInfo; mDisplayController = displayController; mContext = context; mTaskSurface = taskSurface; mRootTdaOrganizer = taskDisplayAreaOrganizer; + mBubbleBoundsProvider = bubbleBoundsProvider; mCurrentType = NO_INDICATOR; mDragStartState = dragStartState; } @@ -175,15 +183,24 @@ public class DesktopModeVisualIndicator { captionHeight); final Region splitRightRegion = calculateSplitRightRegion(layout, transitionAreaWidth, captionHeight); - if (fullscreenRegion.contains((int) inputCoordinates.x, (int) inputCoordinates.y)) { + final int x = (int) inputCoordinates.x; + final int y = (int) inputCoordinates.y; + if (fullscreenRegion.contains(x, y)) { result = TO_FULLSCREEN_INDICATOR; } - if (splitLeftRegion.contains((int) inputCoordinates.x, (int) inputCoordinates.y)) { + if (splitLeftRegion.contains(x, y)) { result = IndicatorType.TO_SPLIT_LEFT_INDICATOR; } - if (splitRightRegion.contains((int) inputCoordinates.x, (int) inputCoordinates.y)) { + if (splitRightRegion.contains(x, y)) { result = IndicatorType.TO_SPLIT_RIGHT_INDICATOR; } + if (BubbleAnythingFlagHelper.enableBubbleToFullscreen()) { + if (calculateBubbleLeftRegion(layout).contains(x, y)) { + result = IndicatorType.TO_BUBBLE_LEFT_INDICATOR; + } else if (calculateBubbleRightRegion(layout).contains(x, y)) { + result = IndicatorType.TO_BUBBLE_RIGHT_INDICATOR; + } + } if (mDragStartState != DragStartState.DRAGGED_INTENT) { transitionIndicator(result); } @@ -247,6 +264,25 @@ public class DesktopModeVisualIndicator { return region; } + @VisibleForTesting + Region calculateBubbleLeftRegion(DisplayLayout layout) { + int regionWidth = mContext.getResources().getDimensionPixelSize( + com.android.wm.shell.R.dimen.bubble_transform_area_width); + int regionHeight = mContext.getResources().getDimensionPixelSize( + com.android.wm.shell.R.dimen.bubble_transform_area_height); + return new Region(0, layout.height() - regionHeight, regionWidth, layout.height()); + } + + @VisibleForTesting + Region calculateBubbleRightRegion(DisplayLayout layout) { + int regionWidth = mContext.getResources().getDimensionPixelSize( + com.android.wm.shell.R.dimen.bubble_transform_area_width); + int regionHeight = mContext.getResources().getDimensionPixelSize( + com.android.wm.shell.R.dimen.bubble_transform_area_height); + return new Region(layout.width() - regionWidth, layout.height() - regionHeight, + layout.width(), layout.height()); + } + /** * Create a fullscreen indicator with no animation */ @@ -297,6 +333,11 @@ public class DesktopModeVisualIndicator { }); } + @VisibleForTesting + Rect getIndicatorBounds() { + return mView.getBackground().getBounds(); + } + /** * Fade indicator in as provided type. Animator fades it in while expanding the bounds outwards. */ @@ -304,7 +345,8 @@ public class DesktopModeVisualIndicator { mView.setBackgroundResource(R.drawable.desktop_windowing_transition_background); final VisualIndicatorAnimator animator = VisualIndicatorAnimator .fadeBoundsIn(mView, type, - mDisplayController.getDisplayLayout(mTaskInfo.displayId)); + mDisplayController.getDisplayLayout(mTaskInfo.displayId), + mBubbleBoundsProvider); animator.start(); mCurrentType = type; } @@ -323,7 +365,8 @@ public class DesktopModeVisualIndicator { } final VisualIndicatorAnimator animator = VisualIndicatorAnimator .fadeBoundsOut(mView, mCurrentType, - mDisplayController.getDisplayLayout(mTaskInfo.displayId)); + mDisplayController.getDisplayLayout(mTaskInfo.displayId), + mBubbleBoundsProvider); animator.start(); if (finishCallback != null) { animator.addListener(new AnimatorListenerAdapter() { @@ -351,7 +394,7 @@ public class DesktopModeVisualIndicator { } else { final VisualIndicatorAnimator animator = VisualIndicatorAnimator.animateIndicatorType( mView, mDisplayController.getDisplayLayout(mTaskInfo.displayId), mCurrentType, - newType); + newType, mBubbleBoundsProvider); mCurrentType = newType; animator.start(); } @@ -406,8 +449,9 @@ public class DesktopModeVisualIndicator { } private static VisualIndicatorAnimator fadeBoundsIn( - @NonNull View view, IndicatorType type, @NonNull DisplayLayout displayLayout) { - final Rect endBounds = getIndicatorBounds(displayLayout, type); + @NonNull View view, IndicatorType type, @NonNull DisplayLayout displayLayout, + @Nullable BubbleDropTargetBoundsProvider bubbleBoundsProvider) { + final Rect endBounds = getIndicatorBounds(displayLayout, type, bubbleBoundsProvider); final Rect startBounds = getMinBounds(endBounds); view.getBackground().setBounds(startBounds); @@ -419,8 +463,9 @@ public class DesktopModeVisualIndicator { } private static VisualIndicatorAnimator fadeBoundsOut( - @NonNull View view, IndicatorType type, @NonNull DisplayLayout displayLayout) { - final Rect startBounds = getIndicatorBounds(displayLayout, type); + @NonNull View view, IndicatorType type, @NonNull DisplayLayout displayLayout, + @Nullable BubbleDropTargetBoundsProvider bubbleBoundsProvider) { + final Rect startBounds = getIndicatorBounds(displayLayout, type, bubbleBoundsProvider); final Rect endBounds = getMinBounds(startBounds); view.getBackground().setBounds(startBounds); @@ -435,16 +480,19 @@ public class DesktopModeVisualIndicator { * Create animator for visual indicator changing type (i.e., fullscreen to freeform, * freeform to split, etc.) * - * @param view the view for this indicator - * @param displayLayout information about the display the transitioning task is currently on - * @param origType the original indicator type - * @param newType the new indicator type + * @param view the view for this indicator + * @param displayLayout information about the display the transitioning task is + * currently on + * @param origType the original indicator type + * @param newType the new indicator type + * @param bubbleBoundsProvider provides bounds for bubbles indicators */ private static VisualIndicatorAnimator animateIndicatorType(@NonNull View view, - @NonNull DisplayLayout displayLayout, IndicatorType origType, - IndicatorType newType) { - final Rect startBounds = getIndicatorBounds(displayLayout, origType); - final Rect endBounds = getIndicatorBounds(displayLayout, newType); + @NonNull DisplayLayout displayLayout, IndicatorType origType, IndicatorType newType, + @Nullable BubbleDropTargetBoundsProvider bubbleBoundsProvider) { + final Rect startBounds = getIndicatorBounds(displayLayout, origType, + bubbleBoundsProvider); + final Rect endBounds = getIndicatorBounds(displayLayout, newType, bubbleBoundsProvider); final VisualIndicatorAnimator animator = new VisualIndicatorAnimator( view, startBounds, endBounds); animator.setInterpolator(new DecelerateInterpolator()); @@ -453,7 +501,8 @@ public class DesktopModeVisualIndicator { } /** Calculates the bounds the indicator should have when fully faded in. */ - private static Rect getIndicatorBounds(DisplayLayout layout, IndicatorType type) { + private static Rect getIndicatorBounds(DisplayLayout layout, IndicatorType type, + @Nullable BubbleDropTargetBoundsProvider bubbleBoundsProvider) { final Rect desktopStableBounds = new Rect(); layout.getStableBounds(desktopStableBounds); final int padding = desktopStableBounds.top; @@ -481,6 +530,18 @@ public class DesktopModeVisualIndicator { return new Rect(desktopStableBounds.width() / 2 + padding, padding, desktopStableBounds.width() - padding, desktopStableBounds.height()); + case TO_BUBBLE_LEFT_INDICATOR: + if (bubbleBoundsProvider == null) { + return new Rect(); + } + return bubbleBoundsProvider.getBubbleBarExpandedViewDropTargetBounds( + /* onLeft= */ true); + case TO_BUBBLE_RIGHT_INDICATOR: + if (bubbleBoundsProvider == null) { + return new Rect(); + } + return bubbleBoundsProvider.getBubbleBarExpandedViewDropTargetBounds( + /* onLeft= */ false); default: throw new IllegalArgumentException("Invalid indicator type provided."); } diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopTasksController.kt b/libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopTasksController.kt index fb4016c4e7b6..0d32acd6b068 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopTasksController.kt +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopTasksController.kt @@ -150,6 +150,7 @@ import java.util.Optional import java.util.concurrent.Executor import java.util.concurrent.TimeUnit import java.util.function.Consumer +import kotlin.jvm.optionals.getOrNull /** Handles moving tasks in and out of desktop */ class DesktopTasksController( @@ -2706,6 +2707,7 @@ class DesktopTasksController( taskSurface, rootTaskDisplayAreaOrganizer, dragStartState, + bubbleController.getOrNull()?.bubbleDropTargetBoundsProvider, ) if (visualIndicator == null) visualIndicator = indicator return indicator.updateIndicatorType(PointF(inputX, taskTop)) @@ -2788,7 +2790,11 @@ class DesktopTasksController( desktopModeWindowDecoration, ) } - IndicatorType.NO_INDICATOR -> { + IndicatorType.NO_INDICATOR, + IndicatorType.TO_BUBBLE_LEFT_INDICATOR, + IndicatorType.TO_BUBBLE_RIGHT_INDICATOR -> { + // TODO(b/391928049): add support fof dragging desktop apps to a bubble + // Create a copy so that we can animate from the current bounds if we end up having // to snap the surface back without a WCT change. val destinationBounds = Rect(currentDragBounds) @@ -2915,6 +2921,11 @@ class DesktopTasksController( ) requestSplit(taskInfo, leftOrTop = false) } + IndicatorType.TO_BUBBLE_LEFT_INDICATOR, + IndicatorType.TO_BUBBLE_RIGHT_INDICATOR -> { + // TODO(b/388851898): move to bubble + cancelDragToDesktop(taskInfo) + } } return indicatorType } diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/tv/TvPipMenuController.java b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/tv/TvPipMenuController.java index e74870d4d139..5894ea8d0b5c 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/tv/TvPipMenuController.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/tv/TvPipMenuController.java @@ -32,6 +32,7 @@ import android.view.View; import android.view.ViewRootImpl; import android.view.WindowManager; import android.view.WindowManagerGlobal; +import android.view.accessibility.AccessibilityManager; import android.window.SurfaceSyncGroup; import androidx.annotation.Nullable; @@ -63,6 +64,8 @@ public class TvPipMenuController implements PipMenuController, TvPipMenuView.Lis private TvPipMenuView mPipMenuView; private TvPipBackgroundView mPipBackgroundView; + private final AccessibilityManager mA11yManager; + private boolean mIsReloading; private static final int PIP_MENU_FORCE_CLOSE_DELAY_MS = 10_000; private final Runnable mClosePipMenuRunnable = this::closeMenu; @@ -107,6 +110,8 @@ public class TvPipMenuController implements PipMenuController, TvPipMenuView.Lis mSystemWindows = systemWindows; mMainHandler = mainHandler; + mA11yManager = context.getSystemService(AccessibilityManager.class); + // We need to "close" the menu the platform call for all the system dialogs to close (for // example, on the Home button press). final BroadcastReceiver closeSystemDialogsBroadcastReceiver = new BroadcastReceiver() { @@ -499,7 +504,9 @@ public class TvPipMenuController implements PipMenuController, TvPipMenuView.Lis switchToMenuMode(menuMode); } else { if (isMenuOpen(menuMode)) { - mMainHandler.postDelayed(mClosePipMenuRunnable, PIP_MENU_FORCE_CLOSE_DELAY_MS); + if (!mA11yManager.isEnabled()) { + mMainHandler.postDelayed(mClosePipMenuRunnable, PIP_MENU_FORCE_CLOSE_DELAY_MS); + } mMenuModeOnFocus = menuMode; } // Send a request to gain window focus if the menu is open, or lose window focus @@ -594,8 +601,10 @@ public class TvPipMenuController implements PipMenuController, TvPipMenuView.Lis public void onUserInteracting() { ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE, "%s: onUserInteracting - mCurrentMenuMode=%s", TAG, getMenuModeString()); - mMainHandler.removeCallbacks(mClosePipMenuRunnable); - mMainHandler.postDelayed(mClosePipMenuRunnable, PIP_MENU_FORCE_CLOSE_DELAY_MS); + if (mMainHandler.hasCallbacks(mClosePipMenuRunnable)) { + mMainHandler.removeCallbacks(mClosePipMenuRunnable); + mMainHandler.postDelayed(mClosePipMenuRunnable, PIP_MENU_FORCE_CLOSE_DELAY_MS); + } } @Override diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/taskview/TaskViewTransitions.java b/libs/WindowManager/Shell/src/com/android/wm/shell/taskview/TaskViewTransitions.java index 9af23080351f..a6f872634ee9 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/taskview/TaskViewTransitions.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/taskview/TaskViewTransitions.java @@ -52,6 +52,7 @@ import com.android.wm.shell.Flags; import com.android.wm.shell.ShellTaskOrganizer; import com.android.wm.shell.common.SyncTransactionQueue; import com.android.wm.shell.shared.TransitionUtil; +import com.android.wm.shell.shared.bubbles.BubbleAnythingFlagHelper; import com.android.wm.shell.transition.Transitions; import java.util.ArrayList; @@ -571,7 +572,7 @@ public class TaskViewTransitions implements Transitions.TransitionHandler, TaskV @NonNull SurfaceControl.Transaction startTransaction, @NonNull SurfaceControl.Transaction finishTransaction, @NonNull Transitions.TransitionFinishCallback finishCallback) { - PendingTransition pending = findPending(transition); + final PendingTransition pending = findPending(transition); if (pending != null) { mPending.remove(pending); } @@ -586,10 +587,11 @@ public class TaskViewTransitions implements Transitions.TransitionHandler, TaskV WindowContainerTransaction wct = null; for (int i = 0; i < info.getChanges().size(); ++i) { final TransitionInfo.Change chg = info.getChanges().get(i); - if (chg.getTaskInfo() == null) continue; + final ActivityManager.RunningTaskInfo taskInfo = chg.getTaskInfo(); + if (taskInfo == null) continue; if (TransitionUtil.isClosingType(chg.getMode())) { final boolean isHide = chg.getMode() == TRANSIT_TO_BACK; - TaskViewTaskController tv = findTaskView(chg.getTaskInfo()); + TaskViewTaskController tv = findTaskView(taskInfo); if (tv == null && !isHide) { // TaskView can be null when closing changesHandled++; @@ -599,7 +601,7 @@ public class TaskViewTransitions implements Transitions.TransitionHandler, TaskV if (pending != null) { Slog.w(TAG, "Found a non-TaskView task in a TaskView Transition. This " + "shouldn't happen, so there may be a visual artifact: " - + chg.getTaskInfo().taskId); + + taskInfo.taskId); } continue; } @@ -615,40 +617,51 @@ public class TaskViewTransitions implements Transitions.TransitionHandler, TaskV } changesHandled++; } else if (TransitionUtil.isOpeningType(chg.getMode())) { - final boolean taskIsNew = chg.getMode() == TRANSIT_OPEN; - final TaskViewTaskController tv; - if (taskIsNew) { - if (pending == null - || !chg.getTaskInfo().containsLaunchCookie(pending.mLaunchCookie)) { + boolean isNewInTaskView = false; + TaskViewTaskController tv; + if (chg.getMode() == TRANSIT_OPEN) { + isNewInTaskView = true; + if (pending == null || !taskInfo.containsLaunchCookie(pending.mLaunchCookie)) { Slog.e(TAG, "Found a launching TaskView in the wrong transition. All " + "TaskView launches should be initiated by shell and in their " - + "own transition: " + chg.getTaskInfo().taskId); + + "own transition: " + taskInfo.taskId); continue; } stillNeedsMatchingLaunch = false; tv = pending.mTaskView; } else { - tv = findTaskView(chg.getTaskInfo()); - if (tv == null) { - if (pending != null) { - Slog.w(TAG, "Found a non-TaskView task in a TaskView Transition. This " - + "shouldn't happen, so there may be a visual artifact: " - + chg.getTaskInfo().taskId); + tv = findTaskView(taskInfo); + if (tv == null && pending != null) { + if (BubbleAnythingFlagHelper.enableCreateAnyBubble() + && chg.getMode() == TRANSIT_TO_FRONT + && pending.mTaskView.getPendingInfo() != null + && pending.mTaskView.getPendingInfo().taskId == taskInfo.taskId) { + // In this case an existing task, not currently in TaskView, is + // brought to the front to be moved into TaskView. This is still + // "new" from TaskView's perspective. (e.g. task being moved into a + // bubble) + isNewInTaskView = true; + stillNeedsMatchingLaunch = false; + tv = pending.mTaskView; + } else { + Slog.w(TAG, "Found a non-TaskView task in a TaskView Transition. " + + "This shouldn't happen, so there may be a visual " + + "artifact: " + taskInfo.taskId); } - continue; } + if (tv == null) continue; } if (wct == null) wct = new WindowContainerTransaction(); - prepareOpenAnimation(tv, taskIsNew, startTransaction, finishTransaction, - chg.getTaskInfo(), chg.getLeash(), wct); + prepareOpenAnimation(tv, isNewInTaskView, startTransaction, finishTransaction, + taskInfo, chg.getLeash(), wct); changesHandled++; } else if (chg.getMode() == TRANSIT_CHANGE) { - TaskViewTaskController tv = findTaskView(chg.getTaskInfo()); + TaskViewTaskController tv = findTaskView(taskInfo); if (tv == null) { if (pending != null) { Slog.w(TAG, "Found a non-TaskView task in a TaskView Transition. This " + "shouldn't happen, so there may be a visual artifact: " - + chg.getTaskInfo().taskId); + + taskInfo.taskId); } continue; } 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 72cbc4702ac8..c90f6cf62b7e 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 @@ -193,6 +193,9 @@ public class Transitions implements RemoteCallable<Transitions>, /** Transition to end the recents transition */ public static final int TRANSIT_END_RECENTS_TRANSITION = TRANSIT_FIRST_CUSTOM + 22; + /** Transition type for app compat reachability. */ + public static final int TRANSIT_MOVE_LETTERBOX_REACHABILITY = TRANSIT_FIRST_CUSTOM + 23; + /** Transition type for desktop mode transitions. */ public static final int TRANSIT_DESKTOP_MODE_TYPES = WindowManager.TRANSIT_FIRST_CUSTOM + 100; 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 740adf320f53..a3a0baebcba1 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 @@ -1659,8 +1659,9 @@ public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel, if (mDesktopModeCompatPolicy.isTopActivityExemptFromDesktopWindowing(taskInfo)) { return false; } - final boolean isOnLargeScreen = taskInfo.getConfiguration().smallestScreenWidthDp - >= WindowManager.LARGE_SCREEN_SMALLEST_SCREEN_WIDTH_DP; + final boolean isOnLargeScreen = + mDisplayController.getDisplay(taskInfo.displayId).getMinSizeDimensionDp() + >= WindowManager.LARGE_SCREEN_SMALLEST_SCREEN_WIDTH_DP; if (!DesktopModeStatus.canEnterDesktopMode(mContext) && DesktopModeStatus.overridesShowAppHandle(mContext) && !isOnLargeScreen) { // Devices with multiple screens may enable the app handle but it should not show on diff --git a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/common/InputChannelSupplierTest.kt b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/common/InputChannelSupplierTest.kt new file mode 100644 index 000000000000..09c2faaa2670 --- /dev/null +++ b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/common/InputChannelSupplierTest.kt @@ -0,0 +1,42 @@ +/* + * Copyright 2025 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.common + +import android.testing.AndroidTestingRunner +import android.view.InputChannel +import androidx.test.filters.SmallTest +import org.junit.Test +import org.junit.runner.RunWith + +/** + * Tests for [InputChannelSupplier]. + * + * Build/Install/Run: + * atest WMShellUnitTests:InputChannelSupplierTest + */ +@RunWith(AndroidTestingRunner::class) +@SmallTest +class InputChannelSupplierTest { + + @Test + fun `InputChannelSupplier supplies an InputChannel`() { + val supplier = InputChannelSupplier() + SuppliersUtilsTest.assertSupplierProvidesValue(supplier) { + it is InputChannel + } + } +} diff --git a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/common/SuppliersUtilsTest.kt b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/common/SuppliersUtilsTest.kt new file mode 100644 index 000000000000..8468c636542e --- /dev/null +++ b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/common/SuppliersUtilsTest.kt @@ -0,0 +1,34 @@ +/* + * Copyright 2025 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.common + +import java.util.function.Supplier + +/** + * Utility class we can use to test a []Supplier<T>] of any parameters type [T]. + */ +class SuppliersUtilsTest { + + companion object { + /** + * Allows to check that the object supplied is asserts what in [assertion]. + */ + fun <T> assertSupplierProvidesValue(supplier: Supplier<T>, assertion: (Any?) -> Boolean) { + assert(assertion(supplier.get())) { "Supplier didn't provided what is expected" } + } + } +} diff --git a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/common/WindowSessionSupplierTest.kt b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/common/WindowSessionSupplierTest.kt new file mode 100644 index 000000000000..33e8d78d6a15 --- /dev/null +++ b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/common/WindowSessionSupplierTest.kt @@ -0,0 +1,42 @@ +/* + * Copyright 2025 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.common + +import android.testing.AndroidTestingRunner +import android.view.IWindowSession +import androidx.test.filters.SmallTest +import org.junit.Test +import org.junit.runner.RunWith + +/** + * Tests for [WindowSessionSupplier]. + * + * Build/Install/Run: + * atest WMShellUnitTests:WindowSessionSupplierTest + */ +@RunWith(AndroidTestingRunner::class) +@SmallTest +class WindowSessionSupplierTest { + + @Test + fun `InputChannelSupplier supplies an InputChannel`() { + val supplier = WindowSessionSupplier() + SuppliersUtilsTest.assertSupplierProvidesValue(supplier) { + it is IWindowSession + } + } +} diff --git a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/common/transition/SurfaceBuilderSupplierTest.kt b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/common/transition/SurfaceBuilderSupplierTest.kt new file mode 100644 index 000000000000..f88f72356759 --- /dev/null +++ b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/common/transition/SurfaceBuilderSupplierTest.kt @@ -0,0 +1,43 @@ +/* + * Copyright 2025 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.common.transition + +import android.testing.AndroidTestingRunner +import android.view.SurfaceControl +import androidx.test.filters.SmallTest +import com.android.wm.shell.common.SuppliersUtilsTest +import org.junit.Test +import org.junit.runner.RunWith + +/** + * Tests for [SurfaceBuilderSupplier]. + * + * Build/Install/Run: + * atest WMShellUnitTests:SurfaceBuilderSupplierTest + */ +@RunWith(AndroidTestingRunner::class) +@SmallTest +class SurfaceBuilderSupplierTest { + + @Test + fun `SurfaceBuilderSupplier supplies an SurfaceControl Builder`() { + val supplier = SurfaceBuilderSupplier() + SuppliersUtilsTest.assertSupplierProvidesValue(supplier) { + it is SurfaceControl.Builder + } + } +} diff --git a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/common/transition/TransactionSupplierTest.kt b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/common/transition/TransactionSupplierTest.kt new file mode 100644 index 000000000000..12b4d8b5f96b --- /dev/null +++ b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/common/transition/TransactionSupplierTest.kt @@ -0,0 +1,43 @@ +/* + * Copyright 2025 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.common.transition + +import android.testing.AndroidTestingRunner +import android.view.SurfaceControl +import androidx.test.filters.SmallTest +import com.android.wm.shell.common.SuppliersUtilsTest +import org.junit.Test +import org.junit.runner.RunWith + +/** + * Tests for [TransactionSupplier]. + * + * Build/Install/Run: + * atest WMShellUnitTests:TransactionSupplierTest + */ +@RunWith(AndroidTestingRunner::class) +@SmallTest +class TransactionSupplierTest { + + @Test + fun `SurfaceBuilderSupplier supplies a Transaction`() { + val supplier = TransactionSupplier() + SuppliersUtilsTest.assertSupplierProvidesValue(supplier) { + it is SurfaceControl.Transaction + } + } +} diff --git a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/compatui/letterbox/LetterboxControllerRobotTest.kt b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/compatui/letterbox/LetterboxControllerRobotTest.kt index 88cc981dd30c..e34884b103f6 100644 --- a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/compatui/letterbox/LetterboxControllerRobotTest.kt +++ b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/compatui/letterbox/LetterboxControllerRobotTest.kt @@ -33,10 +33,10 @@ abstract class LetterboxControllerRobotTest { companion object { @JvmStatic - private val DISPLAY_ID = 1 + val DISPLAY_ID = 1 @JvmStatic - private val TASK_ID = 20 + val TASK_ID = 20 } lateinit var letterboxController: LetterboxController diff --git a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/compatui/letterbox/LetterboxGestureDelegateTest.kt b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/compatui/letterbox/LetterboxGestureDelegateTest.kt new file mode 100644 index 000000000000..bc3416a88918 --- /dev/null +++ b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/compatui/letterbox/LetterboxGestureDelegateTest.kt @@ -0,0 +1,75 @@ +/* + * Copyright 2025 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.compatui.letterbox + +import android.testing.AndroidTestingRunner +import androidx.test.filters.SmallTest +import com.android.dx.mockito.inline.extended.ExtendedMockito.spyOn +import com.android.wm.shell.compatui.letterbox.LetterboxEvents.motionEventAt +import org.junit.Before +import org.junit.Test +import org.junit.runner.RunWith +import org.mockito.kotlin.verify + +/** + * Tests for [LetterboxGestureDelegate]. + * + * Build/Install/Run: + * atest WMShellUnitTests:LetterboxGestureDelegateTest + */ +@RunWith(AndroidTestingRunner::class) +@SmallTest +class LetterboxGestureDelegateTest { + + class DelegateTest : LetterboxGestureListener by LetterboxGestureDelegate + + val delegate = DelegateTest() + + @Before + fun setUp() { + spyOn(LetterboxGestureDelegate) + } + + @Test + fun `When delegating all methods are invoked`() { + val event = motionEventAt(0f, 0f) + with(delegate) { + onDown(event) + onShowPress(event) + onSingleTapUp(event) + onScroll(event, event, 0f, 0f) + onFling(event, event, 0f, 0f) + onLongPress(event) + onSingleTapConfirmed(event) + onDoubleTap(event) + onDoubleTapEvent(event) + onContextClick(event) + } + with(LetterboxGestureDelegate) { + verify(this).onDown(event) + verify(this).onShowPress(event) + verify(this).onSingleTapUp(event) + verify(this).onScroll(event, event, 0f, 0f) + verify(this).onFling(event, event, 0f, 0f) + verify(this).onLongPress(event) + verify(this).onSingleTapConfirmed(event) + verify(this).onDoubleTap(event) + verify(this).onDoubleTapEvent(event) + verify(this).onContextClick(event) + } + } +} diff --git a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/compatui/letterbox/LetterboxInputControllerTest.kt b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/compatui/letterbox/LetterboxInputControllerTest.kt new file mode 100644 index 000000000000..fa95faee4b6e --- /dev/null +++ b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/compatui/letterbox/LetterboxInputControllerTest.kt @@ -0,0 +1,203 @@ +/* + * Copyright 2025 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.compatui.letterbox + +import android.content.Context +import android.graphics.Rect +import android.graphics.Region +import android.os.Handler +import android.os.Looper +import android.testing.AndroidTestingRunner +import android.view.IWindowSession +import android.view.InputChannel +import androidx.test.filters.SmallTest +import com.android.wm.shell.ShellTestCase +import com.android.wm.shell.common.InputChannelSupplier +import com.android.wm.shell.common.WindowSessionSupplier +import com.android.wm.shell.compatui.letterbox.LetterboxMatchers.asAnyMode +import com.android.wm.shell.windowdecor.DesktopModeWindowDecorViewModelTestsBase.Companion.TAG +import java.util.function.Consumer +import java.util.function.Supplier +import org.junit.Test +import org.junit.runner.RunWith +import org.mockito.kotlin.any +import org.mockito.kotlin.doReturn +import org.mockito.kotlin.eq +import org.mockito.kotlin.mock +import org.mockito.kotlin.times +import org.mockito.kotlin.verify + +/** + * Tests for [LetterboxInputController]. + * + * Build/Install/Run: + * atest WMShellUnitTests:LetterboxInputControllerTest + */ +@RunWith(AndroidTestingRunner::class) +@SmallTest +class LetterboxInputControllerTest : ShellTestCase() { + + @Test + fun `When creation is requested the surface is created if not present`() { + runTestScenario { r -> + r.sendCreateSurfaceRequest() + + r.checkInputSurfaceBuilderInvoked() + } + } + + @Test + fun `When creation is requested multiple times the input surface is created once`() { + runTestScenario { r -> + r.sendCreateSurfaceRequest() + r.sendCreateSurfaceRequest() + r.sendCreateSurfaceRequest() + r.sendCreateSurfaceRequest() + + r.checkInputSurfaceBuilderInvoked(times = 1) + } + } + + @Test + fun `A different input surface is created for every key`() { + runTestScenario { r -> + r.sendCreateSurfaceRequest() + r.sendCreateSurfaceRequest() + r.sendCreateSurfaceRequest(displayId = 2) + r.sendCreateSurfaceRequest(displayId = 2, taskId = 2) + r.sendCreateSurfaceRequest(displayId = 2) + r.sendCreateSurfaceRequest(displayId = 2, taskId = 2) + + r.checkInputSurfaceBuilderInvoked(times = 3) + } + } + + @Test + fun `Created spy surface is removed once`() { + runTestScenario { r -> + r.sendCreateSurfaceRequest() + r.checkInputSurfaceBuilderInvoked() + + r.sendDestroySurfaceRequest() + r.sendDestroySurfaceRequest() + r.sendDestroySurfaceRequest() + + r.checkTransactionRemovedInvoked() + } + } + @Test + fun `Only existing surfaces receive visibility update`() { + runTestScenario { r -> + r.sendCreateSurfaceRequest() + r.sendUpdateSurfaceVisibilityRequest(visible = true) + r.sendUpdateSurfaceVisibilityRequest(visible = true, displayId = 20) + + r.checkVisibilityUpdated(expectedVisibility = true) + } + } + + @Test + fun `Only existing surfaces receive taskBounds update`() { + runTestScenario { r -> + r.sendUpdateSurfaceBoundsRequest( + taskBounds = Rect(0, 0, 2000, 1000), + activityBounds = Rect(500, 0, 1500, 1000) + ) + + r.checkUpdateSessionRegion(times = 0, region = Region(0, 0, 2000, 1000)) + r.checkSurfaceSizeUpdated(times = 0, expectedWidth = 2000, expectedHeight = 1000) + + r.resetTransitionTest() + + r.sendCreateSurfaceRequest() + r.sendUpdateSurfaceBoundsRequest( + taskBounds = Rect(0, 0, 2000, 1000), + activityBounds = Rect(500, 0, 1500, 1000) + ) + r.checkUpdateSessionRegion(region = Region(0, 0, 2000, 1000)) + r.checkSurfaceSizeUpdated(expectedWidth = 2000, expectedHeight = 1000) + } + } + + /** + * Runs a test scenario providing a Robot. + */ + fun runTestScenario(consumer: Consumer<InputLetterboxControllerRobotTest>) { + consumer.accept(InputLetterboxControllerRobotTest(mContext).apply { initController() }) + } + + class InputLetterboxControllerRobotTest(private val context: Context) : + LetterboxControllerRobotTest() { + + private val inputSurfaceBuilder: LetterboxInputSurfaceBuilder + private val handler = Handler(Looper.getMainLooper()) + private val listener: LetterboxGestureListener + private val listenerSupplier: Supplier<LetterboxGestureListener> + private val windowSessionSupplier: WindowSessionSupplier + private val windowSession: IWindowSession + private val inputChannelSupplier: InputChannelSupplier + + init { + inputSurfaceBuilder = getLetterboxInputSurfaceBuilderMock() + listener = mock<LetterboxGestureListener>() + listenerSupplier = mock<Supplier<LetterboxGestureListener>>() + doReturn(LetterboxGestureDelegate).`when`(listenerSupplier).get() + windowSessionSupplier = mock<WindowSessionSupplier>() + windowSession = mock<IWindowSession>() + doReturn(windowSession).`when`(windowSessionSupplier).get() + inputChannelSupplier = mock<InputChannelSupplier>() + val inputChannels = InputChannel.openInputChannelPair(TAG) + inputChannels.first().dispose() + doReturn(inputChannels[1]).`when`(inputChannelSupplier).get() + } + + override fun buildController(): LetterboxController = + LetterboxInputController( + context, + handler, + inputSurfaceBuilder, + listenerSupplier, + windowSessionSupplier, + inputChannelSupplier + ) + + fun checkInputSurfaceBuilderInvoked( + times: Int = 1, + name: String = "", + callSite: String = "" + ) { + verify(inputSurfaceBuilder, times(times)).createInputSurface( + eq(transaction), + eq(parentLeash), + name.asAnyMode(), + callSite.asAnyMode() + ) + } + + fun checkUpdateSessionRegion(times: Int = 1, displayId: Int = DISPLAY_ID, region: Region) { + verify(windowSession, times(times)).updateInputChannel( + any(), + eq(displayId), + any(), + any(), + any(), + any(), + eq(region) + ) + } + } +} diff --git a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/compatui/letterbox/LetterboxTestUtils.kt b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/compatui/letterbox/LetterboxTestUtils.kt index 2c06dfda7917..3ce1fec32a16 100644 --- a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/compatui/letterbox/LetterboxTestUtils.kt +++ b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/compatui/letterbox/LetterboxTestUtils.kt @@ -16,6 +16,8 @@ package com.android.wm.shell.compatui.letterbox +import android.view.MotionEvent.ACTION_DOWN +import android.view.MotionEvent.obtain import android.view.SurfaceControl import org.mockito.kotlin.any import org.mockito.kotlin.anyOrNull @@ -37,6 +39,18 @@ fun getTransactionMock(): SurfaceControl.Transaction = mock<SurfaceControl.Trans doReturn(this).`when`(this).setWindowCrop(anyOrNull(), any(), any()) } +/** + * @return A [LetterboxInputSurfaceBuilder] mock to use in tests. + */ +fun getLetterboxInputSurfaceBuilderMock() = mock<LetterboxInputSurfaceBuilder>().apply { + doReturn(SurfaceControl()).`when`(this).createInputSurface( + any(), + any(), + any(), + any() + ) +} + // Utility to make verification mode depending on a [Boolean]. fun Boolean.asMode(): VerificationMode = if (this) times(1) else never() @@ -47,5 +61,10 @@ object LetterboxMatchers { fun String.asAnyMode() = asAnyMode { this.isEmpty() } } +object LetterboxEvents { + fun motionEventAt(x: Float, y: Float) = + obtain(0, 10, ACTION_DOWN, x, y, 0) +} + private inline fun <reified T : Any> T.asAnyMode(condition: () -> Boolean) = (if (condition()) any() else eq(this)) diff --git a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/desktopmode/DesktopModeVisualIndicatorTest.kt b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/desktopmode/DesktopModeVisualIndicatorTest.kt index 13b44977e9c7..a6575535faee 100644 --- a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/desktopmode/DesktopModeVisualIndicatorTest.kt +++ b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/desktopmode/DesktopModeVisualIndicatorTest.kt @@ -16,11 +16,11 @@ package com.android.wm.shell.desktopmode +import android.animation.AnimatorTestRule import android.app.ActivityManager.RunningTaskInfo import android.graphics.PointF import android.graphics.Rect import android.platform.test.annotations.EnableFlags -import android.platform.test.flag.junit.SetFlagsRule import android.testing.AndroidTestingRunner import android.testing.TestableLooper.RunWithLooper import android.view.SurfaceControl @@ -34,6 +34,7 @@ import com.android.wm.shell.ShellTestCase import com.android.wm.shell.common.DisplayController import com.android.wm.shell.common.DisplayLayout import com.android.wm.shell.common.SyncTransactionQueue +import com.android.wm.shell.shared.bubbles.BubbleDropTargetBoundsProvider import com.android.wm.shell.shared.desktopmode.DesktopModeStatus import com.google.common.truth.Truth.assertThat import org.junit.Before @@ -56,7 +57,7 @@ import org.mockito.kotlin.whenever @EnableFlags(FLAG_ENABLE_DESKTOP_WINDOWING_MODE) class DesktopModeVisualIndicatorTest : ShellTestCase() { - @JvmField @Rule val setFlagsRule = SetFlagsRule() + @JvmField @Rule val animatorTestRule = AnimatorTestRule(this) @JvmField @Rule @@ -69,6 +70,7 @@ class DesktopModeVisualIndicatorTest : ShellTestCase() { @Mock private lateinit var taskSurface: SurfaceControl @Mock private lateinit var taskDisplayAreaOrganizer: RootTaskDisplayAreaOrganizer @Mock private lateinit var displayLayout: DisplayLayout + @Mock private lateinit var bubbleBoundsProvider: BubbleDropTargetBoundsProvider private lateinit var visualIndicator: DesktopModeVisualIndicator @@ -80,6 +82,8 @@ class DesktopModeVisualIndicatorTest : ShellTestCase() { whenever(displayLayout.stableInsets()).thenReturn(STABLE_INSETS) whenever(displayController.getDisplayLayout(anyInt())).thenReturn(displayLayout) whenever(displayController.getDisplay(anyInt())).thenReturn(mContext.display) + whenever(bubbleBoundsProvider.getBubbleBarExpandedViewDropTargetBounds(any())) + .thenReturn(Rect()) taskInfo = DesktopTestHelpers.createFullscreenTask() } @@ -194,6 +198,40 @@ class DesktopModeVisualIndicatorTest : ShellTestCase() { } @Test + fun testBubbleLeftRegionCalculation() { + val bubbleRegionWidth = + context.resources.getDimensionPixelSize(R.dimen.bubble_transform_area_width) + val bubbleRegionHeight = + context.resources.getDimensionPixelSize(R.dimen.bubble_transform_area_height) + val expectedRect = Rect(0, 1600 - bubbleRegionHeight, bubbleRegionWidth, 1600) + + createVisualIndicator(DesktopModeVisualIndicator.DragStartState.FROM_FULLSCREEN) + var testRegion = visualIndicator.calculateBubbleLeftRegion(displayLayout) + assertThat(testRegion.bounds).isEqualTo(expectedRect) + + createVisualIndicator(DesktopModeVisualIndicator.DragStartState.FROM_SPLIT) + testRegion = visualIndicator.calculateBubbleLeftRegion(displayLayout) + assertThat(testRegion.bounds).isEqualTo(expectedRect) + } + + @Test + fun testBubbleRightRegionCalculation() { + val bubbleRegionWidth = + context.resources.getDimensionPixelSize(R.dimen.bubble_transform_area_width) + val bubbleRegionHeight = + context.resources.getDimensionPixelSize(R.dimen.bubble_transform_area_height) + val expectedRect = Rect(2400 - bubbleRegionWidth, 1600 - bubbleRegionHeight, 2400, 1600) + + createVisualIndicator(DesktopModeVisualIndicator.DragStartState.FROM_FULLSCREEN) + var testRegion = visualIndicator.calculateBubbleRightRegion(displayLayout) + assertThat(testRegion.bounds).isEqualTo(expectedRect) + + createVisualIndicator(DesktopModeVisualIndicator.DragStartState.FROM_SPLIT) + testRegion = visualIndicator.calculateBubbleRightRegion(displayLayout) + assertThat(testRegion.bounds).isEqualTo(expectedRect) + } + + @Test fun testDefaultIndicators() { createVisualIndicator(DesktopModeVisualIndicator.DragStartState.FROM_FULLSCREEN) var result = visualIndicator.updateIndicatorType(PointF(-10000f, 500f)) @@ -219,31 +257,79 @@ class DesktopModeVisualIndicatorTest : ShellTestCase() { fun testDefaultIndicatorWithNoDesktop() { whenever(DesktopModeStatus.canEnterDesktopMode(any())).thenReturn(false) + // Fullscreen to center, no desktop indicator createVisualIndicator(DesktopModeVisualIndicator.DragStartState.FROM_FULLSCREEN) var result = visualIndicator.updateIndicatorType(PointF(500f, 500f)) assertThat(result).isEqualTo(DesktopModeVisualIndicator.IndicatorType.NO_INDICATOR) - + // Fullscreen to split result = visualIndicator.updateIndicatorType(PointF(10000f, 500f)) assertThat(result) .isEqualTo(DesktopModeVisualIndicator.IndicatorType.TO_SPLIT_RIGHT_INDICATOR) - result = visualIndicator.updateIndicatorType(PointF(-10000f, 500f)) assertThat(result) .isEqualTo(DesktopModeVisualIndicator.IndicatorType.TO_SPLIT_LEFT_INDICATOR) - + // Fullscreen to bubble + result = visualIndicator.updateIndicatorType(PointF(100f, 1500f)) + assertThat(result) + .isEqualTo(DesktopModeVisualIndicator.IndicatorType.TO_BUBBLE_LEFT_INDICATOR) + result = visualIndicator.updateIndicatorType(PointF(2300f, 1500f)) + assertThat(result) + .isEqualTo(DesktopModeVisualIndicator.IndicatorType.TO_BUBBLE_RIGHT_INDICATOR) + // Split to center, no desktop indicator createVisualIndicator(DesktopModeVisualIndicator.DragStartState.FROM_SPLIT) result = visualIndicator.updateIndicatorType(PointF(500f, 500f)) assertThat(result).isEqualTo(DesktopModeVisualIndicator.IndicatorType.NO_INDICATOR) - + // Split to fullscreen result = visualIndicator.updateIndicatorType(PointF(500f, 0f)) assertThat(result) .isEqualTo(DesktopModeVisualIndicator.IndicatorType.TO_FULLSCREEN_INDICATOR) - + // Split to bubble + result = visualIndicator.updateIndicatorType(PointF(100f, 1500f)) + assertThat(result) + .isEqualTo(DesktopModeVisualIndicator.IndicatorType.TO_BUBBLE_LEFT_INDICATOR) + result = visualIndicator.updateIndicatorType(PointF(2300f, 1500f)) + assertThat(result) + .isEqualTo(DesktopModeVisualIndicator.IndicatorType.TO_BUBBLE_RIGHT_INDICATOR) + // Drag app to center, no desktop indicator createVisualIndicator(DesktopModeVisualIndicator.DragStartState.DRAGGED_INTENT) result = visualIndicator.updateIndicatorType(PointF(500f, 500f)) assertThat(result).isEqualTo(DesktopModeVisualIndicator.IndicatorType.NO_INDICATOR) } + @Test + @EnableFlags( + com.android.wm.shell.Flags.FLAG_ENABLE_BUBBLE_TO_FULLSCREEN, + com.android.wm.shell.Flags.FLAG_ENABLE_CREATE_ANY_BUBBLE, + ) + fun testBubbleLeftVisualIndicatorSize() { + val dropTargetBounds = Rect(100, 100, 500, 1500) + whenever(bubbleBoundsProvider.getBubbleBarExpandedViewDropTargetBounds(/* onLeft= */ true)) + .thenReturn(dropTargetBounds) + createVisualIndicator(DesktopModeVisualIndicator.DragStartState.FROM_FULLSCREEN) + visualIndicator.updateIndicatorType(PointF(100f, 1500f)) + + animatorTestRule.advanceTimeBy(200) + + assertThat(visualIndicator.indicatorBounds).isEqualTo(dropTargetBounds) + } + + @Test + @EnableFlags( + com.android.wm.shell.Flags.FLAG_ENABLE_BUBBLE_TO_FULLSCREEN, + com.android.wm.shell.Flags.FLAG_ENABLE_CREATE_ANY_BUBBLE, + ) + fun testBubbleRightVisualIndicatorSize() { + val dropTargetBounds = Rect(1900, 100, 2300, 1500) + whenever(bubbleBoundsProvider.getBubbleBarExpandedViewDropTargetBounds(/* onLeft= */ false)) + .thenReturn(dropTargetBounds) + createVisualIndicator(DesktopModeVisualIndicator.DragStartState.FROM_FULLSCREEN) + visualIndicator.updateIndicatorType(PointF(2300f, 1500f)) + + animatorTestRule.advanceTimeBy(200) + + assertThat(visualIndicator.indicatorBounds).isEqualTo(dropTargetBounds) + } + private fun createVisualIndicator(dragStartState: DesktopModeVisualIndicator.DragStartState) { visualIndicator = DesktopModeVisualIndicator( @@ -254,6 +340,7 @@ class DesktopModeVisualIndicatorTest : ShellTestCase() { taskSurface, taskDisplayAreaOrganizer, dragStartState, + bubbleBoundsProvider, ) } diff --git a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/shared/bubbles/DragZoneFactoryTest.kt b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/shared/bubbles/DragZoneFactoryTest.kt new file mode 100644 index 000000000000..e28d6ff8bf7f --- /dev/null +++ b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/shared/bubbles/DragZoneFactoryTest.kt @@ -0,0 +1,249 @@ +/* + * Copyright (C) 2025 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.shared.bubbles + +import android.graphics.Insets +import android.graphics.Rect +import androidx.test.ext.junit.runners.AndroidJUnit4 +import androidx.test.filters.SmallTest +import com.android.wm.shell.shared.bubbles.DragZoneFactory.DesktopWindowModeChecker +import com.android.wm.shell.shared.bubbles.DragZoneFactory.SplitScreenModeChecker +import com.android.wm.shell.shared.bubbles.DragZoneFactory.SplitScreenModeChecker.SplitScreenMode +import com.google.common.truth.Truth.assertThat +import org.junit.Test +import org.junit.runner.RunWith + +@SmallTest +@RunWith(AndroidJUnit4::class) +/** Unit tests for [DragZoneFactory]. */ +class DragZoneFactoryTest { + + private lateinit var dragZoneFactory: DragZoneFactory + private val tabletPortrait = + DeviceConfig( + windowBounds = Rect(0, 0, 1000, 2000), + isLargeScreen = true, + isSmallTablet = false, + isLandscape = false, + isRtl = false, + insets = Insets.of(0, 0, 0, 0) + ) + private val tabletLandscape = + tabletPortrait.copy(windowBounds = Rect(0, 0, 2000, 1000), isLandscape = true) + private val foldablePortrait = + tabletPortrait.copy(windowBounds = Rect(0, 0, 800, 900), isSmallTablet = true) + private val foldableLandscape = + foldablePortrait.copy(windowBounds = Rect(0, 0, 900, 800), isLandscape = true) + private val splitScreenModeChecker = SplitScreenModeChecker { SplitScreenMode.NONE } + private var isDesktopWindowModeSupported = true + private val desktopWindowModeChecker = DesktopWindowModeChecker { isDesktopWindowModeSupported } + + @Test + fun dragZonesForBubbleBar_tablet() { + dragZoneFactory = + DragZoneFactory(tabletPortrait, splitScreenModeChecker, desktopWindowModeChecker) + val dragZones = + dragZoneFactory.createSortedDragZones(DraggedObject.BubbleBar(BubbleBarLocation.LEFT)) + val expectedZones: List<Class<out DragZone>> = + listOf( + DragZone.Dismiss::class.java, + DragZone.Bubble::class.java, + DragZone.Bubble::class.java, + ) + dragZones.zip(expectedZones).forEach { (zone, expectedType) -> + assertThat(zone).isInstanceOf(expectedType) + } + } + + @Test + fun dragZonesForBubble_tablet_portrait() { + dragZoneFactory = + DragZoneFactory(tabletPortrait, splitScreenModeChecker, desktopWindowModeChecker) + val dragZones = + dragZoneFactory.createSortedDragZones(DraggedObject.Bubble(BubbleBarLocation.LEFT)) + val expectedZones: List<Class<out DragZone>> = + listOf( + DragZone.Dismiss::class.java, + DragZone.Bubble.Left::class.java, + DragZone.Bubble.Right::class.java, + DragZone.FullScreen::class.java, + DragZone.DesktopWindow::class.java, + DragZone.Split.Top::class.java, + DragZone.Split.Bottom::class.java, + ) + dragZones.zip(expectedZones).forEach { (zone, expectedType) -> + assertThat(zone).isInstanceOf(expectedType) + } + } + + @Test + fun dragZonesForBubble_tablet_landscape() { + dragZoneFactory = DragZoneFactory(tabletLandscape, splitScreenModeChecker, desktopWindowModeChecker) + val dragZones = + dragZoneFactory.createSortedDragZones(DraggedObject.Bubble(BubbleBarLocation.LEFT)) + val expectedZones: List<Class<out DragZone>> = + listOf( + DragZone.Dismiss::class.java, + DragZone.Bubble.Left::class.java, + DragZone.Bubble.Right::class.java, + DragZone.FullScreen::class.java, + DragZone.DesktopWindow::class.java, + DragZone.Split.Left::class.java, + DragZone.Split.Right::class.java, + ) + dragZones.zip(expectedZones).forEach { (zone, expectedType) -> + assertThat(zone).isInstanceOf(expectedType) + } + } + + @Test + fun dragZonesForBubble_foldable_portrait() { + dragZoneFactory = DragZoneFactory(foldablePortrait, splitScreenModeChecker, desktopWindowModeChecker) + val dragZones = + dragZoneFactory.createSortedDragZones(DraggedObject.Bubble(BubbleBarLocation.LEFT)) + val expectedZones: List<Class<out DragZone>> = + listOf( + DragZone.Dismiss::class.java, + DragZone.Bubble.Left::class.java, + DragZone.Bubble.Right::class.java, + DragZone.FullScreen::class.java, + DragZone.Split.Left::class.java, + DragZone.Split.Right::class.java, + ) + dragZones.zip(expectedZones).forEach { (zone, expectedType) -> + assertThat(zone).isInstanceOf(expectedType) + } + } + + @Test + fun dragZonesForBubble_foldable_landscape() { + dragZoneFactory = DragZoneFactory(foldableLandscape, splitScreenModeChecker, desktopWindowModeChecker) + val dragZones = + dragZoneFactory.createSortedDragZones(DraggedObject.Bubble(BubbleBarLocation.LEFT)) + val expectedZones: List<Class<out DragZone>> = + listOf( + DragZone.Dismiss::class.java, + DragZone.Bubble.Left::class.java, + DragZone.Bubble.Right::class.java, + DragZone.FullScreen::class.java, + DragZone.Split.Top::class.java, + DragZone.Split.Bottom::class.java, + ) + dragZones.zip(expectedZones).forEach { (zone, expectedType) -> + assertThat(zone).isInstanceOf(expectedType) + } + } + + @Test + fun dragZonesForExpandedView_tablet_portrait() { + dragZoneFactory = + DragZoneFactory(tabletPortrait, splitScreenModeChecker, desktopWindowModeChecker) + val dragZones = + dragZoneFactory.createSortedDragZones( + DraggedObject.ExpandedView(BubbleBarLocation.LEFT) + ) + val expectedZones: List<Class<out DragZone>> = + listOf( + DragZone.Dismiss::class.java, + DragZone.FullScreen::class.java, + DragZone.DesktopWindow::class.java, + DragZone.Split.Top::class.java, + DragZone.Split.Bottom::class.java, + DragZone.Bubble.Left::class.java, + DragZone.Bubble.Right::class.java, + ) + dragZones.zip(expectedZones).forEach { (zone, expectedType) -> + assertThat(zone).isInstanceOf(expectedType) + } + } + + @Test + fun dragZonesForExpandedView_tablet_landscape() { + dragZoneFactory = DragZoneFactory(tabletLandscape, splitScreenModeChecker, desktopWindowModeChecker) + val dragZones = + dragZoneFactory.createSortedDragZones(DraggedObject.ExpandedView(BubbleBarLocation.LEFT)) + val expectedZones: List<Class<out DragZone>> = + listOf( + DragZone.Dismiss::class.java, + DragZone.FullScreen::class.java, + DragZone.DesktopWindow::class.java, + DragZone.Split.Left::class.java, + DragZone.Split.Right::class.java, + DragZone.Bubble.Left::class.java, + DragZone.Bubble.Right::class.java, + ) + dragZones.zip(expectedZones).forEach { (zone, expectedType) -> + assertThat(zone).isInstanceOf(expectedType) + } + } + + @Test + fun dragZonesForExpandedView_foldable_portrait() { + dragZoneFactory = DragZoneFactory(foldablePortrait, splitScreenModeChecker, desktopWindowModeChecker) + val dragZones = + dragZoneFactory.createSortedDragZones(DraggedObject.ExpandedView(BubbleBarLocation.LEFT)) + val expectedZones: List<Class<out DragZone>> = + listOf( + DragZone.Dismiss::class.java, + DragZone.FullScreen::class.java, + DragZone.Split.Left::class.java, + DragZone.Split.Right::class.java, + DragZone.Bubble.Left::class.java, + DragZone.Bubble.Right::class.java, + ) + dragZones.zip(expectedZones).forEach { (zone, expectedType) -> + assertThat(zone).isInstanceOf(expectedType) + } + } + + @Test + fun dragZonesForExpandedView_foldable_landscape() { + dragZoneFactory = DragZoneFactory(foldableLandscape, splitScreenModeChecker, desktopWindowModeChecker) + val dragZones = + dragZoneFactory.createSortedDragZones(DraggedObject.ExpandedView(BubbleBarLocation.LEFT)) + val expectedZones: List<Class<out DragZone>> = + listOf( + DragZone.Dismiss::class.java, + DragZone.FullScreen::class.java, + DragZone.Split.Top::class.java, + DragZone.Split.Bottom::class.java, + DragZone.Bubble.Left::class.java, + DragZone.Bubble.Right::class.java, + ) + dragZones.zip(expectedZones).forEach { (zone, expectedType) -> + assertThat(zone).isInstanceOf(expectedType) + } + } + + @Test + fun dragZonesForBubble_tablet_desktopModeDisabled() { + isDesktopWindowModeSupported = false + dragZoneFactory = DragZoneFactory(foldableLandscape, splitScreenModeChecker, desktopWindowModeChecker) + val dragZones = + dragZoneFactory.createSortedDragZones(DraggedObject.Bubble(BubbleBarLocation.LEFT)) + assertThat(dragZones.filterIsInstance<DragZone.DesktopWindow>()).isEmpty() + } + + @Test + fun dragZonesForExpandedView_tablet_desktopModeDisabled() { + isDesktopWindowModeSupported = false + dragZoneFactory = DragZoneFactory(foldableLandscape, splitScreenModeChecker, desktopWindowModeChecker) + val dragZones = + dragZoneFactory.createSortedDragZones(DraggedObject.ExpandedView(BubbleBarLocation.LEFT)) + assertThat(dragZones.filterIsInstance<DragZone.DesktopWindow>()).isEmpty() + } +} diff --git a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecorViewModelAppHandleOnlyTest.kt b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecorViewModelAppHandleOnlyTest.kt index e40d97c68554..53ae967e7bbf 100644 --- a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecorViewModelAppHandleOnlyTest.kt +++ b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecorViewModelAppHandleOnlyTest.kt @@ -25,6 +25,7 @@ import android.content.pm.ActivityInfo import android.platform.test.annotations.EnableFlags import android.testing.AndroidTestingRunner import android.testing.TestableLooper.RunWithLooper +import android.view.Display import android.view.Display.DEFAULT_DISPLAY import android.view.SurfaceControl import androidx.test.filters.SmallTest @@ -38,10 +39,13 @@ import junit.framework.Assert.assertTrue import org.junit.Before import org.junit.Test import org.junit.runner.RunWith +import org.mockito.ArgumentMatchers.anyInt import org.mockito.Mockito.times import org.mockito.kotlin.any import org.mockito.kotlin.argumentCaptor +import org.mockito.kotlin.mock import org.mockito.kotlin.verify +import org.mockito.kotlin.whenever import org.mockito.quality.Strictness /** @@ -59,6 +63,8 @@ import org.mockito.quality.Strictness class DesktopModeWindowDecorViewModelAppHandleOnlyTest : DesktopModeWindowDecorViewModelTestsBase() { + protected val mockDisplay = mock<Display>() + @Before fun setUp() { mockitoSession = @@ -70,6 +76,7 @@ class DesktopModeWindowDecorViewModelAppHandleOnlyTest : doReturn(false).`when` { DesktopModeStatus.isDeviceEligibleForDesktopMode(any()) } doReturn(true).`when` { DesktopModeStatus.overridesShowAppHandle(any())} setUpCommon() + whenever(mockDisplayController.getDisplay(anyInt())).thenReturn(mockDisplay) } @Test @@ -156,7 +163,7 @@ class DesktopModeWindowDecorViewModelAppHandleOnlyTest : assertTrue(windowDecorByTaskIdSpy.contains(task.taskId)) - task.setOnLargeScreen(false) + setLargeScreen(false) setUpMockDecorationForTask(task) onTaskChanging(task, taskSurface) assertFalse(windowDecorByTaskIdSpy.contains(task.taskId)) @@ -172,11 +179,12 @@ class DesktopModeWindowDecorViewModelAppHandleOnlyTest : ): RunningTaskInfo { val task = createTask( displayId, windowingMode, activityType, activityInfo, requestingImmersive) - task.setOnLargeScreen(shouldShowAspectRatioButton) + setLargeScreen(shouldShowAspectRatioButton) return task } - private fun RunningTaskInfo.setOnLargeScreen(large: Boolean) { - configuration.smallestScreenWidthDp = if (large) 1000 else 100 + private fun setLargeScreen(large: Boolean) { + val size: Float = if (large) 1000f else 100f + whenever(mockDisplay.getMinSizeDimensionDp()).thenReturn(size) } } diff --git a/media/jni/android_media_MediaCodec.cpp b/media/jni/android_media_MediaCodec.cpp index 3bc238a812d9..61c287b9633c 100644 --- a/media/jni/android_media_MediaCodec.cpp +++ b/media/jni/android_media_MediaCodec.cpp @@ -1232,63 +1232,73 @@ static void AMessageToCryptoInfo(JNIEnv * env, const jobject & obj, sp<ABuffer> ivBuffer; CryptoPlugin::Mode mode; CryptoPlugin::Pattern pattern; - CHECK(msg->findInt32("mode", (int*)&mode)); - CHECK(msg->findSize("numSubSamples", &numSubSamples)); - CHECK(msg->findBuffer("subSamples", &subSamplesBuffer)); - CHECK(msg->findInt32("encryptBlocks", (int32_t *)&pattern.mEncryptBlocks)); - CHECK(msg->findInt32("skipBlocks", (int32_t *)&pattern.mSkipBlocks)); - CHECK(msg->findBuffer("iv", &ivBuffer)); - CHECK(msg->findBuffer("key", &keyBuffer)); - - // subsamples + CryptoPlugin::SubSample *samplesArray = nullptr; + ScopedLocalRef<jbyteArray> keyArray(env, env->NewByteArray(16)); + ScopedLocalRef<jbyteArray> ivArray(env, env->NewByteArray(16)); + jboolean isCopy; + sp<RefBase> cryptoInfosObj; + if (msg->findObject("cryptoInfos", &cryptoInfosObj)) { + sp<CryptoInfosWrapper> cryptoInfos((CryptoInfosWrapper*)cryptoInfosObj.get()); + CHECK(!cryptoInfos->value.empty() && (cryptoInfos->value[0] != nullptr)); + std::unique_ptr<CodecCryptoInfo> &info = cryptoInfos->value[0]; + mode = info->mMode; + numSubSamples = info->mNumSubSamples; + samplesArray = info->mSubSamples; + pattern = info->mPattern; + if (info->mKey != nullptr) { + jbyte * dstKey = env->GetByteArrayElements(keyArray.get(), &isCopy); + memcpy(dstKey, info->mKey, 16); + env->ReleaseByteArrayElements(keyArray.get(), dstKey, 0); + } + if (info->mIv != nullptr) { + jbyte * dstIv = env->GetByteArrayElements(ivArray.get(), &isCopy); + memcpy(dstIv, info->mIv, 16); + env->ReleaseByteArrayElements(ivArray.get(), dstIv, 0); + } + } else { + CHECK(msg->findInt32("mode", (int*)&mode)); + CHECK(msg->findSize("numSubSamples", &numSubSamples)); + CHECK(msg->findBuffer("subSamples", &subSamplesBuffer)); + CHECK(msg->findInt32("encryptBlocks", (int32_t *)&pattern.mEncryptBlocks)); + CHECK(msg->findInt32("skipBlocks", (int32_t *)&pattern.mSkipBlocks)); + CHECK(msg->findBuffer("iv", &ivBuffer)); + CHECK(msg->findBuffer("key", &keyBuffer)); + samplesArray = + (CryptoPlugin::SubSample*)(subSamplesBuffer.get()->data()); + if (keyBuffer.get() != nullptr && keyBuffer->size() > 0) { + jbyte * dstKey = env->GetByteArrayElements(keyArray.get(), &isCopy); + memcpy(dstKey, keyBuffer->data(), keyBuffer->size()); + env->ReleaseByteArrayElements(keyArray.get(), dstKey, 0); + } + if (ivBuffer.get() != nullptr && ivBuffer->size() > 0) { + jbyte * dstIv = env->GetByteArrayElements(ivArray.get(), &isCopy); + memcpy(dstIv, ivBuffer->data(), ivBuffer->size()); + env->ReleaseByteArrayElements(ivArray.get(), dstIv, 0); + } + } ScopedLocalRef<jintArray> samplesOfEncryptedDataArr(env, env->NewIntArray(numSubSamples)); ScopedLocalRef<jintArray> samplesOfClearDataArr(env, env->NewIntArray(numSubSamples)); - jboolean isCopy; - jint *dstEncryptedSamples = - env->GetIntArrayElements(samplesOfEncryptedDataArr.get(), &isCopy); - jint * dstClearSamples = - env->GetIntArrayElements(samplesOfClearDataArr.get(), &isCopy); - - CryptoPlugin::SubSample * samplesArray = - (CryptoPlugin::SubSample*)(subSamplesBuffer.get()->data()); - - for(int i = 0 ; i < numSubSamples ; i++) { - dstEncryptedSamples[i] = samplesArray[i].mNumBytesOfEncryptedData; - dstClearSamples[i] = samplesArray[i].mNumBytesOfClearData; - } - env->ReleaseIntArrayElements(samplesOfEncryptedDataArr.get(), dstEncryptedSamples, 0); - env->ReleaseIntArrayElements(samplesOfClearDataArr.get(), dstClearSamples, 0); - // key and iv - jbyteArray keyArray = NULL; - jbyteArray ivArray = NULL; - if (keyBuffer.get() != nullptr && keyBuffer->size() > 0) { - keyArray = env->NewByteArray(keyBuffer->size()); - jbyte * dstKey = env->GetByteArrayElements(keyArray, &isCopy); - memcpy(dstKey, keyBuffer->data(), keyBuffer->size()); - env->ReleaseByteArrayElements(keyArray,dstKey,0); - } - if (ivBuffer.get() != nullptr && ivBuffer->size() > 0) { - ivArray = env->NewByteArray(ivBuffer->size()); - jbyte *dstIv = env->GetByteArrayElements(ivArray, &isCopy); - memcpy(dstIv, ivBuffer->data(), ivBuffer->size()); - env->ReleaseByteArrayElements(ivArray, dstIv,0); - } - // set samples, key and iv + if (numSubSamples > 0) { + jint *dstEncryptedSamples = + env->GetIntArrayElements(samplesOfEncryptedDataArr.get(), &isCopy); + jint * dstClearSamples = + env->GetIntArrayElements(samplesOfClearDataArr.get(), &isCopy); + for(int i = 0 ; i < numSubSamples ; i++) { + dstEncryptedSamples[i] = samplesArray[i].mNumBytesOfEncryptedData; + dstClearSamples[i] = samplesArray[i].mNumBytesOfClearData; + } + env->ReleaseIntArrayElements(samplesOfEncryptedDataArr.get(), dstEncryptedSamples, 0); + env->ReleaseIntArrayElements(samplesOfClearDataArr.get(), dstClearSamples, 0); + } env->CallVoidMethod( obj, gFields.cryptoInfoSetID, (jint)numSubSamples, samplesOfClearDataArr.get(), samplesOfEncryptedDataArr.get(), - keyArray, - ivArray, + keyArray.get(), + ivArray.get(), mode); - if (keyArray != NULL) { - env->DeleteLocalRef(keyArray); - } - if (ivArray != NULL) { - env->DeleteLocalRef(ivArray); - } // set pattern env->CallVoidMethod( obj, diff --git a/packages/SettingsLib/IllustrationPreference/src/com/android/settingslib/widget/IllustrationPreference.java b/packages/SettingsLib/IllustrationPreference/src/com/android/settingslib/widget/IllustrationPreference.java index 4b407c50bbd5..af40c647e805 100644 --- a/packages/SettingsLib/IllustrationPreference/src/com/android/settingslib/widget/IllustrationPreference.java +++ b/packages/SettingsLib/IllustrationPreference/src/com/android/settingslib/widget/IllustrationPreference.java @@ -73,6 +73,7 @@ public class IllustrationPreference extends Preference implements GroupSectionDi private boolean mLottieDynamicColor; private CharSequence mContentDescription; private boolean mIsTablet; + private boolean mIsAnimationPaused; /** * Interface to listen in on when {@link #onBindViewHolder(PreferenceViewHolder)} occurs. @@ -143,6 +144,16 @@ public class IllustrationPreference extends Preference implements GroupSectionDi (FrameLayout) holder.findViewById(R.id.middleground_layout); final LottieAnimationView illustrationView = (LottieAnimationView) holder.findViewById(R.id.lottie_view); + // Pause and resume animation + illustrationFrame.setOnClickListener(v -> { + mIsAnimationPaused = !mIsAnimationPaused; + if (mIsAnimationPaused) { + illustrationView.pauseAnimation(); + } else { + illustrationView.resumeAnimation(); + } + }); + if (illustrationView != null && !TextUtils.isEmpty(mContentDescription)) { illustrationView.setContentDescription(mContentDescription); illustrationView.setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_YES); diff --git a/packages/SystemUI/compose/features/src/com/android/systemui/communal/ui/compose/section/CommunalToDreamButtonSection.kt b/packages/SystemUI/compose/features/src/com/android/systemui/communal/ui/compose/section/CommunalToDreamButtonSection.kt index 13d551aef4c2..a840a6f0476f 100644 --- a/packages/SystemUI/compose/features/src/com/android/systemui/communal/ui/compose/section/CommunalToDreamButtonSection.kt +++ b/packages/SystemUI/compose/features/src/com/android/systemui/communal/ui/compose/section/CommunalToDreamButtonSection.kt @@ -39,6 +39,7 @@ import androidx.compose.ui.graphics.Outline import androidx.compose.ui.graphics.Path import androidx.compose.ui.graphics.Shape import androidx.compose.ui.input.pointer.pointerInput +import androidx.compose.ui.res.dimensionResource import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.Density import androidx.compose.ui.unit.Dp @@ -71,6 +72,8 @@ constructor( return } + val buttonSize = dimensionResource(R.dimen.communal_to_dream_button_size) + if (viewModel.shouldShowTooltip) { Column( modifier = @@ -96,7 +99,6 @@ constructor( } companion object { - private val buttonSize = 64.dp private val tooltipMaxWidth = 350.dp } } diff --git a/packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/section/DefaultClockSection.kt b/packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/section/DefaultClockSection.kt index 34c0bcaca997..ae541dda6eeb 100644 --- a/packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/section/DefaultClockSection.kt +++ b/packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/section/DefaultClockSection.kt @@ -26,8 +26,8 @@ import androidx.compose.foundation.layout.padding import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.getValue +import androidx.compose.runtime.key import androidx.compose.ui.Modifier -import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.res.dimensionResource import androidx.compose.ui.viewinterop.AndroidView import androidx.core.view.contains @@ -46,6 +46,28 @@ import com.android.systemui.keyguard.ui.viewmodel.BurnInParameters import com.android.systemui.keyguard.ui.viewmodel.KeyguardClockViewModel import javax.inject.Inject +@Composable +fun ClockView(view: View?, modifier: Modifier = Modifier) { + AndroidView( + factory = { + FrameLayout(it).apply { + // Clip nothing. The clock views at times render outside their bounds. Compose does + // not clip by default, so only this layer needs clipping to be explicitly disabled. + clipChildren = false + clipToPadding = false + } + }, + update = { parent -> + view?.let { + parent.removeAllViews() + (view.parent as? ViewGroup)?.removeView(view) + parent.addView(view) + } ?: run { parent.removeAllViews() } + }, + modifier = modifier, + ) +} + /** Provides small clock and large clock composables for the default clock face. */ class DefaultClockSection @Inject @@ -67,14 +89,9 @@ constructor( if (currentClock?.smallClock?.view == null) { return } - val context = LocalContext.current - AndroidView( - factory = { context -> - FrameLayout(context).apply { - ensureClockViewExists(checkNotNull(currentClock).smallClock.view) - } - }, - update = { it.ensureClockViewExists(checkNotNull(currentClock).smallClock.view) }, + + ClockView( + checkNotNull(currentClock).smallClock.view, modifier = modifier .height(dimensionResource(R.dimen.small_clock_height)) @@ -116,25 +133,8 @@ constructor( Element(key = largeClockElementKey, modifier = modifier) { content { - AndroidView( - factory = { context -> - FrameLayout(context).apply { - // By default, ViewGroups like FrameLayout clip their children. Turning - // off the clipping allows the child view to render outside of its - // bounds - letting the step animation of the clock push the digits out - // when needed. - // - // Note that, in Compose, clipping is actually disabled by default so - // there's no need to propagate this up the composable hierarchy. - clipChildren = false - clipToPadding = false - - ensureClockViewExists(checkNotNull(currentClock).largeClock.view) - } - }, - update = { - it.ensureClockViewExists(checkNotNull(currentClock).largeClock.view) - }, + ClockView( + checkNotNull(currentClock).largeClock.view, modifier = Modifier.fillMaxSize() .burnInAware( @@ -147,15 +147,6 @@ constructor( } } - private fun FrameLayout.ensureClockViewExists(clockView: View) { - if (contains(clockView)) { - return - } - removeAllViews() - (clockView.parent as? ViewGroup)?.removeView(clockView) - addView(clockView) - } - fun getClockCenteringDistance(): Float { return Resources.getSystem().displayMetrics.widthPixels / 4f } diff --git a/packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/section/WeatherClockSection.kt b/packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/section/WeatherClockSection.kt index 6250da379402..4fcb5ca42df2 100644 --- a/packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/section/WeatherClockSection.kt +++ b/packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/section/WeatherClockSection.kt @@ -16,8 +16,6 @@ package com.android.systemui.keyguard.ui.composable.section -import android.view.View -import android.view.ViewGroup import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.IntrinsicSize import androidx.compose.foundation.layout.Row @@ -26,10 +24,10 @@ import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.wrapContentSize import androidx.compose.runtime.Composable +import androidx.compose.runtime.key import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.res.dimensionResource -import androidx.compose.ui.viewinterop.AndroidView import com.android.compose.animation.scene.ContentScope import com.android.compose.animation.scene.ElementKey import com.android.systemui.customization.R as customR @@ -112,21 +110,11 @@ constructor( ) { Element(key = elementKey, modifier) { content { - AndroidView( - factory = { - try { - val view = - clock.largeClock.layout.views.first { - it.id == weatherClockElementViewId - } - (view.parent as? ViewGroup)?.removeView(view) - view - } catch (e: NoSuchElementException) { - View(it) - } + ClockView( + clock.largeClock.layout.views.firstOrNull { + it.id == weatherClockElementViewId }, - update = {}, - modifier = modifier, + modifier, ) } } diff --git a/packages/SystemUI/compose/features/src/com/android/systemui/notifications/ui/composable/NotificationsShadeOverlay.kt b/packages/SystemUI/compose/features/src/com/android/systemui/notifications/ui/composable/NotificationsShadeOverlay.kt index 26e7524f4fa8..7c50d6f8af12 100644 --- a/packages/SystemUI/compose/features/src/com/android/systemui/notifications/ui/composable/NotificationsShadeOverlay.kt +++ b/packages/SystemUI/compose/features/src/com/android/systemui/notifications/ui/composable/NotificationsShadeOverlay.kt @@ -85,6 +85,7 @@ constructor( } OverlayShade( + panelElement = NotificationsShade.Elements.Panel, panelAlignment = Alignment.TopStart, modifier = modifier, onScrimClicked = viewModel::onScrimClicked, @@ -144,6 +145,7 @@ constructor( object NotificationsShade { object Elements { - val StatusBar = ElementKey("NotificationsShadeStatusBar") + val Panel = ElementKey("NotificationsShadeOverlayPanel") + val StatusBar = ElementKey("NotificationsShadeOverlayStatusBar") } } diff --git a/packages/SystemUI/compose/features/src/com/android/systemui/qs/ui/composable/QuickSettingsShadeOverlay.kt b/packages/SystemUI/compose/features/src/com/android/systemui/qs/ui/composable/QuickSettingsShadeOverlay.kt index 2fa370458ab0..818d8e202368 100644 --- a/packages/SystemUI/compose/features/src/com/android/systemui/qs/ui/composable/QuickSettingsShadeOverlay.kt +++ b/packages/SystemUI/compose/features/src/com/android/systemui/qs/ui/composable/QuickSettingsShadeOverlay.kt @@ -43,13 +43,13 @@ import androidx.compose.ui.platform.LocalDensity import androidx.compose.ui.unit.dp import androidx.lifecycle.compose.collectAsStateWithLifecycle import com.android.compose.animation.scene.ContentScope +import com.android.compose.animation.scene.ElementKey import com.android.compose.animation.scene.UserAction import com.android.compose.animation.scene.UserActionResult import com.android.systemui.brightness.ui.compose.BrightnessSliderContainer import com.android.systemui.compose.modifiers.sysuiResTag import com.android.systemui.dagger.SysUISingleton import com.android.systemui.lifecycle.rememberViewModel -import com.android.systemui.notifications.ui.composable.NotificationsShade import com.android.systemui.notifications.ui.composable.SnoozeableHeadsUpNotificationSpace import com.android.systemui.qs.composefragment.ui.GridAnchor import com.android.systemui.qs.flags.QsDetailedView @@ -123,13 +123,14 @@ constructor( }, ) OverlayShade( + panelElement = QuickSettingsShade.Elements.Panel, panelAlignment = Alignment.TopEnd, onScrimClicked = contentViewModel::onScrimClicked, header = { OverlayShadeHeader( viewModel = quickSettingsContainerViewModel.shadeHeaderViewModel, modifier = - Modifier.element(NotificationsShade.Elements.StatusBar) + Modifier.element(QuickSettingsShade.Elements.StatusBar) .layoutId(SingleShadeMeasurePolicy.LayoutId.ShadeHeader), ) }, @@ -159,7 +160,8 @@ constructor( QuickSettingsOverlayHeader( viewModel = quickSettingsContainerViewModel.shadeHeaderViewModel, modifier = - Modifier.padding(top = QuickSettingsShade.Dimensions.Padding), + Modifier.element(QuickSettingsShade.Elements.Header) + .padding(top = QuickSettingsShade.Dimensions.Padding), ) } }, @@ -267,6 +269,11 @@ fun ContentScope.QuickSettingsLayout( } object QuickSettingsShade { + object Elements { + val StatusBar = ElementKey("QuickSettingsShadeOverlayStatusBar") + val Panel = ElementKey("QuickSettingsShadeOverlayPanel") + val Header = ElementKey("QuickSettingsShadeOverlayHeader") + } object Dimensions { val Padding = 16.dp diff --git a/packages/SystemUI/compose/features/src/com/android/systemui/scene/ui/composable/transitions/ToNotificationsShadeTransition.kt b/packages/SystemUI/compose/features/src/com/android/systemui/scene/ui/composable/transitions/ToNotificationsShadeTransition.kt index fd83497f33c1..97624142afd2 100644 --- a/packages/SystemUI/compose/features/src/com/android/systemui/scene/ui/composable/transitions/ToNotificationsShadeTransition.kt +++ b/packages/SystemUI/compose/features/src/com/android/systemui/scene/ui/composable/transitions/ToNotificationsShadeTransition.kt @@ -21,8 +21,8 @@ import com.android.compose.animation.scene.TransitionBuilder import com.android.compose.animation.scene.reveal.ContainerRevealHaptics import com.android.compose.animation.scene.reveal.verticalContainerReveal import com.android.systemui.keyguard.ui.composable.blueprint.ClockElementKeys +import com.android.systemui.notifications.ui.composable.NotificationsShade import com.android.systemui.scene.shared.model.Overlays -import com.android.systemui.shade.ui.composable.OverlayShade import kotlin.time.Duration.Companion.milliseconds fun TransitionBuilder.toNotificationsShadeTransition( @@ -36,7 +36,10 @@ fun TransitionBuilder.toNotificationsShadeTransition( ClockElementKeys.smallClockElementKey, elevateInContent = Overlays.NotificationsShade, ) - verticalContainerReveal(OverlayShade.Elements.Panel, revealHaptics) + + verticalContainerReveal(NotificationsShade.Elements.Panel, revealHaptics) + + fade(NotificationsShade.Elements.StatusBar) } private val DefaultDuration = 300.milliseconds diff --git a/packages/SystemUI/compose/features/src/com/android/systemui/scene/ui/composable/transitions/ToQuickSettingsShadeTransition.kt b/packages/SystemUI/compose/features/src/com/android/systemui/scene/ui/composable/transitions/ToQuickSettingsShadeTransition.kt index 361ae46f7799..522b2d426697 100644 --- a/packages/SystemUI/compose/features/src/com/android/systemui/scene/ui/composable/transitions/ToQuickSettingsShadeTransition.kt +++ b/packages/SystemUI/compose/features/src/com/android/systemui/scene/ui/composable/transitions/ToQuickSettingsShadeTransition.kt @@ -20,7 +20,7 @@ import androidx.compose.animation.core.tween import com.android.compose.animation.scene.TransitionBuilder import com.android.compose.animation.scene.reveal.ContainerRevealHaptics import com.android.compose.animation.scene.reveal.verticalContainerReveal -import com.android.systemui.shade.ui.composable.OverlayShade +import com.android.systemui.qs.ui.composable.QuickSettingsShade import kotlin.time.Duration.Companion.milliseconds fun TransitionBuilder.toQuickSettingsShadeTransition( @@ -29,7 +29,9 @@ fun TransitionBuilder.toQuickSettingsShadeTransition( ) { spec = tween(durationMillis = (DefaultDuration * durationScale).inWholeMilliseconds.toInt()) - verticalContainerReveal(OverlayShade.Elements.Panel, revealHaptics) + verticalContainerReveal(QuickSettingsShade.Elements.Panel, revealHaptics) + + fade(QuickSettingsShade.Elements.StatusBar) } private val DefaultDuration = 300.milliseconds diff --git a/packages/SystemUI/compose/features/src/com/android/systemui/shade/ui/composable/OverlayShade.kt b/packages/SystemUI/compose/features/src/com/android/systemui/shade/ui/composable/OverlayShade.kt index 3d2d7c37ce48..b53cc898be01 100644 --- a/packages/SystemUI/compose/features/src/com/android/systemui/shade/ui/composable/OverlayShade.kt +++ b/packages/SystemUI/compose/features/src/com/android/systemui/shade/ui/composable/OverlayShade.kt @@ -58,6 +58,7 @@ import com.android.systemui.res.R /** Renders a lightweight shade UI container, as an overlay. */ @Composable fun ContentScope.OverlayShade( + panelElement: ElementKey, panelAlignment: Alignment, onScrimClicked: () -> Unit, modifier: Modifier = Modifier, @@ -75,7 +76,7 @@ fun ContentScope.OverlayShade( Panel( modifier = Modifier.overscroll(verticalOverscrollEffect) - .element(OverlayShade.Elements.Panel) + .element(panelElement) .panelWidth(isFullWidth), header = header.takeIf { isFullWidth }, content = content, diff --git a/packages/SystemUI/compose/features/src/com/android/systemui/volume/panel/component/mediaoutput/MediaOutputModule.kt b/packages/SystemUI/compose/features/src/com/android/systemui/volume/panel/component/mediaoutput/MediaOutputModule.kt index c73656eb1ec5..f1cc71bc59af 100644 --- a/packages/SystemUI/compose/features/src/com/android/systemui/volume/panel/component/mediaoutput/MediaOutputModule.kt +++ b/packages/SystemUI/compose/features/src/com/android/systemui/volume/panel/component/mediaoutput/MediaOutputModule.kt @@ -16,9 +16,9 @@ package com.android.systemui.volume.panel.component.mediaoutput -import com.android.systemui.volume.panel.component.mediaoutput.domain.MediaOutputAvailabilityCriteria import com.android.systemui.volume.panel.component.mediaoutput.ui.composable.MediaOutputComponent import com.android.systemui.volume.panel.component.shared.model.VolumePanelComponents +import com.android.systemui.volume.panel.domain.AlwaysAvailableCriteria import com.android.systemui.volume.panel.domain.ComponentAvailabilityCriteria import com.android.systemui.volume.panel.shared.model.VolumePanelUiComponent import dagger.Binds @@ -39,6 +39,6 @@ interface MediaOutputModule { @IntoMap @StringKey(VolumePanelComponents.MEDIA_OUTPUT) fun bindComponentAvailabilityCriteria( - criteria: MediaOutputAvailabilityCriteria + criteria: AlwaysAvailableCriteria ): ComponentAvailabilityCriteria } diff --git a/packages/SystemUI/customization/src/com/android/systemui/shared/clocks/ClockRegistry.kt b/packages/SystemUI/customization/src/com/android/systemui/shared/clocks/ClockRegistry.kt index ab31286b78b4..b59b4ab34c80 100644 --- a/packages/SystemUI/customization/src/com/android/systemui/shared/clocks/ClockRegistry.kt +++ b/packages/SystemUI/customization/src/com/android/systemui/shared/clocks/ClockRegistry.kt @@ -145,7 +145,6 @@ open class ClockRegistry( var isCurrentClock = false var isClockListChanged = false for (metadata in knownClocks) { - isCurrentClock = isCurrentClock || currentClockId == metadata.clockId val id = metadata.clockId val info = availableClocks.concurrentGetOrPut(id, ClockInfo(metadata, null, manager)) { @@ -156,15 +155,17 @@ open class ClockRegistry( if (manager != info.manager) { logger.e({ "Clock Id conflict on attach: " + - "$str1 is double registered by $str2 and $str3" + "$str1 is double registered by $str2 and $str3. " + + "Using $str2 since it was attached first." }) { str1 = id - str2 = info.manager.toString() + str2 = info.manager?.toString() ?: info.provider?.toString() str3 = manager.toString() } continue } + isCurrentClock = isCurrentClock || currentClockId == metadata.clockId info.provider = null } @@ -197,10 +198,11 @@ open class ClockRegistry( if (manager != info.manager) { logger.e({ "Clock Id conflict on load: " + - "$str1 is double registered by $str2 and $str3" + "$str1 is double registered by $str2 and $str3. " + + "Using $str2 since it was attached first." }) { str1 = id - str2 = info.manager.toString() + str2 = info.manager?.toString() ?: info.provider?.toString() str3 = manager.toString() } manager.unloadPlugin() @@ -227,10 +229,11 @@ open class ClockRegistry( if (info?.manager != manager) { logger.e({ "Clock Id conflict on unload: " + - "$str1 is double registered by $str2 and $str3" + "$str1 is double registered by $str2 and $str3. " + + "Using $str2 since it was attached first." }) { str1 = id - str2 = info?.manager.toString() + str2 = info?.manager?.toString() ?: info?.provider?.toString() str3 = manager.toString() } continue diff --git a/packages/SystemUI/customization/src/com/android/systemui/shared/clocks/ComposedDigitalLayerController.kt b/packages/SystemUI/customization/src/com/android/systemui/shared/clocks/ComposedDigitalLayerController.kt index 9fb60c75b046..98cf68468151 100644 --- a/packages/SystemUI/customization/src/com/android/systemui/shared/clocks/ComposedDigitalLayerController.kt +++ b/packages/SystemUI/customization/src/com/android/systemui/shared/clocks/ComposedDigitalLayerController.kt @@ -47,7 +47,7 @@ class ComposedDigitalLayerController(private val clockCtx: ClockContext) : init { fun createController(cfg: LayerConfig) { - val controller = SimpleDigitalHandLayerController(clockCtx, cfg) + val controller = SimpleDigitalHandLayerController(clockCtx, cfg, isLargeClock = true) view.addView(controller.view) layerControllers.add(controller) } @@ -55,31 +55,20 @@ class ComposedDigitalLayerController(private val clockCtx: ClockContext) : val layerCfg = LayerConfig( style = FontTextStyle(lineHeight = 147.25f), + timespec = DigitalTimespec.DIGIT_PAIR, + alignment = DigitalAlignment(HorizontalAlignment.CENTER, VerticalAlignment.CENTER), aodStyle = FontTextStyle( transitionInterpolator = Interpolators.EMPHASIZED, transitionDuration = 750, ), - alignment = - DigitalAlignment(HorizontalAlignment.CENTER, VerticalAlignment.BASELINE), - // Placeholders - timespec = DigitalTimespec.TIME_FULL_FORMAT, + // Placeholder dateTimeFormat = "hh:mm", ) - createController( - layerCfg.copy(timespec = DigitalTimespec.FIRST_DIGIT, dateTimeFormat = "hh") - ) - createController( - layerCfg.copy(timespec = DigitalTimespec.SECOND_DIGIT, dateTimeFormat = "hh") - ) - createController( - layerCfg.copy(timespec = DigitalTimespec.FIRST_DIGIT, dateTimeFormat = "mm") - ) - createController( - layerCfg.copy(timespec = DigitalTimespec.SECOND_DIGIT, dateTimeFormat = "mm") - ) + createController(layerCfg.copy(dateTimeFormat = "hh")) + createController(layerCfg.copy(dateTimeFormat = "mm")) } private fun refreshTime() { diff --git a/packages/SystemUI/customization/src/com/android/systemui/shared/clocks/DefaultClockProvider.kt b/packages/SystemUI/customization/src/com/android/systemui/shared/clocks/DefaultClockProvider.kt index 6cc281ace481..af9f2ce9d73f 100644 --- a/packages/SystemUI/customization/src/com/android/systemui/shared/clocks/DefaultClockProvider.kt +++ b/packages/SystemUI/customization/src/com/android/systemui/shared/clocks/DefaultClockProvider.kt @@ -17,21 +17,21 @@ import android.content.Context import android.content.res.Resources import android.graphics.Typeface import android.view.LayoutInflater -import com.android.systemui.animation.GSFAxes import com.android.systemui.customization.R import com.android.systemui.log.core.MessageBuffer import com.android.systemui.plugins.clocks.ClockController -import com.android.systemui.plugins.clocks.ClockFontAxis -import com.android.systemui.plugins.clocks.ClockFontAxisSetting +import com.android.systemui.plugins.clocks.ClockFontAxis.Companion.merge import com.android.systemui.plugins.clocks.ClockLogger import com.android.systemui.plugins.clocks.ClockMessageBuffers import com.android.systemui.plugins.clocks.ClockMetadata import com.android.systemui.plugins.clocks.ClockPickerConfig import com.android.systemui.plugins.clocks.ClockProvider import com.android.systemui.plugins.clocks.ClockSettings +import com.android.systemui.shared.clocks.FlexClockController.Companion.getDefaultAxes private val TAG = DefaultClockProvider::class.simpleName const val DEFAULT_CLOCK_ID = "DEFAULT" +const val FLEX_CLOCK_ID = "DIGITAL_CLOCK_FLEX" data class ClockContext( val context: Context, @@ -55,16 +55,20 @@ class DefaultClockProvider( messageBuffers = buffers } - override fun getClocks(): List<ClockMetadata> = listOf(ClockMetadata(DEFAULT_CLOCK_ID)) + override fun getClocks(): List<ClockMetadata> { + var clocks = listOf(ClockMetadata(DEFAULT_CLOCK_ID)) + if (isClockReactiveVariantsEnabled) clocks += ClockMetadata(FLEX_CLOCK_ID) + return clocks + } override fun createClock(settings: ClockSettings): ClockController { - if (settings.clockId != DEFAULT_CLOCK_ID) { + if (getClocks().all { it.clockId != settings.clockId }) { throw IllegalArgumentException("${settings.clockId} is unsupported by $TAG") } return if (isClockReactiveVariantsEnabled) { val buffers = messageBuffers ?: ClockMessageBuffers(ClockLogger.DEFAULT_MESSAGE_BUFFER) - val fontAxes = ClockFontAxis.merge(FlexClockController.FONT_AXES, settings.axes) + val fontAxes = getDefaultAxes(settings).merge(settings.axes) val clockSettings = settings.copy(axes = fontAxes.map { it.toSetting() }) val typefaceCache = TypefaceCache(buffers.infraMessageBuffer, NUM_CLOCK_FONT_ANIMATION_STEPS) { @@ -86,15 +90,15 @@ class DefaultClockProvider( } override fun getClockPickerConfig(settings: ClockSettings): ClockPickerConfig { - if (settings.clockId != DEFAULT_CLOCK_ID) { + if (getClocks().all { it.clockId != settings.clockId }) { throw IllegalArgumentException("${settings.clockId} is unsupported by $TAG") } val fontAxes = if (!isClockReactiveVariantsEnabled) listOf() - else ClockFontAxis.merge(FlexClockController.FONT_AXES, settings.axes) + else getDefaultAxes(settings).merge(settings.axes) return ClockPickerConfig( - DEFAULT_CLOCK_ID, + settings.clockId ?: DEFAULT_CLOCK_ID, resources.getString(R.string.clock_default_name), resources.getString(R.string.clock_default_description), resources.getDrawable(R.drawable.clock_default_thumbnail, null), @@ -106,23 +110,6 @@ class DefaultClockProvider( companion object { const val NUM_CLOCK_FONT_ANIMATION_STEPS = 30 - // TODO(b/364681643): Variations for retargetted DIGITAL_CLOCK_FLEX - val LEGACY_FLEX_LS_VARIATION = - listOf( - ClockFontAxisSetting(GSFAxes.WEIGHT, 600f), - ClockFontAxisSetting(GSFAxes.WIDTH, 100f), - ClockFontAxisSetting(GSFAxes.ROUND, 100f), - ClockFontAxisSetting(GSFAxes.SLANT, 0f), - ) - - val LEGACY_FLEX_AOD_VARIATION = - listOf( - ClockFontAxisSetting(GSFAxes.WEIGHT, 74f), - ClockFontAxisSetting(GSFAxes.WIDTH, 43f), - ClockFontAxisSetting(GSFAxes.ROUND, 100f), - ClockFontAxisSetting(GSFAxes.SLANT, 0f), - ) - val FLEX_TYPEFACE by lazy { // TODO(b/364680873): Move constant to config_clockFontFamily when shipping Typeface.create("google-sans-flex-clock", Typeface.NORMAL) diff --git a/packages/SystemUI/customization/src/com/android/systemui/shared/clocks/FlexClockController.kt b/packages/SystemUI/customization/src/com/android/systemui/shared/clocks/FlexClockController.kt index cc3769e0a568..004d1aa1fe93 100644 --- a/packages/SystemUI/customization/src/com/android/systemui/shared/clocks/FlexClockController.kt +++ b/packages/SystemUI/customization/src/com/android/systemui/shared/clocks/FlexClockController.kt @@ -24,7 +24,9 @@ import com.android.systemui.plugins.clocks.ClockConfig import com.android.systemui.plugins.clocks.ClockController import com.android.systemui.plugins.clocks.ClockEvents import com.android.systemui.plugins.clocks.ClockFontAxis +import com.android.systemui.plugins.clocks.ClockFontAxis.Companion.merge import com.android.systemui.plugins.clocks.ClockFontAxisSetting +import com.android.systemui.plugins.clocks.ClockSettings import com.android.systemui.plugins.clocks.WeatherData import com.android.systemui.plugins.clocks.ZenData import com.android.systemui.shared.clocks.view.FlexClockView @@ -94,7 +96,7 @@ class FlexClockController(private val clockCtx: ClockContext) : ClockController } override fun onFontAxesChanged(axes: List<ClockFontAxisSetting>) { - val fontAxes = ClockFontAxis.merge(FONT_AXES, axes).map { it.toSetting() } + val fontAxes = getDefaultAxes(clockCtx.settings).merge(axes).map { it.toSetting() } smallClock.events.onFontAxesChanged(fontAxes) largeClock.events.onFontAxesChanged(fontAxes) } @@ -120,7 +122,13 @@ class FlexClockController(private val clockCtx: ClockContext) : ClockController override fun dump(pw: PrintWriter) {} companion object { - val FONT_AXES = + fun getDefaultAxes(settings: ClockSettings): List<ClockFontAxis> { + return if (settings.clockId == FLEX_CLOCK_ID) { + FONT_AXES.merge(LEGACY_FLEX_SETTINGS) + } else FONT_AXES + } + + private val FONT_AXES = listOf( ClockFontAxis( key = GSFAxes.WEIGHT, @@ -135,7 +143,7 @@ class FlexClockController(private val clockCtx: ClockContext) : ClockController key = GSFAxes.WIDTH, type = AxisType.Float, minValue = 25f, - currentValue = 100f, + currentValue = 85f, maxValue = 151f, name = "Width", description = "Glyph Width", @@ -159,5 +167,13 @@ class FlexClockController(private val clockCtx: ClockContext) : ClockController description = "Glyph Slant", ), ) + + private val LEGACY_FLEX_SETTINGS = + listOf( + ClockFontAxisSetting(GSFAxes.WEIGHT, 600f), + ClockFontAxisSetting(GSFAxes.WIDTH, 100f), + ClockFontAxisSetting(GSFAxes.ROUND, 100f), + ClockFontAxisSetting(GSFAxes.SLANT, 0f), + ) } } diff --git a/packages/SystemUI/customization/src/com/android/systemui/shared/clocks/FlexClockFaceController.kt b/packages/SystemUI/customization/src/com/android/systemui/shared/clocks/FlexClockFaceController.kt index d7d8d28a71e0..cfcf201796da 100644 --- a/packages/SystemUI/customization/src/com/android/systemui/shared/clocks/FlexClockFaceController.kt +++ b/packages/SystemUI/customization/src/com/android/systemui/shared/clocks/FlexClockFaceController.kt @@ -60,7 +60,7 @@ class FlexClockFaceController(clockCtx: ClockContext, private val isLargeClock: init { layerController = if (isLargeClock) ComposedDigitalLayerController(clockCtx) - else SimpleDigitalHandLayerController(clockCtx, SMALL_LAYER_CONFIG) + else SimpleDigitalHandLayerController(clockCtx, SMALL_LAYER_CONFIG, isLargeClock) layerController.view.layoutParams = FrameLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT).apply { gravity = Gravity.CENTER } @@ -148,21 +148,6 @@ class FlexClockFaceController(clockCtx: ClockContext, private val isLargeClock: * keyguard_large_clock_top_margin from default clock */ override fun onTargetRegionChanged(targetRegion: Rect?) { - // When a clock needs to be aligned with screen, like weather clock - // it needs to offset back the translation of keyguard_large_clock_top_margin - if (isLargeClock && (view as FlexClockView).isAlignedWithScreen()) { - val topMargin = keyguardLargeClockTopMargin - targetRegion?.let { - val (_, yDiff) = computeLayoutDiff(view, it, isLargeClock) - // In LS, we use yDiff to counter translate - // the translation of KeyguardLargeClockTopMargin - // With the targetRegion passed from picker, - // we will have yDiff = 0, no translation is needed for weather clock - if (yDiff.toInt() != 0) view.translationY = yDiff - topMargin / 2 - } - return - } - var maxWidth = 0f var maxHeight = 0f @@ -231,7 +216,7 @@ class FlexClockFaceController(clockCtx: ClockContext, private val isLargeClock: } override fun onPickerCarouselSwiping(swipingFraction: Float) { - if (isLargeClock && !(view as FlexClockView).isAlignedWithScreen()) { + if (isLargeClock) { view.translationY = keyguardLargeClockTopMargin / 2F * swipingFraction } layerController.animations.onPickerCarouselSwiping(swipingFraction) @@ -251,6 +236,7 @@ class FlexClockFaceController(clockCtx: ClockContext, private val isLargeClock: companion object { val SMALL_CLOCK_MAX_WDTH = 120f + val SMALL_LAYER_CONFIG = LayerConfig( timespec = DigitalTimespec.TIME_FULL_FORMAT, diff --git a/packages/SystemUI/customization/src/com/android/systemui/shared/clocks/SimpleDigitalHandLayerController.kt b/packages/SystemUI/customization/src/com/android/systemui/shared/clocks/SimpleDigitalHandLayerController.kt index 82fc35012dbc..1659814b74eb 100644 --- a/packages/SystemUI/customization/src/com/android/systemui/shared/clocks/SimpleDigitalHandLayerController.kt +++ b/packages/SystemUI/customization/src/com/android/systemui/shared/clocks/SimpleDigitalHandLayerController.kt @@ -71,6 +71,7 @@ data class FontTextStyle( enum class DigitalTimespec { TIME_FULL_FORMAT, + DIGIT_PAIR, FIRST_DIGIT, SECOND_DIGIT, } @@ -78,8 +79,9 @@ enum class DigitalTimespec { open class SimpleDigitalHandLayerController( private val clockCtx: ClockContext, private val layerCfg: LayerConfig, + isLargeClock: Boolean, ) : SimpleClockLayerController { - override val view = SimpleDigitalClockTextView(clockCtx) + override val view = SimpleDigitalClockTextView(clockCtx, isLargeClock) private val logger = Logger(clockCtx.messageBuffer, TAG) val timespec = DigitalTimespecHandler(layerCfg.timespec, layerCfg.dateTimeFormat) @@ -120,6 +122,28 @@ open class SimpleDigitalHandLayerController( } } + private fun applyLayout() { + // TODO: Remove NO-OP + if (view.layoutParams is RelativeLayout.LayoutParams) { + val lp = view.layoutParams as RelativeLayout.LayoutParams + lp.addRule(RelativeLayout.TEXT_ALIGNMENT_CENTER) + when (view.id) { + R.id.HOUR_DIGIT_PAIR -> { + lp.addRule(RelativeLayout.CENTER_VERTICAL) + lp.addRule(RelativeLayout.ALIGN_PARENT_START) + } + R.id.MINUTE_DIGIT_PAIR -> { + lp.addRule(RelativeLayout.CENTER_VERTICAL) + lp.addRule(RelativeLayout.END_OF, R.id.HOUR_DIGIT_PAIR) + } + else -> { + throw Exception("cannot apply two pairs layout to view ${view.id}") + } + } + view.layoutParams = lp + } + } + override val events = object : ClockEvents { override var isReactiveTouchInteractionEnabled = false @@ -154,6 +178,7 @@ open class SimpleDigitalHandLayerController( override val animations = object : ClockAnimations { override fun enter() { + applyLayout() refreshTime() } @@ -169,6 +194,7 @@ open class SimpleDigitalHandLayerController( } override fun fold(fraction: Float) { + applyLayout() refreshTime() } diff --git a/packages/SystemUI/customization/src/com/android/systemui/shared/clocks/TimespecHandler.kt b/packages/SystemUI/customization/src/com/android/systemui/shared/clocks/TimespecHandler.kt index 37db783aba53..8b3b92921ee0 100644 --- a/packages/SystemUI/customization/src/com/android/systemui/shared/clocks/TimespecHandler.kt +++ b/packages/SystemUI/customization/src/com/android/systemui/shared/clocks/TimespecHandler.kt @@ -106,19 +106,16 @@ class DigitalTimespecHandler( ) } - private fun getSingleDigit(): String { - val isFirstDigit = timespec == DigitalTimespec.FIRST_DIGIT + private fun getSingleDigit(offset: Int): String { val text = dateFormat.format(cal.time).toString() - return text.substring( - if (isFirstDigit) 0 else text.length - 1, - if (isFirstDigit) text.length - 1 else text.length, - ) + return text.substring(offset, offset + 1) } fun getDigitString(): String { return when (timespec) { - DigitalTimespec.FIRST_DIGIT, - DigitalTimespec.SECOND_DIGIT -> getSingleDigit() + DigitalTimespec.FIRST_DIGIT -> getSingleDigit(0) + DigitalTimespec.SECOND_DIGIT -> getSingleDigit(1) + DigitalTimespec.DIGIT_PAIR -> dateFormat.format(cal.time).toString() DigitalTimespec.TIME_FULL_FORMAT -> dateFormat.format(cal.time).toString() } } diff --git a/packages/SystemUI/customization/src/com/android/systemui/shared/clocks/view/FlexClockView.kt b/packages/SystemUI/customization/src/com/android/systemui/shared/clocks/view/FlexClockView.kt index 55750b5e0925..f0f344a605a9 100644 --- a/packages/SystemUI/customization/src/com/android/systemui/shared/clocks/view/FlexClockView.kt +++ b/packages/SystemUI/customization/src/com/android/systemui/shared/clocks/view/FlexClockView.kt @@ -87,7 +87,7 @@ class FlexClockView(clockCtx: ClockContext) : FrameLayout(clockCtx.context) { protected fun calculateSize(widthMeasureSpec: Int, heightMeasureSpec: Int): Point? { maxSingleDigitSize = Point(-1, -1) - val bottomLocation: (textView: SimpleDigitalClockTextView) -> Int = { textView -> + val viewHeight: (textView: SimpleDigitalClockTextView) -> Int = { textView -> if (isMonoVerticalNumericLineSpacing) { maxSingleDigitSize.y } else { @@ -98,9 +98,15 @@ class FlexClockView(clockCtx: ClockContext) : FrameLayout(clockCtx.context) { digitalClockTextViewMap.forEach { (_, textView) -> textView.measure(MeasureSpec.UNSPECIFIED, MeasureSpec.UNSPECIFIED) maxSingleDigitSize.x = max(maxSingleDigitSize.x, textView.measuredWidth) - maxSingleDigitSize.y = max(bottomLocation(textView), textView.measuredHeight) + maxSingleDigitSize.y = max(viewHeight(textView), textView.measuredHeight) } aodTranslate = Point(0, 0) + // TODO(b/364680879): Cleanup + /* + aodTranslate = Point( + (maxSingleDigitSize.x * AOD_HORIZONTAL_TRANSLATE_RATIO).toInt(), + (maxSingleDigitSize.y * AOD_VERTICAL_TRANSLATE_RATIO).toInt()) + */ return Point( ((maxSingleDigitSize.x + abs(aodTranslate.x)) * 2), ((maxSingleDigitSize.y + abs(aodTranslate.y)) * 2), @@ -112,6 +118,10 @@ class FlexClockView(clockCtx: ClockContext) : FrameLayout(clockCtx.context) { digitLeftTopMap[R.id.HOUR_SECOND_DIGIT] = Point(maxSingleDigitSize.x, 0) digitLeftTopMap[R.id.MINUTE_FIRST_DIGIT] = Point(0, maxSingleDigitSize.y) digitLeftTopMap[R.id.MINUTE_SECOND_DIGIT] = Point(maxSingleDigitSize) + digitLeftTopMap[R.id.HOUR_DIGIT_PAIR] = Point(maxSingleDigitSize.x / 2, 0) + // Add a small vertical buffer for the second digit pair + digitLeftTopMap[R.id.MINUTE_DIGIT_PAIR] = + Point(maxSingleDigitSize.x / 2, (maxSingleDigitSize.y * 1.05f).toInt()) digitLeftTopMap.forEach { (_, point) -> point.x += abs(aodTranslate.x) point.y += abs(aodTranslate.y) @@ -179,9 +189,9 @@ class FlexClockView(clockCtx: ClockContext) : FrameLayout(clockCtx.context) { // save canvas location in anticipation of restoration later canvas.save() val xTranslateAmount = - digitOffsets.getOrDefault(id, 0f) + digitLeftTopMap[id]!!.x.toFloat() + digitOffsets.getOrDefault(id, 0f) + (digitLeftTopMap[id]?.x?.toFloat() ?: 0f) // move canvas to location that the textView would like - canvas.translate(xTranslateAmount, digitLeftTopMap[id]!!.y.toFloat()) + canvas.translate(xTranslateAmount, digitLeftTopMap[id]?.y?.toFloat() ?: 0f) // draw the textView at the location of the canvas above textView.draw(canvas) // reset the canvas location back to 0 without drawing @@ -189,8 +199,6 @@ class FlexClockView(clockCtx: ClockContext) : FrameLayout(clockCtx.context) { } } - fun isAlignedWithScreen(): Boolean = false - fun onLocaleChanged(locale: Locale) { updateLocale(locale) requestLayout() @@ -302,23 +310,17 @@ class FlexClockView(clockCtx: ClockContext) : FrameLayout(clockCtx.context) { clockMoveDirection: Int, moveFraction: Float, ) { + // TODO(b/393577936): The step animation isn't correct with the two pairs approach val isMovingToCenter = if (isLayoutRtl) clockMoveDirection < 0 else clockMoveDirection > 0 // The sign of moveAmountDeltaForDigit is already set here // we can interpret (left - clockStartLeft) as (destinationPosition - originPosition) // so we no longer need to multiply direct sign to moveAmountDeltaForDigit val currentMoveAmount = left - clockStartLeft - for (i in 0 until NUM_DIGITS) { - val mapIndexToId = - when (i) { - 0 -> R.id.HOUR_FIRST_DIGIT - 1 -> R.id.HOUR_SECOND_DIGIT - 2 -> R.id.MINUTE_FIRST_DIGIT - 3 -> R.id.MINUTE_SECOND_DIGIT - else -> -1 - } + var index = 0 + digitalClockTextViewMap.forEach { id, _ -> val digitFraction = getDigitFraction( - digit = i, + digit = index++, isMovingToCenter = isMovingToCenter, fraction = moveFraction, ) @@ -326,7 +328,7 @@ class FlexClockView(clockCtx: ClockContext) : FrameLayout(clockCtx.context) { val moveAmountForDigit = currentMoveAmount * digitFraction var moveAmountDeltaForDigit = moveAmountForDigit - currentMoveAmount if (isMovingToCenter && moveAmountForDigit < 0) moveAmountDeltaForDigit *= -1 - digitOffsets[mapIndexToId] = moveAmountDeltaForDigit + digitOffsets[id] = moveAmountDeltaForDigit invalidate() } } @@ -347,7 +349,8 @@ class FlexClockView(clockCtx: ClockContext) : FrameLayout(clockCtx.context) { /* rangeMin= */ 0.0f, /* rangeMax= */ 1.0f, /* valueMin= */ digitInitialDelay, - /* valueMax= */ digitInitialDelay + AVAILABLE_ANIMATION_TIME, + /* valueMax= */ digitInitialDelay + + availableAnimationTime(digitalClockTextViewMap.size), /* value= */ fraction, ) ) @@ -357,12 +360,8 @@ class FlexClockView(clockCtx: ClockContext) : FrameLayout(clockCtx.context) { val AOD_TRANSITION_DURATION = 750L val CHARGING_TRANSITION_DURATION = 300L - // Calculate the positions of all of the digits... - // Offset each digit by, say, 0.1 - // This means that each digit needs to move over a slice of "fractions", i.e. digit 0 should - // move from 0.0 - 0.7, digit 1 from 0.1 - 0.8, digit 2 from 0.2 - 0.9, and digit 3 - // from 0.3 - 1.0. - private const val NUM_DIGITS = 4 + val AOD_HORIZONTAL_TRANSLATE_RATIO = -0.15F + val AOD_VERTICAL_TRANSLATE_RATIO = 0.075F // Delays. Each digit's animation should have a slight delay, so we get a nice // "stepping" effect. When moving right, the second digit of the hour should move first. @@ -387,7 +386,9 @@ class FlexClockView(clockCtx: ClockContext) : FrameLayout(clockCtx.context) { // Total available transition time for each digit, taking into account the step. If step is // 0.1, then digit 0 would animate over 0.0 - 0.7, making availableTime 0.7. - private const val AVAILABLE_ANIMATION_TIME = 1.0f - MOVE_DIGIT_STEP * (NUM_DIGITS - 1) + private fun availableAnimationTime(numDigits: Int): Float { + return 1.0f - MOVE_DIGIT_STEP * (numDigits.toFloat() - 1) + } // Add language tags below that do not have vertically mono spaced numerals private val NON_MONO_VERTICAL_NUMERIC_LINE_SPACING_LANGUAGES = @@ -415,6 +416,14 @@ class FlexClockView(clockCtx: ClockContext) : FrameLayout(clockCtx.context) { outPoint.x *= 1 outPoint.y *= 1 } + R.id.HOUR_DIGIT_PAIR -> { + outPoint.x *= -1 + outPoint.y *= -1 + } + R.id.MINUTE_DIGIT_PAIR -> { + outPoint.x *= -1 + outPoint.y *= 1 + } } return outPoint } diff --git a/packages/SystemUI/customization/src/com/android/systemui/shared/clocks/view/SimpleDigitalClockTextView.kt b/packages/SystemUI/customization/src/com/android/systemui/shared/clocks/view/SimpleDigitalClockTextView.kt index db39162205b2..13f563389e19 100644 --- a/packages/SystemUI/customization/src/com/android/systemui/shared/clocks/view/SimpleDigitalClockTextView.kt +++ b/packages/SystemUI/customization/src/com/android/systemui/shared/clocks/view/SimpleDigitalClockTextView.kt @@ -38,10 +38,13 @@ import com.android.systemui.animation.GSFAxes import com.android.systemui.animation.TextAnimator import com.android.systemui.customization.R import com.android.systemui.plugins.clocks.ClockFontAxisSetting +import com.android.systemui.plugins.clocks.ClockFontAxisSetting.Companion.replace +import com.android.systemui.plugins.clocks.ClockFontAxisSetting.Companion.toFVar import com.android.systemui.plugins.clocks.ClockLogger import com.android.systemui.shared.clocks.ClockContext import com.android.systemui.shared.clocks.DigitTranslateAnimator import com.android.systemui.shared.clocks.DimensionParser +import com.android.systemui.shared.clocks.FLEX_CLOCK_ID import com.android.systemui.shared.clocks.FontTextStyle import java.lang.Thread import kotlin.math.max @@ -63,14 +66,32 @@ enum class HorizontalAlignment { } @SuppressLint("AppCompatCustomView") -open class SimpleDigitalClockTextView(clockCtx: ClockContext, attrs: AttributeSet? = null) : - TextView(clockCtx.context, attrs) { +open class SimpleDigitalClockTextView( + clockCtx: ClockContext, + isLargeClock: Boolean, + attrs: AttributeSet? = null, +) : TextView(clockCtx.context, attrs) { val lockScreenPaint = TextPaint() lateinit var textStyle: FontTextStyle lateinit var aodStyle: FontTextStyle - private var lsFontVariation = ClockFontAxisSetting.toFVar(DEFAULT_LS_VARIATION) - private var aodFontVariation = ClockFontAxisSetting.toFVar(DEFAULT_AOD_VARIATION) + private val isLegacyFlex = clockCtx.settings.clockId == FLEX_CLOCK_ID + private val fixedAodAxes = + when { + !isLegacyFlex -> listOf(AOD_WEIGHT_AXIS, WIDTH_AXIS) + isLargeClock -> listOf(FLEX_AOD_LARGE_WEIGHT_AXIS, FLEX_AOD_WIDTH_AXIS) + else -> listOf(FLEX_AOD_SMALL_WEIGHT_AXIS, FLEX_AOD_WIDTH_AXIS) + } + + private var lsFontVariation = + if (!isLegacyFlex) listOf(LS_WEIGHT_AXIS, WIDTH_AXIS, ROUND_AXIS, SLANT_AXIS).toFVar() + else listOf(FLEX_LS_WEIGHT_AXIS, FLEX_LS_WIDTH_AXIS, FLEX_ROUND_AXIS, SLANT_AXIS).toFVar() + + private var aodFontVariation = run { + val roundAxis = if (!isLegacyFlex) ROUND_AXIS else FLEX_ROUND_AXIS + (fixedAodAxes + listOf(roundAxis, SLANT_AXIS)).toFVar() + } + private val parser = DimensionParser(clockCtx.context) var maxSingleDigitHeight = -1 var maxSingleDigitWidth = -1 @@ -129,8 +150,14 @@ open class SimpleDigitalClockTextView(clockCtx: ClockContext, attrs: AttributeSe invalidate() } - fun updateAxes(axes: List<ClockFontAxisSetting>) { - lsFontVariation = ClockFontAxisSetting.toFVar(axes + OPTICAL_SIZE_AXIS) + fun updateAxes(lsAxes: List<ClockFontAxisSetting>) { + lsFontVariation = lsAxes.toFVar() + aodFontVariation = lsAxes.replace(fixedAodAxes).toFVar() + logger.i({ "updateAxes(LS = $str1, AOD = $str2)" }) { + str1 = lsFontVariation + str2 = aodFontVariation + } + lockScreenPaint.typeface = typefaceCache.getTypefaceForVariant(lsFontVariation) typeface = lockScreenPaint.typeface @@ -287,6 +314,7 @@ open class SimpleDigitalClockTextView(clockCtx: ClockContext, attrs: AttributeSe targetTextBounds, ) } + if (layout == null) { requestLayout() } else { @@ -501,22 +529,18 @@ open class SimpleDigitalClockTextView(clockCtx: ClockContext, attrs: AttributeSe Paint().also { it.xfermode = PorterDuffXfermode(PorterDuff.Mode.DST_OUT) } val AOD_COLOR = Color.WHITE - val OPTICAL_SIZE_AXIS = ClockFontAxisSetting(GSFAxes.OPTICAL_SIZE, 144f) - val DEFAULT_LS_VARIATION = - listOf( - OPTICAL_SIZE_AXIS, - ClockFontAxisSetting(GSFAxes.WEIGHT, 400f), - ClockFontAxisSetting(GSFAxes.WIDTH, 100f), - ClockFontAxisSetting(GSFAxes.ROUND, 0f), - ClockFontAxisSetting(GSFAxes.SLANT, 0f), - ) - val DEFAULT_AOD_VARIATION = - listOf( - OPTICAL_SIZE_AXIS, - ClockFontAxisSetting(GSFAxes.WEIGHT, 200f), - ClockFontAxisSetting(GSFAxes.WIDTH, 100f), - ClockFontAxisSetting(GSFAxes.ROUND, 0f), - ClockFontAxisSetting(GSFAxes.SLANT, 0f), - ) + val LS_WEIGHT_AXIS = ClockFontAxisSetting(GSFAxes.WEIGHT, 400f) + val AOD_WEIGHT_AXIS = ClockFontAxisSetting(GSFAxes.WEIGHT, 200f) + val WIDTH_AXIS = ClockFontAxisSetting(GSFAxes.WIDTH, 85f) + val ROUND_AXIS = ClockFontAxisSetting(GSFAxes.ROUND, 0f) + val SLANT_AXIS = ClockFontAxisSetting(GSFAxes.SLANT, 0f) + + // Axes for Legacy version of the Flex Clock + val FLEX_LS_WEIGHT_AXIS = ClockFontAxisSetting(GSFAxes.WEIGHT, 600f) + val FLEX_AOD_LARGE_WEIGHT_AXIS = ClockFontAxisSetting(GSFAxes.WEIGHT, 74f) + val FLEX_AOD_SMALL_WEIGHT_AXIS = ClockFontAxisSetting(GSFAxes.WEIGHT, 133f) + val FLEX_LS_WIDTH_AXIS = ClockFontAxisSetting(GSFAxes.WIDTH, 100f) + val FLEX_AOD_WIDTH_AXIS = ClockFontAxisSetting(GSFAxes.WIDTH, 43f) + val FLEX_ROUND_AXIS = ClockFontAxisSetting(GSFAxes.ROUND, 100f) } } diff --git a/packages/SystemUI/multivalentTests/src/com/android/keyguard/KeyguardDisplayManagerTest.kt b/packages/SystemUI/multivalentTests/src/com/android/keyguard/KeyguardDisplayManagerTest.kt index cea1e9600741..3be92280a983 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/keyguard/KeyguardDisplayManagerTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/keyguard/KeyguardDisplayManagerTest.kt @@ -31,7 +31,6 @@ import com.android.systemui.settings.FakeDisplayTracker import com.android.systemui.shade.data.repository.FakeShadeDisplayRepository import com.android.systemui.statusbar.policy.KeyguardStateController import java.util.concurrent.Executor -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.UnconfinedTestDispatcher import kotlinx.coroutines.test.advanceUntilIdle @@ -52,7 +51,6 @@ import org.mockito.kotlin.whenever @SmallTest @RunWith(AndroidJUnit4::class) @RunWithLooper -@OptIn(ExperimentalCoroutinesApi::class) class KeyguardDisplayManagerTest : SysuiTestCase() { @Mock private val navigationBarController = mock(NavigationBarController::class.java) @Mock diff --git a/packages/SystemUI/multivalentTests/src/com/android/keyguard/KeyguardSecurityContainerControllerTest.kt b/packages/SystemUI/multivalentTests/src/com/android/keyguard/KeyguardSecurityContainerControllerTest.kt index d2b61c0ab745..fe665e658feb 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/keyguard/KeyguardSecurityContainerControllerTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/keyguard/KeyguardSecurityContainerControllerTest.kt @@ -13,8 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -@file:OptIn(ExperimentalCoroutinesApi::class) - package com.android.keyguard import android.app.admin.DevicePolicyManager @@ -88,7 +86,6 @@ import com.android.systemui.util.settings.GlobalSettings import com.android.systemui.util.time.FakeSystemClock import com.google.common.truth.Truth import junit.framework.Assert -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.test.runCurrent diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/accessibility/data/repository/AccessibilityRepositoryTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/accessibility/data/repository/AccessibilityRepositoryTest.kt index c4a92bf18283..84cbef85e9c0 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/accessibility/data/repository/AccessibilityRepositoryTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/accessibility/data/repository/AccessibilityRepositoryTest.kt @@ -14,8 +14,6 @@ * limitations under the License. */ -@file:OptIn(ExperimentalCoroutinesApi::class) - package com.android.systemui.accessibility.data.repository import android.view.accessibility.AccessibilityManager @@ -26,7 +24,6 @@ import com.android.systemui.coroutines.collectLastValue import com.android.systemui.util.mockito.whenever import com.android.systemui.util.mockito.withArgCaptor import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Rule 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 fc57757c9a8c..2cacea4ad908 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 @@ -27,7 +27,6 @@ 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.filterNotNull import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest @@ -41,7 +40,6 @@ import org.mockito.Mockito.verify import org.mockito.Mockito.`when` import org.mockito.MockitoAnnotations -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class CaptioningRepositoryTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/accessibility/data/repository/ColorCorrectionRepositoryImplTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/accessibility/data/repository/ColorCorrectionRepositoryImplTest.kt index 801d3599ac10..e5be3440ce8c 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/accessibility/data/repository/ColorCorrectionRepositoryImplTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/accessibility/data/repository/ColorCorrectionRepositoryImplTest.kt @@ -28,14 +28,12 @@ import com.android.systemui.kosmos.testScope import com.android.systemui.testKosmos import com.android.systemui.util.settings.fakeSettings import com.google.common.truth.Truth -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Before import org.junit.Test import org.junit.runner.RunWith -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class ColorCorrectionRepositoryImplTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/accessibility/data/repository/ColorInversionRepositoryImplTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/accessibility/data/repository/ColorInversionRepositoryImplTest.kt index 2f457be8a81b..0ed3dbca2d90 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/accessibility/data/repository/ColorInversionRepositoryImplTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/accessibility/data/repository/ColorInversionRepositoryImplTest.kt @@ -28,14 +28,12 @@ import com.android.systemui.kosmos.testScope import com.android.systemui.testKosmos import com.android.systemui.util.settings.fakeSettings import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Before import org.junit.Test import org.junit.runner.RunWith -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class ColorInversionRepositoryImplTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/accessibility/data/repository/NightDisplayRepositoryTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/accessibility/data/repository/NightDisplayRepositoryTest.kt index 54dbed8407d0..e1db4c931247 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/accessibility/data/repository/NightDisplayRepositoryTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/accessibility/data/repository/NightDisplayRepositoryTest.kt @@ -39,7 +39,6 @@ import com.android.systemui.util.settings.fakeSettings import com.android.systemui.utils.leaks.FakeLocationController import com.google.common.truth.Truth.assertThat import java.time.LocalTime -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Test @@ -47,7 +46,6 @@ import org.junit.runner.RunWith import org.mockito.ArgumentMatchers import org.mockito.Mockito.verify -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class NightDisplayRepositoryTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/accessibility/data/repository/OneHandedModeRepositoryImplTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/accessibility/data/repository/OneHandedModeRepositoryImplTest.kt index 729d356e2be1..b66b64a6c69b 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/accessibility/data/repository/OneHandedModeRepositoryImplTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/accessibility/data/repository/OneHandedModeRepositoryImplTest.kt @@ -27,13 +27,11 @@ import com.android.systemui.kosmos.testScope import com.android.systemui.testKosmos import com.android.systemui.util.settings.fakeSettings import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Test import org.junit.runner.RunWith -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class OneHandedModeRepositoryImplTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/accessibility/extradim/ExtraDimDialogDelegateTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/accessibility/extradim/ExtraDimDialogDelegateTest.kt index b80836d80e12..cde42bd00ba5 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/accessibility/extradim/ExtraDimDialogDelegateTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/accessibility/extradim/ExtraDimDialogDelegateTest.kt @@ -31,7 +31,6 @@ import com.android.systemui.model.SysUiState import com.android.systemui.res.R import com.android.systemui.settings.UserTracker import com.android.systemui.statusbar.phone.SystemUIDialog -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.advanceUntilIdle import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest @@ -51,7 +50,6 @@ import org.mockito.kotlin.eq import org.mockito.kotlin.verify /** Tests for [ExtraDimDialogDelegate]. */ -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @TestableLooper.RunWithLooper(setAsMainLooper = true) @RunWith(AndroidJUnit4::class) diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/assist/data/repository/AssistRepositoryTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/assist/data/repository/AssistRepositoryTest.kt index 80077a21f985..2abc44ca04e0 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/assist/data/repository/AssistRepositoryTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/assist/data/repository/AssistRepositoryTest.kt @@ -23,13 +23,11 @@ import com.android.systemui.coroutines.collectLastValue 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.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Test import org.junit.runner.RunWith -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class AssistRepositoryTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/assist/domain/interactor/AssistInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/assist/domain/interactor/AssistInteractorTest.kt index c12f1aca350a..6c00ed89b343 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/assist/domain/interactor/AssistInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/assist/domain/interactor/AssistInteractorTest.kt @@ -25,13 +25,11 @@ import com.android.systemui.coroutines.collectLastValue 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.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Test import org.junit.runner.RunWith -@OptIn(ExperimentalCoroutinesApi::class) @RunWith(AndroidJUnit4::class) @SmallTest class AssistInteractorTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/authentication/data/repository/AuthenticationRepositoryTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/authentication/data/repository/AuthenticationRepositoryTest.kt index f82c8b0e56e0..75ca375f287f 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/authentication/data/repository/AuthenticationRepositoryTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/authentication/data/repository/AuthenticationRepositoryTest.kt @@ -14,8 +14,6 @@ * limitations under the License. */ -@file:OptIn(ExperimentalCoroutinesApi::class) - package com.android.systemui.authentication.data.repository import android.app.admin.DevicePolicyManager @@ -40,7 +38,6 @@ import com.android.systemui.util.time.FakeSystemClock import com.google.common.truth.Truth.assertThat import java.util.function.Function import kotlin.time.Duration.Companion.seconds -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.runBlocking import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/authentication/domain/interactor/AuthenticationInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/authentication/domain/interactor/AuthenticationInteractorTest.kt index 080b48af2af1..ae771cce5976 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/authentication/domain/interactor/AuthenticationInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/authentication/domain/interactor/AuthenticationInteractorTest.kt @@ -36,7 +36,6 @@ import com.android.systemui.user.data.repository.FakeUserRepository import com.android.systemui.user.data.repository.fakeUserRepository import com.google.common.truth.Truth.assertThat import kotlin.time.Duration.Companion.seconds -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.advanceTimeBy import kotlinx.coroutines.test.currentTime import kotlinx.coroutines.test.runCurrent @@ -44,7 +43,6 @@ import kotlinx.coroutines.test.runTest import org.junit.Test import org.junit.runner.RunWith -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class AuthenticationInteractorTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/back/domain/interactor/BackActionInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/back/domain/interactor/BackActionInteractorTest.kt index cbb6f81a015d..4d238ac3798d 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/back/domain/interactor/BackActionInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/back/domain/interactor/BackActionInteractorTest.kt @@ -61,7 +61,6 @@ import com.android.systemui.util.time.FakeSystemClock import com.google.common.truth.Truth.assertThat import junit.framework.Assert.assertFalse import junit.framework.Assert.assertTrue -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import org.junit.Before import org.junit.Rule @@ -76,7 +75,6 @@ import org.mockito.junit.MockitoJUnit @SmallTest @RunWith(AndroidJUnit4::class) -@OptIn(ExperimentalCoroutinesApi::class) class BackActionInteractorTest : SysuiTestCase() { private val kosmos = Kosmos() private val testScope = kosmos.testScope 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 194b41fbeaea..002ed17af890 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/BiometricTestExtensions.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/BiometricTestExtensions.kt @@ -35,7 +35,6 @@ 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 @@ -157,7 +156,6 @@ internal fun promptInfo( return info } -@OptIn(ExperimentalCoroutinesApi::class) internal fun TestScope.updateSfpsIndicatorRequests( kosmos: Kosmos, mContext: SysuiTestableContext, diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/data/repository/BiometricStatusRepositoryTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/data/repository/BiometricStatusRepositoryTest.kt index d2150471744e..881ee1038826 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/data/repository/BiometricStatusRepositoryTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/data/repository/BiometricStatusRepositoryTest.kt @@ -40,7 +40,6 @@ import com.android.systemui.kosmos.testScope import com.android.systemui.testKosmos import com.android.systemui.util.mockito.withArgCaptor import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Before @@ -52,7 +51,6 @@ import org.mockito.Mockito.verify import org.mockito.junit.MockitoJUnit import org.mockito.junit.MockitoRule -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class BiometricStatusRepositoryTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/data/repository/DisplayStateRepositoryTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/data/repository/DisplayStateRepositoryTest.kt index d9b71619992f..7a9f3ec457ab 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/data/repository/DisplayStateRepositoryTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/data/repository/DisplayStateRepositoryTest.kt @@ -35,7 +35,6 @@ import com.android.systemui.util.mockito.any import com.android.systemui.util.mockito.mock import com.android.systemui.util.mockito.whenever import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.StandardTestDispatcher import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.runCurrent @@ -45,7 +44,6 @@ import org.junit.Test import org.junit.runner.RunWith import org.mockito.Mockito.spy -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class DisplayStateRepositoryTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/data/repository/FacePropertyRepositoryImplTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/data/repository/FacePropertyRepositoryImplTest.kt index 9c114054bcfb..05312e906725 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/data/repository/FacePropertyRepositoryImplTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/data/repository/FacePropertyRepositoryImplTest.kt @@ -37,7 +37,6 @@ import com.android.systemui.res.R import com.android.systemui.util.mockito.whenever import com.google.common.truth.Truth.assertThat import java.util.concurrent.Executor -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.StandardTestDispatcher import kotlinx.coroutines.test.TestDispatcher import kotlinx.coroutines.test.TestScope @@ -55,7 +54,6 @@ import org.mockito.Mockito.verify import org.mockito.junit.MockitoJUnit import org.mockito.junit.MockitoRule -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class FacePropertyRepositoryImplTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/data/repository/FaceSettingsRepositoryImplTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/data/repository/FaceSettingsRepositoryImplTest.kt index 0209ab803368..756442be037a 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/data/repository/FaceSettingsRepositoryImplTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/data/repository/FaceSettingsRepositoryImplTest.kt @@ -29,7 +29,6 @@ import com.android.systemui.util.mockito.whenever import com.android.systemui.util.mockito.withArgCaptor import com.android.systemui.util.settings.SecureSettings import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.runTest import org.junit.Before @@ -45,7 +44,6 @@ import org.mockito.kotlin.any private const val USER_ID = 8 -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class FaceSettingsRepositoryImplTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/data/repository/FingerprintRepositoryImplTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/data/repository/FingerprintRepositoryImplTest.kt index ff5a419faf35..ffabc83ab6fe 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/data/repository/FingerprintRepositoryImplTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/data/repository/FingerprintRepositoryImplTest.kt @@ -30,7 +30,6 @@ import com.android.systemui.biometrics.shared.model.FingerprintSensorType import com.android.systemui.biometrics.shared.model.SensorStrength import com.android.systemui.coroutines.collectLastValue import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.StandardTestDispatcher import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.runCurrent @@ -45,7 +44,6 @@ import org.mockito.Mock import org.mockito.Mockito.verify import org.mockito.junit.MockitoJUnit -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class FingerprintRepositoryImplTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/data/repository/PromptRepositoryImplTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/data/repository/PromptRepositoryImplTest.kt index 22971bcf799e..12607718ed5e 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/data/repository/PromptRepositoryImplTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/data/repository/PromptRepositoryImplTest.kt @@ -28,7 +28,6 @@ import com.android.systemui.util.mockito.whenever import com.android.systemui.util.mockito.withArgCaptor import com.android.systemui.util.time.FakeSystemClock import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.toList import kotlinx.coroutines.launch import kotlinx.coroutines.test.TestScope @@ -49,7 +48,6 @@ private const val WRONG_REQUEST_ID = 10L private const val CHALLENGE = 90L private const val OP_PACKAGE_NAME = "biometric.testapp" -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class PromptRepositoryImplTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/domain/interactor/BiometricStatusInteractorImplTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/domain/interactor/BiometricStatusInteractorImplTest.kt index 5d2d20ce88e9..4622cbec735a 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/domain/interactor/BiometricStatusInteractorImplTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/domain/interactor/BiometricStatusInteractorImplTest.kt @@ -32,7 +32,6 @@ import com.android.systemui.keyguard.shared.model.AcquiredFingerprintAuthenticat 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.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Before @@ -41,7 +40,6 @@ import org.junit.runner.RunWith import org.mockito.Mockito import org.mockito.Mockito.`when` -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class BiometricStatusInteractorImplTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/domain/interactor/CredentialInteractorImplTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/domain/interactor/CredentialInteractorImplTest.kt index fde847897f72..15816fdcb8fa 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/domain/interactor/CredentialInteractorImplTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/domain/interactor/CredentialInteractorImplTest.kt @@ -21,7 +21,6 @@ import com.android.systemui.util.mockito.eq import com.android.systemui.util.mockito.whenever import com.android.systemui.util.time.FakeSystemClock import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.toList import kotlinx.coroutines.test.runTest import org.junit.Before @@ -40,7 +39,6 @@ private const val PASSWORD_ID = 30 private const val OPERATION_ID = 100L private const val MAX_ATTEMPTS = 5 -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class CredentialInteractorImplTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/domain/interactor/DisplayStateInteractorImplTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/domain/interactor/DisplayStateInteractorImplTest.kt index f40b6b046187..f3d5dfb636a6 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/domain/interactor/DisplayStateInteractorImplTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/domain/interactor/DisplayStateInteractorImplTest.kt @@ -14,7 +14,6 @@ import com.android.systemui.util.mockito.any import com.android.systemui.util.mockito.withArgCaptor import com.android.systemui.util.time.FakeSystemClock import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.StandardTestDispatcher import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.runCurrent @@ -27,7 +26,6 @@ import org.mockito.Mock import org.mockito.Mockito.verify import org.mockito.junit.MockitoJUnit -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class DisplayStateInteractorImplTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/domain/interactor/FingerprintPropertyInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/domain/interactor/FingerprintPropertyInteractorTest.kt index 970ce1f09909..353d2b120199 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/domain/interactor/FingerprintPropertyInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/domain/interactor/FingerprintPropertyInteractorTest.kt @@ -29,13 +29,11 @@ import com.android.systemui.display.data.repository.displayRepository 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.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Test import org.junit.runner.RunWith -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class FingerprintPropertyInteractorTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/domain/interactor/LogContextInteractorImplTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/domain/interactor/LogContextInteractorImplTest.kt index 30207bb310ba..40928faf6f8f 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/domain/interactor/LogContextInteractorImplTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/domain/interactor/LogContextInteractorImplTest.kt @@ -41,7 +41,6 @@ import com.android.systemui.scene.domain.interactor.sceneInteractor import com.android.systemui.scene.shared.model.Scenes import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Before @@ -50,7 +49,6 @@ import org.junit.Test import org.junit.runner.RunWith import org.mockito.junit.MockitoJUnit -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class LogContextInteractorImplTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/domain/interactor/PromptCredentialInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/domain/interactor/PromptCredentialInteractorTest.kt index 5a3637668cfe..136dfefc9ae1 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/domain/interactor/PromptCredentialInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/domain/interactor/PromptCredentialInteractorTest.kt @@ -16,7 +16,6 @@ import com.android.systemui.coroutines.collectLastValue import com.android.systemui.util.concurrency.FakeExecutor import com.android.systemui.util.time.FakeSystemClock import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.delay import kotlinx.coroutines.flow.flow import kotlinx.coroutines.flow.flowOf @@ -37,7 +36,6 @@ private const val REQUEST_ID = 22L private const val OPERATION_ID = 100L private const val OP_PACKAGE_NAME = "biometric.testapp" -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class PromptCredentialInteractorTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/domain/interactor/PromptSelectorInteractorImplTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/domain/interactor/PromptSelectorInteractorImplTest.kt index b39a888dad91..97d5944afbf0 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/domain/interactor/PromptSelectorInteractorImplTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/domain/interactor/PromptSelectorInteractorImplTest.kt @@ -41,7 +41,6 @@ import com.android.systemui.util.mockito.any import com.android.systemui.util.mockito.whenever import com.android.systemui.util.time.FakeSystemClock import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.runTest import org.junit.Before @@ -51,7 +50,6 @@ import org.junit.runner.RunWith import org.mockito.Mock import org.mockito.junit.MockitoJUnit -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class PromptSelectorInteractorImplTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/domain/interactor/SideFpsSensorInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/domain/interactor/SideFpsSensorInteractorTest.kt index a862112b56e8..4d967d686bab 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/domain/interactor/SideFpsSensorInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/domain/interactor/SideFpsSensorInteractorTest.kt @@ -55,7 +55,6 @@ import com.android.systemui.testKosmos import com.android.systemui.util.mockito.whenever import com.google.common.truth.Truth.assertThat import java.util.Optional -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.runCurrent @@ -69,7 +68,6 @@ import org.mockito.Mockito.mock import org.mockito.Mockito.spy import org.mockito.junit.MockitoJUnit -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class SideFpsSensorInteractorTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/domain/interactor/UdfpsOverlayInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/domain/interactor/UdfpsOverlayInteractorTest.kt index 297aee5c84c0..63b9d4fdf66f 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/domain/interactor/UdfpsOverlayInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/domain/interactor/UdfpsOverlayInteractorTest.kt @@ -33,7 +33,6 @@ import com.android.systemui.kosmos.testScope import com.android.systemui.res.R 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 @@ -50,7 +49,6 @@ import org.mockito.Mockito.verify import org.mockito.Mockito.`when` as whenever import org.mockito.junit.MockitoJUnit -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class UdfpsOverlayInteractorTest : SysuiTestCase() { 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 57df66207380..4d027088ca1a 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 @@ -37,7 +37,6 @@ 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 kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest @@ -59,7 +58,6 @@ import org.mockito.junit.MockitoJUnit import org.mockito.junit.MockitoRule import org.mockito.kotlin.firstValue -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) @TestableLooper.RunWithLooper(setAsMainLooper = true) diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/ui/viewmodel/CredentialViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/ui/viewmodel/CredentialViewModelTest.kt index e4c5cd456f03..3e1050739ce0 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/ui/viewmodel/CredentialViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/ui/viewmodel/CredentialViewModelTest.kt @@ -10,7 +10,6 @@ import com.android.systemui.biometrics.domain.interactor.PromptCredentialInterac import com.android.systemui.biometrics.promptInfo import com.android.systemui.biometrics.shared.model.PromptKind import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.flow.toList import kotlinx.coroutines.launch @@ -25,7 +24,6 @@ private const val USER_ID = 9 private const val REQUEST_ID = 9L private const val OPERATION_ID = 10L -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class CredentialViewModelTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/ui/viewmodel/DefaultUdfpsTouchOverlayViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/ui/viewmodel/DefaultUdfpsTouchOverlayViewModelTest.kt index 0d01472b45c7..a194c8ec9d3b 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/ui/viewmodel/DefaultUdfpsTouchOverlayViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/ui/viewmodel/DefaultUdfpsTouchOverlayViewModelTest.kt @@ -33,7 +33,6 @@ import com.android.systemui.statusbar.phone.SystemUIDialogManager import com.android.systemui.statusbar.phone.systemUIDialogManager import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Before @@ -46,7 +45,6 @@ import org.mockito.MockitoAnnotations import platform.test.runner.parameterized.ParameterizedAndroidJunit4 import platform.test.runner.parameterized.Parameters -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(ParameterizedAndroidJunit4::class) class DefaultUdfpsTouchOverlayViewModelTest(flags: FlagsParameterization) : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/ui/viewmodel/DeviceEntryUdfpsTouchOverlayViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/ui/viewmodel/DeviceEntryUdfpsTouchOverlayViewModelTest.kt index 77ddd3183b00..ce43c5f775aa 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/ui/viewmodel/DeviceEntryUdfpsTouchOverlayViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/ui/viewmodel/DeviceEntryUdfpsTouchOverlayViewModelTest.kt @@ -29,7 +29,6 @@ import com.android.systemui.statusbar.phone.SystemUIDialogManager import com.android.systemui.statusbar.phone.systemUIDialogManager import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Before @@ -40,7 +39,6 @@ import org.mockito.Captor import org.mockito.Mockito.verify import org.mockito.MockitoAnnotations -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class DeviceEntryUdfpsTouchOverlayViewModelTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/ui/viewmodel/PromptViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/ui/viewmodel/PromptViewModelTest.kt index 66f44babdf5f..b6c63479990e 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/ui/viewmodel/PromptViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/ui/viewmodel/PromptViewModelTest.kt @@ -77,7 +77,6 @@ import com.android.systemui.res.R import com.android.systemui.util.mockito.withArgCaptor import com.google.android.msdl.data.model.MSDLToken import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.first import kotlinx.coroutines.launch import kotlinx.coroutines.test.TestScope @@ -107,7 +106,6 @@ private const val OP_PACKAGE_NAME_WITH_APP_LOGO = "biometric.testapp" private const val OP_PACKAGE_NAME_NO_LOGO_INFO = "biometric.testapp.nologoinfo" private const val OP_PACKAGE_NAME_CAN_NOT_BE_FOUND = "can.not.be.found" -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(ParameterizedAndroidJunit4::class) internal class PromptViewModelTest(private val testCase: TestCase) : SysuiTestCase() { 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 831012c88f7b..9f90fb831257 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 @@ -48,7 +48,6 @@ import com.android.systemui.testKosmos import com.android.systemui.unfold.compat.ScreenSizeFoldProvider import com.android.systemui.util.mockito.whenever import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.runCurrent @@ -63,7 +62,6 @@ import org.mockito.Mockito.spy import org.mockito.junit.MockitoJUnit import org.mockito.junit.MockitoRule -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class SideFpsOverlayViewModelTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/bluetooth/qsdialog/AudioSharingDialogDelegateTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/bluetooth/qsdialog/AudioSharingDialogDelegateTest.kt index 9f0c7e1ba660..b4200b6850c8 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/bluetooth/qsdialog/AudioSharingDialogDelegateTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/bluetooth/qsdialog/AudioSharingDialogDelegateTest.kt @@ -27,7 +27,6 @@ import com.android.systemui.res.R import com.android.systemui.statusbar.phone.SystemUIDialog import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.MutableSharedFlow import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.test.runCurrent @@ -45,7 +44,6 @@ import org.mockito.kotlin.whenever @SmallTest @RunWith(AndroidJUnit4::class) @TestableLooper.RunWithLooper(setAsMainLooper = true) -@OptIn(ExperimentalCoroutinesApi::class) class AudioSharingDialogDelegateTest : SysuiTestCase() { @get:Rule val mockitoRule: MockitoRule = MockitoJUnit.rule() private val kosmos = testKosmos() diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/bluetooth/qsdialog/AudioSharingDialogViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/bluetooth/qsdialog/AudioSharingDialogViewModelTest.kt index 32606e09a1ac..3bb023f1daeb 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/bluetooth/qsdialog/AudioSharingDialogViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/bluetooth/qsdialog/AudioSharingDialogViewModelTest.kt @@ -30,7 +30,6 @@ import com.android.systemui.kosmos.testScope import com.android.systemui.res.R import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.MutableSharedFlow import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.test.UnconfinedTestDispatcher @@ -50,7 +49,6 @@ import org.mockito.kotlin.whenever @SmallTest @RunWith(AndroidJUnit4::class) @TestableLooper.RunWithLooper(setAsMainLooper = true) -@OptIn(ExperimentalCoroutinesApi::class) class AudioSharingDialogViewModelTest : SysuiTestCase() { @get:Rule val mockitoRule: MockitoRule = MockitoJUnit.rule() private val kosmos = testKosmos().apply { testDispatcher = UnconfinedTestDispatcher() } diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/bluetooth/qsdialog/AudioSharingInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/bluetooth/qsdialog/AudioSharingInteractorTest.kt index cebd05d92537..682ad0c5c48b 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/bluetooth/qsdialog/AudioSharingInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/bluetooth/qsdialog/AudioSharingInteractorTest.kt @@ -27,7 +27,6 @@ import com.android.systemui.coroutines.collectLastValue 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.launch import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest @@ -48,7 +47,6 @@ import org.mockito.kotlin.whenever @SmallTest @RunWith(AndroidJUnit4::class) @TestableLooper.RunWithLooper(setAsMainLooper = true) -@OptIn(ExperimentalCoroutinesApi::class) class AudioSharingInteractorTest : SysuiTestCase() { @get:Rule val mockito: MockitoRule = MockitoJUnit.rule() private val kosmos = testKosmos() diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/bluetooth/qsdialog/AudioSharingRepositoryTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/bluetooth/qsdialog/AudioSharingRepositoryTest.kt index f0746064f67f..587f3cc8357c 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/bluetooth/qsdialog/AudioSharingRepositoryTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/bluetooth/qsdialog/AudioSharingRepositoryTest.kt @@ -28,7 +28,6 @@ import com.android.systemui.kosmos.testDispatcher import com.android.systemui.kosmos.testScope import com.android.systemui.testKosmos import com.android.systemui.volume.data.repository.audioSharingRepository -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Before @@ -44,7 +43,6 @@ import org.mockito.kotlin.never import org.mockito.kotlin.verify import org.mockito.kotlin.whenever -@ExperimentalCoroutinesApi @SmallTest @RunWith(AndroidJUnit4::class) @TestableLooper.RunWithLooper(setAsMainLooper = true) diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/bluetooth/qsdialog/BluetoothDeviceMetadataInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/bluetooth/qsdialog/BluetoothDeviceMetadataInteractorTest.kt index cee17c32925e..5b108c855aaa 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/bluetooth/qsdialog/BluetoothDeviceMetadataInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/bluetooth/qsdialog/BluetoothDeviceMetadataInteractorTest.kt @@ -31,7 +31,6 @@ import com.android.systemui.kosmos.testDispatcher 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.flow.MutableSharedFlow import kotlinx.coroutines.test.UnconfinedTestDispatcher import kotlinx.coroutines.test.runCurrent @@ -52,7 +51,6 @@ import org.mockito.kotlin.times import org.mockito.kotlin.verify import org.mockito.kotlin.whenever -@OptIn(ExperimentalCoroutinesApi::class) @RunWith(AndroidJUnit4::class) @SmallTest @TestableLooper.RunWithLooper(setAsMainLooper = true) diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/bluetooth/qsdialog/DeviceItemActionInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/bluetooth/qsdialog/DeviceItemActionInteractorTest.kt index ad0337e5ce86..9803bb95dab3 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/bluetooth/qsdialog/DeviceItemActionInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/bluetooth/qsdialog/DeviceItemActionInteractorTest.kt @@ -24,7 +24,6 @@ import com.android.systemui.kosmos.testScope import com.android.systemui.statusbar.phone.SystemUIDialog import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.UnconfinedTestDispatcher import kotlinx.coroutines.test.runTest import org.junit.Before @@ -40,7 +39,6 @@ import org.mockito.kotlin.whenever @SmallTest @RunWith(AndroidJUnit4::class) @TestableLooper.RunWithLooper(setAsMainLooper = true) -@OptIn(ExperimentalCoroutinesApi::class) class DeviceItemActionInteractorTest : SysuiTestCase() { @get:Rule val mockitoRule: MockitoRule = MockitoJUnit.rule() private val kosmos = testKosmos().apply { testDispatcher = UnconfinedTestDispatcher() } diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/bouncer/data/repository/EmergencyServicesRepositoryImplTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/bouncer/data/repository/EmergencyServicesRepositoryImplTest.kt index d317aeb08e1e..1aa9c197b999 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/bouncer/data/repository/EmergencyServicesRepositoryImplTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/bouncer/data/repository/EmergencyServicesRepositoryImplTest.kt @@ -26,7 +26,6 @@ import com.android.systemui.coroutines.collectLastValue 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 @@ -34,7 +33,6 @@ import org.junit.Before import org.junit.Test import org.junit.runner.RunWith -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) @android.platform.test.annotations.EnabledOnRavenwood diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/bouncer/data/repository/SimBouncerRepositoryTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/bouncer/data/repository/SimBouncerRepositoryTest.kt index b391b5a45799..3fbb0221e85e 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/bouncer/data/repository/SimBouncerRepositoryTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/bouncer/data/repository/SimBouncerRepositoryTest.kt @@ -28,7 +28,6 @@ import com.android.systemui.statusbar.pipeline.mobile.util.FakeSubscriptionManag import com.android.systemui.util.mockito.any import com.android.systemui.util.mockito.whenever import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.test.StandardTestDispatcher import kotlinx.coroutines.test.TestScope @@ -176,7 +175,6 @@ class SimBouncerRepositoryTest : SysuiTestCase() { } /** Emits a new sim card state and collects the last value of the flow argument. */ - @OptIn(ExperimentalCoroutinesApi::class) private fun <T> TestScope.emitSubscriptionIdAndCollectLastValue( flow: Flow<T>, subId: Int = 1, diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/bouncer/domain/interactor/BouncerActionButtonInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/bouncer/domain/interactor/BouncerActionButtonInteractorTest.kt index 10bf5233e61e..f376e932e70b 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/bouncer/domain/interactor/BouncerActionButtonInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/bouncer/domain/interactor/BouncerActionButtonInteractorTest.kt @@ -43,7 +43,6 @@ import com.android.systemui.user.domain.interactor.SelectedUserInteractor import com.android.systemui.util.mockito.whenever import com.android.telecom.telecomManager import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Before @@ -55,7 +54,6 @@ import org.mockito.Mockito.never import org.mockito.Mockito.verify import org.mockito.MockitoAnnotations -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) @EnableSceneContainer diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/bouncer/domain/interactor/BouncerInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/bouncer/domain/interactor/BouncerInteractorTest.kt index 521b34671be4..dd4af7bb780e 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/bouncer/domain/interactor/BouncerInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/bouncer/domain/interactor/BouncerInteractorTest.kt @@ -46,7 +46,6 @@ import com.android.systemui.testKosmos import com.android.systemui.util.settings.fakeGlobalSettings import com.google.common.truth.Truth.assertThat import kotlin.time.Duration.Companion.seconds -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.advanceTimeBy import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest @@ -55,7 +54,6 @@ import org.junit.Test import org.junit.runner.RunWith import org.mockito.MockitoAnnotations -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) @EnableSceneContainer diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/bouncer/domain/interactor/BouncerMessageInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/bouncer/domain/interactor/BouncerMessageInteractorTest.kt index 65c9b72a3665..d098f2801ef6 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/bouncer/domain/interactor/BouncerMessageInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/bouncer/domain/interactor/BouncerMessageInteractorTest.kt @@ -53,7 +53,6 @@ import com.android.systemui.user.data.repository.fakeUserRepository import com.android.systemui.util.mockito.KotlinArgumentCaptor import com.android.systemui.util.mockito.whenever 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 @@ -67,7 +66,6 @@ import org.mockito.Mock import org.mockito.Mockito.verify import org.mockito.MockitoAnnotations -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @TestableLooper.RunWithLooper(setAsMainLooper = true) @RunWith(AndroidJUnit4::class) diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/bouncer/domain/interactor/SimBouncerInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/bouncer/domain/interactor/SimBouncerInteractorTest.kt index bd1403a6aa26..3b50e4b077ea 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/bouncer/domain/interactor/SimBouncerInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/bouncer/domain/interactor/SimBouncerInteractorTest.kt @@ -35,7 +35,6 @@ import com.android.systemui.statusbar.pipeline.mobile.data.repository.mobileConn import com.android.systemui.testKosmos import com.android.systemui.util.mockito.whenever 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 @@ -52,7 +51,6 @@ import org.mockito.MockitoAnnotations @SmallTest @RunWith(AndroidJUnit4::class) -@OptIn(ExperimentalCoroutinesApi::class) class SimBouncerInteractorTest : SysuiTestCase() { @Mock lateinit var telephonyManager: TelephonyManager @Mock lateinit var keyguardUpdateMonitor: KeyguardUpdateMonitor diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/bouncer/ui/viewmodel/AuthMethodBouncerViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/bouncer/ui/viewmodel/AuthMethodBouncerViewModelTest.kt index 9552564cf1a2..edd115fa0e51 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/bouncer/ui/viewmodel/AuthMethodBouncerViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/bouncer/ui/viewmodel/AuthMethodBouncerViewModelTest.kt @@ -33,7 +33,6 @@ import com.android.systemui.lifecycle.activateIn import com.android.systemui.testKosmos import com.google.android.msdl.data.model.MSDLToken import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest @@ -90,7 +89,6 @@ class AuthMethodBouncerViewModelTest : SysuiTestCase() { assertThat(animateFailure).isFalse() } - @OptIn(ExperimentalCoroutinesApi::class) @Test @EnableFlags(Flags.FLAG_MSDL_FEEDBACK) fun onAuthenticationResult_playUnlockTokenIfSuccessful() = @@ -109,7 +107,6 @@ class AuthMethodBouncerViewModelTest : SysuiTestCase() { assertThat(msdlPlayer.latestPropertiesPlayed).isEqualTo(authInteractionProperties) } - @OptIn(ExperimentalCoroutinesApi::class) @Test @EnableFlags(Flags.FLAG_MSDL_FEEDBACK) fun onAuthenticationResult_playFailureTokenIfFailure() = diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/bouncer/ui/viewmodel/BouncerMessageViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/bouncer/ui/viewmodel/BouncerMessageViewModelTest.kt index 8c8faee99139..482a067a11f5 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/bouncer/ui/viewmodel/BouncerMessageViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/bouncer/ui/viewmodel/BouncerMessageViewModelTest.kt @@ -59,7 +59,6 @@ import com.android.systemui.testKosmos import com.android.systemui.user.data.repository.fakeUserRepository import com.google.common.truth.Truth.assertThat import kotlin.time.Duration.Companion.seconds -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.advanceTimeBy import kotlinx.coroutines.test.currentTime @@ -69,7 +68,6 @@ import org.junit.Before import org.junit.Test import org.junit.runner.RunWith -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) @EnableFlags(Flags.FLAG_COMPOSE_BOUNCER) diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/bouncer/ui/viewmodel/BouncerSceneContentViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/bouncer/ui/viewmodel/BouncerSceneContentViewModelTest.kt index 94f6769ba406..eef8d9f40458 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/bouncer/ui/viewmodel/BouncerSceneContentViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/bouncer/ui/viewmodel/BouncerSceneContentViewModelTest.kt @@ -46,7 +46,6 @@ import com.android.systemui.scene.domain.startable.sceneContainerStartable import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat import com.google.common.truth.Truth.assertWithMessage -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.emptyFlow import kotlinx.coroutines.flow.flatMapLatest import kotlinx.coroutines.flow.launchIn @@ -59,7 +58,6 @@ import org.junit.Before import org.junit.Test import org.junit.runner.RunWith -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) @EnableSceneContainer diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/bouncer/ui/viewmodel/BouncerUserActionsViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/bouncer/ui/viewmodel/BouncerUserActionsViewModelTest.kt index d3715926932c..e12fabfd199d 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/bouncer/ui/viewmodel/BouncerUserActionsViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/bouncer/ui/viewmodel/BouncerUserActionsViewModelTest.kt @@ -32,14 +32,12 @@ import com.android.systemui.scene.shared.model.fakeSceneDataSource import com.android.systemui.testKosmos import com.android.systemui.truth.containsEntriesExactly import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Before import org.junit.Test import org.junit.runner.RunWith -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) @EnableSceneContainer diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/bouncer/ui/viewmodel/KeyguardBouncerViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/bouncer/ui/viewmodel/KeyguardBouncerViewModelTest.kt index 1a435013e7a9..61c74cc27bee 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/bouncer/ui/viewmodel/KeyguardBouncerViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/bouncer/ui/viewmodel/KeyguardBouncerViewModelTest.kt @@ -51,7 +51,6 @@ import org.mockito.MockitoAnnotations @SmallTest @RunWith(AndroidJUnit4::class) -@kotlinx.coroutines.ExperimentalCoroutinesApi class KeyguardBouncerViewModelTest : SysuiTestCase() { @Mock lateinit var bouncerView: BouncerView diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/bouncer/ui/viewmodel/PasswordBouncerViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/bouncer/ui/viewmodel/PasswordBouncerViewModelTest.kt index 29ee87466f1a..b2d245858196 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/bouncer/ui/viewmodel/PasswordBouncerViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/bouncer/ui/viewmodel/PasswordBouncerViewModelTest.kt @@ -47,7 +47,6 @@ import com.android.systemui.user.domain.interactor.selectedUserInteractor import com.google.common.truth.Truth.assertThat import java.util.UUID import kotlin.time.Duration.Companion.seconds -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.advanceTimeBy @@ -57,7 +56,6 @@ import org.junit.Before import org.junit.Test import org.junit.runner.RunWith -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class PasswordBouncerViewModelTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/bouncer/ui/viewmodel/PatternBouncerViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/bouncer/ui/viewmodel/PatternBouncerViewModelTest.kt index 0490a26019e1..ec7d1c3bea3e 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/bouncer/ui/viewmodel/PatternBouncerViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/bouncer/ui/viewmodel/PatternBouncerViewModelTest.kt @@ -41,7 +41,6 @@ import com.android.systemui.testKosmos import com.google.android.msdl.data.model.MSDLToken import com.google.common.truth.Truth.assertThat import com.google.common.truth.Truth.assertWithMessage -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.asStateFlow import kotlinx.coroutines.test.TestScope @@ -51,7 +50,6 @@ import org.junit.Before import org.junit.Test import org.junit.runner.RunWith -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class PatternBouncerViewModelTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/bouncer/ui/viewmodel/PinBouncerViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/bouncer/ui/viewmodel/PinBouncerViewModelTest.kt index af5f2acb444d..705e8341ff80 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/bouncer/ui/viewmodel/PinBouncerViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/bouncer/ui/viewmodel/PinBouncerViewModelTest.kt @@ -49,7 +49,6 @@ import com.google.common.truth.Truth.assertThat import kotlin.random.Random import kotlin.random.nextInt import kotlin.test.assertTrue -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.map import kotlinx.coroutines.test.TestScope @@ -59,7 +58,6 @@ import org.junit.Before import org.junit.Test import org.junit.runner.RunWith -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class PinBouncerViewModelTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/brightness/data/repository/ScreenBrightnessDisplayManagerRepositoryTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/brightness/data/repository/ScreenBrightnessDisplayManagerRepositoryTest.kt index 2e8efdb8c84b..8c748f07f859 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/brightness/data/repository/ScreenBrightnessDisplayManagerRepositoryTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/brightness/data/repository/ScreenBrightnessDisplayManagerRepositoryTest.kt @@ -38,7 +38,6 @@ import com.android.systemui.util.mockito.capture import com.android.systemui.util.mockito.eq import com.android.systemui.util.mockito.whenever import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Before @@ -53,7 +52,6 @@ import org.mockito.Mockito.verify import org.mockito.junit.MockitoJUnit import org.mockito.junit.MockitoRule -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class ScreenBrightnessDisplayManagerRepositoryTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/brightness/domain/interactor/ScreenBrightnessInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/brightness/domain/interactor/ScreenBrightnessInteractorTest.kt index 18e7a7e28b4d..39146d279d63 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/brightness/domain/interactor/ScreenBrightnessInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/brightness/domain/interactor/ScreenBrightnessInteractorTest.kt @@ -30,13 +30,11 @@ import com.android.systemui.kosmos.testScope import com.android.systemui.log.table.logcatTableLogBuffer import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Test import org.junit.runner.RunWith -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class ScreenBrightnessInteractorTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/brightness/ui/viewmodel/BrightnessSliderViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/brightness/ui/viewmodel/BrightnessSliderViewModelTest.kt index f9e88341316e..6deb5257e726 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/brightness/ui/viewmodel/BrightnessSliderViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/brightness/ui/viewmodel/BrightnessSliderViewModelTest.kt @@ -36,14 +36,12 @@ import com.android.systemui.settings.brightness.domain.interactor.brightnessMirr import com.android.systemui.settings.brightness.ui.brightnessWarningToast import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Before import org.junit.Test import org.junit.runner.RunWith -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class BrightnessSliderViewModelTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/camera/data/repository/CameraAutoRotateRepositoryImplTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/camera/data/repository/CameraAutoRotateRepositoryImplTest.kt index 667d364ddc69..648d74d20cc5 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/camera/data/repository/CameraAutoRotateRepositoryImplTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/camera/data/repository/CameraAutoRotateRepositoryImplTest.kt @@ -26,13 +26,11 @@ import com.android.systemui.kosmos.Kosmos import com.android.systemui.kosmos.testScope import com.android.systemui.util.settings.fakeSettings import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Test import org.junit.runner.RunWith -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class CameraAutoRotateRepositoryImplTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/camera/data/repository/CameraSensorPrivacyRepositoryImplTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/camera/data/repository/CameraSensorPrivacyRepositoryImplTest.kt index 29de58e2b28f..b73a212c9bd1 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/camera/data/repository/CameraSensorPrivacyRepositoryImplTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/camera/data/repository/CameraSensorPrivacyRepositoryImplTest.kt @@ -26,7 +26,6 @@ import com.android.systemui.kosmos.Kosmos import com.android.systemui.kosmos.testScope import com.android.systemui.util.mockito.mock import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Test @@ -35,7 +34,6 @@ import org.mockito.ArgumentCaptor import org.mockito.ArgumentMatchers import org.mockito.Mockito -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) @android.platform.test.annotations.EnabledOnRavenwood diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/camera/data/repository/FakeCameraAutoRotateRepositoryTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/camera/data/repository/FakeCameraAutoRotateRepositoryTest.kt index f75e036d78d4..6c8097ed7166 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/camera/data/repository/FakeCameraAutoRotateRepositoryTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/camera/data/repository/FakeCameraAutoRotateRepositoryTest.kt @@ -23,13 +23,11 @@ import com.android.systemui.SysuiTestCase import com.android.systemui.coroutines.collectValues import com.android.systemui.kosmos.Kosmos import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Test import org.junit.runner.RunWith -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) @android.platform.test.annotations.EnabledOnRavenwood diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/camera/data/repository/FakeCameraSensorPrivacyRepositoryTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/camera/data/repository/FakeCameraSensorPrivacyRepositoryTest.kt index 7fa1be3d20ff..7161c2c13a60 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/camera/data/repository/FakeCameraSensorPrivacyRepositoryTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/camera/data/repository/FakeCameraSensorPrivacyRepositoryTest.kt @@ -23,13 +23,11 @@ import com.android.systemui.SysuiTestCase import com.android.systemui.coroutines.collectValues import com.android.systemui.kosmos.Kosmos import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Test import org.junit.runner.RunWith -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) @android.platform.test.annotations.EnabledOnRavenwood diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/common/coroutine/CoroutineResultTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/common/coroutine/CoroutineResultTest.kt index de07cda21e75..51286507503e 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/common/coroutine/CoroutineResultTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/common/coroutine/CoroutineResultTest.kt @@ -19,14 +19,12 @@ import androidx.test.filters.SmallTest import com.android.systemui.SysuiTestCase import com.google.common.truth.Truth.assertThat import kotlinx.coroutines.CancellationException -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.cancel import kotlinx.coroutines.test.runTest import org.junit.Test import org.junit.runner.RunWith /** atest SystemUITests:CoroutineResultTest */ -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class CoroutineResultTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/common/data/repository/PackageInstallerMonitorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/common/data/repository/PackageInstallerMonitorTest.kt index 4c908dd895c7..781e416e6374 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/common/data/repository/PackageInstallerMonitorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/common/data/repository/PackageInstallerMonitorTest.kt @@ -36,7 +36,6 @@ import com.android.systemui.util.mockito.whenever import com.android.systemui.util.mockito.withArgCaptor import com.google.common.truth.Correspondence import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.launch import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest @@ -48,7 +47,6 @@ import org.mockito.Mockito.never import org.mockito.Mockito.verify import org.mockito.MockitoAnnotations -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class PackageInstallerMonitorTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/common/data/repository/PackageUpdateMonitorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/common/data/repository/PackageUpdateMonitorTest.kt index 35d9d3f21c8f..3e0c19e903ac 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/common/data/repository/PackageUpdateMonitorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/common/data/repository/PackageUpdateMonitorTest.kt @@ -34,7 +34,6 @@ import com.android.systemui.testKosmos import com.android.systemui.util.mockito.whenever import com.android.systemui.util.time.fakeSystemClock import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.MutableSharedFlow import kotlinx.coroutines.flow.first import kotlinx.coroutines.flow.launchIn @@ -47,7 +46,6 @@ import org.junit.runner.RunWith import org.mockito.Mock import org.mockito.MockitoAnnotations -@ExperimentalCoroutinesApi @SmallTest @RunWith(AndroidJUnit4::class) class PackageUpdateMonitorTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/common/domain/interactor/PackageChangeInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/common/domain/interactor/PackageChangeInteractorTest.kt index a164e7cbc0ec..19bc04bfdbb5 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/common/domain/interactor/PackageChangeInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/common/domain/interactor/PackageChangeInteractorTest.kt @@ -31,7 +31,6 @@ import com.android.systemui.testKosmos import com.android.systemui.user.data.repository.fakeUserRepository import com.android.systemui.user.domain.interactor.selectedUserInteractor 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 @@ -39,7 +38,6 @@ import org.junit.Before import org.junit.Test import org.junit.runner.RunWith -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class PackageChangeInteractorTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/common/ui/data/repository/ConfigurationRepositoryImplTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/common/ui/data/repository/ConfigurationRepositoryImplTest.kt index 205f94434970..a2c647d85330 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/common/ui/data/repository/ConfigurationRepositoryImplTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/common/ui/data/repository/ConfigurationRepositoryImplTest.kt @@ -28,7 +28,6 @@ import com.android.systemui.util.mockito.whenever import com.android.systemui.util.mockito.withArgCaptor import com.android.systemui.util.wrapper.DisplayUtilsWrapper 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 @@ -42,7 +41,6 @@ import org.mockito.Mockito.verify import org.mockito.MockitoAnnotations import org.mockito.kotlin.clearInvocations -@ExperimentalCoroutinesApi @SmallTest @RunWith(AndroidJUnit4::class) class ConfigurationRepositoryImplTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/common/ui/domain/interactor/ConfigurationInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/common/ui/domain/interactor/ConfigurationInteractorTest.kt index 5994afa948c7..4a960fee603a 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/common/ui/domain/interactor/ConfigurationInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/common/ui/domain/interactor/ConfigurationInteractorTest.kt @@ -27,7 +27,6 @@ import com.android.systemui.common.ui.data.repository.FakeConfigurationRepositor import com.android.systemui.coroutines.collectLastValue import com.android.systemui.coroutines.collectValues 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 @@ -38,7 +37,6 @@ import org.mockito.MockitoAnnotations import org.mockito.kotlin.mock import org.mockito.kotlin.whenever -@ExperimentalCoroutinesApi @SmallTest @RunWith(AndroidJUnit4::class) class ConfigurationInteractorTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/common/ui/view/LongPressHandlingViewInteractionHandlerTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/common/ui/view/LongPressHandlingViewInteractionHandlerTest.kt index f06cd6aec8e0..262c5903ec83 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/common/ui/view/LongPressHandlingViewInteractionHandlerTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/common/ui/view/LongPressHandlingViewInteractionHandlerTest.kt @@ -29,7 +29,6 @@ import com.android.systemui.util.mockito.any import com.android.systemui.util.mockito.whenever import com.google.common.truth.Truth.assertThat import kotlinx.coroutines.DisposableHandle -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runTest import org.junit.Before import org.junit.Test @@ -39,7 +38,6 @@ import org.mockito.Mockito.never import org.mockito.Mockito.verify import org.mockito.MockitoAnnotations -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class LongPressHandlingViewInteractionHandlerTest : SysuiTestCase() { 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 00d5afe26f0a..ad7df9e97c83 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/CommunalDreamStartableTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/CommunalDreamStartableTest.kt @@ -42,7 +42,6 @@ import com.android.systemui.power.domain.interactor.powerInteractor import com.android.systemui.power.shared.model.ScreenPowerState import com.android.systemui.testKosmos import com.android.systemui.util.mockito.whenever -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest @@ -54,7 +53,6 @@ import org.mockito.Mockito.verify import platform.test.runner.parameterized.ParameterizedAndroidJunit4 import platform.test.runner.parameterized.Parameters -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @EnableFlags(Flags.FLAG_COMMUNAL_HUB) @RunWith(ParameterizedAndroidJunit4::class) diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/CommunalOngoingContentStartableTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/CommunalOngoingContentStartableTest.kt index 9113617095e2..e53155de653d 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/CommunalOngoingContentStartableTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/CommunalOngoingContentStartableTest.kt @@ -32,14 +32,12 @@ import com.android.systemui.kosmos.applicationCoroutineScope 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.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Before import org.junit.Test import org.junit.runner.RunWith -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @EnableFlags(FLAG_COMMUNAL_HUB) @RunWith(AndroidJUnit4::class) diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/CommunalSceneStartableTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/CommunalSceneStartableTest.kt index 68f4acde7609..6f2082b35fa7 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/CommunalSceneStartableTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/CommunalSceneStartableTest.kt @@ -58,7 +58,6 @@ import com.android.systemui.testKosmos import com.android.systemui.util.settings.fakeSettings import com.google.common.truth.Truth.assertThat import kotlin.time.Duration.Companion.milliseconds -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.launch import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.advanceTimeBy @@ -72,7 +71,6 @@ import org.mockito.kotlin.whenever import platform.test.runner.parameterized.ParameterizedAndroidJunit4 import platform.test.runner.parameterized.Parameters -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(ParameterizedAndroidJunit4::class) @EnableFlags(FLAG_COMMUNAL_HUB) diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/data/db/DefaultWidgetPopulationTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/data/db/DefaultWidgetPopulationTest.kt index f1c58a2aeac9..3eb08004ae61 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/data/db/DefaultWidgetPopulationTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/data/db/DefaultWidgetPopulationTest.kt @@ -30,7 +30,6 @@ import com.android.systemui.kosmos.applicationCoroutineScope import com.android.systemui.kosmos.testScope import com.android.systemui.log.logcatLogBuffer import com.android.systemui.testKosmos -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Before @@ -45,7 +44,6 @@ import org.mockito.kotlin.never import org.mockito.kotlin.verify @SmallTest -@OptIn(ExperimentalCoroutinesApi::class) @RunWith(AndroidJUnit4::class) class DefaultWidgetPopulationTest : SysuiTestCase() { private val kosmos = testKosmos() diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/data/repository/CommunalMediaRepositoryImplTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/data/repository/CommunalMediaRepositoryImplTest.kt index 2b0928ffd396..c6196d4861b8 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/data/repository/CommunalMediaRepositoryImplTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/data/repository/CommunalMediaRepositoryImplTest.kt @@ -27,7 +27,6 @@ import com.android.systemui.media.controls.shared.model.MediaData import com.android.systemui.testKosmos import com.android.systemui.util.mockito.whenever import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Before @@ -37,7 +36,6 @@ import org.mockito.Mockito.verify import org.mockito.kotlin.argumentCaptor import org.mockito.kotlin.mock -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) @android.platform.test.annotations.EnabledOnRavenwood diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/data/repository/CommunalPrefsRepositoryImplTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/data/repository/CommunalPrefsRepositoryImplTest.kt index b6359c7f8da5..3682dcec8dfd 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/data/repository/CommunalPrefsRepositoryImplTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/data/repository/CommunalPrefsRepositoryImplTest.kt @@ -34,7 +34,6 @@ import com.android.systemui.settings.UserFileManager import com.android.systemui.settings.fakeUserFileManager import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Test @@ -44,7 +43,6 @@ import org.mockito.Mockito.clearInvocations import org.mockito.Mockito.verify import org.mockito.kotlin.spy -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class CommunalPrefsRepositoryImplTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/data/repository/CommunalSmartspaceRepositoryImplTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/data/repository/CommunalSmartspaceRepositoryImplTest.kt index 1a426d6ebce2..4e12a169d00f 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/data/repository/CommunalSmartspaceRepositoryImplTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/data/repository/CommunalSmartspaceRepositoryImplTest.kt @@ -33,7 +33,6 @@ import com.android.systemui.plugins.BcSmartspaceDataPlugin.SmartspaceTargetListe import com.android.systemui.testKosmos import com.android.systemui.util.time.fakeSystemClock import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Before @@ -47,7 +46,6 @@ import org.mockito.kotlin.never import org.mockito.kotlin.verify @SmallTest -@OptIn(ExperimentalCoroutinesApi::class) @RunWith(AndroidJUnit4::class) class CommunalSmartspaceRepositoryImplTest : SysuiTestCase() { private val kosmos = testKosmos() diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/domain/interactor/CommunalBackActionInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/domain/interactor/CommunalBackActionInteractorTest.kt index c365f1cb3872..70f38f7bc94e 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/domain/interactor/CommunalBackActionInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/domain/interactor/CommunalBackActionInteractorTest.kt @@ -29,12 +29,10 @@ import com.android.systemui.kosmos.runCurrent import com.android.systemui.kosmos.runTest import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import org.junit.Test import org.junit.runner.RunWith @SmallTest -@OptIn(ExperimentalCoroutinesApi::class) @RunWith(AndroidJUnit4::class) class CommunalBackActionInteractorTest : SysuiTestCase() { private val kosmos = testKosmos() diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/domain/interactor/CommunalInteractorCommunalDisabledTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/domain/interactor/CommunalInteractorCommunalDisabledTest.kt index cebcbc98bbaa..beec184b80e7 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/domain/interactor/CommunalInteractorCommunalDisabledTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/domain/interactor/CommunalInteractorCommunalDisabledTest.kt @@ -31,7 +31,6 @@ import com.android.systemui.keyguard.data.repository.fakeKeyguardRepository 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.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Before @@ -42,7 +41,6 @@ import org.junit.runner.RunWith * This class is a variation of the [CommunalInteractorTest] for cases where communal is disabled. */ @SmallTest -@OptIn(ExperimentalCoroutinesApi::class) @RunWith(AndroidJUnit4::class) class CommunalInteractorCommunalDisabledTest : SysuiTestCase() { private val kosmos = testKosmos() diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/domain/interactor/CommunalSceneInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/domain/interactor/CommunalSceneInteractorTest.kt index 6a9b9beaa614..77d7091e463a 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/domain/interactor/CommunalSceneInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/domain/interactor/CommunalSceneInteractorTest.kt @@ -35,7 +35,6 @@ import com.android.systemui.scene.initialSceneKey import com.android.systemui.scene.shared.model.Scenes import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.test.advanceTimeBy @@ -126,7 +125,6 @@ class CommunalSceneInteractorTest(flags: FlagsParameterization) : SysuiTestCase( assertThat(currentScene).isEqualTo(CommunalScenes.Communal) } - @OptIn(ExperimentalCoroutinesApi::class) @DisableFlags(FLAG_SCENE_CONTAINER) @Test fun snapToSceneWithDelay() = diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/domain/interactor/CommunalSceneTransitionInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/domain/interactor/CommunalSceneTransitionInteractorTest.kt index d5020a580d00..ff722bf602bc 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/domain/interactor/CommunalSceneTransitionInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/domain/interactor/CommunalSceneTransitionInteractorTest.kt @@ -51,7 +51,6 @@ import com.android.systemui.kosmos.testScope import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat import kotlin.time.Duration.Companion.seconds -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.MutableSharedFlow import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.flowOf @@ -63,7 +62,6 @@ import org.junit.Before import org.junit.Test import org.junit.runner.RunWith -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) @EnableFlags(FLAG_COMMUNAL_HUB, FLAG_COMMUNAL_SCENE_KTF_REFACTOR) diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/domain/interactor/CommunalTutorialInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/domain/interactor/CommunalTutorialInteractorTest.kt index 8a9c42d9b64e..feee9e3d62d2 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/domain/interactor/CommunalTutorialInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/domain/interactor/CommunalTutorialInteractorTest.kt @@ -36,7 +36,6 @@ import com.android.systemui.testKosmos import com.android.systemui.user.data.repository.FakeUserRepository import com.android.systemui.user.data.repository.fakeUserRepository 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 @@ -44,7 +43,6 @@ import org.junit.Before import org.junit.Test import org.junit.runner.RunWith -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class CommunalTutorialInteractorTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/domain/interactor/WidgetTrampolineInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/domain/interactor/WidgetTrampolineInteractorTest.kt index d6734e85ed77..d15ec2ff193e 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/domain/interactor/WidgetTrampolineInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/domain/interactor/WidgetTrampolineInteractorTest.kt @@ -38,7 +38,6 @@ import com.android.systemui.util.time.fakeSystemClock import kotlin.time.Duration import kotlin.time.Duration.Companion.milliseconds import kotlin.time.Duration.Companion.seconds -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.launch import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.advanceTimeBy @@ -56,7 +55,6 @@ import org.mockito.kotlin.never import org.mockito.kotlin.times import org.mockito.kotlin.verify -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class WidgetTrampolineInteractorTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/log/CommunalLoggerStartableTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/log/CommunalLoggerStartableTest.kt index 28ad269776f9..358cae7c9cdb 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/log/CommunalLoggerStartableTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/log/CommunalLoggerStartableTest.kt @@ -31,7 +31,6 @@ import com.android.systemui.keyguard.data.repository.fakeKeyguardRepository import com.android.systemui.keyguard.domain.interactor.keyguardInteractor import com.android.systemui.kosmos.testScope import com.android.systemui.testKosmos -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.emptyFlow import kotlinx.coroutines.flow.flowOf @@ -48,7 +47,6 @@ import org.mockito.Mockito.verify import org.mockito.MockitoAnnotations @SmallTest -@OptIn(ExperimentalCoroutinesApi::class) @RunWith(AndroidJUnit4::class) class CommunalLoggerStartableTest : SysuiTestCase() { @Mock private lateinit var uiEventLogger: UiEventLogger diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/ui/viewmodel/CommunalTransitionViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/ui/viewmodel/CommunalTransitionViewModelTest.kt index 0084e18f519f..1a3606e413cc 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/ui/viewmodel/CommunalTransitionViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/ui/viewmodel/CommunalTransitionViewModelTest.kt @@ -35,7 +35,6 @@ import com.android.systemui.scene.domain.interactor.sceneInteractor import com.android.systemui.scene.shared.model.Scenes import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.runCurrent @@ -45,7 +44,6 @@ import org.junit.runner.RunWith import platform.test.runner.parameterized.ParameterizedAndroidJunit4 import platform.test.runner.parameterized.Parameters -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(ParameterizedAndroidJunit4::class) class CommunalTransitionViewModelTest(flags: FlagsParameterization) : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/ui/viewmodel/CommunalUserActionsViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/ui/viewmodel/CommunalUserActionsViewModelTest.kt index 5510710b9b3f..c158baf5a80c 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/ui/viewmodel/CommunalUserActionsViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/ui/viewmodel/CommunalUserActionsViewModelTest.kt @@ -14,8 +14,6 @@ * limitations under the License. */ -@file:OptIn(ExperimentalCoroutinesApi::class) - package com.android.systemui.communal.ui.viewmodel import androidx.test.ext.junit.runners.AndroidJUnit4 @@ -46,7 +44,6 @@ import com.android.systemui.shade.domain.interactor.enableSplitShade import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat import kotlin.test.Test -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/ui/viewmodel/ResizeableItemFrameViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/ui/viewmodel/ResizeableItemFrameViewModelTest.kt index bea1010d8887..3ad798139107 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/ui/viewmodel/ResizeableItemFrameViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/ui/viewmodel/ResizeableItemFrameViewModelTest.kt @@ -26,7 +26,6 @@ import com.android.systemui.kosmos.testScope import com.android.systemui.lifecycle.activateIn 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 @@ -34,7 +33,6 @@ import org.junit.Before import org.junit.Test import org.junit.runner.RunWith -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class ResizeableItemFrameViewModelTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/ui/widgets/CommunalAppWidgetHostTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/ui/widgets/CommunalAppWidgetHostTest.kt index 18513fc496b4..30c41c8f7ec6 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/ui/widgets/CommunalAppWidgetHostTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/ui/widgets/CommunalAppWidgetHostTest.kt @@ -32,7 +32,6 @@ import com.android.systemui.util.mockito.any import com.android.systemui.util.mockito.eq import com.android.systemui.util.mockito.mock import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Before @@ -42,7 +41,6 @@ import org.mockito.Mockito.clearInvocations import org.mockito.Mockito.never import org.mockito.Mockito.verify -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWithLooper(setAsMainLooper = true) @RunWith(AndroidJUnit4::class) diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/view/viewmodel/CommunalViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/view/viewmodel/CommunalViewModelTest.kt index 7866a7f01658..dbdd7fb2773a 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/view/viewmodel/CommunalViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/view/viewmodel/CommunalViewModelTest.kt @@ -95,7 +95,6 @@ import com.android.systemui.testKosmos import com.android.systemui.user.data.repository.FakeUserRepository import com.android.systemui.user.data.repository.fakeUserRepository import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.test.advanceTimeBy import kotlinx.coroutines.test.runCurrent @@ -117,7 +116,6 @@ import org.mockito.kotlin.whenever import platform.test.runner.parameterized.ParameterizedAndroidJunit4 import platform.test.runner.parameterized.Parameters -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(ParameterizedAndroidJunit4::class) class CommunalViewModelTest(flags: FlagsParameterization) : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/widgets/CommunalAppWidgetHostStartableTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/widgets/CommunalAppWidgetHostStartableTest.kt index 9ef2b190fdd7..95681941a1c1 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/widgets/CommunalAppWidgetHostStartableTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/widgets/CommunalAppWidgetHostStartableTest.kt @@ -41,7 +41,6 @@ import com.android.systemui.user.data.repository.fakeUserRepository import com.android.systemui.util.mockito.whenever import com.android.systemui.util.settings.fakeSettings import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.MutableSharedFlow import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest @@ -53,7 +52,6 @@ import org.mockito.Mockito.never import org.mockito.Mockito.verify import org.mockito.MockitoAnnotations -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class CommunalAppWidgetHostStartableTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/widgets/CommunalTransitionAnimatorControllerTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/widgets/CommunalTransitionAnimatorControllerTest.kt index a052b078167d..a4261b0ea844 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/widgets/CommunalTransitionAnimatorControllerTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/widgets/CommunalTransitionAnimatorControllerTest.kt @@ -26,7 +26,6 @@ import com.android.systemui.coroutines.collectLastValue import com.android.systemui.kosmos.testScope import com.android.systemui.testKosmos import com.google.common.truth.Truth -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.advanceTimeBy import kotlinx.coroutines.test.runTest import org.junit.Assert.assertFalse @@ -37,7 +36,6 @@ import org.junit.runner.RunWith import org.mockito.kotlin.mock import org.mockito.kotlin.verify -@ExperimentalCoroutinesApi @SmallTest @RunWith(AndroidJUnit4::class) class CommunalTransitionAnimatorControllerTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/widgets/EditWidgetsActivityControllerTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/widgets/EditWidgetsActivityControllerTest.kt index 3ba86254d2f4..9525496e1472 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/widgets/EditWidgetsActivityControllerTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/widgets/EditWidgetsActivityControllerTest.kt @@ -22,7 +22,6 @@ import android.os.Bundle import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest import com.android.systemui.SysuiTestCase -import kotlinx.coroutines.ExperimentalCoroutinesApi import org.junit.Test import org.junit.runner.RunWith import org.mockito.kotlin.argumentCaptor @@ -32,7 +31,6 @@ import org.mockito.kotlin.never import org.mockito.kotlin.verify import org.mockito.kotlin.whenever -@ExperimentalCoroutinesApi @SmallTest @RunWith(AndroidJUnit4::class) class EditWidgetsActivityControllerTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/widgets/EditWidgetsActivityStarterTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/widgets/EditWidgetsActivityStarterTest.kt index 48b42d551d60..807023cbd59d 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/widgets/EditWidgetsActivityStarterTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/widgets/EditWidgetsActivityStarterTest.kt @@ -25,7 +25,6 @@ import com.android.systemui.kosmos.testScope import com.android.systemui.plugins.ActivityStarter import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runTest import org.junit.Before import org.junit.Test @@ -37,7 +36,6 @@ import org.mockito.kotlin.mock import org.mockito.kotlin.times import org.mockito.kotlin.verify -@ExperimentalCoroutinesApi @SmallTest @RunWith(AndroidJUnit4::class) class EditWidgetsActivityStarterTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/widgets/GlanceableHubWidgetManagerServiceTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/widgets/GlanceableHubWidgetManagerServiceTest.kt index c3c958ca0e94..a2f702c672ff 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/widgets/GlanceableHubWidgetManagerServiceTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/widgets/GlanceableHubWidgetManagerServiceTest.kt @@ -39,7 +39,6 @@ import com.android.systemui.log.logcatLogBuffer import com.android.systemui.testKosmos import com.android.systemui.utils.coroutines.flow.conflatedCallbackFlow import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.channels.awaitClose import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest @@ -54,7 +53,6 @@ import org.mockito.kotlin.never import org.mockito.kotlin.verify import org.mockito.kotlin.whenever -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @TestableLooper.RunWithLooper(setAsMainLooper = true) @RunWith(AndroidJUnit4::class) diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/widgets/WidgetConfigurationControllerTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/widgets/WidgetConfigurationControllerTest.kt index e1bdf1c42c9a..8ad9048742c1 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/widgets/WidgetConfigurationControllerTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/widgets/WidgetConfigurationControllerTest.kt @@ -31,7 +31,6 @@ import com.android.systemui.kosmos.testDispatcher 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.async import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest @@ -47,7 +46,6 @@ import org.mockito.kotlin.mock import org.mockito.kotlin.verify import org.mockito.kotlin.whenever -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class WidgetConfigurationControllerTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/widgets/WidgetInteractionHandlerTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/widgets/WidgetInteractionHandlerTest.kt index 9c308a60d3f0..ed4e73a40979 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/widgets/WidgetInteractionHandlerTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/widgets/WidgetInteractionHandlerTest.kt @@ -36,7 +36,6 @@ import com.android.systemui.kosmos.testScope import com.android.systemui.log.logcatLogBuffer import com.android.systemui.plugins.ActivityStarter import com.android.systemui.testKosmos -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Assert.assertFalse @@ -52,7 +51,6 @@ import org.mockito.kotlin.mock import org.mockito.kotlin.refEq import org.mockito.kotlin.verify -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class WidgetInteractionHandlerTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/controls/panels/SelectedComponentRepositoryTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/controls/panels/SelectedComponentRepositoryTest.kt index 86e3481ff263..0545665dd2ca 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/controls/panels/SelectedComponentRepositoryTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/controls/panels/SelectedComponentRepositoryTest.kt @@ -33,7 +33,6 @@ import com.android.systemui.util.FakeSharedPreferences import com.android.systemui.util.mockito.whenever import com.google.common.truth.Truth.assertThat import java.io.File -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.advanceUntilIdle import kotlinx.coroutines.test.runTest import org.junit.Before @@ -42,7 +41,6 @@ import org.junit.runner.RunWith import org.mockito.Mock import org.mockito.MockitoAnnotations -@ExperimentalCoroutinesApi @RunWith(AndroidJUnit4::class) @SmallTest class SelectedComponentRepositoryTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/controls/settings/ControlsSettingsRepositoryImplTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/controls/settings/ControlsSettingsRepositoryImplTest.kt index 3bdd5cf8cfe7..43945fa72ea0 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/controls/settings/ControlsSettingsRepositoryImplTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/controls/settings/ControlsSettingsRepositoryImplTest.kt @@ -25,7 +25,6 @@ import com.android.systemui.SysuiTestCase import com.android.systemui.user.data.repository.FakeUserRepository import com.android.systemui.util.settings.FakeSettings import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.toList import kotlinx.coroutines.launch import kotlinx.coroutines.test.TestScope @@ -37,7 +36,6 @@ import org.junit.runner.RunWith @SmallTest @RunWith(AndroidJUnit4::class) -@OptIn(ExperimentalCoroutinesApi::class) class ControlsSettingsRepositoryImplTest : SysuiTestCase() { companion object { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/controls/start/ControlsStartableTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/controls/start/ControlsStartableTest.kt index 0d8312e7f264..11c6fed5f0c1 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/controls/start/ControlsStartableTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/controls/start/ControlsStartableTest.kt @@ -57,7 +57,6 @@ import com.android.systemui.util.mockito.whenever import com.android.systemui.util.time.FakeSystemClock import com.google.common.truth.Truth.assertThat import java.util.Optional -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Before @@ -73,7 +72,6 @@ import org.mockito.Mockito.verifyNoMoreInteractions import org.mockito.Mockito.`when` import org.mockito.MockitoAnnotations -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class ControlsStartableTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/coroutines/FlowTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/coroutines/FlowTest.kt index 23da3f1d3ac0..7a77f0d6eb9b 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/coroutines/FlowTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/coroutines/FlowTest.kt @@ -4,13 +4,11 @@ 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 kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.test.runTest import org.junit.Test import org.junit.runner.RunWith -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class FlowTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/demomode/DemoModeControllerTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/demomode/DemoModeControllerTest.kt index 4793a52f3497..014a4189a340 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/demomode/DemoModeControllerTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/demomode/DemoModeControllerTest.kt @@ -27,7 +27,6 @@ import com.android.systemui.demomode.DemoMode.COMMAND_STATUS import com.android.systemui.dump.DumpManager import com.android.systemui.util.settings.FakeGlobalSettings import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.launch import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.UnconfinedTestDispatcher @@ -39,7 +38,6 @@ import org.mockito.Mock import org.mockito.MockitoAnnotations @Suppress("EXPERIMENTAL_IS_NOT_ENABLED") -@OptIn(ExperimentalCoroutinesApi::class) @RunWith(AndroidJUnit4::class) @TestableLooper.RunWithLooper @SmallTest diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/deviceconfig/data/repository/DeviceConfigRepositoryTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/deviceconfig/data/repository/DeviceConfigRepositoryTest.kt index 79115ae2ebdd..844c9bf8c97c 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/deviceconfig/data/repository/DeviceConfigRepositoryTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/deviceconfig/data/repository/DeviceConfigRepositoryTest.kt @@ -14,8 +14,6 @@ * limitations under the License. */ -@file:OptIn(ExperimentalCoroutinesApi::class) - package com.android.systemui.deviceconfig.data.repository import androidx.test.ext.junit.runners.AndroidJUnit4 @@ -27,7 +25,6 @@ import com.android.systemui.kosmos.testScope import com.android.systemui.testKosmos import com.android.systemui.util.fakeDeviceConfigProxy import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runTest import org.junit.Test import org.junit.runner.RunWith diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/deviceentry/data/repository/DeviceEntryFaceAuthRepositoryTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/deviceentry/data/repository/DeviceEntryFaceAuthRepositoryTest.kt index 71abed78e557..f6016c6479ac 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/deviceentry/data/repository/DeviceEntryFaceAuthRepositoryTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/deviceentry/data/repository/DeviceEntryFaceAuthRepositoryTest.kt @@ -93,7 +93,6 @@ import com.android.systemui.util.mockito.whenever import com.google.common.truth.Truth.assertThat import java.io.PrintWriter import java.io.StringWriter -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.test.TestScope @@ -116,7 +115,6 @@ import org.mockito.Mockito.verify import org.mockito.Mockito.verifyNoMoreInteractions import org.mockito.MockitoAnnotations -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class DeviceEntryFaceAuthRepositoryTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/deviceentry/data/repository/DeviceEntryRepositoryTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/deviceentry/data/repository/DeviceEntryRepositoryTest.kt index 73373d553560..89ad668f1e2f 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/deviceentry/data/repository/DeviceEntryRepositoryTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/deviceentry/data/repository/DeviceEntryRepositoryTest.kt @@ -13,7 +13,6 @@ import com.android.systemui.user.data.repository.FakeUserRepository import com.android.systemui.util.mockito.whenever import com.android.systemui.util.mockito.withArgCaptor import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.runBlocking import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest @@ -24,7 +23,6 @@ import org.mockito.Mock import org.mockito.Mockito.verify import org.mockito.MockitoAnnotations -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) @android.platform.test.annotations.EnabledOnRavenwood diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/deviceentry/domain/interactor/AuthRippleInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/deviceentry/domain/interactor/AuthRippleInteractorTest.kt index 3005d0b0d160..5e2e07c88f24 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/deviceentry/domain/interactor/AuthRippleInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/deviceentry/domain/interactor/AuthRippleInteractorTest.kt @@ -27,13 +27,11 @@ import com.android.systemui.keyguard.shared.model.BiometricUnlockSource 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.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Test import org.junit.runner.RunWith -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class AuthRippleInteractorTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/deviceentry/domain/interactor/BiometricMessageInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/deviceentry/domain/interactor/BiometricMessageInteractorTest.kt index 6fd866066879..f44b9fea3437 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/deviceentry/domain/interactor/BiometricMessageInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/deviceentry/domain/interactor/BiometricMessageInteractorTest.kt @@ -45,14 +45,12 @@ import com.android.systemui.kosmos.testScope import com.android.systemui.testKosmos import com.android.systemui.util.mockito.whenever import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Test import org.junit.runner.RunWith import org.mockito.ArgumentMatchers.anyInt -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class BiometricMessageInteractorTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/deviceentry/domain/interactor/DeviceEntryBiometricSettingsInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/deviceentry/domain/interactor/DeviceEntryBiometricSettingsInteractorTest.kt index 4a7757ba1820..2d69227bb4a7 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/deviceentry/domain/interactor/DeviceEntryBiometricSettingsInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/deviceentry/domain/interactor/DeviceEntryBiometricSettingsInteractorTest.kt @@ -24,12 +24,10 @@ import com.android.systemui.keyguard.data.repository.biometricSettingsRepository 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.runTest import org.junit.Test import org.junit.runner.RunWith -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class DeviceEntryBiometricSettingsInteractorTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/deviceentry/domain/interactor/DeviceEntryBiometricsAllowedInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/deviceentry/domain/interactor/DeviceEntryBiometricsAllowedInteractorTest.kt index 295a626d2028..46b2986c376d 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/deviceentry/domain/interactor/DeviceEntryBiometricsAllowedInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/deviceentry/domain/interactor/DeviceEntryBiometricsAllowedInteractorTest.kt @@ -30,12 +30,10 @@ import com.android.systemui.keyguard.data.repository.fakeDeviceEntryFingerprintA 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.runTest import org.junit.Test import org.junit.runner.RunWith -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class DeviceEntryBiometricsAllowedInteractorTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/deviceentry/domain/interactor/DeviceEntryFaceAuthInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/deviceentry/domain/interactor/DeviceEntryFaceAuthInteractorTest.kt index a0c56b4a27a6..329627af8ec2 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/deviceentry/domain/interactor/DeviceEntryFaceAuthInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/deviceentry/domain/interactor/DeviceEntryFaceAuthInteractorTest.kt @@ -61,7 +61,6 @@ import com.android.systemui.user.data.model.SelectionStatus import com.android.systemui.user.data.repository.fakeUserRepository import com.android.systemui.util.mockito.eq import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.test.TestScope @@ -74,7 +73,6 @@ import org.mockito.ArgumentMatchers.anyInt import org.mockito.Mockito.never import org.mockito.Mockito.verify -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class DeviceEntryFaceAuthInteractorTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/deviceentry/domain/interactor/DeviceEntryFaceAuthStatusInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/deviceentry/domain/interactor/DeviceEntryFaceAuthStatusInteractorTest.kt index 6022d9cfcbfd..886351c4bad6 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/deviceentry/domain/interactor/DeviceEntryFaceAuthStatusInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/deviceentry/domain/interactor/DeviceEntryFaceAuthStatusInteractorTest.kt @@ -33,7 +33,6 @@ import com.android.systemui.kosmos.testScope import com.android.systemui.res.R 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 @@ -42,7 +41,6 @@ import org.junit.Test import org.junit.runner.RunWith import org.mockito.Mockito.mock -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class DeviceEntryFaceAuthStatusInteractorTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/deviceentry/domain/interactor/DeviceEntryHapticsInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/deviceentry/domain/interactor/DeviceEntryHapticsInteractorTest.kt index 5fd480f90ac9..e0515000b232 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/deviceentry/domain/interactor/DeviceEntryHapticsInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/deviceentry/domain/interactor/DeviceEntryHapticsInteractorTest.kt @@ -56,7 +56,6 @@ import com.android.systemui.statusbar.phone.dozeScrimController import com.android.systemui.statusbar.phone.screenOffAnimationController import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.advanceTimeBy @@ -68,7 +67,6 @@ import org.junit.runner.RunWith import org.mockito.ArgumentMatchers.anyBoolean import org.mockito.kotlin.whenever -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class DeviceEntryHapticsInteractorTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/deviceentry/domain/interactor/DeviceEntryInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/deviceentry/domain/interactor/DeviceEntryInteractorTest.kt index 1bb5c9afdc33..84f08f14a86a 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/deviceentry/domain/interactor/DeviceEntryInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/deviceentry/domain/interactor/DeviceEntryInteractorTest.kt @@ -49,7 +49,6 @@ import com.android.systemui.scene.shared.model.Scenes import com.android.systemui.statusbar.sysuiStatusBarStateController import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.runCurrent @@ -58,7 +57,6 @@ import org.junit.Before import org.junit.Test import org.junit.runner.RunWith -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) @EnableSceneContainer diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/deviceentry/domain/interactor/DeviceEntrySourceInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/deviceentry/domain/interactor/DeviceEntrySourceInteractorTest.kt index b3c891dc9ac6..a5c0da52d86d 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/deviceentry/domain/interactor/DeviceEntrySourceInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/deviceentry/domain/interactor/DeviceEntrySourceInteractorTest.kt @@ -52,7 +52,6 @@ import com.android.systemui.statusbar.policy.DevicePostureController.DEVICE_POST import com.android.systemui.statusbar.policy.devicePostureController import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest @@ -62,7 +61,6 @@ import org.junit.runner.RunWith import org.mockito.ArgumentMatchers.anyBoolean import org.mockito.kotlin.whenever -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class DeviceEntrySourceInteractorTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/deviceentry/domain/interactor/DeviceEntryUdfpsInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/deviceentry/domain/interactor/DeviceEntryUdfpsInteractorTest.kt index d5839b502625..db594a553712 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/deviceentry/domain/interactor/DeviceEntryUdfpsInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/deviceentry/domain/interactor/DeviceEntryUdfpsInteractorTest.kt @@ -31,13 +31,11 @@ import com.android.systemui.keyguard.data.repository.fakeDeviceEntryFingerprintA 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.runTest import org.junit.Before import org.junit.Test import org.junit.runner.RunWith -@ExperimentalCoroutinesApi @SmallTest @RunWith(AndroidJUnit4::class) class DeviceEntryUdfpsInteractorTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/deviceentry/domain/interactor/DeviceUnlockedInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/deviceentry/domain/interactor/DeviceUnlockedInteractorTest.kt index 39baa01e07d6..1ce2bc9da7de 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/deviceentry/domain/interactor/DeviceUnlockedInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/deviceentry/domain/interactor/DeviceUnlockedInteractorTest.kt @@ -49,7 +49,6 @@ import com.android.systemui.user.data.repository.fakeUserRepository import com.android.systemui.user.domain.interactor.selectedUserInteractor import com.android.systemui.util.settings.fakeSettings import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.map import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.advanceTimeBy @@ -59,7 +58,6 @@ import org.junit.Before import org.junit.Test import org.junit.runner.RunWith -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class DeviceUnlockedInteractorTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/deviceentry/domain/interactor/OccludingAppDeviceEntryInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/deviceentry/domain/interactor/OccludingAppDeviceEntryInteractorTest.kt index a981e2083312..f14ab530017f 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/deviceentry/domain/interactor/OccludingAppDeviceEntryInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/deviceentry/domain/interactor/OccludingAppDeviceEntryInteractorTest.kt @@ -47,7 +47,6 @@ import com.android.systemui.testKosmos import com.android.systemui.util.mockito.any import com.android.systemui.util.mockito.whenever import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest @@ -61,7 +60,6 @@ import org.mockito.Mockito.never import org.mockito.Mockito.verify import org.mockito.kotlin.mock -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class OccludingAppDeviceEntryInteractorTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/deviceentry/domain/ui/binder/LiftToRunFaceAuthBinderTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/deviceentry/domain/ui/binder/LiftToRunFaceAuthBinderTest.kt index 11cade20bcb9..6b3136fa3991 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/deviceentry/domain/ui/binder/LiftToRunFaceAuthBinderTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/deviceentry/domain/ui/binder/LiftToRunFaceAuthBinderTest.kt @@ -35,7 +35,6 @@ import com.android.systemui.util.mockito.any import com.android.systemui.util.mockito.capture import com.android.systemui.util.mockito.whenever import com.android.systemui.util.sensors.asyncSensorManager -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Before @@ -49,7 +48,6 @@ import org.mockito.Mockito.never import org.mockito.Mockito.verify import org.mockito.MockitoAnnotations -@ExperimentalCoroutinesApi @SmallTest @RunWith(AndroidJUnit4::class) @TestableLooper.RunWithLooper(setAsMainLooper = true) diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/deviceentry/domain/ui/viewmodel/UdfpsAccessibilityOverlayViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/deviceentry/domain/ui/viewmodel/UdfpsAccessibilityOverlayViewModelTest.kt index 2d54337def13..90500839c8ad 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/deviceentry/domain/ui/viewmodel/UdfpsAccessibilityOverlayViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/deviceentry/domain/ui/viewmodel/UdfpsAccessibilityOverlayViewModelTest.kt @@ -41,7 +41,6 @@ import com.android.systemui.shade.shadeTestUtil import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat import kotlin.test.Test -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.After @@ -50,7 +49,6 @@ import org.junit.runner.RunWith import platform.test.runner.parameterized.ParameterizedAndroidJunit4 import platform.test.runner.parameterized.Parameters -@ExperimentalCoroutinesApi @SmallTest @RunWith(ParameterizedAndroidJunit4::class) class UdfpsAccessibilityOverlayViewModelTest(flags: FlagsParameterization) : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/display/data/repository/DeviceStateRepositoryTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/display/data/repository/DeviceStateRepositoryTest.kt index bec8a30320e7..64571841f019 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/display/data/repository/DeviceStateRepositoryTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/display/data/repository/DeviceStateRepositoryTest.kt @@ -40,7 +40,6 @@ import com.android.systemui.util.mockito.mock import com.android.systemui.util.time.FakeSystemClock import com.google.common.truth.Truth.assertThat import kotlin.test.Test -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.UnconfinedTestDispatcher import kotlinx.coroutines.test.runTest @@ -53,7 +52,6 @@ import android.hardware.devicestate.DeviceState as PlatformDeviceState @RunWith(AndroidJUnit4::class) @TestableLooper.RunWithLooper -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest class DeviceStateRepositoryTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/display/data/repository/DisplayMetricsRepositoryTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/display/data/repository/DisplayMetricsRepositoryTest.kt index d79db5cc32eb..c3759ca08e17 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/display/data/repository/DisplayMetricsRepositoryTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/display/data/repository/DisplayMetricsRepositoryTest.kt @@ -27,7 +27,6 @@ import com.android.systemui.statusbar.policy.FakeConfigurationController import com.android.systemui.util.mockito.mock import com.android.systemui.util.mockito.whenever import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.StandardTestDispatcher import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.runCurrent @@ -37,7 +36,6 @@ import org.junit.Test import org.junit.runner.RunWith @SmallTest -@OptIn(ExperimentalCoroutinesApi::class) @RunWith(AndroidJUnit4::class) class DisplayMetricsRepositoryTest : SysuiTestCase() { private lateinit var underTest: DisplayMetricsRepository diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/display/data/repository/DisplayRepositoryTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/display/data/repository/DisplayRepositoryTest.kt index c585d5c56a4e..dfea78458b9d 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/display/data/repository/DisplayRepositoryTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/display/data/repository/DisplayRepositoryTest.kt @@ -34,7 +34,6 @@ import com.android.systemui.util.mockito.mock import com.android.systemui.util.mockito.whenever import com.android.systemui.utils.os.FakeHandler import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.UnconfinedTestDispatcher import kotlinx.coroutines.test.runTest @@ -50,7 +49,6 @@ import org.mockito.kotlin.eq @RunWith(AndroidJUnit4::class) @TestableLooper.RunWithLooper -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest class DisplayRepositoryTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/display/domain/interactor/ConnectedDisplayInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/display/domain/interactor/ConnectedDisplayInteractorTest.kt index a2b50fd2ec17..92ea01ed298f 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/display/domain/interactor/ConnectedDisplayInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/display/domain/interactor/ConnectedDisplayInteractorTest.kt @@ -39,7 +39,6 @@ import com.android.systemui.keyguard.data.repository.FakeKeyguardRepository import com.android.systemui.util.mockito.mock import com.android.systemui.util.mockito.whenever 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 @@ -53,7 +52,6 @@ import org.mockito.Mockito.anyInt @RunWith(AndroidJUnit4::class) @TestableLooper.RunWithLooper -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest class ConnectedDisplayInteractorTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/dreams/DreamOverlayServiceTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/dreams/DreamOverlayServiceTest.kt index 0df584ff4dc1..526510a98e37 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/dreams/DreamOverlayServiceTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/dreams/DreamOverlayServiceTest.kt @@ -83,7 +83,6 @@ import com.android.systemui.touch.TouchInsetManager import com.android.systemui.util.concurrency.FakeExecutor import com.android.systemui.util.time.FakeSystemClock import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest @@ -107,7 +106,6 @@ import org.mockito.kotlin.whenever import platform.test.runner.parameterized.ParameterizedAndroidJunit4 import platform.test.runner.parameterized.Parameters -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @TestableLooper.RunWithLooper(setAsMainLooper = true) @RunWith(ParameterizedAndroidJunit4::class) diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/dreams/homecontrols/HomeControlsComponentInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/dreams/homecontrols/HomeControlsComponentInteractorTest.kt index c950523f7854..f347668aae77 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/dreams/homecontrols/HomeControlsComponentInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/dreams/homecontrols/HomeControlsComponentInteractorTest.kt @@ -39,7 +39,6 @@ import com.android.systemui.util.mockito.whenever import com.android.systemui.util.mockito.withArgCaptor import com.google.common.truth.Truth.assertThat import java.util.Optional -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest @@ -48,7 +47,6 @@ import org.junit.Test import org.junit.runner.RunWith import org.mockito.Mockito.verify -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class HomeControlsComponentInteractorTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/dreams/homecontrols/HomeControlsDreamServiceTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/dreams/homecontrols/HomeControlsDreamServiceTest.kt index 4317b9f27da6..e56bd0a4cc3b 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/dreams/homecontrols/HomeControlsDreamServiceTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/dreams/homecontrols/HomeControlsDreamServiceTest.kt @@ -40,7 +40,6 @@ import com.android.systemui.util.time.fakeSystemClock import com.android.systemui.util.wakelock.WakeLockFake import com.google.common.truth.Truth.assertThat import kotlinx.coroutines.Dispatchers -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.advanceUntilIdle import kotlinx.coroutines.test.resetMain import kotlinx.coroutines.test.runCurrent @@ -60,7 +59,6 @@ import org.mockito.kotlin.never import org.mockito.kotlin.times import org.mockito.kotlin.verify -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class HomeControlsDreamServiceTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/dreams/homecontrols/HomeControlsDreamStartableTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/dreams/homecontrols/HomeControlsDreamStartableTest.kt index ef02817eb4ac..0b6b97655b59 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/dreams/homecontrols/HomeControlsDreamStartableTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/dreams/homecontrols/HomeControlsDreamStartableTest.kt @@ -44,7 +44,6 @@ import com.android.systemui.settings.userTracker import com.android.systemui.testKosmos import com.android.systemui.user.data.repository.fakeUserRepository import java.util.Optional -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Before @@ -59,7 +58,6 @@ import org.mockito.kotlin.whenever import platform.test.runner.parameterized.ParameterizedAndroidJunit4 import platform.test.runner.parameterized.Parameters -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(ParameterizedAndroidJunit4::class) class HomeControlsDreamStartableTest(flags: FlagsParameterization) : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/dreams/homecontrols/service/HomeControlsRemoteProxyTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/dreams/homecontrols/service/HomeControlsRemoteProxyTest.kt index e57776f4db1b..38f1902d77c4 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/dreams/homecontrols/service/HomeControlsRemoteProxyTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/dreams/homecontrols/service/HomeControlsRemoteProxyTest.kt @@ -25,14 +25,12 @@ import com.android.systemui.dreams.homecontrols.shared.model.HomeControlsCompone 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.launch import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Test import org.junit.runner.RunWith -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class HomeControlsRemoteProxyTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/dreams/homecontrols/service/RemoteHomeControlsDataSourceDelegatorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/dreams/homecontrols/service/RemoteHomeControlsDataSourceDelegatorTest.kt index 400217503299..2b86f6ba84e0 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/dreams/homecontrols/service/RemoteHomeControlsDataSourceDelegatorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/dreams/homecontrols/service/RemoteHomeControlsDataSourceDelegatorTest.kt @@ -28,7 +28,6 @@ import com.android.systemui.testKosmos import com.android.systemui.util.service.ObservableServiceConnection import com.android.systemui.util.service.PersistentConnectionManager import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.launch import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest @@ -44,7 +43,6 @@ import org.mockito.kotlin.stub import org.mockito.kotlin.times import org.mockito.kotlin.verify -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class RemoteHomeControlsDataSourceDelegatorTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/dreams/homecontrols/system/HomeControlsRemoteServiceBinderTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/dreams/homecontrols/system/HomeControlsRemoteServiceBinderTest.kt index b343def58e29..a2ff5b410a9a 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/dreams/homecontrols/system/HomeControlsRemoteServiceBinderTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/dreams/homecontrols/system/HomeControlsRemoteServiceBinderTest.kt @@ -46,7 +46,6 @@ import com.android.systemui.user.data.repository.fakeUserRepository import com.android.systemui.util.mockito.withArgCaptor import com.google.common.truth.Truth.assertThat import java.util.Optional -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest @@ -56,7 +55,6 @@ import org.junit.runner.RunWith import org.mockito.Mockito import org.mockito.kotlin.whenever -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class HomeControlsRemoteServiceBinderTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/dreams/ui/viewmodel/DreamUserActionsViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/dreams/ui/viewmodel/DreamUserActionsViewModelTest.kt index e5670627735c..1c93b3c66e32 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/dreams/ui/viewmodel/DreamUserActionsViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/dreams/ui/viewmodel/DreamUserActionsViewModelTest.kt @@ -14,8 +14,6 @@ * limitations under the License. */ -@file:OptIn(ExperimentalCoroutinesApi::class) - package com.android.systemui.dreams.ui.viewmodel import androidx.test.ext.junit.runners.AndroidJUnit4 @@ -46,7 +44,6 @@ import com.android.systemui.shade.domain.interactor.enableSplitShade import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat import kotlin.test.Test -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/education/domain/ui/view/ContextualEduUiCoordinatorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/education/domain/ui/view/ContextualEduUiCoordinatorTest.kt index 248b922bcc77..6cb6fed978b8 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/education/domain/ui/view/ContextualEduUiCoordinatorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/education/domain/ui/view/ContextualEduUiCoordinatorTest.kt @@ -63,7 +63,6 @@ import platform.test.runner.parameterized.Parameters @SmallTest @RunWith(ParameterizedAndroidJunit4::class) -@OptIn(kotlinx.coroutines.ExperimentalCoroutinesApi::class) class ContextualEduUiCoordinatorTest(private val gestureType: GestureType) : SysuiTestCase() { private val kosmos = testKosmos() private val testScope = kosmos.testScope diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/flags/NotOccludedConditionTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/flags/NotOccludedConditionTest.kt index 46b4c4b80481..ae2c483d843e 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/flags/NotOccludedConditionTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/flags/NotOccludedConditionTest.kt @@ -22,7 +22,6 @@ import com.android.systemui.coroutines.collectLastValue import com.android.systemui.keyguard.domain.interactor.KeyguardTransitionInteractor import com.android.systemui.keyguard.shared.model.KeyguardState import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.test.StandardTestDispatcher import kotlinx.coroutines.test.TestDispatcher @@ -39,7 +38,6 @@ import org.mockito.MockitoAnnotations /** * Be careful with the {FeatureFlagsReleaseRestarter} in this test. It has a call to System.exit()! */ -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class NotOccludedConditionTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/globalactions/data/repository/GlobalActionsRepositoryTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/globalactions/data/repository/GlobalActionsRepositoryTest.kt index e437c10c7b73..e46bfb7040cc 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/globalactions/data/repository/GlobalActionsRepositoryTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/globalactions/data/repository/GlobalActionsRepositoryTest.kt @@ -23,14 +23,12 @@ import com.android.systemui.coroutines.collectLastValue 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.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Before import org.junit.Test import org.junit.runner.RunWith -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class GlobalActionsRepositoryTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/globalactions/domain/interactor/GlobalActionsInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/globalactions/domain/interactor/GlobalActionsInteractorTest.kt index 9275512009b2..afb9bd378707 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/globalactions/domain/interactor/GlobalActionsInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/globalactions/domain/interactor/GlobalActionsInteractorTest.kt @@ -23,14 +23,12 @@ import com.android.systemui.coroutines.collectLastValue 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.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Before import org.junit.Test import org.junit.runner.RunWith -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class GlobalActionsInteractorTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/haptics/msdl/qs/TileHapticsViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/haptics/msdl/qs/TileHapticsViewModelTest.kt index f6a6e5465e1b..891d6f960d4e 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/haptics/msdl/qs/TileHapticsViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/haptics/msdl/qs/TileHapticsViewModelTest.kt @@ -30,7 +30,6 @@ import com.android.systemui.qs.panels.ui.viewmodel.tileViewModel import com.android.systemui.testKosmos import com.google.android.msdl.data.model.MSDLToken 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 @@ -39,7 +38,6 @@ import org.junit.Test import org.junit.runner.RunWith @SmallTest -@OptIn(ExperimentalCoroutinesApi::class) @RunWith(AndroidJUnit4::class) class TileHapticsViewModelTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/haptics/slider/HapticSliderPluginTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/haptics/slider/HapticSliderPluginTest.kt index 088101054220..5030d1e49da0 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/haptics/slider/HapticSliderPluginTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/haptics/slider/HapticSliderPluginTest.kt @@ -28,7 +28,6 @@ import com.android.systemui.util.mockito.whenever import com.android.systemui.util.time.fakeSystemClock import com.google.common.truth.Truth.assertThat import kotlinx.coroutines.CoroutineScope -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.UnconfinedTestDispatcher import kotlinx.coroutines.test.advanceTimeBy @@ -44,7 +43,6 @@ import org.mockito.junit.MockitoRule @SmallTest @RunWith(AndroidJUnit4::class) -@OptIn(ExperimentalCoroutinesApi::class) class HapticSliderPluginTest : SysuiTestCase() { private val kosmos = Kosmos() diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/haptics/slider/SliderStateTrackerTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/haptics/slider/SliderStateTrackerTest.kt index 2e9d993c99a9..8060f7b5fe48 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/haptics/slider/SliderStateTrackerTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/haptics/slider/SliderStateTrackerTest.kt @@ -21,7 +21,6 @@ import androidx.test.filters.SmallTest import com.android.systemui.SysuiTestCase import com.google.common.truth.Truth.assertThat import kotlinx.coroutines.CoroutineScope -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.UnconfinedTestDispatcher import kotlinx.coroutines.test.advanceTimeBy import kotlinx.coroutines.test.runTest @@ -35,7 +34,6 @@ import org.mockito.Mockito.verifyNoMoreInteractions import org.mockito.MockitoAnnotations @SmallTest -@OptIn(ExperimentalCoroutinesApi::class) @RunWith(AndroidJUnit4::class) class SliderStateTrackerTest : SysuiTestCase() { @@ -102,7 +100,6 @@ class SliderStateTrackerTest : SysuiTestCase() { // Tests on the WAIT state - @OptIn(ExperimentalCoroutinesApi::class) @Test fun waitCompletes_onWait_movesToHandleAcquired() = runTest { val config = SeekableSliderTrackerConfig() @@ -716,7 +713,6 @@ class SliderStateTrackerTest : SysuiTestCase() { assertThat(mSliderStateTracker.currentState).isEqualTo(SliderState.IDLE) } - @OptIn(ExperimentalCoroutinesApi::class) private fun initTracker( scope: CoroutineScope, config: SeekableSliderTrackerConfig = SeekableSliderTrackerConfig(), diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/haptics/slider/compose/ui/SliderHapticsViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/haptics/slider/compose/ui/SliderHapticsViewModelTest.kt index 8693f6b1d927..895ef9cd74ae 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/haptics/slider/compose/ui/SliderHapticsViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/haptics/slider/compose/ui/SliderHapticsViewModelTest.kt @@ -30,7 +30,6 @@ import com.android.systemui.kosmos.testScope import com.android.systemui.lifecycle.activateIn import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.asStateFlow import kotlinx.coroutines.test.runCurrent @@ -39,7 +38,6 @@ import org.junit.Before import org.junit.Test import org.junit.runner.RunWith -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class SliderHapticsViewModelTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/inputdevice/data/repository/UserInputDeviceRepositoryTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/inputdevice/data/repository/UserInputDeviceRepositoryTest.kt index f2e43fcb8e2c..798c5ab817a5 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/inputdevice/data/repository/UserInputDeviceRepositoryTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/inputdevice/data/repository/UserInputDeviceRepositoryTest.kt @@ -38,7 +38,6 @@ import org.junit.runner.RunWith @SmallTest @RunWith(AndroidJUnit4::class) -@OptIn(kotlinx.coroutines.ExperimentalCoroutinesApi::class) class UserInputDeviceRepositoryTest : SysuiTestCase() { private lateinit var underTest: UserInputDeviceRepository diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/inputdevice/tutorial/domain/interactor/TutorialNotificationCoordinatorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/inputdevice/tutorial/domain/interactor/TutorialNotificationCoordinatorTest.kt index 886aa51360b0..e0082dadee26 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/inputdevice/tutorial/domain/interactor/TutorialNotificationCoordinatorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/inputdevice/tutorial/domain/interactor/TutorialNotificationCoordinatorTest.kt @@ -35,7 +35,6 @@ import com.android.systemui.testKosmos import com.android.systemui.touchpad.data.repository.FakeTouchpadRepository import com.google.common.truth.Truth.assertThat import kotlin.time.Duration.Companion.hours -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.advanceTimeBy import kotlinx.coroutines.test.runTest import org.junit.Before @@ -51,7 +50,6 @@ import org.mockito.kotlin.eq import org.mockito.kotlin.never import org.mockito.kotlin.verify -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class TutorialNotificationCoordinatorTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/inputdevice/tutorial/domain/interactor/TutorialSchedulerInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/inputdevice/tutorial/domain/interactor/TutorialSchedulerInteractorTest.kt index 722451e158e4..e87aca48392c 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/inputdevice/tutorial/domain/interactor/TutorialSchedulerInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/inputdevice/tutorial/domain/interactor/TutorialSchedulerInteractorTest.kt @@ -30,7 +30,6 @@ import com.android.systemui.testKosmos import com.android.systemui.touchpad.data.repository.FakeTouchpadRepository import com.google.common.truth.Truth.assertThat import kotlin.time.Duration.Companion.hours -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.first import kotlinx.coroutines.launch import kotlinx.coroutines.test.advanceTimeBy @@ -39,7 +38,6 @@ import org.junit.Before import org.junit.Test import org.junit.runner.RunWith -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class TutorialSchedulerInteractorTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/inputdevice/tutorial/ui/viewmodel/KeyboardTouchpadTutorialViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/inputdevice/tutorial/ui/viewmodel/KeyboardTouchpadTutorialViewModelTest.kt index 1de38ee3a04e..57bcc1407e24 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/inputdevice/tutorial/ui/viewmodel/KeyboardTouchpadTutorialViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/inputdevice/tutorial/ui/viewmodel/KeyboardTouchpadTutorialViewModelTest.kt @@ -44,7 +44,6 @@ import com.android.systemui.touchpad.tutorial.touchpadGesturesInteractor import com.android.systemui.util.coroutines.MainDispatcherRule import com.google.common.truth.Truth.assertThat import java.util.Optional -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.test.TestScope @@ -55,7 +54,6 @@ import org.junit.Test import org.junit.runner.RunWith import org.mockito.kotlin.mock -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class KeyboardTouchpadTutorialViewModelTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyboard/backlight/domain/interactor/KeyboardBacklightInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyboard/backlight/domain/interactor/KeyboardBacklightInteractorTest.kt index 64cd09128373..92d3dbaed616 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyboard/backlight/domain/interactor/KeyboardBacklightInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyboard/backlight/domain/interactor/KeyboardBacklightInteractorTest.kt @@ -24,14 +24,12 @@ import com.android.systemui.coroutines.collectLastValue import com.android.systemui.keyboard.data.repository.FakeKeyboardRepository import com.android.systemui.keyboard.shared.model.BacklightModel import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.first import kotlinx.coroutines.test.runTest import org.junit.Before import org.junit.Test import org.junit.runner.RunWith -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class KeyboardBacklightInteractorTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyboard/backlight/ui/KeyboardBacklightDialogCoordinatorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyboard/backlight/ui/KeyboardBacklightDialogCoordinatorTest.kt index 47261a935725..cd5e54b419c4 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyboard/backlight/ui/KeyboardBacklightDialogCoordinatorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyboard/backlight/ui/KeyboardBacklightDialogCoordinatorTest.kt @@ -29,7 +29,6 @@ import com.android.systemui.statusbar.policy.AccessibilityManagerWrapper import com.android.systemui.util.mockito.any import com.android.systemui.util.mockito.whenever import com.google.common.truth.Truth -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.StandardTestDispatcher import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.advanceTimeBy @@ -44,7 +43,6 @@ import org.mockito.Mockito.times import org.mockito.Mockito.verify import org.mockito.MockitoAnnotations -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class KeyboardBacklightDialogCoordinatorTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyboard/data/repository/KeyboardRepositoryTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyboard/data/repository/KeyboardRepositoryTest.kt index 8b1341114c68..4976fce5e992 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyboard/data/repository/KeyboardRepositoryTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyboard/data/repository/KeyboardRepositoryTest.kt @@ -36,7 +36,6 @@ import com.android.systemui.testKosmos import com.android.systemui.utils.os.FakeHandler import com.google.common.truth.Truth.assertThat import kotlinx.coroutines.CoroutineDispatcher -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.first import kotlinx.coroutines.test.StandardTestDispatcher @@ -54,7 +53,6 @@ import org.mockito.MockitoAnnotations import org.mockito.kotlin.any import org.mockito.kotlin.anyOrNull -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @TestableLooper.RunWithLooper @RunWith(AndroidJUnit4::class) diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyboard/shortcut/ShortcutHelperCoreStartableTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyboard/shortcut/ShortcutHelperCoreStartableTest.kt index b417616425c4..25b5972aff45 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyboard/shortcut/ShortcutHelperCoreStartableTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyboard/shortcut/ShortcutHelperCoreStartableTest.kt @@ -26,7 +26,6 @@ import com.android.systemui.plugins.ActivityStarter import com.android.systemui.plugins.activityStarter import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runTest import org.junit.Test import org.junit.runner.RunWith @@ -37,7 +36,6 @@ import org.mockito.kotlin.whenever @SmallTest @RunWith(AndroidJUnit4::class) -@OptIn(ExperimentalCoroutinesApi::class) class ShortcutHelperCoreStartableTest : SysuiTestCase() { private val kosmos = testKosmos() private val repo = kosmos.shortcutHelperStateRepository diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyboard/shortcut/data/repository/DefaultShortcutCategoriesRepositoryTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyboard/shortcut/data/repository/DefaultShortcutCategoriesRepositoryTest.kt index cd05980385e0..e5991e89d198 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyboard/shortcut/data/repository/DefaultShortcutCategoriesRepositoryTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyboard/shortcut/data/repository/DefaultShortcutCategoriesRepositoryTest.kt @@ -62,7 +62,6 @@ import com.android.systemui.kosmos.testScope import com.android.systemui.res.R import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.UnconfinedTestDispatcher import kotlinx.coroutines.test.runTest import org.junit.Before @@ -72,7 +71,6 @@ import org.mockito.ArgumentMatchers.anyInt import org.mockito.Mockito.mock import org.mockito.kotlin.whenever -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class DefaultShortcutCategoriesRepositoryTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyboard/shortcut/domain/interactor/ShortcutHelperCategoriesInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyboard/shortcut/domain/interactor/ShortcutHelperCategoriesInteractorTest.kt index 61490986f4a9..800886b2a845 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyboard/shortcut/domain/interactor/ShortcutHelperCategoriesInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyboard/shortcut/domain/interactor/ShortcutHelperCategoriesInteractorTest.kt @@ -51,7 +51,6 @@ import com.android.systemui.settings.FakeUserTracker import com.android.systemui.settings.userTracker import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.UnconfinedTestDispatcher import kotlinx.coroutines.test.runTest import org.junit.Before @@ -69,7 +68,6 @@ class ShortcutHelperCategoriesInteractorTest : SysuiTestCase() { private val systemShortcutsSource = FakeKeyboardShortcutGroupsSource() private val multitaskingShortcutsSource = FakeKeyboardShortcutGroupsSource() - @OptIn(ExperimentalCoroutinesApi::class) private val kosmos = testKosmos().also { it.testDispatcher = UnconfinedTestDispatcher() diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyboard/shortcut/ui/ShortcutHelperDialogStarterTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyboard/shortcut/ui/ShortcutHelperDialogStarterTest.kt index 7a343351ef64..1bb4805d4f16 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyboard/shortcut/ui/ShortcutHelperDialogStarterTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyboard/shortcut/ui/ShortcutHelperDialogStarterTest.kt @@ -44,7 +44,6 @@ import com.android.systemui.settings.FakeUserTracker import com.android.systemui.settings.userTracker import com.android.systemui.statusbar.phone.systemUIDialogFactory import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.UnconfinedTestDispatcher import kotlinx.coroutines.test.runTest import org.junit.Before @@ -53,7 +52,6 @@ import org.junit.runner.RunWith import org.mockito.kotlin.mock import org.mockito.kotlin.whenever -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class ShortcutHelperDialogStarterTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyboard/shortcut/ui/viewmodel/ShortcutHelperViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyboard/shortcut/ui/viewmodel/ShortcutHelperViewModelTest.kt index cf38072912e9..766744885077 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyboard/shortcut/ui/viewmodel/ShortcutHelperViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyboard/shortcut/ui/viewmodel/ShortcutHelperViewModelTest.kt @@ -66,7 +66,6 @@ import com.android.systemui.settings.userTracker import com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_SHORTCUT_HELPER_SHOWING import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.UnconfinedTestDispatcher import kotlinx.coroutines.test.runTest import org.junit.Before @@ -77,7 +76,6 @@ import org.mockito.kotlin.eq import org.mockito.kotlin.mock import org.mockito.kotlin.whenever -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class ShortcutHelperViewModelTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyboard/stickykeys/ui/StickyKeysIndicatorCoordinatorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyboard/stickykeys/ui/StickyKeysIndicatorCoordinatorTest.kt index 727481e0637d..be9e93c64053 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyboard/stickykeys/ui/StickyKeysIndicatorCoordinatorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyboard/stickykeys/ui/StickyKeysIndicatorCoordinatorTest.kt @@ -30,7 +30,6 @@ import com.android.systemui.kosmos.Kosmos import com.android.systemui.util.mockito.any import com.android.systemui.util.mockito.mock import com.android.systemui.util.mockito.whenever -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.StandardTestDispatcher import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.runCurrent @@ -40,7 +39,6 @@ import org.junit.runner.RunWith import org.mockito.Mockito.verify import org.mockito.Mockito.verifyNoMoreInteractions -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class StickyKeysIndicatorCoordinatorTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyboard/stickykeys/ui/viewmodel/StickyKeysIndicatorViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyboard/stickykeys/ui/viewmodel/StickyKeysIndicatorViewModelTest.kt index 7ec53dfbdd10..9daf0ffd34b4 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyboard/stickykeys/ui/viewmodel/StickyKeysIndicatorViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyboard/stickykeys/ui/viewmodel/StickyKeysIndicatorViewModelTest.kt @@ -43,7 +43,6 @@ import com.android.systemui.util.mockito.mock import com.android.systemui.util.settings.data.repository.userAwareSecureSettingsRepository import com.android.systemui.util.settings.fakeSettings 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 @@ -54,7 +53,6 @@ import org.mockito.ArgumentCaptor import org.mockito.Mockito.verify import org.mockito.Mockito.verifyNoMoreInteractions -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class StickyKeysIndicatorViewModelTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ResourceTrimmerTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ResourceTrimmerTest.kt index 6b49d3a095d8..32a631b191bf 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ResourceTrimmerTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ResourceTrimmerTest.kt @@ -21,7 +21,6 @@ import com.android.systemui.scene.data.repository.setSceneTransition import com.android.systemui.scene.shared.model.Scenes import com.android.systemui.testKosmos import com.android.systemui.utils.GlobalWindowManager -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Before @@ -34,7 +33,6 @@ import org.mockito.Mockito.verify import org.mockito.Mockito.verifyNoMoreInteractions import org.mockito.MockitoAnnotations -@OptIn(ExperimentalCoroutinesApi::class) @RunWith(AndroidJUnit4::class) @SmallTest class ResourceTrimmerTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/quickaffordance/CameraQuickAffordanceConfigTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/quickaffordance/CameraQuickAffordanceConfigTest.kt index 56e8185ab580..577f2222238c 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/quickaffordance/CameraQuickAffordanceConfigTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/quickaffordance/CameraQuickAffordanceConfigTest.kt @@ -28,7 +28,6 @@ import com.android.systemui.camera.CameraGestureHelper import com.android.systemui.settings.UserTracker import com.android.systemui.util.mockito.whenever import com.google.common.truth.Truth -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.StandardTestDispatcher import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.runTest @@ -40,7 +39,6 @@ import org.mockito.Mock import org.mockito.Mockito.verify import org.mockito.MockitoAnnotations -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) @android.platform.test.annotations.EnabledOnRavenwood diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/quickaffordance/DoNotDisturbQuickAffordanceConfigTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/quickaffordance/DoNotDisturbQuickAffordanceConfigTest.kt index 451ebf32c367..e999c16ada34 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/quickaffordance/DoNotDisturbQuickAffordanceConfigTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/quickaffordance/DoNotDisturbQuickAffordanceConfigTest.kt @@ -52,7 +52,6 @@ import com.android.systemui.util.mockito.whenever import com.android.systemui.util.settings.fakeSettings import com.google.common.truth.Truth.assertThat import java.time.Duration -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Assert.assertEquals @@ -67,7 +66,6 @@ import org.mockito.Mock import org.mockito.Mockito.verify import org.mockito.MockitoAnnotations -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class DoNotDisturbQuickAffordanceConfigTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/quickaffordance/FlashlightQuickAffordanceConfigTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/quickaffordance/FlashlightQuickAffordanceConfigTest.kt index 77e0f4ef2c5f..11590493fce2 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/quickaffordance/FlashlightQuickAffordanceConfigTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/quickaffordance/FlashlightQuickAffordanceConfigTest.kt @@ -26,7 +26,6 @@ import com.android.systemui.keyguard.shared.quickaffordance.ActivationState import com.android.systemui.statusbar.policy.FlashlightController import com.android.systemui.utils.leaks.FakeFlashlightController import com.android.systemui.utils.leaks.LeakCheckedTest -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.toList import kotlinx.coroutines.launch import kotlinx.coroutines.test.UnconfinedTestDispatcher @@ -39,7 +38,6 @@ import org.junit.runner.RunWith import org.mockito.Mock import org.mockito.MockitoAnnotations -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) @android.platform.test.annotations.EnabledOnRavenwood diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/quickaffordance/KeyguardQuickAffordanceHapticViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/quickaffordance/KeyguardQuickAffordanceHapticViewModelTest.kt index 18946f9d7e07..11401af7bec6 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/quickaffordance/KeyguardQuickAffordanceHapticViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/quickaffordance/KeyguardQuickAffordanceHapticViewModelTest.kt @@ -28,7 +28,6 @@ import com.android.systemui.kosmos.testScope import com.android.systemui.shared.keyguard.shared.model.KeyguardQuickAffordanceSlots import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.runCurrent @@ -37,7 +36,6 @@ import org.junit.Test import org.junit.runner.RunWith @SmallTest -@OptIn(ExperimentalCoroutinesApi::class) @RunWith(AndroidJUnit4::class) class KeyguardQuickAffordanceHapticViewModelTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/quickaffordance/KeyguardQuickAffordanceLegacySettingSyncerTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/quickaffordance/KeyguardQuickAffordanceLegacySettingSyncerTest.kt index 4a422f05a45a..c787a8b0dcdf 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/quickaffordance/KeyguardQuickAffordanceLegacySettingSyncerTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/quickaffordance/KeyguardQuickAffordanceLegacySettingSyncerTest.kt @@ -36,7 +36,6 @@ import com.android.systemui.util.mockito.mock import com.android.systemui.util.mockito.whenever import com.android.systemui.util.settings.fakeSettings import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.advanceUntilIdle import kotlinx.coroutines.test.runTest import org.junit.Before @@ -47,7 +46,6 @@ import org.mockito.ArgumentMatchers.anyString import org.mockito.Mock import org.mockito.MockitoAnnotations -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class KeyguardQuickAffordanceLegacySettingSyncerTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/quickaffordance/KeyguardQuickAffordanceLocalUserSelectionManagerTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/quickaffordance/KeyguardQuickAffordanceLocalUserSelectionManagerTest.kt index 15f12d7de603..d93b77bac9b9 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/quickaffordance/KeyguardQuickAffordanceLocalUserSelectionManagerTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/quickaffordance/KeyguardQuickAffordanceLocalUserSelectionManagerTest.kt @@ -31,7 +31,6 @@ import com.android.systemui.util.FakeSharedPreferences import com.android.systemui.util.mockito.whenever import com.google.common.truth.Truth.assertThat import kotlinx.coroutines.Dispatchers -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.toList import kotlinx.coroutines.launch import kotlinx.coroutines.test.UnconfinedTestDispatcher @@ -50,7 +49,6 @@ import org.mockito.Mockito.clearInvocations import org.mockito.Mockito.verify import org.mockito.MockitoAnnotations -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class KeyguardQuickAffordanceLocalUserSelectionManagerTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/quickaffordance/KeyguardQuickAffordanceRemoteUserSelectionManagerTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/quickaffordance/KeyguardQuickAffordanceRemoteUserSelectionManagerTest.kt index a1c9f87ee7bc..2e7131021d0a 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/quickaffordance/KeyguardQuickAffordanceRemoteUserSelectionManagerTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/quickaffordance/KeyguardQuickAffordanceRemoteUserSelectionManagerTest.kt @@ -27,7 +27,6 @@ import com.android.systemui.shared.customization.data.content.FakeCustomizationP import com.android.systemui.shared.keyguard.shared.model.KeyguardQuickAffordanceSlots import com.android.systemui.util.mockito.whenever import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.toList import kotlinx.coroutines.launch import kotlinx.coroutines.test.StandardTestDispatcher @@ -41,7 +40,6 @@ import org.junit.runner.RunWith import org.mockito.Mock import org.mockito.MockitoAnnotations -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class KeyguardQuickAffordanceRemoteUserSelectionManagerTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/quickaffordance/MuteQuickAffordanceConfigTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/quickaffordance/MuteQuickAffordanceConfigTest.kt index 173b4e56075c..115055d97029 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/quickaffordance/MuteQuickAffordanceConfigTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/quickaffordance/MuteQuickAffordanceConfigTest.kt @@ -28,7 +28,6 @@ import com.android.systemui.util.RingerModeTracker import com.android.systemui.util.mockito.any import com.android.systemui.util.mockito.argumentCaptor import com.android.systemui.util.mockito.whenever -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.StandardTestDispatcher import kotlinx.coroutines.test.TestDispatcher import kotlinx.coroutines.test.TestScope @@ -43,7 +42,6 @@ import org.mockito.Mockito.times import org.mockito.Mockito.verify import org.mockito.MockitoAnnotations -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class MuteQuickAffordanceConfigTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/quickaffordance/MuteQuickAffordanceCoreStartableTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/quickaffordance/MuteQuickAffordanceCoreStartableTest.kt index 42b3463c052e..3e67b89f7b36 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/quickaffordance/MuteQuickAffordanceCoreStartableTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/quickaffordance/MuteQuickAffordanceCoreStartableTest.kt @@ -33,7 +33,6 @@ import com.android.systemui.util.mockito.argumentCaptor import com.android.systemui.util.mockito.eq import com.android.systemui.util.mockito.mock import com.android.systemui.util.mockito.whenever -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.cancelChildren import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.test.StandardTestDispatcher @@ -51,7 +50,6 @@ import org.mockito.Mockito.verify import org.mockito.Mockito.verifyNoMoreInteractions import org.mockito.MockitoAnnotations -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class MuteQuickAffordanceCoreStartableTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/quickaffordance/VideoCameraQuickAffordanceConfigTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/quickaffordance/VideoCameraQuickAffordanceConfigTest.kt index a9b9c9011636..ee5188e224b0 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/quickaffordance/VideoCameraQuickAffordanceConfigTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/quickaffordance/VideoCameraQuickAffordanceConfigTest.kt @@ -30,7 +30,6 @@ import com.android.systemui.util.mockito.any import com.android.systemui.util.mockito.mock import com.android.systemui.util.mockito.whenever import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.StandardTestDispatcher import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.runTest @@ -42,7 +41,6 @@ import org.mockito.ArgumentMatchers.anyInt import org.mockito.Mock import org.mockito.MockitoAnnotations -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class VideoCameraQuickAffordanceConfigTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/repository/BiometricSettingsRepositoryTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/repository/BiometricSettingsRepositoryTest.kt index 49d324b27bb1..8e484cc8ad37 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/repository/BiometricSettingsRepositoryTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/repository/BiometricSettingsRepositoryTest.kt @@ -59,7 +59,6 @@ import com.android.systemui.user.data.repository.FakeUserRepository import com.android.systemui.util.mockito.eq import com.android.systemui.util.mockito.whenever import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.StandardTestDispatcher import kotlinx.coroutines.test.TestDispatcher import kotlinx.coroutines.test.TestScope @@ -83,7 +82,6 @@ import org.mockito.kotlin.doAnswer import org.mockito.kotlin.doReturn import org.mockito.kotlin.stub -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @TestableLooper.RunWithLooper(setAsMainLooper = true) @RunWith(AndroidJUnit4::class) diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/repository/DeviceEntryFingerprintAuthRepositoryTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/repository/DeviceEntryFingerprintAuthRepositoryTest.kt index 9bcc19defbd5..f3f9fa785c75 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/repository/DeviceEntryFingerprintAuthRepositoryTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/repository/DeviceEntryFingerprintAuthRepositoryTest.kt @@ -32,7 +32,6 @@ import com.android.systemui.keyguard.shared.model.HelpFingerprintAuthenticationS import com.android.systemui.keyguard.shared.model.SuccessFingerprintAuthenticationStatus import com.android.systemui.util.mockito.whenever import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.filterIsInstance import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.UnconfinedTestDispatcher @@ -48,7 +47,6 @@ import org.mockito.Mockito.atLeastOnce import org.mockito.Mockito.verify import org.mockito.MockitoAnnotations -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) @android.platform.test.annotations.EnabledOnRavenwood diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/repository/DevicePostureRepositoryTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/repository/DevicePostureRepositoryTest.kt index a0b85423b9f2..f40555f8301d 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/repository/DevicePostureRepositoryTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/repository/DevicePostureRepositoryTest.kt @@ -24,7 +24,6 @@ import com.android.systemui.keyguard.shared.model.DevicePosture import com.android.systemui.statusbar.policy.DevicePostureController import com.android.systemui.util.mockito.whenever import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.UnconfinedTestDispatcher import kotlinx.coroutines.test.runTest @@ -37,7 +36,6 @@ import org.mockito.Mock import org.mockito.Mockito.verify import org.mockito.MockitoAnnotations -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) @android.platform.test.annotations.EnabledOnRavenwood diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/repository/KeyEventRepositoryTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/repository/KeyEventRepositoryTest.kt index bbe45c1b3cd9..c7f1525e2946 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/repository/KeyEventRepositoryTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/repository/KeyEventRepositoryTest.kt @@ -25,7 +25,6 @@ import com.android.systemui.coroutines.collectLastValue import com.android.systemui.keyevent.data.repository.KeyEventRepositoryImpl import com.android.systemui.statusbar.CommandQueue 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 @@ -39,7 +38,6 @@ import org.mockito.Mockito.times import org.mockito.Mockito.verify import org.mockito.MockitoAnnotations -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class KeyEventRepositoryTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/repository/KeyguardBlueprintRepositoryTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/repository/KeyguardBlueprintRepositoryTest.kt index 972ca02548ec..13d09e8a1162 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/repository/KeyguardBlueprintRepositoryTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/repository/KeyguardBlueprintRepositoryTest.kt @@ -15,8 +15,6 @@ * */ -@file:OptIn(ExperimentalCoroutinesApi::class) - package com.android.systemui.keyguard.data.repository import androidx.test.ext.junit.runners.AndroidJUnit4 @@ -31,7 +29,6 @@ import com.android.systemui.kosmos.testScope import com.android.systemui.testKosmos import com.android.systemui.util.ThreadAssert import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.StandardTestDispatcher import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.runTest diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/repository/KeyguardQuickAffordanceRepositoryTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/repository/KeyguardQuickAffordanceRepositoryTest.kt index 8e458a2a9525..b0e07bef0763 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/repository/KeyguardQuickAffordanceRepositoryTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/repository/KeyguardQuickAffordanceRepositoryTest.kt @@ -45,7 +45,6 @@ import com.android.systemui.util.mockito.whenever import com.android.systemui.util.settings.fakeSettings import com.google.common.truth.Truth.assertThat import java.util.Locale -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runTest import org.junit.After import org.junit.Before @@ -54,7 +53,6 @@ import org.junit.runner.RunWith import org.mockito.ArgumentMatchers.anyInt import org.mockito.ArgumentMatchers.anyString -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class KeyguardQuickAffordanceRepositoryTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/repository/KeyguardRepositoryImplTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/repository/KeyguardRepositoryImplTest.kt index 6805a133459f..ec7031aec3d9 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/repository/KeyguardRepositoryImplTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/repository/KeyguardRepositoryImplTest.kt @@ -45,7 +45,6 @@ import com.android.systemui.util.mockito.whenever import com.android.systemui.util.mockito.withArgCaptor import com.android.systemui.util.time.FakeSystemClock 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.StandardTestDispatcher @@ -62,7 +61,6 @@ import org.mockito.Mockito.atLeastOnce import org.mockito.Mockito.verify import org.mockito.MockitoAnnotations -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) @android.platform.test.annotations.EnabledOnRavenwood diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/repository/KeyguardSurfaceBehindRepositoryImplTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/repository/KeyguardSurfaceBehindRepositoryImplTest.kt index bed959f1a3f0..368bf9ee2a72 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/repository/KeyguardSurfaceBehindRepositoryImplTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/repository/KeyguardSurfaceBehindRepositoryImplTest.kt @@ -21,7 +21,6 @@ import androidx.test.filters.SmallTest import com.android.systemui.SysuiTestCase import com.android.systemui.coroutines.collectValues 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 @@ -29,7 +28,6 @@ import org.junit.Before import org.junit.Test import org.junit.runner.RunWith -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class KeyguardSurfaceBehindRepositoryImplTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/repository/LightRevealScrimRepositoryTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/repository/LightRevealScrimRepositoryTest.kt index 0bfcd548881b..3a8603d747bf 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/repository/LightRevealScrimRepositoryTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/repository/LightRevealScrimRepositoryTest.kt @@ -36,7 +36,6 @@ import com.android.systemui.testKosmos import com.android.systemui.util.mockito.mock import junit.framework.Assert.assertEquals import junit.framework.Assert.assertFalse -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.launch import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest @@ -47,7 +46,6 @@ import org.junit.runner.RunWith import org.mockito.MockitoAnnotations @SmallTest -@OptIn(ExperimentalCoroutinesApi::class) @RunWith(AndroidJUnit4::class) class LightRevealScrimRepositoryTest : SysuiTestCase() { private val kosmos = testKosmos() diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/repository/TrustRepositoryTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/repository/TrustRepositoryTest.kt index 2d121502650e..8a1afe4c2c6b 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/repository/TrustRepositoryTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/repository/TrustRepositoryTest.kt @@ -29,7 +29,6 @@ import com.android.systemui.log.LogcatEchoTracker import com.android.systemui.user.data.repository.FakeUserRepository import com.android.systemui.util.mockito.whenever import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.StandardTestDispatcher import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.runCurrent @@ -44,7 +43,6 @@ import org.mockito.Mockito.mock import org.mockito.Mockito.verify import org.mockito.MockitoAnnotations -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) @android.platform.test.annotations.EnabledOnRavenwood diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/BurnInInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/BurnInInteractorTest.kt index 0bd541c7a704..3dd2ecd2469f 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/BurnInInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/BurnInInteractorTest.kt @@ -32,7 +32,6 @@ import com.android.systemui.res.R import com.android.systemui.testKosmos import com.android.systemui.util.mockito.whenever import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runTest import org.junit.Before import org.junit.Test @@ -42,7 +41,6 @@ import org.mockito.ArgumentMatchers.anyInt import org.mockito.Mock import org.mockito.MockitoAnnotations -@ExperimentalCoroutinesApi @SmallTest @RunWith(AndroidJUnit4::class) class BurnInInteractorTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/DeviceEntrySideFpsOverlayInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/DeviceEntrySideFpsOverlayInteractorTest.kt index b5ea305544ff..425079d7b5d7 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/DeviceEntrySideFpsOverlayInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/DeviceEntrySideFpsOverlayInteractorTest.kt @@ -48,7 +48,6 @@ import com.android.systemui.user.domain.interactor.SelectedUserInteractor import com.android.systemui.util.mockito.whenever import com.android.systemui.util.time.FakeSystemClock 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 @@ -61,7 +60,6 @@ import org.mockito.Mockito.mock import org.mockito.junit.MockitoJUnit import org.mockito.junit.MockitoRule -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class DeviceEntrySideFpsOverlayInteractorTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/FromAlternateBouncerTransitionInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/FromAlternateBouncerTransitionInteractorTest.kt index 047d8c2b31a9..2feabf8221ad 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/FromAlternateBouncerTransitionInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/FromAlternateBouncerTransitionInteractorTest.kt @@ -51,7 +51,6 @@ 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.testKosmos -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.advanceTimeBy import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest @@ -60,7 +59,6 @@ import org.junit.Test import org.junit.runner.RunWith import org.mockito.Mockito.reset -@ExperimentalCoroutinesApi @SmallTest @RunWith(AndroidJUnit4::class) class FromAlternateBouncerTransitionInteractorTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/FromAodTransitionInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/FromAodTransitionInteractorTest.kt index 3f2e78cdfb52..208abf39611d 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/FromAodTransitionInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/FromAodTransitionInteractorTest.kt @@ -63,7 +63,6 @@ import com.android.systemui.scene.shared.model.Scenes import com.android.systemui.statusbar.domain.interactor.keyguardOcclusionInteractor import com.android.systemui.testKosmos import junit.framework.Assert.assertEquals -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.runBlocking import kotlinx.coroutines.test.advanceTimeBy import kotlinx.coroutines.test.runCurrent @@ -73,7 +72,6 @@ import org.junit.Test import org.junit.runner.RunWith import org.mockito.Mockito.reset -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class FromAodTransitionInteractorTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/FromDozingTransitionInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/FromDozingTransitionInteractorTest.kt index df44425d4b49..c7f9edff6060 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/FromDozingTransitionInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/FromDozingTransitionInteractorTest.kt @@ -55,7 +55,6 @@ import com.android.systemui.scene.shared.model.Scenes import com.android.systemui.testKosmos import com.google.common.truth.Truth import junit.framework.Assert.assertEquals -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.runBlocking import kotlinx.coroutines.test.advanceTimeBy @@ -73,7 +72,6 @@ import org.mockito.kotlin.whenever import platform.test.runner.parameterized.ParameterizedAndroidJunit4 import platform.test.runner.parameterized.Parameters -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(ParameterizedAndroidJunit4::class) @EnableFlags(FLAG_COMMUNAL_HUB) diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/FromDreamingTransitionInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/FromDreamingTransitionInteractorTest.kt index e9e3e1b37776..dcfa298e99ff 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/FromDreamingTransitionInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/FromDreamingTransitionInteractorTest.kt @@ -44,7 +44,6 @@ import com.android.systemui.power.domain.interactor.powerInteractor import com.android.systemui.statusbar.domain.interactor.keyguardOcclusionInteractor import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.runBlocking import kotlinx.coroutines.test.advanceTimeBy import kotlinx.coroutines.test.runCurrent @@ -59,7 +58,6 @@ import org.mockito.kotlin.whenever import platform.test.runner.parameterized.ParameterizedAndroidJunit4 import platform.test.runner.parameterized.Parameters -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(ParameterizedAndroidJunit4::class) class FromDreamingTransitionInteractorTest(flags: FlagsParameterization?) : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/FromLockscreenTransitionInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/FromLockscreenTransitionInteractorTest.kt index 9e8713be3f5e..63960abcfd23 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/FromLockscreenTransitionInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/FromLockscreenTransitionInteractorTest.kt @@ -40,7 +40,6 @@ import com.android.systemui.shade.data.repository.FlingInfo import com.android.systemui.shade.data.repository.fakeShadeRepository import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Before @@ -49,7 +48,6 @@ import org.junit.runner.RunWith import org.mockito.Mockito.reset import org.mockito.Mockito.spy -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class FromLockscreenTransitionInteractorTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/FromOccludedTransitionInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/FromOccludedTransitionInteractorTest.kt index 4a90722274bd..63ed0402b633 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/FromOccludedTransitionInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/FromOccludedTransitionInteractorTest.kt @@ -51,7 +51,6 @@ import com.android.systemui.kosmos.testScope import com.android.systemui.power.domain.interactor.PowerInteractor.Companion.setAwakeForTest import com.android.systemui.power.domain.interactor.powerInteractor import com.android.systemui.testKosmos -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.runBlocking import kotlinx.coroutines.test.runCurrent @@ -61,7 +60,6 @@ import org.junit.Test import org.junit.runner.RunWith import org.mockito.Mockito.reset -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class FromOccludedTransitionInteractorTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/FromPrimaryBouncerTransitionInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/FromPrimaryBouncerTransitionInteractorTest.kt index a7da23065dec..63bb1001c873 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/FromPrimaryBouncerTransitionInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/FromPrimaryBouncerTransitionInteractorTest.kt @@ -37,7 +37,6 @@ import com.android.systemui.kosmos.testScope import com.android.systemui.testKosmos import com.android.systemui.user.domain.interactor.selectedUserInteractor import junit.framework.Assert.assertEquals -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest @@ -45,7 +44,6 @@ import org.junit.Test import org.junit.runner.RunWith import org.mockito.Mockito.reset -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class FromPrimaryBouncerTransitionInteractorTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/InWindowLauncherUnlockAnimationInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/InWindowLauncherUnlockAnimationInteractorTest.kt index ea5a41f6fd5c..6241865ed9b9 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/InWindowLauncherUnlockAnimationInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/InWindowLauncherUnlockAnimationInteractorTest.kt @@ -44,7 +44,6 @@ import org.mockito.MockitoAnnotations @SmallTest @RunWith(AndroidJUnit4::class) -@kotlinx.coroutines.ExperimentalCoroutinesApi class InWindowLauncherUnlockAnimationInteractorTest : SysuiTestCase() { private val kosmos = testKosmos() private val underTest = diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/KeyguardBlueprintInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/KeyguardBlueprintInteractorTest.kt index 84b7f5c28265..3acb9c68d4bb 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/KeyguardBlueprintInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/KeyguardBlueprintInteractorTest.kt @@ -39,7 +39,6 @@ import com.android.systemui.testKosmos import com.android.systemui.util.mockito.any import com.android.systemui.util.mockito.whenever import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.advanceUntilIdle import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest @@ -52,7 +51,6 @@ import org.mockito.Mockito.times import org.mockito.Mockito.verify import org.mockito.MockitoAnnotations -@ExperimentalCoroutinesApi @SmallTest @RunWith(AndroidJUnit4::class) class KeyguardBlueprintInteractorTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/KeyguardDismissActionInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/KeyguardDismissActionInteractorTest.kt index dadcf71a4723..c63f6f65c631 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/KeyguardDismissActionInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/KeyguardDismissActionInteractorTest.kt @@ -45,7 +45,6 @@ import com.android.systemui.scene.domain.interactor.sceneInteractor import com.android.systemui.scene.shared.model.Scenes import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.test.TestScope @@ -56,7 +55,6 @@ import org.junit.Test import org.junit.runner.RunWith import org.mockito.MockitoAnnotations -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @EnableSceneContainer @RunWith(AndroidJUnit4::class) diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/KeyguardDismissInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/KeyguardDismissInteractorTest.kt index fabed03bc18c..4eb5ea086870 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/KeyguardDismissInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/KeyguardDismissInteractorTest.kt @@ -34,7 +34,6 @@ import com.android.systemui.power.data.repository.fakePowerRepository import com.android.systemui.testKosmos import com.android.systemui.user.data.repository.fakeUserRepository import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.StandardTestDispatcher import kotlinx.coroutines.test.TestDispatcher import kotlinx.coroutines.test.TestScope @@ -45,7 +44,6 @@ import org.junit.Test import org.junit.runner.RunWith import org.mockito.MockitoAnnotations -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class KeyguardDismissInteractorTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/KeyguardInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/KeyguardInteractorTest.kt index c44f27ef348b..0718d0d32812 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/KeyguardInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/KeyguardInteractorTest.kt @@ -52,7 +52,6 @@ import com.android.systemui.scene.shared.model.Scenes import com.android.systemui.shade.data.repository.shadeRepository import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.test.advanceTimeBy @@ -62,7 +61,6 @@ import org.junit.Before import org.junit.Test import org.junit.runner.RunWith -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class KeyguardInteractorTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/KeyguardKeyEventInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/KeyguardKeyEventInteractorTest.kt index fbdab7d40c9b..6704d63395ad 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/KeyguardKeyEventInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/KeyguardKeyEventInteractorTest.kt @@ -36,7 +36,6 @@ import com.android.systemui.testKosmos import com.android.systemui.util.mockito.any import com.android.systemui.util.mockito.whenever import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import org.junit.Before import org.junit.Rule import org.junit.Test @@ -49,7 +48,6 @@ import org.mockito.Mockito.verify import org.mockito.junit.MockitoJUnit import org.mockito.kotlin.isNull -@ExperimentalCoroutinesApi @SmallTest @RunWith(AndroidJUnit4::class) class KeyguardKeyEventInteractorTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/KeyguardLockWhileAwakeInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/KeyguardLockWhileAwakeInteractorTest.kt index bef995fa5225..3eacc28c0bd0 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/KeyguardLockWhileAwakeInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/KeyguardLockWhileAwakeInteractorTest.kt @@ -39,7 +39,6 @@ import org.mockito.kotlin.whenever @SmallTest @RunWith(AndroidJUnit4::class) -@kotlinx.coroutines.ExperimentalCoroutinesApi class KeyguardLockWhileAwakeInteractorTest : SysuiTestCase() { private val kosmos = testKosmos() private val testScope = kosmos.testScope diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/KeyguardOcclusionInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/KeyguardOcclusionInteractorTest.kt index ae2a5c5fe501..8f60e6bbff1d 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/KeyguardOcclusionInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/KeyguardOcclusionInteractorTest.kt @@ -30,8 +30,6 @@ * limitations under the License. */ -@file:OptIn(ExperimentalCoroutinesApi::class) - package com.android.systemui.keyguard.domain.interactor import android.provider.Settings @@ -66,7 +64,6 @@ import com.android.systemui.util.settings.data.repository.userAwareSecureSetting import com.google.common.truth.Truth.assertThat import junit.framework.Assert.assertFalse import junit.framework.Assert.assertTrue -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.advanceTimeBy import kotlinx.coroutines.test.runCurrent diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/KeyguardQuickAffordanceInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/KeyguardQuickAffordanceInteractorTest.kt index bdced7075f92..868b3cee4953 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/KeyguardQuickAffordanceInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/KeyguardQuickAffordanceInteractorTest.kt @@ -66,7 +66,6 @@ import com.android.systemui.util.mockito.mock import com.android.systemui.util.mockito.whenever import com.android.systemui.util.settings.fakeSettings import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest @@ -78,7 +77,6 @@ import org.mockito.ArgumentMatchers.anyString import org.mockito.Mock import org.mockito.MockitoAnnotations -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class KeyguardQuickAffordanceInteractorTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/KeyguardSurfaceBehindInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/KeyguardSurfaceBehindInteractorTest.kt index c9871f1e4e1e..6d53e6c138c7 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/KeyguardSurfaceBehindInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/KeyguardSurfaceBehindInteractorTest.kt @@ -50,7 +50,6 @@ import org.junit.runner.RunWith @SmallTest @RunWith(AndroidJUnit4::class) -@kotlinx.coroutines.ExperimentalCoroutinesApi class KeyguardSurfaceBehindInteractorTest : SysuiTestCase() { private val kosmos = testKosmos() private lateinit var testScope: TestScope diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/KeyguardTouchHandlingInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/KeyguardTouchHandlingInteractorTest.kt index 16f02c5dc9ea..e203a276a2f2 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/KeyguardTouchHandlingInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/KeyguardTouchHandlingInteractorTest.kt @@ -40,7 +40,6 @@ import com.android.systemui.testKosmos import com.android.systemui.util.mockito.mock import com.android.systemui.util.mockito.whenever import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.runBlocking import kotlinx.coroutines.test.advanceTimeBy import kotlinx.coroutines.test.runCurrent @@ -53,7 +52,6 @@ import org.mockito.ArgumentMatchers.anyInt import org.mockito.Mockito.verify import org.mockito.MockitoAnnotations -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class KeyguardTouchHandlingInteractorTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/KeyguardTransitionInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/KeyguardTransitionInteractorTest.kt index 635f80262348..29e95cd911f8 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/KeyguardTransitionInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/KeyguardTransitionInteractorTest.kt @@ -55,7 +55,6 @@ import org.junit.runner.RunWith @SmallTest @RunWith(AndroidJUnit4::class) -@kotlinx.coroutines.ExperimentalCoroutinesApi class KeyguardTransitionInteractorTest : SysuiTestCase() { val kosmos = testKosmos() val underTest = kosmos.keyguardTransitionInteractor diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/KeyguardTransitionScenariosTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/KeyguardTransitionScenariosTest.kt index abcbdb153e80..d057f7a0e8f2 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/KeyguardTransitionScenariosTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/KeyguardTransitionScenariosTest.kt @@ -65,7 +65,6 @@ import com.android.systemui.shade.shadeTestUtil import com.android.systemui.testKosmos import com.android.systemui.util.mockito.whenever import kotlin.time.Duration.Companion.milliseconds -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.cancelChildren import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.flowOf @@ -88,7 +87,6 @@ import platform.test.runner.parameterized.Parameters * Class for testing user journeys through the interactors. They will all be activated during setup, * to ensure the expected transitions are still triggered. */ -@ExperimentalCoroutinesApi @SmallTest @RunWith(ParameterizedAndroidJunit4::class) class KeyguardTransitionScenariosTest(flags: FlagsParameterization?) : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/KeyguardWakeDirectlyToGoneInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/KeyguardWakeDirectlyToGoneInteractorTest.kt index 98e3c68e6e33..a814953f707b 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/KeyguardWakeDirectlyToGoneInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/KeyguardWakeDirectlyToGoneInteractorTest.kt @@ -44,7 +44,6 @@ import com.android.systemui.power.domain.interactor.powerInteractor import com.android.systemui.testKosmos import com.android.systemui.util.settings.fakeSettings import junit.framework.Assert.assertEquals -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Test @@ -58,7 +57,6 @@ import org.mockito.kotlin.mock import org.mockito.kotlin.verify import org.mockito.kotlin.whenever -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class KeyguardWakeDirectlyToGoneInteractorTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/LightRevealScrimInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/LightRevealScrimInteractorTest.kt index e24bb0432ed5..96db0149d71c 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/LightRevealScrimInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/LightRevealScrimInteractorTest.kt @@ -38,7 +38,6 @@ import com.android.systemui.statusbar.LightRevealEffect import com.android.systemui.statusbar.LightRevealScrim import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Assert.assertEquals @@ -47,7 +46,6 @@ import org.junit.runner.RunWith import org.mockito.Mockito @SmallTest -@OptIn(ExperimentalCoroutinesApi::class) @RunWith(AndroidJUnit4::class) class LightRevealScrimInteractorTest : SysuiTestCase() { val kosmos = diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/SwipeToDismissInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/SwipeToDismissInteractorTest.kt index d77519d4b755..d36b45e79fcc 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/SwipeToDismissInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/SwipeToDismissInteractorTest.kt @@ -36,7 +36,6 @@ import org.junit.runner.RunWith @SmallTest @RunWith(AndroidJUnit4::class) -@kotlinx.coroutines.ExperimentalCoroutinesApi class SwipeToDismissInteractorTest : SysuiTestCase() { private val kosmos = testKosmos() private val testScope = kosmos.testScope diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/UdfpsKeyguardInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/UdfpsKeyguardInteractorTest.kt index 309e3a8be14a..be81f31498f7 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/UdfpsKeyguardInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/UdfpsKeyguardInteractorTest.kt @@ -49,7 +49,6 @@ import com.android.systemui.util.mockito.argumentCaptor import com.android.systemui.util.mockito.eq import com.android.systemui.util.mockito.whenever import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Before @@ -62,7 +61,6 @@ import org.mockito.MockitoAnnotations import platform.test.runner.parameterized.ParameterizedAndroidJunit4 import platform.test.runner.parameterized.Parameters -@ExperimentalCoroutinesApi @SmallTest @RunWith(ParameterizedAndroidJunit4::class) class UdfpsKeyguardInteractorTest(flags: FlagsParameterization) : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/WindowManagerLockscreenVisibilityInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/WindowManagerLockscreenVisibilityInteractorTest.kt index 5f5d80c01292..b7c162b4d6eb 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/WindowManagerLockscreenVisibilityInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/WindowManagerLockscreenVisibilityInteractorTest.kt @@ -60,7 +60,6 @@ import org.junit.runner.RunWith @SmallTest @RunWith(AndroidJUnit4::class) -@kotlinx.coroutines.ExperimentalCoroutinesApi class WindowManagerLockscreenVisibilityInteractorTest : SysuiTestCase() { private val lockscreenSurfaceVisibilityFlow = MutableStateFlow<Boolean?>(false) private val primaryBouncerSurfaceVisibilityFlow = MutableStateFlow<Boolean?>(false) diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/binder/InWindowLauncherUnlockAnimationManagerTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/binder/InWindowLauncherUnlockAnimationManagerTest.kt index 0cfc20d7bbd8..0e9f5e715146 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/binder/InWindowLauncherUnlockAnimationManagerTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/binder/InWindowLauncherUnlockAnimationManagerTest.kt @@ -41,7 +41,6 @@ import org.mockito.MockitoAnnotations @SmallTest @RunWith(AndroidJUnit4::class) -@kotlinx.coroutines.ExperimentalCoroutinesApi class InWindowLauncherUnlockAnimationManagerTest : SysuiTestCase() { private val kosmos = testKosmos() private lateinit var underTest: InWindowLauncherUnlockAnimationManager diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/binder/KeyguardClockViewBinderTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/binder/KeyguardClockViewBinderTest.kt index 4e3d18c80a4f..5131b603f762 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/binder/KeyguardClockViewBinderTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/binder/KeyguardClockViewBinderTest.kt @@ -40,7 +40,6 @@ import org.mockito.MockitoAnnotations @SmallTest @RunWith(AndroidJUnit4::class) -@kotlinx.coroutines.ExperimentalCoroutinesApi class KeyguardClockViewBinderTest : SysuiTestCase() { @Mock private lateinit var rootView: ConstraintLayout @Mock private lateinit var burnInLayer: Layer diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/binder/KeyguardSurfaceBehindParamsApplierTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/binder/KeyguardSurfaceBehindParamsApplierTest.kt index 9055495b9f23..7a614fd34402 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/binder/KeyguardSurfaceBehindParamsApplierTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/binder/KeyguardSurfaceBehindParamsApplierTest.kt @@ -43,7 +43,6 @@ import org.mockito.MockitoAnnotations @SmallTest @RunWithLooper(setAsMainLooper = true) -@kotlinx.coroutines.ExperimentalCoroutinesApi @RunWith(AndroidJUnit4::class) class KeyguardSurfaceBehindParamsApplierTest : SysuiTestCase() { @get:Rule val animatorTestRule = AnimatorTestRule(this) diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/binder/WindowManagerLockscreenVisibilityManagerTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/binder/WindowManagerLockscreenVisibilityManagerTest.kt index bafabe07d370..97c746c49cba 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/binder/WindowManagerLockscreenVisibilityManagerTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/binder/WindowManagerLockscreenVisibilityManagerTest.kt @@ -50,7 +50,6 @@ import org.mockito.kotlin.whenever @SmallTest @RunWith(AndroidJUnit4::class) -@kotlinx.coroutines.ExperimentalCoroutinesApi class WindowManagerLockscreenVisibilityManagerTest : SysuiTestCase() { @get:Rule val checkFlagsRule: CheckFlagsRule = DeviceFlagsValueProvider.createCheckFlagsRule() diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/view/layout/blueprints/DefaultKeyguardBlueprintTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/view/layout/blueprints/DefaultKeyguardBlueprintTest.kt index 810ca4960a57..3a016ff7152a 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/view/layout/blueprints/DefaultKeyguardBlueprintTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/view/layout/blueprints/DefaultKeyguardBlueprintTest.kt @@ -43,7 +43,6 @@ import com.android.systemui.keyguard.ui.view.layout.sections.SmartspaceSection import com.android.systemui.keyguard.ui.view.layout.sections.SplitShadeGuidelines import com.android.systemui.util.mockito.whenever import java.util.Optional -import kotlinx.coroutines.ExperimentalCoroutinesApi import org.junit.Before import org.junit.Test import org.junit.runner.RunWith @@ -55,7 +54,6 @@ import org.mockito.MockitoAnnotations @RunWith(AndroidJUnit4::class) @RunWithLooper(setAsMainLooper = true) -@ExperimentalCoroutinesApi @SmallTest class DefaultKeyguardBlueprintTest : SysuiTestCase() { private lateinit var underTest: DefaultKeyguardBlueprint diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/view/layout/sections/ClockSectionTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/view/layout/sections/ClockSectionTest.kt index 1cf45f8f8b8e..2ef86e66a2aa 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/view/layout/sections/ClockSectionTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/view/layout/sections/ClockSectionTest.kt @@ -47,7 +47,6 @@ import com.android.systemui.testKosmos import com.android.systemui.util.mockito.eq import com.android.systemui.util.mockito.whenever import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.advanceUntilIdle import kotlinx.coroutines.test.runTest import org.junit.Before @@ -58,7 +57,6 @@ import org.mockito.ArgumentMatchers.anyString import org.mockito.MockitoAnnotations import org.mockito.kotlin.mock -@OptIn(ExperimentalCoroutinesApi::class) @RunWith(AndroidJUnit4::class) @SmallTest class ClockSectionTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/AccessibilityActionsViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/AccessibilityActionsViewModelTest.kt index d0f434ad9b4f..708257a90667 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/AccessibilityActionsViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/AccessibilityActionsViewModelTest.kt @@ -14,8 +14,6 @@ * limitations under the License. */ -@file:OptIn(ExperimentalCoroutinesApi::class) - package com.android.systemui.keyguard.ui.viewmodel import androidx.test.ext.junit.runners.AndroidJUnit4 @@ -31,7 +29,6 @@ import com.android.systemui.keyguard.shared.model.TransitionStep 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.runTest import org.junit.Before import org.junit.Test diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/AlternateBouncerMessageAreaViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/AlternateBouncerMessageAreaViewModelTest.kt index 87d1cd571e3c..1716fe09525c 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/AlternateBouncerMessageAreaViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/AlternateBouncerMessageAreaViewModelTest.kt @@ -33,7 +33,6 @@ import com.android.systemui.keyguard.shared.model.FailFingerprintAuthenticationS 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.advanceTimeBy import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest @@ -41,7 +40,6 @@ import org.junit.Before import org.junit.Test import org.junit.runner.RunWith -@ExperimentalCoroutinesApi @SmallTest @RunWith(AndroidJUnit4::class) class AlternateBouncerMessageAreaViewModelTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/AlternateBouncerToAodTransitionViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/AlternateBouncerToAodTransitionViewModelTest.kt index df8afdbcf7a8..9dd14290f773 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/AlternateBouncerToAodTransitionViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/AlternateBouncerToAodTransitionViewModelTest.kt @@ -38,13 +38,11 @@ import com.android.systemui.kosmos.testScope import com.android.systemui.testKosmos import com.google.common.collect.Range import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runTest import org.junit.Before import org.junit.Test import org.junit.runner.RunWith -@ExperimentalCoroutinesApi @SmallTest @RunWith(AndroidJUnit4::class) class AlternateBouncerToAodTransitionViewModelTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/AlternateBouncerToDozingTransitionViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/AlternateBouncerToDozingTransitionViewModelTest.kt index f8a6fc795b42..a75f27c984da 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/AlternateBouncerToDozingTransitionViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/AlternateBouncerToDozingTransitionViewModelTest.kt @@ -33,13 +33,11 @@ import com.android.systemui.keyguard.shared.model.TransitionStep 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.runTest import org.junit.Before import org.junit.Test import org.junit.runner.RunWith -@ExperimentalCoroutinesApi @SmallTest @RunWith(AndroidJUnit4::class) class AlternateBouncerToDozingTransitionViewModelTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/AlternateBouncerToGoneTransitionViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/AlternateBouncerToGoneTransitionViewModelTest.kt index 692ffee3fa31..1e91845825d5 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/AlternateBouncerToGoneTransitionViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/AlternateBouncerToGoneTransitionViewModelTest.kt @@ -33,13 +33,11 @@ import com.android.systemui.kosmos.testScope import com.android.systemui.statusbar.sysuiStatusBarStateController import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Test import org.junit.runner.RunWith -@ExperimentalCoroutinesApi @SmallTest @RunWith(AndroidJUnit4::class) class AlternateBouncerToGoneTransitionViewModelTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/AlternateBouncerToLockscreenTransitionViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/AlternateBouncerToLockscreenTransitionViewModelTest.kt index f74b74a9f618..e0ba826436aa 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/AlternateBouncerToLockscreenTransitionViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/AlternateBouncerToLockscreenTransitionViewModelTest.kt @@ -30,13 +30,11 @@ import com.android.systemui.keyguard.shared.model.TransitionStep 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.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Test import org.junit.runner.RunWith -@ExperimentalCoroutinesApi @SmallTest @RunWith(AndroidJUnit4::class) class AlternateBouncerToLockscreenTransitionViewModelTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/AlternateBouncerToOccludedTransitionViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/AlternateBouncerToOccludedTransitionViewModelTest.kt index 288dc489c1bd..06c224f16bac 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/AlternateBouncerToOccludedTransitionViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/AlternateBouncerToOccludedTransitionViewModelTest.kt @@ -30,12 +30,10 @@ import com.android.systemui.keyguard.shared.model.TransitionStep 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.runTest import org.junit.Test import org.junit.runner.RunWith -@ExperimentalCoroutinesApi @SmallTest @RunWith(AndroidJUnit4::class) class AlternateBouncerToOccludedTransitionViewModelTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/AlternateBouncerToPrimaryBouncerTransitionViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/AlternateBouncerToPrimaryBouncerTransitionViewModelTest.kt index e93ed39274fb..bbbdeff5a043 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/AlternateBouncerToPrimaryBouncerTransitionViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/AlternateBouncerToPrimaryBouncerTransitionViewModelTest.kt @@ -36,12 +36,10 @@ import com.android.systemui.kosmos.testScope import com.android.systemui.shade.shadeTestUtil import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runTest import org.junit.Test import org.junit.runner.RunWith -@ExperimentalCoroutinesApi @SmallTest @RunWith(AndroidJUnit4::class) class AlternateBouncerToPrimaryBouncerTransitionViewModelTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/AlternateBouncerViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/AlternateBouncerViewModelTest.kt index 844a166be47b..e1323c166f6b 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/AlternateBouncerViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/AlternateBouncerViewModelTest.kt @@ -37,14 +37,12 @@ import com.android.systemui.testKosmos import com.android.systemui.util.mockito.any import com.google.common.collect.Range import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runTest import org.junit.Test import org.junit.runner.RunWith import org.mockito.Mockito.mock import org.mockito.Mockito.verify -@ExperimentalCoroutinesApi @RunWith(AndroidJUnit4::class) @SmallTest class AlternateBouncerViewModelTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/AlternateBouncerWindowViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/AlternateBouncerWindowViewModelTest.kt index 5d9548057bae..7b000df1c715 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/AlternateBouncerWindowViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/AlternateBouncerWindowViewModelTest.kt @@ -29,12 +29,10 @@ import com.android.systemui.keyguard.shared.model.TransitionStep 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.runTest import org.junit.Test import org.junit.runner.RunWith -@ExperimentalCoroutinesApi @RunWith(AndroidJUnit4::class) @SmallTest class AlternateBouncerWindowViewModelTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/AodBurnInViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/AodBurnInViewModelTest.kt index be504cc0f704..eb8f1aac5cae 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/AodBurnInViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/AodBurnInViewModelTest.kt @@ -14,8 +14,6 @@ * limitations under the License. */ -@file:OptIn(ExperimentalCoroutinesApi::class) - package com.android.systemui.keyguard.ui.viewmodel import androidx.test.ext.junit.runners.AndroidJUnit4 @@ -38,7 +36,6 @@ import com.android.systemui.plugins.clocks.ClockController import com.android.systemui.testKosmos import com.android.systemui.util.mockito.whenever import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.emptyFlow import kotlinx.coroutines.test.runCurrent diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/AodToGoneTransitionViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/AodToGoneTransitionViewModelTest.kt index a3371d3d24f4..0e13d018ee5e 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/AodToGoneTransitionViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/AodToGoneTransitionViewModelTest.kt @@ -27,12 +27,10 @@ import com.android.systemui.keyguard.shared.model.TransitionStep 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.runTest import org.junit.Test import org.junit.runner.RunWith -@ExperimentalCoroutinesApi @SmallTest @RunWith(AndroidJUnit4::class) class AodToGoneTransitionViewModelTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/AodToLockscreenTransitionViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/AodToLockscreenTransitionViewModelTest.kt index 4dbe7c8bdb5a..caf54f17294b 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/AodToLockscreenTransitionViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/AodToLockscreenTransitionViewModelTest.kt @@ -32,7 +32,6 @@ import com.android.systemui.scene.shared.flag.SceneContainerFlag import com.android.systemui.shade.shadeTestUtil import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Before @@ -41,7 +40,6 @@ import org.junit.runner.RunWith import platform.test.runner.parameterized.ParameterizedAndroidJunit4 import platform.test.runner.parameterized.Parameters -@ExperimentalCoroutinesApi @SmallTest @RunWith(ParameterizedAndroidJunit4::class) class AodToLockscreenTransitionViewModelTest(flags: FlagsParameterization) : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/AodToOccludedTransitionViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/AodToOccludedTransitionViewModelTest.kt index db8fbf604430..e03086857e7f 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/AodToOccludedTransitionViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/AodToOccludedTransitionViewModelTest.kt @@ -27,12 +27,10 @@ import com.android.systemui.keyguard.shared.model.TransitionStep import com.android.systemui.kosmos.testScope import com.android.systemui.testKosmos import com.google.common.truth.Truth -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runTest import org.junit.Test import org.junit.runner.RunWith -@ExperimentalCoroutinesApi @SmallTest @RunWith(AndroidJUnit4::class) class AodToOccludedTransitionViewModelTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/AodToPrimaryBouncerTransitionViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/AodToPrimaryBouncerTransitionViewModelTest.kt index 01191cca87a1..52f7ca784d4f 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/AodToPrimaryBouncerTransitionViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/AodToPrimaryBouncerTransitionViewModelTest.kt @@ -32,13 +32,11 @@ import com.android.systemui.keyguard.ui.transitions.blurConfig 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.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Test import org.junit.runner.RunWith -@ExperimentalCoroutinesApi @SmallTest @RunWith(AndroidJUnit4::class) class AodToPrimaryBouncerTransitionViewModelTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/DeviceEntryBackgroundViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/DeviceEntryBackgroundViewModelTest.kt index 22677b2f8e3e..c8fade3fbf01 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/DeviceEntryBackgroundViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/DeviceEntryBackgroundViewModelTest.kt @@ -30,13 +30,11 @@ import com.android.systemui.keyguard.shared.model.TransitionStep 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.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Test import org.junit.runner.RunWith -@ExperimentalCoroutinesApi @SmallTest @RunWith(AndroidJUnit4::class) class DeviceEntryBackgroundViewModelTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/DeviceEntryForegroundViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/DeviceEntryForegroundViewModelTest.kt index d42b538cf355..eb4b373edcfa 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/DeviceEntryForegroundViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/DeviceEntryForegroundViewModelTest.kt @@ -30,14 +30,12 @@ import com.android.systemui.kosmos.testScope import com.android.systemui.res.R import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runTest import org.junit.After import org.junit.Before import org.junit.Test import org.junit.runner.RunWith -@ExperimentalCoroutinesApi @SmallTest @RunWith(AndroidJUnit4::class) class DeviceEntryForegroundViewModelTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/DeviceEntryIconViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/DeviceEntryIconViewModelTest.kt index b49e546c6e78..5bc4d5ebaf59 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/DeviceEntryIconViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/DeviceEntryIconViewModelTest.kt @@ -39,7 +39,6 @@ import com.android.systemui.kosmos.testScope import com.android.systemui.scene.shared.flag.SceneContainerFlag 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.advanceTimeBy import kotlinx.coroutines.test.runCurrent @@ -48,7 +47,6 @@ import org.junit.Before import org.junit.Test import org.junit.runner.RunWith -@ExperimentalCoroutinesApi @SmallTest @RunWith(AndroidJUnit4::class) class DeviceEntryIconViewModelTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/DozingToGoneTransitionViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/DozingToGoneTransitionViewModelTest.kt index bf3231e6e59d..61a50babbf3f 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/DozingToGoneTransitionViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/DozingToGoneTransitionViewModelTest.kt @@ -29,13 +29,11 @@ import com.android.systemui.keyguard.shared.model.TransitionStep 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.runTest import org.junit.Before import org.junit.Test import org.junit.runner.RunWith -@ExperimentalCoroutinesApi @SmallTest @RunWith(AndroidJUnit4::class) class DozingToGoneTransitionViewModelTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/DozingToLockscreenTransitionViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/DozingToLockscreenTransitionViewModelTest.kt index 8e4876d3c6df..779c1cd7ec8a 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/DozingToLockscreenTransitionViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/DozingToLockscreenTransitionViewModelTest.kt @@ -27,12 +27,10 @@ import com.android.systemui.keyguard.shared.model.TransitionStep 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.runTest import org.junit.Test import org.junit.runner.RunWith -@ExperimentalCoroutinesApi @SmallTest @RunWith(AndroidJUnit4::class) class DozingToLockscreenTransitionViewModelTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/DozingToPrimaryBouncerTransitionViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/DozingToPrimaryBouncerTransitionViewModelTest.kt index 28410d9e3be1..bafd41528b7b 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/DozingToPrimaryBouncerTransitionViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/DozingToPrimaryBouncerTransitionViewModelTest.kt @@ -34,14 +34,12 @@ import com.android.systemui.keyguard.ui.transitions.blurConfig 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.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Before import org.junit.Test import org.junit.runner.RunWith -@ExperimentalCoroutinesApi @SmallTest @RunWith(AndroidJUnit4::class) class DozingToPrimaryBouncerTransitionViewModelTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/DreamingToLockscreenTransitionViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/DreamingToLockscreenTransitionViewModelTest.kt index e34edb4c442e..eb5e1395d510 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/DreamingToLockscreenTransitionViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/DreamingToLockscreenTransitionViewModelTest.kt @@ -36,13 +36,11 @@ import com.android.systemui.kosmos.testScope import com.android.systemui.testKosmos import com.google.common.collect.Range import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runTest import org.junit.Before import org.junit.Test import org.junit.runner.RunWith -@ExperimentalCoroutinesApi @SmallTest @RunWith(AndroidJUnit4::class) class DreamingToLockscreenTransitionViewModelTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/GlanceableHubToLockscreenTransitionViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/GlanceableHubToLockscreenTransitionViewModelTest.kt index 1dd435b413be..3ab920a46084 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/GlanceableHubToLockscreenTransitionViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/GlanceableHubToLockscreenTransitionViewModelTest.kt @@ -35,13 +35,11 @@ import com.android.systemui.res.R import com.android.systemui.testKosmos import com.google.common.collect.Range import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import org.junit.Test import org.junit.runner.RunWith import org.mockito.kotlin.mock import org.mockito.kotlin.whenever -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class GlanceableHubToLockscreenTransitionViewModelTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/GlanceableHubToPrimaryBouncerTransitionViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/GlanceableHubToPrimaryBouncerTransitionViewModelTest.kt index 54d20d203fc1..6b9e23abd9a4 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/GlanceableHubToPrimaryBouncerTransitionViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/GlanceableHubToPrimaryBouncerTransitionViewModelTest.kt @@ -29,11 +29,9 @@ import com.android.systemui.keyguard.ui.transitions.blurConfig import com.android.systemui.kosmos.collectValues import com.android.systemui.kosmos.runTest import com.android.systemui.testKosmos -import kotlinx.coroutines.ExperimentalCoroutinesApi import org.junit.Test import org.junit.runner.RunWith -@ExperimentalCoroutinesApi @SmallTest @RunWith(AndroidJUnit4::class) class GlanceableHubToPrimaryBouncerTransitionViewModelTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/GoneToAodTransitionViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/GoneToAodTransitionViewModelTest.kt index bab466a6c1d4..ce234ccb3194 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/GoneToAodTransitionViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/GoneToAodTransitionViewModelTest.kt @@ -34,13 +34,11 @@ import com.android.systemui.power.shared.model.WakefulnessState import com.android.systemui.testKosmos import com.google.common.collect.Range import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Test import org.junit.runner.RunWith -@ExperimentalCoroutinesApi @SmallTest @RunWith(AndroidJUnit4::class) class GoneToAodTransitionViewModelTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/GoneToDozingTransitionViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/GoneToDozingTransitionViewModelTest.kt index 80a95324a185..c7c03699bc28 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/GoneToDozingTransitionViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/GoneToDozingTransitionViewModelTest.kt @@ -35,13 +35,11 @@ import com.android.systemui.kosmos.testScope import com.android.systemui.testKosmos import com.google.common.collect.Range import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runTest import org.junit.Before import org.junit.Test import org.junit.runner.RunWith -@ExperimentalCoroutinesApi @SmallTest @RunWith(AndroidJUnit4::class) class GoneToDozingTransitionViewModelTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardIndicationAreaViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardIndicationAreaViewModelTest.kt index bd892d588d8b..9c7f01495b58 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardIndicationAreaViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardIndicationAreaViewModelTest.kt @@ -36,7 +36,6 @@ import com.android.systemui.kosmos.testDispatcher 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.flow.MutableStateFlow import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.test.runTest @@ -47,7 +46,6 @@ import org.mockito.kotlin.any import org.mockito.kotlin.doReturn import org.mockito.kotlin.mock -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest class KeyguardIndicationAreaViewModelTest() : SysuiTestCase() { private val kosmos = testKosmos() diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardRootViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardRootViewModelTest.kt index 789477e38b55..83bee7c66d31 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardRootViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardRootViewModelTest.kt @@ -15,8 +15,6 @@ * */ -@file:OptIn(ExperimentalCoroutinesApi::class) - package com.android.systemui.keyguard.ui.viewmodel import android.platform.test.flag.junit.FlagsParameterization @@ -57,7 +55,6 @@ import com.android.systemui.util.ui.isAnimating import com.android.systemui.util.ui.stopAnimating import com.android.systemui.util.ui.value import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.emptyFlow import kotlinx.coroutines.flow.flowOf diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/LockscreenContentViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/LockscreenContentViewModelTest.kt index 5436d7eee00c..bd0fb68a9c42 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/LockscreenContentViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/LockscreenContentViewModelTest.kt @@ -14,8 +14,6 @@ * limitations under the License. */ -@file:OptIn(ExperimentalCoroutinesApi::class) - package com.android.systemui.keyguard.ui.viewmodel import android.platform.test.flag.junit.FlagsParameterization @@ -27,8 +25,10 @@ import com.android.systemui.coroutines.collectLastValue import com.android.systemui.flags.DisableSceneContainer import com.android.systemui.flags.andSceneContainer import com.android.systemui.keyguard.data.repository.fakeKeyguardClockRepository +import com.android.systemui.keyguard.data.repository.fakeKeyguardTransitionRepository import com.android.systemui.keyguard.data.repository.keyguardOcclusionRepository import com.android.systemui.keyguard.shared.model.ClockSize +import com.android.systemui.keyguard.shared.model.KeyguardState import com.android.systemui.kosmos.Kosmos import com.android.systemui.kosmos.testScope import com.android.systemui.lifecycle.activateIn @@ -42,7 +42,6 @@ import com.android.systemui.unfold.fakeUnfoldTransitionProgressProvider import com.android.systemui.util.mockito.whenever import com.google.common.truth.Truth.assertThat import java.util.Locale -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Before @@ -239,6 +238,10 @@ class LockscreenContentViewModelTest(flags: FlagsParameterization) : SysuiTestCa val isContentVisible by collectLastValue(underTest.isContentVisible) keyguardOcclusionRepository.setShowWhenLockedActivityInfo(true, null) + fakeKeyguardTransitionRepository.transitionTo( + KeyguardState.LOCKSCREEN, + KeyguardState.OCCLUDED, + ) runCurrent() assertThat(isContentVisible).isFalse() } @@ -249,7 +252,12 @@ class LockscreenContentViewModelTest(flags: FlagsParameterization) : SysuiTestCa with(kosmos) { testScope.runTest { val isContentVisible by collectLastValue(underTest.isContentVisible) + keyguardOcclusionRepository.setShowWhenLockedActivityInfo(true, null) + fakeKeyguardTransitionRepository.transitionTo( + KeyguardState.LOCKSCREEN, + KeyguardState.OCCLUDED, + ) runCurrent() sceneInteractor.snapToScene(Scenes.Shade, "") @@ -258,6 +266,35 @@ class LockscreenContentViewModelTest(flags: FlagsParameterization) : SysuiTestCa } } + @Test + fun isContentVisible_whenOccluded_notVisibleInOccluded_visibleInAod() = + with(kosmos) { + testScope.runTest { + val isContentVisible by collectLastValue(underTest.isContentVisible) + keyguardOcclusionRepository.setShowWhenLockedActivityInfo(true, null) + fakeKeyguardTransitionRepository.transitionTo( + KeyguardState.LOCKSCREEN, + KeyguardState.OCCLUDED, + ) + runCurrent() + + sceneInteractor.snapToScene(Scenes.Shade, "") + runCurrent() + assertThat(isContentVisible).isFalse() + + fakeKeyguardTransitionRepository.transitionTo( + KeyguardState.OCCLUDED, + KeyguardState.AOD, + ) + runCurrent() + + sceneInteractor.snapToScene(Scenes.Lockscreen, "") + runCurrent() + + assertThat(isContentVisible).isTrue() + } + } + private fun prepareConfiguration(): Int { val configuration = context.resources.configuration configuration.setLayoutDirection(Locale.US) diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/LockscreenToAodTransitionViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/LockscreenToAodTransitionViewModelTest.kt index bc381f2abc6d..28f57998c39d 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/LockscreenToAodTransitionViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/LockscreenToAodTransitionViewModelTest.kt @@ -37,7 +37,6 @@ import com.android.systemui.shade.shadeTestUtil import com.android.systemui.testKosmos import com.google.common.collect.Range import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Before @@ -46,7 +45,6 @@ import org.junit.runner.RunWith import platform.test.runner.parameterized.ParameterizedAndroidJunit4 import platform.test.runner.parameterized.Parameters -@ExperimentalCoroutinesApi @SmallTest @RunWith(ParameterizedAndroidJunit4::class) class LockscreenToAodTransitionViewModelTest(flags: FlagsParameterization) : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/LockscreenToDozingTransitionViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/LockscreenToDozingTransitionViewModelTest.kt index 0a0ded7ec861..9c42a64aa561 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/LockscreenToDozingTransitionViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/LockscreenToDozingTransitionViewModelTest.kt @@ -33,14 +33,12 @@ import com.android.systemui.keyguard.shared.model.TransitionStep 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.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Before import org.junit.Test import org.junit.runner.RunWith -@ExperimentalCoroutinesApi @SmallTest @RunWith(AndroidJUnit4::class) class LockscreenToDozingTransitionViewModelTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/LockscreenToDreamingTransitionViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/LockscreenToDreamingTransitionViewModelTest.kt index 933779312df5..4bec6bb63924 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/LockscreenToDreamingTransitionViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/LockscreenToDreamingTransitionViewModelTest.kt @@ -14,8 +14,6 @@ * limitations under the License. */ -@file:OptIn(ExperimentalCoroutinesApi::class) - package com.android.systemui.keyguard.ui.viewmodel import android.platform.test.flag.junit.FlagsParameterization @@ -40,7 +38,6 @@ import com.android.systemui.shade.shadeTestUtil import com.android.systemui.testKosmos import com.google.common.collect.Range import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Before diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/LockscreenToGlanceableHubTransitionViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/LockscreenToGlanceableHubTransitionViewModelTest.kt index b5cee80c0bf6..aefa2eba3927 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/LockscreenToGlanceableHubTransitionViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/LockscreenToGlanceableHubTransitionViewModelTest.kt @@ -35,13 +35,11 @@ import com.android.systemui.res.R import com.android.systemui.testKosmos import com.google.common.collect.Range import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import org.junit.Test import org.junit.runner.RunWith import org.mockito.kotlin.mock import org.mockito.kotlin.whenever -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class LockscreenToGlanceableHubTransitionViewModelTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/LockscreenToGoneTransitionViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/LockscreenToGoneTransitionViewModelTest.kt index 26cb4856e571..a82d01f760af 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/LockscreenToGoneTransitionViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/LockscreenToGoneTransitionViewModelTest.kt @@ -29,12 +29,10 @@ import com.android.systemui.kosmos.testScope import com.android.systemui.statusbar.sysuiStatusBarStateController import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runTest import org.junit.Test import org.junit.runner.RunWith -@ExperimentalCoroutinesApi @SmallTest @RunWith(AndroidJUnit4::class) class LockscreenToGoneTransitionViewModelTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/LockscreenToOccludedTransitionViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/LockscreenToOccludedTransitionViewModelTest.kt index 576795d7e293..6d90c43837ab 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/LockscreenToOccludedTransitionViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/LockscreenToOccludedTransitionViewModelTest.kt @@ -14,8 +14,6 @@ * limitations under the License. */ -@file:OptIn(ExperimentalCoroutinesApi::class) - package com.android.systemui.keyguard.ui.viewmodel import android.platform.test.flag.junit.FlagsParameterization @@ -44,7 +42,6 @@ import com.android.systemui.shade.shadeTestUtil import com.android.systemui.testKosmos import com.google.common.collect.Range import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Before diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/LockscreenToPrimaryBouncerTransitionViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/LockscreenToPrimaryBouncerTransitionViewModelTest.kt index aaca603ecf77..a31728ce5e18 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/LockscreenToPrimaryBouncerTransitionViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/LockscreenToPrimaryBouncerTransitionViewModelTest.kt @@ -44,7 +44,6 @@ import com.android.systemui.shade.shadeTestUtil import com.android.systemui.testKosmos import com.google.common.collect.Range import com.google.common.truth.Truth -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.emptyFlow import kotlinx.coroutines.test.runCurrent @@ -55,7 +54,6 @@ import org.junit.runner.RunWith import platform.test.runner.parameterized.ParameterizedAndroidJunit4 import platform.test.runner.parameterized.Parameters -@ExperimentalCoroutinesApi @SmallTest @RunWith(ParameterizedAndroidJunit4::class) class LockscreenToPrimaryBouncerTransitionViewModelTest(flags: FlagsParameterization) : diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/LockscreenUserActionsViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/LockscreenUserActionsViewModelTest.kt index 97e67634cd2b..57c65b4ac8e9 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/LockscreenUserActionsViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/LockscreenUserActionsViewModelTest.kt @@ -14,8 +14,6 @@ * limitations under the License. */ -@file:OptIn(ExperimentalCoroutinesApi::class) - package com.android.systemui.keyguard.ui.viewmodel import android.platform.test.annotations.DisableFlags @@ -50,7 +48,6 @@ import com.android.systemui.shade.data.repository.shadeRepository import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat import kotlin.math.pow -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.test.runTest import org.junit.BeforeClass diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/OccludedToAodTransitionViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/OccludedToAodTransitionViewModelTest.kt index 1912987cc447..123ed0b91a79 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/OccludedToAodTransitionViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/OccludedToAodTransitionViewModelTest.kt @@ -29,13 +29,11 @@ import com.android.systemui.keyguard.shared.model.TransitionStep 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.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Test import org.junit.runner.RunWith -@ExperimentalCoroutinesApi @SmallTest @RunWith(AndroidJUnit4::class) class OccludedToAodTransitionViewModelTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/OccludedToLockscreenTransitionViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/OccludedToLockscreenTransitionViewModelTest.kt index 4c16a339d696..5357c284b43e 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/OccludedToLockscreenTransitionViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/OccludedToLockscreenTransitionViewModelTest.kt @@ -32,13 +32,11 @@ import com.android.systemui.res.R import com.android.systemui.testKosmos import com.google.common.collect.Range import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Test import org.junit.runner.RunWith -@ExperimentalCoroutinesApi @SmallTest @RunWith(AndroidJUnit4::class) class OccludedToLockscreenTransitionViewModelTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/OccludedToPrimaryBouncerTransitionViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/OccludedToPrimaryBouncerTransitionViewModelTest.kt index 0951df24c56f..8533134fd94e 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/OccludedToPrimaryBouncerTransitionViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/OccludedToPrimaryBouncerTransitionViewModelTest.kt @@ -30,7 +30,6 @@ import com.android.systemui.keyguard.shared.model.TransitionStep import com.android.systemui.keyguard.ui.transitions.blurConfig import com.android.systemui.kosmos.testScope import com.android.systemui.testKosmos -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runTest import org.junit.Before import org.junit.Test @@ -38,7 +37,6 @@ import org.junit.runner.RunWith import platform.test.runner.parameterized.ParameterizedAndroidJunit4 import platform.test.runner.parameterized.Parameters -@ExperimentalCoroutinesApi @SmallTest @RunWith(ParameterizedAndroidJunit4::class) class OccludedToPrimaryBouncerTransitionViewModelTest(flags: FlagsParameterization) : diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/OffToLockscreenTransitionViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/OffToLockscreenTransitionViewModelTest.kt index 0b7a38eb9ebd..715bd39b1c99 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/OffToLockscreenTransitionViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/OffToLockscreenTransitionViewModelTest.kt @@ -29,7 +29,6 @@ import com.android.systemui.kosmos.testScope import com.android.systemui.testKosmos import com.google.common.collect.Range import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runTest import org.junit.Before import org.junit.Test @@ -37,7 +36,6 @@ import org.junit.runner.RunWith import platform.test.runner.parameterized.ParameterizedAndroidJunit4 import platform.test.runner.parameterized.Parameters -@ExperimentalCoroutinesApi @SmallTest @RunWith(ParameterizedAndroidJunit4::class) class OffToLockscreenTransitionViewModelTest(flags: FlagsParameterization) : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/PrimaryBouncerToAodTransitionViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/PrimaryBouncerToAodTransitionViewModelTest.kt index aa1e7ae9d509..db617a7ca140 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/PrimaryBouncerToAodTransitionViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/PrimaryBouncerToAodTransitionViewModelTest.kt @@ -31,13 +31,11 @@ import com.android.systemui.keyguard.ui.transitions.blurConfig 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.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Test import org.junit.runner.RunWith -@ExperimentalCoroutinesApi @SmallTest @RunWith(AndroidJUnit4::class) class PrimaryBouncerToAodTransitionViewModelTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/PrimaryBouncerToDozingTransitionViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/PrimaryBouncerToDozingTransitionViewModelTest.kt index 766816b1ac26..90a918b6291e 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/PrimaryBouncerToDozingTransitionViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/PrimaryBouncerToDozingTransitionViewModelTest.kt @@ -34,13 +34,11 @@ import com.android.systemui.keyguard.ui.transitions.blurConfig 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.runTest import org.junit.Before import org.junit.Test import org.junit.runner.RunWith -@ExperimentalCoroutinesApi @SmallTest @RunWith(AndroidJUnit4::class) class PrimaryBouncerToDozingTransitionViewModelTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/PrimaryBouncerToGlanceableHubTransitionViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/PrimaryBouncerToGlanceableHubTransitionViewModelTest.kt index e4843bd88133..d64ae3f0b90c 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/PrimaryBouncerToGlanceableHubTransitionViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/PrimaryBouncerToGlanceableHubTransitionViewModelTest.kt @@ -29,11 +29,9 @@ import com.android.systemui.keyguard.ui.transitions.blurConfig import com.android.systemui.kosmos.collectValues import com.android.systemui.kosmos.runTest import com.android.systemui.testKosmos -import kotlinx.coroutines.ExperimentalCoroutinesApi import org.junit.Test import org.junit.runner.RunWith -@ExperimentalCoroutinesApi @SmallTest @RunWith(AndroidJUnit4::class) class PrimaryBouncerToGlanceableHubTransitionViewModelTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/PrimaryBouncerToGoneTransitionViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/PrimaryBouncerToGoneTransitionViewModelTest.kt index fd2e33504ec9..97709a76cb62 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/PrimaryBouncerToGoneTransitionViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/PrimaryBouncerToGoneTransitionViewModelTest.kt @@ -66,11 +66,7 @@ class PrimaryBouncerToGoneTransitionViewModelTest : SysuiTestCase() { runCurrent() keyguardTransitionRepository.sendTransitionSteps( - listOf( - step(0f, TransitionState.STARTED), - step(0.3f), - step(0.6f), - ), + listOf(step(0f, TransitionState.STARTED), step(0.3f), step(0.6f)), testScope, ) @@ -87,11 +83,7 @@ class PrimaryBouncerToGoneTransitionViewModelTest : SysuiTestCase() { whenever(primaryBouncerInteractor.willRunDismissFromKeyguard()).thenReturn(true) keyguardTransitionRepository.sendTransitionSteps( - listOf( - step(0f, TransitionState.STARTED), - step(0.3f), - step(0.6f), - ), + listOf(step(0f, TransitionState.STARTED), step(0.3f), step(0.6f)), testScope, ) @@ -149,7 +141,8 @@ class PrimaryBouncerToGoneTransitionViewModelTest : SysuiTestCase() { @Test fun notificationAlpha() = testScope.runTest { - val values by collectValues(underTest.notificationAlpha) + val values by + collectValues(underTest.notificationAlpha(ViewStateAccessor(alpha = { 0.5f }))) runCurrent() keyguardTransitionRepository.sendTransitionSteps( @@ -158,7 +151,7 @@ class PrimaryBouncerToGoneTransitionViewModelTest : SysuiTestCase() { testScope, ) - assertThat(values[0]).isEqualTo(1f) + assertThat(values[0]).isEqualTo(0.5f) assertThat(values[1]).isEqualTo(0f) // Should always finish with 1f to show HUNs assertThat(values[2]).isEqualTo(1f) @@ -167,7 +160,7 @@ class PrimaryBouncerToGoneTransitionViewModelTest : SysuiTestCase() { @Test fun notificationAlpha_leaveShadeOpen() = testScope.runTest { - val values by collectValues(underTest.notificationAlpha) + val values by collectValues(underTest.notificationAlpha(ViewStateAccessor())) runCurrent() sysuiStatusBarStateController.setLeaveOpenOnKeyguardHide(true) @@ -185,14 +178,14 @@ class PrimaryBouncerToGoneTransitionViewModelTest : SysuiTestCase() { private fun step( value: Float, - state: TransitionState = TransitionState.RUNNING + state: TransitionState = TransitionState.RUNNING, ): TransitionStep { return TransitionStep( from = KeyguardState.PRIMARY_BOUNCER, to = KeyguardState.GONE, value = value, transitionState = state, - ownerName = "PrimaryBouncerToGoneTransitionViewModelTest" + ownerName = "PrimaryBouncerToGoneTransitionViewModelTest", ) } } diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/PrimaryBouncerToLockscreenTransitionViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/PrimaryBouncerToLockscreenTransitionViewModelTest.kt index 8fefb8d40b71..6fd54f47b1f7 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/PrimaryBouncerToLockscreenTransitionViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/PrimaryBouncerToLockscreenTransitionViewModelTest.kt @@ -36,7 +36,6 @@ import com.android.systemui.kosmos.testScope import com.android.systemui.testKosmos import com.google.common.collect.Range import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Before @@ -45,7 +44,6 @@ import org.junit.runner.RunWith import platform.test.runner.parameterized.ParameterizedAndroidJunit4 import platform.test.runner.parameterized.Parameters -@ExperimentalCoroutinesApi @SmallTest @RunWith(ParameterizedAndroidJunit4::class) class PrimaryBouncerToLockscreenTransitionViewModelTest(flags: FlagsParameterization) : diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/PrimaryBouncerToOccludedTransitionViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/PrimaryBouncerToOccludedTransitionViewModelTest.kt index fd7fb9f863c8..cec624d2beb2 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/PrimaryBouncerToOccludedTransitionViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/PrimaryBouncerToOccludedTransitionViewModelTest.kt @@ -28,12 +28,10 @@ import com.android.systemui.keyguard.shared.model.TransitionStep import com.android.systemui.keyguard.ui.transitions.blurConfig import com.android.systemui.kosmos.testScope import com.android.systemui.testKosmos -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runTest import org.junit.Test import org.junit.runner.RunWith -@ExperimentalCoroutinesApi @SmallTest @RunWith(AndroidJUnit4::class) class PrimaryBouncerToOccludedTransitionViewModelTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/SideFpsProgressBarViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/SideFpsProgressBarViewModelTest.kt index 0588b1c90035..dfed1f0a135e 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/SideFpsProgressBarViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/SideFpsProgressBarViewModelTest.kt @@ -53,7 +53,6 @@ import com.android.systemui.statusbar.phone.dozeServiceHost import com.android.systemui.testKosmos import com.android.systemui.util.mockito.mock import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Before @@ -62,7 +61,6 @@ import org.junit.runner.RunWith import org.mockito.Mockito.spy import org.mockito.Mockito.verify -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @TestableLooper.RunWithLooper @RunWith(AndroidJUnit4::class) diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/lifecycle/ExclusiveActivatableTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/lifecycle/ExclusiveActivatableTest.kt index 81b91802ec28..397831240a42 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/lifecycle/ExclusiveActivatableTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/lifecycle/ExclusiveActivatableTest.kt @@ -14,8 +14,6 @@ * limitations under the License. */ -@file:OptIn(ExperimentalCoroutinesApi::class) - package com.android.systemui.lifecycle import androidx.test.ext.junit.runners.AndroidJUnit4 @@ -24,7 +22,6 @@ import com.android.systemui.SysuiTestCase 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.Job import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/log/echo/LogcatEchoTrackerDebugTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/log/echo/LogcatEchoTrackerDebugTest.kt index a5f50af55a4b..f508df2cceba 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/log/echo/LogcatEchoTrackerDebugTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/log/echo/LogcatEchoTrackerDebugTest.kt @@ -30,7 +30,6 @@ import com.android.systemui.statusbar.commandline.CommandRegistry import com.android.systemui.util.settings.FakeGlobalSettings import kotlin.test.assertEquals import kotlin.test.assertNotNull -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.StandardTestDispatcher import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.advanceUntilIdle @@ -44,7 +43,6 @@ import org.junit.runner.RunWith import org.mockito.Mock import org.mockito.MockitoAnnotations -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class LogcatEchoTrackerDebugTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/log/table/LogDiffsForTableTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/log/table/LogDiffsForTableTest.kt index 030b1726bb73..d5d88d352415 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/log/table/LogDiffsForTableTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/log/table/LogDiffsForTableTest.kt @@ -25,7 +25,6 @@ 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.MutableStateFlow import kotlinx.coroutines.flow.collect import kotlinx.coroutines.flow.flow @@ -39,7 +38,6 @@ import org.junit.Test import org.junit.runner.RunWith @SmallTest -@OptIn(ExperimentalCoroutinesApi::class) @RunWith(AndroidJUnit4::class) class LogDiffsForTableTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/media/controls/domain/pipeline/Media3ActionFactoryTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/media/controls/domain/pipeline/Media3ActionFactoryTest.kt index 466c9f96749f..460232c46676 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/media/controls/domain/pipeline/Media3ActionFactoryTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/media/controls/domain/pipeline/Media3ActionFactoryTest.kt @@ -43,7 +43,6 @@ import com.android.systemui.util.concurrency.execution import com.google.common.collect.ImmutableList import com.google.common.truth.Truth.assertThat import com.google.common.util.concurrent.ListenableFuture -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Before @@ -63,7 +62,6 @@ private const val PACKAGE_NAME = "package_name" private const val CUSTOM_ACTION_NAME = "Custom Action" private const val CUSTOM_ACTION_COMMAND = "custom-action" -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWithLooper @RunWith(AndroidJUnit4::class) diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/media/controls/domain/pipeline/MediaDataLoaderTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/media/controls/domain/pipeline/MediaDataLoaderTest.kt index cf503bbf1310..1f1a74b6c389 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/media/controls/domain/pipeline/MediaDataLoaderTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/media/controls/domain/pipeline/MediaDataLoaderTest.kt @@ -47,7 +47,6 @@ import com.android.systemui.res.R import com.android.systemui.statusbar.SbnBuilder import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.launch import kotlinx.coroutines.test.advanceUntilIdle import kotlinx.coroutines.test.runTest @@ -387,7 +386,6 @@ class MediaDataLoaderTest : SysuiTestCase() { assertThat(result).isNotNull() } - @OptIn(ExperimentalCoroutinesApi::class) @Test fun testLoadMediaDataInBg_cancelMultipleScheduledTasks() = testScope.runTest { @@ -416,7 +414,6 @@ class MediaDataLoaderTest : SysuiTestCase() { verify(mockImageLoader, times(1)).loadBitmap(any(), anyInt(), anyInt(), anyInt()) } - @OptIn(ExperimentalCoroutinesApi::class) @Test fun testLoadMediaDataInBg_fromResumeToActive_doesNotCancelResumeToActiveTask() = testScope.runTest { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/mediaprojection/appselector/data/ActivityTaskManagerThumbnailLoaderTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/mediaprojection/appselector/data/ActivityTaskManagerThumbnailLoaderTest.kt index 9797c8c5b538..47ec5ec1e7e6 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/mediaprojection/appselector/data/ActivityTaskManagerThumbnailLoaderTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/mediaprojection/appselector/data/ActivityTaskManagerThumbnailLoaderTest.kt @@ -17,7 +17,6 @@ import com.android.systemui.shared.system.ActivityManagerWrapper import com.android.systemui.util.mockito.mock import com.android.systemui.util.mockito.whenever import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.UnconfinedTestDispatcher import kotlinx.coroutines.test.runTest @@ -26,7 +25,6 @@ import org.junit.runner.RunWith @RunWith(AndroidJUnit4::class) @SmallTest -@OptIn(ExperimentalCoroutinesApi::class) class ActivityTaskManagerThumbnailLoaderTest : SysuiTestCase() { private val dispatcher = UnconfinedTestDispatcher() diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/mediarouter/data/repository/MediaRouterRepositoryTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/mediarouter/data/repository/MediaRouterRepositoryTest.kt index 6ec38ba171c3..6bc8000b0519 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/mediarouter/data/repository/MediaRouterRepositoryTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/mediarouter/data/repository/MediaRouterRepositoryTest.kt @@ -27,13 +27,11 @@ import com.android.systemui.statusbar.policy.CastDevice import com.android.systemui.statusbar.policy.fakeCastController import com.google.common.truth.Truth.assertThat import kotlin.test.Test -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.runner.RunWith @SmallTest -@OptIn(ExperimentalCoroutinesApi::class) @RunWith(AndroidJUnit4::class) class MediaRouterRepositoryTest : SysuiTestCase() { val kosmos = Kosmos() diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/notifications/ui/viewmodel/NotificationsShadeOverlayContentViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/notifications/ui/viewmodel/NotificationsShadeOverlayContentViewModelTest.kt index 43db50ad675f..26f5d9ea0996 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/notifications/ui/viewmodel/NotificationsShadeOverlayContentViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/notifications/ui/viewmodel/NotificationsShadeOverlayContentViewModelTest.kt @@ -42,7 +42,6 @@ import com.android.systemui.statusbar.notification.data.repository.activeNotific import com.android.systemui.statusbar.notification.data.repository.setActiveNotifs 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 @@ -50,7 +49,6 @@ import org.junit.Before import org.junit.Test import org.junit.runner.RunWith -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) @TestableLooper.RunWithLooper diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/QSPanelControllerBaseSceneContainerTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/QSPanelControllerBaseSceneContainerTest.kt index 07ec38e6ae6c..32e5fa1a8d59 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/QSPanelControllerBaseSceneContainerTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/QSPanelControllerBaseSceneContainerTest.kt @@ -41,7 +41,6 @@ import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat import javax.inject.Provider import kotlinx.coroutines.Dispatchers -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.test.resetMain @@ -62,7 +61,6 @@ import org.mockito.kotlin.whenever @RunWith(AndroidJUnit4::class) @SmallTest @RunWithLooper -@OptIn(ExperimentalCoroutinesApi::class) @EnableSceneContainer class QSPanelControllerBaseSceneContainerTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/UserSettingObserverTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/UserSettingObserverTest.kt index 0c2b59fed078..858ed6a6b54a 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/UserSettingObserverTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/UserSettingObserverTest.kt @@ -28,7 +28,6 @@ import com.android.systemui.util.settings.SecureSettings import com.android.systemui.util.settings.fakeSettings import com.google.common.truth.Truth.assertThat import junit.framework.Assert.fail -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.After @@ -40,7 +39,6 @@ import platform.test.runner.parameterized.Parameters private typealias Callback = (Int, Boolean) -> Unit -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(ParameterizedAndroidJunit4::class) @TestableLooper.RunWithLooper diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/composefragment/viewmodel/AbstractQSFragmentComposeViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/composefragment/viewmodel/AbstractQSFragmentComposeViewModelTest.kt index 87e2fefde989..dd5e89208238 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/composefragment/viewmodel/AbstractQSFragmentComposeViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/composefragment/viewmodel/AbstractQSFragmentComposeViewModelTest.kt @@ -31,7 +31,6 @@ import com.android.systemui.media.controls.domain.pipeline.mediaDataManager import com.android.systemui.qs.composefragment.dagger.usingMediaInComposeFragment import com.android.systemui.testKosmos import kotlinx.coroutines.Dispatchers -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.TestResult import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.resetMain @@ -42,7 +41,6 @@ import org.junit.Before import org.junit.runner.RunWith @RunWith(AndroidJUnit4::class) -@OptIn(ExperimentalCoroutinesApi::class) abstract class AbstractQSFragmentComposeViewModelTest : SysuiTestCase() { protected val kosmos = testKosmos().apply { mediaDataManager = legacyMediaDataManagerImpl } diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/composefragment/viewmodel/QSFragmentComposeViewModelForceQSTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/composefragment/viewmodel/QSFragmentComposeViewModelForceQSTest.kt index d16da1c359fb..428d97482751 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/composefragment/viewmodel/QSFragmentComposeViewModelForceQSTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/composefragment/viewmodel/QSFragmentComposeViewModelForceQSTest.kt @@ -23,7 +23,6 @@ import com.android.systemui.kosmos.testScope import com.android.systemui.statusbar.StatusBarState import com.android.systemui.statusbar.sysuiStatusBarStateController import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import org.junit.Test import org.junit.runner.RunWith @@ -33,7 +32,6 @@ import platform.test.runner.parameterized.Parameters @SmallTest @RunWith(ParameterizedAndroidJunit4::class) @RunWithLooper -@OptIn(ExperimentalCoroutinesApi::class) class QSFragmentComposeViewModelForceQSTest(private val testData: TestData) : AbstractQSFragmentComposeViewModelTest() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/composefragment/viewmodel/QSFragmentComposeViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/composefragment/viewmodel/QSFragmentComposeViewModelTest.kt index 4457d9b25ade..e3fe24ca37c1 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/composefragment/viewmodel/QSFragmentComposeViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/composefragment/viewmodel/QSFragmentComposeViewModelTest.kt @@ -46,7 +46,6 @@ import com.android.systemui.statusbar.disableflags.shared.model.DisableFlagsMode import com.android.systemui.statusbar.sysuiStatusBarStateController import com.android.systemui.util.animation.DisappearParameters import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.runCurrent import org.junit.Test @@ -56,7 +55,6 @@ import org.mockito.kotlin.whenever @SmallTest @RunWith(AndroidJUnit4::class) @RunWithLooper -@OptIn(ExperimentalCoroutinesApi::class) class QSFragmentComposeViewModelTest : AbstractQSFragmentComposeViewModelTest() { @Test diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/panels/domain/interactor/DynamicIconTilesInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/panels/domain/interactor/DynamicIconTilesInteractorTest.kt index 75d4b91f25a9..c68300751c5a 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/panels/domain/interactor/DynamicIconTilesInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/panels/domain/interactor/DynamicIconTilesInteractorTest.kt @@ -29,7 +29,6 @@ import com.android.systemui.qs.pipeline.domain.interactor.currentTilesInteractor import com.android.systemui.qs.pipeline.shared.TileSpec import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Before @@ -57,7 +56,6 @@ class DynamicIconTilesInteractorTest : SysuiTestCase() { } } - @OptIn(ExperimentalCoroutinesApi::class) @Test fun removingTile_updatesSharedPreferences() = with(kosmos) { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/panels/domain/interactor/IconTilesInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/panels/domain/interactor/IconTilesInteractorTest.kt index ed28dc8304c3..79acfdaa415b 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/panels/domain/interactor/IconTilesInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/panels/domain/interactor/IconTilesInteractorTest.kt @@ -28,7 +28,6 @@ import com.android.systemui.qs.pipeline.domain.interactor.currentTilesInteractor import com.android.systemui.qs.pipeline.shared.TileSpec import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Test @@ -53,7 +52,6 @@ class IconTilesInteractorTest : SysuiTestCase() { assertThat(underTest.isIconTile(smallTile)).isTrue() } - @OptIn(ExperimentalCoroutinesApi::class) @Test fun isIconTile_updatesFromSharedPreferences() = with(kosmos) { @@ -76,7 +74,6 @@ class IconTilesInteractorTest : SysuiTestCase() { } } - @OptIn(ExperimentalCoroutinesApi::class) @Test fun resize_updatesSharedPreferences() = with(kosmos) { @@ -96,7 +93,6 @@ class IconTilesInteractorTest : SysuiTestCase() { } } - @OptIn(ExperimentalCoroutinesApi::class) @Test fun resizingNonCurrentTile_doesNothing() = with(kosmos) { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/panels/domain/interactor/SizedTilesResetInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/panels/domain/interactor/SizedTilesResetInteractorTest.kt index ee7a15eb7fa7..e6d78d927780 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/panels/domain/interactor/SizedTilesResetInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/panels/domain/interactor/SizedTilesResetInteractorTest.kt @@ -28,7 +28,6 @@ import com.android.systemui.qs.pipeline.domain.interactor.currentTilesInteractor import com.android.systemui.qs.pipeline.shared.TileSpec import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Test @@ -47,7 +46,6 @@ class SizedTilesResetInteractorTest : SysuiTestCase() { } private val underTest = with(kosmos) { sizedTilesResetInteractor } - @OptIn(ExperimentalCoroutinesApi::class) @Test fun changeTiles_resetsCorrectly() { with(kosmos) { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/panels/ui/viewmodel/DetailsViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/panels/ui/viewmodel/DetailsViewModelTest.kt index c5d679f5df05..68a591dd075f 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/panels/ui/viewmodel/DetailsViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/panels/ui/viewmodel/DetailsViewModelTest.kt @@ -28,7 +28,6 @@ import com.android.systemui.qs.pipeline.domain.interactor.currentTilesInteractor import com.android.systemui.qs.pipeline.shared.TileSpec import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Before @@ -48,7 +47,6 @@ class DetailsViewModelTest : SysuiTestCase() { underTest = kosmos.detailsViewModel } - @OptIn(ExperimentalCoroutinesApi::class) @Test fun changeTileDetailsViewModel() = with(kosmos) { testScope.runTest { 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 bbfa7e7a81ee..50229eb4348d 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 @@ -62,7 +62,6 @@ import com.android.systemui.qs.tiles.viewmodel.qSTileConfigProvider import com.android.systemui.settings.userTracker import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.test.runCurrent @@ -501,7 +500,6 @@ class EditModeViewModelTest(flags: FlagsParameterization) : SysuiTestCase() { } } - @OptIn(ExperimentalCoroutinesApi::class) @Test fun currentTiles_moveTileDown() = with(kosmos) { @@ -527,7 +525,6 @@ class EditModeViewModelTest(flags: FlagsParameterization) : SysuiTestCase() { } } - @OptIn(ExperimentalCoroutinesApi::class) @Test fun currentTiles_moveTileUp() = with(kosmos) { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/panels/ui/viewmodel/MediaInRowInLandscapeViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/panels/ui/viewmodel/MediaInRowInLandscapeViewModelTest.kt index e686d4dde2f1..fdbf42c9afd8 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/panels/ui/viewmodel/MediaInRowInLandscapeViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/panels/ui/viewmodel/MediaInRowInLandscapeViewModelTest.kt @@ -36,7 +36,6 @@ import com.android.systemui.shade.shared.model.ShadeMode import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat import kotlin.test.Test -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Before @@ -44,7 +43,6 @@ import org.junit.runner.RunWith import platform.test.runner.parameterized.ParameterizedAndroidJunit4 import platform.test.runner.parameterized.Parameters -@OptIn(ExperimentalCoroutinesApi::class) @RunWith(ParameterizedAndroidJunit4::class) @SmallTest class MediaInRowInLandscapeViewModelTest(private val testData: TestData) : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/panels/ui/viewmodel/QuickQuickSettingsViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/panels/ui/viewmodel/QuickQuickSettingsViewModelTest.kt index 3d1265aec45e..69fc4cd45096 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/panels/ui/viewmodel/QuickQuickSettingsViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/panels/ui/viewmodel/QuickQuickSettingsViewModelTest.kt @@ -35,7 +35,6 @@ import com.android.systemui.qs.pipeline.shared.TileSpec import com.android.systemui.res.R 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 @@ -43,7 +42,6 @@ import org.junit.Before import org.junit.Test import org.junit.runner.RunWith -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class QuickQuickSettingsViewModelTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/pipeline/data/repository/AutoAddSettingsRepositoryTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/pipeline/data/repository/AutoAddSettingsRepositoryTest.kt index 1545e7444ffb..e1672ead0e9e 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/pipeline/data/repository/AutoAddSettingsRepositoryTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/pipeline/data/repository/AutoAddSettingsRepositoryTest.kt @@ -26,7 +26,6 @@ import com.android.systemui.qs.pipeline.shared.TileSpec import com.android.systemui.qs.pipeline.shared.logging.QSPipelineLogger import com.android.systemui.util.settings.FakeSettings import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.StandardTestDispatcher import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.runCurrent @@ -37,7 +36,6 @@ import org.junit.runner.RunWith import org.mockito.Mock import org.mockito.MockitoAnnotations -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @EnabledOnRavenwood @RunWith(AndroidJUnit4::class) diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/pipeline/data/repository/InstalledTilesComponentRepositoryImplTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/pipeline/data/repository/InstalledTilesComponentRepositoryImplTest.kt index a0dec8cb745d..0a8b1d195ece 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/pipeline/data/repository/InstalledTilesComponentRepositoryImplTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/pipeline/data/repository/InstalledTilesComponentRepositoryImplTest.kt @@ -43,7 +43,6 @@ import com.android.systemui.util.mockito.eq import com.android.systemui.util.mockito.mock import com.android.systemui.util.mockito.whenever import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Before @@ -53,7 +52,6 @@ import org.mockito.ArgumentMatchers.anyInt import org.mockito.Mock import org.mockito.MockitoAnnotations -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) @TestableLooper.RunWithLooper diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/pipeline/data/repository/QSSettingsRestoredBroadcastRepositoryTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/pipeline/data/repository/QSSettingsRestoredBroadcastRepositoryTest.kt index 39851b6f21a7..41b00bbaa1b2 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/pipeline/data/repository/QSSettingsRestoredBroadcastRepositoryTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/pipeline/data/repository/QSSettingsRestoredBroadcastRepositoryTest.kt @@ -10,7 +10,6 @@ import com.android.systemui.coroutines.collectLastValue import com.android.systemui.qs.pipeline.shared.logging.QSPipelineLogger import com.android.systemui.statusbar.policy.FakeDeviceProvisionedController import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.StandardTestDispatcher import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.runCurrent @@ -22,7 +21,6 @@ import org.mockito.Mock import org.mockito.MockitoAnnotations @SmallTest -@OptIn(ExperimentalCoroutinesApi::class) @RunWith(AndroidJUnit4::class) class QSSettingsRestoredBroadcastRepositoryTest : SysuiTestCase() { private val dispatcher = StandardTestDispatcher() diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/pipeline/data/repository/TileSpecSettingsRepositoryTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/pipeline/data/repository/TileSpecSettingsRepositoryTest.kt index 23056b2e1eab..88e3951cdf92 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/pipeline/data/repository/TileSpecSettingsRepositoryTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/pipeline/data/repository/TileSpecSettingsRepositoryTest.kt @@ -28,7 +28,6 @@ import com.android.systemui.res.R import com.android.systemui.retail.data.repository.FakeRetailModeRepository import com.android.systemui.util.settings.FakeSettings import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.StandardTestDispatcher import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.runCurrent @@ -42,7 +41,6 @@ import org.mockito.MockitoAnnotations @SmallTest @EnabledOnRavenwood @RunWith(AndroidJUnit4::class) -@OptIn(ExperimentalCoroutinesApi::class) class TileSpecSettingsRepositoryTest : SysuiTestCase() { private lateinit var secureSettings: FakeSettings diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/pipeline/data/repository/UserAutoAddRepositoryTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/pipeline/data/repository/UserAutoAddRepositoryTest.kt index 1ca3c0637824..88da9ae0debd 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/pipeline/data/repository/UserAutoAddRepositoryTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/pipeline/data/repository/UserAutoAddRepositoryTest.kt @@ -12,7 +12,6 @@ import com.android.systemui.qs.pipeline.shared.logging.QSPipelineLogger import com.android.systemui.util.settings.FakeSettings import com.google.common.truth.Truth import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.StandardTestDispatcher import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.runCurrent @@ -23,7 +22,6 @@ import org.junit.runner.RunWith import org.mockito.Mock import org.mockito.MockitoAnnotations -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @EnabledOnRavenwood @RunWith(AndroidJUnit4::class) diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/pipeline/data/repository/UserTileSpecRepositoryTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/pipeline/data/repository/UserTileSpecRepositoryTest.kt index b12fbc2066a2..502e179f62ec 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/pipeline/data/repository/UserTileSpecRepositoryTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/pipeline/data/repository/UserTileSpecRepositoryTest.kt @@ -11,7 +11,6 @@ import com.android.systemui.qs.pipeline.shared.TileSpec import com.android.systemui.qs.pipeline.shared.logging.QSPipelineLogger import com.android.systemui.util.settings.FakeSettings import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.coroutineScope import kotlinx.coroutines.test.StandardTestDispatcher import kotlinx.coroutines.test.TestScope @@ -25,7 +24,6 @@ import org.mockito.MockitoAnnotations @SmallTest @EnabledOnRavenwood -@OptIn(ExperimentalCoroutinesApi::class) @RunWith(AndroidJUnit4::class) class UserTileSpecRepositoryTest : SysuiTestCase() { private val secureSettings = FakeSettings() diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/pipeline/data/restoreprocessors/WorkTileRestoreProcessorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/pipeline/data/restoreprocessors/WorkTileRestoreProcessorTest.kt index 57bb77f46e40..5abcb0cb6954 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/pipeline/data/restoreprocessors/WorkTileRestoreProcessorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/pipeline/data/restoreprocessors/WorkTileRestoreProcessorTest.kt @@ -25,7 +25,6 @@ import com.android.systemui.coroutines.collectLastValue import com.android.systemui.qs.pipeline.data.model.RestoreData import com.android.systemui.qs.pipeline.shared.TileSpec import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Test @@ -34,7 +33,6 @@ import org.junit.runner.RunWith @SmallTest @EnabledOnRavenwood @RunWith(AndroidJUnit4::class) -@OptIn(ExperimentalCoroutinesApi::class) class WorkTileRestoreProcessorTest : SysuiTestCase() { private val underTest = WorkTileRestoreProcessor() diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/pipeline/domain/autoaddable/AutoAddableSettingTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/pipeline/domain/autoaddable/AutoAddableSettingTest.kt index 561902234990..b0fd7eb74c1d 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/pipeline/domain/autoaddable/AutoAddableSettingTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/pipeline/domain/autoaddable/AutoAddableSettingTest.kt @@ -29,12 +29,10 @@ import com.android.systemui.qs.pipeline.shared.TileSpec import com.android.systemui.testKosmos import com.android.systemui.util.settings.fakeSettings import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runTest import org.junit.Test import org.junit.runner.RunWith -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class AutoAddableSettingTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/pipeline/domain/autoaddable/CallbackControllerAutoAddableTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/pipeline/domain/autoaddable/CallbackControllerAutoAddableTest.kt index ea8d87358172..3be8e3faf333 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/pipeline/domain/autoaddable/CallbackControllerAutoAddableTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/pipeline/domain/autoaddable/CallbackControllerAutoAddableTest.kt @@ -26,7 +26,6 @@ import com.android.systemui.qs.pipeline.domain.model.AutoAddTracking import com.android.systemui.qs.pipeline.shared.TileSpec import com.android.systemui.statusbar.policy.CallbackController import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.channels.ProducerScope import kotlinx.coroutines.launch import kotlinx.coroutines.test.runCurrent @@ -34,7 +33,6 @@ import kotlinx.coroutines.test.runTest import org.junit.Test import org.junit.runner.RunWith -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @EnabledOnRavenwood @RunWith(AndroidJUnit4::class) diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/pipeline/domain/autoaddable/CastAutoAddableTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/pipeline/domain/autoaddable/CastAutoAddableTest.kt index 8ad647dd4d26..a2629844b626 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/pipeline/domain/autoaddable/CastAutoAddableTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/pipeline/domain/autoaddable/CastAutoAddableTest.kt @@ -29,7 +29,6 @@ import com.android.systemui.statusbar.policy.CastDevice import com.android.systemui.util.mockito.capture import com.android.systemui.util.mockito.whenever import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Before @@ -41,7 +40,6 @@ import org.mockito.Mock import org.mockito.Mockito.verify import org.mockito.MockitoAnnotations -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @EnabledOnRavenwood @RunWith(AndroidJUnit4::class) diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/pipeline/domain/autoaddable/DataSaverAutoAddableTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/pipeline/domain/autoaddable/DataSaverAutoAddableTest.kt index b925b27bfcc3..c5788b586f5e 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/pipeline/domain/autoaddable/DataSaverAutoAddableTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/pipeline/domain/autoaddable/DataSaverAutoAddableTest.kt @@ -27,7 +27,6 @@ import com.android.systemui.qs.tiles.DataSaverTile import com.android.systemui.statusbar.policy.DataSaverController import com.android.systemui.util.mockito.capture import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Before @@ -39,7 +38,6 @@ import org.mockito.Mock import org.mockito.Mockito.verify import org.mockito.MockitoAnnotations -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @EnabledOnRavenwood @RunWith(AndroidJUnit4::class) diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/pipeline/domain/autoaddable/DeviceControlsAutoAddableTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/pipeline/domain/autoaddable/DeviceControlsAutoAddableTest.kt index 188c6a949104..ac32fa82d463 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/pipeline/domain/autoaddable/DeviceControlsAutoAddableTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/pipeline/domain/autoaddable/DeviceControlsAutoAddableTest.kt @@ -28,7 +28,6 @@ import com.android.systemui.qs.tiles.DeviceControlsTile import com.android.systemui.statusbar.policy.DeviceControlsController import com.android.systemui.util.mockito.capture import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.collect import kotlinx.coroutines.launch import kotlinx.coroutines.test.runCurrent @@ -42,7 +41,6 @@ import org.mockito.Mock import org.mockito.Mockito.verify import org.mockito.MockitoAnnotations -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @EnabledOnRavenwood @RunWith(AndroidJUnit4::class) diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/pipeline/domain/autoaddable/HotspotAutoAddableTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/pipeline/domain/autoaddable/HotspotAutoAddableTest.kt index 02699ddad089..cc694d4a466f 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/pipeline/domain/autoaddable/HotspotAutoAddableTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/pipeline/domain/autoaddable/HotspotAutoAddableTest.kt @@ -27,7 +27,6 @@ import com.android.systemui.qs.tiles.HotspotTile import com.android.systemui.statusbar.policy.HotspotController import com.android.systemui.util.mockito.capture import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Before @@ -39,7 +38,6 @@ import org.mockito.Mock import org.mockito.Mockito.verify import org.mockito.MockitoAnnotations -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @EnabledOnRavenwood @RunWith(AndroidJUnit4::class) diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/pipeline/domain/autoaddable/NightDisplayAutoAddableTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/pipeline/domain/autoaddable/NightDisplayAutoAddableTest.kt index 20fd3601f9ef..ca7fa5f02b62 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/pipeline/domain/autoaddable/NightDisplayAutoAddableTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/pipeline/domain/autoaddable/NightDisplayAutoAddableTest.kt @@ -29,7 +29,6 @@ import com.android.systemui.qs.tiles.NightDisplayTile import com.android.systemui.util.mockito.capture import com.android.systemui.util.mockito.whenever import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.collect import kotlinx.coroutines.launch import kotlinx.coroutines.test.TestResult @@ -47,7 +46,6 @@ import org.mockito.Mockito.inOrder import org.mockito.Mockito.verify import org.mockito.MockitoAnnotations -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class NightDisplayAutoAddableTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/pipeline/domain/autoaddable/SafetyCenterAutoAddableTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/pipeline/domain/autoaddable/SafetyCenterAutoAddableTest.kt index 633e494b3195..9a3b0078c12e 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/pipeline/domain/autoaddable/SafetyCenterAutoAddableTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/pipeline/domain/autoaddable/SafetyCenterAutoAddableTest.kt @@ -33,7 +33,6 @@ import com.android.systemui.util.mockito.any import com.android.systemui.util.mockito.capture import com.android.systemui.util.mockito.whenever import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.collect import kotlinx.coroutines.launch import kotlinx.coroutines.test.StandardTestDispatcher @@ -50,7 +49,6 @@ import org.mockito.Mockito.never import org.mockito.Mockito.verify import org.mockito.MockitoAnnotations -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @EnabledOnRavenwood @RunWith(AndroidJUnit4::class) diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/pipeline/domain/autoaddable/WalletAutoAddableTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/pipeline/domain/autoaddable/WalletAutoAddableTest.kt index c5c76eb77152..d3fba4dc80e7 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/pipeline/domain/autoaddable/WalletAutoAddableTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/pipeline/domain/autoaddable/WalletAutoAddableTest.kt @@ -28,7 +28,6 @@ import com.android.systemui.qs.tiles.QuickAccessWalletTile import com.android.systemui.statusbar.policy.WalletController import com.android.systemui.util.mockito.whenever import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runTest import org.junit.Before import org.junit.Test @@ -36,7 +35,6 @@ import org.junit.runner.RunWith import org.mockito.Mock import org.mockito.MockitoAnnotations -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @EnabledOnRavenwood @RunWith(AndroidJUnit4::class) diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/pipeline/domain/autoaddable/WorkTileAutoAddableTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/pipeline/domain/autoaddable/WorkTileAutoAddableTest.kt index bf34d6ee4435..00490427f80b 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/pipeline/domain/autoaddable/WorkTileAutoAddableTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/pipeline/domain/autoaddable/WorkTileAutoAddableTest.kt @@ -37,14 +37,12 @@ import com.android.systemui.qs.pipeline.shared.TileSpec import com.android.systemui.qs.tiles.WorkModeTile import com.android.systemui.settings.FakeUserTracker import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Before import org.junit.Test import org.junit.runner.RunWith -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class WorkTileAutoAddableTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/pipeline/domain/interactor/AccessibilityTilesInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/pipeline/domain/interactor/AccessibilityTilesInteractorTest.kt index 6cd627c1d058..d9e2d82e5db6 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/pipeline/domain/interactor/AccessibilityTilesInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/pipeline/domain/interactor/AccessibilityTilesInteractorTest.kt @@ -32,7 +32,6 @@ import com.android.systemui.qs.tiles.ColorInversionTile import com.android.systemui.util.mockito.mock import com.android.systemui.util.mockito.whenever import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.test.StandardTestDispatcher import kotlinx.coroutines.test.TestScope @@ -45,7 +44,6 @@ import org.mockito.Mockito.mock @SmallTest @RunWith(AndroidJUnit4::class) -@OptIn(ExperimentalCoroutinesApi::class) class AccessibilityTilesInteractorTest : SysuiTestCase() { private val USER_0_INFO = UserInfo(0, "zero", "", UserInfo.FLAG_ADMIN or UserInfo.FLAG_FULL) diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/pipeline/domain/interactor/AutoAddInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/pipeline/domain/interactor/AutoAddInteractorTest.kt index 167eff193147..c83f2f4f6ab7 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/pipeline/domain/interactor/AutoAddInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/pipeline/domain/interactor/AutoAddInteractorTest.kt @@ -33,7 +33,6 @@ import com.android.systemui.qs.pipeline.shared.logging.QSPipelineLogger import com.android.systemui.util.mockito.any import com.android.systemui.util.mockito.whenever import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.runCurrent @@ -51,7 +50,6 @@ import org.mockito.MockitoAnnotations @SmallTest @EnabledOnRavenwood @RunWith(AndroidJUnit4::class) -@OptIn(ExperimentalCoroutinesApi::class) class AutoAddInteractorTest : SysuiTestCase() { private val testScope = TestScope() diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/pipeline/domain/interactor/CurrentTilesInteractorImplTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/pipeline/domain/interactor/CurrentTilesInteractorImplTest.kt index 090e2e9e19a9..9b50f1bd735d 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/pipeline/domain/interactor/CurrentTilesInteractorImplTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/pipeline/domain/interactor/CurrentTilesInteractorImplTest.kt @@ -57,7 +57,6 @@ import com.android.systemui.util.mockito.mock import com.android.systemui.util.mockito.whenever import com.google.common.truth.Truth.assertThat import com.google.protobuf.nano.MessageNano -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.StandardTestDispatcher import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.runCurrent @@ -74,7 +73,6 @@ import org.mockito.MockitoAnnotations @SmallTest @RunWith(AndroidJUnit4::class) -@OptIn(ExperimentalCoroutinesApi::class) class CurrentTilesInteractorImplTest : SysuiTestCase() { private val tileSpecRepository: TileSpecRepository = FakeTileSpecRepository() diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/pipeline/domain/interactor/NoLowNumberOfTilesTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/pipeline/domain/interactor/NoLowNumberOfTilesTest.kt index 00c720475fb1..3a9c3d066b23 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/pipeline/domain/interactor/NoLowNumberOfTilesTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/pipeline/domain/interactor/NoLowNumberOfTilesTest.kt @@ -40,7 +40,6 @@ import com.android.systemui.qs.qsTileFactory import com.android.systemui.settings.fakeUserTracker import com.android.systemui.settings.userTracker import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Before @@ -52,7 +51,6 @@ import org.junit.runner.RunWith * from a device that uses different specs for tiles, we may end up with empty (or mostly empty) QS. * In that case, we want to prepend the default tiles instead. */ -@OptIn(ExperimentalCoroutinesApi::class) @MediumTest @RunWith(AndroidJUnit4::class) class NoLowNumberOfTilesTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/pipeline/domain/interactor/WorkProfileAutoAddedAfterRestoreTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/pipeline/domain/interactor/WorkProfileAutoAddedAfterRestoreTest.kt index 6bcaea47cab1..9d9bfda99bd9 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/pipeline/domain/interactor/WorkProfileAutoAddedAfterRestoreTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/pipeline/domain/interactor/WorkProfileAutoAddedAfterRestoreTest.kt @@ -35,7 +35,6 @@ import com.android.systemui.qs.qsTileFactory import com.android.systemui.settings.fakeUserTracker import com.android.systemui.settings.userTracker 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 @@ -51,7 +50,6 @@ import org.junit.runner.RunWith */ @MediumTest @RunWith(AndroidJUnit4::class) -@OptIn(ExperimentalCoroutinesApi::class) class WorkProfileAutoAddedAfterRestoreTest : SysuiTestCase() { private val kosmos by lazy { Kosmos().apply { fakeUserTracker.set(listOf(USER_0_INFO), 0) } } diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/shared/QSSettingsPackageRepositoryTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/shared/QSSettingsPackageRepositoryTest.kt index 765c02afbb41..a727714a26ef 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/shared/QSSettingsPackageRepositoryTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/shared/QSSettingsPackageRepositoryTest.kt @@ -28,7 +28,6 @@ import com.android.systemui.kosmos.testScope import com.android.systemui.testKosmos import com.android.systemui.user.data.repository.fakeUserRepository import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Before @@ -42,7 +41,6 @@ import org.mockito.junit.MockitoJUnit import org.mockito.junit.MockitoRule import org.mockito.kotlin.whenever -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class QSSettingsPackageRepositoryTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/InternetTileNewImplTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/InternetTileNewImplTest.kt index 4c834b396df6..41d7e490ddc2 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/InternetTileNewImplTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/InternetTileNewImplTest.kt @@ -41,7 +41,6 @@ import com.android.systemui.qs.tiles.dialog.InternetDetailsViewModel import com.android.systemui.qs.tiles.dialog.InternetDialogManager import com.android.systemui.qs.tiles.dialog.WifiStateWorker import com.android.systemui.res.R -import com.android.systemui.shade.shared.flag.DualShade import com.android.systemui.statusbar.connectivity.AccessPointController import com.android.systemui.statusbar.notification.shared.NotificationThrottleHun import com.android.systemui.statusbar.pipeline.airplane.data.repository.FakeAirplaneModeRepository @@ -58,7 +57,6 @@ import com.android.systemui.statusbar.pipeline.wifi.shared.model.WifiNetworkMode import com.android.systemui.statusbar.pipeline.wifi.shared.model.WifiScanEntry import com.android.systemui.util.mockito.mock import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.StandardTestDispatcher import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.runCurrent @@ -76,7 +74,6 @@ import org.mockito.kotlin.whenever import platform.test.runner.parameterized.ParameterizedAndroidJunit4 import platform.test.runner.parameterized.Parameters -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWithLooper(setAsMainLooper = true) @RunWith(ParameterizedAndroidJunit4::class) @@ -147,7 +144,7 @@ class InternetTileNewImplTest(flags: FlagsParameterization) : SysuiTestCase() { dialogManager, wifiStateWorker, accessPointController, - internetDetailsViewModelFactory + internetDetailsViewModelFactory, ) underTest.initialize() @@ -297,7 +294,6 @@ class InternetTileNewImplTest(flags: FlagsParameterization) : SysuiTestCase() { FLAG_SCENE_CONTAINER, KeyguardWmStateRefactor.FLAG_NAME, NotificationThrottleHun.FLAG_NAME, - DualShade.FLAG_NAME, ] ) fun click_withQsDetailedViewEnabled() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/ModesTileTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/ModesTileTest.kt index 4aa01eac72a8..bbc0dbcad355 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/ModesTileTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/ModesTileTest.kt @@ -56,7 +56,6 @@ import com.android.systemui.util.mockito.any import com.android.systemui.util.settings.FakeSettings import com.android.systemui.util.settings.SecureSettings import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.After @@ -67,7 +66,6 @@ import org.mockito.Mock import org.mockito.MockitoAnnotations import org.mockito.kotlin.whenever -@OptIn(ExperimentalCoroutinesApi::class) @EnableFlags(android.app.Flags.FLAG_MODES_UI) @SmallTest @RunWith(AndroidJUnit4::class) diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/base/viewmodel/QSTileViewModelImplTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/base/viewmodel/QSTileViewModelImplTest.kt index c47a412e226a..fba615121a39 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/base/viewmodel/QSTileViewModelImplTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/base/viewmodel/QSTileViewModelImplTest.kt @@ -37,7 +37,6 @@ 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.test.StandardTestDispatcher import kotlinx.coroutines.test.TestScope @@ -53,7 +52,6 @@ import org.mockito.junit.MockitoRule @SmallTest @RunWith(AndroidJUnit4::class) -@OptIn(ExperimentalCoroutinesApi::class) class QSTileViewModelImplTest : SysuiTestCase() { @get:Rule val mockitoRule: MockitoRule = MockitoJUnit.rule() diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/airplane/domain/interactor/AirplaneModeTileDataInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/airplane/domain/interactor/AirplaneModeTileDataInteractorTest.kt index 67e2fba30822..fda75ca76cec 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/airplane/domain/interactor/AirplaneModeTileDataInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/airplane/domain/interactor/AirplaneModeTileDataInteractorTest.kt @@ -26,7 +26,6 @@ import com.android.systemui.qs.tiles.base.interactor.DataUpdateTrigger import com.android.systemui.qs.tiles.impl.airplane.domain.model.AirplaneModeTileModel import com.android.systemui.statusbar.pipeline.airplane.data.repository.FakeAirplaneModeRepository import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.flow.toCollection import kotlinx.coroutines.test.runCurrent @@ -34,7 +33,6 @@ import kotlinx.coroutines.test.runTest import org.junit.Test import org.junit.runner.RunWith -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @EnabledOnRavenwood @RunWith(AndroidJUnit4::class) diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/alarm/domain/interactor/AlarmTileDataInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/alarm/domain/interactor/AlarmTileDataInteractorTest.kt index 990d74728052..afbc3e810743 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/alarm/domain/interactor/AlarmTileDataInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/alarm/domain/interactor/AlarmTileDataInteractorTest.kt @@ -32,7 +32,6 @@ import com.android.systemui.util.mockito.whenever import com.android.systemui.util.time.DateFormatUtil import com.android.systemui.utils.leaks.FakeNextAlarmController import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.flow.toCollection import kotlinx.coroutines.test.runCurrent @@ -41,7 +40,6 @@ import org.junit.Before import org.junit.Test import org.junit.runner.RunWith -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class AlarmTileDataInteractorTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/battery/doman/interactor/BatterySaverTileDataInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/battery/doman/interactor/BatterySaverTileDataInteractorTest.kt index c80eb135f1a5..44c175ab7156 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/battery/doman/interactor/BatterySaverTileDataInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/battery/doman/interactor/BatterySaverTileDataInteractorTest.kt @@ -29,7 +29,6 @@ import com.android.systemui.qs.tiles.base.interactor.DataUpdateTrigger import com.android.systemui.qs.tiles.impl.battery.domain.interactor.BatterySaverTileDataInteractor import com.android.systemui.utils.leaks.FakeBatteryController import com.google.common.truth.Truth -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.flow.toCollection import kotlinx.coroutines.test.runCurrent @@ -37,7 +36,6 @@ import kotlinx.coroutines.test.runTest import org.junit.Test import org.junit.runner.RunWith -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @EnabledOnRavenwood @RunWith(AndroidJUnit4::class) diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/colorcorrection/domain/interactor/ColorCorrectionTileDataInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/colorcorrection/domain/interactor/ColorCorrectionTileDataInteractorTest.kt index abaf808f3f91..4c156b77132b 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/colorcorrection/domain/interactor/ColorCorrectionTileDataInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/colorcorrection/domain/interactor/ColorCorrectionTileDataInteractorTest.kt @@ -26,7 +26,6 @@ import com.android.systemui.coroutines.collectValues import com.android.systemui.qs.tiles.base.interactor.DataUpdateTrigger import com.android.systemui.qs.tiles.impl.colorcorrection.domain.model.ColorCorrectionTileModel import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.flow.toCollection import kotlinx.coroutines.test.runCurrent @@ -34,7 +33,6 @@ import kotlinx.coroutines.test.runTest import org.junit.Test import org.junit.runner.RunWith -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @EnabledOnRavenwood @RunWith(AndroidJUnit4::class) diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/custom/CustomTileDefaultsRepositoryTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/custom/CustomTileDefaultsRepositoryTest.kt index 89ba69fce9ad..10530a25b06e 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/custom/CustomTileDefaultsRepositoryTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/custom/CustomTileDefaultsRepositoryTest.kt @@ -32,7 +32,6 @@ import com.android.systemui.util.mockito.any import com.android.systemui.util.mockito.eq import com.android.systemui.util.mockito.whenever import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.Job import kotlinx.coroutines.flow.first import kotlinx.coroutines.flow.launchIn @@ -50,7 +49,6 @@ import org.mockito.MockitoAnnotations @SmallTest @RunWith(AndroidJUnit4::class) -@OptIn(ExperimentalCoroutinesApi::class) class CustomTileDefaultsRepositoryTest : SysuiTestCase() { @Mock private lateinit var sysuiContext: Context diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/custom/CustomTilePackageUpdatesRepositoryTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/custom/CustomTilePackageUpdatesRepositoryTest.kt index 2eeb75e3443b..835dba21ce05 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/custom/CustomTilePackageUpdatesRepositoryTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/custom/CustomTilePackageUpdatesRepositoryTest.kt @@ -35,7 +35,6 @@ import com.android.systemui.util.mockito.capture import com.android.systemui.util.mockito.eq import com.android.systemui.util.mockito.nullable import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.launchIn import kotlinx.coroutines.test.StandardTestDispatcher import kotlinx.coroutines.test.TestScope @@ -50,7 +49,6 @@ import org.mockito.Mock import org.mockito.Mockito.verify import org.mockito.MockitoAnnotations -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) @SuppressLint("UnspecifiedRegisterReceiverFlag") // Not needed in the test diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/custom/data/repository/CustomTileRepositoryTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/custom/data/repository/CustomTileRepositoryTest.kt index c9869bdbf049..83e61d1b36bf 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/custom/data/repository/CustomTileRepositoryTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/custom/data/repository/CustomTileRepositoryTest.kt @@ -35,7 +35,6 @@ import com.android.systemui.qs.tiles.impl.custom.customTileStatePersister import com.android.systemui.qs.tiles.impl.custom.data.entity.CustomTileDefaults import com.android.systemui.qs.tiles.impl.custom.packageManagerAdapterFacade import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.first import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest @@ -44,7 +43,6 @@ import org.junit.runner.RunWith @SmallTest @RunWith(AndroidJUnit4::class) -@OptIn(ExperimentalCoroutinesApi::class) class CustomTileRepositoryTest : SysuiTestCase() { private val kosmos = Kosmos().apply { customTileSpec = TileSpec.create(TEST_COMPONENT) } diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/custom/domain/interactor/CustomTileDataInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/custom/domain/interactor/CustomTileDataInteractorTest.kt index b5aaadcb7e0c..2cc3678c2065 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/custom/domain/interactor/CustomTileDataInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/custom/domain/interactor/CustomTileDataInteractorTest.kt @@ -45,7 +45,6 @@ import com.android.systemui.testKosmos import com.android.systemui.user.data.repository.fakeUserRepository import com.android.systemui.user.data.repository.userRepository import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.flow.launchIn import kotlinx.coroutines.test.runCurrent @@ -55,7 +54,6 @@ import org.junit.runner.RunWith @SmallTest @RunWith(AndroidJUnit4::class) -@OptIn(ExperimentalCoroutinesApi::class) class CustomTileDataInteractorTest : SysuiTestCase() { private val kosmos = diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/custom/domain/interactor/CustomTileInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/custom/domain/interactor/CustomTileInteractorTest.kt index 33299d9ce74c..a317dc525df9 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/custom/domain/interactor/CustomTileInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/custom/domain/interactor/CustomTileInteractorTest.kt @@ -36,7 +36,6 @@ import com.android.systemui.qs.tiles.impl.custom.customTileStatePersister import com.android.systemui.qs.tiles.impl.custom.data.entity.CustomTileDefaults import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.first import kotlinx.coroutines.launch import kotlinx.coroutines.test.advanceTimeBy @@ -47,7 +46,6 @@ import org.junit.runner.RunWith @SmallTest @RunWith(AndroidJUnit4::class) -@OptIn(ExperimentalCoroutinesApi::class) class CustomTileInteractorTest : SysuiTestCase() { private val kosmos = testKosmos().apply { customTileSpec = TileSpec.create(TEST_COMPONENT) } diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/flashlight/domain/interactor/FlashlightTileDataInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/flashlight/domain/interactor/FlashlightTileDataInteractorTest.kt index c5a8c70330a7..d42eb5ebc9ab 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/flashlight/domain/interactor/FlashlightTileDataInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/flashlight/domain/interactor/FlashlightTileDataInteractorTest.kt @@ -28,7 +28,6 @@ import com.android.systemui.qs.tiles.base.interactor.DataUpdateTrigger import com.android.systemui.qs.tiles.impl.flashlight.domain.model.FlashlightTileModel import com.android.systemui.utils.leaks.FakeFlashlightController import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest @@ -36,7 +35,6 @@ import org.junit.Before import org.junit.Test import org.junit.runner.RunWith -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @EnabledOnRavenwood @RunWith(AndroidJUnit4::class) diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/fontscaling/domain/interactor/FontScalingTileDataInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/fontscaling/domain/interactor/FontScalingTileDataInteractorTest.kt index 39bc8a6fa6a2..cd825045de44 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/fontscaling/domain/interactor/FontScalingTileDataInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/fontscaling/domain/interactor/FontScalingTileDataInteractorTest.kt @@ -24,14 +24,12 @@ import com.android.systemui.coroutines.collectLastValue import com.android.systemui.coroutines.collectValues import com.android.systemui.qs.tiles.base.interactor.DataUpdateTrigger import com.google.common.truth.Truth -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Test import org.junit.runner.RunWith -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class FontScalingTileDataInteractorTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/hearingdevices/domain/interactor/HearingDevicesTileDataInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/hearingdevices/domain/interactor/HearingDevicesTileDataInteractorTest.kt index 9099d3d911bc..4b9d11d2f706 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/hearingdevices/domain/interactor/HearingDevicesTileDataInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/hearingdevices/domain/interactor/HearingDevicesTileDataInteractorTest.kt @@ -30,7 +30,6 @@ import com.android.systemui.qs.tiles.base.interactor.DataUpdateTrigger import com.android.systemui.qs.tiles.impl.hearingdevices.domain.model.HearingDevicesTileModel import com.android.systemui.statusbar.policy.fakeBluetoothController import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest @@ -43,7 +42,6 @@ import org.mockito.junit.MockitoJUnit import org.mockito.junit.MockitoRule import org.mockito.kotlin.whenever -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @EnabledOnRavenwood @RunWith(AndroidJUnit4::class) 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 5259aa84b193..63607f1edd59 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 @@ -57,14 +57,12 @@ import com.android.systemui.statusbar.policy.data.repository.FakeUserSetupReposi import com.android.systemui.util.CarrierConfigTracker import com.android.systemui.util.mockito.mock import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.test.runTest import org.junit.Before import org.junit.Test import org.junit.runner.RunWith -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class InternetTileDataInteractorTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/inversion/domain/interactor/ColorInversionTileDataInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/inversion/domain/interactor/ColorInversionTileDataInteractorTest.kt index 75b07eedab95..228e99305926 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/inversion/domain/interactor/ColorInversionTileDataInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/inversion/domain/interactor/ColorInversionTileDataInteractorTest.kt @@ -26,7 +26,6 @@ import com.android.systemui.coroutines.collectValues import com.android.systemui.qs.tiles.base.interactor.DataUpdateTrigger import com.android.systemui.qs.tiles.impl.inversion.domain.model.ColorInversionTileModel import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.flow.toCollection import kotlinx.coroutines.test.runCurrent @@ -34,7 +33,6 @@ import kotlinx.coroutines.test.runTest import org.junit.Test import org.junit.runner.RunWith -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @EnabledOnRavenwood @RunWith(AndroidJUnit4::class) diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/irecording/IssueRecordingDataInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/irecording/IssueRecordingDataInteractorTest.kt index f3fc0ab92c84..7562ac00e4a6 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/irecording/IssueRecordingDataInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/irecording/IssueRecordingDataInteractorTest.kt @@ -31,7 +31,6 @@ import com.android.systemui.settings.fakeUserFileManager import com.android.systemui.settings.userTracker import com.android.systemui.util.settings.fakeGlobalSettings import com.google.common.truth.Truth -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest @@ -64,7 +63,6 @@ class IssueRecordingDataInteractorTest : SysuiTestCase() { underTest = IssueRecordingDataInteractor(state, kosmos.testScope.testScheduler) } - @OptIn(ExperimentalCoroutinesApi::class) @Test fun emitsEvent_whenIsRecordingStatusChanges_correctly() { kosmos.testScope.runTest { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/location/interactor/LocationTileDataInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/location/interactor/LocationTileDataInteractorTest.kt index 9adf57ac458a..52ce95b1d742 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/location/interactor/LocationTileDataInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/location/interactor/LocationTileDataInteractorTest.kt @@ -29,7 +29,6 @@ import com.android.systemui.qs.tiles.impl.location.domain.interactor.LocationTil import com.android.systemui.qs.tiles.impl.location.domain.model.LocationTileModel import com.android.systemui.utils.leaks.FakeLocationController import com.google.common.truth.Truth -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest @@ -37,7 +36,6 @@ import org.junit.Before import org.junit.Test import org.junit.runner.RunWith -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @EnabledOnRavenwood @RunWith(AndroidJUnit4::class) diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/modes/domain/interactor/ModesTileDataInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/modes/domain/interactor/ModesTileDataInteractorTest.kt index 029a2f91a4ba..0b641cee29a2 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/modes/domain/interactor/ModesTileDataInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/modes/domain/interactor/ModesTileDataInteractorTest.kt @@ -40,7 +40,6 @@ import com.android.systemui.statusbar.policy.data.repository.fakeZenModeReposito import com.android.systemui.statusbar.policy.domain.interactor.zenModeInteractor import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.flow.toCollection import kotlinx.coroutines.test.runCurrent @@ -49,7 +48,6 @@ import org.junit.Before import org.junit.Test import org.junit.runner.RunWith -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class ModesTileDataInteractorTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/modes/domain/interactor/ModesTileUserActionInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/modes/domain/interactor/ModesTileUserActionInteractorTest.kt index b57dc377b465..24e4279642d8 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/modes/domain/interactor/ModesTileUserActionInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/modes/domain/interactor/ModesTileUserActionInteractorTest.kt @@ -14,8 +14,6 @@ * limitations under the License. */ -@file:OptIn(ExperimentalCoroutinesApi::class) - package com.android.systemui.qs.tiles.impl.modes.domain.interactor import android.graphics.drawable.TestStubDrawable @@ -42,7 +40,6 @@ import com.android.systemui.statusbar.policy.ui.dialog.mockModesDialogDelegate import com.android.systemui.statusbar.policy.ui.dialog.modesDialogEventLogger import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runTest import org.junit.Test import org.junit.runner.RunWith diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/notes/domain/interactor/NotesTileDataInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/notes/domain/interactor/NotesTileDataInteractorTest.kt index 35d6d5adc3f4..4786fc40562a 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/notes/domain/interactor/NotesTileDataInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/notes/domain/interactor/NotesTileDataInteractorTest.kt @@ -28,7 +28,6 @@ import com.android.systemui.kosmos.Kosmos import com.android.systemui.kosmos.testScope import com.android.systemui.qs.tiles.base.interactor.DataUpdateTrigger import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.flow.toCollection import kotlinx.coroutines.test.runCurrent @@ -36,7 +35,6 @@ import kotlinx.coroutines.test.runTest import org.junit.Test import org.junit.runner.RunWith -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class NotesTileDataInteractorTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/onehanded/domain/interactor/OneHandedModeTileDataInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/onehanded/domain/interactor/OneHandedModeTileDataInteractorTest.kt index 0761ee734830..59eb069a5f3b 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/onehanded/domain/interactor/OneHandedModeTileDataInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/onehanded/domain/interactor/OneHandedModeTileDataInteractorTest.kt @@ -27,14 +27,12 @@ import com.android.systemui.qs.tiles.base.interactor.DataUpdateTrigger import com.android.systemui.qs.tiles.impl.onehanded.domain.OneHandedModeTileDataInteractor import com.android.wm.shell.onehanded.OneHanded import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Test import org.junit.runner.RunWith -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class OneHandedModeTileDataInteractorTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/reducebrightness/domain/interactor/ReduceBrightColorsTileDataInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/reducebrightness/domain/interactor/ReduceBrightColorsTileDataInteractorTest.kt index a5f98a739b49..dc3248d42d62 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/reducebrightness/domain/interactor/ReduceBrightColorsTileDataInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/reducebrightness/domain/interactor/ReduceBrightColorsTileDataInteractorTest.kt @@ -28,14 +28,12 @@ import com.android.systemui.kosmos.testScope import com.android.systemui.qs.tiles.base.interactor.DataUpdateTrigger import com.android.systemui.qs.tiles.impl.reducebrightness.domain.model.ReduceBrightColorsTileModel import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Test import org.junit.runner.RunWith -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @EnabledOnRavenwood @RunWith(AndroidJUnit4::class) diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/rotation/domain/interactor/RotationLockTileDataInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/rotation/domain/interactor/RotationLockTileDataInteractorTest.kt index 266875e9e12a..283fa601f8df 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/rotation/domain/interactor/RotationLockTileDataInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/rotation/domain/interactor/RotationLockTileDataInteractorTest.kt @@ -36,7 +36,6 @@ import com.android.systemui.util.mockito.whenever import com.android.systemui.utils.leaks.FakeBatteryController import com.android.systemui.utils.leaks.FakeRotationLockController import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.flow.toCollection import kotlinx.coroutines.test.runCurrent @@ -45,7 +44,6 @@ import org.junit.Before import org.junit.Test import org.junit.runner.RunWith -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @EnabledOnRavenwood @RunWith(AndroidJUnit4::class) diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/saver/domain/interactor/DataSaverTileDataInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/saver/domain/interactor/DataSaverTileDataInteractorTest.kt index daee22d0c45c..c286ea7a5062 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/saver/domain/interactor/DataSaverTileDataInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/saver/domain/interactor/DataSaverTileDataInteractorTest.kt @@ -28,14 +28,12 @@ import com.android.systemui.qs.tiles.base.interactor.DataUpdateTrigger import com.android.systemui.qs.tiles.impl.saver.domain.model.DataSaverTileModel import com.android.systemui.utils.leaks.FakeDataSaverController import com.google.common.truth.Truth -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Test import org.junit.runner.RunWith -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @EnabledOnRavenwood @RunWith(AndroidJUnit4::class) diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/screenrecord/domain/interactor/ScreenRecordTileDataInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/screenrecord/domain/interactor/ScreenRecordTileDataInteractorTest.kt index 28f2a43c8f14..41174e7ca6af 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/screenrecord/domain/interactor/ScreenRecordTileDataInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/screenrecord/domain/interactor/ScreenRecordTileDataInteractorTest.kt @@ -28,14 +28,12 @@ import com.android.systemui.qs.tiles.base.interactor.DataUpdateTrigger import com.android.systemui.screenrecord.data.model.ScreenRecordModel import com.android.systemui.screenrecord.data.repository.screenRecordRepository import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Test import org.junit.runner.RunWith -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @EnabledOnRavenwood @RunWith(AndroidJUnit4::class) diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/sensorprivacy/domain/interactor/SensorPrivacyToggleTileDataInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/sensorprivacy/domain/interactor/SensorPrivacyToggleTileDataInteractorTest.kt index d0cd56fce778..6c7bb1b46c36 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/sensorprivacy/domain/interactor/SensorPrivacyToggleTileDataInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/sensorprivacy/domain/interactor/SensorPrivacyToggleTileDataInteractorTest.kt @@ -32,7 +32,6 @@ import com.android.systemui.util.mockito.argumentCaptor import com.android.systemui.util.mockito.mock import com.android.systemui.util.mockito.whenever import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.flow.toCollection import kotlinx.coroutines.test.runCurrent @@ -42,7 +41,6 @@ import org.junit.runner.RunWith import org.mockito.ArgumentMatchers.eq import org.mockito.Mockito.verify -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class SensorPrivacyToggleTileDataInteractorTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/uimodenight/domain/UiModeNightTileDataInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/uimodenight/domain/UiModeNightTileDataInteractorTest.kt index 46e1609b02ad..96538b730354 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/uimodenight/domain/UiModeNightTileDataInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/uimodenight/domain/UiModeNightTileDataInteractorTest.kt @@ -39,7 +39,6 @@ import com.android.systemui.utils.leaks.FakeBatteryController import com.android.systemui.utils.leaks.FakeLocationController import com.google.common.truth.Truth.assertThat import java.time.LocalTime -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest @@ -49,7 +48,6 @@ import org.junit.runner.RunWith import org.mockito.Mock import org.mockito.Mockito.verify -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class UiModeNightTileDataInteractorTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/viewmodel/QSTileViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/viewmodel/QSTileViewModelTest.kt index 2edb9c60711b..0598a8b9d058 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/viewmodel/QSTileViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/viewmodel/QSTileViewModelTest.kt @@ -37,7 +37,6 @@ import com.android.systemui.user.data.repository.FakeUserRepository import com.android.systemui.util.mockito.eq import com.android.systemui.util.time.FakeSystemClock import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.launchIn import kotlinx.coroutines.test.StandardTestDispatcher import kotlinx.coroutines.test.TestScope @@ -53,7 +52,6 @@ import org.mockito.MockitoAnnotations @MediumTest @EnabledOnRavenwood @RunWith(AndroidJUnit4::class) -@OptIn(ExperimentalCoroutinesApi::class) class QSTileViewModelTest : SysuiTestCase() { @Mock private lateinit var qsTileLogger: QSTileLogger diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/viewmodel/QSTileViewModelUserInputTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/viewmodel/QSTileViewModelUserInputTest.kt index 0219a4c58dcf..ece21e1bef66 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/viewmodel/QSTileViewModelUserInputTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/viewmodel/QSTileViewModelUserInputTest.kt @@ -37,7 +37,6 @@ import com.android.systemui.util.mockito.any import com.android.systemui.util.mockito.eq import com.android.systemui.util.time.FakeSystemClock import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.launchIn import kotlinx.coroutines.test.StandardTestDispatcher import kotlinx.coroutines.test.TestScope @@ -54,7 +53,6 @@ import org.mockito.MockitoAnnotations /** Tests all possible [QSTileUserAction]s. If you need */ @MediumTest @RunWith(AndroidJUnit4::class) -@OptIn(ExperimentalCoroutinesApi::class) class QSTileViewModelUserInputTest : SysuiTestCase() { @Mock private lateinit var qsTileLogger: QSTileLogger diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/ui/adapter/QSSceneAdapterImplTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/ui/adapter/QSSceneAdapterImplTest.kt index 8769022f3aa8..a8b005fb6554 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/ui/adapter/QSSceneAdapterImplTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/ui/adapter/QSSceneAdapterImplTest.kt @@ -39,7 +39,7 @@ import com.android.systemui.qs.dagger.QSComponent import com.android.systemui.qs.dagger.QSSceneComponent import com.android.systemui.settings.brightness.MirrorController import com.android.systemui.shade.data.repository.fakeShadeRepository -import com.android.systemui.shade.domain.interactor.shadeInteractor +import com.android.systemui.shade.domain.interactor.shadeModeInteractor import com.android.systemui.util.mockito.any import com.android.systemui.util.mockito.argumentCaptor import com.android.systemui.util.mockito.capture @@ -50,7 +50,6 @@ import com.android.systemui.util.mockito.whenever import com.google.common.truth.Truth.assertThat import java.util.Locale import javax.inject.Provider -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Test @@ -64,7 +63,6 @@ import org.mockito.Mockito.verify @SmallTest @RunWith(AndroidJUnit4::class) -@OptIn(ExperimentalCoroutinesApi::class) class QSSceneAdapterImplTest : SysuiTestCase() { private val kosmos = Kosmos().apply { testCase = this@QSSceneAdapterImplTest } @@ -118,16 +116,14 @@ class QSSceneAdapterImplTest : SysuiTestCase() { } } - private val shadeInteractor = kosmos.shadeInteractor - private val displayStateInteractor = kosmos.displayStateInteractor private val dumpManager = mock<DumpManager>() private val underTest = QSSceneAdapterImpl( qsSceneComponentFactory, qsImplProvider, - shadeInteractor, - displayStateInteractor, + kosmos.shadeModeInteractor, + kosmos.displayStateInteractor, dumpManager, testDispatcher, testScope.backgroundScope, diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/ui/viewmodel/QuickSettingsSceneContentViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/ui/viewmodel/QuickSettingsSceneContentViewModelTest.kt index cc94005a418c..b36c111904b9 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/ui/viewmodel/QuickSettingsSceneContentViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/ui/viewmodel/QuickSettingsSceneContentViewModelTest.kt @@ -39,13 +39,14 @@ import com.android.systemui.scene.shared.model.Scenes import com.android.systemui.settings.brightness.ui.viewmodel.brightnessMirrorViewModelFactory import com.android.systemui.shade.data.repository.shadeRepository import com.android.systemui.shade.domain.interactor.disableDualShade -import com.android.systemui.shade.domain.interactor.shadeInteractor +import com.android.systemui.shade.domain.interactor.shadeModeInteractor import com.android.systemui.shade.ui.viewmodel.shadeHeaderViewModelFactory import com.android.systemui.testKosmos import com.android.systemui.util.mockito.any import com.android.systemui.util.mockito.mock import com.android.systemui.util.mockito.whenever import com.google.common.truth.Truth.assertThat +import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Before @@ -54,6 +55,7 @@ import org.junit.runner.RunWith import org.mockito.Mockito.times import org.mockito.Mockito.verify +@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) @RunWithLooper @@ -72,7 +74,6 @@ class QuickSettingsSceneContentViewModelTest : SysuiTestCase() { private val sceneContainerStartable = kosmos.sceneContainerStartable private val sceneInteractor by lazy { kosmos.sceneInteractor } - private val shadeInteractor by lazy { kosmos.shadeInteractor } private lateinit var underTest: QuickSettingsSceneContentViewModel @@ -89,7 +90,7 @@ class QuickSettingsSceneContentViewModelTest : SysuiTestCase() { footerActionsViewModelFactory = footerActionsViewModelFactory, footerActionsController = footerActionsController, mediaCarouselInteractor = kosmos.mediaCarouselInteractor, - shadeInteractor = shadeInteractor, + shadeModeInteractor = kosmos.shadeModeInteractor, sceneInteractor = sceneInteractor, ) underTest.activateIn(testScope) diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/ui/viewmodel/QuickSettingsShadeOverlayContentViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/ui/viewmodel/QuickSettingsShadeOverlayContentViewModelTest.kt index b532554f5dfd..ec0596515efd 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/ui/viewmodel/QuickSettingsShadeOverlayContentViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/ui/viewmodel/QuickSettingsShadeOverlayContentViewModelTest.kt @@ -42,7 +42,6 @@ import com.android.systemui.statusbar.notification.stack.shared.model.ShadeScrim import com.android.systemui.statusbar.notification.stack.ui.viewmodel.notificationScrollViewModel 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 @@ -50,7 +49,6 @@ import org.junit.Before import org.junit.Test import org.junit.runner.RunWith -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) @TestableLooper.RunWithLooper diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/retail/data/repository/RetailModeSettingsRepositoryTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/retail/data/repository/RetailModeSettingsRepositoryTest.kt index 47bfda41c7ad..0d03247bcf59 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/retail/data/repository/RetailModeSettingsRepositoryTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/retail/data/repository/RetailModeSettingsRepositoryTest.kt @@ -24,7 +24,6 @@ import com.android.systemui.coroutines.collectLastValue import com.android.systemui.retail.data.repository.impl.RetailModeSettingsRepository import com.android.systemui.util.settings.FakeGlobalSettings import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.StandardTestDispatcher import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.runCurrent @@ -32,7 +31,6 @@ import kotlinx.coroutines.test.runTest import org.junit.Test import org.junit.runner.RunWith -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class RetailModeSettingsRepositoryTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/SceneFrameworkIntegrationTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/SceneFrameworkIntegrationTest.kt index 3187cca6ca45..c5fac08a4b35 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/SceneFrameworkIntegrationTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/SceneFrameworkIntegrationTest.kt @@ -14,8 +14,6 @@ * limitations under the License. */ -@file:OptIn(ExperimentalCoroutinesApi::class) - package com.android.systemui.scene import android.provider.Settings @@ -70,7 +68,6 @@ import com.android.systemui.util.settings.data.repository.userAwareSecureSetting import com.android.telecom.mockTelecomManager import com.google.common.truth.Truth.assertThat import com.google.common.truth.Truth.assertWithMessage -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.Job import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.flowOf @@ -98,7 +95,6 @@ import org.junit.runner.RunWith * being used when the state is as required (e.g. cannot unlock an already unlocked device, cannot * put to sleep a device that's already asleep, etc.). */ -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) @RunWithLooper diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/data/repository/SceneContainerRepositoryTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/data/repository/SceneContainerRepositoryTest.kt index 227b3a610188..4c6ab8b70ca3 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/data/repository/SceneContainerRepositoryTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/data/repository/SceneContainerRepositoryTest.kt @@ -14,8 +14,6 @@ * limitations under the License. */ -@file:OptIn(ExperimentalCoroutinesApi::class) - package com.android.systemui.scene.data.repository import androidx.test.ext.junit.runners.AndroidJUnit4 @@ -31,7 +29,6 @@ import com.android.systemui.scene.sceneKeys import com.android.systemui.scene.shared.model.Scenes import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.test.runTest diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/domain/interactor/SceneBackInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/domain/interactor/SceneBackInteractorTest.kt index 405cfd38d49a..9cc6c0fa801a 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/domain/interactor/SceneBackInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/domain/interactor/SceneBackInteractorTest.kt @@ -14,8 +14,6 @@ * limitations under the License. */ -@file:OptIn(ExperimentalCoroutinesApi::class) - package com.android.systemui.scene.domain.interactor import androidx.test.ext.junit.runners.AndroidJUnit4 @@ -35,7 +33,6 @@ import com.android.systemui.scene.shared.model.Scenes import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat import com.google.common.truth.Truth.assertWithMessage -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/domain/interactor/SceneContainerOcclusionInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/domain/interactor/SceneContainerOcclusionInteractorTest.kt index 707cd0493e36..0192b5bc6ac0 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/domain/interactor/SceneContainerOcclusionInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/domain/interactor/SceneContainerOcclusionInteractorTest.kt @@ -14,8 +14,6 @@ * limitations under the License. */ -@file:OptIn(ExperimentalCoroutinesApi::class) - package com.android.systemui.scene.domain.interactor import androidx.test.ext.junit.runners.AndroidJUnit4 @@ -41,7 +39,6 @@ import com.android.systemui.testKosmos import com.android.systemui.util.mockito.mock import com.google.common.truth.Truth.assertThat import com.google.common.truth.Truth.assertWithMessage -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.test.TestScope diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/domain/interactor/SceneInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/domain/interactor/SceneInteractorTest.kt index de54e75281aa..fd485edec117 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/domain/interactor/SceneInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/domain/interactor/SceneInteractorTest.kt @@ -14,8 +14,6 @@ * limitations under the License. */ -@file:OptIn(ExperimentalCoroutinesApi::class) - package com.android.systemui.scene.domain.interactor import android.app.StatusBarManager @@ -50,7 +48,6 @@ import com.android.systemui.statusbar.disableflags.data.repository.fakeDisableFl import com.android.systemui.statusbar.disableflags.shared.model.DisableFlagsModel import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.first import kotlinx.coroutines.flow.flowOf diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/domain/startable/KeyguardStateCallbackStartableTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/domain/startable/KeyguardStateCallbackStartableTest.kt index 695edafefdf3..590aaeec5f87 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/domain/startable/KeyguardStateCallbackStartableTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/domain/startable/KeyguardStateCallbackStartableTest.kt @@ -14,8 +14,6 @@ * limitations under the License. */ -@file:OptIn(ExperimentalCoroutinesApi::class) - package com.android.systemui.scene.domain.startable import android.content.pm.UserInfo @@ -37,7 +35,6 @@ import com.android.systemui.testKosmos import com.android.systemui.user.data.repository.fakeUserRepository import com.google.common.truth.Truth.assertThat import com.google.common.truth.Truth.assertWithMessage -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/domain/startable/SceneContainerStartableTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/domain/startable/SceneContainerStartableTest.kt index 5648c62fb439..33733103053e 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/domain/startable/SceneContainerStartableTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/domain/startable/SceneContainerStartableTest.kt @@ -14,8 +14,6 @@ * limitations under the License. */ -@file:OptIn(ExperimentalCoroutinesApi::class) - package com.android.systemui.scene.domain.startable import android.app.StatusBarManager @@ -124,7 +122,6 @@ import com.android.systemui.util.mockito.mock import com.android.systemui.util.settings.data.repository.userAwareSecureSettingsRepository import com.google.android.msdl.data.model.MSDLToken import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.flow.map diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/domain/startable/ScrimStartableTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/domain/startable/ScrimStartableTest.kt index 0e90afe2ebcd..572bc4dc4247 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/domain/startable/ScrimStartableTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/domain/startable/ScrimStartableTest.kt @@ -14,8 +14,6 @@ * limitations under the License. */ -@file:OptIn(ExperimentalCoroutinesApi::class) - package com.android.systemui.scene.domain.startable import androidx.test.filters.SmallTest @@ -47,7 +45,6 @@ import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat import com.google.common.truth.Truth.assertWithMessage import kotlin.reflect.full.memberProperties -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.runCurrent diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/domain/startable/StatusBarStartableTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/domain/startable/StatusBarStartableTest.kt index 9601f20add8e..99146d8b1267 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/domain/startable/StatusBarStartableTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/domain/startable/StatusBarStartableTest.kt @@ -14,8 +14,6 @@ * limitations under the License. */ -@file:OptIn(ExperimentalCoroutinesApi::class) - package com.android.systemui.scene.domain.startable import android.app.StatusBarManager @@ -49,7 +47,6 @@ import com.android.systemui.util.fakeDeviceConfigProxy import com.google.common.truth.Truth.assertThat import com.google.common.truth.Truth.assertWithMessage import kotlin.reflect.full.memberProperties -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/ui/viewmodel/GoneUserActionsViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/ui/viewmodel/GoneUserActionsViewModelTest.kt index 048dd66ae1da..0647db40e483 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/ui/viewmodel/GoneUserActionsViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/ui/viewmodel/GoneUserActionsViewModelTest.kt @@ -33,17 +33,15 @@ import com.android.systemui.scene.shared.model.TransitionKeys.ToSplitShade import com.android.systemui.shade.domain.interactor.enableDualShade import com.android.systemui.shade.domain.interactor.enableSingleShade import com.android.systemui.shade.domain.interactor.enableSplitShade -import com.android.systemui.shade.domain.interactor.shadeInteractor +import com.android.systemui.shade.domain.interactor.shadeModeInteractor import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Before import org.junit.Test import org.junit.runner.RunWith -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) @TestableLooper.RunWithLooper @@ -56,7 +54,7 @@ class GoneUserActionsViewModelTest : SysuiTestCase() { @Before fun setUp() { - underTest = GoneUserActionsViewModel(shadeInteractor = kosmos.shadeInteractor) + underTest = GoneUserActionsViewModel(shadeModeInteractor = kosmos.shadeModeInteractor) underTest.activateIn(testScope) } diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/ui/viewmodel/SceneContainerHapticsViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/ui/viewmodel/SceneContainerHapticsViewModelTest.kt index ef87eb3554aa..7330b517ba67 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/ui/viewmodel/SceneContainerHapticsViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/ui/viewmodel/SceneContainerHapticsViewModelTest.kt @@ -42,7 +42,6 @@ import com.android.systemui.shade.domain.interactor.enableDualShade import com.android.systemui.testKosmos import com.google.android.msdl.data.model.MSDLToken import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.test.runCurrent @@ -55,7 +54,6 @@ import org.mockito.kotlin.mock import org.mockito.kotlin.verify import org.mockito.kotlin.verifyNoMoreInteractions -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) @EnableSceneContainer 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 399b48fb2fb9..30d9f73d7441 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 @@ -14,8 +14,6 @@ * limitations under the License. */ -@file:OptIn(ExperimentalCoroutinesApi::class) - package com.android.systemui.scene.ui.viewmodel import android.view.MotionEvent @@ -42,7 +40,7 @@ import com.android.systemui.scene.shared.model.fakeSceneDataSource import com.android.systemui.shade.domain.interactor.enableDualShade import com.android.systemui.shade.domain.interactor.enableSingleShade import com.android.systemui.shade.domain.interactor.enableSplitShade -import com.android.systemui.shade.domain.interactor.shadeInteractor +import com.android.systemui.shade.domain.interactor.shadeMode import com.android.systemui.shade.shared.model.ShadeMode import com.android.systemui.statusbar.data.repository.fakeRemoteInputRepository import com.android.systemui.testKosmos @@ -50,7 +48,6 @@ import com.android.systemui.util.mockito.mock import com.android.systemui.util.mockito.whenever import com.google.common.truth.Truth.assertThat import com.google.common.truth.Truth.assertWithMessage -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.Job import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest @@ -58,7 +55,6 @@ import org.junit.Before import org.junit.Test import org.junit.runner.RunWith -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) @EnableSceneContainer @@ -324,7 +320,7 @@ class SceneContainerViewModelTest : SysuiTestCase() { @Test fun edgeDetector_singleShade_usesDefaultEdgeDetector() = testScope.runTest { - val shadeMode by collectLastValue(kosmos.shadeInteractor.shadeMode) + val shadeMode by collectLastValue(kosmos.shadeMode) kosmos.enableSingleShade() assertThat(shadeMode).isEqualTo(ShadeMode.Single) @@ -334,7 +330,7 @@ class SceneContainerViewModelTest : SysuiTestCase() { @Test fun edgeDetector_splitShade_usesDefaultEdgeDetector() = testScope.runTest { - val shadeMode by collectLastValue(kosmos.shadeInteractor.shadeMode) + val shadeMode by collectLastValue(kosmos.shadeMode) kosmos.enableSplitShade() assertThat(shadeMode).isEqualTo(ShadeMode.Split) @@ -344,7 +340,7 @@ class SceneContainerViewModelTest : SysuiTestCase() { @Test fun edgeDetector_dualShade_narrowScreen_usesSplitEdgeDetector() = testScope.runTest { - val shadeMode by collectLastValue(kosmos.shadeInteractor.shadeMode) + val shadeMode by collectLastValue(kosmos.shadeMode) kosmos.enableDualShade(wideLayout = false) assertThat(shadeMode).isEqualTo(ShadeMode.Dual) @@ -354,7 +350,7 @@ class SceneContainerViewModelTest : SysuiTestCase() { @Test fun edgeDetector_dualShade_wideScreen_usesSplitEdgeDetector() = testScope.runTest { - val shadeMode by collectLastValue(kosmos.shadeInteractor.shadeMode) + val shadeMode by collectLastValue(kosmos.shadeMode) kosmos.enableDualShade(wideLayout = true) assertThat(shadeMode).isEqualTo(ShadeMode.Dual) diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/ui/viewmodel/UserActionsViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/ui/viewmodel/UserActionsViewModelTest.kt index d5f57da40e5a..c42a46c0490e 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/ui/viewmodel/UserActionsViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/ui/viewmodel/UserActionsViewModelTest.kt @@ -14,8 +14,6 @@ * limitations under the License. */ -@file:OptIn(ExperimentalCoroutinesApi::class) - package com.android.systemui.scene.ui.viewmodel import androidx.test.ext.junit.runners.AndroidJUnit4 @@ -31,7 +29,6 @@ import com.android.systemui.lifecycle.activateIn import com.android.systemui.scene.shared.model.Scenes import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.Job import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.test.runCurrent diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/screenrecord/data/repository/ScreenRecordRepositoryTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/screenrecord/data/repository/ScreenRecordRepositoryTest.kt index ade5941d010d..9724974e3044 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/screenrecord/data/repository/ScreenRecordRepositoryTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/screenrecord/data/repository/ScreenRecordRepositoryTest.kt @@ -26,7 +26,6 @@ import com.android.systemui.kosmos.testScope import com.android.systemui.screenrecord.RecordingController import com.android.systemui.screenrecord.data.model.ScreenRecordModel import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Test @@ -38,7 +37,6 @@ import org.mockito.kotlin.verify import org.mockito.kotlin.whenever @SmallTest -@OptIn(ExperimentalCoroutinesApi::class) @RunWith(AndroidJUnit4::class) class ScreenRecordRepositoryTest : SysuiTestCase() { private val kosmos = Kosmos() diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/MessageContainerControllerTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/MessageContainerControllerTest.kt index 4000d6cde2fd..0da01fc4e07c 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/MessageContainerControllerTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/MessageContainerControllerTest.kt @@ -16,7 +16,6 @@ import com.android.systemui.util.mockito.any import com.android.systemui.util.mockito.eq import com.android.systemui.util.mockito.whenever import junit.framework.Assert.assertEquals -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.UnconfinedTestDispatcher import kotlinx.coroutines.test.runTest @@ -53,7 +52,6 @@ class MessageContainerControllerTest : SysuiTestCase() { lateinit var workProfileData: WorkProfileMessageController.WorkProfileFirstRunData @Before - @ExperimentalCoroutinesApi fun setup() { MockitoAnnotations.initMocks(this) messageContainer = diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/ScreenshotSoundControllerTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/ScreenshotSoundControllerTest.kt index 5987e74e02ec..ccf419f844f6 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/ScreenshotSoundControllerTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/screenshot/ScreenshotSoundControllerTest.kt @@ -23,7 +23,6 @@ import com.android.systemui.SysuiTestCase import com.android.systemui.util.mockito.mock import com.android.systemui.util.mockito.whenever import java.lang.IllegalStateException -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.UnconfinedTestDispatcher import kotlinx.coroutines.test.advanceUntilIdle @@ -35,7 +34,6 @@ import org.mockito.Mockito.never import org.mockito.Mockito.verify @SmallTest -@OptIn(ExperimentalCoroutinesApi::class) @RunWith(AndroidJUnit4::class) class ScreenshotSoundControllerTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/NotificationShadeWindowViewTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/NotificationShadeWindowViewTest.kt index 93d1f593e81f..72a57831e61a 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/NotificationShadeWindowViewTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/NotificationShadeWindowViewTest.kt @@ -75,7 +75,6 @@ import com.android.systemui.util.time.FakeSystemClock import com.android.systemui.window.ui.viewmodel.WindowRootViewModel import com.google.common.truth.Truth.assertThat import java.util.Optional -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.emptyFlow import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.UnconfinedTestDispatcher @@ -93,7 +92,6 @@ import org.mockito.Mockito.verify import org.mockito.MockitoAnnotations import org.mockito.kotlin.eq -@ExperimentalCoroutinesApi @RunWith(AndroidJUnit4::class) @RunWithLooper(setAsMainLooper = true) @SmallTest diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/QuickSettingsControllerImplWithCoroutinesTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/QuickSettingsControllerImplWithCoroutinesTest.kt index ee3f8016c410..6b5f17678f9e 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/QuickSettingsControllerImplWithCoroutinesTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/QuickSettingsControllerImplWithCoroutinesTest.kt @@ -21,7 +21,6 @@ import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest import com.android.systemui.statusbar.disableflags.shared.model.DisableFlagsModel import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.cancelChildren import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest @@ -29,7 +28,6 @@ import org.junit.Test import org.junit.runner.RunWith @SmallTest -@OptIn(ExperimentalCoroutinesApi::class) @RunWith(AndroidJUnit4::class) class QuickSettingsControllerImplWithCoroutinesTest : QuickSettingsControllerImplBaseTest() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/ShadeControllerSceneImplTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/ShadeControllerSceneImplTest.kt index 420418b60d07..054c1b8207eb 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/ShadeControllerSceneImplTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/ShadeControllerSceneImplTest.kt @@ -37,7 +37,6 @@ import com.android.systemui.shade.domain.interactor.shadeInteractor import com.android.systemui.statusbar.CommandQueue import com.android.systemui.util.mockito.mock import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.runCurrent @@ -49,7 +48,6 @@ import org.mockito.Mockito.never import org.mockito.Mockito.times import org.mockito.Mockito.verify -@ExperimentalCoroutinesApi @SmallTest @RunWith(AndroidJUnit4::class) @EnableSceneContainer diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/ShadeDisplayChangeLatencyTrackerTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/ShadeDisplayChangeLatencyTrackerTest.kt index 56356b4489f8..487f2c7dbd25 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/ShadeDisplayChangeLatencyTrackerTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/ShadeDisplayChangeLatencyTrackerTest.kt @@ -27,7 +27,6 @@ import com.android.systemui.kosmos.useUnconfinedTestDispatcher import com.android.systemui.testKosmos import kotlin.test.Test import kotlin.time.Duration.Companion.seconds -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.advanceTimeBy import kotlinx.coroutines.test.runTest import org.junit.runner.RunWith @@ -61,7 +60,6 @@ class ShadeDisplayChangeLatencyTrackerTest : SysuiTestCase() { verify(latencyTracker).onActionEnd(any()) } - @OptIn(ExperimentalCoroutinesApi::class) @Test fun onChange_doFrameTimesOut_previousCancelled() = testScope.runTest { @@ -77,7 +75,6 @@ class ShadeDisplayChangeLatencyTrackerTest : SysuiTestCase() { verify(latencyTracker).onActionCancel(any()) } - @OptIn(ExperimentalCoroutinesApi::class) @Test fun onChange_onMovedToDisplayTimesOut_cancelled() = testScope.runTest { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/data/repository/PrivacyChipRepositoryTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/data/repository/PrivacyChipRepositoryTest.kt index 613f256113f3..2f455267c7c0 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/data/repository/PrivacyChipRepositoryTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/data/repository/PrivacyChipRepositoryTest.kt @@ -36,7 +36,6 @@ import com.android.systemui.util.mockito.kotlinArgumentCaptor import com.android.systemui.util.mockito.whenever import com.android.systemui.util.mockito.withArgCaptor import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Before @@ -47,7 +46,6 @@ import org.mockito.Mockito.times import org.mockito.Mockito.verify import org.mockito.MockitoAnnotations.initMocks -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class PrivacyChipRepositoryTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/domain/interactor/PanelExpansionInteractorImplTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/domain/interactor/PanelExpansionInteractorImplTest.kt index ba559b59c92e..1859e250c6ad 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/domain/interactor/PanelExpansionInteractorImplTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/domain/interactor/PanelExpansionInteractorImplTest.kt @@ -14,8 +14,6 @@ * limitations under the License. */ -@file:OptIn(ExperimentalCoroutinesApi::class) - package com.android.systemui.shade.domain.interactor import androidx.test.ext.junit.runners.AndroidJUnit4 @@ -39,7 +37,6 @@ import com.android.systemui.scene.shared.model.Scenes import com.android.systemui.scene.shared.model.fakeSceneDataSource import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.test.TestScope diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/domain/interactor/PrivacyChipInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/domain/interactor/PrivacyChipInteractorTest.kt index f0293a8efc8a..14f0a45d8700 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/domain/interactor/PrivacyChipInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/domain/interactor/PrivacyChipInteractorTest.kt @@ -33,7 +33,6 @@ import com.android.systemui.testKosmos import com.android.systemui.util.mockito.any import com.android.systemui.util.mockito.whenever import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Before @@ -44,7 +43,6 @@ import org.mockito.Mockito.never import org.mockito.Mockito.verify import org.mockito.MockitoAnnotations.initMocks -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class PrivacyChipInteractorTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/domain/interactor/ShadeAnimationInteractorSceneContainerImplTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/domain/interactor/ShadeAnimationInteractorSceneContainerImplTest.kt index b917014d4798..ca039ad02d8c 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/domain/interactor/ShadeAnimationInteractorSceneContainerImplTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/domain/interactor/ShadeAnimationInteractorSceneContainerImplTest.kt @@ -26,7 +26,6 @@ import com.android.systemui.scene.domain.interactor.sceneInteractor import com.android.systemui.scene.shared.model.Scenes import com.android.systemui.testKosmos import com.google.common.truth.Truth -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.test.runCurrent @@ -34,7 +33,6 @@ import kotlinx.coroutines.test.runTest import org.junit.Test import org.junit.runner.RunWith -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class ShadeAnimationInteractorSceneContainerImplTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/domain/interactor/ShadeBackActionInteractorImplTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/domain/interactor/ShadeBackActionInteractorImplTest.kt index fa4da42fb958..61777a4f4b0f 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/domain/interactor/ShadeBackActionInteractorImplTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/domain/interactor/ShadeBackActionInteractorImplTest.kt @@ -35,7 +35,6 @@ import com.android.systemui.scene.shared.model.Scenes import com.android.systemui.shared.recents.utilities.Utilities import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.launchIn import kotlinx.coroutines.test.TestScope @@ -46,7 +45,6 @@ import org.junit.Before import org.junit.Test import org.junit.runner.RunWith -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) @EnableSceneContainer 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 da652c4e1b5e..4ee62001bdf4 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 @@ -47,7 +47,6 @@ import com.android.systemui.user.data.model.UserSwitcherSettingsModel import com.android.systemui.user.data.repository.fakeUserRepository import com.android.systemui.util.mockito.whenever import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Before @@ -56,7 +55,6 @@ import org.junit.runner.RunWith import platform.test.runner.parameterized.ParameterizedAndroidJunit4 import platform.test.runner.parameterized.Parameters -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(ParameterizedAndroidJunit4::class) class ShadeInteractorImplTest(flags: FlagsParameterization) : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/domain/interactor/ShadeInteractorLegacyImplTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/domain/interactor/ShadeInteractorLegacyImplTest.kt index 238a1c1348b5..1e46f784ff8d 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/domain/interactor/ShadeInteractorLegacyImplTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/domain/interactor/ShadeInteractorLegacyImplTest.kt @@ -32,14 +32,12 @@ import com.android.systemui.shade.shadeTestUtil import com.android.systemui.testKosmos import com.android.systemui.user.data.repository.fakeUserRepository import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Assert.assertThrows import org.junit.Test import org.junit.runner.RunWith -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) @DisableSceneContainer diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/domain/interactor/ShadeInteractorSceneContainerImplTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/domain/interactor/ShadeInteractorSceneContainerImplTest.kt index 5c9cf82574a1..508836e3b48b 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/domain/interactor/ShadeInteractorSceneContainerImplTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/domain/interactor/ShadeInteractorSceneContainerImplTest.kt @@ -35,7 +35,6 @@ import com.android.systemui.shade.shadeTestUtil import com.android.systemui.shade.shared.model.ShadeMode import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.test.TestScope @@ -44,7 +43,6 @@ import kotlinx.coroutines.test.runTest import org.junit.Test import org.junit.runner.RunWith -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) @EnableSceneContainer @@ -597,7 +595,7 @@ class ShadeInteractorSceneContainerImplTest : SysuiTestCase() { fun expandNotificationsShade_dualShade_opensOverlay() = testScope.runTest { kosmos.enableDualShade() - val shadeMode by collectLastValue(kosmos.shadeModeInteractor.shadeMode) + val shadeMode by collectLastValue(kosmos.shadeMode) val currentScene by collectLastValue(sceneInteractor.currentScene) val currentOverlays by collectLastValue(sceneInteractor.currentOverlays) assertThat(shadeMode).isEqualTo(ShadeMode.Dual) @@ -614,7 +612,7 @@ class ShadeInteractorSceneContainerImplTest : SysuiTestCase() { fun expandNotificationsShade_singleShade_switchesToShadeScene() = testScope.runTest { kosmos.enableSingleShade() - val shadeMode by collectLastValue(kosmos.shadeModeInteractor.shadeMode) + val shadeMode by collectLastValue(kosmos.shadeMode) val currentScene by collectLastValue(sceneInteractor.currentScene) val currentOverlays by collectLastValue(sceneInteractor.currentOverlays) assertThat(shadeMode).isEqualTo(ShadeMode.Single) @@ -631,7 +629,7 @@ class ShadeInteractorSceneContainerImplTest : SysuiTestCase() { fun expandNotificationsShade_dualShadeQuickSettingsOpen_replacesOverlay() = testScope.runTest { kosmos.enableDualShade() - val shadeMode by collectLastValue(kosmos.shadeModeInteractor.shadeMode) + val shadeMode by collectLastValue(kosmos.shadeMode) val currentScene by collectLastValue(sceneInteractor.currentScene) val currentOverlays by collectLastValue(sceneInteractor.currentOverlays) assertThat(shadeMode).isEqualTo(ShadeMode.Dual) @@ -649,7 +647,7 @@ class ShadeInteractorSceneContainerImplTest : SysuiTestCase() { fun expandQuickSettingsShade_dualShade_opensOverlay() = testScope.runTest { kosmos.enableDualShade() - val shadeMode by collectLastValue(kosmos.shadeModeInteractor.shadeMode) + val shadeMode by collectLastValue(kosmos.shadeMode) val currentScene by collectLastValue(sceneInteractor.currentScene) val currentOverlays by collectLastValue(sceneInteractor.currentOverlays) assertThat(shadeMode).isEqualTo(ShadeMode.Dual) @@ -666,7 +664,7 @@ class ShadeInteractorSceneContainerImplTest : SysuiTestCase() { fun expandQuickSettingsShade_singleShade_switchesToQuickSettingsScene() = testScope.runTest { kosmos.enableSingleShade() - val shadeMode by collectLastValue(kosmos.shadeModeInteractor.shadeMode) + val shadeMode by collectLastValue(kosmos.shadeMode) val currentScene by collectLastValue(sceneInteractor.currentScene) val currentOverlays by collectLastValue(sceneInteractor.currentOverlays) assertThat(shadeMode).isEqualTo(ShadeMode.Single) @@ -683,7 +681,7 @@ class ShadeInteractorSceneContainerImplTest : SysuiTestCase() { fun expandQuickSettingsShade_splitShade_switchesToShadeScene() = testScope.runTest { kosmos.enableSplitShade() - val shadeMode by collectLastValue(kosmos.shadeModeInteractor.shadeMode) + val shadeMode by collectLastValue(kosmos.shadeMode) val currentScene by collectLastValue(sceneInteractor.currentScene) val currentOverlays by collectLastValue(sceneInteractor.currentOverlays) assertThat(shadeMode).isEqualTo(ShadeMode.Split) @@ -700,7 +698,7 @@ class ShadeInteractorSceneContainerImplTest : SysuiTestCase() { fun expandQuickSettingsShade_dualShadeNotificationsOpen_replacesOverlay() = testScope.runTest { kosmos.enableDualShade() - val shadeMode by collectLastValue(kosmos.shadeModeInteractor.shadeMode) + val shadeMode by collectLastValue(kosmos.shadeMode) val currentScene by collectLastValue(sceneInteractor.currentScene) val currentOverlays by collectLastValue(sceneInteractor.currentOverlays) assertThat(shadeMode).isEqualTo(ShadeMode.Dual) @@ -732,7 +730,7 @@ class ShadeInteractorSceneContainerImplTest : SysuiTestCase() { fun collapseNotificationsShade_singleShade_switchesToLockscreen() = testScope.runTest { kosmos.enableSingleShade() - val shadeMode by collectLastValue(kosmos.shadeModeInteractor.shadeMode) + val shadeMode by collectLastValue(kosmos.shadeMode) val currentScene by collectLastValue(sceneInteractor.currentScene) val currentOverlays by collectLastValue(sceneInteractor.currentOverlays) assertThat(shadeMode).isEqualTo(ShadeMode.Single) @@ -764,7 +762,7 @@ class ShadeInteractorSceneContainerImplTest : SysuiTestCase() { fun collapseQuickSettingsShadeNotBypassingShade_singleShade_switchesToShade() = testScope.runTest { kosmos.enableSingleShade() - val shadeMode by collectLastValue(kosmos.shadeModeInteractor.shadeMode) + val shadeMode by collectLastValue(kosmos.shadeMode) val currentScene by collectLastValue(sceneInteractor.currentScene) val currentOverlays by collectLastValue(sceneInteractor.currentOverlays) assertThat(shadeMode).isEqualTo(ShadeMode.Single) @@ -786,7 +784,7 @@ class ShadeInteractorSceneContainerImplTest : SysuiTestCase() { fun collapseQuickSettingsShadeNotBypassingShade_splitShade_switchesToLockscreen() = testScope.runTest { kosmos.enableSplitShade() - val shadeMode by collectLastValue(kosmos.shadeModeInteractor.shadeMode) + val shadeMode by collectLastValue(kosmos.shadeMode) val currentScene by collectLastValue(sceneInteractor.currentScene) val currentOverlays by collectLastValue(sceneInteractor.currentOverlays) assertThat(shadeMode).isEqualTo(ShadeMode.Split) @@ -808,7 +806,7 @@ class ShadeInteractorSceneContainerImplTest : SysuiTestCase() { fun collapseQuickSettingsShadeBypassingShade_singleShade_switchesToLockscreen() = testScope.runTest { kosmos.enableSingleShade() - val shadeMode by collectLastValue(kosmos.shadeModeInteractor.shadeMode) + val shadeMode by collectLastValue(kosmos.shadeMode) val currentScene by collectLastValue(sceneInteractor.currentScene) val currentOverlays by collectLastValue(sceneInteractor.currentOverlays) assertThat(shadeMode).isEqualTo(ShadeMode.Single) @@ -844,7 +842,7 @@ class ShadeInteractorSceneContainerImplTest : SysuiTestCase() { } private fun TestScope.openShade(overlay: OverlayKey) { - val shadeMode by collectLastValue(kosmos.shadeModeInteractor.shadeMode) + val shadeMode by collectLastValue(kosmos.shadeMode) val isAnyExpanded by collectLastValue(underTest.isAnyExpanded) val currentScene by collectLastValue(sceneInteractor.currentScene) val currentOverlays by collectLastValue(sceneInteractor.currentOverlays) diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/domain/startable/ShadeStartableTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/domain/startable/ShadeStartableTest.kt index 0406c3e69b54..b8f66acf6413 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/domain/startable/ShadeStartableTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/domain/startable/ShadeStartableTest.kt @@ -39,7 +39,7 @@ import com.android.systemui.shade.ShadeExpansionChangeEvent import com.android.systemui.shade.ShadeExpansionListener import com.android.systemui.shade.domain.interactor.disableDualShade import com.android.systemui.shade.domain.interactor.enableDualShade -import com.android.systemui.shade.domain.interactor.shadeInteractor +import com.android.systemui.shade.domain.interactor.shadeMode import com.android.systemui.shade.shared.model.ShadeMode import com.android.systemui.statusbar.notification.stack.notificationStackScrollLayoutController import com.android.systemui.statusbar.phone.scrimController @@ -48,7 +48,6 @@ import com.android.systemui.util.mockito.any import com.android.systemui.util.mockito.mock import com.android.systemui.util.mockito.whenever import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.test.TestScope @@ -60,13 +59,11 @@ import org.mockito.kotlin.verify import platform.test.runner.parameterized.ParameterizedAndroidJunit4 import platform.test.runner.parameterized.Parameters -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(ParameterizedAndroidJunit4::class) class ShadeStartableTest(flags: FlagsParameterization) : SysuiTestCase() { private val kosmos = testKosmos() private val testScope = kosmos.testScope - private val shadeInteractor by lazy { kosmos.shadeInteractor } private val sceneInteractor by lazy { kosmos.sceneInteractor } private val shadeExpansionStateManager by lazy { kosmos.shadeExpansionStateManager } private val fakeConfigurationRepository by lazy { kosmos.fakeConfigurationRepository } @@ -91,7 +88,7 @@ class ShadeStartableTest(flags: FlagsParameterization) : SysuiTestCase() { testScope.runTest { overrideResource(R.bool.config_use_split_notification_shade, false) kosmos.disableDualShade() - val shadeMode by collectLastValue(shadeInteractor.shadeMode) + val shadeMode by collectLastValue(kosmos.shadeMode) underTest.start() assertThat(shadeMode).isEqualTo(ShadeMode.Single) @@ -110,7 +107,7 @@ class ShadeStartableTest(flags: FlagsParameterization) : SysuiTestCase() { testScope.runTest { overrideResource(R.bool.config_use_split_notification_shade, false) kosmos.enableDualShade() - val shadeMode by collectLastValue(shadeInteractor.shadeMode) + val shadeMode by collectLastValue(kosmos.shadeMode) underTest.start() assertThat(shadeMode).isEqualTo(ShadeMode.Dual) diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/ui/viewmodel/NotificationShadeWindowModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/ui/viewmodel/NotificationShadeWindowModelTest.kt index f5022b9cff8b..2038adcfc21f 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/ui/viewmodel/NotificationShadeWindowModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/ui/viewmodel/NotificationShadeWindowModelTest.kt @@ -35,14 +35,12 @@ import com.android.systemui.scene.domain.interactor.sceneInteractor import com.android.systemui.scene.shared.model.Scenes import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Test import org.junit.runner.RunWith -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class NotificationShadeWindowModelTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/ui/viewmodel/ShadeHeaderViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/ui/viewmodel/ShadeHeaderViewModelTest.kt index d08c8a7c5974..061e04ef29f7 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/ui/viewmodel/ShadeHeaderViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/ui/viewmodel/ShadeHeaderViewModelTest.kt @@ -31,7 +31,6 @@ import com.android.systemui.statusbar.pipeline.mobile.domain.interactor.fakeMobi import com.android.systemui.testKosmos import com.android.systemui.util.mockito.argThat import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.runCurrent @@ -44,7 +43,6 @@ import org.mockito.ArgumentMatchers.anyInt import org.mockito.Mockito.verify import org.mockito.MockitoAnnotations -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) @EnableSceneContainer diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/ui/viewmodel/ShadeSceneContentViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/ui/viewmodel/ShadeSceneContentViewModelTest.kt index 27faeb8574a8..623a0ebcaf2f 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/ui/viewmodel/ShadeSceneContentViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/ui/viewmodel/ShadeSceneContentViewModelTest.kt @@ -46,7 +46,6 @@ import com.android.systemui.testKosmos import com.android.systemui.unfold.fakeUnfoldTransitionProgressProvider import com.google.common.truth.Truth.assertThat import java.util.Locale -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.combine import kotlinx.coroutines.flow.update @@ -57,7 +56,6 @@ import org.junit.Before import org.junit.Test import org.junit.runner.RunWith -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) @TestableLooper.RunWithLooper diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/ui/viewmodel/ShadeUserActionsViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/ui/viewmodel/ShadeUserActionsViewModelTest.kt index 8f904f7fe132..9a4f8ea8ea28 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/ui/viewmodel/ShadeUserActionsViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/ui/viewmodel/ShadeUserActionsViewModelTest.kt @@ -51,7 +51,6 @@ import com.android.systemui.shade.domain.startable.shadeStartable import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat import com.google.common.truth.Truth.assertWithMessage -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.runCurrent @@ -60,7 +59,6 @@ import org.junit.Before import org.junit.Test import org.junit.runner.RunWith -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) @TestableLooper.RunWithLooper diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/shared/condition/ConditionExtensionsTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/shared/condition/ConditionExtensionsTest.kt index 6b2c4b260806..4bd02e0fab22 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/shared/condition/ConditionExtensionsTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/shared/condition/ConditionExtensionsTest.kt @@ -4,7 +4,6 @@ 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 kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.MutableSharedFlow import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.emptyFlow @@ -16,7 +15,6 @@ import org.junit.Before import org.junit.Test import org.junit.runner.RunWith -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class ConditionExtensionsTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/NotificationShadeDepthControllerTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/NotificationShadeDepthControllerTest.kt index a79f4085ec6d..d2ea62da0940 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/NotificationShadeDepthControllerTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/NotificationShadeDepthControllerTest.kt @@ -29,10 +29,12 @@ import com.android.systemui.Flags import com.android.systemui.SysuiTestCase import com.android.systemui.animation.ShadeInterpolation import com.android.systemui.dump.DumpManager +import com.android.systemui.keyguard.domain.interactor.KeyguardInteractor import com.android.systemui.kosmos.testScope import com.android.systemui.plugins.statusbar.StatusBarStateController import com.android.systemui.res.R import com.android.systemui.shade.ShadeExpansionChangeEvent +import com.android.systemui.shared.Flags as SharedFlags import com.android.systemui.statusbar.phone.BiometricUnlockController import com.android.systemui.statusbar.phone.DozeParameters import com.android.systemui.statusbar.phone.ScrimController @@ -80,6 +82,7 @@ class NotificationShadeDepthControllerTest : SysuiTestCase() { @Mock private lateinit var blurUtils: BlurUtils @Mock private lateinit var biometricUnlockController: BiometricUnlockController @Mock private lateinit var keyguardStateController: KeyguardStateController + @Mock private lateinit var keyguardInteractor: KeyguardInteractor @Mock private lateinit var choreographer: Choreographer @Mock private lateinit var wallpaperController: WallpaperController @Mock private lateinit var notificationShadeWindowController: NotificationShadeWindowController @@ -123,6 +126,7 @@ class NotificationShadeDepthControllerTest : SysuiTestCase() { blurUtils, biometricUnlockController, keyguardStateController, + keyguardInteractor, choreographer, wallpaperController, notificationShadeWindowController, @@ -308,6 +312,7 @@ class NotificationShadeDepthControllerTest : SysuiTestCase() { } @Test + @DisableFlags(SharedFlags.FLAG_AMBIENT_AOD) fun onDozeAmountChanged_appliesBlur() { statusBarStateListener.onDozeAmountChanged(1f, 1f) notificationShadeDepthController.updateBlurCallback.doFrame(0) @@ -315,6 +320,14 @@ class NotificationShadeDepthControllerTest : SysuiTestCase() { } @Test + @EnableFlags(SharedFlags.FLAG_AMBIENT_AOD) + fun onDozeAmountChanged_doesNotApplyBlurWithAmbientAod() { + statusBarStateListener.onDozeAmountChanged(1f, 1f) + notificationShadeDepthController.updateBlurCallback.doFrame(0) + verify(blurUtils).applyBlur(any(), eq(0), eq(false)) + } + + @Test fun setFullShadeTransition_appliesBlur_onlyIfSupported() { reset(blurUtils) `when`(blurUtils.blurRadiusOfRatio(anyFloat())).then { answer -> diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/OperatorNameViewControllerTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/OperatorNameViewControllerTest.kt index 72a2ce50ed9c..03dee3aeb75c 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/OperatorNameViewControllerTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/OperatorNameViewControllerTest.kt @@ -40,7 +40,6 @@ import com.android.systemui.util.mockito.whenever import com.google.common.truth.Truth.assertThat import junit.framework.Assert.assertTrue import kotlin.test.Test -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest @@ -49,7 +48,6 @@ import org.junit.runner.RunWith import org.mockito.Mock import org.mockito.MockitoAnnotations -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class OperatorNameViewControllerTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/StatusBarStateControllerImplTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/StatusBarStateControllerImplTest.kt index a458ab6e713c..7a982a30981f 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/StatusBarStateControllerImplTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/StatusBarStateControllerImplTest.kt @@ -14,8 +14,6 @@ * limitations under the License. */ -@file:OptIn(ExperimentalCoroutinesApi::class) - package com.android.systemui.statusbar import android.animation.ObjectAnimator @@ -58,7 +56,6 @@ import com.android.systemui.testKosmos import com.android.systemui.util.kotlin.JavaAdapter import com.android.systemui.util.mockito.mock import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Assert.assertEquals diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/chips/casttootherdevice/domian/interactor/MediaRouterChipInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/chips/casttootherdevice/domian/interactor/MediaRouterChipInteractorTest.kt index dd0ac1cc4ce5..b2174c1b1d8c 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/chips/casttootherdevice/domian/interactor/MediaRouterChipInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/chips/casttootherdevice/domian/interactor/MediaRouterChipInteractorTest.kt @@ -28,14 +28,12 @@ import com.android.systemui.statusbar.chips.casttootherdevice.domain.model.Media import com.android.systemui.statusbar.policy.CastDevice import com.google.common.truth.Truth.assertThat import kotlin.test.Test -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.runner.RunWith @SmallTest @RunWith(AndroidJUnit4::class) -@OptIn(ExperimentalCoroutinesApi::class) class MediaRouterChipInteractorTest : SysuiTestCase() { val kosmos = Kosmos() val testScope = kosmos.testScope diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/chips/casttootherdevice/ui/view/EndCastScreenToOtherDeviceDialogDelegateTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/chips/casttootherdevice/ui/view/EndCastScreenToOtherDeviceDialogDelegateTest.kt index fc13cdaae8ce..274efbb50788 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/chips/casttootherdevice/ui/view/EndCastScreenToOtherDeviceDialogDelegateTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/chips/casttootherdevice/ui/view/EndCastScreenToOtherDeviceDialogDelegateTest.kt @@ -43,7 +43,6 @@ import com.android.systemui.statusbar.chips.mediaprojection.ui.view.endMediaProj import com.android.systemui.statusbar.phone.SystemUIDialog import com.google.common.truth.Truth.assertThat import kotlin.test.Test -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.runner.RunWith @@ -57,7 +56,6 @@ import org.mockito.kotlin.whenever @SmallTest @RunWith(AndroidJUnit4::class) -@OptIn(ExperimentalCoroutinesApi::class) class EndCastScreenToOtherDeviceDialogDelegateTest : SysuiTestCase() { private val kosmos = Kosmos().also { it.testCase = this } private val sysuiDialog = mock<SystemUIDialog>() diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/chips/casttootherdevice/ui/view/EndGenericCastToOtherDeviceDialogDelegateTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/chips/casttootherdevice/ui/view/EndGenericCastToOtherDeviceDialogDelegateTest.kt index ddac98dde45d..88207d1c61d8 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/chips/casttootherdevice/ui/view/EndGenericCastToOtherDeviceDialogDelegateTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/chips/casttootherdevice/ui/view/EndGenericCastToOtherDeviceDialogDelegateTest.kt @@ -37,7 +37,6 @@ import com.android.systemui.statusbar.phone.SystemUIDialog import com.android.systemui.statusbar.policy.CastDevice import com.google.common.truth.Truth.assertThat import kotlin.test.Test -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.runner.RunWith @@ -51,7 +50,6 @@ import org.mockito.kotlin.whenever @SmallTest @RunWith(AndroidJUnit4::class) -@OptIn(ExperimentalCoroutinesApi::class) class EndGenericCastToOtherDeviceDialogDelegateTest : SysuiTestCase() { private val kosmos = Kosmos().also { it.testCase = this } private val sysuiDialog = mock<SystemUIDialog>() diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/chips/screenrecord/domain/interactor/ScreenRecordChipInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/chips/screenrecord/domain/interactor/ScreenRecordChipInteractorTest.kt index 11a125a21be0..538247e26a6b 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/chips/screenrecord/domain/interactor/ScreenRecordChipInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/chips/screenrecord/domain/interactor/ScreenRecordChipInteractorTest.kt @@ -34,7 +34,6 @@ import com.android.systemui.statusbar.chips.screenrecord.domain.model.ScreenReco import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat import kotlin.test.Test -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.advanceTimeBy import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest @@ -42,7 +41,6 @@ import org.junit.runner.RunWith @SmallTest @RunWith(AndroidJUnit4::class) -@OptIn(ExperimentalCoroutinesApi::class) class ScreenRecordChipInteractorTest : SysuiTestCase() { private val kosmos = testKosmos().useUnconfinedTestDispatcher() private val testScope = kosmos.testScope diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/chips/screenrecord/ui/view/EndScreenRecordingDialogDelegateTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/chips/screenrecord/ui/view/EndScreenRecordingDialogDelegateTest.kt index 1f91babbfa47..f560ee7730ae 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/chips/screenrecord/ui/view/EndScreenRecordingDialogDelegateTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/chips/screenrecord/ui/view/EndScreenRecordingDialogDelegateTest.kt @@ -41,7 +41,6 @@ import com.android.systemui.statusbar.chips.screenrecord.domain.interactor.scree import com.android.systemui.statusbar.phone.SystemUIDialog import com.google.common.truth.Truth.assertThat import kotlin.test.Test -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.runner.RunWith @@ -55,7 +54,6 @@ import org.mockito.kotlin.whenever @SmallTest @RunWith(AndroidJUnit4::class) -@OptIn(ExperimentalCoroutinesApi::class) class EndScreenRecordingDialogDelegateTest : SysuiTestCase() { private val kosmos = Kosmos().also { it.testCase = this } diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/chips/sharetoapp/ui/view/EndGenericShareToAppDialogDelegateTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/chips/sharetoapp/ui/view/EndGenericShareToAppDialogDelegateTest.kt index 259d3872cfa2..27ed0591dc36 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/chips/sharetoapp/ui/view/EndGenericShareToAppDialogDelegateTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/chips/sharetoapp/ui/view/EndGenericShareToAppDialogDelegateTest.kt @@ -33,7 +33,6 @@ import com.android.systemui.statusbar.phone.SystemUIDialog import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat import kotlin.test.Test -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.runner.RunWith @@ -45,7 +44,6 @@ import org.mockito.kotlin.verify import org.mockito.kotlin.whenever @SmallTest -@OptIn(ExperimentalCoroutinesApi::class) @RunWith(AndroidJUnit4::class) class EndGenericShareToAppDialogDelegateTest : SysuiTestCase() { private val kosmos = testKosmos() diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/chips/sharetoapp/ui/view/EndShareScreenToAppDialogDelegateTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/chips/sharetoapp/ui/view/EndShareScreenToAppDialogDelegateTest.kt index 0ae0d178185e..95aa6cd3250b 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/chips/sharetoapp/ui/view/EndShareScreenToAppDialogDelegateTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/chips/sharetoapp/ui/view/EndShareScreenToAppDialogDelegateTest.kt @@ -43,7 +43,6 @@ import com.android.systemui.statusbar.chips.mediaprojection.ui.view.endMediaProj import com.android.systemui.statusbar.phone.SystemUIDialog import com.google.common.truth.Truth.assertThat import kotlin.test.Test -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.runner.RunWith @@ -56,7 +55,6 @@ import org.mockito.kotlin.verify import org.mockito.kotlin.whenever @SmallTest -@OptIn(ExperimentalCoroutinesApi::class) @RunWith(AndroidJUnit4::class) class EndShareScreenToAppDialogDelegateTest : SysuiTestCase() { private val kosmos = Kosmos().also { it.testCase = this } diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/chips/ui/viewmodel/ChipTransitionHelperTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/chips/ui/viewmodel/ChipTransitionHelperTest.kt index d099e70c9bc5..52d966335f48 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/chips/ui/viewmodel/ChipTransitionHelperTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/chips/ui/viewmodel/ChipTransitionHelperTest.kt @@ -30,7 +30,6 @@ import com.android.systemui.statusbar.chips.ui.model.ColorsModel import com.android.systemui.statusbar.chips.ui.model.OngoingActivityChipModel import com.google.common.truth.Truth.assertThat import kotlin.test.Test -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.test.advanceTimeBy import kotlinx.coroutines.test.runCurrent @@ -39,7 +38,6 @@ import org.junit.runner.RunWith @SmallTest @RunWith(AndroidJUnit4::class) -@OptIn(ExperimentalCoroutinesApi::class) class ChipTransitionHelperTest : SysuiTestCase() { private val kosmos = Kosmos() private val testScope = kosmos.testScope diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/chips/ui/viewmodel/OngoingActivityChipsViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/chips/ui/viewmodel/OngoingActivityChipsViewModelTest.kt index 9442367e82a3..08f1cf0df3cd 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/chips/ui/viewmodel/OngoingActivityChipsViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/chips/ui/viewmodel/OngoingActivityChipsViewModelTest.kt @@ -52,7 +52,6 @@ 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 kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.launchIn import kotlinx.coroutines.flow.onEach import kotlinx.coroutines.test.runCurrent @@ -71,7 +70,6 @@ import org.mockito.kotlin.whenever /** Tests for [OngoingActivityChipsViewModel] when the [StatusBarNotifChips] flag is disabled. */ @SmallTest @RunWith(AndroidJUnit4::class) -@OptIn(ExperimentalCoroutinesApi::class) @DisableFlags(StatusBarNotifChips.FLAG_NAME) class OngoingActivityChipsViewModelTest : SysuiTestCase() { private val kosmos = testKosmos() diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/chips/ui/viewmodel/OngoingActivityChipsWithNotifsViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/chips/ui/viewmodel/OngoingActivityChipsWithNotifsViewModelTest.kt index a03500e5f08f..29528cc48a26 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/chips/ui/viewmodel/OngoingActivityChipsWithNotifsViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/chips/ui/viewmodel/OngoingActivityChipsWithNotifsViewModelTest.kt @@ -68,7 +68,6 @@ 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 kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.launchIn import kotlinx.coroutines.flow.onEach import kotlinx.coroutines.test.runCurrent @@ -84,7 +83,6 @@ import org.mockito.kotlin.whenever /** Tests for [OngoingActivityChipsViewModel] when the [StatusBarNotifChips] flag is enabled. */ @SmallTest @RunWith(AndroidJUnit4::class) -@OptIn(ExperimentalCoroutinesApi::class) @EnableFlags(StatusBarNotifChips.FLAG_NAME) class OngoingActivityChipsWithNotifsViewModelTest : SysuiTestCase() { private val kosmos = testKosmos().useUnconfinedTestDispatcher() diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/core/MultiDisplayStatusBarStarterTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/core/MultiDisplayStatusBarStarterTest.kt index dc65a9e24407..fee939df2cbb 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/core/MultiDisplayStatusBarStarterTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/core/MultiDisplayStatusBarStarterTest.kt @@ -29,7 +29,6 @@ import com.android.systemui.statusbar.data.repository.fakePrivacyDotWindowContro import com.android.systemui.testKosmos import com.google.common.truth.Expect import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Before @@ -40,7 +39,6 @@ import org.mockito.kotlin.never import org.mockito.kotlin.verify import org.mockito.kotlin.whenever -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) @EnableFlags(StatusBarConnectedDisplays.FLAG_NAME) diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/data/repository/RemoteInputRepositoryImplTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/data/repository/RemoteInputRepositoryImplTest.kt index 3b720ef30db7..e48c17ce8663 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/data/repository/RemoteInputRepositoryImplTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/data/repository/RemoteInputRepositoryImplTest.kt @@ -14,8 +14,6 @@ * limitations under the License. */ -@file:OptIn(ExperimentalCoroutinesApi::class) - package com.android.systemui.statusbar.data.repository import androidx.test.ext.junit.runners.AndroidJUnit4 @@ -25,7 +23,6 @@ import com.android.systemui.coroutines.collectLastValue import com.android.systemui.statusbar.NotificationRemoteInputManager import com.android.systemui.util.mockito.withArgCaptor 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 diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/disableflags/data/repository/DisableFlagsRepositoryTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/disableflags/data/repository/DisableFlagsRepositoryTest.kt index cd078211f934..45fbbac7f981 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/disableflags/data/repository/DisableFlagsRepositoryTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/disableflags/data/repository/DisableFlagsRepositoryTest.kt @@ -40,7 +40,6 @@ import com.android.systemui.util.mockito.any import com.android.systemui.util.mockito.argumentCaptor import com.android.systemui.util.mockito.mock import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.UnconfinedTestDispatcher import kotlinx.coroutines.test.runTest @@ -50,7 +49,6 @@ import org.junit.runner.RunWith import org.mockito.Mockito.verify @SmallTest -@OptIn(ExperimentalCoroutinesApi::class) @RunWith(AndroidJUnit4::class) class DisableFlagsRepositoryTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/domain/interactor/RemoteInputInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/domain/interactor/RemoteInputInteractorTest.kt index 60da53cebc80..e44eaaf24836 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/domain/interactor/RemoteInputInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/domain/interactor/RemoteInputInteractorTest.kt @@ -14,8 +14,6 @@ * limitations under the License. */ -@file:OptIn(ExperimentalCoroutinesApi::class) - package com.android.systemui.statusbar.domain.interactor import androidx.test.ext.junit.runners.AndroidJUnit4 @@ -26,7 +24,6 @@ import com.android.systemui.kosmos.testScope import com.android.systemui.statusbar.data.repository.fakeRemoteInputRepository import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Test diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/events/SystemEventCoordinatorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/events/SystemEventCoordinatorTest.kt index 742494b769de..01e8dfe385b0 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/events/SystemEventCoordinatorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/events/SystemEventCoordinatorTest.kt @@ -25,7 +25,6 @@ import com.android.systemui.privacy.PrivacyItemController import com.android.systemui.statusbar.policy.BatteryController import com.android.systemui.util.mockito.any import com.android.systemui.util.time.FakeSystemClock -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.MutableSharedFlow import kotlinx.coroutines.test.TestScope @@ -43,7 +42,6 @@ import org.mockito.MockitoAnnotations @RunWith(AndroidJUnit4::class) @TestableLooper.RunWithLooper(setAsMainLooper = true) @SmallTest -@OptIn(ExperimentalCoroutinesApi::class) class SystemEventCoordinatorTest : SysuiTestCase() { private val fakeSystemClock = FakeSystemClock() diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/NotificationStackAppearanceIntegrationTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/NotificationStackAppearanceIntegrationTest.kt index c3547bc5cc9b..0f1cdac05f7a 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/NotificationStackAppearanceIntegrationTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/NotificationStackAppearanceIntegrationTest.kt @@ -14,8 +14,6 @@ * limitations under the License. */ -@file:OptIn(ExperimentalCoroutinesApi::class) - package com.android.systemui.statusbar.notification import android.testing.TestableLooper.RunWithLooper @@ -41,7 +39,6 @@ import com.android.systemui.statusbar.notification.stack.ui.viewmodel.notificati import com.android.systemui.statusbar.notification.stack.ui.viewmodel.notificationsPlaceholderViewModel import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.test.runCurrent diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/NotificationWakeUpCoordinatorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/NotificationWakeUpCoordinatorTest.kt index 3abd6207338c..c987b6155f9d 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/NotificationWakeUpCoordinatorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/NotificationWakeUpCoordinatorTest.kt @@ -47,7 +47,6 @@ import com.android.systemui.statusbar.phone.ScreenOffAnimationController import com.android.systemui.testKosmos import com.android.systemui.util.mockito.withArgCaptor import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest @@ -65,7 +64,6 @@ import org.mockito.kotlin.whenever import platform.test.runner.parameterized.ParameterizedAndroidJunit4 import platform.test.runner.parameterized.Parameters -@OptIn(ExperimentalCoroutinesApi::class) @RunWith(ParameterizedAndroidJunit4::class) @SmallTest @TestableLooper.RunWithLooper(setAsMainLooper = true) diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/coordinator/LockScreenMinimalismCoordinatorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/coordinator/LockScreenMinimalismCoordinatorTest.kt index 14148cdc0f03..a90539413adb 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/coordinator/LockScreenMinimalismCoordinatorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/coordinator/LockScreenMinimalismCoordinatorTest.kt @@ -13,8 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -@file:OptIn(ExperimentalCoroutinesApi::class) - package com.android.systemui.statusbar.notification.collection.coordinator import android.app.Notification @@ -52,7 +50,6 @@ import com.google.common.truth.StringSubject import com.google.common.truth.Truth.assertThat import kotlin.time.Duration.Companion.seconds import kotlinx.coroutines.CoroutineScope -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.TestCoroutineScheduler import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.UnconfinedTestDispatcher diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/coordinator/OriginalUnseenKeyguardCoordinatorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/coordinator/OriginalUnseenKeyguardCoordinatorTest.kt index 5f154acbaca0..7781df1ad91f 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/coordinator/OriginalUnseenKeyguardCoordinatorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/coordinator/OriginalUnseenKeyguardCoordinatorTest.kt @@ -13,8 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -@file:OptIn(ExperimentalCoroutinesApi::class) - package com.android.systemui.statusbar.notification.collection.coordinator import android.app.Notification @@ -56,7 +54,6 @@ import com.android.systemui.util.settings.fakeSettings import com.google.common.truth.Truth.assertThat import kotlin.time.Duration.Companion.seconds import kotlinx.coroutines.CoroutineScope -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.TestCoroutineScheduler import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.UnconfinedTestDispatcher diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/coordinator/SensitiveContentCoordinatorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/coordinator/SensitiveContentCoordinatorTest.kt index 8f21ddff524c..ad4925c99901 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/coordinator/SensitiveContentCoordinatorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/coordinator/SensitiveContentCoordinatorTest.kt @@ -14,8 +14,6 @@ * limitations under the License. */ -@file:OptIn(ExperimentalCoroutinesApi::class) - package com.android.systemui.statusbar.notification.collection.coordinator import android.app.Notification @@ -74,7 +72,6 @@ import com.android.systemui.statusbar.policy.mockSensitiveNotificationProtection import com.android.systemui.statusbar.policy.sensitiveNotificationProtectionController import com.android.systemui.testKosmos import com.android.systemui.util.mockito.withArgCaptor -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.runCurrent diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/domain/interactor/ActiveNotificationsInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/domain/interactor/ActiveNotificationsInteractorTest.kt index 83c61507a506..d3befa921e9e 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/domain/interactor/ActiveNotificationsInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/domain/interactor/ActiveNotificationsInteractorTest.kt @@ -14,8 +14,6 @@ * limitations under the License. */ -@file:OptIn(ExperimentalCoroutinesApi::class) - package com.android.systemui.statusbar.notification.domain.interactor import android.platform.test.annotations.DisableFlags @@ -35,7 +33,6 @@ import com.android.systemui.statusbar.notification.promoted.shared.model.Promote import com.android.systemui.statusbar.notification.shared.CallType import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Test diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/domain/interactor/HeadsUpNotificationInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/domain/interactor/HeadsUpNotificationInteractorTest.kt index fae7d515d305..a7ae35d72780 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/domain/interactor/HeadsUpNotificationInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/domain/interactor/HeadsUpNotificationInteractorTest.kt @@ -14,8 +14,6 @@ * limitations under the License. */ -@file:OptIn(ExperimentalCoroutinesApi::class) - package com.android.systemui.statusbar.notification.domain.interactor import androidx.test.ext.junit.runners.AndroidJUnit4 @@ -38,7 +36,6 @@ import com.android.systemui.statusbar.notification.stack.data.repository.headsUp import com.android.systemui.statusbar.notification.stack.domain.interactor.headsUpNotificationInteractor import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Test diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/domain/interactor/NotificationsSoundPolicyInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/domain/interactor/NotificationsSoundPolicyInteractorTest.kt index 0195e9d8418b..7f0f199aa9b3 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/domain/interactor/NotificationsSoundPolicyInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/domain/interactor/NotificationsSoundPolicyInteractorTest.kt @@ -31,7 +31,6 @@ import com.android.systemui.statusbar.policy.data.repository.zenModeRepository import com.android.systemui.testKosmos import com.google.common.truth.Expect import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Before @@ -39,7 +38,6 @@ import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class NotificationsSoundPolicyInteractorTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/emptyshade/ui/viewmodel/EmptyShadeViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/emptyshade/ui/viewmodel/EmptyShadeViewModelTest.kt index 163ae47ad78a..5ba972def76d 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/emptyshade/ui/viewmodel/EmptyShadeViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/emptyshade/ui/viewmodel/EmptyShadeViewModelTest.kt @@ -40,7 +40,6 @@ import com.android.systemui.statusbar.policy.data.repository.zenModeRepository import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat import java.util.Locale -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.After @@ -50,7 +49,6 @@ import org.junit.runner.RunWith import platform.test.runner.parameterized.ParameterizedAndroidJunit4 import platform.test.runner.parameterized.Parameters -@OptIn(ExperimentalCoroutinesApi::class) @RunWith(ParameterizedAndroidJunit4::class) @SmallTest class EmptyShadeViewModelTest(flags: FlagsParameterization) : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/footer/ui/viewmodel/FooterViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/footer/ui/viewmodel/FooterViewModelTest.kt index b3a60b052d08..cb2de88172ee 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/footer/ui/viewmodel/FooterViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/footer/ui/viewmodel/FooterViewModelTest.kt @@ -14,8 +14,6 @@ * limitations under the License. */ -@file:OptIn(ExperimentalCoroutinesApi::class) - package com.android.systemui.statusbar.notification.footer.ui.viewmodel import android.platform.test.annotations.DisableFlags @@ -45,7 +43,6 @@ import com.android.systemui.testKosmos 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.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Before diff --git a/packages/SystemUI/multivalentTests/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 index f07303ed32e3..ee4d0990d38f 100644 --- a/packages/SystemUI/multivalentTests/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 @@ -15,6 +15,7 @@ package com.android.systemui.statusbar.notification.icon.domain.interactor +import android.platform.test.annotations.DisableFlags import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest import com.android.systemui.SysuiTestCase @@ -24,6 +25,7 @@ import com.android.systemui.deviceentry.domain.interactor.deviceEntryInteractor import com.android.systemui.kosmos.testDispatcher import com.android.systemui.kosmos.testScope import com.android.systemui.statusbar.data.repository.notificationListenerSettingsRepository +import com.android.systemui.statusbar.headsup.shared.StatusBarNoHunBehavior import com.android.systemui.statusbar.notification.data.model.activeNotificationModel import com.android.systemui.statusbar.notification.data.repository.ActiveNotificationsStore import com.android.systemui.statusbar.notification.data.repository.activeNotificationListRepository @@ -44,7 +46,6 @@ import com.android.systemui.util.mockito.whenever import com.android.wm.shell.bubbles.bubbles import com.android.wm.shell.bubbles.bubblesOptional import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runTest import org.junit.Before import org.junit.Test @@ -63,7 +64,7 @@ class NotificationIconsInteractorTest : SysuiTestCase() { kosmos.activeNotificationsInteractor, kosmos.bubblesOptional, kosmos.headsUpNotificationIconInteractor, - kosmos.notificationsKeyguardViewStateRepository + kosmos.notificationsKeyguardViewStateRepository, ) @Before @@ -142,7 +143,6 @@ class NotificationIconsInteractorTest : SysuiTestCase() { } } -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class AlwaysOnDisplayNotificationIconsInteractorTest : SysuiTestCase() { @@ -308,6 +308,7 @@ class StatusBarNotificationIconsInteractorTest : SysuiTestCase() { } @Test + @DisableFlags(StatusBarNoHunBehavior.FLAG_NAME) fun filteredEntrySet_includesIsolatedIcon() = testScope.runTest { val filteredSet by collectLastValue(underTest.statusBarNotifs) @@ -318,31 +319,11 @@ class StatusBarNotificationIconsInteractorTest : SysuiTestCase() { private val testIcons = listOf( - activeNotificationModel( - key = "notif1", - ), - activeNotificationModel( - key = "notif2", - isAmbient = true, - ), - activeNotificationModel( - key = "notif3", - isRowDismissed = true, - ), - activeNotificationModel( - key = "notif4", - isSilent = true, - ), - activeNotificationModel( - key = "notif5", - isLastMessageFromReply = true, - ), - activeNotificationModel( - key = "notif6", - isSuppressedFromStatusBar = true, - ), - activeNotificationModel( - key = "notif7", - isPulsing = true, - ), + activeNotificationModel(key = "notif1"), + activeNotificationModel(key = "notif2", isAmbient = true), + activeNotificationModel(key = "notif3", isRowDismissed = true), + activeNotificationModel(key = "notif4", isSilent = true), + activeNotificationModel(key = "notif5", isLastMessageFromReply = true), + activeNotificationModel(key = "notif6", isSuppressedFromStatusBar = true), + activeNotificationModel(key = "notif7", isPulsing = true), ) diff --git a/packages/SystemUI/multivalentTests/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 index 76390fddc529..fb734ac79dc8 100644 --- a/packages/SystemUI/multivalentTests/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 @@ -46,7 +46,6 @@ import com.android.systemui.statusbar.phone.dozeParameters import com.android.systemui.testKosmos import com.android.systemui.util.mockito.whenever import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Before @@ -55,7 +54,6 @@ import org.junit.runner.RunWith import platform.test.runner.parameterized.ParameterizedAndroidJunit4 import platform.test.runner.parameterized.Parameters -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(ParameterizedAndroidJunit4::class) class NotificationIconContainerAlwaysOnDisplayViewModelTest(flags: FlagsParameterization) : diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/BigPictureIconManagerTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/BigPictureIconManagerTest.kt index da488336c7c3..99dcd6c9a798 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/BigPictureIconManagerTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/BigPictureIconManagerTest.kt @@ -30,7 +30,6 @@ import com.android.systemui.res.R import com.android.systemui.util.mockito.argumentCaptor import com.android.systemui.util.mockito.mock import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.StandardTestDispatcher import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.advanceTimeBy @@ -47,7 +46,6 @@ import org.mockito.Mockito.verifyNoMoreInteractions private const val FREE_IMAGE_DELAY_MS = 4000L private const val MAX_IMAGE_SIZE = 512 // size of the test drawables in pixels -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWithLooper @RunWith(AndroidJUnit4::class) diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/NotificationGutsManagerTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/NotificationGutsManagerTest.kt index 11673a0e73b2..d43cc78e20dc 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/NotificationGutsManagerTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/NotificationGutsManagerTest.kt @@ -13,8 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License */ -@file:OptIn(ExperimentalCoroutinesApi::class) - package com.android.systemui.statusbar.notification.row import android.R @@ -81,7 +79,6 @@ import com.android.systemui.wmshell.BubblesManager import java.util.Optional import kotlin.test.assertNotNull import kotlin.test.fail -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Assert.assertEquals diff --git a/packages/SystemUI/multivalentTests/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 index 0dc871a523ee..961616c99cb1 100644 --- a/packages/SystemUI/multivalentTests/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 @@ -14,8 +14,6 @@ * limitations under the License. */ -@file:OptIn(ExperimentalCoroutinesApi::class) - package com.android.systemui.statusbar.notification.row.ui.viewmodel import androidx.test.ext.junit.runners.AndroidJUnit4 @@ -25,7 +23,6 @@ import com.android.systemui.accessibility.data.repository.FakeAccessibilityRepos import com.android.systemui.accessibility.domain.interactor.AccessibilityInteractor import com.android.systemui.coroutines.collectLastValue import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Test diff --git a/packages/SystemUI/multivalentTests/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 index f88bd7ec60bb..c42b24deaccf 100644 --- a/packages/SystemUI/multivalentTests/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 @@ -14,8 +14,6 @@ * limitations under the License. */ -@file:OptIn(ExperimentalCoroutinesApi::class) - package com.android.systemui.statusbar.notification.row.ui.viewmodel import android.platform.test.annotations.EnableFlags @@ -31,7 +29,6 @@ import com.android.systemui.power.shared.model.WakefulnessState import com.android.systemui.statusbar.notification.shared.NotificationViewFlipperPausing import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Test diff --git a/packages/SystemUI/multivalentTests/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 index 4c6e25a530a5..8eea2a8e6121 100644 --- a/packages/SystemUI/multivalentTests/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 @@ -14,8 +14,6 @@ * limitations under the License. */ -@file:OptIn(ExperimentalCoroutinesApi::class) - package com.android.systemui.statusbar.notification.shelf.domain.interactor import android.os.PowerManager @@ -34,7 +32,6 @@ import com.android.systemui.util.mockito.eq import com.android.systemui.util.mockito.mock import com.android.systemui.util.mockito.whenever import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runTest import org.junit.Test import org.junit.runner.RunWith diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/DisplaySwitchNotificationsHiderTrackerTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/DisplaySwitchNotificationsHiderTrackerTest.kt index 578950fa88b5..4aaf6fc60ddd 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/DisplaySwitchNotificationsHiderTrackerTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/DisplaySwitchNotificationsHiderTrackerTest.kt @@ -24,7 +24,6 @@ import com.android.systemui.SysuiTestCase import com.android.systemui.shade.domain.interactor.ShadeInteractor import com.android.systemui.util.mockito.mock import com.android.systemui.util.mockito.whenever -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.launch import kotlinx.coroutines.test.TestScope @@ -38,7 +37,6 @@ import org.mockito.Mockito.never import org.mockito.Mockito.verify @SmallTest -@OptIn(ExperimentalCoroutinesApi::class) @RunWith(AndroidJUnit4::class) class DisplaySwitchNotificationsHiderTrackerTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/MagneticNotificationRowManagerImplTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/MagneticNotificationRowManagerImplTest.kt index 739636e01f0b..d14ff35f824a 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/MagneticNotificationRowManagerImplTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/MagneticNotificationRowManagerImplTest.kt @@ -18,6 +18,7 @@ package com.android.systemui.statusbar.notification.stack import android.os.testableLooper import android.testing.TestableLooper.RunWithLooper +import androidx.dynamicanimation.animation.SpringForce import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest import com.android.systemui.SysuiTestCase @@ -46,13 +47,14 @@ class MagneticNotificationRowManagerImplTest : SysuiTestCase() { private val childrenNumber = 5 private val stackScrollLayout = mock<NotificationStackScrollLayout>() private val sectionsManager = mock<NotificationSectionsManager>() - private val swipedMultiplier = 0.5f private val msdlPlayer = kosmos.fakeMSDLPlayer + private var canRowBeDismissed = true private val underTest = kosmos.magneticNotificationRowManagerImpl private lateinit var notificationTestHelper: NotificationTestHelper private lateinit var children: NotificationChildrenContainer + private lateinit var swipedRow: ExpandableNotificationRow @Before fun setUp() { @@ -60,14 +62,15 @@ class MagneticNotificationRowManagerImplTest : SysuiTestCase() { notificationTestHelper = NotificationTestHelper(mContext, mDependency, kosmos.testableLooper, featureFlags) children = notificationTestHelper.createGroup(childrenNumber).childrenContainer + swipedRow = children.attachedChildren[childrenNumber / 2] + configureMagneticRowListener(swipedRow) } @Test fun setMagneticAndRoundableTargets_onIdle_targetsGetSet() = kosmos.testScope.runTest { // WHEN the targets are set for a row - val row = children.attachedChildren[childrenNumber / 2] - setTargetsForRow(row) + setTargets() // THEN the magnetic and roundable targets are defined and the state is TARGETS_SET assertThat(underTest.currentState).isEqualTo(State.TARGETS_SET) @@ -79,11 +82,10 @@ class MagneticNotificationRowManagerImplTest : SysuiTestCase() { fun setMagneticRowTranslation_whenTargetsAreSet_startsPulling() = kosmos.testScope.runTest { // GIVEN targets are set - val row = children.attachedChildren[childrenNumber / 2] - setTargetsForRow(row) + setTargets() // WHEN setting a translation for the swiped row - underTest.setMagneticRowTranslation(row, translation = 100f) + underTest.setMagneticRowTranslation(swipedRow, translation = 100f) // THEN the state moves to PULLING assertThat(underTest.currentState).isEqualTo(State.PULLING) @@ -107,8 +109,7 @@ class MagneticNotificationRowManagerImplTest : SysuiTestCase() { fun setMagneticRowTranslation_whenRowIsNotSwiped_doesNotSetMagneticTranslation() = kosmos.testScope.runTest { // GIVEN that targets are set - val row = children.attachedChildren[childrenNumber / 2] - setTargetsForRow(row) + setTargets() // WHEN setting a translation for a row that is not being swiped val differentRow = children.attachedChildren[childrenNumber / 2 - 1] @@ -120,41 +121,61 @@ class MagneticNotificationRowManagerImplTest : SysuiTestCase() { } @Test - fun setMagneticRowTranslation_belowThreshold_whilePulling_setsMagneticTranslations() = + fun setMagneticRowTranslation_whenDismissible_belowThreshold_whenPulling_setsTranslations() = kosmos.testScope.runTest { // GIVEN a threshold of 100 px val threshold = 100f underTest.setSwipeThresholdPx(threshold) // GIVEN that targets are set and the rows are being pulled - val row = children.attachedChildren[childrenNumber / 2] - setTargetsForRow(row) - underTest.setMagneticRowTranslation(row, translation = 100f) + setTargets() + underTest.setMagneticRowTranslation(swipedRow, translation = 100f) // WHEN setting a translation that will fall below the threshold - val translation = threshold / swipedMultiplier - 50f - underTest.setMagneticRowTranslation(row, translation) + val translation = threshold / underTest.swipedRowMultiplier - 50f + underTest.setMagneticRowTranslation(swipedRow, translation) // THEN the targets continue to be pulled and translations are set assertThat(underTest.currentState).isEqualTo(State.PULLING) - assertThat(row.translation).isEqualTo(swipedMultiplier * translation) + assertThat(swipedRow.translation).isEqualTo(underTest.swipedRowMultiplier * translation) } @Test - fun setMagneticRowTranslation_aboveThreshold_whilePulling_detachesMagneticTargets() = + fun setMagneticRowTranslation_whenNotDismissible_belowThreshold_whenPulling_setsTranslations() = kosmos.testScope.runTest { // GIVEN a threshold of 100 px val threshold = 100f underTest.setSwipeThresholdPx(threshold) // GIVEN that targets are set and the rows are being pulled - val row = children.attachedChildren[childrenNumber / 2] - setTargetsForRow(row) - underTest.setMagneticRowTranslation(row, translation = 100f) + canRowBeDismissed = false + setTargets() + underTest.setMagneticRowTranslation(swipedRow, translation = 100f) + + // WHEN setting a translation that will fall below the threshold + val translation = threshold / underTest.swipedRowMultiplier - 50f + underTest.setMagneticRowTranslation(swipedRow, translation) + + // THEN the targets continue to be pulled and reduced translations are set + val expectedTranslation = getReducedTranslation(translation) + assertThat(underTest.currentState).isEqualTo(State.PULLING) + assertThat(swipedRow.translation).isEqualTo(expectedTranslation) + } + + @Test + fun setMagneticRowTranslation_whenDismissible_aboveThreshold_whilePulling_detaches() = + kosmos.testScope.runTest { + // GIVEN a threshold of 100 px + val threshold = 100f + underTest.setSwipeThresholdPx(threshold) + + // GIVEN that targets are set and the rows are being pulled + setTargets() + underTest.setMagneticRowTranslation(swipedRow, translation = 100f) // WHEN setting a translation that will fall above the threshold - val translation = threshold / swipedMultiplier + 50f - underTest.setMagneticRowTranslation(row, translation) + val translation = threshold / underTest.swipedRowMultiplier + 50f + underTest.setMagneticRowTranslation(swipedRow, translation) // THEN the swiped view detaches and the correct detach haptics play assertThat(underTest.currentState).isEqualTo(State.DETACHED) @@ -162,15 +183,36 @@ class MagneticNotificationRowManagerImplTest : SysuiTestCase() { } @Test + fun setMagneticRowTranslation_whenNotDismissible_aboveThreshold_whilePulling_doesNotDetach() = + kosmos.testScope.runTest { + // GIVEN a threshold of 100 px + val threshold = 100f + underTest.setSwipeThresholdPx(threshold) + + // GIVEN that targets are set and the rows are being pulled + canRowBeDismissed = false + setTargets() + underTest.setMagneticRowTranslation(swipedRow, translation = 100f) + + // WHEN setting a translation that will fall above the threshold + val translation = threshold / underTest.swipedRowMultiplier + 50f + underTest.setMagneticRowTranslation(swipedRow, translation) + + // THEN the swiped view does not detach and the reduced translation is set + val expectedTranslation = getReducedTranslation(translation) + assertThat(underTest.currentState).isEqualTo(State.PULLING) + assertThat(swipedRow.translation).isEqualTo(expectedTranslation) + } + + @Test fun setMagneticRowTranslation_whileDetached_setsTranslationAndStaysDetached() = kosmos.testScope.runTest { // GIVEN that the swiped view has been detached - val row = children.attachedChildren[childrenNumber / 2] - setDetachedState(row) + setDetachedState() // WHEN setting a new translation val translation = 300f - underTest.setMagneticRowTranslation(row, translation) + underTest.setMagneticRowTranslation(swipedRow, translation) // THEN the swiped view continues to be detached assertThat(underTest.currentState).isEqualTo(State.DETACHED) @@ -180,14 +222,13 @@ class MagneticNotificationRowManagerImplTest : SysuiTestCase() { fun onMagneticInteractionEnd_whilePulling_goesToIdle() = kosmos.testScope.runTest { // GIVEN targets are set - val row = children.attachedChildren[childrenNumber / 2] - setTargetsForRow(row) + setTargets() // WHEN setting a translation for the swiped row - underTest.setMagneticRowTranslation(row, translation = 100f) + underTest.setMagneticRowTranslation(swipedRow, translation = 100f) // WHEN the interaction ends on the row - underTest.onMagneticInteractionEnd(row, velocity = null) + underTest.onMagneticInteractionEnd(swipedRow, velocity = null) // THEN the state resets assertThat(underTest.currentState).isEqualTo(State.IDLE) @@ -197,32 +238,56 @@ class MagneticNotificationRowManagerImplTest : SysuiTestCase() { fun onMagneticInteractionEnd_whileDetached_goesToIdle() = kosmos.testScope.runTest { // GIVEN the swiped row is detached - val row = children.attachedChildren[childrenNumber / 2] - setDetachedState(row) + setDetachedState() // WHEN the interaction ends on the row - underTest.onMagneticInteractionEnd(row, velocity = null) + underTest.onMagneticInteractionEnd(swipedRow, velocity = null) // THEN the state resets assertThat(underTest.currentState).isEqualTo(State.IDLE) } - private fun setDetachedState(row: ExpandableNotificationRow) { + private fun setDetachedState() { val threshold = 100f underTest.setSwipeThresholdPx(threshold) // Set the pulling state - setTargetsForRow(row) - underTest.setMagneticRowTranslation(row, translation = 100f) + setTargets() + underTest.setMagneticRowTranslation(swipedRow, translation = 100f) // Set a translation that will fall above the threshold - val translation = threshold / swipedMultiplier + 50f - underTest.setMagneticRowTranslation(row, translation) + val translation = threshold / underTest.swipedRowMultiplier + 50f + underTest.setMagneticRowTranslation(swipedRow, translation) assertThat(underTest.currentState).isEqualTo(State.DETACHED) } - private fun setTargetsForRow(row: ExpandableNotificationRow) { - underTest.setMagneticAndRoundableTargets(row, stackScrollLayout, sectionsManager) + private fun setTargets() { + underTest.setMagneticAndRoundableTargets(swipedRow, stackScrollLayout, sectionsManager) + } + + private fun getReducedTranslation(originalTranslation: Float) = + underTest.swipedRowMultiplier * + originalTranslation * + MagneticNotificationRowManagerImpl.MAGNETIC_REDUCTION + + private fun configureMagneticRowListener(row: ExpandableNotificationRow) { + val listener = + object : MagneticRowListener { + override fun setMagneticTranslation(translation: Float) { + row.translation = translation + } + + override fun triggerMagneticForce( + endTranslation: Float, + springForce: SpringForce, + startVelocity: Float, + ) {} + + override fun cancelMagneticAnimations() {} + + override fun canRowBeDismissed(): Boolean = canRowBeDismissed + } + row.magneticRowListener = listener } } diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithmTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithmTest.kt index 4f9beb6ffc73..7659fb42fba7 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithmTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithmTest.kt @@ -31,7 +31,6 @@ import com.android.systemui.statusbar.notification.row.ExpandableView import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager import com.google.common.truth.Expect import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import org.junit.Assume import org.junit.Before import org.junit.Rule @@ -59,7 +58,6 @@ class StackScrollAlgorithmTest(flags: FlagsParameterization) : SysuiTestCase() { private val notificationRow = mock<ExpandableNotificationRow>() private val notificationEntry = mock<NotificationEntry>() private val dumpManager = mock<DumpManager>() - @OptIn(ExperimentalCoroutinesApi::class) private val mStatusBarKeyguardViewManager = mock<StatusBarKeyguardViewManager>() private val notificationShelf = mock<NotificationShelf>() private val emptyShadeView = @@ -67,7 +65,6 @@ class StackScrollAlgorithmTest(flags: FlagsParameterization) : SysuiTestCase() { layout(/* l= */ 0, /* t= */ 0, /* r= */ 100, /* b= */ 100) } private val footerView = FooterView(context, /* attrs= */ null) - @OptIn(ExperimentalCoroutinesApi::class) private val ambientState = AmbientState( context, @@ -504,7 +501,6 @@ class StackScrollAlgorithmTest(flags: FlagsParameterization) : SysuiTestCase() { assertThat(notificationRow.viewState.alpha).isEqualTo(1f) } - @OptIn(ExperimentalCoroutinesApi::class) @Test fun resetViewStates_expansionChanging_notificationBecomesTransparent() { whenever(mStatusBarKeyguardViewManager.isPrimaryBouncerInTransit).thenReturn(false) @@ -514,7 +510,6 @@ class StackScrollAlgorithmTest(flags: FlagsParameterization) : SysuiTestCase() { ) } - @OptIn(ExperimentalCoroutinesApi::class) @Test fun resetViewStates_expansionChangingWhileBouncerInTransit_viewBecomesTransparent() { whenever(mStatusBarKeyguardViewManager.isPrimaryBouncerInTransit).thenReturn(true) @@ -524,7 +519,6 @@ class StackScrollAlgorithmTest(flags: FlagsParameterization) : SysuiTestCase() { ) } - @OptIn(ExperimentalCoroutinesApi::class) @Test fun resetViewStates_expansionChanging_notificationAlphaUpdated() { whenever(mStatusBarKeyguardViewManager.isPrimaryBouncerInTransit).thenReturn(false) @@ -534,7 +528,6 @@ class StackScrollAlgorithmTest(flags: FlagsParameterization) : SysuiTestCase() { ) } - @OptIn(ExperimentalCoroutinesApi::class) @Test fun resetViewStates_largeScreen_expansionChanging_alphaUpdated_largeScreenValue() { val expansionFraction = 0.6f @@ -550,7 +543,6 @@ class StackScrollAlgorithmTest(flags: FlagsParameterization) : SysuiTestCase() { ) } - @OptIn(ExperimentalCoroutinesApi::class) @Test fun expansionChanging_largeScreen_bouncerInTransit_alphaUpdated_bouncerValues() { ambientState.isSmallScreen = false diff --git a/packages/SystemUI/multivalentTests/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 index d665b3166986..5db9bca6ae29 100644 --- a/packages/SystemUI/multivalentTests/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 @@ -39,7 +39,6 @@ import com.android.systemui.util.mockito.mock import com.google.common.truth.Truth.assertThat import java.time.Duration import java.util.Optional -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.advanceTimeBy @@ -50,7 +49,6 @@ import org.junit.Test import org.junit.runner.RunWith import org.mockito.MockitoAnnotations -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) open class HideNotificationsInteractorTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/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 index 1c6bda985a0e..d52f5deb3b5c 100644 --- a/packages/SystemUI/multivalentTests/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 @@ -14,8 +14,6 @@ * limitations under the License. */ -@file:OptIn(ExperimentalCoroutinesApi::class) - package com.android.systemui.statusbar.notification.stack.domain.interactor import androidx.test.ext.junit.runners.AndroidJUnit4 @@ -29,7 +27,6 @@ import com.android.systemui.power.data.repository.fakePowerRepository import com.android.systemui.power.shared.model.WakefulnessState import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Test diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/domain/interactor/SharedNotificationContainerInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/domain/interactor/SharedNotificationContainerInteractorTest.kt index 4176d1c1f6fd..21ebe7f9db61 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/domain/interactor/SharedNotificationContainerInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/domain/interactor/SharedNotificationContainerInteractorTest.kt @@ -15,8 +15,6 @@ * */ -@file:OptIn(ExperimentalCoroutinesApi::class) - package com.android.systemui.statusbar.notification.stack.domain.interactor import android.platform.test.flag.junit.FlagsParameterization @@ -32,7 +30,6 @@ import com.android.systemui.kosmos.testScope import com.android.systemui.res.R import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Test diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/ui/view/NotificationStatsLoggerTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/ui/view/NotificationStatsLoggerTest.kt index 13280f2caec7..80e9e36862dd 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/ui/view/NotificationStatsLoggerTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/ui/view/NotificationStatsLoggerTest.kt @@ -32,7 +32,6 @@ import com.android.systemui.util.mockito.argumentCaptor import com.android.systemui.util.mockito.eq import com.google.common.truth.Truth.assertThat import java.util.concurrent.Callable -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Test @@ -42,7 +41,6 @@ import org.mockito.Mockito.spy import org.mockito.Mockito.verify import org.mockito.Mockito.verifyNoMoreInteractions -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class NotificationStatsLoggerTest : SysuiTestCase() { @@ -172,6 +170,41 @@ class NotificationStatsLoggerTest : SysuiTestCase() { } @Test + fun onNotificationVisibilityChanged_thenShadeNotInteractive_noDuplicateLogs() = + testScope.runTest { + // GIVEN a visible Notifications is reported + val (ranks, locations) = fakeNotificationMaps("key0") + val callable = Callable { locations } + underTest.onNotificationLocationsChanged(callable, ranks) + runCurrent() + clearInvocations(mockStatusBarService, mockNotificationListenerService) + + // WHEN the same Notification becomins invisible + val emptyCallable = Callable { emptyMap<String, Int>() } + underTest.onNotificationLocationsChanged(emptyCallable, ranks) + // AND notifications become non interactible + underTest.onLockscreenOrShadeNotInteractive(emptyList()) + runCurrent() + + // THEN visibility changes are reported + verify(mockStatusBarService) + .onNotificationVisibilityChanged(eq(emptyArray()), visibilityArrayCaptor.capture()) + val noLongerVisible = visibilityArrayCaptor.value + assertThat(noLongerVisible).hasLength(1) + assertThat(noLongerVisible[0]).apply { + isKeyEqualTo("key0") + isRankEqualTo(0) + notVisible() + isInMainArea() + isCountEqualTo(1) + } + + // AND nothing else is logged + verifyNoMoreInteractions(mockStatusBarService) + verifyNoMoreInteractions(mockNotificationListenerService) + } + + @Test fun onNotificationListUpdated_itemsChangedPositions_nothingLogged() = testScope.runTest { // GIVEN some visible Notifications are reported @@ -255,14 +288,14 @@ class NotificationStatsLoggerTest : SysuiTestCase() { activeNotificationModel( key = "key0", uid = 0, - packageName = "com.android.first" + packageName = "com.android.first", ), activeNotificationModel( key = "key1", uid = 1, - packageName = "com.android.second" + packageName = "com.android.second", ), - ) + ), ) runCurrent() @@ -288,7 +321,7 @@ class NotificationStatsLoggerTest : SysuiTestCase() { key = "key", isExpanded = true, location = ExpandableViewState.LOCATION_MAIN_AREA, - isUserAction = true + isUserAction = true, ) runCurrent() @@ -298,7 +331,7 @@ class NotificationStatsLoggerTest : SysuiTestCase() { /* key = */ "key", /* userAction = */ true, /* expanded = */ true, - NotificationVisibility.NotificationLocation.LOCATION_MAIN_AREA.ordinal + NotificationVisibility.NotificationLocation.LOCATION_MAIN_AREA.ordinal, ) } @@ -310,7 +343,7 @@ class NotificationStatsLoggerTest : SysuiTestCase() { key = "key", isExpanded = true, location = ExpandableViewState.LOCATION_MAIN_AREA, - isUserAction = true + isUserAction = true, ) runCurrent() clearInvocations(mockStatusBarService) @@ -320,7 +353,7 @@ class NotificationStatsLoggerTest : SysuiTestCase() { key = "key", isExpanded = true, location = ExpandableViewState.LOCATION_MAIN_AREA, - isUserAction = true + isUserAction = true, ) runCurrent() @@ -336,7 +369,7 @@ class NotificationStatsLoggerTest : SysuiTestCase() { key = "key", isExpanded = true, location = ExpandableViewState.LOCATION_BOTTOM_STACK_HIDDEN, - isUserAction = true + isUserAction = true, ) runCurrent() @@ -352,7 +385,7 @@ class NotificationStatsLoggerTest : SysuiTestCase() { key = "key", isExpanded = true, location = ExpandableViewState.LOCATION_GONE, - isUserAction = false + isUserAction = false, ) runCurrent() @@ -368,7 +401,7 @@ class NotificationStatsLoggerTest : SysuiTestCase() { /* key = */ "key", /* userAction = */ false, /* expanded = */ true, - NotificationVisibility.NotificationLocation.LOCATION_MAIN_AREA.ordinal + NotificationVisibility.NotificationLocation.LOCATION_MAIN_AREA.ordinal, ) } @@ -380,7 +413,7 @@ class NotificationStatsLoggerTest : SysuiTestCase() { key = "key", isExpanded = true, location = ExpandableViewState.LOCATION_GONE, - isUserAction = false + isUserAction = false, ) runCurrent() // AND we open the shade, so we log its events @@ -406,7 +439,7 @@ class NotificationStatsLoggerTest : SysuiTestCase() { /* key = */ "key", /* userAction = */ false, /* expanded = */ true, - NotificationVisibility.NotificationLocation.LOCATION_MAIN_AREA.ordinal + NotificationVisibility.NotificationLocation.LOCATION_MAIN_AREA.ordinal, ) } @@ -418,7 +451,7 @@ class NotificationStatsLoggerTest : SysuiTestCase() { key = "key", isExpanded = false, location = ExpandableViewState.LOCATION_MAIN_AREA, - isUserAction = false + isUserAction = false, ) runCurrent() @@ -435,7 +468,7 @@ class NotificationStatsLoggerTest : SysuiTestCase() { key = "key", isExpanded = true, location = ExpandableViewState.LOCATION_MAIN_AREA, - isUserAction = true + isUserAction = true, ) runCurrent() @@ -445,7 +478,7 @@ class NotificationStatsLoggerTest : SysuiTestCase() { /* key = */ "key", /* userAction = */ true, /* expanded = */ true, - NotificationVisibility.NotificationLocation.LOCATION_MAIN_AREA.ordinal + NotificationVisibility.NotificationLocation.LOCATION_MAIN_AREA.ordinal, ) // AND the Notification is expanded again @@ -453,7 +486,7 @@ class NotificationStatsLoggerTest : SysuiTestCase() { key = "key", isExpanded = false, location = ExpandableViewState.LOCATION_MAIN_AREA, - isUserAction = true + isUserAction = true, ) runCurrent() @@ -463,7 +496,7 @@ class NotificationStatsLoggerTest : SysuiTestCase() { /* key = */ "key", /* userAction = */ true, /* expanded = */ false, - NotificationVisibility.NotificationLocation.LOCATION_MAIN_AREA.ordinal + NotificationVisibility.NotificationLocation.LOCATION_MAIN_AREA.ordinal, ) } @@ -475,14 +508,14 @@ class NotificationStatsLoggerTest : SysuiTestCase() { key = "key1", isExpanded = true, location = ExpandableViewState.LOCATION_MAIN_AREA, - isUserAction = true + isUserAction = true, ) runCurrent() underTest.onNotificationExpansionChanged( key = "key2", isExpanded = true, location = ExpandableViewState.LOCATION_MAIN_AREA, - isUserAction = true + isUserAction = true, ) runCurrent() clearInvocations(mockStatusBarService) @@ -502,14 +535,14 @@ class NotificationStatsLoggerTest : SysuiTestCase() { key = "key1", isExpanded = true, location = ExpandableViewState.LOCATION_MAIN_AREA, - isUserAction = true + isUserAction = true, ) runCurrent() underTest.onNotificationExpansionChanged( key = "key2", isExpanded = true, location = ExpandableViewState.LOCATION_MAIN_AREA, - isUserAction = true + isUserAction = true, ) runCurrent() clearInvocations(mockStatusBarService) @@ -537,10 +570,15 @@ class NotificationStatsLoggerTest : SysuiTestCase() { private class NotificationVisibilitySubject(private val visibility: NotificationVisibility) { fun isKeyEqualTo(key: String) = assertThat(visibility.key).isEqualTo(key) + fun isRankEqualTo(rank: Int) = assertThat(visibility.rank).isEqualTo(rank) + fun isCountEqualTo(count: Int) = assertThat(visibility.count).isEqualTo(count) + fun isVisible() = assertThat(this.visibility.visible).isTrue() + fun notVisible() = assertThat(this.visibility.visible).isFalse() + fun isInMainArea() = assertThat(this.visibility.location) .isEqualTo(NotificationVisibility.NotificationLocation.LOCATION_MAIN_AREA) 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 1b4f9a79557d..911b1b5b04ba 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 @@ -14,8 +14,6 @@ * limitations under the License. */ -@file:OptIn(ExperimentalCoroutinesApi::class) - package com.android.systemui.statusbar.notification.stack.ui.viewmodel import android.platform.test.flag.junit.FlagsParameterization @@ -48,7 +46,6 @@ import com.android.systemui.testKosmos 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.flow.map import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.runCurrent 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 77f02c050098..af00e2a1a639 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 @@ -15,8 +15,6 @@ * */ -@file:OptIn(ExperimentalCoroutinesApi::class) - package com.android.systemui.statusbar.notification.stack.ui.viewmodel import android.platform.test.annotations.DisableFlags @@ -77,7 +75,6 @@ import com.android.systemui.window.ui.viewmodel.fakeBouncerTransitions import com.google.common.collect.Range import com.google.common.truth.Truth.assertThat import kotlin.test.assertIs -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.test.TestScope diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/CentralSurfacesCommandQueueCallbacksTest.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/CentralSurfacesCommandQueueCallbacksTest.java index f318c74e0584..7bc2bca3df02 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/CentralSurfacesCommandQueueCallbacksTest.java +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/CentralSurfacesCommandQueueCallbacksTest.java @@ -43,6 +43,8 @@ import com.android.keyguard.KeyguardUpdateMonitor; import com.android.systemui.SysuiTestCase; import com.android.systemui.assist.AssistManager; import com.android.systemui.emergency.EmergencyGestureModule.EmergencyGestureIntentFactory; +import com.android.systemui.flags.DisableSceneContainer; +import com.android.systemui.flags.EnableSceneContainer; import com.android.systemui.keyguard.WakefulnessLifecycle; import com.android.systemui.keyguard.domain.interactor.KeyguardInteractor; import com.android.systemui.plugins.ActivityStarter; @@ -55,10 +57,8 @@ import com.android.systemui.shade.CameraLauncher; import com.android.systemui.shade.QuickSettingsController; import com.android.systemui.shade.ShadeController; import com.android.systemui.shade.ShadeHeaderController; -import com.android.systemui.shade.ShadeViewController; import com.android.systemui.shade.domain.interactor.PanelExpansionInteractor; import com.android.systemui.shade.domain.interactor.ShadeInteractor; -import com.android.systemui.shade.shared.flag.DualShade; import com.android.systemui.statusbar.CommandQueue; import com.android.systemui.statusbar.notification.headsup.HeadsUpManager; import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayoutController; @@ -67,6 +67,8 @@ import com.android.systemui.statusbar.policy.KeyguardStateController; import com.android.systemui.statusbar.policy.RemoteInputQuickSettingsDisabler; import com.android.systemui.wallet.controller.QuickAccessWalletController; +import dagger.Lazy; + import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -76,8 +78,6 @@ import org.mockito.stubbing.Answer; import java.util.Optional; -import dagger.Lazy; - @SmallTest @RunWith(AndroidJUnit4.class) public class CentralSurfacesCommandQueueCallbacksTest extends SysuiTestCase { @@ -87,7 +87,6 @@ public class CentralSurfacesCommandQueueCallbacksTest extends SysuiTestCase { @Mock private ShadeController mShadeController; @Mock private CommandQueue mCommandQueue; @Mock private QuickSettingsController mQuickSettingsController; - @Mock private ShadeViewController mShadeViewController; @Mock private PanelExpansionInteractor mPanelExpansionInteractor; @Mock private Lazy<ShadeInteractor> mShadeInteractorLazy; @Mock private ShadeHeaderController mShadeHeaderController; @@ -242,7 +241,8 @@ public class CentralSurfacesCommandQueueCallbacksTest extends SysuiTestCase { } @Test - @DisableFlags(value = {QSComposeFragment.FLAG_NAME, DualShade.FLAG_NAME}) + @DisableSceneContainer + @DisableFlags(QSComposeFragment.FLAG_NAME) public void clickQsTile_flagsDisabled_callsQSPanelController() { ComponentName c = new ComponentName("testpkg", "testcls"); @@ -251,7 +251,7 @@ public class CentralSurfacesCommandQueueCallbacksTest extends SysuiTestCase { } @Test - @DisableFlags(DualShade.FLAG_NAME) + @DisableSceneContainer @EnableFlags(QSComposeFragment.FLAG_NAME) public void clickQsTile_onlyQSComposeFlag_callsQSHost() { ComponentName c = new ComponentName("testpkg", "testcls"); @@ -262,9 +262,9 @@ public class CentralSurfacesCommandQueueCallbacksTest extends SysuiTestCase { } @Test - @EnableFlags(DualShade.FLAG_NAME) + @EnableSceneContainer @DisableFlags(QSComposeFragment.FLAG_NAME) - public void clickQsTile_onlyDualShadeFlag_callsQSHost() { + public void clickQsTile_onlySceneContainerFlag_callsQSHost() { ComponentName c = new ComponentName("testpkg", "testcls"); mSbcqCallbacks.clickTile(c); @@ -273,8 +273,9 @@ public class CentralSurfacesCommandQueueCallbacksTest extends SysuiTestCase { } @Test - @EnableFlags(value = {QSComposeFragment.FLAG_NAME, DualShade.FLAG_NAME}) - public void clickQsTile_qsComposeAndDualShadeFlags_callsQSHost() { + @EnableSceneContainer + @EnableFlags(QSComposeFragment.FLAG_NAME) + public void clickQsTile_qsComposeAndSceneContainerFlags_callsQSHost() { ComponentName c = new ComponentName("testpkg", "testcls"); mSbcqCallbacks.clickTile(c); diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/DozeServiceHostCoroutinesTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/DozeServiceHostCoroutinesTest.kt index 7bc6948edf31..52eda1c6fc77 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/DozeServiceHostCoroutinesTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/DozeServiceHostCoroutinesTest.kt @@ -14,8 +14,6 @@ * limitations under the License. */ -@file:OptIn(ExperimentalCoroutinesApi::class) - package com.android.systemui.statusbar.phone import android.testing.TestableLooper.RunWithLooper @@ -32,7 +30,6 @@ import com.android.systemui.scene.shared.model.Scenes import com.android.systemui.testKosmos import com.android.systemui.util.mockito.mock import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Before diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/KeyguardBypassControllerTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/KeyguardBypassControllerTest.kt index cb40f72ff1af..d9577707531d 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/KeyguardBypassControllerTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/KeyguardBypassControllerTest.kt @@ -42,7 +42,6 @@ import com.android.systemui.statusbar.policy.KeyguardStateController import com.android.systemui.testKosmos import com.android.systemui.tuner.TunerService import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.After @@ -303,7 +302,6 @@ class KeyguardBypassControllerTest(flags: FlagsParameterization) : SysuiTestCase assertThat(keyguardBypassController.bypassEnabled).isFalse() } - @OptIn(ExperimentalCoroutinesApi::class) @Test fun qsExpansion_updates() { testScope.runTest { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/LegacyActivityStarterInternalImplTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/LegacyActivityStarterInternalImplTest.kt index dfa5c9a26d79..dffb64b4ab71 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/LegacyActivityStarterInternalImplTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/LegacyActivityStarterInternalImplTest.kt @@ -64,7 +64,6 @@ import com.android.systemui.util.concurrency.FakeExecutor import com.android.systemui.util.time.FakeSystemClock import com.google.common.truth.Truth.assertThat import java.util.Optional -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.test.runTest import org.junit.Assert.assertThrows @@ -85,7 +84,6 @@ import org.mockito.kotlin.never import org.mockito.kotlin.times import org.mockito.kotlin.verify -@ExperimentalCoroutinesApi @SmallTest @RunWith(AndroidJUnit4::class) class LegacyActivityStarterInternalImplTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicyTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicyTest.kt index 4313aea44326..4e414713abda 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicyTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicyTest.kt @@ -67,7 +67,6 @@ import com.android.systemui.util.kotlin.JavaAdapter import com.android.systemui.util.mockito.capture import com.android.systemui.util.time.DateFormatUtil import com.android.systemui.util.time.FakeSystemClock -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.test.runCurrent @@ -93,7 +92,6 @@ import org.mockito.kotlin.reset @RunWith(AndroidJUnit4::class) @RunWithLooper -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest class PhoneStatusBarPolicyTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/ShadeTouchableRegionManagerTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/ShadeTouchableRegionManagerTest.kt index d82cb86406ec..b8b084c94252 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/ShadeTouchableRegionManagerTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/ShadeTouchableRegionManagerTest.kt @@ -31,7 +31,6 @@ import com.android.systemui.testKosmos import com.android.systemui.util.kotlin.getValue import com.google.common.truth.Truth.assertThat import dagger.Lazy -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest @@ -40,7 +39,6 @@ import org.junit.runner.RunWith @SmallTest @RunWith(AndroidJUnit4::class) -@OptIn(ExperimentalCoroutinesApi::class) class ShadeTouchableRegionManagerTest : SysuiTestCase() { private val kosmos = testKosmos() private val testScope = kosmos.testScope diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/SystemUIBottomSheetDialogTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/SystemUIBottomSheetDialogTest.kt index 1ee8005fb7ab..03728960d818 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/SystemUIBottomSheetDialogTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/SystemUIBottomSheetDialogTest.kt @@ -30,7 +30,6 @@ import com.android.systemui.util.mockito.argumentCaptor import com.android.systemui.util.mockito.capture import com.android.systemui.util.mockito.mock import kotlin.test.Test -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.test.runTest @@ -38,7 +37,6 @@ import org.junit.Before import org.junit.runner.RunWith import org.mockito.Mockito.verify -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) @RunWithLooper(setAsMainLooper = true) diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/data/repository/KeyguardBypassRepositoryTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/data/repository/KeyguardBypassRepositoryTest.kt index a2fabf3b9baa..41fb4c1088bd 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/data/repository/KeyguardBypassRepositoryTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/data/repository/KeyguardBypassRepositoryTest.kt @@ -36,14 +36,12 @@ import com.android.systemui.statusbar.policy.devicePostureController import com.android.systemui.testKosmos import com.android.systemui.util.settings.data.repository.userAwareSecureSettingsRepository 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.Test import org.junit.runner.RunWith -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) @EnableSceneContainer diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/domain/interactor/KeyguardBypassInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/domain/interactor/KeyguardBypassInteractorTest.kt index 1cc55bf87b1a..091fbb65bcf9 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/domain/interactor/KeyguardBypassInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/domain/interactor/KeyguardBypassInteractorTest.kt @@ -33,13 +33,11 @@ import com.android.systemui.scene.shared.model.Scenes import com.android.systemui.shade.shadeTestUtil import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Test import org.junit.runner.RunWith -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) @EnableSceneContainer diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/ongoingcall/OngoingCallControllerTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/ongoingcall/OngoingCallControllerTest.kt index 02135f6a7836..eb95ddb39b40 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/ongoingcall/OngoingCallControllerTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/ongoingcall/OngoingCallControllerTest.kt @@ -49,7 +49,6 @@ import com.android.systemui.statusbar.phone.ongoingcall.shared.model.OngoingCall import com.android.systemui.statusbar.window.StatusBarWindowController import com.android.systemui.statusbar.window.StatusBarWindowControllerStore import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.After @@ -69,7 +68,6 @@ import org.mockito.kotlin.whenever @SmallTest @RunWith(AndroidJUnit4::class) @TestableLooper.RunWithLooper -@OptIn(ExperimentalCoroutinesApi::class) @DisableFlags(StatusBarChipsModernization.FLAG_NAME) class OngoingCallControllerTest : SysuiTestCase() { private val kosmos = Kosmos() diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/ongoingcall/domain/interactor/OngoingCallInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/ongoingcall/domain/interactor/OngoingCallInteractorTest.kt index 14263c4b1b9b..73c191b32393 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/ongoingcall/domain/interactor/OngoingCallInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/ongoingcall/domain/interactor/OngoingCallInteractorTest.kt @@ -14,8 +14,6 @@ * limitations under the License. */ -@file:OptIn(ExperimentalCoroutinesApi::class) - package com.android.systemui.statusbar.phone.ongoingcall.domain.interactor import android.app.PendingIntent @@ -40,7 +38,6 @@ import com.android.systemui.statusbar.notification.shared.CallType import com.android.systemui.statusbar.phone.ongoingcall.shared.model.OngoingCallModel import com.android.systemui.statusbar.window.fakeStatusBarWindowControllerStore import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runTest import org.junit.Before import org.junit.Test diff --git a/packages/SystemUI/multivalentTests/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 index 0641e173576d..ac92659bdff4 100644 --- a/packages/SystemUI/multivalentTests/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 @@ -28,7 +28,6 @@ import com.android.systemui.util.mockito.eq import com.android.systemui.util.mockito.whenever import com.android.systemui.util.settings.FakeGlobalSettings import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.launchIn import kotlinx.coroutines.test.StandardTestDispatcher import kotlinx.coroutines.test.TestScope @@ -41,7 +40,6 @@ import org.mockito.Mock import org.mockito.Mockito.verify import org.mockito.MockitoAnnotations -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class AirplaneModeRepositoryImplTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/airplane/domain/interactor/AirplaneModeInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/airplane/domain/interactor/AirplaneModeInteractorTest.kt index 7901f47b19fd..8e03563620e5 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/airplane/domain/interactor/AirplaneModeInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/airplane/domain/interactor/AirplaneModeInteractorTest.kt @@ -25,7 +25,6 @@ import com.android.systemui.statusbar.pipeline.shared.data.model.ConnectivitySlo import com.android.systemui.statusbar.pipeline.shared.data.repository.FakeConnectivityRepository import com.android.systemui.testKosmos 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.runCurrent @@ -33,7 +32,6 @@ import kotlinx.coroutines.test.runTest import org.junit.Test import org.junit.runner.RunWith -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class AirplaneModeInteractorTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/demo/DemoMobileConnectionParameterizedTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/demo/DemoMobileConnectionParameterizedTest.kt index 7d320212750f..e4806e62a9e5 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/demo/DemoMobileConnectionParameterizedTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/demo/DemoMobileConnectionParameterizedTest.kt @@ -34,7 +34,6 @@ import com.android.systemui.testKosmos import com.android.systemui.util.mockito.mock import com.android.systemui.util.mockito.whenever import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.Job import kotlinx.coroutines.cancel import kotlinx.coroutines.flow.MutableStateFlow @@ -54,7 +53,6 @@ import platform.test.runner.parameterized.Parameters * verifies that passing the given model to [DemoMobileConnectionsRepository] results in the correct * flows emitting from the given connection. */ -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(ParameterizedAndroidJunit4::class) internal class DemoMobileConnectionParameterizedTest(private val testCase: TestCase) : diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/demo/DemoMobileConnectionsRepositoryTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/demo/DemoMobileConnectionsRepositoryTest.kt index 5017dda88d3b..25359c92c3f6 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/demo/DemoMobileConnectionsRepositoryTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/demo/DemoMobileConnectionsRepositoryTest.kt @@ -38,7 +38,6 @@ import com.android.systemui.util.mockito.mock import com.android.systemui.util.mockito.whenever import com.google.common.truth.Truth.assertThat import junit.framework.Assert -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.Job import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.launchIn @@ -51,7 +50,6 @@ import org.junit.Before import org.junit.Test import org.junit.runner.RunWith -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class DemoMobileConnectionsRepositoryTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/prod/CarrierMergedConnectionRepositoryTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/prod/CarrierMergedConnectionRepositoryTest.kt index 715e3b472373..8e55f2e9a31a 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/prod/CarrierMergedConnectionRepositoryTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/prod/CarrierMergedConnectionRepositoryTest.kt @@ -30,7 +30,6 @@ import com.android.systemui.statusbar.pipeline.wifi.data.repository.FakeWifiRepo import com.android.systemui.statusbar.pipeline.wifi.shared.model.WifiNetworkModel import com.android.systemui.util.mockito.whenever 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 @@ -43,7 +42,6 @@ import org.mockito.Mock import org.mockito.MockitoAnnotations @SmallTest -@OptIn(ExperimentalCoroutinesApi::class) @RunWith(AndroidJUnit4::class) class CarrierMergedConnectionRepositoryTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/mobile/domain/interactor/MobileIconInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/mobile/domain/interactor/MobileIconInteractorTest.kt index 39a1c106cfcf..4009144757f7 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/mobile/domain/interactor/MobileIconInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/mobile/domain/interactor/MobileIconInteractorTest.kt @@ -45,7 +45,6 @@ import com.android.systemui.util.mockito.any import com.android.systemui.util.mockito.mock import com.android.systemui.util.mockito.whenever 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 @@ -57,7 +56,6 @@ import org.junit.runner.RunWith import org.mockito.ArgumentMatchers.anyInt import org.mockito.ArgumentMatchers.anyString -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class MobileIconInteractorTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/mobile/domain/interactor/MobileIconsInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/mobile/domain/interactor/MobileIconsInteractorTest.kt index 6efb9c77c131..d17abd7da05c 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/mobile/domain/interactor/MobileIconsInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/mobile/domain/interactor/MobileIconsInteractorTest.kt @@ -46,14 +46,12 @@ import com.android.systemui.testKosmos import com.android.systemui.util.CarrierConfigTracker import com.google.common.truth.Truth.assertThat import java.util.UUID -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.advanceTimeBy import org.junit.Test import org.junit.runner.RunWith import org.mockito.kotlin.mock import org.mockito.kotlin.whenever -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class MobileIconsInteractorTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/mobile/ui/viewmodel/LocationBasedMobileIconViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/mobile/ui/viewmodel/LocationBasedMobileIconViewModelTest.kt index f99fcac28be6..cef0824e16d2 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/mobile/ui/viewmodel/LocationBasedMobileIconViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/mobile/ui/viewmodel/LocationBasedMobileIconViewModelTest.kt @@ -41,7 +41,6 @@ import com.android.systemui.testKosmos import com.android.systemui.util.CarrierConfigTracker import com.android.systemui.util.mockito.mock 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 @@ -54,7 +53,6 @@ import org.mockito.Mock import org.mockito.MockitoAnnotations @Suppress("EXPERIMENTAL_IS_NOT_ENABLED") -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class LocationBasedMobileIconViewModelTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/mobile/ui/viewmodel/MobileIconViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/mobile/ui/viewmodel/MobileIconViewModelTest.kt index bf1fbad074cd..61ed04c6b59d 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/mobile/ui/viewmodel/MobileIconViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/mobile/ui/viewmodel/MobileIconViewModelTest.kt @@ -58,7 +58,6 @@ import com.android.systemui.util.CarrierConfigTracker import com.android.systemui.util.mockito.whenever import com.google.common.truth.Truth.assertThat import com.google.common.truth.Truth.assertWithMessage -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.filterIsInstance import kotlinx.coroutines.flow.launchIn import kotlinx.coroutines.flow.onEach @@ -73,7 +72,6 @@ import org.mockito.Mock import org.mockito.MockitoAnnotations @Suppress("EXPERIMENTAL_IS_NOT_ENABLED") -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class MobileIconViewModelTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/mobile/ui/viewmodel/MobileIconsViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/mobile/ui/viewmodel/MobileIconsViewModelTest.kt index 31ba83752758..46777fa68486 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/mobile/ui/viewmodel/MobileIconsViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/mobile/ui/viewmodel/MobileIconsViewModelTest.kt @@ -40,7 +40,6 @@ import com.android.systemui.util.mockito.mock import com.google.common.truth.Truth.assertThat import junit.framework.Assert.assertFalse import junit.framework.Assert.assertTrue -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.launchIn import kotlinx.coroutines.flow.onEach import kotlinx.coroutines.isActive @@ -54,7 +53,6 @@ import org.mockito.Mock import org.mockito.MockitoAnnotations @Suppress("EXPERIMENTAL_IS_NOT_ENABLED") -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class MobileIconsViewModelTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/satellite/data/DeviceBasedSatelliteRepositorySwitcherTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/satellite/data/DeviceBasedSatelliteRepositorySwitcherTest.kt index 19d5a16deabd..30346caace55 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/satellite/data/DeviceBasedSatelliteRepositorySwitcherTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/satellite/data/DeviceBasedSatelliteRepositorySwitcherTest.kt @@ -35,7 +35,6 @@ import com.android.systemui.util.mockito.whenever import com.android.systemui.util.time.FakeSystemClock import com.google.common.truth.Truth.assertThat import java.util.Optional -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.test.StandardTestDispatcher import kotlinx.coroutines.test.TestScope @@ -95,7 +94,6 @@ class DeviceBasedSatelliteRepositorySwitcherTest : SysuiTestCase() { testScope.backgroundScope, ) - @OptIn(ExperimentalCoroutinesApi::class) @Test fun switcherActiveRepo_updatesWhenDemoModeChanges() = testScope.runTest { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/satellite/ui/viewmodel/DeviceBasedSatelliteViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/satellite/ui/viewmodel/DeviceBasedSatelliteViewModelTest.kt index fe5b56a4e66d..c493c029a2a1 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/satellite/ui/viewmodel/DeviceBasedSatelliteViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/satellite/ui/viewmodel/DeviceBasedSatelliteViewModelTest.kt @@ -36,7 +36,6 @@ import com.android.systemui.statusbar.pipeline.wifi.shared.model.WifiNetworkMode import com.google.common.truth.Truth.assertThat import kotlin.test.Test import kotlin.time.Duration.Companion.seconds -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.advanceTimeBy import kotlinx.coroutines.test.runTest @@ -45,7 +44,6 @@ import org.junit.runner.RunWith import org.mockito.MockitoAnnotations import org.mockito.kotlin.mock -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class DeviceBasedSatelliteViewModelTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/shared/ui/viewmodel/FakeHomeStatusBarViewBinder.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/shared/ui/viewmodel/FakeHomeStatusBarViewBinder.kt index a2ca12c13a3e..5b5681e0faf4 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/shared/ui/viewmodel/FakeHomeStatusBarViewBinder.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/shared/ui/viewmodel/FakeHomeStatusBarViewBinder.kt @@ -35,7 +35,7 @@ class FakeHomeStatusBarViewBinder : HomeStatusBarViewBinder { viewModel: HomeStatusBarViewModel, systemEventChipAnimateIn: ((View) -> Unit)?, systemEventChipAnimateOut: ((View) -> Unit)?, - listener: StatusBarVisibilityChangeListener, + listener: StatusBarVisibilityChangeListener?, ) { this.listener = listener } diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/shared/ui/viewmodel/FakeHomeStatusBarViewModel.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/shared/ui/viewmodel/FakeHomeStatusBarViewModel.kt index 0223484dae41..4af97c0d33d9 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/shared/ui/viewmodel/FakeHomeStatusBarViewModel.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/shared/ui/viewmodel/FakeHomeStatusBarViewModel.kt @@ -52,8 +52,6 @@ class FakeHomeStatusBarViewModel( override val isHomeStatusBarAllowedByScene = MutableStateFlow(false) - override val shouldHomeStatusBarBeVisible = MutableStateFlow(false) - override val shouldShowOperatorNameView = MutableStateFlow(false) override val isClockVisible = diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/shared/ui/viewmodel/HomeStatusBarViewModelImplTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/shared/ui/viewmodel/HomeStatusBarViewModelImplTest.kt index 46f625fd9ba8..dc355434c00b 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/shared/ui/viewmodel/HomeStatusBarViewModelImplTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/shared/ui/viewmodel/HomeStatusBarViewModelImplTest.kt @@ -88,16 +88,13 @@ import com.android.systemui.statusbar.pipeline.shared.domain.interactor.setHomeS import com.android.systemui.statusbar.pipeline.shared.ui.model.VisibilityModel import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.runBlocking -import kotlinx.coroutines.test.runTest import org.junit.Before import org.junit.Test import org.junit.runner.RunWith @SmallTest -@OptIn(ExperimentalCoroutinesApi::class) @RunWith(AndroidJUnit4::class) class HomeStatusBarViewModelImplTest : SysuiTestCase() { private val kosmos = testKosmos().useUnconfinedTestDispatcher() @@ -651,98 +648,6 @@ class HomeStatusBarViewModelImplTest : SysuiTestCase() { } @Test - fun shouldHomeStatusBarBeVisible_keyguardNotGone_noHun_false() = - kosmos.runTest { - // Do not transition from keyguard. i.e., we don't call transitionKeyguardToGone() - - // Nothing disabled - fakeDisableFlagsRepository.disableFlags.value = - DisableFlagsModel(DISABLE_NONE, DISABLE2_NONE) - - val latest by collectLastValue(underTest.shouldHomeStatusBarBeVisible) - assertThat(latest).isFalse() - } - - @Test - fun shouldHomeStatusBarBeVisible_keyguardNotGone_hun_true() = - kosmos.runTest { - // Keyguard gone - transitionKeyguardToGone() - - // Nothing disabled - fakeDisableFlagsRepository.disableFlags.value = - DisableFlagsModel(DISABLE_NONE, DISABLE2_NONE) - - // there is an active HUN - headsUpNotificationRepository.setNotifications( - UnconfinedFakeHeadsUpRowRepository( - key = "key", - pinnedStatus = MutableStateFlow(PinnedStatus.PinnedByUser), - ) - ) - - val latest by collectLastValue(underTest.shouldHomeStatusBarBeVisible) - assertThat(latest).isTrue() - } - - @Test - fun shouldHomeStatusBarBeVisible_keyguardGone_noHun_notInCamera_true() = - kosmos.runTest { - // Keyguard gone - transitionKeyguardToGone() - - // Nothing disabled - fakeDisableFlagsRepository.disableFlags.value = - DisableFlagsModel(DISABLE_NONE, DISABLE2_NONE) - - val latest by collectLastValue(underTest.shouldHomeStatusBarBeVisible) - assertThat(latest).isTrue() - } - - @Test - fun shouldHomeStatusBarBeVisible_keyguardGone_hun_notInCamera_true() = - kosmos.runTest { - // Keyguard gone - transitionKeyguardToGone() - - // Nothing disabled - fakeDisableFlagsRepository.disableFlags.value = - DisableFlagsModel(DISABLE_NONE, DISABLE2_NONE) - - // there is an active HUN - headsUpNotificationRepository.setNotifications( - UnconfinedFakeHeadsUpRowRepository( - key = "key", - pinnedStatus = MutableStateFlow(PinnedStatus.PinnedByUser), - ) - ) - - val latest by collectLastValue(underTest.shouldHomeStatusBarBeVisible) - assertThat(latest).isTrue() - } - - @Test - fun shouldHomeStatusBarBeVisible_keyguardGone_noHun_inCamera_false() = - kosmos.runTest { - // Keyguard gone - transitionKeyguardToGone() - - // Nothing disabled - fakeDisableFlagsRepository.disableFlags.value = - DisableFlagsModel(DISABLE_NONE, DISABLE2_NONE) - - fakeKeyguardTransitionRepository.sendTransitionSteps( - from = KeyguardState.LOCKSCREEN, - to = KeyguardState.OCCLUDED, - testScope = testScope, - ) - kosmos.keyguardInteractor.onCameraLaunchDetected(CAMERA_LAUNCH_SOURCE_POWER_DOUBLE_TAP) - - val latest by collectLastValue(underTest.shouldHomeStatusBarBeVisible) - assertThat(latest).isFalse() - } - - @Test fun isClockVisible_allowedByDisableFlags_visible() = kosmos.runTest { val latest by collectLastValue(underTest.isClockVisible) diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/wifi/data/repository/WifiRepositorySwitcherTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/wifi/data/repository/WifiRepositorySwitcherTest.kt index 33223aef11ff..914d9f2173a7 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/wifi/data/repository/WifiRepositorySwitcherTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/wifi/data/repository/WifiRepositorySwitcherTest.kt @@ -38,7 +38,6 @@ import com.android.systemui.util.mockito.whenever import com.android.systemui.util.time.FakeSystemClock import com.android.wifitrackerlib.WifiPickerTracker import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.launchIn import kotlinx.coroutines.flow.onEach @@ -52,7 +51,6 @@ import org.mockito.Mock import org.mockito.Mockito import org.mockito.MockitoAnnotations -@OptIn(ExperimentalCoroutinesApi::class) @Suppress("EXPERIMENTAL_IS_NOT_ENABLED") @SmallTest @RunWith(AndroidJUnit4::class) 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 c0a15922642e..2aecf5b9dacb 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 @@ -28,7 +28,6 @@ import com.android.systemui.statusbar.pipeline.wifi.data.repository.FakeWifiRepo import com.android.systemui.statusbar.pipeline.wifi.shared.model.WifiNetworkModel import com.android.systemui.statusbar.pipeline.wifi.shared.model.WifiScanEntry 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 @@ -39,7 +38,6 @@ import org.junit.Before import org.junit.Test import org.junit.runner.RunWith -@OptIn(ExperimentalCoroutinesApi::class) @Suppress("EXPERIMENTAL_IS_NOT_ENABLED") @SmallTest @RunWith(AndroidJUnit4::class) diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/ZenModeControllerImplTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/ZenModeControllerImplTest.kt index 22250082944e..24fee19dbf58 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/ZenModeControllerImplTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/ZenModeControllerImplTest.kt @@ -31,7 +31,6 @@ import com.android.systemui.util.settings.fakeGlobalSettings import com.google.common.truth.Truth.assertThat import java.util.concurrent.atomic.AtomicBoolean import java.util.concurrent.atomic.AtomicInteger -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Before @@ -42,7 +41,6 @@ import org.mockito.Mockito import org.mockito.kotlin.mock import org.mockito.kotlin.whenever -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) @RunWithLooper diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/ZenModesCleanupStartableTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/ZenModesCleanupStartableTest.kt index fd8958166a6c..170a84b63dfb 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/ZenModesCleanupStartableTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/ZenModesCleanupStartableTest.kt @@ -26,7 +26,6 @@ import com.android.systemui.SysuiTestCase import com.android.systemui.kosmos.backgroundCoroutineContext import com.android.systemui.kosmos.testScope import com.android.systemui.testKosmos -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Before @@ -40,7 +39,6 @@ import org.mockito.kotlin.never import org.mockito.kotlin.verify import org.mockito.kotlin.whenever -@OptIn(ExperimentalCoroutinesApi::class) @RunWith(AndroidJUnit4::class) @SmallTest @EnableFlags(android.app.Flags.FLAG_MODES_UI) diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/bluetooth/BluetoothRepositoryImplTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/bluetooth/BluetoothRepositoryImplTest.kt index 94f0d196fa21..23933f658ac9 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/bluetooth/BluetoothRepositoryImplTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/bluetooth/BluetoothRepositoryImplTest.kt @@ -24,7 +24,6 @@ import com.android.systemui.SysuiTestCase import com.android.systemui.util.mockito.mock import com.android.systemui.util.mockito.whenever import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.StandardTestDispatcher import kotlinx.coroutines.test.TestCoroutineScheduler import kotlinx.coroutines.test.TestDispatcher @@ -35,7 +34,6 @@ import org.junit.runner.RunWith import org.mockito.Mock import org.mockito.MockitoAnnotations -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class BluetoothRepositoryImplTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/bluetooth/FakeBluetoothRepository.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/bluetooth/FakeBluetoothRepository.kt index d8c0f777d4cc..cdaca51c9db5 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/bluetooth/FakeBluetoothRepository.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/bluetooth/FakeBluetoothRepository.kt @@ -16,7 +16,6 @@ package com.android.systemui.statusbar.policy.bluetooth import com.android.settingslib.bluetooth.CachedBluetoothDevice import com.android.settingslib.bluetooth.LocalBluetoothManager -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.StandardTestDispatcher import kotlinx.coroutines.test.TestCoroutineScheduler import kotlinx.coroutines.test.TestScope @@ -28,7 +27,6 @@ import kotlinx.coroutines.test.TestScope * [StandardTestDispatcher], etc. to create a test version of the repo. This class uses those test * items under-the-hood so Java classes can indirectly access them. */ -@OptIn(ExperimentalCoroutinesApi::class) class FakeBluetoothRepository(localBluetoothManager: LocalBluetoothManager) : BluetoothRepository { private val scheduler = TestCoroutineScheduler() diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/data/repository/DeviceProvisioningRepositoryImplTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/data/repository/DeviceProvisioningRepositoryImplTest.kt index 21ed3841c70b..703baa1be4ac 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/data/repository/DeviceProvisioningRepositoryImplTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/data/repository/DeviceProvisioningRepositoryImplTest.kt @@ -13,8 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -@file:OptIn(ExperimentalCoroutinesApi::class) - package com.android.systemui.statusbar.policy.data.repository import androidx.test.ext.junit.runners.AndroidJUnit4 @@ -25,7 +23,6 @@ import com.android.systemui.statusbar.policy.DeviceProvisionedController import com.android.systemui.util.mockito.whenever import com.android.systemui.util.mockito.withArgCaptor import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Before diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/data/repository/UserSetupRepositoryTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/data/repository/UserSetupRepositoryTest.kt index 4c8bbe09a688..441b3306971f 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/data/repository/UserSetupRepositoryTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/data/repository/UserSetupRepositoryTest.kt @@ -14,8 +14,6 @@ * limitations under the License. */ -@file:OptIn(ExperimentalCoroutinesApi::class) - package com.android.systemui.statusbar.policy.data.repository import androidx.test.ext.junit.runners.AndroidJUnit4 @@ -34,7 +32,6 @@ import com.android.systemui.util.mockito.mock import com.android.systemui.util.mockito.whenever import com.google.common.truth.Truth.assertThat import kotlinx.coroutines.Dispatchers -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.launchIn import kotlinx.coroutines.flow.onEach import kotlinx.coroutines.test.runCurrent diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/ui/dialog/ModesDialogDelegateTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/ui/dialog/ModesDialogDelegateTest.kt index 2d6315014164..ffdebb3517e7 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/ui/dialog/ModesDialogDelegateTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/ui/dialog/ModesDialogDelegateTest.kt @@ -14,8 +14,6 @@ * limitations under the License. */ -@file:OptIn(ExperimentalCoroutinesApi::class) - package com.android.systemui.statusbar.policy.ui.dialog import android.app.Dialog @@ -37,7 +35,6 @@ import com.android.systemui.statusbar.phone.systemUIDialogFactory import com.android.systemui.statusbar.policy.ui.dialog.viewmodel.modesDialogViewModel import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.launch import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/ui/dialog/viewmodel/ModesDialogViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/ui/dialog/viewmodel/ModesDialogViewModelTest.kt index 856de8ee1c80..bae61bb867e1 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/ui/dialog/viewmodel/ModesDialogViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/ui/dialog/viewmodel/ModesDialogViewModelTest.kt @@ -14,8 +14,6 @@ * limitations under the License. */ -@file:OptIn(ExperimentalCoroutinesApi::class) - package com.android.systemui.statusbar.policy.ui.dialog.viewmodel import android.app.AutomaticZenRule @@ -41,7 +39,6 @@ import com.android.systemui.statusbar.policy.ui.dialog.mockModesDialogEventLogge import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat import java.util.Calendar -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.Job import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/ui/viewmodel/KeyguardStatusBarViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/ui/viewmodel/KeyguardStatusBarViewModelTest.kt index 73e5004d47f0..ebb4697d800e 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/ui/viewmodel/KeyguardStatusBarViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/ui/viewmodel/KeyguardStatusBarViewModelTest.kt @@ -44,7 +44,6 @@ import com.android.systemui.testKosmos import com.android.systemui.util.mockito.argumentCaptor import com.android.systemui.util.mockito.capture import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.launchIn import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest @@ -56,7 +55,6 @@ import platform.test.runner.parameterized.ParameterizedAndroidJunit4 import platform.test.runner.parameterized.Parameters @SmallTest -@OptIn(ExperimentalCoroutinesApi::class) @RunWith(ParameterizedAndroidJunit4::class) class KeyguardStatusBarViewModelTest(flags: FlagsParameterization) : SysuiTestCase() { private val kosmos = testKosmos() diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/window/data/repository/StatusBarWindowStatePerDisplayRepositoryTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/window/data/repository/StatusBarWindowStatePerDisplayRepositoryTest.kt index 42ebaf7e0c59..a132e4d40ae7 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/window/data/repository/StatusBarWindowStatePerDisplayRepositoryTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/window/data/repository/StatusBarWindowStatePerDisplayRepositoryTest.kt @@ -31,7 +31,6 @@ import com.android.systemui.statusbar.commandQueue import com.android.systemui.statusbar.window.shared.model.StatusBarWindowState import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Test @@ -40,7 +39,6 @@ import org.mockito.Mockito.verify import org.mockito.kotlin.argumentCaptor @SmallTest -@OptIn(ExperimentalCoroutinesApi::class) @RunWith(AndroidJUnit4::class) class StatusBarWindowStatePerDisplayRepositoryTest : SysuiTestCase() { private val kosmos = testKosmos() diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/window/data/repository/StatusBarWindowStateRepositoryStoreTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/window/data/repository/StatusBarWindowStateRepositoryStoreTest.kt index e36178cb99d5..4734810a5526 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/window/data/repository/StatusBarWindowStateRepositoryStoreTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/window/data/repository/StatusBarWindowStateRepositoryStoreTest.kt @@ -31,7 +31,6 @@ import com.android.systemui.statusbar.window.shared.model.StatusBarWindowState import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat import kotlin.test.Test -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.runner.RunWith @@ -40,7 +39,6 @@ import org.mockito.kotlin.argumentCaptor import org.mockito.kotlin.reset @SmallTest -@OptIn(ExperimentalCoroutinesApi::class) @RunWith(AndroidJUnit4::class) class StatusBarWindowStateRepositoryStoreTest : SysuiTestCase() { private val kosmos = testKosmos() diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/unfold/DisplaySwitchLatencyTrackerTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/unfold/DisplaySwitchLatencyTrackerTest.kt index ea91b7a9d6e2..fecf1fd2f222 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/unfold/DisplaySwitchLatencyTrackerTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/unfold/DisplaySwitchLatencyTrackerTest.kt @@ -56,7 +56,6 @@ import com.android.systemui.util.mockito.capture import com.android.systemui.util.time.FakeSystemClock import com.google.common.truth.Truth.assertThat import java.util.Optional -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.asExecutor import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.test.StandardTestDispatcher @@ -75,7 +74,6 @@ import org.mockito.Mockito.`when` as whenever import org.mockito.MockitoAnnotations import org.mockito.kotlin.mock -@OptIn(ExperimentalCoroutinesApi::class) @RunWith(AndroidJUnit4::class) @SmallTest class DisplaySwitchLatencyTrackerTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/unfold/FoldLightRevealOverlayAnimationTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/unfold/FoldLightRevealOverlayAnimationTest.kt index 665f55bfc2ec..dfc4d0f07df8 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/unfold/FoldLightRevealOverlayAnimationTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/unfold/FoldLightRevealOverlayAnimationTest.kt @@ -37,7 +37,6 @@ import com.android.systemui.power.domain.interactor.powerInteractor import com.android.systemui.power.shared.model.ScreenPowerState import com.android.systemui.statusbar.LightRevealScrim import com.android.systemui.util.animation.data.repository.fakeAnimationStatusRepository -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.advanceTimeBy import kotlinx.coroutines.test.runTest @@ -59,7 +58,6 @@ import org.mockito.kotlin.whenever @SmallTest @TestableLooper.RunWithLooper(setAsMainLooper = true) @RunWith(AndroidJUnit4::class) -@OptIn(ExperimentalCoroutinesApi::class) class FoldLightRevealOverlayAnimationTest : SysuiTestCase() { @get:Rule val animatorTestRule = AnimatorTestRule(this) diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/unfold/domain/interactor/UnfoldTransitionInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/unfold/domain/interactor/UnfoldTransitionInteractorTest.kt index 12f08a343886..872c84d63eed 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/unfold/domain/interactor/UnfoldTransitionInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/unfold/domain/interactor/UnfoldTransitionInteractorTest.kt @@ -26,7 +26,6 @@ import com.android.systemui.testKosmos import com.android.systemui.unfold.fakeUnfoldTransitionProgressProvider import com.google.common.truth.Truth.assertThat import java.util.Locale -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.async import kotlinx.coroutines.flow.combine import kotlinx.coroutines.test.runCurrent @@ -34,7 +33,6 @@ import kotlinx.coroutines.test.runTest import org.junit.Test import org.junit.runner.RunWith -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class UnfoldTransitionInteractorTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/user/data/repository/UserRepositoryImplTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/user/data/repository/UserRepositoryImplTest.kt index 8a4593032748..3ca1f5c0dd30 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/user/data/repository/UserRepositoryImplTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/user/data/repository/UserRepositoryImplTest.kt @@ -40,7 +40,6 @@ import com.android.systemui.util.settings.fakeGlobalSettings import com.google.common.truth.Truth.assertThat import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.launchIn import kotlinx.coroutines.flow.onEach import kotlinx.coroutines.test.runTest @@ -52,7 +51,6 @@ import org.mockito.Mockito.mock import org.mockito.Mockito.`when` as whenever import org.mockito.MockitoAnnotations -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class UserRepositoryImplTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/user/domain/interactor/UserLogoutInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/user/domain/interactor/UserLogoutInteractorTest.kt index f70b42638cda..cf01ee164e0d 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/user/domain/interactor/UserLogoutInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/user/domain/interactor/UserLogoutInteractorTest.kt @@ -27,14 +27,12 @@ import com.android.systemui.kosmos.useUnconfinedTestDispatcher import com.android.systemui.testKosmos import com.android.systemui.user.data.repository.fakeUserRepository import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.runBlocking import kotlinx.coroutines.test.runTest import org.junit.Before import org.junit.Test import org.junit.runner.RunWith -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class UserLogoutInteractorTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/user/domain/interactor/UserSwitcherInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/user/domain/interactor/UserSwitcherInteractorTest.kt index ccbdffa03cbf..3eada258f616 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/user/domain/interactor/UserSwitcherInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/user/domain/interactor/UserSwitcherInteractorTest.kt @@ -68,7 +68,6 @@ import com.android.systemui.util.mockito.mock import com.android.systemui.util.mockito.whenever import com.google.common.truth.Truth.assertThat import junit.framework.Assert.assertNotNull -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.launch import kotlinx.coroutines.runBlocking import kotlinx.coroutines.test.runCurrent @@ -87,7 +86,6 @@ import org.mockito.Mockito.times import org.mockito.Mockito.verify import org.mockito.MockitoAnnotations -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class UserSwitcherInteractorTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/user/ui/viewmodel/StatusBarUserChipViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/user/ui/viewmodel/StatusBarUserChipViewModelTest.kt index 99cdf731a765..5d51c6d16c5a 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/user/ui/viewmodel/StatusBarUserChipViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/user/ui/viewmodel/StatusBarUserChipViewModelTest.kt @@ -47,7 +47,6 @@ import com.android.systemui.user.domain.interactor.RefreshUsersScheduler import com.android.systemui.user.domain.interactor.UserSwitcherInteractor import com.android.systemui.util.mockito.mock import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.launchIn import kotlinx.coroutines.flow.onEach import kotlinx.coroutines.flow.toList @@ -66,7 +65,6 @@ import org.mockito.Mock import org.mockito.Mockito.doAnswer import org.mockito.MockitoAnnotations -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class StatusBarUserChipViewModelTest : SysuiTestCase() { @@ -265,7 +263,7 @@ class StatusBarUserChipViewModelTest : SysuiTestCase() { guestUserInteractor = guestUserInteractor, uiEventLogger = uiEventLogger, userRestrictionChecker = mock(), - processWrapper = ProcessWrapperFake() + processWrapper = ProcessWrapperFake(activityManager) ) ) } diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/user/ui/viewmodel/UserSwitcherViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/user/ui/viewmodel/UserSwitcherViewModelTest.kt index 917df619467d..8ff088f5d29b 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/user/ui/viewmodel/UserSwitcherViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/user/ui/viewmodel/UserSwitcherViewModelTest.kt @@ -51,7 +51,6 @@ import com.android.systemui.util.mockito.any import com.android.systemui.util.mockito.mock import com.android.systemui.util.mockito.whenever import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.toList import kotlinx.coroutines.launch import kotlinx.coroutines.runBlocking @@ -66,7 +65,6 @@ import org.junit.runner.RunWith import org.mockito.Mock import org.mockito.MockitoAnnotations -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class UserSwitcherViewModelTest : SysuiTestCase() { @@ -177,7 +175,7 @@ class UserSwitcherViewModelTest : SysuiTestCase() { guestUserInteractor = guestUserInteractor, uiEventLogger = uiEventLogger, userRestrictionChecker = mock(), - processWrapper = ProcessWrapperFake() + processWrapper = ProcessWrapperFake(activityManager) ), guestUserInteractor = guestUserInteractor, ) diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/util/kotlin/FlowUtilTests.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/util/kotlin/FlowUtilTests.kt index e2ce50ccb6da..9440280649dd 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/util/kotlin/FlowUtilTests.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/util/kotlin/FlowUtilTests.kt @@ -22,7 +22,6 @@ import com.android.systemui.SysuiTestCase import com.android.systemui.util.time.FakeSystemClock import com.google.common.truth.Truth.assertThat import kotlinx.coroutines.Dispatchers -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.Job import kotlinx.coroutines.delay import kotlinx.coroutines.flow.Flow @@ -244,7 +243,6 @@ class SampleFlowTest : SysuiTestCase() { } } -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class ThrottleFlowTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/util/settings/SettingsProxyExtTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/util/settings/SettingsProxyExtTest.kt index e281894a93ab..29d2bf9e051e 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/util/settings/SettingsProxyExtTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/util/settings/SettingsProxyExtTest.kt @@ -26,7 +26,6 @@ import com.android.systemui.coroutines.collectLastValue import com.android.systemui.kosmos.testScope import com.android.systemui.testKosmos import com.android.systemui.util.settings.SettingsProxyExt.observerFlow -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.Job import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest @@ -42,7 +41,6 @@ import org.mockito.kotlin.verify /** Tests for [SettingsProxyExt]. */ @RunWith(AndroidJUnit4::class) @SmallTest -@OptIn(ExperimentalCoroutinesApi::class) class SettingsProxyExtTest : SysuiTestCase() { private val kosmos = testKosmos() private val testScope = kosmos.testScope diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/util/settings/SettingsProxyTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/util/settings/SettingsProxyTest.kt index e25bf13c41f2..671ef5b95a79 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/util/settings/SettingsProxyTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/util/settings/SettingsProxyTest.kt @@ -28,7 +28,6 @@ import androidx.test.filters.SmallTest import com.android.systemui.SysuiTestCase import com.google.common.truth.Truth.assertThat import kotlinx.coroutines.CoroutineScope -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.StandardTestDispatcher import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.advanceUntilIdle @@ -45,7 +44,6 @@ import org.mockito.kotlin.eq @RunWith(AndroidJUnit4::class) @SmallTest @TestableLooper.RunWithLooper -@OptIn(ExperimentalCoroutinesApi::class) class SettingsProxyTest : SysuiTestCase() { private val testDispatcher = StandardTestDispatcher() diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/util/settings/UserSettingsProxyTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/util/settings/UserSettingsProxyTest.kt index 5787f7dfc61f..7b71283a9931 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/util/settings/UserSettingsProxyTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/util/settings/UserSettingsProxyTest.kt @@ -29,7 +29,6 @@ import androidx.test.filters.SmallTest import com.android.systemui.SysuiTestCase import com.google.common.truth.Truth.assertThat import kotlinx.coroutines.CoroutineScope -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.launch import kotlinx.coroutines.test.StandardTestDispatcher import kotlinx.coroutines.test.TestScope @@ -194,7 +193,6 @@ class UserSettingsProxyTest : SysuiTestCase() { ) } - @OptIn(ExperimentalCoroutinesApi::class) @Test fun registerContentObserverForUserAsync_callbackAfterRegister() = testScope.runTest { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/util/settings/repository/UserAwareSettingsRepositoryTestBase.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/util/settings/repository/UserAwareSettingsRepositoryTestBase.kt index 09db96f8ffb8..8b227176f858 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/util/settings/repository/UserAwareSettingsRepositoryTestBase.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/util/settings/repository/UserAwareSettingsRepositoryTestBase.kt @@ -25,13 +25,11 @@ import com.android.systemui.testKosmos import com.android.systemui.user.data.repository.fakeUserRepository import com.android.systemui.util.settings.fakeSettings import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Before import org.junit.Test -@OptIn(ExperimentalCoroutinesApi::class) abstract class UserAwareSettingsRepositoryTestBase : SysuiTestCase() { protected val kosmos = testKosmos() diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/util/ui/AnimatedValueTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/util/ui/AnimatedValueTest.kt index 6637d5f8de92..80fd01589fd5 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/util/ui/AnimatedValueTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/util/ui/AnimatedValueTest.kt @@ -13,8 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -@file:OptIn(ExperimentalCoroutinesApi::class) - package com.android.systemui.util.ui import androidx.test.ext.junit.runners.AndroidJUnit4 @@ -22,7 +20,6 @@ import androidx.test.filters.SmallTest import com.android.systemui.SysuiTestCase import com.android.systemui.coroutines.collectLastValue import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.MutableSharedFlow import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/CsdWarningDialogTest.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/CsdWarningDialogTest.java index bebf1cfa86e7..ac4ef06cd53a 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/CsdWarningDialogTest.java +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/CsdWarningDialogTest.java @@ -18,16 +18,13 @@ package com.android.systemui.volume; import static android.media.AudioManager.CSD_WARNING_DOSE_REACHED_1X; import static android.media.AudioManager.CSD_WARNING_DOSE_REPEATED_5X; - import static com.google.common.truth.Truth.assertThat; - import static org.mockito.Mockito.any; import static org.mockito.Mockito.eq; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; - import android.app.Notification; import android.app.NotificationManager; import android.content.Intent; @@ -48,13 +45,12 @@ import com.android.systemui.plugins.VolumeDialog; import com.android.systemui.util.concurrency.FakeExecutor; import com.android.systemui.util.time.FakeSystemClock; -import com.google.common.collect.ImmutableList; - import org.junit.After; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; +import java.util.Collections; import java.util.List; import java.util.Optional; @@ -69,8 +65,8 @@ public class CsdWarningDialogTest extends SysuiTestCase { private CsdWarningDialog mDialog; private static final String DISMISS_CSD_NOTIFICATION = "com.android.systemui.volume.DISMISS_CSD_NOTIFICATION"; - private final Optional<ImmutableList<CsdWarningAction>> mEmptyActions = - Optional.of(ImmutableList.of()); + private final Optional<List<CsdWarningAction>> mEmptyActions = + Optional.of(Collections.emptyList()); @Before public void setup() { @@ -84,7 +80,7 @@ public class CsdWarningDialogTest extends SysuiTestCase { @Test public void create1XCsdDialogAndWait_sendsNotification() { - FakeExecutor executor = new FakeExecutor(new FakeSystemClock()); + FakeExecutor executor = new FakeExecutor(new FakeSystemClock()); // instantiate directly instead of via factory; we don't want executor to be @Background mDialog = new CsdWarningDialog(CSD_WARNING_DOSE_REACHED_1X, mContext, mAudioManager, mNotificationManager, executor, null, @@ -102,7 +98,7 @@ public class CsdWarningDialogTest extends SysuiTestCase { @Test public void create5XCsdDialogAndWait_willSendNotification() { - FakeExecutor executor = new FakeExecutor(new FakeSystemClock()); + FakeExecutor executor = new FakeExecutor(new FakeSystemClock()); mDialog = new CsdWarningDialog(CSD_WARNING_DOSE_REPEATED_5X, mContext, mAudioManager, mNotificationManager, executor, null, mEmptyActions, @@ -122,7 +118,7 @@ public class CsdWarningDialogTest extends SysuiTestCase { .setPackage(mContext.getPackageName()); mDialog = new CsdWarningDialog(CSD_WARNING_DOSE_REPEATED_5X, mContext, mAudioManager, mNotificationManager, executor, null, - Optional.of(ImmutableList.of(new CsdWarningAction("Undo", undoIntent, false))), + Optional.of(List.of(new CsdWarningAction("Undo", undoIntent, false))), mFakeBroadcastDispatcher); when(mAudioManager.getStreamVolume(AudioManager.STREAM_MUSIC)).thenReturn(25); @@ -149,7 +145,7 @@ public class CsdWarningDialogTest extends SysuiTestCase { .setPackage(mContext.getPackageName()); mDialog = new CsdWarningDialog(CSD_WARNING_DOSE_REPEATED_5X, mContext, mAudioManager, mNotificationManager, executor, null, - Optional.of(ImmutableList.of(new CsdWarningAction("Undo", undoIntent, false))), + Optional.of(List.of(new CsdWarningAction("Undo", undoIntent, false))), mFakeBroadcastDispatcher); Intent dismissIntent = new Intent(DISMISS_CSD_NOTIFICATION) .setPackage(mContext.getPackageName()); diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/VolumeControllerAdapterTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/VolumeControllerAdapterTest.kt index c1403649efdd..d61a7daf6cb9 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/VolumeControllerAdapterTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/VolumeControllerAdapterTest.kt @@ -25,7 +25,6 @@ import com.android.systemui.kosmos.applicationCoroutineScope import com.android.systemui.kosmos.testScope import com.android.systemui.testKosmos import com.android.systemui.volume.data.repository.audioRepository -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest @@ -36,7 +35,6 @@ import org.mockito.kotlin.eq import org.mockito.kotlin.mock import org.mockito.kotlin.verify -@OptIn(ExperimentalCoroutinesApi::class) @RunWith(AndroidJUnit4::class) @SmallTest class VolumeControllerAdapterTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/VolumeDialogControllerImplTestKt.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/VolumeDialogControllerImplTestKt.kt index a9c352df9a26..95d6743a3c41 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/VolumeDialogControllerImplTestKt.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/VolumeDialogControllerImplTestKt.kt @@ -53,7 +53,6 @@ import com.android.systemui.util.kotlin.JavaAdapter import com.android.systemui.util.time.fakeSystemClock import com.android.systemui.volume.data.repository.audioRepository import com.android.systemui.volume.domain.interactor.FakeAudioSharingInteractor -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Before @@ -66,7 +65,6 @@ import org.mockito.kotlin.mock import org.mockito.kotlin.verify import org.mockito.kotlin.whenever -@OptIn(ExperimentalCoroutinesApi::class) @RunWith(AndroidJUnit4::class) @SmallTest @TestableLooper.RunWithLooper diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/data/repository/VolumeDialogRepositoryTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/data/repository/VolumeDialogRepositoryTest.kt index dcac85e7fb5b..240121422ef0 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/data/repository/VolumeDialogRepositoryTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/data/repository/VolumeDialogRepositoryTest.kt @@ -23,14 +23,12 @@ import com.android.systemui.coroutines.collectLastValue 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.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Before import org.junit.Test import org.junit.runner.RunWith -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class VolumeDialogRepositoryTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/dialog/domain/interactor/VolumeDialogVisibilityInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/dialog/domain/interactor/VolumeDialogVisibilityInteractorTest.kt index 31d2eb37dead..d0cabec8332a 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/dialog/domain/interactor/VolumeDialogVisibilityInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/dialog/domain/interactor/VolumeDialogVisibilityInteractorTest.kt @@ -31,7 +31,6 @@ import com.android.systemui.volume.dialog.shared.model.VolumeDialogVisibilityMod import com.google.common.truth.Truth.assertThat import kotlin.time.Duration.Companion.days import kotlin.time.Duration.Companion.seconds -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.advanceTimeBy import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest @@ -41,7 +40,6 @@ import org.junit.runner.RunWith private val dialogTimeoutDuration = 3.seconds -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) @TestableLooper.RunWithLooper diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/dialog/ringer/domain/VolumeDialogRingerInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/dialog/ringer/domain/VolumeDialogRingerInteractorTest.kt index 12885a83a70b..4ce2e10b1247 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/dialog/ringer/domain/VolumeDialogRingerInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/dialog/ringer/domain/VolumeDialogRingerInteractorTest.kt @@ -31,12 +31,10 @@ import com.android.systemui.kosmos.useUnconfinedTestDispatcher import com.android.systemui.plugins.fakeVolumeDialogController import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import org.junit.Before import org.junit.Test import org.junit.runner.RunWith -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) @TestableLooper.RunWithLooper diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/dialog/ringer/ui/viewmodel/VolumeDialogRingerDrawerViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/dialog/ringer/ui/viewmodel/VolumeDialogRingerDrawerViewModelTest.kt index 2dcfdd958df1..4e8a375b53bb 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/dialog/ringer/ui/viewmodel/VolumeDialogRingerDrawerViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/dialog/ringer/ui/viewmodel/VolumeDialogRingerDrawerViewModelTest.kt @@ -33,7 +33,6 @@ import com.android.systemui.testKosmos import com.android.systemui.util.time.fakeSystemClock import com.android.systemui.volume.data.repository.audioSystemRepository 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 @@ -41,7 +40,6 @@ import org.junit.Before import org.junit.Test import org.junit.runner.RunWith -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) @TestableLooper.RunWithLooper diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/dialog/sliders/domain/interactor/VolumeDialogSliderInputEventsInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/dialog/sliders/domain/interactor/VolumeDialogSliderInputEventsInteractorTest.kt index 0a50722d8fed..4ed0d6ed4657 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/dialog/sliders/domain/interactor/VolumeDialogSliderInputEventsInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/dialog/sliders/domain/interactor/VolumeDialogSliderInputEventsInteractorTest.kt @@ -32,7 +32,6 @@ import com.android.systemui.volume.dialog.sliders.shared.model.SliderInputEvent import com.google.common.truth.Truth.assertThat import kotlin.test.Test import kotlin.time.Duration.Companion.seconds -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.advanceTimeBy import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest @@ -41,7 +40,6 @@ import org.junit.runner.RunWith private val volumeDialogTimeout = 3.seconds -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) @TestableLooper.RunWithLooper diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/dialog/sliders/domain/interactor/VolumeDialogSlidersInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/dialog/sliders/domain/interactor/VolumeDialogSlidersInteractorTest.kt index 87d782e7815d..de81212900ea 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/dialog/sliders/domain/interactor/VolumeDialogSlidersInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/dialog/sliders/domain/interactor/VolumeDialogSlidersInteractorTest.kt @@ -30,7 +30,6 @@ import com.android.systemui.plugins.fakeVolumeDialogController import com.android.systemui.testKosmos import com.android.systemui.volume.dialog.sliders.domain.model.VolumeDialogSliderType import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Before @@ -40,7 +39,6 @@ import org.mockito.kotlin.whenever private const val AUDIO_SHARING_STREAM = 99 -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) @TestableLooper.RunWithLooper diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/domain/interactor/AudioModeInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/domain/interactor/AudioModeInteractorTest.kt index fe34361540e1..6df0184cabcf 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/domain/interactor/AudioModeInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/domain/interactor/AudioModeInteractorTest.kt @@ -23,7 +23,6 @@ import com.android.settingslib.volume.domain.interactor.AudioModeInteractor import com.android.systemui.SysuiTestCase import com.android.systemui.volume.data.repository.FakeAudioRepository 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 @@ -32,7 +31,6 @@ import kotlinx.coroutines.test.runTest import org.junit.Test import org.junit.runner.RunWith -@OptIn(ExperimentalCoroutinesApi::class) @RunWith(AndroidJUnit4::class) @SmallTest class AudioModeInteractorTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/domain/interactor/AudioOutputInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/domain/interactor/AudioOutputInteractorTest.kt index 7c55f7a91a76..3f1b3a6e5ee9 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/domain/interactor/AudioOutputInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/domain/interactor/AudioOutputInteractorTest.kt @@ -38,7 +38,6 @@ import com.android.systemui.volume.localMediaRepository import com.android.systemui.volume.mediaControllerRepository import com.android.systemui.volume.panel.component.mediaoutput.domain.interactor.TestMediaDevicesFactory import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Before @@ -51,7 +50,6 @@ import org.mockito.kotlin.whenever private const val builtInDeviceName = "This phone" -@OptIn(ExperimentalCoroutinesApi::class) @RunWith(AndroidJUnit4::class) @SmallTest @TestableLooper.RunWithLooper(setAsMainLooper = true) diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/domain/interactor/AudioSharingInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/domain/interactor/AudioSharingInteractorTest.kt index 09d6ac6589ed..1b4d7d02ae1c 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/domain/interactor/AudioSharingInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/domain/interactor/AudioSharingInteractorTest.kt @@ -31,7 +31,6 @@ import com.android.systemui.kosmos.testScope import com.android.systemui.testKosmos import com.android.systemui.volume.data.repository.audioSharingRepository import com.google.common.truth.Truth -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Before @@ -40,7 +39,6 @@ import org.junit.runner.RunWith import org.mockito.kotlin.mock import org.mockito.kotlin.whenever -@OptIn(ExperimentalCoroutinesApi::class) @RunWith(AndroidJUnit4::class) @SmallTest class AudioSharingInteractorTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/domain/interactor/AudioVolumeInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/domain/interactor/AudioVolumeInteractorTest.kt index 1ea8a6b8d9e5..35ad3a24e971 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/domain/interactor/AudioVolumeInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/domain/interactor/AudioVolumeInteractorTest.kt @@ -32,14 +32,12 @@ import com.android.systemui.statusbar.policy.data.repository.zenModeRepository import com.android.systemui.testKosmos import com.android.systemui.volume.data.repository.audioRepository import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Before import org.junit.Test import org.junit.runner.RunWith -@OptIn(ExperimentalCoroutinesApi::class) @RunWith(AndroidJUnit4::class) @SmallTest class AudioVolumeInteractorTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/domain/interactor/VolumeDialogInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/domain/interactor/VolumeDialogInteractorTest.kt index 5c735e3c7842..784ff9aea35d 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/domain/interactor/VolumeDialogInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/domain/interactor/VolumeDialogInteractorTest.kt @@ -23,14 +23,12 @@ import com.android.systemui.coroutines.collectLastValue 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.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Before import org.junit.Test import org.junit.runner.RunWith -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class VolumeDialogInteractorTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/domain/startable/AudioModeLoggerStartableTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/domain/startable/AudioModeLoggerStartableTest.kt index 89acbc8f1abd..bbcbac7114a8 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/domain/startable/AudioModeLoggerStartableTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/domain/startable/AudioModeLoggerStartableTest.kt @@ -29,7 +29,6 @@ import com.android.systemui.volume.data.repository.audioRepository import com.android.systemui.volume.domain.interactor.audioModeInteractor import com.android.systemui.volume.panel.ui.VolumePanelUiEvent import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Before @@ -39,7 +38,6 @@ import org.junit.runner.RunWith import org.mockito.junit.MockitoJUnit import org.mockito.junit.MockitoRule -@OptIn(ExperimentalCoroutinesApi::class) @RunWith(AndroidJUnit4::class) @SmallTest class AudioModeLoggerStartableTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/panel/component/anc/data/repository/AncSliceRepositoryTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/panel/component/anc/data/repository/AncSliceRepositoryTest.kt index 9a952742f735..3c9e45c6bbb0 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/panel/component/anc/data/repository/AncSliceRepositoryTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/panel/component/anc/data/repository/AncSliceRepositoryTest.kt @@ -28,7 +28,6 @@ import com.android.systemui.testKosmos import com.android.systemui.volume.panel.component.anc.FakeSliceFactory import com.android.systemui.volume.panel.component.anc.sliceViewManager import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Before @@ -38,7 +37,6 @@ import org.mockito.kotlin.any import org.mockito.kotlin.mock import org.mockito.kotlin.whenever -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) @TestableLooper.RunWithLooper(setAsMainLooper = true) diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/panel/component/anc/domain/AncAvailabilityCriteriaTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/panel/component/anc/domain/AncAvailabilityCriteriaTest.kt index 8d052fe12a5a..1bb23f656696 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/panel/component/anc/domain/AncAvailabilityCriteriaTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/panel/component/anc/domain/AncAvailabilityCriteriaTest.kt @@ -36,14 +36,12 @@ import com.android.systemui.volume.panel.component.anc.ancSliceRepository import com.android.systemui.volume.panel.component.anc.sliceViewManager import com.android.systemui.volume.panel.component.mediaoutput.domain.interactor.TestMediaDevicesFactory import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Before import org.junit.Test import org.junit.runner.RunWith -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) @TestableLooper.RunWithLooper(setAsMainLooper = true) diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/panel/component/anc/domain/interactor/AncSliceInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/panel/component/anc/domain/interactor/AncSliceInteractorTest.kt index 741671e6a8a3..b6590592cccc 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/panel/component/anc/domain/interactor/AncSliceInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/panel/component/anc/domain/interactor/AncSliceInteractorTest.kt @@ -32,14 +32,12 @@ import com.android.systemui.volume.panel.component.anc.ancSliceRepository import com.android.systemui.volume.panel.component.anc.domain.model.AncSlices import com.android.systemui.volume.panel.component.mediaoutput.domain.interactor.TestMediaDevicesFactory import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Before import org.junit.Test import org.junit.runner.RunWith -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) @TestableLooper.RunWithLooper(setAsMainLooper = true) diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/panel/component/bottombar/ui/viewmodel/BottomBarViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/panel/component/bottombar/ui/viewmodel/BottomBarViewModelTest.kt index 254a967e480e..9055a117549c 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/panel/component/bottombar/ui/viewmodel/BottomBarViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/panel/component/bottombar/ui/viewmodel/BottomBarViewModelTest.kt @@ -34,7 +34,6 @@ import com.android.systemui.volume.panel.data.repository.volumePanelGlobalStateR import com.android.systemui.volume.panel.ui.VolumePanelUiEvent import com.android.systemui.volume.panel.ui.viewmodel.volumePanelViewModel import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Rule @@ -45,7 +44,6 @@ import org.mockito.Captor import org.mockito.Mockito.verify import org.mockito.junit.MockitoJUnit -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class BottomBarViewModelTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/panel/component/captioning/ui/viewmodel/CaptioningViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/panel/component/captioning/ui/viewmodel/CaptioningViewModelTest.kt index cb6dc193394e..7b8dc18a65d4 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/panel/component/captioning/ui/viewmodel/CaptioningViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/panel/component/captioning/ui/viewmodel/CaptioningViewModelTest.kt @@ -27,14 +27,12 @@ import com.android.systemui.kosmos.applicationCoroutineScope 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.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Before import org.junit.Test import org.junit.runner.RunWith -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class CaptioningViewModelTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/panel/component/mediaoutput/domain/MediaOutputAvailabilityCriteriaTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/panel/component/mediaoutput/domain/MediaOutputAvailabilityCriteriaTest.kt deleted file mode 100644 index d0cc56860ce8..000000000000 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/panel/component/mediaoutput/domain/MediaOutputAvailabilityCriteriaTest.kt +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (C) 2025 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.volume.panel.component.mediaoutput.domain - -import android.content.mockedContext -import android.content.packageManager -import android.content.pm.PackageManager.FEATURE_PC -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.kosmos.collectLastValue -import com.android.systemui.kosmos.runTest -import com.android.systemui.kosmos.testScope -import com.android.systemui.testKosmos -import com.android.systemui.util.mockito.whenever -import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi -import org.junit.Before -import org.junit.Test -import org.junit.runner.RunWith - -@OptIn(ExperimentalCoroutinesApi::class) -@SmallTest -@RunWith(AndroidJUnit4::class) -@TestableLooper.RunWithLooper(setAsMainLooper = true) -class MediaOutputAvailabilityCriteriaTest : SysuiTestCase() { - - private val kosmos = testKosmos() - private val scope = kosmos.testScope - - private lateinit var underTest: MediaOutputAvailabilityCriteria - - @Before - fun setup() { - with(kosmos) { - underTest = MediaOutputAvailabilityCriteria(kosmos.mockedContext, scope.backgroundScope) - } - } - - @Test - fun isDesktop_unavailable() = - kosmos.runTest { - whenever(mockedContext.getPackageManager()).thenReturn(packageManager) - whenever(packageManager.hasSystemFeature(FEATURE_PC)).thenReturn(true) - - val isAvailable by collectLastValue(underTest.isAvailable()) - - assertThat(isAvailable).isFalse() - } - - @Test - fun notIsDesktop_available() = - kosmos.runTest { - whenever(mockedContext.getPackageManager()).thenReturn(packageManager) - whenever(packageManager.hasSystemFeature(FEATURE_PC)).thenReturn(false) - - val isAvailable by collectLastValue(underTest.isAvailable()) - - assertThat(isAvailable).isTrue() - } -} diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/panel/component/mediaoutput/domain/interactor/MediaDeviceSessionInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/panel/component/mediaoutput/domain/interactor/MediaDeviceSessionInteractorTest.kt index 46df0c227f1c..3bf112a84403 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/panel/component/mediaoutput/domain/interactor/MediaDeviceSessionInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/panel/component/mediaoutput/domain/interactor/MediaDeviceSessionInteractorTest.kt @@ -30,14 +30,12 @@ import com.android.systemui.volume.mediaOutputInteractor import com.android.systemui.volume.panel.shared.model.filterData import com.android.systemui.volume.remoteMediaController import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Before import org.junit.Test import org.junit.runner.RunWith -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) @TestableLooper.RunWithLooper(setAsMainLooper = true) diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/panel/component/mediaoutput/domain/interactor/MediaOutputComponentInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/panel/component/mediaoutput/domain/interactor/MediaOutputComponentInteractorTest.kt index 449dc20656b7..a2dd1e7df431 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/panel/component/mediaoutput/domain/interactor/MediaOutputComponentInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/panel/component/mediaoutput/domain/interactor/MediaOutputComponentInteractorTest.kt @@ -41,7 +41,6 @@ import com.android.systemui.volume.mediaControllerRepository import com.android.systemui.volume.panel.component.mediaoutput.domain.model.MediaOutputComponentModel import com.android.systemui.volume.panel.shared.model.filterData import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Before @@ -51,7 +50,6 @@ import org.mockito.kotlin.whenever private const val builtInDeviceName = "This phone" -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) @TestableLooper.RunWithLooper(setAsMainLooper = true) diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/panel/component/mediaoutput/domain/interactor/MediaOutputInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/panel/component/mediaoutput/domain/interactor/MediaOutputInteractorTest.kt index 9e86cedb6732..dacf4d4a41e8 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/panel/component/mediaoutput/domain/interactor/MediaOutputInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/panel/component/mediaoutput/domain/interactor/MediaOutputInteractorTest.kt @@ -42,14 +42,12 @@ import com.android.systemui.volume.remoteMediaController import com.android.systemui.volume.remotePlaybackInfo import com.android.systemui.volume.remotePlaybackStateBuilder import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Before import org.junit.Test import org.junit.runner.RunWith -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) @TestableLooper.RunWithLooper(setAsMainLooper = true) diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/panel/component/mediaoutput/ui/viewmodel/MediaOutputViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/panel/component/mediaoutput/ui/viewmodel/MediaOutputViewModelTest.kt index 86a20dccc8fa..6753ccb1ad04 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/panel/component/mediaoutput/ui/viewmodel/MediaOutputViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/panel/component/mediaoutput/ui/viewmodel/MediaOutputViewModelTest.kt @@ -37,14 +37,12 @@ import com.android.systemui.volume.mediaControllerRepository import com.android.systemui.volume.mediaOutputActionsInteractor import com.android.systemui.volume.panel.component.mediaoutput.domain.interactor.mediaOutputComponentInteractor import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Before import org.junit.Test import org.junit.runner.RunWith -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) @TestableLooper.RunWithLooper(setAsMainLooper = true) diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/panel/component/spatial/domain/SpatialAudioAvailabilityCriteriaTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/panel/component/spatial/domain/SpatialAudioAvailabilityCriteriaTest.kt index ebc78d864494..4aaecabf71a7 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/panel/component/spatial/domain/SpatialAudioAvailabilityCriteriaTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/panel/component/spatial/domain/SpatialAudioAvailabilityCriteriaTest.kt @@ -41,14 +41,12 @@ import com.android.systemui.volume.localMediaRepository import com.android.systemui.volume.mediaControllerRepository import com.android.systemui.volume.panel.component.spatial.spatialAudioComponentInteractor import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Before import org.junit.Test import org.junit.runner.RunWith -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) @RunWithLooper(setAsMainLooper = true) diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/panel/component/spatial/domain/interactor/SpatialAudioComponentInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/panel/component/spatial/domain/interactor/SpatialAudioComponentInteractorTest.kt index d5566adb1fdc..691d5e35e786 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/panel/component/spatial/domain/interactor/SpatialAudioComponentInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/panel/component/spatial/domain/interactor/SpatialAudioComponentInteractorTest.kt @@ -48,7 +48,6 @@ import com.android.systemui.volume.panel.component.spatial.domain.model.SpatialA import com.android.systemui.volume.panel.component.spatial.domain.model.SpatialAudioEnabledModel import com.android.systemui.volume.panel.component.spatial.spatialAudioComponentInteractor import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Before @@ -56,7 +55,6 @@ import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) @TestableLooper.RunWithLooper(setAsMainLooper = true) diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/panel/component/volume/domain/interactor/AudioSlidersInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/panel/component/volume/domain/interactor/AudioSlidersInteractorTest.kt index 76a1269a1fe9..5a814fcfa621 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/panel/component/volume/domain/interactor/AudioSlidersInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/panel/component/volume/domain/interactor/AudioSlidersInteractorTest.kt @@ -32,14 +32,12 @@ import com.android.systemui.volume.data.repository.audioRepository import com.android.systemui.volume.data.repository.audioSystemRepository import com.android.systemui.volume.panel.component.volume.domain.model.SliderType import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Before import org.junit.Test import org.junit.runner.RunWith -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) @TestableLooper.RunWithLooper(setAsMainLooper = true) diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/panel/component/volume/slider/ui/viewmodel/AudioSharingStreamSliderViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/panel/component/volume/slider/ui/viewmodel/AudioSharingStreamSliderViewModelTest.kt index b34d7b8ec17d..e484d8090c64 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/panel/component/volume/slider/ui/viewmodel/AudioSharingStreamSliderViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/panel/component/volume/slider/ui/viewmodel/AudioSharingStreamSliderViewModelTest.kt @@ -31,7 +31,6 @@ import com.android.systemui.testKosmos import com.android.systemui.volume.data.repository.audioSharingRepository import com.android.systemui.volume.domain.interactor.audioSharingInteractor import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Before @@ -39,7 +38,6 @@ import org.junit.Test import org.junit.runner.RunWith import org.mockito.kotlin.mock -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class AudioSharingStreamSliderViewModelTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/panel/ui/viewmodel/VolumePanelViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/panel/ui/viewmodel/VolumePanelViewModelTest.kt index fe6c7417032f..25eb3194fffe 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/panel/ui/viewmodel/VolumePanelViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/panel/ui/viewmodel/VolumePanelViewModelTest.kt @@ -47,7 +47,6 @@ import com.google.common.truth.Truth.assertThat import java.io.PrintWriter import java.io.StringWriter import javax.inject.Provider -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.launch import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest @@ -56,7 +55,6 @@ import org.junit.runner.RunWith @SmallTest @RunWith(AndroidJUnit4::class) -@OptIn(ExperimentalCoroutinesApi::class) class VolumePanelViewModelTest : SysuiTestCase() { private val kosmos = diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/ui/navigation/VolumeNavigatorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/ui/navigation/VolumeNavigatorTest.kt index 7934b02126bd..dbd50a6f9fc5 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/ui/navigation/VolumeNavigatorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/ui/navigation/VolumeNavigatorTest.kt @@ -30,7 +30,6 @@ import com.android.systemui.volume.domain.model.VolumePanelRoute import com.android.systemui.volume.panel.domain.interactor.volumePanelGlobalStateInteractor import com.android.systemui.volume.panel.ui.viewmodel.volumePanelViewModelFactory import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Test @@ -41,7 +40,6 @@ import org.mockito.kotlin.any import org.mockito.kotlin.mock import org.mockito.kotlin.whenever -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class VolumeNavigatorTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/wallet/controller/WalletContextualLocationsServiceTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/wallet/controller/WalletContextualLocationsServiceTest.kt index 6f99cd90ffc6..eaf42acb7c5f 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/wallet/controller/WalletContextualLocationsServiceTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/wallet/controller/WalletContextualLocationsServiceTest.kt @@ -33,7 +33,6 @@ import org.mockito.MockitoAnnotations @RunWith(AndroidJUnit4::class) @SmallTest -@kotlinx.coroutines.ExperimentalCoroutinesApi class WalletContextualLocationsServiceTest : SysuiTestCase() { @Mock private lateinit var controller: WalletContextualSuggestionsController private var featureFlags = FakeFeatureFlags() @@ -49,7 +48,6 @@ class WalletContextualLocationsServiceTest : SysuiTestCase() { } @Before - @kotlinx.coroutines.ExperimentalCoroutinesApi fun setUp() { MockitoAnnotations.initMocks(this) doReturn(fakeWalletCards).whenever(controller).allWalletCards @@ -70,7 +68,6 @@ class WalletContextualLocationsServiceTest : SysuiTestCase() { } @Test - @kotlinx.coroutines.ExperimentalCoroutinesApi fun addListener() = testScope.runTest { underTest.addWalletCardsUpdatedListenerInternal(listener) @@ -78,7 +75,6 @@ class WalletContextualLocationsServiceTest : SysuiTestCase() { } @Test - @kotlinx.coroutines.ExperimentalCoroutinesApi fun addStoreLocations() = testScope.runTest { underTest.onWalletContextualLocationsStateUpdatedInternal(ArrayList<String>()) @@ -86,7 +82,6 @@ class WalletContextualLocationsServiceTest : SysuiTestCase() { } @Test - @kotlinx.coroutines.ExperimentalCoroutinesApi fun updateListenerAndLocationsState() = testScope.runTest { // binds to the service and adds a listener diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/wallet/controller/WalletContextualSuggestionsControllerTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/wallet/controller/WalletContextualSuggestionsControllerTest.kt index 4e44c4a224d4..e5d7f596f1f1 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/wallet/controller/WalletContextualSuggestionsControllerTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/wallet/controller/WalletContextualSuggestionsControllerTest.kt @@ -37,7 +37,6 @@ import com.android.systemui.util.mockito.nullable import com.android.systemui.util.mockito.whenever import com.google.common.truth.Truth.assertThat import kotlinx.coroutines.CoroutineScope -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Before @@ -51,7 +50,6 @@ import org.mockito.Mockito.never import org.mockito.Mockito.verify import org.mockito.MockitoAnnotations -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class WalletContextualSuggestionsControllerTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/wallpapers/data/repository/WallpaperRepositoryImplTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/wallpapers/data/repository/WallpaperRepositoryImplTest.kt index 2b16c00107c3..1f5e7cace8eb 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/wallpapers/data/repository/WallpaperRepositoryImplTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/wallpapers/data/repository/WallpaperRepositoryImplTest.kt @@ -35,7 +35,6 @@ import com.android.systemui.user.data.model.SelectedUserModel import com.android.systemui.user.data.model.SelectionStatus import com.android.systemui.user.data.repository.FakeUserRepository import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.StandardTestDispatcher import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.runCurrent @@ -48,7 +47,6 @@ import org.mockito.kotlin.mock import org.mockito.kotlin.whenever @SmallTest -@OptIn(ExperimentalCoroutinesApi::class) @RunWith(AndroidJUnit4::class) class WallpaperRepositoryImplTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/window/domain/interactor/WindowRootViewBlurInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/window/domain/interactor/WindowRootViewBlurInteractorTest.kt index bc16bec5d5cd..79edc223bc83 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/window/domain/interactor/WindowRootViewBlurInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/window/domain/interactor/WindowRootViewBlurInteractorTest.kt @@ -24,12 +24,10 @@ import com.android.systemui.coroutines.collectLastValue 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.runTest import org.junit.Test import org.junit.runner.RunWith -@ExperimentalCoroutinesApi @SmallTest @RunWith(AndroidJUnit4::class) class WindowRootViewBlurInteractorTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/window/ui/viewmodel/WindowRootViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/window/ui/viewmodel/WindowRootViewModelTest.kt index b97fe5725285..3c4e3612c053 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/window/ui/viewmodel/WindowRootViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/window/ui/viewmodel/WindowRootViewModelTest.kt @@ -24,14 +24,12 @@ import com.android.systemui.kosmos.testScope import com.android.systemui.lifecycle.activateIn import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Before import org.junit.Test import org.junit.runner.RunWith -@ExperimentalCoroutinesApi @SmallTest @RunWith(AndroidJUnit4::class) class WindowRootViewModelTest : SysuiTestCase() { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/wmshell/WMShellTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/wmshell/WMShellTest.kt index 61136577dad8..f362d80150e5 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/wmshell/WMShellTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/wmshell/WMShellTest.kt @@ -65,7 +65,6 @@ import com.android.wm.shell.splitscreen.SplitScreen import com.android.wm.shell.sysui.ShellInterface import java.util.Optional import java.util.concurrent.Executor -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Before @@ -82,7 +81,6 @@ import org.mockito.MockitoAnnotations * * Build/Install/Run: atest SystemUITests:WMShellTest */ -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class WMShellTest : SysuiTestCase() { diff --git a/packages/SystemUI/plugin/src/com/android/systemui/plugins/clocks/ClockPickerConfig.kt b/packages/SystemUI/plugin/src/com/android/systemui/plugins/clocks/ClockPickerConfig.kt index 1bc9367ce3c5..6e4dc1485c7b 100644 --- a/packages/SystemUI/plugin/src/com/android/systemui/plugins/clocks/ClockPickerConfig.kt +++ b/packages/SystemUI/plugin/src/com/android/systemui/plugins/clocks/ClockPickerConfig.kt @@ -62,12 +62,11 @@ data class ClockFontAxis( fun toSetting() = ClockFontAxisSetting(key, currentValue) companion object { - fun merge( - fontAxes: List<ClockFontAxis>, - axisSettings: List<ClockFontAxisSetting>, + fun List<ClockFontAxis>.merge( + axisSettings: List<ClockFontAxisSetting> ): List<ClockFontAxis> { val result = mutableListOf<ClockFontAxis>() - for (axis in fontAxes) { + for (axis in this) { val setting = axisSettings.firstOrNull { axis.key == it.key } val output = setting?.let { axis.copy(currentValue = it.value) } ?: axis result.add(output) diff --git a/packages/SystemUI/plugin/src/com/android/systemui/plugins/clocks/ClockSettings.kt b/packages/SystemUI/plugin/src/com/android/systemui/plugins/clocks/ClockSettings.kt index 6128c00f3843..e7b36626a810 100644 --- a/packages/SystemUI/plugin/src/com/android/systemui/plugins/clocks/ClockSettings.kt +++ b/packages/SystemUI/plugin/src/com/android/systemui/plugins/clocks/ClockSettings.kt @@ -98,13 +98,20 @@ data class ClockFontAxisSetting( return result } - fun toFVar(settings: List<ClockFontAxisSetting>): String { + fun List<ClockFontAxisSetting>.toFVar(): String { val sb = StringBuilder() - for (axis in settings) { + for (axis in this) { if (sb.length > 0) sb.append(", ") sb.append("'${axis.key}' ${axis.value.toInt()}") } return sb.toString() } + + fun List<ClockFontAxisSetting>.replace( + replacements: List<ClockFontAxisSetting> + ): List<ClockFontAxisSetting> { + var remaining = this.filterNot { lhs -> replacements.any { rhs -> lhs.key == rhs.key } } + return remaining + replacements + } } } diff --git a/packages/SystemUI/res-keyguard/values/arrays.xml b/packages/SystemUI/res-keyguard/values/arrays.xml index 26bc865bcaf7..b4c02f0fee1a 100644 --- a/packages/SystemUI/res-keyguard/values/arrays.xml +++ b/packages/SystemUI/res-keyguard/values/arrays.xml @@ -41,4 +41,13 @@ <item>@drawable/pin_dot_shape_5_avd</item> <item>@drawable/pin_dot_shape_6_avd</item> </integer-array> + + <integer-array name="updated_bouncer_pin_shapes"> + <item>@drawable/bouncer_shape_1</item> + <item>@drawable/bouncer_shape_2</item> + <item>@drawable/bouncer_shape_3</item> + <item>@drawable/bouncer_shape_4</item> + <item>@drawable/bouncer_shape_5</item> + <item>@drawable/bouncer_shape_6</item> + </integer-array> </resources> diff --git a/packages/SystemUI/res/drawable/bouncer_shape_1.xml b/packages/SystemUI/res/drawable/bouncer_shape_1.xml new file mode 100644 index 000000000000..575d90525a3d --- /dev/null +++ b/packages/SystemUI/res/drawable/bouncer_shape_1.xml @@ -0,0 +1,81 @@ +<animated-vector xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:aapt="http://schemas.android.com/aapt"> + <target android:name="_R_G_L_0_G_D_0_P_0"> + <aapt:attr name="android:animation"> + <set android:ordering="together"> + <objectAnimator android:duration="33" android:propertyName="pathData" + android:startOffset="0" + android:valueFrom="M-8.34 -3.45 C-7.46,-5.58 -5.58,-7.46 -3.45,-8.34 C-1.33,-9.22 1.33,-9.22 3.45,-8.34 C5.58,-7.46 7.46,-5.58 8.34,-3.45 C9.22,-1.33 9.22,1.33 8.34,3.45 C7.46,5.58 5.58,7.46 3.45,8.34 C1.33,9.22 -1.33,9.22 -3.45,8.34 C-5.58,7.46 -7.46,5.58 -8.34,3.45 C-9.22,1.33 -9.22,-1.33 -8.34,-3.45c " + android:valueTo="M-8.34 -3.45 C-7.46,-5.58 -5.58,-7.46 -3.45,-8.34 C-1.33,-9.22 1.33,-9.22 3.45,-8.34 C5.58,-7.46 7.46,-5.58 8.34,-3.45 C9.22,-1.33 9.22,1.33 8.34,3.45 C7.46,5.58 5.58,7.46 3.45,8.34 C1.33,9.22 -1.33,9.22 -3.45,8.34 C-5.58,7.46 -7.46,5.58 -8.34,3.45 C-9.22,1.33 -9.22,-1.33 -8.34,-3.45c " + android:valueType="pathType"> + <aapt:attr name="android:interpolator"> + <pathInterpolator + android:pathData="M 0.0,0.0 c0.167,0.167 0.833,0.833 1.0,1.0" /> + </aapt:attr> + </objectAnimator> + <objectAnimator android:duration="33" android:propertyName="pathData" + android:startOffset="33" + android:valueFrom="M-8.34 -3.45 C-7.46,-5.58 -5.58,-7.46 -3.45,-8.34 C-1.33,-9.22 1.33,-9.22 3.45,-8.34 C5.58,-7.46 7.46,-5.58 8.34,-3.45 C9.22,-1.33 9.22,1.33 8.34,3.45 C7.46,5.58 5.58,7.46 3.45,8.34 C1.33,9.22 -1.33,9.22 -3.45,8.34 C-5.58,7.46 -7.46,5.58 -8.34,3.45 C-9.22,1.33 -9.22,-1.33 -8.34,-3.45c " + android:valueTo="M-13.65 -3.95 C-16.31,-10.09 -10.09,-16.31 -3.95,-13.65 C-0.76,-12.26 0.77,-12.23 3.95,-13.65 C9.91,-16.31 16.31,-10.09 13.65,-3.95 C12.26,-0.76 12.26,0.76 13.65,3.95 C16.31,10.09 9.91,16.31 3.95,13.65 C0.76,12.22 -0.76,12.26 -3.95,13.65 C-10.09,16.31 -16.31,10.09 -13.65,3.95 C-12.26,0.75 -12.25,-0.73 -13.65,-3.95c " + android:valueType="pathType"> + <aapt:attr name="android:interpolator"> + <pathInterpolator + android:pathData="M 0.0,0.0 c0.167,0.167 0.833,0.833 1.0,1.0" /> + </aapt:attr> + </objectAnimator> + <objectAnimator android:duration="283" android:propertyName="pathData" + android:startOffset="67" + android:valueFrom="M-13.65 -3.95 C-16.31,-10.09 -10.09,-16.31 -3.95,-13.65 C-0.76,-12.26 0.77,-12.23 3.95,-13.65 C9.91,-16.31 16.31,-10.09 13.65,-3.95 C12.26,-0.76 12.26,0.76 13.65,3.95 C16.31,10.09 9.91,16.31 3.95,13.65 C0.76,12.22 -0.76,12.26 -3.95,13.65 C-10.09,16.31 -16.31,10.09 -13.65,3.95 C-12.26,0.75 -12.25,-0.73 -13.65,-3.95c " + android:valueTo="M-8.34 -3.45 C-7.46,-5.58 -5.58,-7.46 -3.45,-8.34 C-1.33,-9.22 1.33,-9.22 3.45,-8.34 C5.58,-7.46 7.46,-5.58 8.34,-3.45 C9.22,-1.33 9.22,1.33 8.34,3.45 C7.46,5.58 5.58,7.46 3.45,8.34 C1.33,9.22 -1.33,9.22 -3.45,8.34 C-5.58,7.46 -7.46,5.58 -8.34,3.45 C-9.22,1.33 -9.22,-1.33 -8.34,-3.45c " + android:valueType="pathType"> + <aapt:attr name="android:interpolator"> + <pathInterpolator android:pathData="M 0.0,0.0 c0.7,0 0.6,1 1.0,1.0" /> + </aapt:attr> + </objectAnimator> + </set> + </aapt:attr> + </target> + <target android:name="_R_G_L_0_G"> + <aapt:attr name="android:animation"> + <set android:ordering="together"> + <objectAnimator android:duration="67" android:propertyName="scaleX" + android:startOffset="0" android:valueFrom="0" android:valueTo="1" + android:valueType="floatType"> + <aapt:attr name="android:interpolator"> + <pathInterpolator android:pathData="M 0.0,0.0 c0.001,0 0.5,1 1.0,1.0" /> + </aapt:attr> + </objectAnimator> + <objectAnimator android:duration="67" android:propertyName="scaleY" + android:startOffset="0" android:valueFrom="0" android:valueTo="1" + android:valueType="floatType"> + <aapt:attr name="android:interpolator"> + <pathInterpolator android:pathData="M 0.0,0.0 c0.001,0 0.5,1 1.0,1.0" /> + </aapt:attr> + </objectAnimator> + </set> + </aapt:attr> + </target> + <target android:name="time_group"> + <aapt:attr name="android:animation"> + <set android:ordering="together"> + <objectAnimator android:duration="500" android:propertyName="translateX" + android:startOffset="0" android:valueFrom="0" android:valueTo="1" + android:valueType="floatType" /> + </set> + </aapt:attr> + </target> + <aapt:attr name="android:drawable"> + <vector android:width="36dp" android:height="36dp" android:viewportHeight="36" + android:viewportWidth="36"> + <group android:name="_R_G"> + <group android:name="_R_G_L_0_G" android:scaleX="0" android:scaleY="0" + android:translateX="18" android:translateY="18"> + <path android:name="_R_G_L_0_G_D_0_P_0" android:fillAlpha="1" + android:fillColor="#ffffff" android:fillType="nonZero" + android:pathData=" M-8.34 -3.45 C-7.46,-5.58 -5.58,-7.46 -3.45,-8.34 C-1.33,-9.22 1.33,-9.22 3.45,-8.34 C5.58,-7.46 7.46,-5.58 8.34,-3.45 C9.22,-1.33 9.22,1.33 8.34,3.45 C7.46,5.58 5.58,7.46 3.45,8.34 C1.33,9.22 -1.33,9.22 -3.45,8.34 C-5.58,7.46 -7.46,5.58 -8.34,3.45 C-9.22,1.33 -9.22,-1.33 -8.34,-3.45c " /> + </group> + </group> + <group android:name="time_group" /> + </vector> + </aapt:attr> +</animated-vector>
\ No newline at end of file diff --git a/packages/SystemUI/res/drawable/bouncer_shape_2.xml b/packages/SystemUI/res/drawable/bouncer_shape_2.xml new file mode 100644 index 000000000000..b748d7f7a062 --- /dev/null +++ b/packages/SystemUI/res/drawable/bouncer_shape_2.xml @@ -0,0 +1,81 @@ +<animated-vector xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:aapt="http://schemas.android.com/aapt"> + <target android:name="_R_G_L_0_G_D_0_P_0"> + <aapt:attr name="android:animation"> + <set android:ordering="together"> + <objectAnimator android:duration="33" android:propertyName="pathData" + android:startOffset="0" + android:valueFrom="M9 0 C9,-2.3 7.99,-4.74 6.36,-6.36 C4.74,-7.99 2.3,-9 0,-9 C-2.3,-9 -4.74,-7.99 -6.36,-6.36 C-7.99,-4.74 -9,-2.3 -9,0 C-9,2.3 -7.99,4.74 -6.36,6.36 C-4.74,7.99 -2.3,9 0,9 C2.3,9 4.74,7.99 6.36,6.36 C7.99,4.74 9,2.3 9,0c " + android:valueTo="M9 0 C9,-2.3 7.99,-4.74 6.36,-6.36 C4.74,-7.99 2.3,-9 0,-9 C-2.3,-9 -4.74,-7.99 -6.36,-6.36 C-7.99,-4.74 -9,-2.3 -9,0 C-9,2.3 -7.99,4.74 -6.36,6.36 C-4.74,7.99 -2.3,9 0,9 C2.3,9 4.74,7.99 6.36,6.36 C7.99,4.74 9,2.3 9,0c " + android:valueType="pathType"> + <aapt:attr name="android:interpolator"> + <pathInterpolator + android:pathData="M 0.0,0.0 c0.167,0.167 0.833,0.833 1.0,1.0" /> + </aapt:attr> + </objectAnimator> + <objectAnimator android:duration="33" android:propertyName="pathData" + android:startOffset="33" + android:valueFrom="M9 0 C9,-2.3 7.99,-4.74 6.36,-6.36 C4.74,-7.99 2.3,-9 0,-9 C-2.3,-9 -4.74,-7.99 -6.36,-6.36 C-7.99,-4.74 -9,-2.3 -9,0 C-9,2.3 -7.99,4.74 -6.36,6.36 C-4.74,7.99 -2.3,9 0,9 C2.3,9 4.74,7.99 6.36,6.36 C7.99,4.74 9,2.3 9,0c " + android:valueTo="M15.06 7.12 C15.06,7.12 5.57,-11.84 5.57,-11.84 C4.43,-14.13 2.23,-15.28 0.02,-15.28 C-2.18,-15.28 -4.39,-14.13 -5.53,-11.84 C-5.53,-11.84 -15.01,7.12 -15.01,7.12 C-17.62,12.34 -12.27,18.03 -6.91,15.56 C-3.18,13.84 -1.9,13.04 0.02,13.04 C1.94,13.04 4.59,14.43 6.96,15.56 C12.14,18.03 17.67,12.34 15.06,7.12c " + android:valueType="pathType"> + <aapt:attr name="android:interpolator"> + <pathInterpolator + android:pathData="M 0.0,0.0 c0.167,0.167 0.833,0.833 1.0,1.0" /> + </aapt:attr> + </objectAnimator> + <objectAnimator android:duration="283" android:propertyName="pathData" + android:startOffset="67" + android:valueFrom="M15.06 7.12 C15.06,7.12 5.57,-11.84 5.57,-11.84 C4.43,-14.13 2.23,-15.28 0.02,-15.28 C-2.18,-15.28 -4.39,-14.13 -5.53,-11.84 C-5.53,-11.84 -15.01,7.12 -15.01,7.12 C-17.62,12.34 -12.27,18.03 -6.91,15.56 C-3.18,13.84 -1.9,13.04 0.02,13.04 C1.94,13.04 4.59,14.43 6.96,15.56 C12.14,18.03 17.67,12.34 15.06,7.12c " + android:valueTo="M9 0 C9,-2.3 7.99,-4.74 6.36,-6.36 C4.74,-7.99 2.3,-9 0,-9 C-2.3,-9 -4.74,-7.99 -6.36,-6.36 C-7.99,-4.74 -9,-2.3 -9,0 C-9,2.3 -7.99,4.74 -6.36,6.36 C-4.74,7.99 -2.3,9 0,9 C2.3,9 4.74,7.99 6.36,6.36 C7.99,4.74 9,2.3 9,0c " + android:valueType="pathType"> + <aapt:attr name="android:interpolator"> + <pathInterpolator android:pathData="M 0.0,0.0 c0.7,0 0.6,1 1.0,1.0" /> + </aapt:attr> + </objectAnimator> + </set> + </aapt:attr> + </target> + <target android:name="_R_G_L_0_G"> + <aapt:attr name="android:animation"> + <set android:ordering="together"> + <objectAnimator android:duration="67" android:propertyName="scaleX" + android:startOffset="0" android:valueFrom="0" android:valueTo="1" + android:valueType="floatType"> + <aapt:attr name="android:interpolator"> + <pathInterpolator android:pathData="M 0.0,0.0 c0.001,0 0.5,1 1.0,1.0" /> + </aapt:attr> + </objectAnimator> + <objectAnimator android:duration="67" android:propertyName="scaleY" + android:startOffset="0" android:valueFrom="0" android:valueTo="1" + android:valueType="floatType"> + <aapt:attr name="android:interpolator"> + <pathInterpolator android:pathData="M 0.0,0.0 c0.001,0 0.5,1 1.0,1.0" /> + </aapt:attr> + </objectAnimator> + </set> + </aapt:attr> + </target> + <target android:name="time_group"> + <aapt:attr name="android:animation"> + <set android:ordering="together"> + <objectAnimator android:duration="500" android:propertyName="translateX" + android:startOffset="0" android:valueFrom="0" android:valueTo="1" + android:valueType="floatType" /> + </set> + </aapt:attr> + </target> + <aapt:attr name="android:drawable"> + <vector android:width="36dp" android:height="36dp" android:viewportHeight="36" + android:viewportWidth="36"> + <group android:name="_R_G"> + <group android:name="_R_G_L_0_G" android:scaleX="0" android:scaleY="0" + android:translateX="18" android:translateY="18"> + <path android:name="_R_G_L_0_G_D_0_P_0" android:fillAlpha="1" + android:fillColor="#ffffff" android:fillType="nonZero" + android:pathData=" M9 0 C9,-2.3 7.99,-4.74 6.36,-6.36 C4.74,-7.99 2.3,-9 0,-9 C-2.3,-9 -4.74,-7.99 -6.36,-6.36 C-7.99,-4.74 -9,-2.3 -9,0 C-9,2.3 -7.99,4.74 -6.36,6.36 C-4.74,7.99 -2.3,9 0,9 C2.3,9 4.74,7.99 6.36,6.36 C7.99,4.74 9,2.3 9,0c " /> + </group> + </group> + <group android:name="time_group" /> + </vector> + </aapt:attr> +</animated-vector>
\ No newline at end of file diff --git a/packages/SystemUI/res/drawable/bouncer_shape_3.xml b/packages/SystemUI/res/drawable/bouncer_shape_3.xml new file mode 100644 index 000000000000..0b71221f3ed0 --- /dev/null +++ b/packages/SystemUI/res/drawable/bouncer_shape_3.xml @@ -0,0 +1,81 @@ +<animated-vector xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:aapt="http://schemas.android.com/aapt"> + <target android:name="_R_G_L_0_G_D_0_P_0"> + <aapt:attr name="android:animation"> + <set android:ordering="together"> + <objectAnimator android:duration="33" android:propertyName="pathData" + android:startOffset="0" + android:valueFrom="M6.35 6.37 C2.84,9.88 -2.85,9.88 -6.36,6.37 C-6.36,6.37 -6.37,6.37 -6.37,6.37 C-9.88,2.85 -9.88,-2.84 -6.37,-6.35 C-2.85,-9.86 2.84,-9.86 6.35,-6.35 C6.35,-6.35 6.35,-6.34 6.35,-6.34 C9.86,-2.83 9.86,2.86 6.35,6.37c " + android:valueTo="M6.35 6.37 C2.84,9.88 -2.85,9.88 -6.36,6.37 C-6.36,6.37 -6.37,6.37 -6.37,6.37 C-9.88,2.85 -9.88,-2.84 -6.37,-6.35 C-2.85,-9.86 2.84,-9.86 6.35,-6.35 C6.35,-6.35 6.35,-6.34 6.35,-6.34 C9.86,-2.83 9.86,2.86 6.35,6.37c " + android:valueType="pathType"> + <aapt:attr name="android:interpolator"> + <pathInterpolator + android:pathData="M 0.0,0.0 c0.167,0.167 0.833,0.833 1.0,1.0" /> + </aapt:attr> + </objectAnimator> + <objectAnimator android:duration="33" android:propertyName="pathData" + android:startOffset="33" + android:valueFrom="M6.35 6.37 C2.84,9.88 -2.85,9.88 -6.36,6.37 C-6.36,6.37 -6.37,6.37 -6.37,6.37 C-9.88,2.85 -9.88,-2.84 -6.37,-6.35 C-2.85,-9.86 2.84,-9.86 6.35,-6.35 C6.35,-6.35 6.35,-6.34 6.35,-6.34 C9.86,-2.83 9.86,2.86 6.35,6.37c " + android:valueTo="M11.96 11.96 C6.61,17.31 -2.06,17.31 -7.41,11.96 C-7.41,11.96 -11.96,7.42 -11.96,7.42 C-17.31,2.06 -17.31,-6.61 -11.96,-11.96 C-6.61,-17.31 2.06,-17.31 7.42,-11.96 C7.42,-11.96 11.96,-7.41 11.96,-7.41 C17.31,-2.06 17.31,6.61 11.96,11.96c " + android:valueType="pathType"> + <aapt:attr name="android:interpolator"> + <pathInterpolator + android:pathData="M 0.0,0.0 c0.167,0.167 0.833,0.833 1.0,1.0" /> + </aapt:attr> + </objectAnimator> + <objectAnimator android:duration="283" android:propertyName="pathData" + android:startOffset="67" + android:valueFrom="M11.96 11.96 C6.61,17.31 -2.06,17.31 -7.41,11.96 C-7.41,11.96 -11.96,7.42 -11.96,7.42 C-17.31,2.06 -17.31,-6.61 -11.96,-11.96 C-6.61,-17.31 2.06,-17.31 7.42,-11.96 C7.42,-11.96 11.96,-7.41 11.96,-7.41 C17.31,-2.06 17.31,6.61 11.96,11.96c " + android:valueTo="M6.35 6.37 C2.84,9.88 -2.85,9.88 -6.36,6.37 C-6.36,6.37 -6.37,6.37 -6.37,6.37 C-9.88,2.85 -9.88,-2.84 -6.37,-6.35 C-2.85,-9.86 2.84,-9.86 6.35,-6.35 C6.35,-6.35 6.35,-6.34 6.35,-6.34 C9.86,-2.83 9.86,2.86 6.35,6.37c " + android:valueType="pathType"> + <aapt:attr name="android:interpolator"> + <pathInterpolator android:pathData="M 0.0,0.0 c0.7,0 0.6,1 1.0,1.0" /> + </aapt:attr> + </objectAnimator> + </set> + </aapt:attr> + </target> + <target android:name="_R_G_L_0_G"> + <aapt:attr name="android:animation"> + <set android:ordering="together"> + <objectAnimator android:duration="67" android:propertyName="scaleX" + android:startOffset="0" android:valueFrom="0" android:valueTo="1" + android:valueType="floatType"> + <aapt:attr name="android:interpolator"> + <pathInterpolator android:pathData="M 0.0,0.0 c0.001,0 0.5,1 1.0,1.0" /> + </aapt:attr> + </objectAnimator> + <objectAnimator android:duration="67" android:propertyName="scaleY" + android:startOffset="0" android:valueFrom="0" android:valueTo="1" + android:valueType="floatType"> + <aapt:attr name="android:interpolator"> + <pathInterpolator android:pathData="M 0.0,0.0 c0.001,0 0.5,1 1.0,1.0" /> + </aapt:attr> + </objectAnimator> + </set> + </aapt:attr> + </target> + <target android:name="time_group"> + <aapt:attr name="android:animation"> + <set android:ordering="together"> + <objectAnimator android:duration="500" android:propertyName="translateX" + android:startOffset="0" android:valueFrom="0" android:valueTo="1" + android:valueType="floatType" /> + </set> + </aapt:attr> + </target> + <aapt:attr name="android:drawable"> + <vector android:width="36dp" android:height="36dp" android:viewportHeight="36" + android:viewportWidth="36"> + <group android:name="_R_G"> + <group android:name="_R_G_L_0_G" android:scaleX="0" android:scaleY="0" + android:translateX="18" android:translateY="18"> + <path android:name="_R_G_L_0_G_D_0_P_0" android:fillAlpha="1" + android:fillColor="#ffffff" android:fillType="nonZero" + android:pathData=" M6.35 6.37 C2.84,9.88 -2.85,9.88 -6.36,6.37 C-6.36,6.37 -6.37,6.37 -6.37,6.37 C-9.88,2.85 -9.88,-2.84 -6.37,-6.35 C-2.85,-9.86 2.84,-9.86 6.35,-6.35 C6.35,-6.35 6.35,-6.34 6.35,-6.34 C9.86,-2.83 9.86,2.86 6.35,6.37c " /> + </group> + </group> + <group android:name="time_group" /> + </vector> + </aapt:attr> +</animated-vector>
\ No newline at end of file diff --git a/packages/SystemUI/res/drawable/bouncer_shape_4.xml b/packages/SystemUI/res/drawable/bouncer_shape_4.xml new file mode 100644 index 000000000000..b923e1af1f9c --- /dev/null +++ b/packages/SystemUI/res/drawable/bouncer_shape_4.xml @@ -0,0 +1,81 @@ +<animated-vector xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:aapt="http://schemas.android.com/aapt"> + <target android:name="_R_G_L_0_G_D_0_P_0"> + <aapt:attr name="android:animation"> + <set android:ordering="together"> + <objectAnimator android:duration="33" android:propertyName="pathData" + android:startOffset="0" + android:valueFrom="M8.98 -0.01 C9,-1.16 8.76,-2.33 8.32,-3.4 C7.86,-4.49 7.18,-5.52 6.35,-6.36 C5.55,-7.18 4.58,-7.84 3.53,-8.27 C2.42,-8.74 1.2,-9 0,-9 C-1.19,-9 -2.4,-8.74 -3.5,-8.29 C-4.56,-7.85 -5.54,-7.18 -6.35,-6.36 C-7.16,-5.56 -7.83,-4.58 -8.27,-3.52 C-8.73,-2.42 -8.96,-1.2 -8.98,-0.01 C-9,1.09 -8.8,2.21 -8.39,3.22 C-7.91,4.37 -7.22,5.45 -6.35,6.35 C-5.56,7.17 -4.56,7.83 -3.51,8.27 C-2.41,8.73 -1.19,8.97 0,8.98 C1.1,9 2.24,8.8 3.26,8.37 C4.39,7.9 5.45,7.2 6.35,6.35 C7.13,5.61 7.77,4.69 8.18,3.7 C8.67,2.53 8.96,1.26 8.98,-0.01c " + android:valueTo="M8.98 -0.01 C9,-1.16 8.76,-2.33 8.32,-3.4 C7.86,-4.49 7.18,-5.52 6.35,-6.36 C5.55,-7.18 4.58,-7.84 3.53,-8.27 C2.42,-8.74 1.2,-9 0,-9 C-1.19,-9 -2.4,-8.74 -3.5,-8.29 C-4.56,-7.85 -5.54,-7.18 -6.35,-6.36 C-7.16,-5.56 -7.83,-4.58 -8.27,-3.52 C-8.73,-2.42 -8.96,-1.2 -8.98,-0.01 C-9,1.09 -8.8,2.21 -8.39,3.22 C-7.91,4.37 -7.22,5.45 -6.35,6.35 C-5.56,7.17 -4.56,7.83 -3.51,8.27 C-2.41,8.73 -1.19,8.97 0,8.98 C1.1,9 2.24,8.8 3.26,8.37 C4.39,7.9 5.45,7.2 6.35,6.35 C7.13,5.61 7.77,4.69 8.18,3.7 C8.67,2.53 8.96,1.26 8.98,-0.01c " + android:valueType="pathType"> + <aapt:attr name="android:interpolator"> + <pathInterpolator + android:pathData="M 0.0,0.0 c0.167,0.167 0.833,0.833 1.0,1.0" /> + </aapt:attr> + </objectAnimator> + <objectAnimator android:duration="33" android:propertyName="pathData" + android:startOffset="33" + android:valueFrom="M8.98 -0.01 C9,-1.16 8.76,-2.33 8.32,-3.4 C7.86,-4.49 7.18,-5.52 6.35,-6.36 C5.55,-7.18 4.58,-7.84 3.53,-8.27 C2.42,-8.74 1.2,-9 0,-9 C-1.19,-9 -2.4,-8.74 -3.5,-8.29 C-4.56,-7.85 -5.54,-7.18 -6.35,-6.36 C-7.16,-5.56 -7.83,-4.58 -8.27,-3.52 C-8.73,-2.42 -8.96,-1.2 -8.98,-0.01 C-9,1.09 -8.8,2.21 -8.39,3.22 C-7.91,4.37 -7.22,5.45 -6.35,6.35 C-5.56,7.17 -4.56,7.83 -3.51,8.27 C-2.41,8.73 -1.19,8.97 0,8.98 C1.1,9 2.24,8.8 3.26,8.37 C4.39,7.9 5.45,7.2 6.35,6.35 C7.13,5.61 7.77,4.69 8.18,3.7 C8.67,2.53 8.96,1.26 8.98,-0.01c " + android:valueTo="M15.94 0 C15.94,-2.68 12.74,-2.45 11.62,-4.58 C10.5,-6.72 13.17,-9.54 11.27,-11.27 C9.37,-13 6.84,-10.78 4.74,-11.54 C2.63,-12.3 2.77,-15.94 0,-15.94 C-2.77,-15.94 -2.85,-12.34 -4.73,-11.52 C-6.62,-10.71 -9.31,-13.21 -11.27,-11.27 C-13.23,-9.33 -10.95,-7.11 -11.55,-4.93 C-12.15,-2.77 -15.94,-2.78 -15.94,0 C-15.94,2.78 -12.4,2.92 -11.62,4.69 C-10.85,6.47 -13.32,9.29 -11.27,11.27 C-9.22,13.25 -6.57,10.83 -4.82,11.64 C-3.07,12.46 -2.63,15.94 0,15.94 C2.63,15.94 2.64,12.52 4.72,11.67 C6.8,10.82 9.66,13.2 11.27,11.27 C12.88,9.34 10.62,6.93 11.65,4.63 C12.68,2.34 15.94,2.68 15.94,0c " + android:valueType="pathType"> + <aapt:attr name="android:interpolator"> + <pathInterpolator + android:pathData="M 0.0,0.0 c0.167,0.167 0.833,0.833 1.0,1.0" /> + </aapt:attr> + </objectAnimator> + <objectAnimator android:duration="283" android:propertyName="pathData" + android:startOffset="67" + android:valueFrom="M15.94 0 C15.94,-2.68 12.74,-2.45 11.62,-4.58 C10.5,-6.72 13.17,-9.54 11.27,-11.27 C9.37,-13 6.84,-10.78 4.74,-11.54 C2.63,-12.3 2.77,-15.94 0,-15.94 C-2.77,-15.94 -2.85,-12.34 -4.73,-11.52 C-6.62,-10.71 -9.31,-13.21 -11.27,-11.27 C-13.23,-9.33 -10.95,-7.11 -11.55,-4.93 C-12.15,-2.77 -15.94,-2.78 -15.94,0 C-15.94,2.78 -12.4,2.92 -11.62,4.69 C-10.85,6.47 -13.32,9.29 -11.27,11.27 C-9.22,13.25 -6.57,10.83 -4.82,11.64 C-3.07,12.46 -2.63,15.94 0,15.94 C2.63,15.94 2.64,12.52 4.72,11.67 C6.8,10.82 9.66,13.2 11.27,11.27 C12.88,9.34 10.62,6.93 11.65,4.63 C12.68,2.34 15.94,2.68 15.94,0c " + android:valueTo="M8.98 -0.01 C9,-1.16 8.76,-2.33 8.32,-3.4 C7.86,-4.49 7.18,-5.52 6.35,-6.36 C5.55,-7.18 4.58,-7.84 3.53,-8.27 C2.42,-8.74 1.2,-9 0,-9 C-1.19,-9 -2.4,-8.74 -3.5,-8.29 C-4.56,-7.85 -5.54,-7.18 -6.35,-6.36 C-7.16,-5.56 -7.83,-4.58 -8.27,-3.52 C-8.73,-2.42 -8.96,-1.2 -8.98,-0.01 C-9,1.09 -8.8,2.21 -8.39,3.22 C-7.91,4.37 -7.22,5.45 -6.35,6.35 C-5.56,7.17 -4.56,7.83 -3.51,8.27 C-2.41,8.73 -1.19,8.97 0,8.98 C1.1,9 2.24,8.8 3.26,8.37 C4.39,7.9 5.45,7.2 6.35,6.35 C7.13,5.61 7.77,4.69 8.18,3.7 C8.67,2.53 8.96,1.26 8.98,-0.01c " + android:valueType="pathType"> + <aapt:attr name="android:interpolator"> + <pathInterpolator android:pathData="M 0.0,0.0 c0.7,0 0.6,1 1.0,1.0" /> + </aapt:attr> + </objectAnimator> + </set> + </aapt:attr> + </target> + <target android:name="_R_G_L_0_G"> + <aapt:attr name="android:animation"> + <set android:ordering="together"> + <objectAnimator android:duration="67" android:propertyName="scaleX" + android:startOffset="0" android:valueFrom="0" android:valueTo="1" + android:valueType="floatType"> + <aapt:attr name="android:interpolator"> + <pathInterpolator android:pathData="M 0.0,0.0 c0.001,0 0.5,1 1.0,1.0" /> + </aapt:attr> + </objectAnimator> + <objectAnimator android:duration="67" android:propertyName="scaleY" + android:startOffset="0" android:valueFrom="0" android:valueTo="1" + android:valueType="floatType"> + <aapt:attr name="android:interpolator"> + <pathInterpolator android:pathData="M 0.0,0.0 c0.001,0 0.5,1 1.0,1.0" /> + </aapt:attr> + </objectAnimator> + </set> + </aapt:attr> + </target> + <target android:name="time_group"> + <aapt:attr name="android:animation"> + <set android:ordering="together"> + <objectAnimator android:duration="500" android:propertyName="translateX" + android:startOffset="0" android:valueFrom="0" android:valueTo="1" + android:valueType="floatType" /> + </set> + </aapt:attr> + </target> + <aapt:attr name="android:drawable"> + <vector android:width="36dp" android:height="36dp" android:viewportHeight="36" + android:viewportWidth="36"> + <group android:name="_R_G"> + <group android:name="_R_G_L_0_G" android:scaleX="0" android:scaleY="0" + android:translateX="18" android:translateY="18"> + <path android:name="_R_G_L_0_G_D_0_P_0" android:fillAlpha="1" + android:fillColor="#ffffff" android:fillType="nonZero" + android:pathData=" M8.98 -0.01 C9,-1.16 8.76,-2.33 8.32,-3.4 C7.86,-4.49 7.18,-5.52 6.35,-6.36 C5.55,-7.18 4.58,-7.84 3.53,-8.27 C2.42,-8.74 1.2,-9 0,-9 C-1.19,-9 -2.4,-8.74 -3.5,-8.29 C-4.56,-7.85 -5.54,-7.18 -6.35,-6.36 C-7.16,-5.56 -7.83,-4.58 -8.27,-3.52 C-8.73,-2.42 -8.96,-1.2 -8.98,-0.01 C-9,1.09 -8.8,2.21 -8.39,3.22 C-7.91,4.37 -7.22,5.45 -6.35,6.35 C-5.56,7.17 -4.56,7.83 -3.51,8.27 C-2.41,8.73 -1.19,8.97 0,8.98 C1.1,9 2.24,8.8 3.26,8.37 C4.39,7.9 5.45,7.2 6.35,6.35 C7.13,5.61 7.77,4.69 8.18,3.7 C8.67,2.53 8.96,1.26 8.98,-0.01c " /> + </group> + </group> + <group android:name="time_group" /> + </vector> + </aapt:attr> +</animated-vector>
\ No newline at end of file diff --git a/packages/SystemUI/res/drawable/bouncer_shape_5.xml b/packages/SystemUI/res/drawable/bouncer_shape_5.xml new file mode 100644 index 000000000000..b1eff54b2230 --- /dev/null +++ b/packages/SystemUI/res/drawable/bouncer_shape_5.xml @@ -0,0 +1,81 @@ +<animated-vector xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:aapt="http://schemas.android.com/aapt"> + <target android:name="_R_G_L_0_G_D_0_P_0"> + <aapt:attr name="android:animation"> + <set android:ordering="together"> + <objectAnimator android:duration="33" android:propertyName="pathData" + android:startOffset="0" + android:valueFrom="M-2.78 -9.43 C-1.02,-10 1.02,-10 2.78,-9.43 C4.54,-8.85 6.19,-7.65 7.28,-6.15 C8.37,-4.65 9,-2.71 9,-0.86 C9,1 8.37,2.93 7.28,4.43 C6.19,5.94 4.55,7.13 2.78,7.71 C1.02,8.28 -1.02,8.28 -2.78,7.71 C-4.54,7.13 -6.19,5.94 -7.28,4.43 C-8.37,2.93 -9,1 -9,-0.86 C-9,-2.71 -8.37,-4.65 -7.28,-6.15 C-6.19,-7.65 -4.55,-8.85 -2.78,-9.43c " + android:valueTo="M-2.78 -9.43 C-1.02,-10 1.02,-10 2.78,-9.43 C4.54,-8.85 6.19,-7.65 7.28,-6.15 C8.37,-4.65 9,-2.71 9,-0.86 C9,1 8.37,2.93 7.28,4.43 C6.19,5.94 4.55,7.13 2.78,7.71 C1.02,8.28 -1.02,8.28 -2.78,7.71 C-4.54,7.13 -6.19,5.94 -7.28,4.43 C-8.37,2.93 -9,1 -9,-0.86 C-9,-2.71 -8.37,-4.65 -7.28,-6.15 C-6.19,-7.65 -4.55,-8.85 -2.78,-9.43c " + android:valueType="pathType"> + <aapt:attr name="android:interpolator"> + <pathInterpolator + android:pathData="M 0.0,0.0 c0.167,0.167 0.833,0.833 1.0,1.0" /> + </aapt:attr> + </objectAnimator> + <objectAnimator android:duration="33" android:propertyName="pathData" + android:startOffset="33" + android:valueFrom="M-2.78 -9.43 C-1.02,-10 1.02,-10 2.78,-9.43 C4.54,-8.85 6.19,-7.65 7.28,-6.15 C8.37,-4.65 9,-2.71 9,-0.86 C9,1 8.37,2.93 7.28,4.43 C6.19,5.94 4.55,7.13 2.78,7.71 C1.02,8.28 -1.02,8.28 -2.78,7.71 C-4.54,7.13 -6.19,5.94 -7.28,4.43 C-8.37,2.93 -9,1 -9,-0.86 C-9,-2.71 -8.37,-4.65 -7.28,-6.15 C-6.19,-7.65 -4.55,-8.85 -2.78,-9.43c " + android:valueTo="M-3.08 -15.05 C-1.24,-16.37 1.24,-16.37 3.08,-15.05 C3.08,-15.05 13.71,-7.34 13.71,-7.34 C15.57,-5.99 16.34,-3.59 15.63,-1.4 C15.63,-1.4 11.59,11.01 11.59,11.01 C10.88,13.18 8.86,14.65 6.59,14.66 C6.59,14.66 -6.59,14.66 -6.59,14.66 C-8.86,14.65 -10.88,13.18 -11.59,11.01 C-11.59,11.01 -15.63,-1.4 -15.63,-1.4 C-16.34,-3.59 -15.57,-5.99 -13.71,-7.34 C-13.71,-7.34 -3.08,-15.05 -3.08,-15.05c " + android:valueType="pathType"> + <aapt:attr name="android:interpolator"> + <pathInterpolator + android:pathData="M 0.0,0.0 c0.167,0.167 0.833,0.833 1.0,1.0" /> + </aapt:attr> + </objectAnimator> + <objectAnimator android:duration="283" android:propertyName="pathData" + android:startOffset="67" + android:valueFrom="M-3.08 -15.05 C-1.24,-16.37 1.24,-16.37 3.08,-15.05 C3.08,-15.05 13.71,-7.34 13.71,-7.34 C15.57,-5.99 16.34,-3.59 15.63,-1.4 C15.63,-1.4 11.59,11.01 11.59,11.01 C10.88,13.18 8.86,14.65 6.59,14.66 C6.59,14.66 -6.59,14.66 -6.59,14.66 C-8.86,14.65 -10.88,13.18 -11.59,11.01 C-11.59,11.01 -15.63,-1.4 -15.63,-1.4 C-16.34,-3.59 -15.57,-5.99 -13.71,-7.34 C-13.71,-7.34 -3.08,-15.05 -3.08,-15.05c " + android:valueTo="M-2.78 -9.43 C-1.02,-10 1.02,-10 2.78,-9.43 C4.54,-8.85 6.19,-7.65 7.28,-6.15 C8.37,-4.65 9,-2.71 9,-0.86 C9,1 8.37,2.93 7.28,4.43 C6.19,5.94 4.55,7.13 2.78,7.71 C1.02,8.28 -1.02,8.28 -2.78,7.71 C-4.54,7.13 -6.19,5.94 -7.28,4.43 C-8.37,2.93 -9,1 -9,-0.86 C-9,-2.71 -8.37,-4.65 -7.28,-6.15 C-6.19,-7.65 -4.55,-8.85 -2.78,-9.43c " + android:valueType="pathType"> + <aapt:attr name="android:interpolator"> + <pathInterpolator android:pathData="M 0.0,0.0 c0.7,0 0.6,1 1.0,1.0" /> + </aapt:attr> + </objectAnimator> + </set> + </aapt:attr> + </target> + <target android:name="_R_G_L_0_G"> + <aapt:attr name="android:animation"> + <set android:ordering="together"> + <objectAnimator android:duration="67" android:propertyName="scaleX" + android:startOffset="0" android:valueFrom="0" android:valueTo="1" + android:valueType="floatType"> + <aapt:attr name="android:interpolator"> + <pathInterpolator android:pathData="M 0.0,0.0 c0.001,0 0.5,1 1.0,1.0" /> + </aapt:attr> + </objectAnimator> + <objectAnimator android:duration="67" android:propertyName="scaleY" + android:startOffset="0" android:valueFrom="0" android:valueTo="1" + android:valueType="floatType"> + <aapt:attr name="android:interpolator"> + <pathInterpolator android:pathData="M 0.0,0.0 c0.001,0 0.5,1 1.0,1.0" /> + </aapt:attr> + </objectAnimator> + </set> + </aapt:attr> + </target> + <target android:name="time_group"> + <aapt:attr name="android:animation"> + <set android:ordering="together"> + <objectAnimator android:duration="500" android:propertyName="translateX" + android:startOffset="0" android:valueFrom="0" android:valueTo="1" + android:valueType="floatType" /> + </set> + </aapt:attr> + </target> + <aapt:attr name="android:drawable"> + <vector android:width="36dp" android:height="36dp" android:viewportHeight="36" + android:viewportWidth="36"> + <group android:name="_R_G"> + <group android:name="_R_G_L_0_G" android:pivotY="-0.859" android:scaleX="0" + android:scaleY="0" android:translateX="18" android:translateY="18.859"> + <path android:name="_R_G_L_0_G_D_0_P_0" android:fillAlpha="1" + android:fillColor="#ffffff" android:fillType="nonZero" + android:pathData=" M-2.78 -9.43 C-1.02,-10 1.02,-10 2.78,-9.43 C4.54,-8.85 6.19,-7.65 7.28,-6.15 C8.37,-4.65 9,-2.71 9,-0.86 C9,1 8.37,2.93 7.28,4.43 C6.19,5.94 4.55,7.13 2.78,7.71 C1.02,8.28 -1.02,8.28 -2.78,7.71 C-4.54,7.13 -6.19,5.94 -7.28,4.43 C-8.37,2.93 -9,1 -9,-0.86 C-9,-2.71 -8.37,-4.65 -7.28,-6.15 C-6.19,-7.65 -4.55,-8.85 -2.78,-9.43c " /> + </group> + </group> + <group android:name="time_group" /> + </vector> + </aapt:attr> +</animated-vector>
\ No newline at end of file diff --git a/packages/SystemUI/res/drawable/bouncer_shape_6.xml b/packages/SystemUI/res/drawable/bouncer_shape_6.xml new file mode 100644 index 000000000000..c7ebfaa60d34 --- /dev/null +++ b/packages/SystemUI/res/drawable/bouncer_shape_6.xml @@ -0,0 +1,81 @@ +<animated-vector xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:aapt="http://schemas.android.com/aapt"> + <target android:name="_R_G_L_0_G_D_0_P_0"> + <aapt:attr name="android:animation"> + <set android:ordering="together"> + <objectAnimator android:duration="33" android:propertyName="pathData" + android:startOffset="0" + android:valueFrom="M8.33 -4.31 C7.45,-6.43 5.58,-8.31 3.45,-9.19 C1.33,-10.07 -1.33,-10.07 -3.45,-9.19 C-5.58,-8.31 -7.45,-6.43 -8.33,-4.31 C-9.21,-2.18 -9.21,0.47 -8.33,2.59 C-7.45,4.72 -5.58,6.59 -3.45,7.47 C-1.33,8.35 1.33,8.35 3.45,7.47 C5.58,6.59 7.45,4.72 8.33,2.59 C9.21,0.47 9.21,-2.18 8.33,-4.31c " + android:valueTo="M8.33 -4.31 C7.45,-6.43 5.58,-8.31 3.45,-9.19 C1.33,-10.07 -1.33,-10.07 -3.45,-9.19 C-5.58,-8.31 -7.45,-6.43 -8.33,-4.31 C-9.21,-2.18 -9.21,0.47 -8.33,2.59 C-7.45,4.72 -5.58,6.59 -3.45,7.47 C-1.33,8.35 1.33,8.35 3.45,7.47 C5.58,6.59 7.45,4.72 8.33,2.59 C9.21,0.47 9.21,-2.18 8.33,-4.31c " + android:valueType="pathType"> + <aapt:attr name="android:interpolator"> + <pathInterpolator + android:pathData="M 0.0,0.0 c0.167,0.167 0.833,0.833 1.0,1.0" /> + </aapt:attr> + </objectAnimator> + <objectAnimator android:duration="33" android:propertyName="pathData" + android:startOffset="33" + android:valueFrom="M8.33 -4.31 C7.45,-6.43 5.58,-8.31 3.45,-9.19 C1.33,-10.07 -1.33,-10.07 -3.45,-9.19 C-5.58,-8.31 -7.45,-6.43 -8.33,-4.31 C-9.21,-2.18 -9.21,0.47 -8.33,2.59 C-7.45,4.72 -5.58,6.59 -3.45,7.47 C-1.33,8.35 1.33,8.35 3.45,7.47 C5.58,6.59 7.45,4.72 8.33,2.59 C9.21,0.47 9.21,-2.18 8.33,-4.31c " + android:valueTo="M14.18 -5.39 C14.18,-5.39 4.53,-15.04 4.53,-15.04 C2.03,-17.55 -2.03,-17.55 -4.53,-15.04 C-4.53,-15.04 -14.18,-5.39 -14.18,-5.39 C-16.69,-2.89 -16.69,1.17 -14.18,3.67 C-14.18,3.67 -4.53,13.32 -4.53,13.32 C-2.03,15.83 2.03,15.83 4.53,13.32 C4.53,13.32 14.18,3.67 14.18,3.67 C16.69,1.17 16.69,-2.89 14.18,-5.39c " + android:valueType="pathType"> + <aapt:attr name="android:interpolator"> + <pathInterpolator + android:pathData="M 0.0,0.0 c0.167,0.167 0.833,0.833 1.0,1.0" /> + </aapt:attr> + </objectAnimator> + <objectAnimator android:duration="283" android:propertyName="pathData" + android:startOffset="67" + android:valueFrom="M14.18 -5.39 C14.18,-5.39 4.53,-15.04 4.53,-15.04 C2.03,-17.55 -2.03,-17.55 -4.53,-15.04 C-4.53,-15.04 -14.18,-5.39 -14.18,-5.39 C-16.69,-2.89 -16.69,1.17 -14.18,3.67 C-14.18,3.67 -4.53,13.32 -4.53,13.32 C-2.03,15.83 2.03,15.83 4.53,13.32 C4.53,13.32 14.18,3.67 14.18,3.67 C16.69,1.17 16.69,-2.89 14.18,-5.39c " + android:valueTo="M8.33 -4.31 C7.45,-6.43 5.58,-8.31 3.45,-9.19 C1.33,-10.07 -1.33,-10.07 -3.45,-9.19 C-5.58,-8.31 -7.45,-6.43 -8.33,-4.31 C-9.21,-2.18 -9.21,0.47 -8.33,2.59 C-7.45,4.72 -5.58,6.59 -3.45,7.47 C-1.33,8.35 1.33,8.35 3.45,7.47 C5.58,6.59 7.45,4.72 8.33,2.59 C9.21,0.47 9.21,-2.18 8.33,-4.31c " + android:valueType="pathType"> + <aapt:attr name="android:interpolator"> + <pathInterpolator android:pathData="M 0.0,0.0 c0.7,0 0.6,1 1.0,1.0" /> + </aapt:attr> + </objectAnimator> + </set> + </aapt:attr> + </target> + <target android:name="_R_G_L_0_G"> + <aapt:attr name="android:animation"> + <set android:ordering="together"> + <objectAnimator android:duration="67" android:propertyName="scaleX" + android:startOffset="0" android:valueFrom="0" android:valueTo="1" + android:valueType="floatType"> + <aapt:attr name="android:interpolator"> + <pathInterpolator android:pathData="M 0.0,0.0 c0.001,0 0.5,1 1.0,1.0" /> + </aapt:attr> + </objectAnimator> + <objectAnimator android:duration="67" android:propertyName="scaleY" + android:startOffset="0" android:valueFrom="0" android:valueTo="1" + android:valueType="floatType"> + <aapt:attr name="android:interpolator"> + <pathInterpolator android:pathData="M 0.0,0.0 c0.001,0 0.5,1 1.0,1.0" /> + </aapt:attr> + </objectAnimator> + </set> + </aapt:attr> + </target> + <target android:name="time_group"> + <aapt:attr name="android:animation"> + <set android:ordering="together"> + <objectAnimator android:duration="500" android:propertyName="translateX" + android:startOffset="0" android:valueFrom="0" android:valueTo="1" + android:valueType="floatType" /> + </set> + </aapt:attr> + </target> + <aapt:attr name="android:drawable"> + <vector android:width="36dp" android:height="36dp" android:viewportHeight="36" + android:viewportWidth="36"> + <group android:name="_R_G"> + <group android:name="_R_G_L_0_G" android:pivotY="-0.859" android:scaleX="0" + android:scaleY="0" android:translateX="18" android:translateY="18.859"> + <path android:name="_R_G_L_0_G_D_0_P_0" android:fillAlpha="1" + android:fillColor="#ffffff" android:fillType="nonZero" + android:pathData=" M8.33 -4.31 C7.45,-6.43 5.58,-8.31 3.45,-9.19 C1.33,-10.07 -1.33,-10.07 -3.45,-9.19 C-5.58,-8.31 -7.45,-6.43 -8.33,-4.31 C-9.21,-2.18 -9.21,0.47 -8.33,2.59 C-7.45,4.72 -5.58,6.59 -3.45,7.47 C-1.33,8.35 1.33,8.35 3.45,7.47 C5.58,6.59 7.45,4.72 8.33,2.59 C9.21,0.47 9.21,-2.18 8.33,-4.31c " /> + </group> + </group> + <group android:name="time_group" /> + </vector> + </aapt:attr> +</animated-vector>
\ No newline at end of file diff --git a/packages/SystemUI/res/drawable/bouncer_shape_delete.xml b/packages/SystemUI/res/drawable/bouncer_shape_delete.xml new file mode 100644 index 000000000000..78191c0bf3a5 --- /dev/null +++ b/packages/SystemUI/res/drawable/bouncer_shape_delete.xml @@ -0,0 +1,126 @@ +<animated-vector xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:aapt="http://schemas.android.com/aapt"> + <target android:name="_R_G_L_0_G_D_0_P_0"> + <aapt:attr name="android:animation"> + <set android:ordering="together"> + <objectAnimator android:duration="150" android:propertyName="fillAlpha" + android:startOffset="0" android:valueFrom="1" android:valueTo="1" + android:valueType="floatType"> + <aapt:attr name="android:interpolator"> + <pathInterpolator + android:pathData="M 0.0,0.0 c0.167,0.167 0.833,0.833 1.0,1.0" /> + </aapt:attr> + </objectAnimator> + <objectAnimator android:duration="200" android:propertyName="fillAlpha" + android:startOffset="150" android:valueFrom="1" android:valueTo="0" + android:valueType="floatType"> + <aapt:attr name="android:interpolator"> + <pathInterpolator + android:pathData="M 0.0,0.0 c0.167,0.167 0.833,0.833 1.0,1.0" /> + </aapt:attr> + </objectAnimator> + </set> + </aapt:attr> + </target> + <target android:name="_R_G_L_0_G_D_0_P_0"> + <aapt:attr name="android:animation"> + <set android:ordering="together"> + <objectAnimator android:duration="150" android:propertyName="pathData" + android:startOffset="0" + android:valueFrom="M-13.54 -17.54 C-8.57,-17.54 -4.54,-13.51 -4.54,-8.54 C-4.54,-3.57 -8.57,0.46 -13.54,0.46 C-18.51,0.46 -22.54,-3.57 -22.54,-8.54 C-22.54,-13.51 -18.51,-17.54 -13.54,-17.54c " + android:valueTo="M-13.54 -11.54 C-11.88,-11.54 -10.54,-10.2 -10.54,-8.54 C-10.54,-6.88 -11.88,-5.54 -13.54,-5.54 C-15.2,-5.54 -16.54,-6.88 -16.54,-8.54 C-16.54,-10.2 -15.2,-11.54 -13.54,-11.54c " + android:valueType="pathType"> + <aapt:attr name="android:interpolator"> + <pathInterpolator + android:pathData="M 0.0,0.0 c0.167,0.167 0.833,0.833 1.0,1.0" /> + </aapt:attr> + </objectAnimator> + <objectAnimator android:duration="200" android:propertyName="pathData" + android:startOffset="150" + android:valueFrom="M-13.54 -11.54 C-11.88,-11.54 -10.54,-10.2 -10.54,-8.54 C-10.54,-6.88 -11.88,-5.54 -13.54,-5.54 C-15.2,-5.54 -16.54,-6.88 -16.54,-8.54 C-16.54,-10.2 -15.2,-11.54 -13.54,-11.54c " + android:valueTo="M-13.54 -13.54 C-10.78,-13.54 -8.54,-11.3 -8.54,-8.54 C-8.54,-5.78 -10.78,-3.54 -13.54,-3.54 C-16.3,-3.54 -18.54,-5.78 -18.54,-8.54 C-18.54,-11.3 -16.3,-13.54 -13.54,-13.54c " + android:valueType="pathType"> + <aapt:attr name="android:interpolator"> + <pathInterpolator + android:pathData="M 0.0,0.0 c0.167,0.167 0.833,0.833 1.0,1.0" /> + </aapt:attr> + </objectAnimator> + </set> + </aapt:attr> + </target> + <target android:name="_R_G_L_0_G_D_1_P_0"> + <aapt:attr name="android:animation"> + <set android:ordering="together"> + <objectAnimator android:duration="150" android:propertyName="strokeWidth" + android:startOffset="0" android:valueFrom="0" android:valueTo="0" + android:valueType="floatType"> + <aapt:attr name="android:interpolator"> + <pathInterpolator + android:pathData="M 0.0,0.0 c0.167,0.167 0.833,0.833 1.0,1.0" /> + </aapt:attr> + </objectAnimator> + <objectAnimator android:duration="50" android:propertyName="strokeWidth" + android:startOffset="150" android:valueFrom="0" android:valueTo="3" + android:valueType="floatType"> + <aapt:attr name="android:interpolator"> + <pathInterpolator + android:pathData="M 0.0,0.0 c0.167,0.167 0.833,0.833 1.0,1.0" /> + </aapt:attr> + </objectAnimator> + </set> + </aapt:attr> + </target> + <target android:name="_R_G_L_0_G_D_1_P_0"> + <aapt:attr name="android:animation"> + <set android:ordering="together"> + <objectAnimator android:duration="150" android:propertyName="pathData" + android:startOffset="0" + android:valueFrom="M-13.54 -17.54 C-8.57,-17.54 -4.54,-13.51 -4.54,-8.54 C-4.54,-3.57 -8.57,0.46 -13.54,0.46 C-18.51,0.46 -22.54,-3.57 -22.54,-8.54 C-22.54,-13.51 -18.51,-17.54 -13.54,-17.54c " + android:valueTo="M-13.54 -11.54 C-11.88,-11.54 -10.54,-10.2 -10.54,-8.54 C-10.54,-6.88 -11.88,-5.54 -13.54,-5.54 C-15.2,-5.54 -16.54,-6.88 -16.54,-8.54 C-16.54,-10.2 -15.2,-11.54 -13.54,-11.54c " + android:valueType="pathType"> + <aapt:attr name="android:interpolator"> + <pathInterpolator + android:pathData="M 0.0,0.0 c0.167,0.167 0.833,0.833 1.0,1.0" /> + </aapt:attr> + </objectAnimator> + <objectAnimator android:duration="200" android:propertyName="pathData" + android:startOffset="150" + android:valueFrom="M-13.54 -11.54 C-11.88,-11.54 -10.54,-10.2 -10.54,-8.54 C-10.54,-6.88 -11.88,-5.54 -13.54,-5.54 C-15.2,-5.54 -16.54,-6.88 -16.54,-8.54 C-16.54,-10.2 -15.2,-11.54 -13.54,-11.54c " + android:valueTo="M-13.54 -13.54 C-10.78,-13.54 -8.54,-11.3 -8.54,-8.54 C-8.54,-5.78 -10.78,-3.54 -13.54,-3.54 C-16.3,-3.54 -18.54,-5.78 -18.54,-8.54 C-18.54,-11.3 -16.3,-13.54 -13.54,-13.54c " + android:valueType="pathType"> + <aapt:attr name="android:interpolator"> + <pathInterpolator + android:pathData="M 0.0,0.0 c0.167,0.167 0.833,0.833 1.0,1.0" /> + </aapt:attr> + </objectAnimator> + </set> + </aapt:attr> + </target> + <target android:name="time_group"> + <aapt:attr name="android:animation"> + <set android:ordering="together"> + <objectAnimator android:duration="500" android:propertyName="translateX" + android:startOffset="0" android:valueFrom="0" android:valueTo="1" + android:valueType="floatType" /> + </set> + </aapt:attr> + </target> + <aapt:attr name="android:drawable"> + <vector android:width="36dp" android:height="36dp" android:viewportHeight="36" + android:viewportWidth="36"> + <group android:name="_R_G"> + <group android:name="_R_G_L_0_G" android:translateX="31.54" + android:translateY="26.54"> + <path android:name="_R_G_L_0_G_D_0_P_0" android:fillAlpha="1" + android:fillColor="#ffffff" android:fillType="nonZero" + android:pathData=" M-13.54 -17.54 C-8.57,-17.54 -4.54,-13.51 -4.54,-8.54 C-4.54,-3.57 -8.57,0.46 -13.54,0.46 C-18.51,0.46 -22.54,-3.57 -22.54,-8.54 C-22.54,-13.51 -18.51,-17.54 -13.54,-17.54c " /> + <path android:name="_R_G_L_0_G_D_1_P_0" android:pathData=" M-13.54 -17.54 C-8.57,-17.54 -4.54,-13.51 -4.54,-8.54 C-4.54,-3.57 -8.57,0.46 -13.54,0.46 C-18.51,0.46 -22.54,-3.57 -22.54,-8.54 C-22.54,-13.51 -18.51,-17.54 -13.54,-17.54c " + android:strokeAlpha="1" android:strokeColor="#ffffff" + android:strokeLineCap="round" android:strokeLineJoin="round" + android:strokeWidth="0" /> + </group> + </group> + <group android:name="time_group" /> + </vector> + </aapt:attr> +</animated-vector>
\ No newline at end of file diff --git a/packages/SystemUI/res/drawable/bouncer_shape_outline.xml b/packages/SystemUI/res/drawable/bouncer_shape_outline.xml new file mode 100644 index 000000000000..72d6c74127a8 --- /dev/null +++ b/packages/SystemUI/res/drawable/bouncer_shape_outline.xml @@ -0,0 +1,27 @@ +<animated-vector xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:aapt="http://schemas.android.com/aapt"> + <target android:name="time_group"> + <aapt:attr name="android:animation"> + <set android:ordering="together"> + <objectAnimator android:duration="500" android:propertyName="translateX" + android:startOffset="0" android:valueFrom="0" android:valueTo="1" + android:valueType="floatType" /> + </set> + </aapt:attr> + </target> + <aapt:attr name="android:drawable"> + <vector android:width="36dp" android:height="36dp" android:viewportHeight="36" + android:viewportWidth="36"> + <group android:name="_R_G"> + <group android:name="_R_G_L_0_G" android:translateX="31.237000000000002" + android:translateY="26.112000000000002"> + <path android:name="_R_G_L_0_G_D_0_P_0" android:pathData=" M-13.24 -13.11 C-10.48,-13.11 -8.24,-10.87 -8.24,-8.11 C-8.24,-5.35 -10.48,-3.11 -13.24,-3.11 C-16,-3.11 -18.24,-5.35 -18.24,-8.11 C-18.24,-10.87 -16,-13.11 -13.24,-13.11c " + android:strokeAlpha="1" android:strokeColor="#ffffff" + android:strokeLineCap="round" android:strokeLineJoin="round" + android:strokeWidth="3" /> + </group> + </group> + <group android:name="time_group" /> + </vector> + </aapt:attr> +</animated-vector>
\ No newline at end of file diff --git a/packages/SystemUI/res/layout/media_output_list_group_divider.xml b/packages/SystemUI/res/layout/media_output_list_group_divider.xml index 5e96866c0a9a..c351912de295 100644 --- a/packages/SystemUI/res/layout/media_output_list_group_divider.xml +++ b/packages/SystemUI/res/layout/media_output_list_group_divider.xml @@ -26,7 +26,7 @@ android:layout_width="wrap_content" android:layout_height="36dp" android:layout_gravity="center_vertical|start" - android:layout_marginStart="16dp" + android:layout_marginStart="@dimen/media_output_dialog_margin_horizontal" android:layout_marginEnd="56dp" android:ellipsize="end" android:maxLines="1" diff --git a/packages/SystemUI/res/layout/media_output_list_item_advanced.xml b/packages/SystemUI/res/layout/media_output_list_item_advanced.xml index 69117cf7cf5d..d297ec46e1e1 100644 --- a/packages/SystemUI/res/layout/media_output_list_item_advanced.xml +++ b/packages/SystemUI/res/layout/media_output_list_item_advanced.xml @@ -15,18 +15,19 @@ ~ limitations under the License. --> -<FrameLayout +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/device_container" android:layout_width="match_parent" - android:layout_height="wrap_content"> + android:layout_height="wrap_content" + android:paddingHorizontal="@dimen/media_output_dialog_margin_horizontal" + android:baselineAligned="false"> <FrameLayout - android:layout_width="match_parent" - android:layout_height="64dp" + android:layout_weight="1" + android:layout_width="0dp" + android:layout_height="@dimen/media_output_dialog_item_height" android:id="@+id/item_layout" android:background="@drawable/media_output_item_background" - android:layout_marginStart="16dp" - android:layout_marginEnd="80dp" android:layout_marginBottom="12dp"> <FrameLayout android:layout_width="match_parent" @@ -36,7 +37,7 @@ android:id="@+id/volume_seekbar" android:splitTrack="false" android:visibility="gone" - android:paddingStart="64dp" + android:paddingStart="@dimen/media_output_dialog_item_height" android:paddingEnd="0dp" android:background="@null" android:contentDescription="@string/media_output_dialog_accessibility_seekbar" @@ -48,8 +49,8 @@ <FrameLayout android:id="@+id/icon_area" - android:layout_width="64dp" - android:layout_height="64dp" + android:layout_width="@dimen/media_output_dialog_item_height" + android:layout_height="@dimen/media_output_dialog_item_height" android:focusable="false" android:importantForAccessibility="no" android:layout_gravity="center_vertical|start"> @@ -131,11 +132,11 @@ </FrameLayout> <FrameLayout android:id="@+id/end_action_area" - android:layout_width="64dp" - android:layout_height="64dp" + android:layout_width="@dimen/media_output_dialog_item_height" + android:layout_height="@dimen/media_output_dialog_item_height" android:visibility="gone" android:layout_marginBottom="6dp" - android:layout_marginEnd="8dp" + android:layout_marginStart="7dp" android:layout_gravity="end|center" android:gravity="center" android:background="@drawable/media_output_item_background_active"> @@ -160,4 +161,4 @@ android:indeterminateOnly="true" android:visibility="gone"/> </FrameLayout> -</FrameLayout>
\ No newline at end of file +</LinearLayout>
\ No newline at end of file diff --git a/packages/SystemUI/res/layout/window_magnification_settings_view.xml b/packages/SystemUI/res/layout/window_magnification_settings_view.xml index 7f7350472fa5..cb7bd1728077 100644 --- a/packages/SystemUI/res/layout/window_magnification_settings_view.xml +++ b/packages/SystemUI/res/layout/window_magnification_settings_view.xml @@ -23,6 +23,7 @@ android:orientation="vertical" android:padding="@dimen/magnification_setting_background_padding" android:focusable="true" + android:accessibilityPaneTitle="@string/accessibility_magnification_settings_panel_description" android:contentDescription="@string/accessibility_magnification_settings_panel_description"> <LinearLayout android:layout_width="match_parent" diff --git a/packages/SystemUI/res/values-ldrtl/dimens.xml b/packages/SystemUI/res/values-ldrtl/dimens.xml index 0d99b617819b..345f0414e637 100644 --- a/packages/SystemUI/res/values-ldrtl/dimens.xml +++ b/packages/SystemUI/res/values-ldrtl/dimens.xml @@ -16,5 +16,5 @@ --> <resources> <dimen name="media_output_dialog_icon_left_radius">0dp</dimen> - <dimen name="media_output_dialog_icon_right_radius">28dp</dimen> + <dimen name="media_output_dialog_icon_right_radius">@dimen/media_output_dialog_active_background_radius</dimen> </resources>
\ No newline at end of file diff --git a/packages/SystemUI/res/values-sw600dp/dimens.xml b/packages/SystemUI/res/values-sw600dp/dimens.xml index 26f32ef60851..d22c8d910230 100644 --- a/packages/SystemUI/res/values-sw600dp/dimens.xml +++ b/packages/SystemUI/res/values-sw600dp/dimens.xml @@ -126,4 +126,6 @@ <dimen name="controls_content_padding">24dp</dimen> <dimen name="control_list_vertical_spacing">8dp</dimen> <dimen name="control_list_horizontal_spacing">16dp</dimen> + + <dimen name="communal_to_dream_button_size">64dp</dimen> </resources> diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml index a96ebe7b4fd6..d93716b03685 100644 --- a/packages/SystemUI/res/values/dimens.xml +++ b/packages/SystemUI/res/values/dimens.xml @@ -953,6 +953,8 @@ <dimen name="communal_widget_picker_desired_width">360dp</dimen> <dimen name="communal_widget_picker_desired_height">240dp</dimen> + <dimen name="communal_to_dream_button_size">48dp</dimen> + <!-- The width/height of the unlock icon view on keyguard. --> <dimen name="keyguard_lock_height">42dp</dimen> <dimen name="keyguard_lock_padding">20dp</dimen> @@ -1523,11 +1525,11 @@ <dimen name="media_output_dialog_icon_corner_radius">16dp</dimen> <dimen name="media_output_dialog_title_anim_y_delta">12.5dp</dimen> <dimen name="media_output_dialog_background_radius">16dp</dimen> - <dimen name="media_output_dialog_active_background_radius">30dp</dimen> - <dimen name="media_output_dialog_default_margin_end">16dp</dimen> - <dimen name="media_output_dialog_selectable_margin_end">80dp</dimen> + <dimen name="media_output_dialog_active_background_radius">32dp</dimen> + <dimen name="media_output_dialog_item_height">64dp</dimen> + <dimen name="media_output_dialog_margin_horizontal">16dp</dimen> <dimen name="media_output_dialog_list_padding_top">8dp</dimen> - <dimen name="media_output_dialog_icon_left_radius">28dp</dimen> + <dimen name="media_output_dialog_icon_left_radius">@dimen/media_output_dialog_active_background_radius</dimen> <dimen name="media_output_dialog_icon_right_radius">0dp</dimen> <!-- Distance that the full shade transition takes in order to complete by tapping on a button diff --git a/packages/SystemUI/src/com/android/keyguard/EmergencyButton.java b/packages/SystemUI/src/com/android/keyguard/EmergencyButton.java index 6ef7de4a32b5..a836dcbf848b 100644 --- a/packages/SystemUI/src/com/android/keyguard/EmergencyButton.java +++ b/packages/SystemUI/src/com/android/keyguard/EmergencyButton.java @@ -20,6 +20,7 @@ import static com.android.systemui.Flags.gsfBouncer; import android.content.Context; import android.graphics.Typeface; +import android.graphics.drawable.Drawable; import android.text.TextUtils; import android.util.AttributeSet; import android.view.MotionEvent; @@ -28,6 +29,8 @@ import android.view.ViewConfiguration; import android.widget.Button; import com.android.internal.util.EmergencyAffordanceManager; +import com.android.systemui.Flags; +import com.android.systemui.bouncer.shared.constants.KeyguardBouncerConstants; /** * This class implements a smart emergency button that updates itself based @@ -72,6 +75,19 @@ public class EmergencyButton extends Button { return false; }); } + if (gsfBouncer() || Flags.bouncerUiRevamp2()) { + setTypeface(Typeface.create("gsf-title-medium", Typeface.NORMAL)); + } + if (Flags.bouncerUiRevamp2()) { + Drawable background = getBackground(); + int bgColor = mContext.getColor(KeyguardBouncerConstants.Color.actionButtonBg); + if (background != null) { + background.setTint(bgColor); + } else { + setBackgroundColor(bgColor); + } + setTextColor(mContext.getColor(KeyguardBouncerConstants.Color.actionButtonText)); + } } @Override @@ -125,9 +141,6 @@ public class EmergencyButton extends Button { textId = com.android.internal.R.string.lockscreen_emergency_call; } setText(textId); - if (gsfBouncer()) { - setTypeface(Typeface.create("gsf-title-medium", Typeface.NORMAL)); - } } else { setVisibility(View.GONE); } diff --git a/packages/SystemUI/src/com/android/keyguard/NumPadAnimator.java b/packages/SystemUI/src/com/android/keyguard/NumPadAnimator.java index dccf53a369ac..2f74158107f2 100644 --- a/packages/SystemUI/src/com/android/keyguard/NumPadAnimator.java +++ b/packages/SystemUI/src/com/android/keyguard/NumPadAnimator.java @@ -15,12 +15,6 @@ */ package com.android.keyguard; -import static com.android.systemui.bouncer.shared.constants.KeyguardBouncerConstants.ColorId.NUM_PAD_BACKGROUND; -import static com.android.systemui.bouncer.shared.constants.KeyguardBouncerConstants.ColorId.NUM_PAD_BACKGROUND_PRESSED; -import static com.android.systemui.bouncer.shared.constants.KeyguardBouncerConstants.ColorId.NUM_PAD_BUTTON; -import static com.android.systemui.bouncer.shared.constants.KeyguardBouncerConstants.ColorId.NUM_PAD_KEY; -import static com.android.systemui.bouncer.shared.constants.KeyguardBouncerConstants.ColorId.NUM_PAD_PRESSED; - import android.animation.AnimatorSet; import android.animation.ArgbEvaluator; import android.animation.ValueAnimator; @@ -35,7 +29,9 @@ import android.widget.TextView; import androidx.annotation.StyleRes; -import com.android.app.animation.Interpolators; +import com.android.systemui.Flags; +import com.android.systemui.bouncer.shared.constants.PinBouncerConstants.Animation; +import com.android.systemui.bouncer.shared.constants.PinBouncerConstants.Color; /** * Provides background color and radius animations for key pad buttons. @@ -58,11 +54,6 @@ class NumPadAnimator { private int mHeight; private int mWidth; - private static final int EXPAND_ANIMATION_MS = 100; - private static final int EXPAND_COLOR_ANIMATION_MS = 50; - private static final int CONTRACT_ANIMATION_DELAY_MS = 33; - private static final int CONTRACT_ANIMATION_MS = 417; - NumPadAnimator(Context context, final Drawable drawable, @StyleRes int style, Drawable buttonImage) { this(context, drawable, style, null, buttonImage); @@ -122,44 +113,46 @@ class NumPadAnimator { void reloadColors(Context context) { boolean isNumPadKey = mImageButton == null; - int[] customAttrs = {android.R.attr.colorControlNormal}; - ContextThemeWrapper ctw = new ContextThemeWrapper(context, mStyle); - @SuppressLint("ResourceType") TypedArray a = ctw.obtainStyledAttributes(customAttrs); + if (!Flags.bouncerUiRevamp2()) { + int[] customAttrs = {android.R.attr.colorControlNormal}; + ContextThemeWrapper ctw = new ContextThemeWrapper(context, mStyle); + @SuppressLint("ResourceType") TypedArray a = ctw.obtainStyledAttributes(customAttrs); - mNormalBackgroundColor = a.getColor(0, context.getColor(NUM_PAD_BACKGROUND)); + mNormalBackgroundColor = a.getColor(0, context.getColor(Color.digitBg)); - a.recycle(); + a.recycle(); + } else { + mNormalBackgroundColor = context.getColor(isNumPadKey ? Color.digitBg : Color.actionBg); + } - mPressedBackgroundColor = context.getColor(NUM_PAD_BACKGROUND_PRESSED); - mTextColorPressed = context.getColor(NUM_PAD_PRESSED); + mPressedBackgroundColor = context.getColor(Color.bgPressed); + mTextColorPressed = context.getColor(Color.digitPressed); mBackground.setColor(mNormalBackgroundColor); - mTextColorPrimary = isNumPadKey - ? context.getColor(NUM_PAD_KEY) - : context.getColor(NUM_PAD_BUTTON); + mTextColorPrimary = context.getColor(isNumPadKey ? Color.digit : Color.action); createAnimators(); } private void createAnimators() { // Actual values will be updated later, usually during an onLayout() call mExpandAnimator = ValueAnimator.ofFloat(0f, 1f); - mExpandAnimator.setDuration(EXPAND_ANIMATION_MS); - mExpandAnimator.setInterpolator(Interpolators.LINEAR); + mExpandAnimator.setDuration(Animation.expansionDuration); + mExpandAnimator.setInterpolator(Animation.expansionInterpolator); mExpandAnimator.addUpdateListener( anim -> mBackground.setCornerRadius((float) anim.getAnimatedValue())); ValueAnimator expandBackgroundColorAnimator = ValueAnimator.ofObject(new ArgbEvaluator(), mNormalBackgroundColor, mPressedBackgroundColor); - expandBackgroundColorAnimator.setDuration(EXPAND_COLOR_ANIMATION_MS); - expandBackgroundColorAnimator.setInterpolator(Interpolators.LINEAR); + expandBackgroundColorAnimator.setDuration(Animation.expansionColorDuration); + expandBackgroundColorAnimator.setInterpolator(Animation.expansionInterpolator); expandBackgroundColorAnimator.addUpdateListener( animator -> mBackground.setColor((int) animator.getAnimatedValue())); ValueAnimator expandTextColorAnimator = ValueAnimator.ofObject(new ArgbEvaluator(), mTextColorPrimary, mTextColorPressed); - expandTextColorAnimator.setInterpolator(Interpolators.LINEAR); - expandTextColorAnimator.setDuration(EXPAND_COLOR_ANIMATION_MS); + expandTextColorAnimator.setInterpolator(Animation.expansionInterpolator); + expandTextColorAnimator.setDuration(Animation.expansionColorDuration); expandTextColorAnimator.addUpdateListener(valueAnimator -> { if (mDigitTextView != null) { mDigitTextView.setTextColor((int) valueAnimator.getAnimatedValue()); @@ -174,25 +167,25 @@ class NumPadAnimator { expandBackgroundColorAnimator, expandTextColorAnimator); mContractAnimator = ValueAnimator.ofFloat(1f, 0f); - mContractAnimator.setStartDelay(CONTRACT_ANIMATION_DELAY_MS); - mContractAnimator.setDuration(CONTRACT_ANIMATION_MS); - mContractAnimator.setInterpolator(Interpolators.FAST_OUT_SLOW_IN); + mContractAnimator.setStartDelay(Animation.contractionStartDelay); + mContractAnimator.setDuration(Animation.contractionDuration); + mContractAnimator.setInterpolator(Animation.contractionRadiusInterpolator); mContractAnimator.addUpdateListener( anim -> mBackground.setCornerRadius((float) anim.getAnimatedValue())); ValueAnimator contractBackgroundColorAnimator = ValueAnimator.ofObject(new ArgbEvaluator(), mPressedBackgroundColor, mNormalBackgroundColor); - contractBackgroundColorAnimator.setInterpolator(Interpolators.LINEAR); - contractBackgroundColorAnimator.setStartDelay(CONTRACT_ANIMATION_DELAY_MS); - contractBackgroundColorAnimator.setDuration(CONTRACT_ANIMATION_MS); + contractBackgroundColorAnimator.setInterpolator(Animation.contractionColorInterpolator); + contractBackgroundColorAnimator.setStartDelay(Animation.contractionStartDelay); + contractBackgroundColorAnimator.setDuration(Animation.contractionDuration); contractBackgroundColorAnimator.addUpdateListener( animator -> mBackground.setColor((int) animator.getAnimatedValue())); ValueAnimator contractTextColorAnimator = ValueAnimator.ofObject(new ArgbEvaluator(), mTextColorPressed, mTextColorPrimary); - contractTextColorAnimator.setInterpolator(Interpolators.LINEAR); - contractTextColorAnimator.setStartDelay(CONTRACT_ANIMATION_DELAY_MS); - contractTextColorAnimator.setDuration(CONTRACT_ANIMATION_MS); + contractTextColorAnimator.setInterpolator(Animation.contractionColorInterpolator); + contractTextColorAnimator.setStartDelay(Animation.contractionStartDelay); + contractTextColorAnimator.setDuration(Animation.contractionDuration); contractTextColorAnimator.addUpdateListener(valueAnimator -> { if (mDigitTextView != null) { mDigitTextView.setTextColor((int) valueAnimator.getAnimatedValue()); diff --git a/packages/SystemUI/src/com/android/keyguard/NumPadButton.java b/packages/SystemUI/src/com/android/keyguard/NumPadButton.java index d7799bf505bd..0ff93236a856 100644 --- a/packages/SystemUI/src/com/android/keyguard/NumPadButton.java +++ b/packages/SystemUI/src/com/android/keyguard/NumPadButton.java @@ -15,9 +15,6 @@ */ package com.android.keyguard; -import static com.android.systemui.bouncer.shared.constants.KeyguardBouncerConstants.ColorId.NUM_PAD_BUTTON; -import static com.android.systemui.bouncer.shared.constants.KeyguardBouncerConstants.ColorId.NUM_PAD_KEY; - import android.content.Context; import android.content.res.ColorStateList; import android.content.res.Configuration; @@ -30,6 +27,8 @@ import android.view.accessibility.AccessibilityNodeInfo; import androidx.annotation.Nullable; +import com.android.systemui.Flags; +import com.android.systemui.bouncer.shared.constants.PinBouncerConstants.Color; import com.android.systemui.res.R; /** @@ -99,7 +98,7 @@ public class NumPadButton extends AlphaOptimizedImageButton implements NumPadAni public void reloadColors() { if (mAnimator != null) mAnimator.reloadColors(getContext()); - int textColorResId = mIsTransparentMode ? NUM_PAD_KEY : NUM_PAD_BUTTON; + int textColorResId = mIsTransparentMode ? Color.actionWithAutoConfirm : Color.action; int imageColor = getContext().getColor(textColorResId); ((VectorDrawable) getDrawable()).setTintList(ColorStateList.valueOf(imageColor)); } @@ -126,7 +125,11 @@ public class NumPadButton extends AlphaOptimizedImageButton implements NumPadAni if (isTransparentMode) { setBackgroundColor(getResources().getColor(android.R.color.transparent)); } else { - setBackground(getContext().getDrawable(R.drawable.num_pad_key_background)); + Drawable bgDrawable = getContext().getDrawable(R.drawable.num_pad_key_background); + if (Flags.bouncerUiRevamp2() && bgDrawable != null) { + bgDrawable.setTint(Color.actionBg); + } + setBackground(bgDrawable); } setupAnimator(); reloadColors(); diff --git a/packages/SystemUI/src/com/android/keyguard/NumPadKey.java b/packages/SystemUI/src/com/android/keyguard/NumPadKey.java index e8a702f5fca3..3ceba5a97b17 100644 --- a/packages/SystemUI/src/com/android/keyguard/NumPadKey.java +++ b/packages/SystemUI/src/com/android/keyguard/NumPadKey.java @@ -16,7 +16,6 @@ package com.android.keyguard; import static com.android.systemui.Flags.gsfBouncer; -import static com.android.systemui.bouncer.shared.constants.KeyguardBouncerConstants.ColorId.NUM_PAD_KEY; import android.content.Context; import android.content.res.Configuration; @@ -38,6 +37,8 @@ import android.widget.TextView; import androidx.annotation.Nullable; import com.android.settingslib.Utils; +import com.android.systemui.Flags; +import com.android.systemui.bouncer.shared.constants.PinBouncerConstants.Color; import com.android.systemui.bouncer.ui.helper.BouncerHapticPlayer; import com.android.systemui.res.R; @@ -155,11 +156,11 @@ public class NumPadKey extends ViewGroup implements NumPadAnimationListener { * Reload colors from resources. **/ public void reloadColors() { - int textColor = getContext().getColor(NUM_PAD_KEY); + int textColor = getContext().getColor(Color.digit); int klondikeColor = Utils.getColorAttr(getContext(), android.R.attr.textColorSecondary) .getDefaultColor(); mDigitText.setTextColor(textColor); - if (gsfBouncer()) { + if (gsfBouncer() || Flags.bouncerUiRevamp2()) { mDigitText.setTypeface(Typeface.create("gsf-label-large-emphasized", Typeface.NORMAL)); } mKlondikeText.setTextColor(klondikeColor); diff --git a/packages/SystemUI/src/com/android/keyguard/PinShapeAdapter.kt b/packages/SystemUI/src/com/android/keyguard/PinShapeAdapter.kt index 8d1bbb29267b..3640d0dfeafa 100644 --- a/packages/SystemUI/src/com/android/keyguard/PinShapeAdapter.kt +++ b/packages/SystemUI/src/com/android/keyguard/PinShapeAdapter.kt @@ -17,7 +17,7 @@ package com.android.keyguard import android.content.Context -import com.android.systemui.res.R +import com.android.systemui.bouncer.shared.constants.PinBouncerConstants import kotlin.random.Random class PinShapeAdapter { @@ -25,7 +25,7 @@ class PinShapeAdapter { val random = Random(System.currentTimeMillis()) constructor(context: Context) { - val availableShapes = context.resources.obtainTypedArray(R.array.bouncer_pin_shapes) + val availableShapes = context.resources.obtainTypedArray(PinBouncerConstants.pinShapes) for (i in 0 until availableShapes.length()) { val shape = availableShapes.getResourceId(i, 0) diff --git a/packages/SystemUI/src/com/android/keyguard/PinShapeHintingView.java b/packages/SystemUI/src/com/android/keyguard/PinShapeHintingView.java index bac9dacef9e1..3480e5b56c80 100644 --- a/packages/SystemUI/src/com/android/keyguard/PinShapeHintingView.java +++ b/packages/SystemUI/src/com/android/keyguard/PinShapeHintingView.java @@ -28,6 +28,9 @@ import android.widget.LinearLayout; import androidx.core.graphics.drawable.DrawableCompat; +import com.android.systemui.Flags; +import com.android.systemui.bouncer.shared.constants.PinBouncerConstants; +import com.android.systemui.bouncer.shared.constants.PinBouncerConstants.Color; import com.android.systemui.res.R; /** @@ -38,6 +41,7 @@ public class PinShapeHintingView extends LinearLayout implements PinShapeInput { private int mPinLength; private int mDotDiameter; + @Deprecated private int mColor = getContext().getColor(PIN_SHAPES); private int mPosition = 0; private static final int DEFAULT_PIN_LENGTH = 6; @@ -53,10 +57,10 @@ public class PinShapeHintingView extends LinearLayout implements PinShapeInput { ImageView pinDot = new ImageView(context, attrs); LayoutParams layoutParams = new LayoutParams(mDotDiameter, mDotDiameter); pinDot.setLayoutParams(layoutParams); - pinDot.setImageResource(R.drawable.pin_dot_avd); + pinDot.setImageResource(PinBouncerConstants.pinDotAvd); if (pinDot.getDrawable() != null) { Drawable drawable = DrawableCompat.wrap(pinDot.getDrawable()); - DrawableCompat.setTint(drawable, mColor); + DrawableCompat.setTint(drawable, getPinHintDotColor()); } addView(pinDot); } @@ -67,7 +71,8 @@ public class PinShapeHintingView extends LinearLayout implements PinShapeInput { if (mPosition == DEFAULT_PIN_LENGTH) { return; } - setAnimatedDrawable(mPosition, mPinShapeAdapter.getShape(mPosition)); + setAnimatedDrawable((ImageView) getChildAt(mPosition), mPinShapeAdapter.getShape(mPosition), + getPinShapeColor()); mPosition++; } @@ -77,7 +82,8 @@ public class PinShapeHintingView extends LinearLayout implements PinShapeInput { return; } mPosition--; - setAnimatedDrawable(mPosition, R.drawable.pin_dot_delete_avd); + setAnimatedDrawable((ImageView) getChildAt(mPosition), PinBouncerConstants.pinDeleteAvd, + getPinHintDotColor()); } @Override @@ -99,15 +105,32 @@ public class PinShapeHintingView extends LinearLayout implements PinShapeInput { return this; } - private void setAnimatedDrawable(int position, int drawableResId) { - ImageView pinDot = (ImageView) getChildAt(position); + private static void setAnimatedDrawable(ImageView pinDot, int drawableResId, + int drawableColor) { pinDot.setImageResource(drawableResId); if (pinDot.getDrawable() != null) { Drawable drawable = DrawableCompat.wrap(pinDot.getDrawable()); - DrawableCompat.setTint(drawable, mColor); + DrawableCompat.setTint(drawable, drawableColor); } if (pinDot.getDrawable() instanceof AnimatedVectorDrawable) { ((AnimatedVectorDrawable) pinDot.getDrawable()).start(); } } + + private int getPinHintDotColor() { + if (Flags.bouncerUiRevamp2()) { + return mContext.getColor(Color.hintDot); + } else { + return mColor; + } + } + + private int getPinShapeColor() { + if (Flags.bouncerUiRevamp2()) { + return mContext.getColor(Color.shape); + } else { + return mColor; + } + } + } diff --git a/packages/SystemUI/src/com/android/keyguard/PinShapeNonHintingView.java b/packages/SystemUI/src/com/android/keyguard/PinShapeNonHintingView.java index 26a774e991a0..8b991742d818 100644 --- a/packages/SystemUI/src/com/android/keyguard/PinShapeNonHintingView.java +++ b/packages/SystemUI/src/com/android/keyguard/PinShapeNonHintingView.java @@ -39,6 +39,8 @@ import android.widget.LinearLayout; import androidx.core.graphics.drawable.DrawableCompat; import com.android.app.animation.Interpolators; +import com.android.systemui.Flags; +import com.android.systemui.bouncer.shared.constants.PinBouncerConstants.Color; import com.android.systemui.res.R; /** @@ -48,6 +50,7 @@ import com.android.systemui.res.R; public class PinShapeNonHintingView extends LinearLayout implements PinShapeInput { private static final int RESET_STAGGER_DELAY = 40; private static final int RESET_MAX_DELAY = 200; + @Deprecated private int mColor = getContext().getColor(PIN_SHAPES); private int mPosition = 0; private boolean mIsAnimatingReset = false; @@ -88,7 +91,7 @@ public class PinShapeNonHintingView extends LinearLayout implements PinShapeInpu pinDot.setImageResource(mPinShapeAdapter.getShape(mPosition)); if (pinDot.getDrawable() != null) { Drawable wrappedDrawable = DrawableCompat.wrap(pinDot.getDrawable()); - DrawableCompat.setTint(wrappedDrawable, mColor); + DrawableCompat.setTint(wrappedDrawable, getPinShapeColor()); } if (pinDot.getDrawable() instanceof AnimatedVectorDrawable) { ((AnimatedVectorDrawable) pinDot.getDrawable()).start(); @@ -216,4 +219,12 @@ public class PinShapeNonHintingView extends LinearLayout implements PinShapeInpu return animator; } } + + private int getPinShapeColor() { + if (Flags.bouncerUiRevamp2()) { + return mContext.getColor(Color.shape); + } else { + return mColor; + } + } } diff --git a/packages/SystemUI/src/com/android/systemui/accessibility/WindowMagnificationSettings.java b/packages/SystemUI/src/com/android/systemui/accessibility/WindowMagnificationSettings.java index 9d9f5691816e..c14d28d1c08d 100644 --- a/packages/SystemUI/src/com/android/systemui/accessibility/WindowMagnificationSettings.java +++ b/packages/SystemUI/src/com/android/systemui/accessibility/WindowMagnificationSettings.java @@ -392,15 +392,6 @@ class WindowMagnificationSettings implements MagnificationGestureDetector.OnGest setSystemGestureExclusion(); mIsVisible = true; mCallback.onSettingsPanelVisibilityChanged(/* shown= */ true); - - if (resetPosition) { - // We could not put focus on the settings panel automatically - // since it is an inactive window. Therefore, we announce the existence of - // magnification settings for accessibility when it is opened. - mSettingView.announceForAccessibility( - mContext.getResources().getString( - R.string.accessibility_magnification_settings_panel_description)); - } } mContext.registerReceiver(mScreenOffReceiver, new IntentFilter(Intent.ACTION_SCREEN_OFF)); } diff --git a/packages/SystemUI/src/com/android/systemui/bouncer/shared/constants/KeyguardBouncerConstants.kt b/packages/SystemUI/src/com/android/systemui/bouncer/shared/constants/KeyguardBouncerConstants.kt index a286d16826cd..e949dc6a1935 100644 --- a/packages/SystemUI/src/com/android/systemui/bouncer/shared/constants/KeyguardBouncerConstants.kt +++ b/packages/SystemUI/src/com/android/systemui/bouncer/shared/constants/KeyguardBouncerConstants.kt @@ -16,6 +16,16 @@ package com.android.systemui.bouncer.shared.constants +import com.android.app.animation.Interpolators +import com.android.internal.R.color as colors +import com.android.systemui.Flags +import com.android.systemui.bouncer.shared.constants.KeyguardBouncerConstants.ColorId.NUM_PAD_BACKGROUND +import com.android.systemui.bouncer.shared.constants.KeyguardBouncerConstants.ColorId.NUM_PAD_BACKGROUND_PRESSED +import com.android.systemui.bouncer.shared.constants.KeyguardBouncerConstants.ColorId.NUM_PAD_BUTTON +import com.android.systemui.bouncer.shared.constants.KeyguardBouncerConstants.ColorId.NUM_PAD_KEY +import com.android.systemui.bouncer.shared.constants.KeyguardBouncerConstants.ColorId.NUM_PAD_PRESSED +import com.android.systemui.res.R + object KeyguardBouncerConstants { /** * Values for the bouncer expansion represented as the panel expansion. Panel expansion 1f = @@ -33,15 +43,88 @@ object KeyguardBouncerConstants { const val DEFAULT_PIN_LENGTH = 6 object ColorId { + private const val DEPRECATION_MSG = + "Colors will not be used after bouncerUiRevamp2 flag is launched" + + @Deprecated(DEPRECATION_MSG) const val TITLE = com.android.internal.R.color.materialColorOnSurface + + @Deprecated(DEPRECATION_MSG) const val PIN_SHAPES = com.android.internal.R.color.materialColorOnSurfaceVariant + + @Deprecated(DEPRECATION_MSG) const val NUM_PAD_BACKGROUND = com.android.internal.R.color.materialColorSurfaceContainerHigh + + @Deprecated(DEPRECATION_MSG) const val NUM_PAD_BACKGROUND_PRESSED = com.android.internal.R.color.materialColorPrimaryFixed + + @Deprecated(DEPRECATION_MSG) const val NUM_PAD_PRESSED = com.android.internal.R.color.materialColorOnPrimaryFixed + + @Deprecated(DEPRECATION_MSG) const val NUM_PAD_KEY = com.android.internal.R.color.materialColorOnSurface + + @Deprecated(DEPRECATION_MSG) const val NUM_PAD_BUTTON = com.android.internal.R.color.materialColorOnSecondaryFixed + + @Deprecated(DEPRECATION_MSG) const val EMERGENCY_BUTTON = com.android.internal.R.color.materialColorTertiaryFixed } + + object Color { + @JvmField val actionButtonText = colors.materialColorOnSecondaryContainer + @JvmField val actionButtonBg = colors.materialColorSecondaryContainer + } +} + +private fun <T> c(old: T, new: T): T { + return if (Flags.bouncerUiRevamp2()) { + new + } else { + old + } +} + +object PinBouncerConstants { + @JvmField + val pinShapes = c(old = R.array.bouncer_pin_shapes, new = R.array.updated_bouncer_pin_shapes) + @JvmField + val pinDotAvd = c(old = R.drawable.pin_dot_avd, new = R.drawable.bouncer_shape_outline) + @JvmField + val pinDeleteAvd = c(old = R.drawable.pin_dot_delete_avd, new = R.drawable.bouncer_shape_delete) + + object Color { + @JvmField val hintDot = colors.materialColorOnSurfaceVariant + @JvmField val shape = colors.materialColorPrimary + @JvmField val digit = c(old = NUM_PAD_KEY, new = colors.materialColorOnSurface) + @JvmField + val digitPressed = c(old = NUM_PAD_PRESSED, new = colors.materialColorOnPrimaryContainer) + @JvmField + val digitBg = c(old = NUM_PAD_BACKGROUND, colors.materialColorSurfaceContainerHigh) + @JvmField + val bgPressed = c(old = NUM_PAD_BACKGROUND_PRESSED, colors.materialColorPrimaryContainer) + @JvmField + val actionWithAutoConfirm = c(old = NUM_PAD_KEY, new = colors.materialColorOnSurface) + @JvmField val action = c(old = NUM_PAD_BUTTON, new = colors.materialColorOnSecondary) + @JvmField + val actionBg = c(old = colors.materialColorSecondaryFixedDim, colors.materialColorSecondary) + } + + object Animation { + @JvmField val expansionDuration = c(old = 100, new = 33) + @JvmField val expansionColorDuration = c(old = 50, new = expansionDuration) + @JvmField + val expansionInterpolator = c(old = Interpolators.LINEAR, new = Interpolators.LINEAR)!! + + @JvmField val contractionDuration = c(old = 417, new = 300) + @JvmField val contractionStartDelay = c(old = 33, new = 0) + @JvmField + val contractionRadiusInterpolator = + c(old = Interpolators.FAST_OUT_SLOW_IN, new = Interpolators.STANDARD)!! + @JvmField + val contractionColorInterpolator = + c(old = Interpolators.LINEAR, new = Interpolators.STANDARD)!! + } } diff --git a/packages/SystemUI/src/com/android/systemui/bouncer/ui/BouncerMessageView.kt b/packages/SystemUI/src/com/android/systemui/bouncer/ui/BouncerMessageView.kt index ad49fd03c577..b53a8a1fe671 100644 --- a/packages/SystemUI/src/com/android/systemui/bouncer/ui/BouncerMessageView.kt +++ b/packages/SystemUI/src/com/android/systemui/bouncer/ui/BouncerMessageView.kt @@ -45,7 +45,7 @@ class BouncerMessageView : LinearLayout { primaryMessageView = findViewById(R.id.bouncer_primary_message_area) secondaryMessageView = findViewById(R.id.bouncer_secondary_message_area) - if (Flags.gsfBouncer()) { + if (Flags.gsfBouncer() || Flags.bouncerUiRevamp2()) { primaryMessageView?.apply { typeface = Typeface.create("gsf-title-large-emphasized", Typeface.NORMAL) } diff --git a/packages/SystemUI/src/com/android/systemui/communal/data/model/CommunalWidgetCategories.kt b/packages/SystemUI/src/com/android/systemui/communal/data/model/CommunalWidgetCategories.kt index 75f0badfc7cb..31ffbbd9f713 100644 --- a/packages/SystemUI/src/com/android/systemui/communal/data/model/CommunalWidgetCategories.kt +++ b/packages/SystemUI/src/com/android/systemui/communal/data/model/CommunalWidgetCategories.kt @@ -22,15 +22,24 @@ import android.appwidget.AppWidgetProviderInfo * The widget categories to display on communal hub (where categories is a bitfield with values that * match those in {@link AppWidgetProviderInfo}). */ -@JvmInline -value class CommunalWidgetCategories(val categories: Int = defaultCategories) { - fun contains(category: Int) = (categories and category) == category +object CommunalWidgetCategories { + /** + * Categories that are allowed on communal hub. + * - Use "or" operator for including multiple categories. + */ + val includedCategories: Int + get() { + return AppWidgetProviderInfo.WIDGET_CATEGORY_HOME_SCREEN or + AppWidgetProviderInfo.WIDGET_CATEGORY_KEYGUARD + } - companion object { - val defaultCategories: Int - get() { - return AppWidgetProviderInfo.WIDGET_CATEGORY_KEYGUARD or - AppWidgetProviderInfo.WIDGET_CATEGORY_HOME_SCREEN - } - } + /** + * Categories to further filter included widgets by excluding certain opt-out categories. + * - WIDGET_CATEGORY_NOT_KEYGUARD: widgets opted out of displaying on keyguard like surfaces. + * - Use "and" operator for excluding multiple opt-out categories. + */ + val excludedCategories: Int + get() { + return AppWidgetProviderInfo.WIDGET_CATEGORY_NOT_KEYGUARD.inv() + } } diff --git a/packages/SystemUI/src/com/android/systemui/communal/ui/viewmodel/CommunalEditModeViewModel.kt b/packages/SystemUI/src/com/android/systemui/communal/ui/viewmodel/CommunalEditModeViewModel.kt index 52bf0004cbe4..8aba11190623 100644 --- a/packages/SystemUI/src/com/android/systemui/communal/ui/viewmodel/CommunalEditModeViewModel.kt +++ b/packages/SystemUI/src/com/android/systemui/communal/ui/viewmodel/CommunalEditModeViewModel.kt @@ -241,8 +241,9 @@ constructor( ) putExtra( AppWidgetManager.EXTRA_CATEGORY_FILTER, - CommunalWidgetCategories.defaultCategories, + CommunalWidgetCategories.includedCategories, ) + putExtra(EXTRA_CATEGORY_EXCLUSION_FILTER, CommunalWidgetCategories.excludedCategories) communalSettingsInteractor.workProfileUserDisallowedByDevicePolicy.value?.let { putExtra(EXTRA_USER_ID_FILTER, arrayListOf(it.id)) @@ -281,6 +282,7 @@ constructor( private const val EXTRA_DESIRED_WIDGET_WIDTH = "desired_widget_width" private const val EXTRA_DESIRED_WIDGET_HEIGHT = "desired_widget_height" + private const val EXTRA_CATEGORY_EXCLUSION_FILTER = "category_exclusion_filter" private const val EXTRA_PICKER_TITLE = "picker_title" private const val EXTRA_PICKER_DESCRIPTION = "picker_description" private const val EXTRA_UI_SURFACE_KEY = "ui_surface" diff --git a/packages/SystemUI/src/com/android/systemui/communal/ui/viewmodel/CommunalUserActionsViewModel.kt b/packages/SystemUI/src/com/android/systemui/communal/ui/viewmodel/CommunalUserActionsViewModel.kt index e35fdfe9087c..29d9cacdbc79 100644 --- a/packages/SystemUI/src/com/android/systemui/communal/ui/viewmodel/CommunalUserActionsViewModel.kt +++ b/packages/SystemUI/src/com/android/systemui/communal/ui/viewmodel/CommunalUserActionsViewModel.kt @@ -24,6 +24,7 @@ import com.android.systemui.scene.shared.model.SceneFamilies import com.android.systemui.scene.shared.model.Scenes import com.android.systemui.scene.ui.viewmodel.UserActionsViewModel 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 com.android.systemui.shade.ui.viewmodel.dualShadeActions import com.android.systemui.shade.ui.viewmodel.singleShadeActions @@ -41,6 +42,7 @@ class CommunalUserActionsViewModel constructor( private val deviceUnlockedInteractor: DeviceUnlockedInteractor, private val shadeInteractor: ShadeInteractor, + private val shadeModeInteractor: ShadeModeInteractor, ) : UserActionsViewModel() { override suspend fun hydrateActions(setActions: (Map<UserAction, UserActionResult>) -> Unit) { @@ -51,7 +53,7 @@ constructor( } else { combine( deviceUnlockedInteractor.deviceUnlockStatus.map { it.isUnlocked }, - shadeInteractor.shadeMode, + shadeModeInteractor.shadeMode, ) { isDeviceUnlocked, shadeMode -> buildList { val bouncerOrGone = diff --git a/packages/SystemUI/src/com/android/systemui/dreams/ui/viewmodel/DreamUserActionsViewModel.kt b/packages/SystemUI/src/com/android/systemui/dreams/ui/viewmodel/DreamUserActionsViewModel.kt index 160574fa2244..9ce2ce0100a3 100644 --- a/packages/SystemUI/src/com/android/systemui/dreams/ui/viewmodel/DreamUserActionsViewModel.kt +++ b/packages/SystemUI/src/com/android/systemui/dreams/ui/viewmodel/DreamUserActionsViewModel.kt @@ -24,6 +24,7 @@ import com.android.systemui.deviceentry.domain.interactor.DeviceUnlockedInteract import com.android.systemui.scene.shared.model.Scenes import com.android.systemui.scene.ui.viewmodel.UserActionsViewModel 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 com.android.systemui.shade.ui.viewmodel.dualShadeActions import com.android.systemui.shade.ui.viewmodel.singleShadeActions @@ -42,6 +43,7 @@ constructor( private val communalInteractor: CommunalInteractor, private val deviceUnlockedInteractor: DeviceUnlockedInteractor, private val shadeInteractor: ShadeInteractor, + private val shadeModeInteractor: ShadeModeInteractor, ) : UserActionsViewModel() { override suspend fun hydrateActions(setActions: (Map<UserAction, UserActionResult>) -> Unit) { @@ -53,7 +55,7 @@ constructor( combine( deviceUnlockedInteractor.deviceUnlockStatus.map { it.isUnlocked }, communalInteractor.isCommunalAvailable, - shadeInteractor.shadeMode, + shadeModeInteractor.shadeMode, ) { isDeviceUnlocked, isCommunalAvailable, shadeMode -> buildList { if (isCommunalAvailable) { diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java index fd50485fc3a3..372fdca20ed9 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java +++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java @@ -3728,12 +3728,13 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable, // windows that appear on top, ever int flags = StatusBarManager.DISABLE_NONE; - // TODO (b/155663717) After restart, status bar will not properly hide home button + // TODO(b/155663717): After restart, status bar will not properly hide home button // unless disable is called to show un-hide it once first if (forceClearFlags) { if (UserManager.isVisibleBackgroundUsersEnabled() - && !mProcessWrapper.isSystemUser() && !mProcessWrapper.isForegroundUser()) { - // TODO: b/341604160 - Support visible background users properly. + && !mProcessWrapper.isSystemUser() + && !mProcessWrapper.isForegroundUserOrProfile()) { + // TODO(b/341604160): Support visible background users properly. if (DEBUG) { Log.d(TAG, "Status bar manager is disabled for visible background users"); } @@ -3769,8 +3770,9 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable, if (!SceneContainerFlag.isEnabled()) { if (UserManager.isVisibleBackgroundUsersEnabled() - && !mProcessWrapper.isSystemUser() && !mProcessWrapper.isForegroundUser()) { - // TODO: b/341604160 - Support visible background users properly. + && !mProcessWrapper.isSystemUser() + && !mProcessWrapper.isForegroundUserOrProfile()) { + // TODO(b/341604160): Support visible background users properly. if (DEBUG) { Log.d(TAG, "Status bar manager is disabled for visible background users"); } diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/data/repository/KeyguardRepository.kt b/packages/SystemUI/src/com/android/systemui/keyguard/data/repository/KeyguardRepository.kt index aaad10140a92..4b36e7a43dcb 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/data/repository/KeyguardRepository.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/data/repository/KeyguardRepository.kt @@ -79,6 +79,8 @@ interface KeyguardRepository { val panelAlpha: MutableStateFlow<Float> + val zoomOut: StateFlow<Float> + /** * Observable for whether the keyguard is showing. * @@ -278,6 +280,9 @@ interface KeyguardRepository { /** Temporary shim for fading out content when the brightness slider is used */ fun setPanelAlpha(alpha: Float) + /** Sets the zoom out scale of spatial model pushback from e.g. pulling down the shade. */ + fun setZoomOut(zoomOutFromShadeRadius: Float) + /** Whether the device is actively dreaming */ fun setDreaming(isDreaming: Boolean) @@ -381,6 +386,7 @@ constructor( override val onCameraLaunchDetected = MutableStateFlow(CameraLaunchSourceModel()) override val panelAlpha: MutableStateFlow<Float> = MutableStateFlow(1f) + override val zoomOut: MutableStateFlow<Float> = MutableStateFlow(0f) override val topClippingBounds = MutableStateFlow<Int?>(null) override val isKeyguardShowing: MutableStateFlow<Boolean> = @@ -662,6 +668,10 @@ constructor( panelAlpha.value = alpha } + override fun setZoomOut(zoomOutFromShadeRadius: Float) { + zoomOut.value = zoomOutFromShadeRadius + } + override fun setDreaming(isDreaming: Boolean) { this.isDreaming.value = isDreaming } diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardInteractor.kt b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardInteractor.kt index 3739d17da6c4..3652c17309f4 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardInteractor.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardInteractor.kt @@ -337,6 +337,9 @@ constructor( @Deprecated("SceneContainer uses NotificationStackAppearanceInteractor") val panelAlpha: StateFlow<Float> = repository.panelAlpha.asStateFlow() + /** Sets the zoom out scale of spatial model pushback from e.g. pulling down the shade. */ + val zoomOut: StateFlow<Float> = repository.zoomOut + /** * When the lockscreen can be dismissed, emit an alpha value as the user swipes up. This is * useful just before the code commits to moving to GONE. @@ -475,6 +478,10 @@ constructor( repository.setPanelAlpha(alpha) } + fun setZoomOut(zoomOutFromShadeRadius: Float) { + repository.setZoomOut(zoomOutFromShadeRadius) + } + fun setAnimateDozingTransitions(animate: Boolean) { repository.setAnimateDozingTransitions(animate) } diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/StatusBarDisableFlagsInteractor.kt b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/StatusBarDisableFlagsInteractor.kt index d6a110a8fd55..cb602f1287f7 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/StatusBarDisableFlagsInteractor.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/StatusBarDisableFlagsInteractor.kt @@ -22,7 +22,10 @@ import android.content.Context import android.os.Binder import android.os.IBinder import android.os.RemoteException +import android.os.UserManager import android.provider.DeviceConfig +import android.util.Log +import com.android.app.tracing.coroutines.launchTraced as launch import com.android.internal.config.sysui.SystemUiDeviceConfigFlags import com.android.internal.statusbar.IStatusBarService import com.android.systemui.CoreStartable @@ -39,6 +42,7 @@ import com.android.systemui.navigation.domain.interactor.NavigationInteractor import com.android.systemui.power.domain.interactor.PowerInteractor import com.android.systemui.power.shared.model.WakeSleepReason import com.android.systemui.power.shared.model.WakefulnessModel +import com.android.systemui.process.ProcessWrapper import com.android.systemui.scene.shared.flag.SceneContainerFlag import com.android.systemui.shade.ShadeDisplayAware import com.android.systemui.user.domain.interactor.SelectedUserInteractor @@ -49,9 +53,10 @@ import kotlinx.coroutines.flow.combine import kotlinx.coroutines.flow.distinctUntilChanged import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.flow.map -import com.android.app.tracing.coroutines.launchTraced as launch import kotlinx.coroutines.withContext +private val TAG = StatusBarDisableFlagsInteractor::class.simpleName + /** * Logic around StatusBarService#disableForUser, which is used to disable the home and recents * button in certain device states. @@ -67,6 +72,7 @@ constructor( @Background private val backgroundDispatcher: CoroutineDispatcher, private val deviceEntryFaceAuthInteractor: DeviceEntryFaceAuthInteractor, private val statusBarService: IStatusBarService, + private val processWrapper: ProcessWrapper, keyguardTransitionInteractor: KeyguardTransitionInteractor, selectedUserInteractor: SelectedUserInteractor, deviceConfigInteractor: DeviceConfigInteractor, @@ -141,6 +147,24 @@ constructor( return } + // TODO(b/341604160): Remove this blocking logic once StatusBarManagerService supports + // visible background users properly. + if ( + UserManager.isVisibleBackgroundUsersEnabled() && + !processWrapper.isSystemUser() && + !processWrapper.isForegroundUserOrProfile() + ) { + // Currently, only one SysUI process can register with IStatusBarService to listen + // for the CommandQueue events. + // In the Multi Display configuration with concurrent multi users (primarily used + // in Automotive), a visible background user (Automotive Multi Display passengers) + // could also access this code path. Given this limitation and we only allow the + // current user's SysUI process to register with IStatusBarService, we need to prevent + // calls into IStatusBarService from visible background users. + Log.d(TAG, "Status bar manager is disabled for visible background users") + return + } + scope.launch { disableFlagsForUserId.collect { (selectedUserId, flags) -> if (context.getSystemService(Context.STATUS_BAR_SERVICE) == null) { 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 e48af773497a..b8020b19ce86 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 @@ -172,6 +172,13 @@ object KeyguardRootViewBinder { } } + launch("$TAG#zoomOut") { + viewModel.scaleFromZoomOut.collect { scaleFromZoomOut -> + view.scaleX = scaleFromZoomOut + view.scaleY = scaleFromZoomOut + } + } + launch("$TAG#translationY") { // When translation happens in burnInLayer, it won't be weather clock large // clock isn't added to burnInLayer due to its scale transition so we also diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardRootViewModel.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardRootViewModel.kt index 11a509a4fa61..47a76a00fd4a 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardRootViewModel.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardRootViewModel.kt @@ -287,6 +287,9 @@ constructor( .distinctUntilChanged() } + val scaleFromZoomOut: Flow<Float> = + keyguardInteractor.zoomOut.map { 1 - it * PUSHBACK_SCALE_FOR_LOCKSCREEN } + val translationY: Flow<Float> = aodBurnInViewModel.movement.map { it.translationY.toFloat() } val translationX: Flow<StateToValue> = @@ -418,5 +421,6 @@ constructor( companion object { private const val TAG = "KeyguardRootViewModel" + private const val PUSHBACK_SCALE_FOR_LOCKSCREEN = 0.05f } } diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/LockscreenContentViewModel.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/LockscreenContentViewModel.kt index ef6ae0dd6427..b6a3b6aaba14 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/LockscreenContentViewModel.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/LockscreenContentViewModel.kt @@ -24,10 +24,11 @@ import com.android.systemui.customization.R as customR import com.android.systemui.deviceentry.domain.interactor.DeviceEntryInteractor import com.android.systemui.keyguard.domain.interactor.KeyguardBlueprintInteractor import com.android.systemui.keyguard.domain.interactor.KeyguardClockInteractor +import com.android.systemui.keyguard.domain.interactor.KeyguardTransitionInteractor import com.android.systemui.keyguard.shared.model.ClockSize +import com.android.systemui.keyguard.shared.model.KeyguardState import com.android.systemui.lifecycle.ExclusiveActivatable import com.android.systemui.res.R -import com.android.systemui.scene.domain.interactor.SceneContainerOcclusionInteractor import com.android.systemui.shade.domain.interactor.ShadeInteractor import com.android.systemui.unfold.domain.interactor.UnfoldTransitionInteractor import dagger.assisted.AssistedFactory @@ -54,8 +55,8 @@ constructor( val touchHandling: KeyguardTouchHandlingViewModel, private val shadeInteractor: ShadeInteractor, private val unfoldTransitionInteractor: UnfoldTransitionInteractor, - private val occlusionInteractor: SceneContainerOcclusionInteractor, private val deviceEntryInteractor: DeviceEntryInteractor, + private val transitionInteractor: KeyguardTransitionInteractor, ) : ExclusiveActivatable() { @VisibleForTesting val clockSize = clockInteractor.clockSize @@ -89,9 +90,15 @@ constructor( } launch { - occlusionInteractor.isOccludingActivityShown - .map { !it } - .collect { _isContentVisible.value = it } + transitionInteractor + .transitionValue(KeyguardState.OCCLUDED) + .map { it > 0f } + .collect { fullyOrPartiallyOccluded -> + // Content is visible unless we're OCCLUDED. Currently, we don't have nice + // animations into and out of OCCLUDED, so the lockscreen/AOD content is + // hidden immediately upon entering/exiting OCCLUDED. + _isContentVisible.value = !fullyOrPartiallyOccluded + } } awaitCancellation() diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/LockscreenUserActionsViewModel.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/LockscreenUserActionsViewModel.kt index b7e3e2b38732..3353983ab5a5 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/LockscreenUserActionsViewModel.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/LockscreenUserActionsViewModel.kt @@ -25,23 +25,27 @@ import com.android.systemui.scene.domain.interactor.SceneContainerOcclusionInter import com.android.systemui.scene.shared.model.Scenes import com.android.systemui.scene.ui.viewmodel.UserActionsViewModel 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 com.android.systemui.shade.ui.viewmodel.dualShadeActions import com.android.systemui.shade.ui.viewmodel.singleShadeActions import com.android.systemui.shade.ui.viewmodel.splitShadeActions import dagger.assisted.AssistedFactory import dagger.assisted.AssistedInject +import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.combine import kotlinx.coroutines.flow.flatMapLatest import kotlinx.coroutines.flow.flowOf /** Models UI state and handles user input for the lockscreen scene. */ +@OptIn(ExperimentalCoroutinesApi::class) class LockscreenUserActionsViewModel @AssistedInject constructor( private val deviceEntryInteractor: DeviceEntryInteractor, private val communalInteractor: CommunalInteractor, private val shadeInteractor: ShadeInteractor, + private val shadeModeInteractor: ShadeModeInteractor, private val occlusionInteractor: SceneContainerOcclusionInteractor, ) : UserActionsViewModel() { @@ -55,7 +59,7 @@ constructor( combine( deviceEntryInteractor.isUnlocked, communalInteractor.isCommunalAvailable, - shadeInteractor.shadeMode, + shadeModeInteractor.shadeMode, occlusionInteractor.isOccludingActivityShown, ) { isDeviceUnlocked, isCommunalAvailable, shadeMode, isOccluded -> buildList { 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 34c87feb0a0d..9968bc95a5ba 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 @@ -16,6 +16,7 @@ package com.android.systemui.keyguard.ui.viewmodel +import android.util.MathUtils import com.android.systemui.bouncer.domain.interactor.PrimaryBouncerInteractor import com.android.systemui.bouncer.shared.flag.ComposeBouncerFlags import com.android.systemui.dagger.SysUISingleton @@ -63,10 +64,12 @@ constructor( val showAllNotifications: Flow<Boolean> = bouncerToGoneFlows.showAllNotifications(TO_GONE_DURATION, PRIMARY_BOUNCER) - val notificationAlpha: Flow<Float> = - transitionAnimation.sharedFlow( + fun notificationAlpha(viewState: ViewStateAccessor): Flow<Float> { + var startAlpha = 1f + return transitionAnimation.sharedFlow( duration = 200.milliseconds, onStart = { + startAlpha = viewState.alpha() leaveShadeOpen = statusBarStateController.leaveOpenOnKeyguardHide() willRunDismissFromKeyguard = primaryBouncerInteractor.willRunDismissFromKeyguard() }, @@ -74,11 +77,12 @@ constructor( if (willRunDismissFromKeyguard || leaveShadeOpen) { 1f } else { - 1f - it + MathUtils.lerp(startAlpha, 0f, it) } }, onFinish = { 1f }, ) + } /** Bouncer container alpha */ val bouncerAlpha: Flow<Float> = diff --git a/packages/SystemUI/src/com/android/systemui/log/SessionTracker.java b/packages/SystemUI/src/com/android/systemui/log/SessionTracker.java index e8ded03e3b38..ad306694346e 100644 --- a/packages/SystemUI/src/com/android/systemui/log/SessionTracker.java +++ b/packages/SystemUI/src/com/android/systemui/log/SessionTracker.java @@ -116,8 +116,8 @@ public class SessionTracker implements CoreStartable { mSessionToInstanceId.put(type, instanceId); if (UserManager.isVisibleBackgroundUsersEnabled() && !mProcessWrapper.isSystemUser() - && !mProcessWrapper.isForegroundUser()) { - // TODO: b/341604160 - Support visible background users properly. + && !mProcessWrapper.isForegroundUserOrProfile()) { + // TODO(b/341604160): Support visible background users properly. if (DEBUG) { Log.d(TAG, "Status bar manager is disabled for visible background users"); } @@ -155,8 +155,8 @@ public class SessionTracker implements CoreStartable { mUiEventLogger.log(endSessionUiEvent, instanceId); } if (UserManager.isVisibleBackgroundUsersEnabled() && !mProcessWrapper.isSystemUser() - && !mProcessWrapper.isForegroundUser()) { - // TODO: b/341604160 - Support visible background users properly. + && !mProcessWrapper.isForegroundUserOrProfile()) { + // TODO(b/341604160): Support visible background users properly. if (DEBUG) { Log.d(TAG, "Status bar manager is disabled for visible background users"); } diff --git a/packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputAdapter.java b/packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputAdapter.java index b391cb079ec5..bc6b2beb2ddb 100644 --- a/packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputAdapter.java +++ b/packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputAdapter.java @@ -298,8 +298,7 @@ public class MediaOutputAdapter extends MediaOutputBaseAdapter { boolean showEndArea = !Flags.enableOutputSwitcherSessionGrouping() || isDeselectable; updateUnmutedVolumeIcon(device); - updateGroupableCheckBox(true, isDeselectable, device); - updateEndClickArea(device, isDeselectable); + updateEndAreaForGroupCheckbox(device, true /* isSelected */, isDeselectable); disableFocusPropertyForView(mContainerLayout); setUpContentDescriptionForView(mSeekBar, device); setSingleLineLayout(device.getName(), true /* showSeekBar */, @@ -331,8 +330,8 @@ public class MediaOutputAdapter extends MediaOutputBaseAdapter { //If device is connected and there's other selectable devices, layout as // one of selected devices. updateUnmutedVolumeIcon(device); - updateGroupableCheckBox(true, isDeselectable, device); - updateEndClickArea(device, isDeselectable); + updateEndAreaForGroupCheckbox(device, true /* isSelected */, + isDeselectable); disableFocusPropertyForView(mContainerLayout); setUpContentDescriptionForView(mSeekBar, device); setSingleLineLayout(device.getName(), true /* showSeekBar */, @@ -352,8 +351,8 @@ public class MediaOutputAdapter extends MediaOutputBaseAdapter { } else if (isSelectable) { //groupable device setUpDeviceIcon(device); - updateGroupableCheckBox(false, true, device); - updateEndClickArea(device, true); + updateEndAreaForGroupCheckbox(device, false /* isSelected */, + true /* isDeselectable */); if (!Flags.disableTransferWhenAppsDoNotSupport() || isTransferable || hasRouteListingPreferenceItem) { @@ -406,7 +405,7 @@ public class MediaOutputAdapter extends MediaOutputBaseAdapter { private void updateEndClickAreaWithIcon(View.OnClickListener clickListener, @DrawableRes int iconDrawableId, @StringRes int accessibilityStringId) { - updateEndClickAreaColor(mController.getColorSeekbarProgress()); + updateEndAreaColor(mController.getColorSeekbarProgress()); mEndClickIcon.setImageTintList( ColorStateList.valueOf(mController.getColorItemContent())); mEndClickIcon.setOnClickListener(clickListener); @@ -422,7 +421,7 @@ public class MediaOutputAdapter extends MediaOutputBaseAdapter { } } - public void updateEndClickAreaColor(int color) { + public void updateEndAreaColor(int color) { mEndTouchArea.setBackgroundTintList( ColorStateList.valueOf(color)); } @@ -455,25 +454,22 @@ public class MediaOutputAdapter extends MediaOutputBaseAdapter { ColorStateList.valueOf(mController.getColorItemContent())); } - public void updateEndClickArea(MediaDevice device, boolean isDeviceDeselectable) { + public void updateEndAreaForGroupCheckbox(MediaDevice device, boolean isSelected, + boolean isDeselectable) { mEndTouchArea.setOnClickListener(null); mEndTouchArea.setOnClickListener( - isDeviceDeselectable ? (v) -> mCheckBox.performClick() : null); + isDeselectable ? (v) -> mCheckBox.performClick() : null); mEndTouchArea.setImportantForAccessibility( View.IMPORTANT_FOR_ACCESSIBILITY_YES); - mEndTouchArea.setBackgroundTintList( - ColorStateList.valueOf(mController.getColorItemBackground())); + updateEndAreaColor(isSelected ? mController.getColorSeekbarProgress() + : mController.getColorItemBackground()); setUpContentDescriptionForView(mEndTouchArea, device); - } - - private void updateGroupableCheckBox(boolean isSelected, boolean isGroupable, - MediaDevice device) { mCheckBox.setOnCheckedChangeListener(null); mCheckBox.setChecked(isSelected); mCheckBox.setOnCheckedChangeListener( - isGroupable ? (buttonView, isChecked) -> onGroupActionTriggered(!isSelected, + isDeselectable ? (buttonView, isChecked) -> onGroupActionTriggered(!isSelected, device) : null); - mCheckBox.setEnabled(isGroupable); + mCheckBox.setEnabled(isDeselectable); setCheckBoxColor(mCheckBox, mController.getColorItemContent()); } diff --git a/packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputBaseAdapter.java b/packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputBaseAdapter.java index ee2d8aa46264..a7786c8f0b57 100644 --- a/packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputBaseAdapter.java +++ b/packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputBaseAdapter.java @@ -141,6 +141,8 @@ public abstract class MediaOutputBaseAdapter extends final ImageView mEndClickIcon; @VisibleForTesting MediaOutputSeekbar mSeekBar; + private final float mInactiveRadius; + private final float mActiveRadius; private String mDeviceId; private ValueAnimator mCornerAnimator; private ValueAnimator mVolumeAnimator; @@ -161,6 +163,10 @@ public abstract class MediaOutputBaseAdapter extends mEndClickIcon = view.requireViewById(R.id.media_output_item_end_click_icon); mVolumeValueText = view.requireViewById(R.id.volume_value); mIconAreaLayout = view.requireViewById(R.id.icon_area); + mInactiveRadius = mContext.getResources().getDimension( + R.dimen.media_output_dialog_background_radius); + mActiveRadius = mContext.getResources().getDimension( + R.dimen.media_output_dialog_active_background_radius); initAnimator(); } @@ -216,10 +222,6 @@ public abstract class MediaOutputBaseAdapter extends mEndClickIcon.setVisibility( !showCheckBox && showEndTouchArea ? View.VISIBLE : View.GONE); } - ViewGroup.MarginLayoutParams params = - (ViewGroup.MarginLayoutParams) mItemLayout.getLayoutParams(); - params.rightMargin = showEndTouchArea ? mController.getItemMarginEndSelectable() - : mController.getItemMarginEndDefault(); } void setTwoLineLayout(CharSequence title, boolean showSeekBar, @@ -247,10 +249,6 @@ public abstract class MediaOutputBaseAdapter extends //update end click area by isActive mEndTouchArea.setVisibility(showEndTouchArea ? View.VISIBLE : View.GONE); mEndClickIcon.setVisibility(showEndTouchArea ? View.VISIBLE : View.GONE); - ViewGroup.MarginLayoutParams params = - (ViewGroup.MarginLayoutParams) mItemLayout.getLayoutParams(); - params.rightMargin = showEndTouchArea ? mController.getItemMarginEndSelectable() - : mController.getItemMarginEndDefault(); mItemLayout.setBackground(backgroundDrawable); mProgressBar.setVisibility(showProgressBar ? View.VISIBLE : View.GONE); mSubTitleText.setVisibility(showSubtitle ? View.VISIBLE : View.GONE); @@ -264,10 +262,10 @@ public abstract class MediaOutputBaseAdapter extends final GradientDrawable progressDrawable = (GradientDrawable) clipDrawable.getDrawable(); progressDrawable.setCornerRadii( - new float[]{0, 0, mController.getActiveRadius(), - mController.getActiveRadius(), - mController.getActiveRadius(), - mController.getActiveRadius(), 0, 0}); + new float[]{0, 0, mActiveRadius, + mActiveRadius, + mActiveRadius, + mActiveRadius, 0, 0}); } private void initializeSeekbarVolume( @@ -431,8 +429,7 @@ public abstract class MediaOutputBaseAdapter extends } private void initAnimator() { - mCornerAnimator = ValueAnimator.ofFloat(mController.getInactiveRadius(), - mController.getActiveRadius()); + mCornerAnimator = ValueAnimator.ofFloat(mInactiveRadius, mActiveRadius); mCornerAnimator.setDuration(ANIM_DURATION); mCornerAnimator.setInterpolator(new LinearInterpolator()); diff --git a/packages/SystemUI/src/com/android/systemui/media/dialog/MediaSwitchingController.java b/packages/SystemUI/src/com/android/systemui/media/dialog/MediaSwitchingController.java index 02a2befe44e5..19409b32a2f6 100644 --- a/packages/SystemUI/src/com/android/systemui/media/dialog/MediaSwitchingController.java +++ b/packages/SystemUI/src/com/android/systemui/media/dialog/MediaSwitchingController.java @@ -171,10 +171,6 @@ public class MediaSwitchingController private int mColorConnectedItemBackground; private int mColorPositiveButtonText; private int mColorDialogBackground; - private int mItemMarginEndDefault; - private int mItemMarginEndSelectable; - private float mInactiveRadius; - private float mActiveRadius; private FeatureFlags mFeatureFlags; private UserTracker mUserTracker; private VolumePanelGlobalStateInteractor mVolumePanelGlobalStateInteractor; @@ -246,16 +242,8 @@ public class MediaSwitchingController R.color.media_dialog_connected_item_background); mColorPositiveButtonText = Utils.getColorStateListDefaultColor(mContext, R.color.media_dialog_solid_button_text); - mInactiveRadius = mContext.getResources().getDimension( - R.dimen.media_output_dialog_background_radius); - mActiveRadius = mContext.getResources().getDimension( - R.dimen.media_output_dialog_active_background_radius); mColorDialogBackground = Utils.getColorStateListDefaultColor(mContext, R.color.media_dialog_background); - mItemMarginEndDefault = (int) mContext.getResources().getDimension( - R.dimen.media_output_dialog_default_margin_end); - mItemMarginEndSelectable = (int) mContext.getResources().getDimension( - R.dimen.media_output_dialog_selectable_margin_end); if (enableInputRouting()) { mInputRouteManager = new InputRouteManager(mContext, audioManager); @@ -638,22 +626,6 @@ public class MediaSwitchingController return mColorItemBackground; } - public float getInactiveRadius() { - return mInactiveRadius; - } - - public float getActiveRadius() { - return mActiveRadius; - } - - public int getItemMarginEndDefault() { - return mItemMarginEndDefault; - } - - public int getItemMarginEndSelectable() { - return mItemMarginEndSelectable; - } - private void buildMediaItems(List<MediaDevice> devices) { synchronized (mMediaDevicesLock) { List<MediaItem> updatedMediaItems = buildMediaItems(mOutputMediaItemList, devices); diff --git a/packages/SystemUI/src/com/android/systemui/process/ProcessWrapper.java b/packages/SystemUI/src/com/android/systemui/process/ProcessWrapper.java index 294d0c75167a..f3a3a3a2ac4c 100644 --- a/packages/SystemUI/src/com/android/systemui/process/ProcessWrapper.java +++ b/packages/SystemUI/src/com/android/systemui/process/ProcessWrapper.java @@ -27,8 +27,12 @@ import javax.inject.Inject; * providing a mockable target around these details. */ public class ProcessWrapper { + private final ActivityManager mActivityManager; + @Inject - public ProcessWrapper() {} + public ProcessWrapper(ActivityManager activityManager) { + mActivityManager = activityManager; + } /** * Returns {@code true} if System User is running the current process. @@ -38,10 +42,10 @@ public class ProcessWrapper { } /** - * Returns {@code true} if the foreground user is running the current process. + * Returns {@code true} if the foreground user or profile is running the current process. */ - public boolean isForegroundUser() { - return ActivityManager.getCurrentUser() == myUserHandle().getIdentifier(); + public boolean isForegroundUserOrProfile() { + return mActivityManager.isProfileForeground(myUserHandle()); } /** diff --git a/packages/SystemUI/src/com/android/systemui/qs/flags/QsDetailedView.kt b/packages/SystemUI/src/com/android/systemui/qs/flags/QsDetailedView.kt index c302cb21f77f..3afaef5ea6a1 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/flags/QsDetailedView.kt +++ b/packages/SystemUI/src/com/android/systemui/qs/flags/QsDetailedView.kt @@ -20,7 +20,6 @@ import com.android.systemui.Flags import com.android.systemui.flags.FlagToken import com.android.systemui.flags.RefactorFlagUtils import com.android.systemui.scene.shared.flag.SceneContainerFlag -import com.android.systemui.shade.shared.flag.DualShade /** Helper for reading or using the QS Detailed View flag state. */ @Suppress("NOTHING_TO_INLINE") @@ -37,7 +36,6 @@ object QsDetailedView { inline val isEnabled get() = Flags.qsTileDetailedView() && // mainAconfigFlag - DualShade.isEnabled && SceneContainerFlag.isEnabled // NOTE: Changes should also be made in getSecondaryFlags @@ -47,10 +45,8 @@ object QsDetailedView { /** The set of secondary flags which must be enabled for qs detailed view to work properly */ inline fun getSecondaryFlags(): Sequence<FlagToken> = - sequenceOf( - DualShade.token - // NOTE: Changes should also be made in isEnabled - ) + SceneContainerFlag.getAllRequirements() + // NOTE: Changes should also be made in isEnabled + SceneContainerFlag.getAllRequirements() /** The full set of requirements for QsDetailedView */ inline fun getAllRequirements(): Sequence<FlagToken> { diff --git a/packages/SystemUI/src/com/android/systemui/qs/flags/QsInCompose.kt b/packages/SystemUI/src/com/android/systemui/qs/flags/QsInCompose.kt index 3067ccbb7cea..3140df8d947a 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/flags/QsInCompose.kt +++ b/packages/SystemUI/src/com/android/systemui/qs/flags/QsInCompose.kt @@ -17,11 +17,11 @@ package com.android.systemui.qs.flags import com.android.systemui.flags.RefactorFlagUtils -import com.android.systemui.shade.shared.flag.DualShade +import com.android.systemui.scene.shared.flag.SceneContainerFlag /** * Object to help check if the new QS ui should be used. This is true if either [QSComposeFragment] - * or [DualShade] are enabled. + * or [SceneContainerFlag] are enabled. */ object QsInCompose { @@ -29,11 +29,12 @@ object QsInCompose { * This is not a real flag name, but a representation of the allowed flag names. Should not be * used with test annotations. */ - private val flagName = "${QSComposeFragment.FLAG_NAME}|${DualShade.FLAG_NAME}" + private val flagName = + "${QSComposeFragment.FLAG_NAME}|${SceneContainerFlag.getMainAconfigFlag().name}" @JvmStatic inline val isEnabled: Boolean - get() = QSComposeFragment.isEnabled || DualShade.isEnabled + get() = QSComposeFragment.isEnabled || SceneContainerFlag.isEnabled @JvmStatic fun isUnexpectedlyInLegacyMode() = diff --git a/packages/SystemUI/src/com/android/systemui/qs/panels/domain/interactor/QSColumnsInteractor.kt b/packages/SystemUI/src/com/android/systemui/qs/panels/domain/interactor/QSColumnsInteractor.kt index 2b2a63b1fded..e6b89fcf2d1f 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/panels/domain/interactor/QSColumnsInteractor.kt +++ b/packages/SystemUI/src/com/android/systemui/qs/panels/domain/interactor/QSColumnsInteractor.kt @@ -19,25 +19,27 @@ package com.android.systemui.qs.panels.domain.interactor import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.qualifiers.Application import com.android.systemui.qs.panels.data.repository.QSColumnsRepository -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 javax.inject.Inject import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.SharingStarted import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.flatMapLatest import kotlinx.coroutines.flow.stateIn +@OptIn(ExperimentalCoroutinesApi::class) @SysUISingleton class QSColumnsInteractor @Inject constructor( @Application scope: CoroutineScope, repo: QSColumnsRepository, - shadeInteractor: ShadeInteractor, + shadeModeInteractor: ShadeModeInteractor, ) { val columns: StateFlow<Int> = - shadeInteractor.shadeMode + shadeModeInteractor.shadeMode .flatMapLatest { when (it) { ShadeMode.Dual -> repo.dualShadeColumns diff --git a/packages/SystemUI/src/com/android/systemui/qs/ui/adapter/QSSceneAdapter.kt b/packages/SystemUI/src/com/android/systemui/qs/ui/adapter/QSSceneAdapter.kt index d4adcdd49f5c..a97bb6102b5d 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/ui/adapter/QSSceneAdapter.kt +++ b/packages/SystemUI/src/com/android/systemui/qs/ui/adapter/QSSceneAdapter.kt @@ -38,7 +38,7 @@ import com.android.systemui.qs.dagger.QSSceneComponent import com.android.systemui.res.R import com.android.systemui.settings.brightness.MirrorController import com.android.systemui.shade.ShadeDisplayAware -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 com.android.systemui.util.kotlin.sample import java.io.PrintWriter @@ -202,7 +202,7 @@ class QSSceneAdapterImpl constructor( private val qsSceneComponentFactory: QSSceneComponent.Factory, private val qsImplProvider: Provider<QSImpl>, - shadeInteractor: ShadeInteractor, + shadeModeInteractor: ShadeModeInteractor, displayStateInteractor: DisplayStateInteractor, dumpManager: DumpManager, @Main private val mainDispatcher: CoroutineDispatcher, @@ -215,7 +215,7 @@ constructor( constructor( qsSceneComponentFactory: QSSceneComponent.Factory, qsImplProvider: Provider<QSImpl>, - shadeInteractor: ShadeInteractor, + shadeModeInteractor: ShadeModeInteractor, displayStateInteractor: DisplayStateInteractor, dumpManager: DumpManager, @Main dispatcher: CoroutineDispatcher, @@ -224,7 +224,7 @@ constructor( ) : this( qsSceneComponentFactory, qsImplProvider, - shadeInteractor, + shadeModeInteractor, displayStateInteractor, dumpManager, dispatcher, @@ -331,8 +331,8 @@ constructor( } } launch { - shadeInteractor.shadeMode.collect { - qsImpl.value?.setInSplitShade(it == ShadeMode.Split) + shadeModeInteractor.shadeMode.collect { + qsImpl.value?.setInSplitShade(it is ShadeMode.Split) } } launch { diff --git a/packages/SystemUI/src/com/android/systemui/qs/ui/viewmodel/QuickSettingsSceneContentViewModel.kt b/packages/SystemUI/src/com/android/systemui/qs/ui/viewmodel/QuickSettingsSceneContentViewModel.kt index 06d3e4a9ad0e..acd091e507ed 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/ui/viewmodel/QuickSettingsSceneContentViewModel.kt +++ b/packages/SystemUI/src/com/android/systemui/qs/ui/viewmodel/QuickSettingsSceneContentViewModel.kt @@ -17,6 +17,7 @@ package com.android.systemui.qs.ui.viewmodel import androidx.lifecycle.LifecycleOwner +import com.android.app.tracing.coroutines.launchTraced as launch import com.android.systemui.lifecycle.ExclusiveActivatable import com.android.systemui.media.controls.domain.pipeline.interactor.MediaCarouselInteractor import com.android.systemui.qs.FooterActionsController @@ -25,7 +26,7 @@ import com.android.systemui.qs.ui.adapter.QSSceneAdapter import com.android.systemui.scene.domain.interactor.SceneInteractor import com.android.systemui.scene.shared.model.Scenes import com.android.systemui.settings.brightness.ui.viewModel.BrightnessMirrorViewModel -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 com.android.systemui.shade.ui.viewmodel.ShadeHeaderViewModel import dagger.assisted.AssistedFactory @@ -34,7 +35,6 @@ import java.util.concurrent.atomic.AtomicBoolean import kotlinx.coroutines.awaitCancellation import kotlinx.coroutines.coroutineScope import kotlinx.coroutines.flow.StateFlow -import com.android.app.tracing.coroutines.launchTraced as launch /** * Models UI state needed for rendering the content of the quick settings scene. @@ -51,7 +51,7 @@ constructor( private val footerActionsViewModelFactory: FooterActionsViewModel.Factory, private val footerActionsController: FooterActionsController, val mediaCarouselInteractor: MediaCarouselInteractor, - private val shadeInteractor: ShadeInteractor, + private val shadeModeInteractor: ShadeModeInteractor, private val sceneInteractor: SceneInteractor, ) : ExclusiveActivatable() { @@ -69,8 +69,8 @@ constructor( override suspend fun onActivated(): Nothing { coroutineScope { launch { - shadeInteractor.shadeMode.collect { shadeMode -> - if (shadeMode == ShadeMode.Split) { + shadeModeInteractor.shadeMode.collect { shadeMode -> + if (shadeMode is ShadeMode.Split) { sceneInteractor.snapToScene(Scenes.Shade, "Unfold while on QS") } } diff --git a/packages/SystemUI/src/com/android/systemui/scene/ui/viewmodel/GoneUserActionsViewModel.kt b/packages/SystemUI/src/com/android/systemui/scene/ui/viewmodel/GoneUserActionsViewModel.kt index fc172e8ca1d8..8eac63cb7cda 100644 --- a/packages/SystemUI/src/com/android/systemui/scene/ui/viewmodel/GoneUserActionsViewModel.kt +++ b/packages/SystemUI/src/com/android/systemui/scene/ui/viewmodel/GoneUserActionsViewModel.kt @@ -18,7 +18,7 @@ package com.android.systemui.scene.ui.viewmodel import com.android.compose.animation.scene.UserAction import com.android.compose.animation.scene.UserActionResult -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 com.android.systemui.shade.ui.viewmodel.dualShadeActions import com.android.systemui.shade.ui.viewmodel.singleShadeActions @@ -28,10 +28,10 @@ import dagger.assisted.AssistedInject class GoneUserActionsViewModel @AssistedInject -constructor(private val shadeInteractor: ShadeInteractor) : UserActionsViewModel() { +constructor(private val shadeModeInteractor: ShadeModeInteractor) : UserActionsViewModel() { override suspend fun hydrateActions(setActions: (Map<UserAction, UserActionResult>) -> Unit) { - shadeInteractor.shadeMode.collect { shadeMode -> + shadeModeInteractor.shadeMode.collect { shadeMode -> setActions( buildList { addAll( 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 a380e26db7ea..fbcd8ea9b9e4 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 @@ -39,7 +39,7 @@ 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.domain.interactor.ShadeModeInteractor import com.android.systemui.shade.shared.model.ShadeMode import com.android.systemui.statusbar.domain.interactor.RemoteInputInteractor import com.android.systemui.statusbar.notification.stack.ui.view.SharedNotificationContainer @@ -60,7 +60,7 @@ constructor( private val sceneInteractor: SceneInteractor, private val falsingInteractor: FalsingInteractor, private val powerInteractor: PowerInteractor, - shadeInteractor: ShadeInteractor, + shadeModeInteractor: ShadeModeInteractor, private val remoteInputInteractor: RemoteInputInteractor, private val splitEdgeDetector: SplitEdgeDetector, private val logger: SceneLogger, @@ -93,7 +93,7 @@ constructor( traceName = "edgeDetector", initialValue = DefaultEdgeDetector, source = - shadeInteractor.shadeMode.map { + shadeModeInteractor.shadeMode.map { if (it is ShadeMode.Dual) splitEdgeDetector else DefaultEdgeDetector }, ) diff --git a/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java b/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java index 28f5694c3332..e535019cd3d7 100644 --- a/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java +++ b/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java @@ -527,6 +527,9 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump private final ActivityStarter mActivityStarter; private final BrightnessMirrorShowingInteractor mBrightnessMirrorShowingInteractor; + @Nullable + private RenderEffect mBlurRenderEffect = null; + @Inject public NotificationPanelViewController(NotificationPanelView view, NotificationWakeUpCoordinator coordinator, @@ -912,13 +915,14 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump private void handleBouncerShowingChanged(Boolean isBouncerShowing) { if (!com.android.systemui.Flags.bouncerUiRevamp()) return; - if (isBouncerShowing && isExpanded()) { - float shadeBlurEffect = mDepthController.getMaxBlurRadiusPx(); - mView.setRenderEffect(RenderEffect.createBlurEffect( - shadeBlurEffect, - shadeBlurEffect, - Shader.TileMode.CLAMP)); + if (mBlurRenderEffect == null) { + mBlurRenderEffect = RenderEffect.createBlurEffect( + mDepthController.getMaxBlurRadiusPx(), + mDepthController.getMaxBlurRadiusPx(), + Shader.TileMode.CLAMP); + } + mView.setRenderEffect(mBlurRenderEffect); } else { mView.setRenderEffect(null); } diff --git a/packages/SystemUI/src/com/android/systemui/shade/ShadeStateTraceLogger.kt b/packages/SystemUI/src/com/android/systemui/shade/ShadeStateTraceLogger.kt index 39703ab5602c..6b183acbf9c2 100644 --- a/packages/SystemUI/src/com/android/systemui/shade/ShadeStateTraceLogger.kt +++ b/packages/SystemUI/src/com/android/systemui/shade/ShadeStateTraceLogger.kt @@ -25,6 +25,7 @@ import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.qualifiers.Application import com.android.systemui.shade.data.repository.ShadeDisplaysRepository import com.android.systemui.shade.domain.interactor.ShadeInteractor +import com.android.systemui.shade.domain.interactor.ShadeModeInteractor import com.android.systemui.shade.shared.flag.ShadeWindowGoesAround import dagger.Lazy import javax.inject.Inject @@ -36,6 +37,7 @@ class ShadeStateTraceLogger @Inject constructor( private val shadeInteractor: ShadeInteractor, + private val shadeModeInteractor: ShadeModeInteractor, private val shadeDisplaysRepository: Lazy<ShadeDisplaysRepository>, @Application private val scope: CoroutineScope, ) : CoreStartable { @@ -47,7 +49,7 @@ constructor( } launch { val stateLogger = createTraceStateLogger("shadeMode") - shadeInteractor.shadeMode.collect { stateLogger.log(it.toString()) } + shadeModeInteractor.shadeMode.collect { stateLogger.log(it.toString()) } } launch { shadeInteractor.shadeExpansion.collect { diff --git a/packages/SystemUI/src/com/android/systemui/shade/domain/interactor/ShadeBackActionInteractorImpl.kt b/packages/SystemUI/src/com/android/systemui/shade/domain/interactor/ShadeBackActionInteractorImpl.kt index 5a63034b5754..6eaedd73ea76 100644 --- a/packages/SystemUI/src/com/android/systemui/shade/domain/interactor/ShadeBackActionInteractorImpl.kt +++ b/packages/SystemUI/src/com/android/systemui/shade/domain/interactor/ShadeBackActionInteractorImpl.kt @@ -20,7 +20,6 @@ import com.android.systemui.deviceentry.domain.interactor.DeviceEntryInteractor import com.android.systemui.scene.domain.interactor.SceneInteractor import com.android.systemui.scene.shared.model.SceneFamilies import com.android.systemui.scene.shared.model.Scenes -import com.android.systemui.shade.shared.model.ShadeMode import javax.inject.Inject /** Implementation of ShadeBackActionInteractor backed by scenes. */ @@ -28,13 +27,14 @@ class ShadeBackActionInteractorImpl @Inject constructor( val shadeInteractor: ShadeInteractor, + val shadeModeInteractor: ShadeModeInteractor, val sceneInteractor: SceneInteractor, val deviceEntryInteractor: DeviceEntryInteractor, ) : ShadeBackActionInteractor { override fun animateCollapseQs(fullyCollapse: Boolean) { if (shadeInteractor.isQsExpanded.value) { val key = - if (fullyCollapse || shadeInteractor.shadeMode.value is ShadeMode.Dual) { + if (fullyCollapse || shadeModeInteractor.isDualShade) { SceneFamilies.Home } else { Scenes.Shade 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 f1765e775d65..c8ce316c41dd 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 @@ -18,7 +18,6 @@ package com.android.systemui.shade.domain.interactor import androidx.annotation.FloatRange import com.android.compose.animation.scene.TransitionKey -import com.android.systemui.shade.shared.model.ShadeMode import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.SharingStarted @@ -60,13 +59,6 @@ interface ShadeInteractor : BaseShadeInteractor { val isExpandToQsEnabled: Flow<Boolean> /** - * The version of the shade layout to use. - * - * Note: Most likely, you want to read [isShadeLayoutWide] instead of this. - */ - val shadeMode: StateFlow<ShadeMode> - - /** * 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 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 322fca39a1df..b1129a94d833 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 @@ -18,7 +18,6 @@ package com.android.systemui.shade.domain.interactor import com.android.compose.animation.scene.TransitionKey import com.android.systemui.dagger.SysUISingleton -import com.android.systemui.shade.shared.model.ShadeMode import javax.inject.Inject import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.MutableStateFlow @@ -47,7 +46,6 @@ class ShadeInteractorEmptyImpl @Inject constructor() : ShadeInteractor { override val isUserInteracting: StateFlow<Boolean> = inactiveFlowBoolean override val isShadeTouchable: Flow<Boolean> = inactiveFlowBoolean override val isExpandToQsEnabled: Flow<Boolean> = inactiveFlowBoolean - override val shadeMode: StateFlow<ShadeMode> = MutableStateFlow(ShadeMode.Single) override val isShadeLayoutWide: StateFlow<Boolean> = 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 b5e171043741..9d81be2091c2 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 @@ -42,7 +42,7 @@ import kotlinx.coroutines.flow.map import kotlinx.coroutines.flow.onEach import kotlinx.coroutines.flow.stateIn -/** The non-empty SceneInteractor implementation. */ +/** The non-empty [ShadeInteractor] implementation. */ @SysUISingleton class ShadeInteractorImpl @Inject @@ -100,30 +100,25 @@ constructor( override val isShadeTouchable: Flow<Boolean> = combine( - powerInteractor.isAsleep - .onEach { Log.d(TAG, "isShadeTouchable: upstream isAsleep=$it") }, + powerInteractor.isAsleep.onEach { + Log.d(TAG, "isShadeTouchable: upstream isAsleep=$it") + }, keyguardTransitionInteractor .isInTransition(Edge.create(to = KeyguardState.AOD)) - .onEach { - Log.d( - TAG, - "isShadeTouchable: upstream isTransitioningToAod=$it", - ) - }, + .onEach { Log.d(TAG, "isShadeTouchable: upstream isTransitioningToAod=$it") }, keyguardRepository.dozeTransitionModel .map { it.to == DozeStateModel.DOZE_PULSING } - .onEach { - Log.d(TAG, "isShadeTouchable: upstream isPulsing=$it") - }, + .onEach { Log.d(TAG, "isShadeTouchable: upstream isPulsing=$it") }, ) { isAsleep, isTransitioningToAod, isPulsing -> - val downstream = when { - // If the device is transitioning to AOD, only accept touches if - // still animating. - isTransitioningToAod -> dozeParams.shouldControlScreenOff() - // If the device is asleep, only accept touches if there's a pulse - isAsleep -> isPulsing - else -> true - } + val downstream = + when { + // If the device is transitioning to AOD, only accept touches if + // still animating. + isTransitioningToAod -> dozeParams.shouldControlScreenOff() + // If the device is asleep, only accept touches if there's a pulse + isAsleep -> isPulsing + else -> true + } Log.d(TAG, "isShadeTouchable emitting $downstream, values:") Log.d(TAG, " isAsleep=$isAsleep") Log.d(TAG, " isTransitioningToAod=$isTransitioningToAod") diff --git a/packages/SystemUI/src/com/android/systemui/shade/ui/viewmodel/ShadeHeaderViewModel.kt b/packages/SystemUI/src/com/android/systemui/shade/ui/viewmodel/ShadeHeaderViewModel.kt index 51fcf7da3c13..8c38d2e7550c 100644 --- a/packages/SystemUI/src/com/android/systemui/shade/ui/viewmodel/ShadeHeaderViewModel.kt +++ b/packages/SystemUI/src/com/android/systemui/shade/ui/viewmodel/ShadeHeaderViewModel.kt @@ -41,7 +41,7 @@ import com.android.systemui.shade.ShadeDisplayAware import com.android.systemui.shade.domain.interactor.PrivacyChipInteractor import com.android.systemui.shade.domain.interactor.ShadeHeaderClockInteractor import com.android.systemui.shade.domain.interactor.ShadeInteractor -import com.android.systemui.shade.shared.model.ShadeMode +import com.android.systemui.shade.domain.interactor.ShadeModeInteractor import com.android.systemui.statusbar.notification.icon.ui.viewbinder.NotificationIconContainerStatusBarViewBinder import com.android.systemui.statusbar.phone.StatusBarLocation import com.android.systemui.statusbar.phone.ui.StatusBarIconController @@ -69,6 +69,7 @@ constructor( private val activityStarter: ActivityStarter, private val sceneInteractor: SceneInteractor, private val shadeInteractor: ShadeInteractor, + private val shadeModeInteractor: ShadeModeInteractor, private val mobileIconsInteractor: MobileIconsInteractor, val mobileIconsViewModel: MobileIconsViewModel, private val privacyChipInteractor: PrivacyChipInteractor, @@ -206,7 +207,7 @@ constructor( /** Notifies that the system icons container was clicked. */ fun onNotificationIconChipClicked() { - if (shadeInteractor.shadeMode.value !is ShadeMode.Dual) { + if (!shadeModeInteractor.isDualShade) { return } val loggingReason = "ShadeHeaderViewModel.onNotificationIconChipClicked" @@ -224,7 +225,7 @@ constructor( /** Notifies that the system icons container was clicked. */ fun onSystemIconChipClicked() { val loggingReason = "ShadeHeaderViewModel.onSystemIconChipClicked" - if (shadeInteractor.shadeMode.value is ShadeMode.Dual) { + if (shadeModeInteractor.isDualShade) { val currentOverlays = sceneInteractor.currentOverlays.value if (Overlays.QuickSettingsShade in currentOverlays) { shadeInteractor.collapseQuickSettingsShade( diff --git a/packages/SystemUI/src/com/android/systemui/shade/ui/viewmodel/ShadeSceneContentViewModel.kt b/packages/SystemUI/src/com/android/systemui/shade/ui/viewmodel/ShadeSceneContentViewModel.kt index 7fd0e4e9d468..35031e39520c 100644 --- a/packages/SystemUI/src/com/android/systemui/shade/ui/viewmodel/ShadeSceneContentViewModel.kt +++ b/packages/SystemUI/src/com/android/systemui/shade/ui/viewmodel/ShadeSceneContentViewModel.kt @@ -26,7 +26,7 @@ import com.android.systemui.qs.ui.adapter.QSSceneAdapter import com.android.systemui.scene.domain.interactor.SceneInteractor import com.android.systemui.scene.shared.model.Scenes import com.android.systemui.settings.brightness.ui.viewModel.BrightnessMirrorViewModel -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 com.android.systemui.statusbar.disableflags.domain.interactor.DisableFlagsInteractor import com.android.systemui.unfold.domain.interactor.UnfoldTransitionInteractor @@ -56,7 +56,7 @@ constructor( val shadeHeaderViewModelFactory: ShadeHeaderViewModel.Factory, val brightnessMirrorViewModelFactory: BrightnessMirrorViewModel.Factory, val mediaCarouselInteractor: MediaCarouselInteractor, - shadeInteractor: ShadeInteractor, + shadeModeInteractor: ShadeModeInteractor, private val disableFlagsInteractor: DisableFlagsInteractor, private val footerActionsViewModelFactory: FooterActionsViewModel.Factory, private val footerActionsController: FooterActionsController, @@ -65,7 +65,7 @@ constructor( private val sceneInteractor: SceneInteractor, ) : ExclusiveActivatable() { - val shadeMode: StateFlow<ShadeMode> = shadeInteractor.shadeMode + val shadeMode: StateFlow<ShadeMode> = shadeModeInteractor.shadeMode private val _isEmptySpaceClickable = MutableStateFlow(!deviceEntryInteractor.isDeviceEntered.value) diff --git a/packages/SystemUI/src/com/android/systemui/shade/ui/viewmodel/ShadeUserActionsViewModel.kt b/packages/SystemUI/src/com/android/systemui/shade/ui/viewmodel/ShadeUserActionsViewModel.kt index 7d6b1a3126dc..d0e0de9b8b96 100644 --- a/packages/SystemUI/src/com/android/systemui/shade/ui/viewmodel/ShadeUserActionsViewModel.kt +++ b/packages/SystemUI/src/com/android/systemui/shade/ui/viewmodel/ShadeUserActionsViewModel.kt @@ -25,7 +25,7 @@ import com.android.systemui.scene.shared.model.SceneFamilies import com.android.systemui.scene.shared.model.Scenes import com.android.systemui.scene.shared.model.TransitionKeys.ToSplitShade import com.android.systemui.scene.ui.viewmodel.UserActionsViewModel -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.assisted.AssistedFactory import dagger.assisted.AssistedInject @@ -42,13 +42,13 @@ class ShadeUserActionsViewModel @AssistedInject constructor( private val qsSceneAdapter: QSSceneAdapter, - private val shadeInteractor: ShadeInteractor, + private val shadeModeInteractor: ShadeModeInteractor, private val sceneBackInteractor: SceneBackInteractor, ) : UserActionsViewModel() { override suspend fun hydrateActions(setActions: (Map<UserAction, UserActionResult>) -> Unit) { combine( - shadeInteractor.shadeMode, + shadeModeInteractor.shadeMode, qsSceneAdapter.isCustomizerShowing, sceneBackInteractor.backScene .filter { it != Scenes.Shade } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShadeDepthController.kt b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShadeDepthController.kt index a2a840942f3c..e3b36df9aed7 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShadeDepthController.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShadeDepthController.kt @@ -40,6 +40,7 @@ import com.android.systemui.animation.ShadeInterpolation import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.qualifiers.Application import com.android.systemui.dump.DumpManager +import com.android.systemui.keyguard.domain.interactor.KeyguardInteractor import com.android.systemui.plugins.statusbar.StatusBarStateController import com.android.systemui.shade.ShadeExpansionChangeEvent import com.android.systemui.shade.ShadeExpansionListener @@ -74,6 +75,7 @@ constructor( private val blurUtils: BlurUtils, private val biometricUnlockController: BiometricUnlockController, private val keyguardStateController: KeyguardStateController, + private val keyguardInteractor: KeyguardInteractor, private val choreographer: Choreographer, private val wallpaperController: WallpaperController, private val notificationShadeWindowController: NotificationShadeWindowController, @@ -281,6 +283,7 @@ constructor( appZoomOutOptional.ifPresent { appZoomOut -> appZoomOut.setProgress(zoomOutFromShadeRadius) } + keyguardInteractor.setZoomOut(zoomOutFromShadeRadius) } listeners.forEach { it.onWallpaperZoomOutChanged(zoomOutFromShadeRadius) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/chips/ui/viewmodel/OngoingActivityChipsViewModel.kt b/packages/SystemUI/src/com/android/systemui/statusbar/chips/ui/viewmodel/OngoingActivityChipsViewModel.kt index 1451154d25ab..4becc8ccac31 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/chips/ui/viewmodel/OngoingActivityChipsViewModel.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/chips/ui/viewmodel/OngoingActivityChipsViewModel.kt @@ -20,7 +20,7 @@ import android.content.res.Configuration import com.android.systemui.biometrics.domain.interactor.DisplayStateInteractor 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.dagger.qualifiers.Background import com.android.systemui.log.LogBuffer import com.android.systemui.log.core.LogLevel import com.android.systemui.statusbar.chips.StatusBarChipLogTags.pad @@ -56,7 +56,7 @@ import kotlinx.coroutines.flow.stateIn class OngoingActivityChipsViewModel @Inject constructor( - @Application scope: CoroutineScope, + @Background scope: CoroutineScope, screenRecordChipViewModel: ScreenRecordChipViewModel, shareToAppChipViewModel: ShareToAppChipViewModel, castToOtherDeviceChipViewModel: CastToOtherDeviceChipViewModel, diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationEntry.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationEntry.java index 5cc79df9130a..09cc3f23032e 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationEntry.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationEntry.java @@ -812,11 +812,6 @@ public final class NotificationEntry extends ListEntry { return !mSbn.isOngoing() || !isLocked; } - public boolean canViewBeDismissed() { - if (row == null) return true; - return row.canViewBeDismissed(); - } - @VisibleForTesting boolean isExemptFromDndVisualSuppression() { if (isNotificationBlockedByPolicy(mSbn.getNotification())) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/promoted/ui/viewmodel/PromotedNotificationViewModel.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/promoted/ui/viewmodel/PromotedNotificationViewModel.kt deleted file mode 100644 index 56057fb00e45..000000000000 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/promoted/ui/viewmodel/PromotedNotificationViewModel.kt +++ /dev/null @@ -1,58 +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.statusbar.notification.promoted.ui.viewmodel - -import android.graphics.drawable.Icon -import com.android.internal.widget.NotificationProgressModel -import com.android.systemui.statusbar.notification.promoted.shared.model.PromotedNotificationContentModel -import com.android.systemui.statusbar.notification.promoted.shared.model.PromotedNotificationContentModel.Style -import com.android.systemui.statusbar.notification.promoted.shared.model.PromotedNotificationContentModel.When -import kotlinx.coroutines.flow.Flow -import kotlinx.coroutines.flow.map - -class PromotedNotificationViewModel( - identity: PromotedNotificationContentModel.Identity, - content: Flow<PromotedNotificationContentModel>, -) { - // for all styles: - - val key: String = identity.key - val style: Style = identity.style - - val skeletonSmallIcon: Flow<Icon?> = content.map { it.skeletonSmallIcon } - val appName: Flow<CharSequence?> = content.map { it.appName } - val subText: Flow<CharSequence?> = content.map { it.subText } - - private val time: Flow<When?> = content.map { it.time } - val whenTime: Flow<Long?> = time.map { it?.time } - val whenMode: Flow<When.Mode?> = time.map { it?.mode } - - val lastAudiblyAlertedMs: Flow<Long> = content.map { it.lastAudiblyAlertedMs } - val profileBadgeResId: Flow<Int?> = content.map { it.profileBadgeResId } - val title: Flow<CharSequence?> = content.map { it.title } - val text: Flow<CharSequence?> = content.map { it.text } - val skeletonLargeIcon: Flow<Icon?> = content.map { it.skeletonLargeIcon } - - // for CallStyle: - val personIcon: Flow<Icon?> = content.map { it.personIcon } - val personName: Flow<CharSequence?> = content.map { it.personName } - val verificationIcon: Flow<Icon?> = content.map { it.verificationIcon } - val verificationText: Flow<CharSequence?> = content.map { it.verificationText } - - // for ProgressStyle: - val progress: Flow<NotificationProgressModel?> = content.map { it.newProgress } -} diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java index aa7665a5b630..15f316800000 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java @@ -71,7 +71,6 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.dynamicanimation.animation.FloatPropertyCompat; import androidx.dynamicanimation.animation.SpringAnimation; -import androidx.dynamicanimation.animation.SpringForce; import com.android.app.animation.Interpolators; import com.android.internal.annotations.VisibleForTesting; @@ -361,39 +360,14 @@ public class ExpandableNotificationRow extends ActivatableNotificationView } }; - private final SpringAnimation mMagneticAnimator = new SpringAnimation( - this, FloatPropertyCompat.createFloatPropertyCompat(TRANSLATE_CONTENT)); - - private final MagneticRowListener mMagneticRowListener = new MagneticRowListener() { - - @Override - public void setMagneticTranslation(float translation) { - if (mMagneticAnimator.isRunning()) { - mMagneticAnimator.animateToFinalPosition(translation); - } else { - setTranslation(translation); - } - } - - @Override - public void triggerMagneticForce(float endTranslation, @NonNull SpringForce springForce, - float startVelocity) { - cancelMagneticAnimations(); - mMagneticAnimator.setSpring(springForce); - mMagneticAnimator.setStartVelocity(startVelocity); - mMagneticAnimator.animateToFinalPosition(endTranslation); - } - - @Override - public void cancelMagneticAnimations() { - cancelSnapBackAnimation(); - cancelTranslateAnimation(); - mMagneticAnimator.cancel(); - } - }; + @Override + protected void cancelTranslationAnimations() { + cancelSnapBackAnimation(); + cancelTranslateAnimation(); + } private void cancelSnapBackAnimation() { - PhysicsAnimator<ExpandableNotificationRow> animator = + PhysicsAnimator<ExpandableView> animator = PhysicsAnimator.getInstanceIfExists(this /* target */); if (animator != null) { animator.cancel(); @@ -2044,6 +2018,8 @@ public class ExpandableNotificationRow extends ActivatableNotificationView new NotificationInlineImageCache()); float radius = getResources().getDimension(R.dimen.notification_corner_radius_small); mSmallRoundness = radius / getMaxRadius(); + mMagneticAnimator = new SpringAnimation( + this, FloatPropertyCompat.createFloatPropertyCompat(TRANSLATE_CONTENT)); initDimens(); } @@ -3300,6 +3276,19 @@ public class ExpandableNotificationRow extends ActivatableNotificationView } /** + * For the case of an {@link ExpandableNotificationRow}, the dismissibility of the row considers + * the exposure of guts, the state of the notification entry, and if the view itself is allowed + * to be dismissed. + */ + @Override + public boolean canExpandableViewBeDismissed() { + if (areGutsExposed() || !mEntry.hasFinishedInitialization()) { + return false; + } + return canViewBeDismissed(); + } + + /** * @return Whether this view is allowed to be dismissed. Only valid for visible notifications as * otherwise some state might not be updated. */ @@ -4067,6 +4056,11 @@ public class ExpandableNotificationRow extends ActivatableNotificationView mLayouts = new NotificationContentView[]{mPrivateLayout, mPublicLayout}; } + @VisibleForTesting + public void setMagneticRowListener(MagneticRowListener listener) { + mMagneticRowListener = listener; + } + /** * Equivalent to View.OnLongClickListener with coordinates */ @@ -4317,8 +4311,4 @@ public class ExpandableNotificationRow extends ActivatableNotificationView } mLogger.logRemoveTransientRow(row.getEntry(), getEntry()); } - - public MagneticRowListener getMagneticRowListener() { - return mMagneticRowListener; - } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableView.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableView.java index f83a1d9b7833..76ba7f9ea901 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableView.java @@ -33,6 +33,9 @@ import android.widget.FrameLayout; import androidx.annotation.NonNull; import androidx.annotation.Nullable; +import androidx.dynamicanimation.animation.DynamicAnimation; +import androidx.dynamicanimation.animation.SpringAnimation; +import androidx.dynamicanimation.animation.SpringForce; import com.android.app.animation.Interpolators; import com.android.systemui.Dumpable; @@ -42,6 +45,7 @@ import com.android.systemui.statusbar.notification.Roundable; import com.android.systemui.statusbar.notification.RoundableState; import com.android.systemui.statusbar.notification.headsup.PinnedStatus; import com.android.systemui.statusbar.notification.stack.ExpandableViewState; +import com.android.systemui.statusbar.notification.stack.MagneticRowListener; import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout; import com.android.systemui.util.Compile; import com.android.systemui.util.DumpUtilsKt; @@ -85,6 +89,55 @@ public abstract class ExpandableView extends FrameLayout implements Dumpable, Ro protected boolean mLastInSection; protected boolean mFirstInSection; + protected SpringAnimation mMagneticAnimator = new SpringAnimation( + this /* object */, DynamicAnimation.TRANSLATION_X); + + protected MagneticRowListener mMagneticRowListener = new MagneticRowListener() { + + @Override + public void setMagneticTranslation(float translation) { + if (mMagneticAnimator.isRunning()) { + mMagneticAnimator.animateToFinalPosition(translation); + } else { + setTranslation(translation); + } + } + + @Override + public void triggerMagneticForce(float endTranslation, @NonNull SpringForce springForce, + float startVelocity) { + cancelMagneticAnimations(); + mMagneticAnimator.setSpring(springForce); + mMagneticAnimator.setStartVelocity(startVelocity); + mMagneticAnimator.animateToFinalPosition(endTranslation); + } + + @Override + public void cancelMagneticAnimations() { + cancelTranslationAnimations(); + mMagneticAnimator.cancel(); + } + + @Override + public boolean canRowBeDismissed() { + return canExpandableViewBeDismissed(); + } + }; + + /** + * @return true if the ExpandableView can be dismissed. False otherwise. + */ + public boolean canExpandableViewBeDismissed() { + return false; + } + + /** Cancel any trailing animations on the translation of the view */ + protected void cancelTranslationAnimations(){} + + public MagneticRowListener getMagneticRowListener() { + return mMagneticRowListener; + } + public ExpandableView(Context context, AttributeSet attrs) { super(context, attrs); mViewState = createExpandableViewState(); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/MagneticNotificationRowManagerImpl.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/MagneticNotificationRowManagerImpl.kt index 61aaf4998e87..3941700496f4 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/MagneticNotificationRowManagerImpl.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/MagneticNotificationRowManagerImpl.kt @@ -57,7 +57,7 @@ constructor( SpringForce().setStiffness(SNAP_BACK_STIFFNESS).setDampingRatio(SNAP_BACK_DAMPING_RATIO) // Multiplier applied to the translation of a row while swiped - private val swipedRowMultiplier = + val swipedRowMultiplier = MAGNETIC_TRANSLATION_MULTIPLIERS[MAGNETIC_TRANSLATION_MULTIPLIERS.size / 2] override fun setSwipeThresholdPx(thresholdPx: Float) { @@ -111,24 +111,22 @@ constructor( ): Boolean { if (!row.isSwipedTarget()) return false + val canTargetBeDismissed = + currentMagneticListeners.swipedListener()?.canRowBeDismissed() ?: false when (currentState) { State.IDLE -> { logger.logMagneticRowTranslationNotSet(currentState, row.entry) return false } State.TARGETS_SET -> { - pullTargets(translation) + pullTargets(translation, canTargetBeDismissed) currentState = State.PULLING } State.PULLING -> { - val targetTranslation = swipedRowMultiplier * translation - val crossedThreshold = abs(targetTranslation) >= magneticDetachThreshold - if (crossedThreshold) { - snapNeighborsBack() - currentMagneticListeners.swipedListener()?.let { detach(it, translation) } - currentState = State.DETACHED + if (canTargetBeDismissed) { + pullDismissibleRow(translation) } else { - pullTargets(translation) + pullTargets(translation, canSwipedBeDismissed = false) } } State.DETACHED -> { @@ -139,23 +137,49 @@ constructor( return true } - private fun pullTargets(translation: Float) { + private fun pullDismissibleRow(translation: Float) { + val targetTranslation = swipedRowMultiplier * translation + val crossedThreshold = abs(targetTranslation) >= magneticDetachThreshold + if (crossedThreshold) { + snapNeighborsBack() + currentMagneticListeners.swipedListener()?.let { detach(it, translation) } + currentState = State.DETACHED + } else { + pullTargets(translation, canSwipedBeDismissed = true) + } + } + + private fun pullTargets(translation: Float, canSwipedBeDismissed: Boolean) { var targetTranslation: Float currentMagneticListeners.forEachIndexed { i, listener -> - targetTranslation = MAGNETIC_TRANSLATION_MULTIPLIERS[i] * translation - listener?.setMagneticTranslation(targetTranslation) + listener?.let { + if (!canSwipedBeDismissed || !it.canRowBeDismissed()) { + // Use a reduced translation if the target swiped can't be dismissed or if the + // target itself can't be dismissed + targetTranslation = + MAGNETIC_TRANSLATION_MULTIPLIERS[i] * translation * MAGNETIC_REDUCTION + } else { + targetTranslation = MAGNETIC_TRANSLATION_MULTIPLIERS[i] * translation + } + it.setMagneticTranslation(targetTranslation) + } } - playPullHaptics(mappedTranslation = swipedRowMultiplier * translation) + playPullHaptics(mappedTranslation = swipedRowMultiplier * translation, canSwipedBeDismissed) } - private fun playPullHaptics(mappedTranslation: Float) { + private fun playPullHaptics(mappedTranslation: Float, canSwipedBeDismissed: Boolean) { val normalizedTranslation = abs(mappedTranslation) / magneticDetachThreshold - val vibrationScale = - (normalizedTranslation * MAX_VIBRATION_SCALE).pow(VIBRATION_PERCEPTION_EXPONENT) + val scaleFactor = + if (canSwipedBeDismissed) { + WEAK_VIBRATION_SCALE + } else { + STRONG_VIBRATION_SCALE + } + val vibrationScale = scaleFactor * normalizedTranslation msdlPlayer.playToken( MSDLToken.DRAG_INDICATOR_CONTINUOUS, InteractionProperties.DynamicVibrationScale( - scale = vibrationScale, + scale = vibrationScale.pow(VIBRATION_PERCEPTION_EXPONENT), vibrationAttributes = VIBRATION_ATTRIBUTES_PIPELINING, ), ) @@ -233,6 +257,8 @@ constructor( */ private val MAGNETIC_TRANSLATION_MULTIPLIERS = listOf(0.18f, 0.28f, 0.5f, 0.28f, 0.18f) + const val MAGNETIC_REDUCTION = 0.65f + /** Spring parameters for physics animators */ private const val DETACH_STIFFNESS = 800f private const val DETACH_DAMPING_RATIO = 0.95f @@ -244,7 +270,8 @@ constructor( .setUsage(VibrationAttributes.USAGE_TOUCH) .setFlags(VibrationAttributes.FLAG_PIPELINED_EFFECT) .build() - private const val MAX_VIBRATION_SCALE = 0.2f private const val VIBRATION_PERCEPTION_EXPONENT = 1 / 0.89f + private const val WEAK_VIBRATION_SCALE = 0.2f + private const val STRONG_VIBRATION_SCALE = 0.45f } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/MagneticRowListener.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/MagneticRowListener.kt index 8a1adfe95392..46036d4c1fad 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/MagneticRowListener.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/MagneticRowListener.kt @@ -41,4 +41,7 @@ interface MagneticRowListener { /** Cancel any animations related to the magnetic interactions of the row */ fun cancelMagneticAnimations() + + /** Can the row be dismissed. */ + fun canRowBeDismissed(): Boolean } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationChildrenContainer.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationChildrenContainer.java index ea397b61fe84..b548b5835e1e 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationChildrenContainer.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationChildrenContainer.java @@ -970,7 +970,9 @@ public class NotificationChildrenContainer extends ViewGroup if (mHeaderViewState != null) { mHeaderViewState.applyToView(mGroupHeader); } - if (notificationsRedesignTemplates()) { + // Only apply the special viewState for the header's children if we're not currently showing + // the minimized header. + if (notificationsRedesignTemplates() && !showingAsLowPriority()) { if (mTopLineViewState != null) { mTopLineViewState.applyToView(mGroupHeader.getTopLineView()); } @@ -1236,14 +1238,12 @@ public class NotificationChildrenContainer extends ViewGroup } } - private ViewGroup calculateDesiredHeader() { - ViewGroup desiredHeader; + private NotificationHeaderView calculateDesiredHeader() { if (showingAsLowPriority()) { - desiredHeader = mMinimizedGroupHeader; + return mMinimizedGroupHeader; } else { - desiredHeader = mGroupHeader; + return mGroupHeader; } - return desiredHeader; } private void startChildAlphaAnimations(boolean toVisible) { 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 ce1fc97cbffe..d6b34b068cc5 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 @@ -6609,10 +6609,7 @@ public class NotificationStackScrollLayout static boolean canChildBeDismissed(View v) { if (v instanceof ExpandableNotificationRow row) { - if (row.areGutsExposed() || !row.getEntry().hasFinishedInitialization()) { - return false; - } - return row.canViewBeDismissed(); + return row.canExpandableViewBeDismissed(); } return false; } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationTargetsHelper.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationTargetsHelper.kt index 74e8b8ef29c2..b69b936ea9f0 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationTargetsHelper.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationTargetsHelper.kt @@ -3,7 +3,9 @@ package com.android.systemui.statusbar.notification.stack import androidx.core.view.children import androidx.core.view.isVisible import com.android.systemui.dagger.SysUISingleton +import com.android.systemui.statusbar.NotificationShelf import com.android.systemui.statusbar.notification.Roundable +import com.android.systemui.statusbar.notification.footer.ui.view.FooterView import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow import com.android.systemui.statusbar.notification.row.ExpandableView import javax.inject.Inject @@ -129,6 +131,10 @@ class NotificationTargetsHelper @Inject constructor() { magneticTargets[leftIndex] = leftElement.magneticRowListener leftIndex-- } else { + if (leftElement.isValidMagneticBoundary()) { + // Add the boundary and then stop the iterating + magneticTargets[leftIndex] = leftElement?.magneticRowListener + } canMoveLeft = false } } @@ -138,12 +144,24 @@ class NotificationTargetsHelper @Inject constructor() { magneticTargets[rightIndex] = rightElement.magneticRowListener rightIndex++ } else { + if (rightElement.isValidMagneticBoundary()) { + // Add the boundary and then stop the iterating + magneticTargets[rightIndex] = rightElement?.magneticRowListener + } canMoveRight = false } } } return magneticTargets } + + private fun ExpandableView?.isValidMagneticBoundary(): Boolean = + when (this) { + is FooterView, + is NotificationShelf, + is SectionHeaderView -> true + else -> false + } } /** diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/domain/interactor/NotificationStackAppearanceInteractor.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/domain/interactor/NotificationStackAppearanceInteractor.kt index 1bd44406507d..96af83336441 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/domain/interactor/NotificationStackAppearanceInteractor.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/domain/interactor/NotificationStackAppearanceInteractor.kt @@ -19,7 +19,7 @@ package com.android.systemui.statusbar.notification.stack.domain.interactor import com.android.systemui.dagger.SysUISingleton import com.android.systemui.scene.domain.interactor.SceneInteractor -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 com.android.systemui.statusbar.notification.stack.data.repository.NotificationPlaceholderRepository import com.android.systemui.statusbar.notification.stack.data.repository.NotificationViewHeightRepository @@ -45,7 +45,7 @@ constructor( private val viewHeightRepository: NotificationViewHeightRepository, private val placeholderRepository: NotificationPlaceholderRepository, sceneInteractor: SceneInteractor, - shadeInteractor: ShadeInteractor, + shadeModeInteractor: ShadeModeInteractor, ) { /** The bounds of the notification stack in the current scene. */ val notificationShadeScrimBounds: StateFlow<ShadeScrimBounds?> = @@ -60,7 +60,7 @@ constructor( /** The rounding of the notification stack. */ val shadeScrimRounding: Flow<ShadeScrimRounding> = - combine(shadeInteractor.shadeMode, isExpandingFromHeadsUp) { + combine(shadeModeInteractor.shadeMode, isExpandingFromHeadsUp) { shadeMode, isExpandingFromHeadsUp -> ShadeScrimRounding( diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/view/NotificationStatsLoggerImpl.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/view/NotificationStatsLoggerImpl.kt index c8c798d00a06..5689230f6bed 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/view/NotificationStatsLoggerImpl.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/view/NotificationStatsLoggerImpl.kt @@ -19,6 +19,7 @@ package com.android.systemui.statusbar.notification.stack.ui.view import android.service.notification.NotificationListenerService import androidx.annotation.VisibleForTesting import com.android.app.tracing.coroutines.TrackTracer +import com.android.app.tracing.coroutines.launchTraced as launch import com.android.internal.statusbar.IStatusBarService import com.android.internal.statusbar.NotificationVisibility import com.android.systemui.dagger.SysUISingleton @@ -33,8 +34,9 @@ import java.util.concurrent.ConcurrentHashMap import javax.inject.Inject import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.CoroutineScope -import kotlinx.coroutines.Job -import com.android.app.tracing.coroutines.launchTraced as launch +import kotlinx.coroutines.channels.BufferOverflow +import kotlinx.coroutines.channels.Channel +import kotlinx.coroutines.channels.consumeEach import kotlinx.coroutines.withContext @VisibleForTesting const val UNKNOWN_RANK = -1 @@ -49,32 +51,56 @@ constructor( private val notificationPanelLogger: NotificationPanelLogger, private val statusBarService: IStatusBarService, ) : NotificationStatsLogger { - private val lastLoggedVisibilities = mutableMapOf<String, VisibilityState>() - private var logVisibilitiesJob: Job? = null - private val expansionStates: MutableMap<String, ExpansionState> = ConcurrentHashMap<String, ExpansionState>() @VisibleForTesting val lastReportedExpansionValues: MutableMap<String, Boolean> = ConcurrentHashMap<String, Boolean>() + private val visibilityLogger = + Channel<VisibilityAction>(capacity = 2, onBufferOverflow = BufferOverflow.DROP_OLDEST) + + init { + applicationScope.launch { consumeVisibilityActions() } + } + + private suspend fun consumeVisibilityActions() { + val lastLoggedVisibilities = mutableMapOf<String, VisibilityState>() + + visibilityLogger.consumeEach { action -> + val newVisibilities = + when (action) { + is VisibilityAction.Change -> action.visibilities + is VisibilityAction.Clear -> emptyMap() + } + + val newlyVisible = newVisibilities - lastLoggedVisibilities.keys + val noLongerVisible = lastLoggedVisibilities - newVisibilities.keys + + maybeLogVisibilityChanges(newlyVisible, noLongerVisible, action.activeCount) + updateExpansionStates(newlyVisible, noLongerVisible) + TrackTracer.instantForGroup("Notifications", "Active", action.activeCount) + TrackTracer.instantForGroup("Notifications", "Visible", newVisibilities.size) + + lastLoggedVisibilities.clear() + lastLoggedVisibilities.putAll(newVisibilities) + } + } + override fun onNotificationLocationsChanged( locationsProvider: Callable<Map<String, Int>>, notificationRanks: Map<String, Int>, ) { - if (logVisibilitiesJob?.isActive == true) { - return - } - - logVisibilitiesJob = - startLogVisibilitiesJob( - newVisibilities = + visibilityLogger.trySend( + VisibilityAction.Change( + visibilities = combine( visibilities = locationsProvider.call(), - rankingsMap = notificationRanks + rankingsMap = notificationRanks, ), - activeNotifCount = notificationRanks.size, + activeCount = notificationRanks.size, ) + ) } override fun onNotificationExpansionChanged( @@ -125,7 +151,7 @@ constructor( /* expanded = */ expansionState.isExpanded, /* notificationLocation = */ expansionState.location .toNotificationLocation() - .ordinal + .ordinal, ) } } @@ -138,7 +164,7 @@ constructor( withContext(bgDispatcher) { notificationPanelLogger.logPanelShown( isOnLockScreen, - activeNotifications.toNotificationProto() + activeNotifications.toNotificationProto(), ) } } @@ -147,11 +173,7 @@ constructor( override fun onLockscreenOrShadeNotInteractive( activeNotifications: List<ActiveNotificationModel> ) { - logVisibilitiesJob = - startLogVisibilitiesJob( - newVisibilities = emptyMap(), - activeNotifCount = activeNotifications.size - ) + visibilityLogger.trySend(VisibilityAction.Clear(activeCount = activeNotifications.size)) } override fun onNotificationRemoved(key: String) { @@ -167,29 +189,12 @@ constructor( private fun combine( visibilities: Map<String, Int>, - rankingsMap: Map<String, Int> + rankingsMap: Map<String, Int>, ): Map<String, VisibilityState> = visibilities.mapValues { entry -> VisibilityState(entry.key, entry.value, rankingsMap[entry.key] ?: UNKNOWN_RANK) } - private fun startLogVisibilitiesJob( - newVisibilities: Map<String, VisibilityState>, - activeNotifCount: Int, - ) = - applicationScope.launch { - val newlyVisible = newVisibilities - lastLoggedVisibilities.keys - val noLongerVisible = lastLoggedVisibilities - newVisibilities.keys - - maybeLogVisibilityChanges(newlyVisible, noLongerVisible, activeNotifCount) - updateExpansionStates(newlyVisible, noLongerVisible) - TrackTracer.instantForGroup("Notifications", "Active", activeNotifCount) - TrackTracer.instantForGroup("Notifications", "Visible", newVisibilities.size) - - lastLoggedVisibilities.clear() - lastLoggedVisibilities.putAll(newVisibilities) - } - private suspend fun maybeLogVisibilityChanges( newlyVisible: Map<String, VisibilityState>, noLongerVisible: Map<String, VisibilityState>, @@ -205,7 +210,7 @@ constructor( val noLongerVisibleAr = noLongerVisible.mapToNotificationVisibilitiesAr( visible = false, - count = activeNotifCount + count = activeNotifCount, ) withContext(bgDispatcher) { @@ -218,7 +223,7 @@ constructor( private fun updateExpansionStates( newlyVisible: Map<String, VisibilityState>, - noLongerVisible: Map<String, VisibilityState> + noLongerVisible: Map<String, VisibilityState>, ) { expansionStates.forEach { (key, expansionState) -> if (newlyVisible.contains(key)) { @@ -241,11 +246,16 @@ constructor( } } - private data class VisibilityState( - val key: String, - val location: Int, - val rank: Int, - ) + private sealed class VisibilityAction(open val activeCount: Int) { + data class Change( + val visibilities: Map<String, VisibilityState>, + override val activeCount: Int, + ) : VisibilityAction(activeCount) + + data class Clear(override val activeCount: Int) : VisibilityAction(activeCount) + } + + private data class VisibilityState(val key: String, val location: Int, val rank: Int) private data class ExpansionState( val key: String, @@ -278,7 +288,7 @@ constructor( /* rank = */ state.rank, /* count = */ count, /* visible = */ visible, - /* location = */ state.location.toNotificationLocation() + /* location = */ state.location.toNotificationLocation(), ) } .toTypedArray() diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/NotificationLockscreenScrimViewModel.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/NotificationLockscreenScrimViewModel.kt index d68f769dffdf..4a28b545fae9 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/NotificationLockscreenScrimViewModel.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/NotificationLockscreenScrimViewModel.kt @@ -29,7 +29,7 @@ import com.android.systemui.lifecycle.ExclusiveActivatable import com.android.systemui.lifecycle.Hydrator import com.android.systemui.notifications.ui.composable.Notifications import com.android.systemui.res.R -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 com.android.systemui.shade.ui.composable.Shade import com.android.systemui.statusbar.notification.stack.domain.interactor.NotificationStackAppearanceInteractor @@ -46,7 +46,7 @@ class NotificationLockscreenScrimViewModel @AssistedInject constructor( dumpManager: DumpManager, - shadeInteractor: ShadeInteractor, + shadeModeInteractor: ShadeModeInteractor, private val stackAppearanceInteractor: NotificationStackAppearanceInteractor, ) : ActivatableFlowDumper by ActivatableFlowDumperImpl(dumpManager, "NotificationScrollViewModel"), @@ -54,7 +54,7 @@ constructor( private val hydrator = Hydrator("NotificationLockscreenScrimViewModel.hydrator") - val shadeMode: StateFlow<ShadeMode> = shadeInteractor.shadeMode + val shadeMode: StateFlow<ShadeMode> = shadeModeInteractor.shadeMode /** The [ElementKey] to use for the scrim. */ val element: ElementViewModel by diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/NotificationScrollViewModel.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/NotificationScrollViewModel.kt index 20149826ceb9..7f016a1cbc2e 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/NotificationScrollViewModel.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/NotificationScrollViewModel.kt @@ -31,6 +31,7 @@ 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.shade.domain.interactor.ShadeInteractor +import com.android.systemui.shade.domain.interactor.ShadeModeInteractor import com.android.systemui.shade.shared.model.ShadeMode import com.android.systemui.statusbar.domain.interactor.RemoteInputInteractor import com.android.systemui.statusbar.notification.stack.domain.interactor.NotificationStackAppearanceInteractor @@ -63,6 +64,7 @@ constructor( dumpManager: DumpManager, private val stackAppearanceInteractor: NotificationStackAppearanceInteractor, shadeInteractor: ShadeInteractor, + shadeModeInteractor: ShadeModeInteractor, private val remoteInputInteractor: RemoteInputInteractor, private val sceneInteractor: SceneInteractor, // TODO(b/336364825) Remove Lazy when SceneContainerFlag is released - @@ -151,10 +153,10 @@ constructor( val expandFraction: Flow<Float> = combine( shadeInteractor.shadeExpansion, - shadeInteractor.shadeMode, shadeInteractor.qsExpansion, + shadeModeInteractor.shadeMode, sceneInteractor.transitionState, - ) { shadeExpansion, _, qsExpansion, transitionState -> + ) { shadeExpansion, qsExpansion, _, transitionState -> when (transitionState) { is Idle -> if ( @@ -210,7 +212,8 @@ constructor( sceneInteractor.isSceneInFamily(scene, this) private val qsAllowsClipping: Flow<Boolean> = - combine(shadeInteractor.shadeMode, shadeInteractor.qsExpansion) { shadeMode, qsExpansion -> + combine(shadeModeInteractor.shadeMode, shadeInteractor.qsExpansion) { shadeMode, qsExpansion + -> when (shadeMode) { is ShadeMode.Dual -> false is ShadeMode.Split -> true diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/NotificationsPlaceholderViewModel.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/NotificationsPlaceholderViewModel.kt index 8e12e081e861..000b3f643e9a 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/NotificationsPlaceholderViewModel.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/NotificationsPlaceholderViewModel.kt @@ -30,6 +30,7 @@ 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.shade.domain.interactor.ShadeInteractor +import com.android.systemui.shade.domain.interactor.ShadeModeInteractor import com.android.systemui.shade.shared.model.ShadeMode import com.android.systemui.statusbar.domain.interactor.RemoteInputInteractor import com.android.systemui.statusbar.notification.domain.interactor.HeadsUpNotificationInteractor @@ -58,6 +59,7 @@ constructor( private val interactor: NotificationStackAppearanceInteractor, private val sceneInteractor: SceneInteractor, private val shadeInteractor: ShadeInteractor, + shadeModeInteractor: ShadeModeInteractor, private val headsUpNotificationInteractor: HeadsUpNotificationInteractor, remoteInputInteractor: RemoteInputInteractor, featureFlags: FeatureFlagsClassic, @@ -75,16 +77,16 @@ constructor( val notificationsShadeContentKey: ContentKey by hydrator.hydratedStateOf( traceName = "notificationsShadeContentKey", - initialValue = getNotificationsShadeContentKey(shadeInteractor.shadeMode.value), - source = shadeInteractor.shadeMode.map { getNotificationsShadeContentKey(it) }, + initialValue = getNotificationsShadeContentKey(shadeModeInteractor.shadeMode.value), + source = shadeModeInteractor.shadeMode.map { getNotificationsShadeContentKey(it) }, ) /** The content key to use for the quick settings shade. */ val quickSettingsShadeContentKey: ContentKey by hydrator.hydratedStateOf( traceName = "quickSettingsShadeContentKey", - initialValue = getQuickSettingsShadeContentKey(shadeInteractor.shadeMode.value), - source = shadeInteractor.shadeMode.map { getQuickSettingsShadeContentKey(it) }, + initialValue = getQuickSettingsShadeContentKey(shadeModeInteractor.shadeMode.value), + source = shadeModeInteractor.shadeMode.map { getQuickSettingsShadeContentKey(it) }, ) /** DEBUG: whether the placeholder should be made slightly visible for positional debugging. */ 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 d6e4add4eee3..1abf8ab2cadc 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 @@ -76,6 +76,7 @@ import com.android.systemui.scene.shared.model.Scenes import com.android.systemui.shade.LargeScreenHeaderHelper import com.android.systemui.shade.ShadeDisplayAware import com.android.systemui.shade.domain.interactor.ShadeInteractor +import com.android.systemui.shade.domain.interactor.ShadeModeInteractor import com.android.systemui.shade.shared.model.ShadeMode.Dual import com.android.systemui.shade.shared.model.ShadeMode.Single import com.android.systemui.shade.shared.model.ShadeMode.Split @@ -91,6 +92,7 @@ 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.currentCoroutineContext import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.SharingStarted @@ -111,6 +113,7 @@ import kotlinx.coroutines.flow.transformWhile import kotlinx.coroutines.isActive /** View-model for the shared notification container, used by both the shade and keyguard spaces */ +@OptIn(ExperimentalCoroutinesApi::class) @SysUISingleton class SharedNotificationContainerViewModel @Inject @@ -123,7 +126,8 @@ constructor( private val keyguardInteractor: KeyguardInteractor, private val keyguardTransitionInteractor: KeyguardTransitionInteractor, private val shadeInteractor: ShadeInteractor, - private val notificationStackAppearanceInteractor: NotificationStackAppearanceInteractor, + shadeModeInteractor: ShadeModeInteractor, + notificationStackAppearanceInteractor: NotificationStackAppearanceInteractor, private val alternateBouncerToGoneTransitionViewModel: AlternateBouncerToGoneTransitionViewModel, private val alternateBouncerToPrimaryBouncerTransitionViewModel: @@ -233,7 +237,7 @@ constructor( if (SceneContainerFlag.isEnabled) { combine( shadeInteractor.isShadeLayoutWide, - shadeInteractor.shadeMode, + shadeModeInteractor.shadeMode, configurationInteractor.onAnyConfigurationChange, ) { isShadeLayoutWide, shadeMode, _ -> with(context.resources) { @@ -477,7 +481,7 @@ constructor( */ private val alphaForShadeAndQsExpansion: Flow<Float> = if (SceneContainerFlag.isEnabled) { - shadeInteractor.shadeMode.flatMapLatest { shadeMode -> + shadeModeInteractor.shadeMode.flatMapLatest { shadeMode -> when (shadeMode) { Single -> combineTransform( @@ -539,7 +543,7 @@ constructor( private fun bouncerToGoneNotificationAlpha(viewState: ViewStateAccessor): Flow<Float> = merge( - primaryBouncerToGoneTransitionViewModel.notificationAlpha, + primaryBouncerToGoneTransitionViewModel.notificationAlpha(viewState), alternateBouncerToGoneTransitionViewModel.notificationAlpha(viewState), ) .sample(communalSceneInteractor.isCommunalVisible) { alpha, isCommunalVisible -> diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/shared/ui/binder/HomeStatusBarViewBinder.kt b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/shared/ui/binder/HomeStatusBarViewBinder.kt index bd6906066ac8..acce6426362d 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/shared/ui/binder/HomeStatusBarViewBinder.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/shared/ui/binder/HomeStatusBarViewBinder.kt @@ -67,7 +67,7 @@ interface HomeStatusBarViewBinder { viewModel: HomeStatusBarViewModel, systemEventChipAnimateIn: ((View) -> Unit)?, systemEventChipAnimateOut: ((View) -> Unit)?, - listener: StatusBarVisibilityChangeListener, + listener: StatusBarVisibilityChangeListener?, ) } @@ -83,8 +83,22 @@ constructor( viewModel: HomeStatusBarViewModel, systemEventChipAnimateIn: ((View) -> Unit)?, systemEventChipAnimateOut: ((View) -> Unit)?, - listener: StatusBarVisibilityChangeListener, + listener: StatusBarVisibilityChangeListener?, ) { + // Set some top-level views to gone before we get started + val primaryChipView: View = view.requireViewById(R.id.ongoing_activity_chip_primary) + val systemInfoView = view.requireViewById<View>(R.id.status_bar_end_side_content) + val clockView = view.requireViewById<View>(R.id.clock) + val notificationIconsArea = view.requireViewById<View>(R.id.notificationIcons) + + // CollapsedStatusBarFragment doesn't need this + if (StatusBarRootModernization.isEnabled) { + primaryChipView.isVisible = false + systemInfoView.isVisible = false + clockView.isVisible = false + notificationIconsArea.isVisible = false + } + view.repeatWhenAttached { repeatOnLifecycle(Lifecycle.State.CREATED) { val iconViewStore = @@ -95,15 +109,19 @@ constructor( } else { null } - launch { - viewModel.isTransitioningFromLockscreenToOccluded.collect { - listener.onStatusBarVisibilityMaybeChanged() + listener?.let { listener -> + launch { + viewModel.isTransitioningFromLockscreenToOccluded.collect { + listener.onStatusBarVisibilityMaybeChanged() + } } } - launch { - viewModel.transitionFromLockscreenToDreamStartedEvent.collect { - listener.onTransitionFromLockscreenToDreamStarted() + listener?.let { listener -> + launch { + viewModel.transitionFromLockscreenToDreamStartedEvent.collect { + listener.onTransitionFromLockscreenToDreamStarted() + } } } @@ -129,9 +147,7 @@ constructor( if (!StatusBarNotifChips.isEnabled && !StatusBarChipsModernization.isEnabled) { val primaryChipViewBinding = - OngoingActivityChipBinder.createBinding( - view.requireViewById(R.id.ongoing_activity_chip_primary) - ) + OngoingActivityChipBinder.createBinding(primaryChipView) launch { viewModel.primaryOngoingActivityChip.collect { primaryChipModel -> OngoingActivityChipBinder.bind( @@ -155,14 +171,14 @@ constructor( } else { when (primaryChipModel) { is OngoingActivityChipModel.Shown -> - listener.onOngoingActivityStatusChanged( + listener?.onOngoingActivityStatusChanged( hasPrimaryOngoingActivity = true, hasSecondaryOngoingActivity = false, shouldAnimate = true, ) is OngoingActivityChipModel.Hidden -> - listener.onOngoingActivityStatusChanged( + listener?.onOngoingActivityStatusChanged( hasPrimaryOngoingActivity = false, hasSecondaryOngoingActivity = false, shouldAnimate = primaryChipModel.shouldAnimate, @@ -177,9 +193,7 @@ constructor( // Create view bindings here so we don't keep re-fetching child views each time // the chip model changes. val primaryChipViewBinding = - OngoingActivityChipBinder.createBinding( - view.requireViewById(R.id.ongoing_activity_chip_primary) - ) + OngoingActivityChipBinder.createBinding(primaryChipView) val secondaryChipViewBinding = OngoingActivityChipBinder.createBinding( view.requireViewById(R.id.ongoing_activity_chip_secondary) @@ -205,7 +219,7 @@ constructor( chips.secondary.toVisibilityModel() ) } else { - listener.onOngoingActivityStatusChanged( + listener?.onOngoingActivityStatusChanged( hasPrimaryOngoingActivity = chips.primary is OngoingActivityChipModel.Shown, hasSecondaryOngoingActivity = @@ -231,15 +245,21 @@ constructor( } if (SceneContainerFlag.isEnabled) { - launch { - viewModel.isHomeStatusBarAllowedByScene.collect { - listener.onIsHomeStatusBarAllowedBySceneChanged(it) + listener?.let { listener -> + launch { + viewModel.isHomeStatusBarAllowedByScene.collect { + listener.onIsHomeStatusBarAllowedBySceneChanged(it) + } } } } if (StatusBarRootModernization.isEnabled) { + // TODO(b/393445203): figure out the best story for this stub view. This crashes + // if we move it up to the top of [bind] val operatorNameView = view.requireViewById<View>(R.id.operator_name_frame) + operatorNameView.isVisible = false + StatusBarOperatorNameViewBinder.bind( operatorNameView, viewModel.operatorNameViewModel, @@ -251,19 +271,14 @@ constructor( } } - val clockView = view.requireViewById<View>(R.id.clock) launch { viewModel.isClockVisible.collect { clockView.adjustVisibility(it) } } - val notificationIconsArea = view.requireViewById<View>(R.id.notificationIcons) launch { viewModel.isNotificationIconContainerVisible.collect { notificationIconsArea.adjustVisibility(it) } } - val systemInfoView = - view.requireViewById<View>(R.id.status_bar_end_side_content) - // TODO(b/364360986): Also handle operator name view. launch { viewModel.systemInfoCombinedVis.collect { (baseVis, animState) -> // Broadly speaking, the baseVis controls the view.visibility, and @@ -352,6 +367,9 @@ constructor( // See CollapsedStatusBarFragment#hide. private fun View.hide(state: Int = View.INVISIBLE, shouldAnimateChange: Boolean) { + if (visibility == View.INVISIBLE || visibility == View.GONE) { + return + } val v = this v.animate().cancel() if (!shouldAnimateChange) { @@ -370,6 +388,9 @@ constructor( // See CollapsedStatusBarFragment#show. private fun View.show(shouldAnimateChange: Boolean) { + if (visibility == View.VISIBLE) { + return + } val v = this v.animate().cancel() v.visibility = View.VISIBLE diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/shared/ui/composable/StatusBarRoot.kt b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/shared/ui/composable/StatusBarRoot.kt index 9c1171fd1ebc..9d72daf01831 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/shared/ui/composable/StatusBarRoot.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/shared/ui/composable/StatusBarRoot.kt @@ -25,16 +25,13 @@ import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue -import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.draw.alpha import androidx.compose.ui.platform.ComposeView import androidx.compose.ui.platform.ViewCompositionStrategy import androidx.compose.ui.viewinterop.AndroidView -import androidx.core.view.isVisible import androidx.lifecycle.compose.collectAsStateWithLifecycle -import com.android.app.tracing.coroutines.launchTraced as launch import com.android.compose.theme.PlatformTheme import com.android.keyguard.AlphaOptimizedLinearLayout import com.android.systemui.plugins.DarkIconDispatcher @@ -56,7 +53,6 @@ import com.android.systemui.statusbar.phone.ui.DarkIconManager import com.android.systemui.statusbar.phone.ui.StatusBarIconController import com.android.systemui.statusbar.pipeline.shared.ui.binder.HomeStatusBarIconBlockListBinder import com.android.systemui.statusbar.pipeline.shared.ui.binder.HomeStatusBarViewBinder -import com.android.systemui.statusbar.pipeline.shared.ui.binder.StatusBarVisibilityChangeListener import com.android.systemui.statusbar.pipeline.shared.ui.model.VisibilityModel import com.android.systemui.statusbar.pipeline.shared.ui.viewmodel.HomeStatusBarViewModel import com.android.systemui.statusbar.pipeline.shared.ui.viewmodel.HomeStatusBarViewModel.HomeStatusBarViewModelFactory @@ -124,25 +120,6 @@ fun StatusBarRoot( eventAnimationInteractor: SystemStatusEventAnimationInteractor, onViewCreated: (ViewGroup) -> Unit, ) { - // None of these methods are used when [StatusBarRootModernization] is on. - // This can be deleted once the fragment is gone - val nopVisibilityChangeListener = - object : StatusBarVisibilityChangeListener { - override fun onStatusBarVisibilityMaybeChanged() {} - - override fun onTransitionFromLockscreenToDreamStarted() {} - - override fun onOngoingActivityStatusChanged( - hasPrimaryOngoingActivity: Boolean, - hasSecondaryOngoingActivity: Boolean, - shouldAnimate: Boolean, - ) {} - - override fun onIsHomeStatusBarAllowedBySceneChanged( - isHomeStatusBarAllowedByScene: Boolean - ) {} - } - Box(Modifier.fillMaxSize()) { // TODO(b/364360986): remove this before rolling the flag forward if (StatusBarRootModernization.SHOW_DISAMBIGUATION) { @@ -150,9 +127,6 @@ fun StatusBarRoot( } Row(Modifier.fillMaxSize()) { - val scope = rememberCoroutineScope() - val visible = - statusBarViewModel.shouldHomeStatusBarBeVisible.collectAsStateWithLifecycle(false) AndroidView( factory = { context -> val inflater = LayoutInflater.from(context) @@ -267,32 +241,23 @@ fun StatusBarRoot( endSideContent.addView(composeView, 0) } - scope.launch { - notificationIconsBinder.bindWhileAttached( - notificationIconContainer, - context.displayId, - ) - } + notificationIconsBinder.bindWhileAttached( + notificationIconContainer, + context.displayId, + ) // This binder handles everything else - scope.launch { - statusBarViewBinder.bind( - context.displayId, - phoneStatusBarView, - statusBarViewModel, - eventAnimationInteractor::animateStatusBarContentForChipEnter, - eventAnimationInteractor::animateStatusBarContentForChipExit, - nopVisibilityChangeListener, - ) - } + statusBarViewBinder.bind( + context.displayId, + phoneStatusBarView, + statusBarViewModel, + eventAnimationInteractor::animateStatusBarContentForChipEnter, + eventAnimationInteractor::animateStatusBarContentForChipExit, + listener = null, + ) onViewCreated(phoneStatusBarView) phoneStatusBarView - }, - update = { view -> - // Show or hide the entire status bar. This is important so that we aren't - // visible when first inflated - view.isVisible = visible.value - }, + } ) } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/shared/ui/viewmodel/HomeStatusBarViewModel.kt b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/shared/ui/viewmodel/HomeStatusBarViewModel.kt index b116b47929d5..67366bb09f04 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/shared/ui/viewmodel/HomeStatusBarViewModel.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/shared/ui/viewmodel/HomeStatusBarViewModel.kt @@ -19,7 +19,7 @@ package com.android.systemui.statusbar.pipeline.shared.ui.viewmodel import android.annotation.ColorInt import android.graphics.Rect import android.view.View -import com.android.systemui.dagger.qualifiers.Application +import com.android.systemui.dagger.qualifiers.Background import com.android.systemui.keyguard.domain.interactor.KeyguardInteractor import com.android.systemui.keyguard.domain.interactor.KeyguardTransitionInteractor import com.android.systemui.keyguard.shared.model.Edge @@ -61,6 +61,7 @@ import com.android.systemui.statusbar.pipeline.shared.ui.model.VisibilityModel import dagger.assisted.Assisted import dagger.assisted.AssistedFactory import dagger.assisted.AssistedInject +import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.SharingStarted @@ -71,6 +72,7 @@ import kotlinx.coroutines.flow.distinctUntilChanged import kotlinx.coroutines.flow.emptyFlow import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.flowOf +import kotlinx.coroutines.flow.flowOn import kotlinx.coroutines.flow.map import kotlinx.coroutines.flow.stateIn @@ -85,9 +87,6 @@ import kotlinx.coroutines.flow.stateIn * so that it's all in one place and easily testable outside of the fragment. */ interface HomeStatusBarViewModel { - /** Should the entire status bar be hidden? */ - val shouldHomeStatusBarBeVisible: Flow<Boolean> - /** * True if the device is currently transitioning from lockscreen to occluded and false * otherwise. @@ -193,7 +192,8 @@ constructor( statusBarPopupChipsViewModel: StatusBarPopupChipsViewModel, animations: SystemStatusEventAnimationInteractor, statusBarContentInsetsViewModelStore: StatusBarContentInsetsViewModelStore, - @Application coroutineScope: CoroutineScope, + @Background bgScope: CoroutineScope, + @Background bgDispatcher: CoroutineDispatcher, ) : HomeStatusBarViewModel { val tableLogger = tableLoggerFactory.getOrCreate(tableLogBufferName(thisDisplayId), 200) @@ -207,13 +207,14 @@ constructor( columnName = COL_LOCK_TO_OCCLUDED, initialValue = false, ) - .stateIn(coroutineScope, SharingStarted.WhileSubscribed(), initialValue = false) + .stateIn(bgScope, SharingStarted.WhileSubscribed(), initialValue = false) override val transitionFromLockscreenToDreamStartedEvent: Flow<Unit> = keyguardTransitionInteractor .transition(Edge.create(from = LOCKSCREEN, to = DREAMING)) .filter { it.transitionState == TransitionState.STARTED } .map {} + .flowOn(bgDispatcher) override val mediaProjectionStopDialogDueToCallEndedState = shareToAppChipViewModel.stopDialogToShow @@ -242,7 +243,7 @@ constructor( columnName = COL_ALLOWED_BY_SCENE, initialValue = false, ) - .stateIn(coroutineScope, SharingStarted.WhileSubscribed(), initialValue = false) + .stateIn(bgScope, SharingStarted.WhileSubscribed(), initialValue = false) override val areNotificationsLightsOut: Flow<Boolean> = if (NotificationsLiveDataStoreRefactor.isUnexpectedlyInLegacyMode()) { @@ -261,6 +262,7 @@ constructor( columnName = COL_NOTIF_LIGHTS_OUT, initialValue = false, ) + .flowOn(bgDispatcher) override val areaTint: Flow<StatusBarTintColor> = darkIconInteractor @@ -276,6 +278,7 @@ constructor( } .conflate() .distinctUntilChanged() + .flowOn(bgDispatcher) /** * True if the current SysUI state can show the home status bar (aka this status bar), and false @@ -297,7 +300,7 @@ constructor( isHomeScreenStatusBarAllowedLegacy } - override val shouldHomeStatusBarBeVisible = + private val shouldHomeStatusBarBeVisible = combine( isHomeStatusBarAllowed, keyguardInteractor.isSecureCameraActive, @@ -318,6 +321,7 @@ constructor( columnName = COL_VISIBLE, initialValue = false, ) + .flowOn(bgDispatcher) private val isAnyChipVisible = if (StatusBarNotifChips.isEnabled) { @@ -361,6 +365,7 @@ constructor( columnName = COL_SHOW_OPERATOR_NAME, initialValue = false, ) + .flowOn(bgDispatcher) override val isClockVisible: Flow<VisibilityModel> = combine( @@ -382,6 +387,7 @@ constructor( columnPrefix = COL_PREFIX_CLOCK, initialValue = VisibilityModel(false.toVisibleOrInvisible(), false), ) + .flowOn(bgDispatcher) override val isNotificationIconContainerVisible: Flow<VisibilityModel> = combine( @@ -407,6 +413,7 @@ constructor( columnPrefix = COL_PREFIX_NOTIF_CONTAINER, initialValue = VisibilityModel(false.toVisibleOrInvisible(), false), ) + .flowOn(bgDispatcher) private val isSystemInfoVisible = combine(shouldHomeStatusBarBeVisible, homeStatusBarInteractor.visibilityViaDisableFlags) { @@ -429,17 +436,17 @@ constructor( SystemInfoCombinedVisibilityModel(VisibilityModel(View.VISIBLE, false), Idle), ) .stateIn( - coroutineScope, + bgScope, SharingStarted.WhileSubscribed(), SystemInfoCombinedVisibilityModel(VisibilityModel(View.VISIBLE, false), Idle), ) override val iconBlockList: Flow<List<String>> = - homeStatusBarIconBlockListInteractor.iconBlockList + homeStatusBarIconBlockListInteractor.iconBlockList.flowOn(bgDispatcher) override val contentArea: Flow<Rect> = statusBarContentInsetsViewModelStore.forDisplay(thisDisplayId)?.contentArea - ?: flowOf(Rect(0, 0, 0, 0)) + ?: flowOf(Rect(0, 0, 0, 0)).flowOn(bgDispatcher) @View.Visibility private fun Boolean.toVisibleOrGone(): Int { diff --git a/packages/SystemUI/src/com/android/systemui/volume/CsdWarningDialog.java b/packages/SystemUI/src/com/android/systemui/volume/CsdWarningDialog.java index a63660ba2804..5c439262b02c 100644 --- a/packages/SystemUI/src/com/android/systemui/volume/CsdWarningDialog.java +++ b/packages/SystemUI/src/com/android/systemui/volume/CsdWarningDialog.java @@ -46,14 +46,13 @@ import com.android.systemui.statusbar.phone.SystemUIDialog; import com.android.systemui.util.NotificationChannels; import com.android.systemui.util.concurrency.DelayableExecutor; -import com.google.common.collect.ImmutableList; +import java.util.List; +import java.util.Optional; import dagger.assisted.Assisted; import dagger.assisted.AssistedFactory; import dagger.assisted.AssistedInject; -import java.util.Optional; - /** * A class that implements the three Computed Sound Dose-related warnings defined in * {@link AudioManager}: @@ -108,7 +107,7 @@ public class CsdWarningDialog extends SystemUIDialog private long mShowTime; @VisibleForTesting public int mCachedMediaStreamVolume; - private Optional<ImmutableList<CsdWarningAction>> mActionIntents; + private Optional<List<CsdWarningAction>> mActionIntents; private final BroadcastDispatcher mBroadcastDispatcher; /** @@ -120,7 +119,7 @@ public class CsdWarningDialog extends SystemUIDialog CsdWarningDialog create( int csdWarning, Runnable onCleanup, - Optional<ImmutableList<CsdWarningAction>> actionIntents); + Optional<List<CsdWarningAction>> actionIntents); } @AssistedInject @@ -131,7 +130,7 @@ public class CsdWarningDialog extends SystemUIDialog NotificationManager notificationManager, @Background DelayableExecutor delayableExecutor, @Assisted Runnable onCleanup, - @Assisted Optional<ImmutableList<CsdWarningAction>> actionIntents, + @Assisted Optional<List<CsdWarningAction>> actionIntents, BroadcastDispatcher broadcastDispatcher) { super(context); mCsdWarning = csdWarning; @@ -350,7 +349,7 @@ public class CsdWarningDialog extends SystemUIDialog if (Flags.sounddoseCustomization() && mActionIntents.isPresent() && !mActionIntents.get().isEmpty()) { - ImmutableList<CsdWarningAction> actionIntentsList = mActionIntents.get(); + List<CsdWarningAction> actionIntentsList = mActionIntents.get(); for (CsdWarningAction action : actionIntentsList) { if (action.getLabel() == null || action.getIntent() == null) { Log.w(TAG, "Null action intent received. Skipping addition to notification"); diff --git a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java index a4e46f667329..ae063b416dca 100644 --- a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java +++ b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java @@ -31,7 +31,6 @@ import static android.view.View.INVISIBLE; import static android.view.View.LAYOUT_DIRECTION_RTL; import static android.view.View.VISIBLE; import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT; - import static com.android.internal.jank.InteractionJankMonitor.CUJ_VOLUME_CONTROL; import static com.android.internal.jank.InteractionJankMonitor.Configuration.Builder; import static com.android.settingslib.flags.Flags.audioSharingDeveloperOption; @@ -144,18 +143,17 @@ import com.android.systemui.volume.domain.interactor.VolumeDialogInteractor; import com.android.systemui.volume.domain.interactor.VolumePanelNavigationInteractor; import com.android.systemui.volume.panel.shared.flag.VolumePanelFlag; import com.android.systemui.volume.ui.navigation.VolumeNavigator; - import com.google.android.msdl.domain.MSDLPlayer; -import com.google.common.collect.ImmutableList; - -import dagger.Lazy; import java.io.PrintWriter; import java.util.ArrayList; +import java.util.Collections; import java.util.List; import java.util.Optional; import java.util.function.Consumer; +import dagger.Lazy; + /** * Visual presentation of the volume dialog. * @@ -326,8 +324,8 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable, private final VolumePanelFlag mVolumePanelFlag; private final VolumeDialogInteractor mInteractor; // Optional actions for soundDose - private Optional<ImmutableList<CsdWarningAction>> - mCsdWarningNotificationActions = Optional.of(ImmutableList.of()); + private Optional<List<CsdWarningAction>> + mCsdWarningNotificationActions = Optional.of(Collections.emptyList()); public VolumeDialogImpl( Context context, @@ -2237,7 +2235,7 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable, } public void setCsdWarningNotificationActionIntents( - ImmutableList<CsdWarningAction> actionIntent) { + List<CsdWarningAction> actionIntent) { mCsdWarningNotificationActions = Optional.of(actionIntent); } diff --git a/packages/SystemUI/src/com/android/systemui/volume/dagger/VolumeModule.java b/packages/SystemUI/src/com/android/systemui/volume/dagger/VolumeModule.java index 2009143859d3..94964bbafbd6 100644 --- a/packages/SystemUI/src/com/android/systemui/volume/dagger/VolumeModule.java +++ b/packages/SystemUI/src/com/android/systemui/volume/dagger/VolumeModule.java @@ -43,13 +43,13 @@ import com.android.systemui.volume.VolumePanelDialogReceiver; import com.android.systemui.volume.VolumeUI; import com.android.systemui.volume.dialog.VolumeDialogPlugin; import com.android.systemui.volume.dialog.dagger.VolumeDialogPluginComponent; +import com.android.systemui.volume.dialog.dagger.factory.VolumeDialogPluginComponentFactory; import com.android.systemui.volume.domain.interactor.VolumeDialogInteractor; import com.android.systemui.volume.domain.interactor.VolumePanelNavigationInteractor; import com.android.systemui.volume.panel.dagger.VolumePanelComponent; import com.android.systemui.volume.panel.dagger.factory.VolumePanelComponentFactory; import com.android.systemui.volume.panel.shared.flag.VolumePanelFlag; import com.android.systemui.volume.ui.navigation.VolumeNavigator; - import com.google.android.msdl.domain.MSDLPlayer; import dagger.Binds; @@ -104,6 +104,10 @@ public interface VolumeModule { @Binds VolumePanelComponentFactory bindVolumePanelComponentFactory(VolumePanelComponent.Factory impl); + @Binds + VolumeDialogPluginComponentFactory bindVolumeDialogPluginComponentFactory( + VolumeDialogPluginComponent.Factory impl); + /** */ @Provides static VolumeDialog provideVolumeDialog( diff --git a/packages/SystemUI/src/com/android/systemui/volume/dialog/VolumeDialogPlugin.kt b/packages/SystemUI/src/com/android/systemui/volume/dialog/VolumeDialogPlugin.kt index 5a69be5486a0..938e313771ad 100644 --- a/packages/SystemUI/src/com/android/systemui/volume/dialog/VolumeDialogPlugin.kt +++ b/packages/SystemUI/src/com/android/systemui/volume/dialog/VolumeDialogPlugin.kt @@ -22,9 +22,13 @@ import com.android.app.tracing.coroutines.coroutineScopeTraced import com.android.app.tracing.coroutines.launchTraced as launch import com.android.systemui.dagger.qualifiers.Application import com.android.systemui.plugins.VolumeDialog +import com.android.systemui.volume.CsdWarningAction +import com.android.systemui.volume.CsdWarningDialog import com.android.systemui.volume.SafetyWarningDialog import com.android.systemui.volume.dialog.dagger.VolumeDialogPluginComponent +import com.android.systemui.volume.dialog.dagger.factory.VolumeDialogPluginComponentFactory import com.android.systemui.volume.dialog.ui.viewmodel.VolumeDialogPluginViewModel +import java.util.Optional import javax.inject.Inject import kotlin.coroutines.resume import kotlinx.coroutines.CoroutineScope @@ -39,7 +43,8 @@ constructor( @Application private val applicationCoroutineScope: CoroutineScope, private val context: Context, private val audioManager: AudioManager, - private val volumeDialogPluginComponentFactory: VolumeDialogPluginComponent.Factory, + private val volumeDialogPluginComponentFactory: VolumeDialogPluginComponentFactory, + private val csdWarningDialogFactory: CsdWarningDialog.Factory, ) : VolumeDialog { private var job: Job? = null @@ -67,6 +72,16 @@ constructor( } } .launchIn(this) + + viewModel.csdWarning + .mapLatest { csdWarning -> + if (csdWarning != null) { + showCsdWarningDialog(csdWarning, viewModel.csdWarningConfigModel.actions) { + viewModel.onCsdWarningDismissed() + } + } + } + .launchIn(this) } override fun destroy() { @@ -86,4 +101,23 @@ constructor( dialog.show() continuation.invokeOnCancellation { dialog.dismiss() } } + + private suspend fun showCsdWarningDialog( + warning: Int, + actions: List<CsdWarningAction>, + onDismissed: () -> Unit, + ) = suspendCancellableCoroutine { continuation -> + val dialog = + csdWarningDialogFactory.create( + warning, + { + onDismissed() + continuation.resume(Unit) + }, + Optional.of(actions), + ) + + dialog.show() + continuation.invokeOnCancellation { dialog.dismiss() } + } } diff --git a/packages/SystemUI/src/com/android/systemui/volume/dialog/dagger/VolumeDialogPluginComponent.kt b/packages/SystemUI/src/com/android/systemui/volume/dialog/dagger/VolumeDialogPluginComponent.kt index 4e0098ccdf99..f0fe4a3b7ffd 100644 --- a/packages/SystemUI/src/com/android/systemui/volume/dialog/dagger/VolumeDialogPluginComponent.kt +++ b/packages/SystemUI/src/com/android/systemui/volume/dialog/dagger/VolumeDialogPluginComponent.kt @@ -16,6 +16,7 @@ package com.android.systemui.volume.dialog.dagger +import com.android.systemui.volume.dialog.dagger.factory.VolumeDialogPluginComponentFactory import com.android.systemui.volume.dialog.dagger.module.VolumeDialogPluginModule import com.android.systemui.volume.dialog.dagger.scope.VolumeDialogPlugin import com.android.systemui.volume.dialog.dagger.scope.VolumeDialogPluginScope @@ -35,9 +36,9 @@ interface VolumeDialogPluginComponent { fun viewModel(): VolumeDialogPluginViewModel @Subcomponent.Factory - interface Factory { + interface Factory : VolumeDialogPluginComponentFactory { - fun create( + override fun create( @BindsInstance @VolumeDialogPlugin scope: CoroutineScope ): VolumeDialogPluginComponent } diff --git a/packages/SystemUI/src/com/android/systemui/volume/dialog/dagger/factory/VolumeDialogPluginComponentFactory.kt b/packages/SystemUI/src/com/android/systemui/volume/dialog/dagger/factory/VolumeDialogPluginComponentFactory.kt new file mode 100644 index 000000000000..8edccd525f68 --- /dev/null +++ b/packages/SystemUI/src/com/android/systemui/volume/dialog/dagger/factory/VolumeDialogPluginComponentFactory.kt @@ -0,0 +1,26 @@ +/* + * Copyright (C) 2025 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.volume.dialog.dagger.factory + +import com.android.systemui.volume.dialog.dagger.VolumeDialogPluginComponent +import kotlinx.coroutines.CoroutineScope + +/** Common interface for all dagger Subcomponent.Factory providing [VolumeDialogPluginComponent]. */ +interface VolumeDialogPluginComponentFactory { + + fun create(scope: CoroutineScope): VolumeDialogPluginComponent +} diff --git a/packages/SystemUI/src/com/android/systemui/volume/dialog/dagger/module/VolumeDialogPluginModule.kt b/packages/SystemUI/src/com/android/systemui/volume/dialog/dagger/module/VolumeDialogPluginModule.kt index cd8cdc8573bd..547c51d1cefd 100644 --- a/packages/SystemUI/src/com/android/systemui/volume/dialog/dagger/module/VolumeDialogPluginModule.kt +++ b/packages/SystemUI/src/com/android/systemui/volume/dialog/dagger/module/VolumeDialogPluginModule.kt @@ -17,13 +17,22 @@ package com.android.systemui.volume.dialog.dagger.module import com.android.systemui.volume.dialog.dagger.VolumeDialogComponent +import com.android.systemui.volume.dialog.shared.model.CsdWarningConfigModel import com.android.systemui.volume.dialog.utils.VolumeTracer import com.android.systemui.volume.dialog.utils.VolumeTracerImpl import dagger.Binds import dagger.Module +import dagger.Provides @Module(subcomponents = [VolumeDialogComponent::class]) interface VolumeDialogPluginModule { @Binds fun bindVolumeTracer(volumeTracer: VolumeTracerImpl): VolumeTracer + + companion object { + + @Provides + fun provideCsdWarningConfigModel(): CsdWarningConfigModel = + CsdWarningConfigModel(emptyList()) + } } diff --git a/packages/SystemUI/src/com/android/systemui/volume/dialog/domain/interactor/VolumeDialogCsdWarningInteractor.kt b/packages/SystemUI/src/com/android/systemui/volume/dialog/domain/interactor/VolumeDialogCsdWarningInteractor.kt new file mode 100644 index 000000000000..ef9def328d15 --- /dev/null +++ b/packages/SystemUI/src/com/android/systemui/volume/dialog/domain/interactor/VolumeDialogCsdWarningInteractor.kt @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2025 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.volume.dialog.domain.interactor + +import com.android.systemui.volume.dialog.dagger.scope.VolumeDialogPluginScope +import com.android.systemui.volume.dialog.shared.model.VolumeDialogCsdWarningModel +import javax.inject.Inject +import kotlinx.coroutines.ExperimentalCoroutinesApi +import kotlinx.coroutines.delay +import kotlinx.coroutines.flow.Flow +import kotlinx.coroutines.flow.flatMapLatest +import kotlinx.coroutines.flow.flow +import kotlinx.coroutines.flow.flowOf +import kotlinx.coroutines.flow.map + +@OptIn(ExperimentalCoroutinesApi::class) +@VolumeDialogPluginScope +class VolumeDialogCsdWarningInteractor +@Inject +constructor(private val stateInteractor: VolumeDialogStateInteractor) { + + /** Emits warning when the warning should be visible and null when it shouldn't */ + val csdWarning: Flow<Int?> = + stateInteractor.volumeDialogState + .map { it.isShowingCsdWarning } + .flatMapLatest { model -> + when (model) { + is VolumeDialogCsdWarningModel.Visible -> + flow { + emit(model.warning) + delay(model.duration) + emit(null) + } + is VolumeDialogCsdWarningModel.Invisible -> flowOf(null) + } + } + + fun onCsdWarningDismissed() { + stateInteractor.setCsdWarning(VolumeDialogCsdWarningModel.Invisible) + } +} diff --git a/packages/SystemUI/src/com/android/systemui/volume/dialog/domain/interactor/VolumeDialogStateInteractor.kt b/packages/SystemUI/src/com/android/systemui/volume/dialog/domain/interactor/VolumeDialogStateInteractor.kt index 26d2414acec1..b3c92f8cdbb9 100644 --- a/packages/SystemUI/src/com/android/systemui/volume/dialog/domain/interactor/VolumeDialogStateInteractor.kt +++ b/packages/SystemUI/src/com/android/systemui/volume/dialog/domain/interactor/VolumeDialogStateInteractor.kt @@ -23,10 +23,12 @@ import com.android.systemui.volume.dialog.dagger.scope.VolumeDialogPlugin import com.android.systemui.volume.dialog.dagger.scope.VolumeDialogPluginScope import com.android.systemui.volume.dialog.data.repository.VolumeDialogStateRepository import com.android.systemui.volume.dialog.domain.model.VolumeDialogEventModel +import com.android.systemui.volume.dialog.shared.model.VolumeDialogCsdWarningModel import com.android.systemui.volume.dialog.shared.model.VolumeDialogSafetyWarningModel import com.android.systemui.volume.dialog.shared.model.VolumeDialogStateModel import com.android.systemui.volume.dialog.shared.model.VolumeDialogStreamModel import javax.inject.Inject +import kotlin.time.Duration.Companion.milliseconds import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.launchIn @@ -64,6 +66,14 @@ constructor( is VolumeDialogEventModel.ShowSafetyWarning -> { setSafetyWarning(VolumeDialogSafetyWarningModel.Visible(event.flags)) } + is VolumeDialogEventModel.ShowCsdWarning -> { + setCsdWarning( + VolumeDialogCsdWarningModel.Visible( + warning = event.csdWarning, + duration = event.durationMs.milliseconds, + ) + ) + } is VolumeDialogEventModel.SubscribedToEvents -> { volumeDialogController.getState() } @@ -81,6 +91,10 @@ constructor( volumeDialogStateRepository.updateState { it.copy(isShowingSafetyWarning = model) } } + fun setCsdWarning(model: VolumeDialogCsdWarningModel) { + volumeDialogStateRepository.updateState { it.copy(isShowingCsdWarning = model) } + } + /** Returns a copy of [model] filled with the values from [VolumeDialogController.State]. */ private fun VolumeDialogController.State.copyIntoModel( model: VolumeDialogStateModel diff --git a/packages/SystemUI/src/com/android/systemui/volume/dialog/shared/model/CsdWarningConfigModel.kt b/packages/SystemUI/src/com/android/systemui/volume/dialog/shared/model/CsdWarningConfigModel.kt new file mode 100644 index 000000000000..e6741bae6c26 --- /dev/null +++ b/packages/SystemUI/src/com/android/systemui/volume/dialog/shared/model/CsdWarningConfigModel.kt @@ -0,0 +1,21 @@ +/* + * Copyright (C) 2025 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.volume.dialog.shared.model + +import com.android.systemui.volume.CsdWarningAction + +data class CsdWarningConfigModel(val actions: List<CsdWarningAction>) diff --git a/packages/SystemUI/src/com/android/systemui/volume/dialog/shared/model/VolumeDialogCsdWarningModel.kt b/packages/SystemUI/src/com/android/systemui/volume/dialog/shared/model/VolumeDialogCsdWarningModel.kt new file mode 100644 index 000000000000..219af7165534 --- /dev/null +++ b/packages/SystemUI/src/com/android/systemui/volume/dialog/shared/model/VolumeDialogCsdWarningModel.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.volume.dialog.shared.model + +import kotlin.time.Duration + +/** Models current CSD dialog state. */ +sealed interface VolumeDialogCsdWarningModel { + + /** CSD dialog is visible and has been shown with the [warning] for the [duration]. */ + data class Visible(val warning: Int, val duration: Duration) : VolumeDialogCsdWarningModel + + /** CSD dialog is invisible. */ + data object Invisible : VolumeDialogCsdWarningModel +} diff --git a/packages/SystemUI/src/com/android/systemui/volume/dialog/shared/model/VolumeDialogStateModel.kt b/packages/SystemUI/src/com/android/systemui/volume/dialog/shared/model/VolumeDialogStateModel.kt index 838006d0adb2..89456fe2ac75 100644 --- a/packages/SystemUI/src/com/android/systemui/volume/dialog/shared/model/VolumeDialogStateModel.kt +++ b/packages/SystemUI/src/com/android/systemui/volume/dialog/shared/model/VolumeDialogStateModel.kt @@ -23,6 +23,7 @@ data class VolumeDialogStateModel( val shouldShowA11ySlider: Boolean = false, val isShowingSafetyWarning: VolumeDialogSafetyWarningModel = VolumeDialogSafetyWarningModel.Invisible, + val isShowingCsdWarning: VolumeDialogCsdWarningModel = VolumeDialogCsdWarningModel.Invisible, val streamModels: Map<Int, VolumeDialogStreamModel> = mapOf(), val ringerModeInternal: Int = 0, val ringerModeExternal: Int = 0, diff --git a/packages/SystemUI/src/com/android/systemui/volume/dialog/ui/viewmodel/VolumeDialogPluginViewModel.kt b/packages/SystemUI/src/com/android/systemui/volume/dialog/ui/viewmodel/VolumeDialogPluginViewModel.kt index e7a2cf4eff08..1765f0111e08 100644 --- a/packages/SystemUI/src/com/android/systemui/volume/dialog/ui/viewmodel/VolumeDialogPluginViewModel.kt +++ b/packages/SystemUI/src/com/android/systemui/volume/dialog/ui/viewmodel/VolumeDialogPluginViewModel.kt @@ -20,9 +20,11 @@ import com.android.systemui.volume.Events import com.android.systemui.volume.dialog.VolumeDialog import com.android.systemui.volume.dialog.dagger.scope.VolumeDialogPlugin import com.android.systemui.volume.dialog.dagger.scope.VolumeDialogPluginScope +import com.android.systemui.volume.dialog.domain.interactor.VolumeDialogCsdWarningInteractor import com.android.systemui.volume.dialog.domain.interactor.VolumeDialogSafetyWarningInteractor import com.android.systemui.volume.dialog.domain.interactor.VolumeDialogVisibilityInteractor import com.android.systemui.volume.dialog.shared.VolumeDialogLogger +import com.android.systemui.volume.dialog.shared.model.CsdWarningConfigModel import com.android.systemui.volume.dialog.shared.model.VolumeDialogVisibilityModel import javax.inject.Inject import javax.inject.Provider @@ -38,8 +40,10 @@ constructor( @VolumeDialogPlugin private val coroutineScope: CoroutineScope, private val dialogVisibilityInteractor: VolumeDialogVisibilityInteractor, private val dialogSafetyWarningInteractor: VolumeDialogSafetyWarningInteractor, + private val dialogCsdWarningInteractor: VolumeDialogCsdWarningInteractor, private val volumeDialogProvider: Provider<VolumeDialog>, private val logger: VolumeDialogLogger, + val csdWarningConfigModel: CsdWarningConfigModel, ) { fun launchVolumeDialog() { @@ -61,11 +65,16 @@ constructor( } val isShowingSafetyWarning: Flow<Boolean> = dialogSafetyWarningInteractor.isShowingSafetyWarning + val csdWarning: Flow<Int?> = dialogCsdWarningInteractor.csdWarning fun onSafetyWarningDismissed() { dialogSafetyWarningInteractor.onSafetyWarningDismissed() } + fun onCsdWarningDismissed() { + dialogCsdWarningInteractor.onCsdWarningDismissed() + } + private fun showDialog() { volumeDialogProvider .get() diff --git a/packages/SystemUI/src/com/android/systemui/volume/panel/component/mediaoutput/domain/MediaOutputAvailabilityCriteria.kt b/packages/SystemUI/src/com/android/systemui/volume/panel/component/mediaoutput/domain/MediaOutputAvailabilityCriteria.kt deleted file mode 100644 index bee45645bfdb..000000000000 --- a/packages/SystemUI/src/com/android/systemui/volume/panel/component/mediaoutput/domain/MediaOutputAvailabilityCriteria.kt +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (C) 2025 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.volume.panel.component.mediaoutput.domain - -import android.content.Context -import com.android.settingslib.media.PhoneMediaDevice.isDesktop -import com.android.systemui.dagger.qualifiers.Application -import com.android.systemui.volume.panel.dagger.scope.VolumePanelScope -import com.android.systemui.volume.panel.domain.ComponentAvailabilityCriteria -import javax.inject.Inject -import kotlinx.coroutines.CoroutineScope -import kotlinx.coroutines.flow.Flow -import kotlinx.coroutines.flow.SharingStarted -import kotlinx.coroutines.flow.flow -import kotlinx.coroutines.flow.stateIn - -@VolumePanelScope -class MediaOutputAvailabilityCriteria -@Inject -constructor( - @Application private val context: Context, - @VolumePanelScope private val scope: CoroutineScope, -) : ComponentAvailabilityCriteria { - - private val availability = - flow { emit(!isDesktop(context)) }.stateIn(scope, SharingStarted.WhileSubscribed(), false) - - override fun isAvailable(): Flow<Boolean> = availability -} diff --git a/packages/SystemUI/tests/src/com/android/systemui/qs/external/TileServiceRequestControllerTestComposeOff.kt b/packages/SystemUI/tests/src/com/android/systemui/qs/external/TileServiceRequestControllerTestComposeOff.kt index 82e247714794..fbc6f84cb8fd 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/qs/external/TileServiceRequestControllerTestComposeOff.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/qs/external/TileServiceRequestControllerTestComposeOff.kt @@ -29,10 +29,10 @@ import com.android.internal.logging.InstanceId import com.android.internal.statusbar.IAddTileResultCallback import com.android.systemui.InstanceIdSequenceFake import com.android.systemui.SysuiTestCase +import com.android.systemui.flags.DisableSceneContainer import com.android.systemui.qs.QSHost import com.android.systemui.qs.external.ui.dialog.tileRequestDialogComposeDelegateFactory import com.android.systemui.qs.flags.QSComposeFragment -import com.android.systemui.shade.shared.flag.DualShade import com.android.systemui.statusbar.CommandQueue import com.android.systemui.statusbar.commandline.CommandRegistry import com.android.systemui.testKosmos @@ -57,7 +57,8 @@ import org.mockito.MockitoAnnotations @SmallTest @RunWith(AndroidJUnit4::class) -@DisableFlags(value = [QSComposeFragment.FLAG_NAME, DualShade.FLAG_NAME]) +@DisableFlags(QSComposeFragment.FLAG_NAME) +@DisableSceneContainer class TileServiceRequestControllerTestComposeOff : SysuiTestCase() { companion object { diff --git a/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/dialog/InternetDetailsContentManagerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/dialog/InternetDetailsContentManagerTest.kt index 50b8f37f8d25..c20a801cd5e3 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/dialog/InternetDetailsContentManagerTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/dialog/InternetDetailsContentManagerTest.kt @@ -63,7 +63,7 @@ import org.mockito.kotlin.whenever @RunWith(AndroidJUnit4::class) @RunWithLooper(setAsMainLooper = true) @EnableSceneContainer -@EnableFlags(Flags.FLAG_QS_TILE_DETAILED_VIEW, Flags.FLAG_DUAL_SHADE) +@EnableFlags(Flags.FLAG_QS_TILE_DETAILED_VIEW) @UiThreadTest class InternetDetailsContentManagerTest : SysuiTestCase() { private val kosmos = Kosmos() diff --git a/packages/SystemUI/tests/src/com/android/systemui/recents/LauncherProxyServiceTest.kt b/packages/SystemUI/tests/src/com/android/systemui/recents/LauncherProxyServiceTest.kt index 69b762b470b7..40547c2787ac 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/recents/LauncherProxyServiceTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/recents/LauncherProxyServiceTest.kt @@ -90,7 +90,7 @@ class LauncherProxyServiceTest : SysuiTestCase() { private val kosmos = testKosmos() private lateinit var subject: LauncherProxyService @Mock private val dumpManager = DumpManager() - @Mock private val processWrapper = ProcessWrapper() + @Mock private lateinit var processWrapper: ProcessWrapper private val displayTracker = FakeDisplayTracker(mContext) private val fakeSystemClock = FakeSystemClock() private val sysUiState = SysUiState(displayTracker, kosmos.sceneContainerPlugin) diff --git a/packages/SystemUI/tests/src/com/android/systemui/shared/clocks/view/SimpleDigitalClockTextViewTest.kt b/packages/SystemUI/tests/src/com/android/systemui/shared/clocks/view/SimpleDigitalClockTextViewTest.kt index 57c28580c063..b75dd0402175 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/shared/clocks/view/SimpleDigitalClockTextViewTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/shared/clocks/view/SimpleDigitalClockTextViewTest.kt @@ -58,7 +58,8 @@ class SimpleDigitalClockTextViewTest : SysuiTestCase() { }, ClockMessageBuffers(messageBuffer), messageBuffer, - ) + ), + isLargeClock = false, ) underTest.textStyle = FontTextStyle() underTest.aodStyle = FontTextStyle() diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/ViewConfigCoordinatorTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/ViewConfigCoordinatorTest.kt index c8fbe61fa799..3937d3d46d68 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/ViewConfigCoordinatorTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/ViewConfigCoordinatorTest.kt @@ -20,6 +20,7 @@ import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest import com.android.keyguard.KeyguardUpdateMonitor import com.android.keyguard.KeyguardUpdateMonitorCallback +import com.android.systemui.Flags import com.android.systemui.SysuiTestCase import com.android.systemui.statusbar.NotificationLockscreenUserManager import com.android.systemui.statusbar.NotificationLockscreenUserManager.UserChangedListener @@ -64,13 +65,14 @@ class ViewConfigCoordinatorTest : SysuiTestCase() { fun setUp() { whenever(pipeline.allNotifs).thenReturn(listOf(entry)) whenever(entry.row).thenReturn(row) - coordinator = ViewConfigCoordinator( - configurationController, - lockscreenUserManager, - gutsManager, - keyguardUpdateMonitor, - colorUpdateLogger, - ) + coordinator = + ViewConfigCoordinator( + configurationController, + lockscreenUserManager, + gutsManager, + keyguardUpdateMonitor, + colorUpdateLogger, + ) coordinator.attach(pipeline) userChangedListener = withArgCaptor { verify(lockscreenUserManager).addUserChangedListener(capture()) @@ -95,7 +97,7 @@ class ViewConfigCoordinatorTest : SysuiTestCase() { fun themeChangePropagatesToEntry() { configurationListener.onThemeChanged() verify(entry).onDensityOrFontScaleChanged() - verify(entry).areGutsExposed() + checkGutsExposedCalled() verifyNoMoreInteractions(entry, row) } @@ -103,7 +105,7 @@ class ViewConfigCoordinatorTest : SysuiTestCase() { fun densityChangePropagatesToEntry() { configurationListener.onDensityOrFontScaleChanged() verify(entry).onDensityOrFontScaleChanged() - verify(entry).areGutsExposed() + checkGutsExposedCalled() verifyNoMoreInteractions(entry, row) } @@ -127,7 +129,7 @@ class ViewConfigCoordinatorTest : SysuiTestCase() { verify(entry).row verify(row).onUiModeChanged() verify(entry).onDensityOrFontScaleChanged() - verify(entry).areGutsExposed() + checkGutsExposedCalled() verifyNoMoreInteractions(entry, row) clearInvocations(entry, row) @@ -158,7 +160,7 @@ class ViewConfigCoordinatorTest : SysuiTestCase() { verify(entry).row verify(row).onUiModeChanged() verify(entry).onDensityOrFontScaleChanged() - verify(entry).areGutsExposed() + checkGutsExposedCalled() verifyNoMoreInteractions(entry, row) clearInvocations(entry, row) @@ -194,8 +196,14 @@ class ViewConfigCoordinatorTest : SysuiTestCase() { verify(entry).row verify(row).onUiModeChanged() verify(entry).onDensityOrFontScaleChanged() - verify(entry).areGutsExposed() + checkGutsExposedCalled() verifyNoMoreInteractions(entry, row) clearInvocations(entry, row) } + + private fun checkGutsExposedCalled() { + if (!Flags.notificationUndoGutsOnConfigChanged()) { + verify(entry).areGutsExposed() + } + } } diff --git a/packages/SystemUI/tests/src/com/android/systemui/volume/VolumeDialogImplTest.java b/packages/SystemUI/tests/src/com/android/systemui/volume/VolumeDialogImplTest.java index 3007eabba0b8..8d05ea16cfa6 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/volume/VolumeDialogImplTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/volume/VolumeDialogImplTest.java @@ -16,6 +16,7 @@ package com.android.systemui.volume; +import java.util.List; import static android.media.AudioManager.RINGER_MODE_NORMAL; import static android.media.AudioManager.RINGER_MODE_SILENT; import static android.media.AudioManager.RINGER_MODE_VIBRATE; @@ -93,7 +94,6 @@ import com.android.systemui.volume.panel.shared.flag.VolumePanelFlag; import com.android.systemui.volume.ui.navigation.VolumeNavigator; import com.google.android.msdl.domain.MSDLPlayer; -import com.google.common.collect.ImmutableList; import dagger.Lazy; @@ -163,7 +163,7 @@ public class VolumeDialogImplTest extends SysuiTestCase { new CsdWarningDialog.Factory() { @Override public CsdWarningDialog create(int warningType, Runnable onCleanup, - Optional<ImmutableList<CsdWarningAction>> actionIntents) { + Optional<List<CsdWarningAction>> actionIntents) { return mCsdWarningDialog; } }; diff --git a/packages/SystemUI/tests/src/com/android/systemui/wmshell/BubblesTest.java b/packages/SystemUI/tests/src/com/android/systemui/wmshell/BubblesTest.java index 097f3929db42..bf10dc6c4aef 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/wmshell/BubblesTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/wmshell/BubblesTest.java @@ -2110,7 +2110,7 @@ public class BubblesTest extends SysuiTestCase { assertThat(mBubbleData.getSelectedBubble().getKey()).isEqualTo(noteBubbleKey); assertThat(mBubbleController.isStackExpanded()).isTrue(); assertThat(mBubbleData.getBubbles().size()).isEqualTo(1); - assertThat(mBubbleData.getBubbles().get(0).getAppBubbleIntent() + assertThat(mBubbleData.getBubbles().get(0).getIntent() .getStringExtra("hello")).isEqualTo("world"); assertThat(mBubbleData.getOverflowBubbleWithKey(noteBubbleKey)).isNull(); } diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/communal/ui/viewmodel/CommunalUserActionsViewModelKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/communal/ui/viewmodel/CommunalUserActionsViewModelKosmos.kt index 1c84133d3821..f73777237cd0 100644 --- a/packages/SystemUI/tests/utils/src/com/android/systemui/communal/ui/viewmodel/CommunalUserActionsViewModelKosmos.kt +++ b/packages/SystemUI/tests/utils/src/com/android/systemui/communal/ui/viewmodel/CommunalUserActionsViewModelKosmos.kt @@ -20,10 +20,12 @@ import com.android.systemui.deviceentry.domain.interactor.deviceUnlockedInteract import com.android.systemui.kosmos.Kosmos import com.android.systemui.kosmos.Kosmos.Fixture import com.android.systemui.shade.domain.interactor.shadeInteractor +import com.android.systemui.shade.domain.interactor.shadeModeInteractor val Kosmos.communalUserActionsViewModel by Fixture { CommunalUserActionsViewModel( deviceUnlockedInteractor = deviceUnlockedInteractor, shadeInteractor = shadeInteractor, + shadeModeInteractor = shadeModeInteractor, ) } diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/dreams/ui/viewmodel/DreamUserActionsViewModelKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/dreams/ui/viewmodel/DreamUserActionsViewModelKosmos.kt index 71746b505a48..2e59788663f7 100644 --- a/packages/SystemUI/tests/utils/src/com/android/systemui/dreams/ui/viewmodel/DreamUserActionsViewModelKosmos.kt +++ b/packages/SystemUI/tests/utils/src/com/android/systemui/dreams/ui/viewmodel/DreamUserActionsViewModelKosmos.kt @@ -20,6 +20,7 @@ import com.android.systemui.communal.domain.interactor.communalInteractor import com.android.systemui.deviceentry.domain.interactor.deviceUnlockedInteractor import com.android.systemui.kosmos.Kosmos import com.android.systemui.shade.domain.interactor.shadeInteractor +import com.android.systemui.shade.domain.interactor.shadeModeInteractor val Kosmos.dreamUserActionsViewModel by Kosmos.Fixture { @@ -27,5 +28,6 @@ val Kosmos.dreamUserActionsViewModel by communalInteractor = communalInteractor, deviceUnlockedInteractor = deviceUnlockedInteractor, shadeInteractor = shadeInteractor, + shadeModeInteractor = shadeModeInteractor, ) } diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/data/repository/FakeKeyguardRepository.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/data/repository/FakeKeyguardRepository.kt index 8ea80081a871..1952f26b4e6a 100644 --- a/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/data/repository/FakeKeyguardRepository.kt +++ b/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/data/repository/FakeKeyguardRepository.kt @@ -114,6 +114,7 @@ class FakeKeyguardRepository @Inject constructor() : KeyguardRepository { override val keyguardAlpha: StateFlow<Float> = _keyguardAlpha override val panelAlpha: MutableStateFlow<Float> = MutableStateFlow(1f) + override val zoomOut: MutableStateFlow<Float> = MutableStateFlow(0f) override val lastRootViewTapPosition: MutableStateFlow<Point?> = MutableStateFlow(null) @@ -272,6 +273,10 @@ class FakeKeyguardRepository @Inject constructor() : KeyguardRepository { panelAlpha.value = alpha } + override fun setZoomOut(zoomOutFromShadeRadius: Float) { + zoomOut.value = zoomOutFromShadeRadius + } + fun setIsEncryptedOrLockdown(value: Boolean) { _isEncryptedOrLockdown.value = value } diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/ui/viewmodel/LockscreenContentViewModelKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/ui/viewmodel/LockscreenContentViewModelKosmos.kt index f47b2df607c1..78d44d4917fe 100644 --- a/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/ui/viewmodel/LockscreenContentViewModelKosmos.kt +++ b/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/ui/viewmodel/LockscreenContentViewModelKosmos.kt @@ -20,8 +20,8 @@ import com.android.systemui.biometrics.authController import com.android.systemui.deviceentry.domain.interactor.deviceEntryInteractor import com.android.systemui.keyguard.domain.interactor.keyguardBlueprintInteractor import com.android.systemui.keyguard.domain.interactor.keyguardClockInteractor +import com.android.systemui.keyguard.domain.interactor.keyguardTransitionInteractor import com.android.systemui.kosmos.Kosmos -import com.android.systemui.scene.domain.interactor.sceneContainerOcclusionInteractor import com.android.systemui.shade.domain.interactor.shadeInteractor import com.android.systemui.unfold.domain.interactor.unfoldTransitionInteractor @@ -34,7 +34,7 @@ val Kosmos.lockscreenContentViewModel by touchHandling = keyguardTouchHandlingViewModel, shadeInteractor = shadeInteractor, unfoldTransitionInteractor = unfoldTransitionInteractor, - occlusionInteractor = sceneContainerOcclusionInteractor, deviceEntryInteractor = deviceEntryInteractor, + transitionInteractor = keyguardTransitionInteractor, ) } diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/ui/viewmodel/LockscreenUserActionsViewModelKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/ui/viewmodel/LockscreenUserActionsViewModelKosmos.kt index 2311c0a23db8..ec83157eb108 100644 --- a/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/ui/viewmodel/LockscreenUserActionsViewModelKosmos.kt +++ b/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/ui/viewmodel/LockscreenUserActionsViewModelKosmos.kt @@ -22,12 +22,14 @@ import com.android.systemui.kosmos.Kosmos import com.android.systemui.kosmos.Kosmos.Fixture import com.android.systemui.scene.domain.interactor.sceneContainerOcclusionInteractor import com.android.systemui.shade.domain.interactor.shadeInteractor +import com.android.systemui.shade.domain.interactor.shadeModeInteractor val Kosmos.lockscreenUserActionsViewModel by Fixture { LockscreenUserActionsViewModel( deviceEntryInteractor = deviceEntryInteractor, communalInteractor = communalInteractor, shadeInteractor = shadeInteractor, + shadeModeInteractor = shadeModeInteractor, occlusionInteractor = sceneContainerOcclusionInteractor, ) } diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/process/ProcessKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/process/ProcessKosmos.kt index 79167f840f60..4d1e0a8c025a 100644 --- a/packages/SystemUI/tests/utils/src/com/android/systemui/process/ProcessKosmos.kt +++ b/packages/SystemUI/tests/utils/src/com/android/systemui/process/ProcessKosmos.kt @@ -16,6 +16,9 @@ package com.android.systemui.process +import android.app.ActivityManager + import com.android.systemui.kosmos.Kosmos +import com.android.systemui.util.mockito.mock -val Kosmos.processWrapper: ProcessWrapperFake by Kosmos.Fixture { ProcessWrapperFake() } +val Kosmos.processWrapper: ProcessWrapperFake by Kosmos.Fixture { ProcessWrapperFake(mock<ActivityManager>()) } diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/process/ProcessWrapperFake.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/process/ProcessWrapperFake.kt index dee3644e95bd..152cc3019d85 100644 --- a/packages/SystemUI/tests/utils/src/com/android/systemui/process/ProcessWrapperFake.kt +++ b/packages/SystemUI/tests/utils/src/com/android/systemui/process/ProcessWrapperFake.kt @@ -16,9 +16,10 @@ package com.android.systemui.process +import android.app.ActivityManager import android.os.UserHandle -class ProcessWrapperFake : ProcessWrapper() { +class ProcessWrapperFake(activityManager: ActivityManager) : ProcessWrapper(activityManager) { var systemUser: Boolean = false diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/qs/panels/domain/interactor/QSColumnsInteractorKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/qs/panels/domain/interactor/QSColumnsInteractorKosmos.kt index 47615f527d16..161f72af5e71 100644 --- a/packages/SystemUI/tests/utils/src/com/android/systemui/qs/panels/domain/interactor/QSColumnsInteractorKosmos.kt +++ b/packages/SystemUI/tests/utils/src/com/android/systemui/qs/panels/domain/interactor/QSColumnsInteractorKosmos.kt @@ -19,9 +19,13 @@ package com.android.systemui.qs.panels.domain.interactor import com.android.systemui.kosmos.Kosmos import com.android.systemui.kosmos.applicationCoroutineScope import com.android.systemui.qs.panels.data.repository.qsColumnsRepository -import com.android.systemui.shade.domain.interactor.shadeInteractor +import com.android.systemui.shade.domain.interactor.shadeModeInteractor val Kosmos.qsColumnsInteractor by Kosmos.Fixture { - QSColumnsInteractor(applicationCoroutineScope, qsColumnsRepository, shadeInteractor) + QSColumnsInteractor( + scope = applicationCoroutineScope, + repo = qsColumnsRepository, + shadeModeInteractor = shadeModeInteractor, + ) } 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 6c4b913cb265..ce298bb90ba2 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 @@ -20,6 +20,7 @@ import com.android.systemui.scene.ui.viewmodel.SceneContainerHapticsViewModel 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.shade.domain.interactor.shadeModeInteractor import com.android.systemui.statusbar.domain.interactor.remoteInputInteractor import com.android.systemui.wallpapers.ui.viewmodel.wallpaperViewModel import kotlinx.coroutines.flow.MutableStateFlow @@ -94,7 +95,7 @@ val Kosmos.sceneContainerViewModelFactory by Fixture { sceneInteractor = sceneInteractor, falsingInteractor = falsingInteractor, powerInteractor = powerInteractor, - shadeInteractor = shadeInteractor, + shadeModeInteractor = shadeModeInteractor, remoteInputInteractor = remoteInputInteractor, splitEdgeDetector = splitEdgeDetector, logger = sceneLogger, diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/shade/domain/interactor/ShadeBackActionInteractorKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/shade/domain/interactor/ShadeBackActionInteractorKosmos.kt index 5dc03338f19b..9eff63ca8a8c 100644 --- a/packages/SystemUI/tests/utils/src/com/android/systemui/shade/domain/interactor/ShadeBackActionInteractorKosmos.kt +++ b/packages/SystemUI/tests/utils/src/com/android/systemui/shade/domain/interactor/ShadeBackActionInteractorKosmos.kt @@ -24,6 +24,7 @@ val Kosmos.shadeBackActionInteractor by Kosmos.Fixture { ShadeBackActionInteractorImpl( shadeInteractor = shadeInteractor, + shadeModeInteractor = shadeModeInteractor, sceneInteractor = sceneInteractor, deviceEntryInteractor = deviceEntryInteractor, ) 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 index 2ba9c8094aac..614b4191d6ce 100644 --- 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 @@ -36,6 +36,8 @@ val Kosmos.shadeModeInteractor by Fixture { ) } +val Kosmos.shadeMode by Fixture { shadeModeInteractor.shadeMode } + // TODO(b/391578667): Make this user-aware once supported by FakeSecureSettingsRepository. /** * Enables the Dual Shade setting, and (optionally) sets the shade layout to be wide (`true`) or diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/shade/ui/viewmodel/ShadeHeaderViewModelKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/shade/ui/viewmodel/ShadeHeaderViewModelKosmos.kt index 2be8acb845b9..cfc2075c1352 100644 --- a/packages/SystemUI/tests/utils/src/com/android/systemui/shade/ui/viewmodel/ShadeHeaderViewModelKosmos.kt +++ b/packages/SystemUI/tests/utils/src/com/android/systemui/shade/ui/viewmodel/ShadeHeaderViewModelKosmos.kt @@ -25,6 +25,7 @@ import com.android.systemui.scene.domain.interactor.sceneInteractor import com.android.systemui.shade.domain.interactor.privacyChipInteractor import com.android.systemui.shade.domain.interactor.shadeHeaderClockInteractor import com.android.systemui.shade.domain.interactor.shadeInteractor +import com.android.systemui.shade.domain.interactor.shadeModeInteractor import com.android.systemui.statusbar.notification.icon.ui.viewbinder.NotificationIconContainerStatusBarViewBinder import com.android.systemui.statusbar.phone.ui.StatusBarIconController import com.android.systemui.statusbar.phone.ui.TintedIconManager @@ -39,6 +40,7 @@ val Kosmos.shadeHeaderViewModel: ShadeHeaderViewModel by activityStarter = activityStarter, sceneInteractor = sceneInteractor, shadeInteractor = shadeInteractor, + shadeModeInteractor = shadeModeInteractor, mobileIconsInteractor = mobileIconsInteractor, mobileIconsViewModel = mobileIconsViewModel, privacyChipInteractor = privacyChipInteractor, diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/shade/ui/viewmodel/ShadeSceneContentViewModelKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/shade/ui/viewmodel/ShadeSceneContentViewModelKosmos.kt index 694bb6e87ef6..db4b979622bb 100644 --- a/packages/SystemUI/tests/utils/src/com/android/systemui/shade/ui/viewmodel/ShadeSceneContentViewModelKosmos.kt +++ b/packages/SystemUI/tests/utils/src/com/android/systemui/shade/ui/viewmodel/ShadeSceneContentViewModelKosmos.kt @@ -25,7 +25,7 @@ import com.android.systemui.qs.footerActionsViewModelFactory import com.android.systemui.qs.ui.adapter.qsSceneAdapter import com.android.systemui.scene.domain.interactor.sceneInteractor import com.android.systemui.settings.brightness.ui.viewmodel.brightnessMirrorViewModelFactory -import com.android.systemui.shade.domain.interactor.shadeInteractor +import com.android.systemui.shade.domain.interactor.shadeModeInteractor import com.android.systemui.statusbar.disableflags.domain.interactor.disableFlagsInteractor import com.android.systemui.unfold.domain.interactor.unfoldTransitionInteractor @@ -35,7 +35,7 @@ val Kosmos.shadeSceneContentViewModel: ShadeSceneContentViewModel by Fixture { qsSceneAdapter = qsSceneAdapter, brightnessMirrorViewModelFactory = brightnessMirrorViewModelFactory, mediaCarouselInteractor = mediaCarouselInteractor, - shadeInteractor = shadeInteractor, + shadeModeInteractor = shadeModeInteractor, disableFlagsInteractor = disableFlagsInteractor, footerActionsViewModelFactory = footerActionsViewModelFactory, footerActionsController = footerActionsController, diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/shade/ui/viewmodel/ShadeUserActionsViewModelKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/shade/ui/viewmodel/ShadeUserActionsViewModelKosmos.kt index 0aeea4e1a2e5..26355930f1a1 100644 --- a/packages/SystemUI/tests/utils/src/com/android/systemui/shade/ui/viewmodel/ShadeUserActionsViewModelKosmos.kt +++ b/packages/SystemUI/tests/utils/src/com/android/systemui/shade/ui/viewmodel/ShadeUserActionsViewModelKosmos.kt @@ -20,12 +20,12 @@ import com.android.systemui.kosmos.Kosmos import com.android.systemui.kosmos.Kosmos.Fixture import com.android.systemui.qs.ui.adapter.qsSceneAdapter import com.android.systemui.scene.domain.interactor.sceneBackInteractor -import com.android.systemui.shade.domain.interactor.shadeInteractor +import com.android.systemui.shade.domain.interactor.shadeModeInteractor val Kosmos.shadeUserActionsViewModel: ShadeUserActionsViewModel by Fixture { ShadeUserActionsViewModel( qsSceneAdapter = qsSceneAdapter, - shadeInteractor = shadeInteractor, + shadeModeInteractor = shadeModeInteractor, sceneBackInteractor = sceneBackInteractor, ) } diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/notification/stack/domain/interactor/NotificationStackAppearanceInteractorKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/notification/stack/domain/interactor/NotificationStackAppearanceInteractorKosmos.kt index 2772d3698d88..87704cc39eaf 100644 --- a/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/notification/stack/domain/interactor/NotificationStackAppearanceInteractorKosmos.kt +++ b/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/notification/stack/domain/interactor/NotificationStackAppearanceInteractorKosmos.kt @@ -19,7 +19,7 @@ package com.android.systemui.statusbar.notification.stack.domain.interactor import com.android.systemui.kosmos.Kosmos import com.android.systemui.kosmos.Kosmos.Fixture import com.android.systemui.scene.domain.interactor.sceneInteractor -import com.android.systemui.shade.domain.interactor.shadeInteractor +import com.android.systemui.shade.domain.interactor.shadeModeInteractor import com.android.systemui.statusbar.notification.stack.data.repository.notificationPlaceholderRepository import com.android.systemui.statusbar.notification.stack.data.repository.notificationViewHeightRepository @@ -28,6 +28,6 @@ val Kosmos.notificationStackAppearanceInteractor by Fixture { viewHeightRepository = notificationViewHeightRepository, placeholderRepository = notificationPlaceholderRepository, sceneInteractor = sceneInteractor, - shadeInteractor = shadeInteractor, + shadeModeInteractor = shadeModeInteractor, ) } diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/notification/stack/ui/view/NotificationStatsLoggerKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/notification/stack/ui/view/NotificationStatsLoggerKosmos.kt index de52155dce79..f91c2f620bb1 100644 --- a/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/notification/stack/ui/view/NotificationStatsLoggerKosmos.kt +++ b/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/notification/stack/ui/view/NotificationStatsLoggerKosmos.kt @@ -26,7 +26,7 @@ import com.android.systemui.statusbar.notification.logging.notificationPanelLogg val Kosmos.notificationStatsLogger by Fixture { NotificationStatsLoggerImpl( - applicationScope = testScope, + applicationScope = testScope.backgroundScope, bgDispatcher = testDispatcher, statusBarService = statusBarService, notificationListenerService = notificationListenerService, diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/NotificationScrollViewModelKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/NotificationScrollViewModelKosmos.kt index 7244d465ed7e..167b11da9dba 100644 --- a/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/NotificationScrollViewModelKosmos.kt +++ b/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/NotificationScrollViewModelKosmos.kt @@ -22,6 +22,7 @@ import com.android.systemui.kosmos.Kosmos import com.android.systemui.kosmos.Kosmos.Fixture import com.android.systemui.scene.domain.interactor.sceneInteractor import com.android.systemui.shade.domain.interactor.shadeInteractor +import com.android.systemui.shade.domain.interactor.shadeModeInteractor import com.android.systemui.statusbar.domain.interactor.remoteInputInteractor import com.android.systemui.statusbar.notification.stack.domain.interactor.notificationStackAppearanceInteractor @@ -30,6 +31,7 @@ val Kosmos.notificationScrollViewModel by Fixture { dumpManager = dumpManager, stackAppearanceInteractor = notificationStackAppearanceInteractor, shadeInteractor = shadeInteractor, + shadeModeInteractor = shadeModeInteractor, remoteInputInteractor = remoteInputInteractor, sceneInteractor = sceneInteractor, keyguardInteractor = { keyguardInteractor }, diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/NotificationsPlaceholderViewModelKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/NotificationsPlaceholderViewModelKosmos.kt index e5cf0a90ebbd..084777417334 100644 --- a/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/NotificationsPlaceholderViewModelKosmos.kt +++ b/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/NotificationsPlaceholderViewModelKosmos.kt @@ -22,6 +22,7 @@ import com.android.systemui.kosmos.Kosmos import com.android.systemui.kosmos.Kosmos.Fixture import com.android.systemui.scene.domain.interactor.sceneInteractor import com.android.systemui.shade.domain.interactor.shadeInteractor +import com.android.systemui.shade.domain.interactor.shadeModeInteractor import com.android.systemui.statusbar.domain.interactor.remoteInputInteractor import com.android.systemui.statusbar.notification.stack.domain.interactor.headsUpNotificationInteractor import com.android.systemui.statusbar.notification.stack.domain.interactor.notificationStackAppearanceInteractor @@ -31,6 +32,7 @@ val Kosmos.notificationsPlaceholderViewModel by Fixture { interactor = notificationStackAppearanceInteractor, sceneInteractor = sceneInteractor, shadeInteractor = shadeInteractor, + shadeModeInteractor = shadeModeInteractor, headsUpNotificationInteractor = headsUpNotificationInteractor, remoteInputInteractor = remoteInputInteractor, featureFlags = featureFlagsClassic, diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/SharedNotificationContainerViewModelKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/SharedNotificationContainerViewModelKosmos.kt index 45c56ae0ab7a..7a2b7c24252b 100644 --- a/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/SharedNotificationContainerViewModelKosmos.kt +++ b/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/SharedNotificationContainerViewModelKosmos.kt @@ -54,6 +54,7 @@ import com.android.systemui.kosmos.Kosmos import com.android.systemui.kosmos.Kosmos.Fixture import com.android.systemui.kosmos.applicationCoroutineScope import com.android.systemui.shade.domain.interactor.shadeInteractor +import com.android.systemui.shade.domain.interactor.shadeModeInteractor import com.android.systemui.shade.largeScreenHeaderHelper import com.android.systemui.statusbar.notification.stack.domain.interactor.headsUpNotificationInteractor import com.android.systemui.statusbar.notification.stack.domain.interactor.notificationStackAppearanceInteractor @@ -71,6 +72,7 @@ val Kosmos.sharedNotificationContainerViewModel by Fixture { keyguardInteractor = keyguardInteractor, keyguardTransitionInteractor = keyguardTransitionInteractor, shadeInteractor = shadeInteractor, + shadeModeInteractor = shadeModeInteractor, notificationStackAppearanceInteractor = notificationStackAppearanceInteractor, alternateBouncerToGoneTransitionViewModel = alternateBouncerToGoneTransitionViewModel, alternateBouncerToPrimaryBouncerTransitionViewModel = diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/pipeline/shared/ui/viewmodel/HomeStatusBarViewModelKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/pipeline/shared/ui/viewmodel/HomeStatusBarViewModelKosmos.kt index 1626904a9c19..bc29dba3442c 100644 --- a/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/pipeline/shared/ui/viewmodel/HomeStatusBarViewModelKosmos.kt +++ b/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/pipeline/shared/ui/viewmodel/HomeStatusBarViewModelKosmos.kt @@ -20,7 +20,8 @@ import android.content.testableContext import com.android.systemui.keyguard.domain.interactor.keyguardInteractor import com.android.systemui.keyguard.domain.interactor.keyguardTransitionInteractor import com.android.systemui.kosmos.Kosmos -import com.android.systemui.kosmos.applicationCoroutineScope +import com.android.systemui.kosmos.backgroundScope +import com.android.systemui.kosmos.testDispatcher import com.android.systemui.log.table.tableLogBufferFactory import com.android.systemui.scene.domain.interactor.sceneContainerOcclusionInteractor import com.android.systemui.scene.domain.interactor.sceneInteractor @@ -59,6 +60,7 @@ var Kosmos.homeStatusBarViewModel: HomeStatusBarViewModel by statusBarPopupChipsViewModel, systemStatusEventAnimationInteractor, multiDisplayStatusBarContentInsetsViewModelStore, - applicationCoroutineScope, + backgroundScope, + testDispatcher, ) } diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/volume/panel/component/mediaoutput/MediaOutputModuleKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/volume/panel/component/mediaoutput/MediaOutputModuleKosmos.kt index 556c34d85f8e..0c814c566d63 100644 --- a/packages/SystemUI/tests/utils/src/com/android/systemui/volume/panel/component/mediaoutput/MediaOutputModuleKosmos.kt +++ b/packages/SystemUI/tests/utils/src/com/android/systemui/volume/panel/component/mediaoutput/MediaOutputModuleKosmos.kt @@ -16,16 +16,13 @@ package com.android.systemui.volume.panel.component.mediaoutput -import android.content.applicationContext import com.android.systemui.kosmos.Kosmos -import com.android.systemui.kosmos.testScope -import com.android.systemui.volume.panel.component.mediaoutput.domain.MediaOutputAvailabilityCriteria import com.android.systemui.volume.panel.component.mediaoutput.ui.composable.MediaOutputComponent import com.android.systemui.volume.panel.component.mediaoutput.ui.viewmodel.mediaOutputViewModel +import com.android.systemui.volume.panel.domain.ComponentAvailabilityCriteria +import com.android.systemui.volume.panel.domain.availableCriteria var Kosmos.mediaOutputComponent: MediaOutputComponent by Kosmos.Fixture { MediaOutputComponent(mediaOutputViewModel) } -var Kosmos.mediaOutputAvailabilityCriteria by - Kosmos.Fixture { - MediaOutputAvailabilityCriteria(applicationContext, testScope.backgroundScope) - } +var Kosmos.mediaOutputAvailabilityCriteria: ComponentAvailabilityCriteria by + Kosmos.Fixture { availableCriteria } diff --git a/services/core/Android.bp b/services/core/Android.bp index 420dcfe9cea6..9b0caf561544 100644 --- a/services/core/Android.bp +++ b/services/core/Android.bp @@ -227,6 +227,7 @@ java_library_static { "com.android.sysprop.watchdog", "securebox", "apache-commons-math", + "apache-commons-compress", "battery_saver_flag_lib", "notification_flags_lib", "power_hint_flags_lib", diff --git a/services/core/java/com/android/server/OWNERS b/services/core/java/com/android/server/OWNERS index ef769cf6217c..6858e2941ff9 100644 --- a/services/core/java/com/android/server/OWNERS +++ b/services/core/java/com/android/server/OWNERS @@ -9,7 +9,6 @@ per-file DisplayThread.java = michaelwr@google.com, ogunwale@google.com # Zram writeback per-file ZramWriteback.java = minchan@google.com, rajekumar@google.com -per-file ZramMaintenance.java = kawasin@google.com # ServiceWatcher per-file ServiceWatcher.java = sooniln@google.com diff --git a/services/core/java/com/android/server/StorageManagerService.java b/services/core/java/com/android/server/StorageManagerService.java index ce6e1ba0cfda..49ab8ecb204b 100644 --- a/services/core/java/com/android/server/StorageManagerService.java +++ b/services/core/java/com/android/server/StorageManagerService.java @@ -156,6 +156,7 @@ import com.android.internal.util.IndentingPrintWriter; import com.android.internal.util.Preconditions; import com.android.modules.utils.TypedXmlPullParser; import com.android.modules.utils.TypedXmlSerializer; +import com.android.server.memory.ZramMaintenance; import com.android.server.pm.Installer; import com.android.server.pm.UserManagerInternal; import com.android.server.storage.AppFuseBridge; diff --git a/services/core/java/com/android/server/VpnManagerService.java b/services/core/java/com/android/server/VpnManagerService.java index 626fa708b4e7..7e68239e0c3b 100644 --- a/services/core/java/com/android/server/VpnManagerService.java +++ b/services/core/java/com/android/server/VpnManagerService.java @@ -19,6 +19,7 @@ package com.android.server; import static android.Manifest.permission.NETWORK_STACK; import static com.android.net.module.util.PermissionUtils.enforceAnyPermissionOf; +import static com.android.net.module.util.PermissionUtils.enforceNetworkStackPermission; import android.annotation.NonNull; import android.annotation.Nullable; @@ -1020,6 +1021,8 @@ public class VpnManagerService extends IVpnManager.Stub { @Override @Nullable public byte[] getFromVpnProfileStore(@NonNull String name) { + // TODO(b/307903113): Replace NETWORK_STACK permission and adopt proper permission + enforceNetworkStackPermission(mContext); return mVpnProfileStore.get(name); } @@ -1037,6 +1040,8 @@ public class VpnManagerService extends IVpnManager.Stub { */ @Override public boolean putIntoVpnProfileStore(@NonNull String name, @NonNull byte[] blob) { + // TODO(b/307903113): Replace NETWORK_STACK permission and adopt proper permission + enforceNetworkStackPermission(mContext); return mVpnProfileStore.put(name, blob); } @@ -1052,6 +1057,8 @@ public class VpnManagerService extends IVpnManager.Stub { */ @Override public boolean removeFromVpnProfileStore(@NonNull String name) { + // TODO(b/307903113): Replace NETWORK_STACK permission and adopt proper permission + enforceNetworkStackPermission(mContext); return mVpnProfileStore.remove(name); } @@ -1069,6 +1076,8 @@ public class VpnManagerService extends IVpnManager.Stub { @Override @NonNull public String[] listFromVpnProfileStore(@NonNull String prefix) { + // TODO(b/307903113): Replace NETWORK_STACK permission and adopt proper permission + enforceNetworkStackPermission(mContext); return mVpnProfileStore.list(prefix); } diff --git a/services/core/java/com/android/server/Watchdog.java b/services/core/java/com/android/server/Watchdog.java index 8e520dc632c3..96b30d4e1285 100644 --- a/services/core/java/com/android/server/Watchdog.java +++ b/services/core/java/com/android/server/Watchdog.java @@ -191,6 +191,9 @@ public class Watchdog implements Dumpable { "android.hardware.sensors.ISensors/", "android.hardware.vibrator.IVibrator/", "android.hardware.vibrator.IVibratorManager/", + "android.hardware.wifi.hostapd.IHostapd/", + "android.hardware.wifi.IWifi/", + "android.hardware.wifi.supplicant.ISupplicant/", "android.system.suspend.ISystemSuspend/", }; diff --git a/services/core/java/com/android/server/am/AppBatteryTracker.java b/services/core/java/com/android/server/am/AppBatteryTracker.java index 374abe0256c1..0bc816e78e7b 100644 --- a/services/core/java/com/android/server/am/AppBatteryTracker.java +++ b/services/core/java/com/android/server/am/AppBatteryTracker.java @@ -818,8 +818,10 @@ final class AppBatteryTracker extends BaseAppStateTracker<AppBatteryPolicy> void dump(PrintWriter pw, String prefix) { pw.print(prefix); pw.println("APP BATTERY STATE TRACKER:"); - // Force an update. - updateBatteryUsageStatsIfNecessary(mInjector.currentTimeMillis(), true); + if (mInjector.getActivityManagerInternal().isBooted()) { + // Force an update. + updateBatteryUsageStatsIfNecessary(mInjector.currentTimeMillis(), true); + } // Force a check. scheduleBgBatteryUsageStatsCheck(); // Wait for its completion (as it runs in handler thread for the sake of thread safe) @@ -878,8 +880,10 @@ final class AppBatteryTracker extends BaseAppStateTracker<AppBatteryPolicy> @Override void dumpAsProto(ProtoOutputStream proto, int uid) { - // Force an update. - updateBatteryUsageStatsIfNecessary(mInjector.currentTimeMillis(), true); + if (mInjector.getActivityManagerInternal().isBooted()) { + // Force an update. + updateBatteryUsageStatsIfNecessary(mInjector.currentTimeMillis(), true); + } synchronized (mLock) { final SparseArray<ImmutableBatteryUsage> uidConsumers = mUidBatteryUsageInWindow; if (uid != android.os.Process.INVALID_UID) { diff --git a/services/core/java/com/android/server/am/BatteryStatsService.java b/services/core/java/com/android/server/am/BatteryStatsService.java index 644077a7e6bb..c8b0a57fe9f0 100644 --- a/services/core/java/com/android/server/am/BatteryStatsService.java +++ b/services/core/java/com/android/server/am/BatteryStatsService.java @@ -526,6 +526,8 @@ public final class BatteryStatsService extends IBatteryStats.Stub } public void systemServicesReady() { + mStats.setBatteryHistoryCompressionEnabled( + Flags.extendedBatteryHistoryCompressionEnabled()); mStats.saveBatteryUsageStatsOnReset(mBatteryUsageStatsProvider, mPowerStatsStore, isBatteryUsageStatsAccumulationSupported()); mStats.resetBatteryHistoryOnNewSession( diff --git a/services/core/java/com/android/server/display/DisplayTopologyCoordinator.java b/services/core/java/com/android/server/display/DisplayTopologyCoordinator.java index fbfe85cd3b78..2618cf40d113 100644 --- a/services/core/java/com/android/server/display/DisplayTopologyCoordinator.java +++ b/services/core/java/com/android/server/display/DisplayTopologyCoordinator.java @@ -250,8 +250,29 @@ class DisplayTopologyCoordinator { } private boolean isDisplayAllowedInTopology(DisplayInfo info) { - return mIsExtendedDisplayEnabled.getAsBoolean() - && info.displayGroupId == Display.DEFAULT_DISPLAY_GROUP; + if (info.type != Display.TYPE_INTERNAL && info.type != Display.TYPE_EXTERNAL + && info.type != Display.TYPE_OVERLAY) { + Slog.d(TAG, "Display " + info.displayId + " not allowed in topology because " + + "type is not INTERNAL, EXTERNAL or OVERLAY"); + return false; + } + if (info.type == Display.TYPE_INTERNAL && info.displayId != Display.DEFAULT_DISPLAY) { + Slog.d(TAG, "Display " + info.displayId + " not allowed in topology because " + + "it is a non-default internal display"); + return false; + } + if ((info.type == Display.TYPE_EXTERNAL || info.type == Display.TYPE_OVERLAY) + && !mIsExtendedDisplayEnabled.getAsBoolean()) { + Slog.d(TAG, "Display " + info.displayId + " not allowed in topology because " + + "type is EXTERNAL or OVERLAY and !mIsExtendedDisplayEnabled"); + return false; + } + if (info.displayGroupId != Display.DEFAULT_DISPLAY_GROUP) { + Slog.d(TAG, "Display " + info.displayId + " not allowed in topology because " + + "it is not in the default display group"); + return false; + } + return true; } /** diff --git a/services/core/java/com/android/server/inputmethod/ImeProtoLogGroup.java b/services/core/java/com/android/server/inputmethod/ImeProtoLogGroup.java new file mode 100644 index 000000000000..f9a56effc800 --- /dev/null +++ b/services/core/java/com/android/server/inputmethod/ImeProtoLogGroup.java @@ -0,0 +1,82 @@ +/* + * Copyright (C) 2025 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.inputmethod; + +import com.android.internal.protolog.common.IProtoLogGroup; + +import java.util.UUID; + +public enum ImeProtoLogGroup implements IProtoLogGroup { + // TODO(b/393561240): add info/warn/error log level and replace in IMMS + IMMS_DEBUG(Consts.ENABLE_DEBUG, false, false, + InputMethodManagerService.TAG); + + private final boolean mEnabled; + private volatile boolean mLogToProto; + private volatile boolean mLogToLogcat; + private final String mTag; + + ImeProtoLogGroup(boolean enabled, boolean logToProto, boolean logToLogcat, String tag) { + this.mEnabled = enabled; + this.mLogToProto = logToProto; + this.mLogToLogcat = logToLogcat; + this.mTag = tag; + } + + + @Override + public boolean isEnabled() { + return mEnabled; + } + + @Override + public boolean isLogToProto() { + return mLogToProto; + } + + @Override + public boolean isLogToLogcat() { + return mLogToLogcat; + } + + @Override + public String getTag() { + return mTag; + } + + @Override + public int getId() { + return Consts.START_ID + ordinal(); + } + + @Override + public void setLogToProto(boolean logToProto) { + mLogToProto = logToProto; + } + + @Override + public void setLogToLogcat(boolean logToLogcat) { + mLogToLogcat = logToLogcat; + } + + private static class Consts { + private static final boolean ENABLE_DEBUG = true; + private static final int START_ID = (int) ( + UUID.nameUUIDFromBytes(ImeProtoLogGroup.class.getName().getBytes()) + .getMostSignificantBits() % Integer.MAX_VALUE); + } +} diff --git a/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java b/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java index 7b81fc92e83d..484b47022f04 100644 --- a/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java +++ b/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java @@ -47,6 +47,7 @@ import static android.view.WindowManager.DISPLAY_IME_POLICY_LOCAL; import static android.view.inputmethod.ConnectionlessHandwritingCallback.CONNECTIONLESS_HANDWRITING_ERROR_OTHER; import static android.view.inputmethod.ConnectionlessHandwritingCallback.CONNECTIONLESS_HANDWRITING_ERROR_UNSUPPORTED; +import static com.android.server.inputmethod.ImeProtoLogGroup.IMMS_DEBUG; import static com.android.server.inputmethod.ImeVisibilityStateComputer.ImeTargetWindowState; import static com.android.server.inputmethod.ImeVisibilityStateComputer.ImeVisibilityResult; import static com.android.server.inputmethod.ImeVisibilityStateComputer.STATE_HIDE_IME; @@ -176,6 +177,7 @@ import com.android.internal.inputmethod.StartInputFlags; import com.android.internal.inputmethod.StartInputReason; import com.android.internal.inputmethod.UnbindReason; import com.android.internal.os.TransferPipe; +import com.android.internal.protolog.ProtoLog; import com.android.internal.util.ArrayUtils; import com.android.internal.util.CollectionUtils; import com.android.internal.util.DumpUtils; @@ -720,9 +722,7 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. */ @WorkerThread void onActionLocaleChanged(@NonNull LocaleList prevLocales, @NonNull LocaleList newLocales) { - if (DEBUG) { - Slog.d(TAG, "onActionLocaleChanged prev=" + prevLocales + " new=" + newLocales); - } + ProtoLog.v(IMMS_DEBUG, "onActionLocaleChanged prev=%s new=%s", prevLocales, newLocales); synchronized (ImfLock.class) { if (!mSystemReady) { return; @@ -1251,6 +1251,8 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. mShowOngoingImeSwitcherForPhones = false; + ProtoLog.init(ImeProtoLogGroup.values()); + mCurrentImeUserId = mActivityManagerInternal.getCurrentUserId(); final IntFunction<InputMethodBindingController> bindingControllerFactory = userId -> new InputMethodBindingController(userId, @@ -1328,9 +1330,7 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. return; } final InputMethodInfo defIm = suitableImes.get(0); - if (DEBUG) { - Slog.i(TAG, "Default found, using " + defIm.getId()); - } + ProtoLog.v(IMMS_DEBUG, "Default found, using %s", defIm.getId()); setSelectedInputMethodAndSubtypeLocked(defIm, NOT_A_SUBTYPE_INDEX, false, userId); } @@ -1347,10 +1347,8 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. private void switchUserOnHandlerLocked(@UserIdInt int newUserId, IInputMethodClientInvoker clientToBeReset) { final int prevUserId = mCurrentImeUserId; - if (DEBUG) { - Slog.d(TAG, "Switching user stage 1/3. newUserId=" + newUserId - + " prevUserId=" + prevUserId); - } + ProtoLog.v(IMMS_DEBUG, "Switching user stage 1/3. newUserId=%s prevUserId=%s", newUserId, + prevUserId); // Clean up stuff for mCurrentImeUserId, which soon becomes the previous user. @@ -1375,10 +1373,8 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. final String defaultImiId = SecureSettingsWrapper.getString( Settings.Secure.DEFAULT_INPUT_METHOD, null, newUserId); - if (DEBUG) { - Slog.d(TAG, "Switching user stage 2/3. newUserId=" + newUserId - + " defaultImiId=" + defaultImiId); - } + ProtoLog.v(IMMS_DEBUG, "Switching user stage 2/3. newUserId=%s defaultImiId=%s", newUserId, + defaultImiId); // For secondary users, the list of enabled IMEs may not have been updated since the // callbacks to PackageMonitor are ignored for the secondary user. Here, defaultImiId may @@ -1414,10 +1410,8 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. newSettings.getEnabledInputMethodList()); } - if (DEBUG) { - Slog.d(TAG, "Switching user stage 3/3. newUserId=" + newUserId - + " selectedIme=" + newSettings.getSelectedInputMethod()); - } + ProtoLog.v(IMMS_DEBUG, "Switching user stage 3/3. newUserId=%s selectedIme=%s", newUserId, + newSettings.getSelectedInputMethod()); if (mIsInteractive && clientToBeReset != null) { final ClientState cs = mClientController.getClient(clientToBeReset.asBinder()); @@ -1466,9 +1460,7 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. waitForUserInitialization(); synchronized (ImfLock.class) { - if (DEBUG) { - Slog.d(TAG, "--- systemReady"); - } + ProtoLog.v(IMMS_DEBUG, "--- systemReady"); if (!mSystemReady) { mSystemReady = true; final int currentImeUserId = mCurrentImeUserId; @@ -1844,10 +1836,8 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. void unbindCurrentClientLocked(@UnbindReason int unbindClientReason, @UserIdInt int userId) { final var userData = getUserData(userId); if (userData.mCurClient != null) { - if (DEBUG) { - Slog.v(TAG, "unbindCurrentInputLocked: client=" - + userData.mCurClient.mClient.asBinder()); - } + ProtoLog.v(IMMS_DEBUG, "unbindCurrentInputLocked: client=%s", + userData.mCurClient.mClient.asBinder()); final var bindingController = userData.mBindingController; if (userData.mBoundToMethod) { userData.mBoundToMethod = false; @@ -1970,7 +1960,7 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. } } else { if (isShowRequestedForCurrentWindow(userId)) { - if (DEBUG) Slog.v(TAG, "Attach new input asks to show input"); + ProtoLog.v(IMMS_DEBUG, "Attach new input asks to show input"); // Re-use current statsToken, if it exists. final var statsToken = userData.mCurStatsToken != null ? userData.mCurStatsToken : createStatsTokenForFocusedClient(true /* show */, @@ -2130,9 +2120,7 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. // If configured, we want to avoid starting up the IME if it is not supposed to be showing if (shouldPreventImeStartupLocked(selectedMethodId, startInputFlags, unverifiedTargetSdkVersion, userId)) { - if (DEBUG) { - Slog.d(TAG, "Avoiding IME startup and unbinding current input method."); - } + ProtoLog.v(IMMS_DEBUG, "Avoiding IME startup and unbinding current input method."); bindingController.invalidateAutofillSession(); bindingController.unbindCurrentMethod(); return InputBindResult.NO_EDITOR; @@ -2215,9 +2203,8 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. return currentMethodId; } final String defaultDeviceMethodId = settings.getSelectedDefaultDeviceInputMethod(); - if (DEBUG) { - Slog.v(TAG, "Restoring default device input method: " + defaultDeviceMethodId); - } + ProtoLog.v(IMMS_DEBUG, "Restoring default device input method: %s", + defaultDeviceMethodId); settings.putSelectedDefaultDeviceInputMethod(null); return defaultDeviceMethodId; } @@ -2226,24 +2213,21 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. if (Objects.equals(deviceMethodId, currentMethodId)) { return currentMethodId; } else if (!settings.getMethodMap().containsKey(deviceMethodId)) { - if (DEBUG) { - Slog.v(TAG, "Disabling IME on virtual device with id " + newDeviceId - + " because its custom input method is not available: " + deviceMethodId); - } + ProtoLog.v(IMMS_DEBUG, + "Disabling IME on virtual device with id %s because its custom input method " + + "is not available: %s", + newDeviceId, deviceMethodId); return null; } if (oldDeviceId == DEVICE_ID_DEFAULT) { - if (DEBUG) { - Slog.v(TAG, "Storing default device input method " + currentMethodId); - } + ProtoLog.v(IMMS_DEBUG, "Storing default device input method %s", currentMethodId); settings.putSelectedDefaultDeviceInputMethod(currentMethodId); } - if (DEBUG) { - Slog.v(TAG, "Switching current input method from " + currentMethodId - + " to device-specific one " + deviceMethodId + " because the current display " - + displayIdToShowIme + " belongs to device with id " + newDeviceId); - } + ProtoLog.v(IMMS_DEBUG, + "Switching current input method from %s to device-specific one %s because the " + + "current display %s belongs to device with id %s", + currentMethodId, deviceMethodId, displayIdToShowIme, newDeviceId); return deviceMethodId; } @@ -2387,10 +2371,8 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. @GuardedBy("ImfLock.class") void initializeImeLocked(@NonNull IInputMethodInvoker inputMethod, @NonNull IBinder token, @NonNull InputMethodBindingController bindingController) { - if (DEBUG) { - Slog.v(TAG, "Sending attach of token: " + token + " for display: " - + bindingController.getCurTokenDisplayId()); - } + ProtoLog.v(IMMS_DEBUG, "Sending attach of token: %s for display: %s", token, + bindingController.getCurTokenDisplayId()); final int userId = bindingController.getUserId(); final var userData = getUserData(userId); inputMethod.initializeInternal(token, @@ -2500,7 +2482,7 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. @GuardedBy("ImfLock.class") void requestClientSessionLocked(ClientState cs, @UserIdInt int userId) { if (!cs.mSessionRequested) { - if (DEBUG) Slog.v(TAG, "Creating new session for client " + cs); + ProtoLog.v(IMMS_DEBUG, "Creating new session for client %s", cs); final InputChannel serverChannel; final InputChannel clientChannel; { @@ -2541,7 +2523,7 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. @GuardedBy("ImfLock.class") void requestClientSessionForAccessibilityLocked(ClientState cs) { if (!cs.mSessionRequestedForAccessibility) { - if (DEBUG) Slog.v(TAG, "Creating new accessibility sessions for client " + cs); + ProtoLog.v(IMMS_DEBUG, "Creating new accessibility sessions for client %s", cs); cs.mSessionRequestedForAccessibility = true; ArraySet<Integer> ignoreSet = new ArraySet<>(); for (int i = 0; i < cs.mAccessibilitySessions.size(); i++) { @@ -2656,10 +2638,10 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. return; } if (iconId == 0) { - if (DEBUG) Slog.d(TAG, "hide the small icon for the input method"); + ProtoLog.v(IMMS_DEBUG, "hide the small icon for the input method"); hideStatusBarIconLocked(userId); } else if (packageName != null) { - if (DEBUG) Slog.d(TAG, "show a small icon for the input method"); + ProtoLog.v(IMMS_DEBUG, "show a small icon for the input method"); final PackageManager userAwarePackageManager = getPackageManagerForUser(mContext, userId); ApplicationInfo applicationInfo = null; @@ -2887,12 +2869,9 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. return; } final int curTokenDisplayId = bindingController.getCurTokenDisplayId(); - if (DEBUG) { - Slog.d(TAG, "IME window vis: " + vis - + " active: " + (vis & InputMethodService.IME_ACTIVE) - + " visible: " + (vis & InputMethodService.IME_VISIBLE) - + " displayId: " + curTokenDisplayId); - } + ProtoLog.v(IMMS_DEBUG, "IME window vis: %s active: %s visible: %s displayId: %s", vis, + (vis & InputMethodService.IME_ACTIVE), (vis & InputMethodService.IME_VISIBLE), + curTokenDisplayId); final IBinder focusedWindowToken = userData.mImeBindingState != null ? userData.mImeBindingState.mFocusedWindow : null; final Boolean windowPerceptible = focusedWindowToken != null @@ -2960,10 +2939,8 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. } if (ai != null && ai.enabledSetting == PackageManager.COMPONENT_ENABLED_STATE_DISABLED_UNTIL_USED) { - if (DEBUG) { - Slog.d(TAG, "Update state(" + imm.getId() - + "): DISABLED_UNTIL_USED -> DEFAULT"); - } + ProtoLog.v(IMMS_DEBUG, "Update state(%s): DISABLED_UNTIL_USED -> DEFAULT", + imm.getId()); userAwarePackageManager.setApplicationEnabledSetting(imm.getPackageName(), PackageManager.COMPONENT_ENABLED_STATE_DEFAULT, PackageManager.DONT_KILL_APP); @@ -2979,11 +2956,10 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. String defaultDeviceIme = SecureSettingsWrapper.getString( Settings.Secure.DEFAULT_DEVICE_INPUT_METHOD, null, userId); if (defaultDeviceIme != null && !Objects.equals(ime, defaultDeviceIme)) { - if (DEBUG) { - Slog.v(TAG, "Current input method " + ime + " differs from the stored default" - + " device input method for user " + userId - + " - restoring " + defaultDeviceIme); - } + ProtoLog.v(IMMS_DEBUG, + "Current input method %s differs from the stored default device input " + + "method for user %s - restoring %s", + ime, userId, defaultDeviceIme); SecureSettingsWrapper.putString( Settings.Secure.DEFAULT_INPUT_METHOD, defaultDeviceIme, userId); SecureSettingsWrapper.putString( @@ -3179,7 +3155,7 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. final var userData = getUserData(userId); final long ident = Binder.clearCallingIdentity(); try { - if (DEBUG) Slog.v(TAG, "Client requesting input be shown"); + ProtoLog.v(IMMS_DEBUG, "Client requesting input be shown"); if (Flags.refactorInsetsController()) { final var visibilityStateComputer = userData.mVisibilityStateComputer; boolean wasVisible = visibilityStateComputer.isInputShown(); @@ -3211,7 +3187,7 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. final int userId = resolveImeUserIdFromWindowLocked(windowToken); final long ident = Binder.clearCallingIdentity(); try { - if (DEBUG) Slog.v(TAG, "Client requesting input be shown"); + ProtoLog.v(IMMS_DEBUG, "Client requesting input be shown"); return showCurrentInputLocked(windowToken, statsToken, 0 /* flags */, 0 /* lastClickTooType */, null /* resultReceiver */, SoftInputShowHideReason.SHOW_SOFT_INPUT, userId); @@ -3231,7 +3207,7 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. final int userId = resolveImeUserIdFromWindowLocked(windowToken); final long ident = Binder.clearCallingIdentity(); try { - if (DEBUG) Slog.v(TAG, "Client requesting input be hidden"); + ProtoLog.v(IMMS_DEBUG, "Client requesting input be hidden"); return hideCurrentInputLocked(windowToken, statsToken, 0 /* flags */, null /* resultReceiver */, SoftInputShowHideReason.HIDE_SOFT_INPUT, userId); @@ -3365,7 +3341,7 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. + " Ignoring startStylusHandwriting()."); return false; } - if (DEBUG) Slog.v(TAG, "Client requesting Stylus Handwriting to be started"); + ProtoLog.v(IMMS_DEBUG, "Client requesting Stylus Handwriting to be started"); final IInputMethodInvoker curMethod = bindingController.getCurMethod(); if (curMethod != null) { curMethod.canStartStylusHandwriting(requestId.getAsInt(), @@ -3630,7 +3606,7 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. final long ident = Binder.clearCallingIdentity(); try { Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "IMMS.hideSoftInput"); - if (DEBUG) Slog.v(TAG, "Client requesting input be hidden"); + ProtoLog.v(IMMS_DEBUG, "Client requesting input be hidden"); if (Flags.refactorInsetsController()) { boolean wasVisible = visibilityStateComputer.isInputShown(); // TODO add windowToken to interface @@ -3830,10 +3806,9 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. // because if the focus changes some time before or after, the // next client receiving focus that has any interest in input will // be calling through here after that change happens. - if (DEBUG) { - Slog.w(TAG, "Focus gain on non-focused client " + cs.mClient - + " (uid=" + cs.mUid + " pid=" + cs.mPid + ")"); - } + ProtoLog.v(IMMS_DEBUG, + "Focus gain on non-focused client %s (uid=%s pid=%s)", + cs.mClient, cs.mUid, cs.mPid); return InputBindResult.NOT_IME_TARGET_WINDOW; case WindowManagerInternal.ImeClientFocusResult.INVALID_DISPLAY_ID: return InputBindResult.INVALID_DISPLAY_ID; @@ -3910,21 +3885,22 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. @Nullable IRemoteAccessibilityInputConnection remoteAccessibilityInputConnection, int unverifiedTargetSdkVersion, @NonNull InputMethodBindingController bindingController, @NonNull ImeOnBackInvokedDispatcher imeDispatcher, @NonNull ClientState cs) { - if (DEBUG) { - Slog.v(TAG, "startInputOrWindowGainedFocusInternalLocked: reason=" - + InputMethodDebug.startInputReasonToString(startInputReason) - + " client=" + client.asBinder() - + " inputContext=" + inputContext - + " editorInfo=" + editorInfo - + " startInputFlags=" - + InputMethodDebug.startInputFlagsToString(startInputFlags) - + " softInputMode=" + InputMethodDebug.softInputModeToString(softInputMode) - + " windowFlags=#" + Integer.toHexString(windowFlags) - + " unverifiedTargetSdkVersion=" + unverifiedTargetSdkVersion - + " bindingController=" + bindingController - + " imeDispatcher=" + imeDispatcher - + " cs=" + cs); - } + ProtoLog.v(IMMS_DEBUG, "startInputOrWindowGainedFocusInternalLocked: reason=%s" + + " client=%s" + + " inputContext=%s" + + " editorInfo=%s" + + " startInputFlags=%s" + + " softInputMode=%s" + + " windowFlags=#%s" + + " unverifiedTargetSdkVersion=%s" + + " bindingController=%s" + + " imeDispatcher=%s" + + " cs=%s", + InputMethodDebug.startInputReasonToString(startInputReason), client.asBinder(), + inputContext, editorInfo, InputMethodDebug.startInputFlagsToString(startInputFlags), + InputMethodDebug.softInputModeToString(softInputMode), + Integer.toHexString(windowFlags), unverifiedTargetSdkVersion, bindingController, + imeDispatcher, cs); final int userId = bindingController.getUserId(); final var userData = getUserData(userId); @@ -3944,12 +3920,11 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. visibilityStateComputer.setWindowState(windowToken, windowState); if (sameWindowFocused && isTextEditor) { - if (DEBUG) { - Slog.w(TAG, "Window already focused, ignoring focus gain of: " + client - + " editorInfo=" + editorInfo + ", token = " + windowToken - + ", startInputReason=" - + InputMethodDebug.startInputReasonToString(startInputReason)); - } + ProtoLog.v(IMMS_DEBUG, + "Window already focused, ignoring focus gain of: %s editorInfo=%s, token=%s, " + + "startInputReason=%s", + client, editorInfo, windowToken, + InputMethodDebug.startInputReasonToString(startInputReason)); if (editorInfo != null) { return startInputUncheckedLocked(cs, inputContext, remoteAccessibilityInputConnection, editorInfo, startInputFlags, @@ -4254,11 +4229,8 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. } if (!TextUtils.isEmpty(targetLastImiId)) { - if (DEBUG) { - Slog.d(TAG, "Switch to: " + lastImi.getId() + ", " + lastIme.second - + ", from: " + bindingController.getSelectedMethodId() + ", " - + subtypeIndex); - } + ProtoLog.v(IMMS_DEBUG, "Switch to: %s, %s, from: %s, %s", lastImi.getId(), + lastIme.second, bindingController.getSelectedMethodId(), subtypeIndex); setInputMethodWithSubtypeIndexLocked(targetLastImiId, subtypeIndex, userId); return true; } else { @@ -4557,7 +4529,7 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. } final long ident = Binder.clearCallingIdentity(); try { - if (DEBUG) Slog.v(TAG, "Adding virtual stylus id for session"); + ProtoLog.v(IMMS_DEBUG, "Adding virtual stylus id for session"); addStylusDeviceIdLocked(VIRTUAL_STYLUS_ID_FOR_TEST); } finally { Binder.restoreCallingIdentity(ident); @@ -4586,7 +4558,7 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. } final long ident = Binder.clearCallingIdentity(); try { - if (DEBUG) Slog.v(TAG, "Setting stylus window idle timeout"); + ProtoLog.v(IMMS_DEBUG, "Setting stylus window idle timeout"); getCurMethodLocked().setStylusWindowIdleTimeoutForTest(timeout); } finally { Binder.restoreCallingIdentity(ident); @@ -4731,9 +4703,7 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. @BinderThread @GuardedBy("ImfLock.class") private void notifyUserActionLocked(@NonNull UserData userData) { - if (DEBUG) { - Slog.d(TAG, "Got the notification of a user action."); - } + ProtoLog.v(IMMS_DEBUG, "Got the notification of a user action."); final var bindingController = userData.mBindingController; final InputMethodInfo imi = bindingController.getSelectedMethod(); if (imi != null) { @@ -4870,13 +4840,13 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. void setEnabledSessionLocked(SessionState session, @NonNull UserData userData) { if (userData.mEnabledSession != session) { if (userData.mEnabledSession != null && userData.mEnabledSession.mSession != null) { - if (DEBUG) Slog.v(TAG, "Disabling: " + userData.mEnabledSession); + ProtoLog.v(IMMS_DEBUG, "Disabling: " + userData.mEnabledSession); userData.mEnabledSession.mMethod.setSessionEnabled( userData.mEnabledSession.mSession, false); } userData.mEnabledSession = session; if (userData.mEnabledSession != null && userData.mEnabledSession.mSession != null) { - if (DEBUG) Slog.v(TAG, "Enabling: " + userData.mEnabledSession); + ProtoLog.v(IMMS_DEBUG, "Enabling: " + userData.mEnabledSession); userData.mEnabledSession.mMethod.setSessionEnabled( userData.mEnabledSession.mSession, true); } @@ -4961,13 +4931,12 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. } if (Flags.imeSwitcherRevamp()) { - if (DEBUG) { - Slog.v(TAG, "Show IME switcher menu," - + " showAuxSubtypes=" + showAuxSubtypes - + " displayId=" + displayId - + " preferredInputMethodId=" + lastInputMethodId - + " preferredInputMethodSubtypeIndex=" + lastInputMethodSubtypeIndex); - } + ProtoLog.v(IMMS_DEBUG, "Show IME switcher menu," + + " showAuxSubtypes=%s" + + " displayId=%s" + + " preferredInputMethodId=%s" + + " preferredInputMethodSubtypeIndex=%s", + showAuxSubtypes, displayId, lastInputMethodId, lastInputMethodSubtypeIndex); int selectedSubtypeIndex = lastInputMethodSubtypeIndex; if (selectedSubtypeIndex == NOT_A_SUBTYPE_INDEX) { @@ -5206,9 +5175,7 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. final InputMethodInfo imi = InputMethodInfoUtils.getMostApplicableDefaultIME( settings.getEnabledInputMethodList()); if (imi != null) { - if (DEBUG) { - Slog.d(TAG, "New default IME was selected: " + imi.getId()); - } + ProtoLog.v(IMMS_DEBUG, "New default IME was selected: %s", imi.getId()); resetSelectedInputMethodAndSubtypeLocked(imi.getId(), userId); return true; } @@ -5262,7 +5229,7 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. continue; } - if (DEBUG) Slog.d(TAG, "Checking " + imeId); + ProtoLog.v(IMMS_DEBUG, "Checking %s", imeId); try { final InputMethodInfo imi = new InputMethodInfo(userAwareContext, ri, @@ -5279,11 +5246,10 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. 1 + imiPackageCount.getOrDefault(packageName, 0)); methodMap.put(imi.getId(), imi); - if (DEBUG) { - Slog.d(TAG, "Found an input method " + imi); - } - } else if (DEBUG) { - Slog.d(TAG, "Found an input method, but ignored due threshold: " + imi); + ProtoLog.v(IMMS_DEBUG, "Found an input method %s", imi); + } else { + ProtoLog.v(IMMS_DEBUG, "Found an input method, but ignored due threshold: %s", + imi); } } catch (Exception e) { Slog.wtf(TAG, "Unable to load input method " + imeId, e); @@ -5295,10 +5261,8 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. @GuardedBy("ImfLock.class") void postInputMethodSettingUpdatedLocked(boolean resetDefaultEnabledIme, @UserIdInt int userId) { - if (DEBUG) { - Slog.d(TAG, "--- re-buildInputMethodList reset = " + resetDefaultEnabledIme - + " \n ------ caller=" + Debug.getCallers(10)); - } + ProtoLog.v(IMMS_DEBUG, "--- re-buildInputMethodList reset = %s" + + " \n ------ caller=%s", resetDefaultEnabledIme, Debug.getCallers(10)); if (!mSystemReady) { Slog.e(TAG, "buildInputMethodListLocked is not allowed until system is ready"); return; @@ -5324,15 +5288,12 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. } } if (!enabledImeFound) { - if (DEBUG) { - Slog.i(TAG, "All the enabled IMEs are gone. Reset default enabled IMEs."); - } + ProtoLog.v(IMMS_DEBUG, + "All the enabled IMEs are gone. Reset default enabled IMEs."); resetDefaultEnabledIme = true; resetSelectedInputMethodAndSubtypeLocked("", userId); } else if (!enabledNonAuxImeFound) { - if (DEBUG) { - Slog.i(TAG, "All the enabled non-Aux IMEs are gone. Do partial reset."); - } + ProtoLog.v(IMMS_DEBUG, "All the enabled non-Aux IMEs are gone. Do partial reset."); reenableMinimumNonAuxSystemImes = true; } } @@ -5344,9 +5305,7 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. final int numImes = defaultEnabledIme.size(); for (int i = 0; i < numImes; ++i) { final InputMethodInfo imi = defaultEnabledIme.get(i); - if (DEBUG) { - Slog.d(TAG, "--- enable ime = " + imi); - } + ProtoLog.v(IMMS_DEBUG, "--- enable ime = %s", imi); setInputMethodEnabledLocked(imi.getId(), true, userId); } } @@ -5422,10 +5381,8 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. final InputMethodInfo newSystemVoiceIme = InputMethodInfoUtils.chooseSystemVoiceIme( settings.getMethodMap(), systemSpeechRecognizer, currentDefaultVoiceImeId); if (newSystemVoiceIme == null) { - if (DEBUG) { - Slog.i(TAG, "Found no valid default Voice IME. If the user is still locked," - + " this may be expected."); - } + ProtoLog.v(IMMS_DEBUG, "Found no valid default Voice IME. If the user is still locked," + + " this may be expected."); // Clear DEFAULT_VOICE_INPUT_METHOD when necessary. Note that InputMethodSettings // does not update the actual Secure Settings until the user is unlocked. if (!TextUtils.isEmpty(currentDefaultVoiceImeId)) { @@ -5438,10 +5395,8 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. if (TextUtils.equals(currentDefaultVoiceImeId, newSystemVoiceIme.getId())) { return; } - if (DEBUG) { - Slog.i(TAG, "Enabling the default Voice IME:" + newSystemVoiceIme - + " userId:" + userId); - } + ProtoLog.v(IMMS_DEBUG, "Enabling the default Voice IME: %s userId: %s", newSystemVoiceIme, + userId); setInputMethodEnabledLocked(newSystemVoiceIme.getId(), true, userId); settings.putDefaultVoiceInputMethod(newSystemVoiceIme.getId()); } @@ -5940,10 +5895,8 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. final var bindingController = userData.mBindingController; // TODO(b/305829876): Implement user ID verification if (userData.mCurClient != null) { - if (DEBUG) { - Slog.v(TAG, "unbindAccessibilityFromCurrentClientLocked: client=" - + userData.mCurClient.mClient.asBinder()); - } + ProtoLog.v(IMMS_DEBUG, "unbindAccessibilityFromCurrentClientLocked: client=%s", + userData.mCurClient.mClient.asBinder()); // A11yManagerService unbinds the disabled accessibility service. We don't need // to do it here. userData.mCurClient.mClient.onUnbindAccessibilityService( diff --git a/services/core/java/com/android/server/location/contexthub/ContextHubEndpointManager.java b/services/core/java/com/android/server/location/contexthub/ContextHubEndpointManager.java index 740c4f195852..4389dd09ba73 100644 --- a/services/core/java/com/android/server/location/contexthub/ContextHubEndpointManager.java +++ b/services/core/java/com/android/server/location/contexthub/ContextHubEndpointManager.java @@ -30,6 +30,7 @@ import android.os.ServiceSpecificException; import android.util.Log; import com.android.internal.annotations.GuardedBy; +import com.android.internal.annotations.VisibleForTesting; import java.util.Collections; import java.util.HashMap; @@ -45,14 +46,14 @@ import java.util.function.Consumer; */ /* package */ class ContextHubEndpointManager implements ContextHubHalEndpointCallback.IEndpointSessionCallback { + /** The range of session IDs to use for endpoints */ + public static final int SERVICE_SESSION_RANGE = 1024; + private static final String TAG = "ContextHubEndpointManager"; /** The hub ID of the Context Hub Service. */ private static final long SERVICE_HUB_ID = 0x416e64726f696400L; - /** The range of session IDs to use for endpoints */ - private static final int SERVICE_SESSION_RANGE = 1024; - /** The length of the array that should be returned by HAL requestSessionIdRange */ private static final int SERVICE_SESSION_RANGE_LENGTH = 2; @@ -400,4 +401,16 @@ import java.util.function.Consumer; private boolean isSessionIdRangeValid(int minId, int maxId) { return (minId <= maxId) && (minId >= 0) && (maxId >= 0); } + + @VisibleForTesting + /* package */ int getNumAvailableSessions() { + synchronized (mSessionIdLock) { + return (mMaxSessionId - mMinSessionId + 1) - mReservedSessionIds.size(); + } + } + + @VisibleForTesting + /* package */ int getNumRegisteredClients() { + return mEndpointMap.size(); + } } diff --git a/services/core/java/com/android/server/media/quality/MediaQualityService.java b/services/core/java/com/android/server/media/quality/MediaQualityService.java index d00ac4d9cd11..c93f107d6640 100644 --- a/services/core/java/com/android/server/media/quality/MediaQualityService.java +++ b/services/core/java/com/android/server/media/quality/MediaQualityService.java @@ -1160,6 +1160,9 @@ public class MediaQualityService extends SystemService { private Bundle convertToCaps(ParameterRange range) { Bundle bundle = new Bundle(); + if (range == null || range.numRange == null) { + return bundle; + } bundle.putObject("INT_MIN_MAX", range.numRange.getIntMinMax()); bundle.putObject("INT_VALUES_SUPPORTED", range.numRange.getIntValuesSupported()); bundle.putObject("DOUBLE_MIN_MAX", range.numRange.getDoubleMinMax()); @@ -1351,7 +1354,7 @@ public class MediaQualityService extends SystemService { RemoteCallbackList<IPictureProfileCallback> { @Override public void onCallbackDied(IPictureProfileCallback callback) { - synchronized ("mPictureProfileLock") { //TODO: Change to lock + synchronized (mPictureProfileLock) { for (int i = 0; i < mUserStates.size(); i++) { int userId = mUserStates.keyAt(i); UserState userState = getOrCreateUserStateLocked(userId); @@ -1365,7 +1368,7 @@ public class MediaQualityService extends SystemService { RemoteCallbackList<ISoundProfileCallback> { @Override public void onCallbackDied(ISoundProfileCallback callback) { - synchronized ("mSoundProfileLock") { //TODO: Change to lock + synchronized (mSoundProfileLock) { for (int i = 0; i < mUserStates.size(); i++) { int userId = mUserStates.keyAt(i); UserState userState = getOrCreateUserStateLocked(userId); diff --git a/services/core/java/com/android/server/media/quality/MediaQualityUtils.java b/services/core/java/com/android/server/media/quality/MediaQualityUtils.java index 5bd4420e9944..ba61e508bef6 100644 --- a/services/core/java/com/android/server/media/quality/MediaQualityUtils.java +++ b/services/core/java/com/android/server/media/quality/MediaQualityUtils.java @@ -357,6 +357,9 @@ public final class MediaQualityUtils { */ public static PictureParameter[] convertPersistableBundleToPictureParameterList( PersistableBundle params) { + if (params == null) { + return null; + } List<PictureParameter> pictureParams = new ArrayList<>(); if (params.containsKey(PictureQuality.PARAMETER_BRIGHTNESS)) { pictureParams.add(PictureParameter.brightness(params.getLong( @@ -784,6 +787,9 @@ public final class MediaQualityUtils { */ public static SoundParameter[] convertPersistableBundleToSoundParameterList( PersistableBundle params) { + if (params == null) { + return null; + } //TODO: set EqualizerDetail List<SoundParameter> soundParams = new ArrayList<>(); if (params.containsKey(SoundQuality.PARAMETER_BALANCE)) { diff --git a/services/core/java/com/android/server/memory/OWNERS b/services/core/java/com/android/server/memory/OWNERS new file mode 100644 index 000000000000..dc0e89892e43 --- /dev/null +++ b/services/core/java/com/android/server/memory/OWNERS @@ -0,0 +1,3 @@ +include /MEMORY_OWNERS + +per-file ZramMaintenance.java = kawasin@google.com diff --git a/services/core/java/com/android/server/ZramMaintenance.java b/services/core/java/com/android/server/memory/ZramMaintenance.java index 099e5b3fe440..48358d130987 100644 --- a/services/core/java/com/android/server/ZramMaintenance.java +++ b/services/core/java/com/android/server/memory/ZramMaintenance.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.android.server; +package com.android.server.memory; import android.app.job.JobInfo; import android.app.job.JobParameters; diff --git a/services/core/java/com/android/server/pm/DexOptHelper.java b/services/core/java/com/android/server/pm/DexOptHelper.java index f011d283c8bb..4ee6e9773199 100644 --- a/services/core/java/com/android/server/pm/DexOptHelper.java +++ b/services/core/java/com/android/server/pm/DexOptHelper.java @@ -726,11 +726,9 @@ public final class DexOptHelper { } } - /** - * Returns DexoptOptions by the given InstallRequest. - */ - static DexoptOptions getDexoptOptionsByInstallRequest(InstallRequest installRequest, - DexManager dexManager) { + /** Returns DexoptOptions by the given InstallRequest. */ + private static DexoptOptions getDexoptOptionsByInstallRequest( + InstallRequest installRequest, DexManager dexManager) { final PackageSetting ps = installRequest.getScannedPackageSetting(); final String packageName = ps.getPackageName(); final boolean isBackupOrRestore = @@ -748,76 +746,74 @@ public final class DexOptHelper { var options = new DexoptOptions(packageName, compilationReason, dexoptFlags); if (installRequest.getDexoptCompilerFilter() != null) { options = options.overrideCompilerFilter(installRequest.getDexoptCompilerFilter()); - } else if (pkg != null && pkg.isDebuggable()) { + } else if (shouldSkipDexopt(installRequest)) { options = options.overrideCompilerFilter(DexoptParams.COMPILER_FILTER_NOOP); } return options; } - /** - * Perform dexopt if needed for the installation - */ - static void performDexoptIfNeeded(InstallRequest installRequest, DexManager dexManager, - Context context, PackageManagerTracedLock.RawLock installLock) { - // Construct the DexoptOptions early to see if we should skip running dexopt. - DexoptOptions dexoptOptions = getDexoptOptionsByInstallRequest(installRequest, dexManager); - boolean performDexopt = - DexOptHelper.shouldPerformDexopt(installRequest, dexoptOptions, context); - - if (performDexopt) { - // dexopt can take long, and ArtService doesn't require installd, so we release - // the lock here and re-acquire the lock after dexopt is finished. + /** Perform dexopt if needed for the installation */ + static void performDexoptIfNeeded( + InstallRequest installRequest, + DexManager dexManager, + PackageManagerTracedLock.RawLock installLock) { + if (!shouldCallArtService(installRequest)) { + return; + } + + // dexopt can take long, and ArtService doesn't require installd, so we release the lock + // here and re-acquire the lock after dexopt is finished. + if (installLock != null) { + installLock.unlock(); + } + try { + Trace.traceBegin(TRACE_TAG_PACKAGE_MANAGER, "dexopt"); + DexoptOptions dexoptOptions = + getDexoptOptionsByInstallRequest(installRequest, dexManager); + // Don't fail application installs if the dexopt step fails. + DexoptResult dexOptResult = + DexOptHelper.dexoptPackageUsingArtService(installRequest, dexoptOptions); + installRequest.onDexoptFinished(dexOptResult); + } finally { + Trace.traceEnd(TRACE_TAG_PACKAGE_MANAGER); if (installLock != null) { - installLock.unlock(); - } - try { - Trace.traceBegin(TRACE_TAG_PACKAGE_MANAGER, "dexopt"); - // Don't fail application installs if the dexopt step fails. - DexoptResult dexOptResult = DexOptHelper.dexoptPackageUsingArtService( - installRequest, dexoptOptions); - installRequest.onDexoptFinished(dexOptResult); - } finally { - Trace.traceEnd(TRACE_TAG_PACKAGE_MANAGER); - if (installLock != null) { - installLock.lock(); - } + installLock.lock(); } } } - /** - * Same as above, but runs asynchronously. - */ - static CompletableFuture<Void> performDexoptIfNeededAsync(InstallRequest installRequest, - DexManager dexManager, Context context) { - // Construct the DexoptOptions early to see if we should skip running dexopt. - DexoptOptions dexoptOptions = getDexoptOptionsByInstallRequest(installRequest, dexManager); - boolean performDexopt = - DexOptHelper.shouldPerformDexopt(installRequest, dexoptOptions, context); - - if (performDexopt) { - return CompletableFuture - .runAsync(() -> { - try { - Trace.traceBegin(TRACE_TAG_PACKAGE_MANAGER, "dexopt"); - // Don't fail application installs if the dexopt step fails. - // TODO(jiakaiz): Make this async in ART Service. - DexoptResult dexOptResult = DexOptHelper.dexoptPackageUsingArtService( - installRequest, dexoptOptions); - installRequest.onDexoptFinished(dexOptResult); - } finally { - Trace.traceEnd(TRACE_TAG_PACKAGE_MANAGER); - } - }, sDexoptExecutor) - .exceptionally((t) -> { - // This should never happen. A normal dexopt failure should result in a - // DexoptResult.DEXOPT_FAILED, not an exception. - Slog.wtf(TAG, "Dexopt encountered a fatal error", t); - return null; - }); - } else { + /** Same as above, but runs asynchronously. */ + static CompletableFuture<Void> performDexoptIfNeededAsync( + InstallRequest installRequest, DexManager dexManager) { + if (!shouldCallArtService(installRequest)) { return CompletableFuture.completedFuture(null); } + + return CompletableFuture.runAsync( + () -> { + try { + Trace.traceBegin(TRACE_TAG_PACKAGE_MANAGER, "dexopt"); + DexoptOptions dexoptOptions = + getDexoptOptionsByInstallRequest( + installRequest, dexManager); + // Don't fail application installs if the dexopt step fails. + // TODO(b/393076925): Make this async in ART Service. + DexoptResult dexOptResult = + DexOptHelper.dexoptPackageUsingArtService( + installRequest, dexoptOptions); + installRequest.onDexoptFinished(dexOptResult); + } finally { + Trace.traceEnd(TRACE_TAG_PACKAGE_MANAGER); + } + }, + sDexoptExecutor) + .exceptionally( + (t) -> { + // This should never happen. A normal dexopt failure should result + // in a DexoptResult.DEXOPT_FAILED, not an exception. + Slog.wtf(TAG, "Dexopt encountered a fatal error", t); + return null; + }); } /** @@ -852,43 +848,36 @@ public final class DexOptHelper { } } + private static boolean shouldSkipDexopt(InstallRequest installRequest) { + PackageSetting ps = installRequest.getScannedPackageSetting(); + AndroidPackage pkg = ps.getPkg(); + boolean onIncremental = isIncrementalPath(ps.getPathString()); + return pkg == null || pkg.isDebuggable() || onIncremental; + } + /** - * Returns whether to perform dexopt by the given InstallRequest. + * Returns whether to call ART Service to perform dexopt for the given InstallRequest. Note that + * ART Service may still skip dexopt, depending on the specified compiler filter, compilation + * reason, and other conditions. */ - static boolean shouldPerformDexopt(InstallRequest installRequest, DexoptOptions dexoptOptions, - Context context) { - // We only need to dexopt if the package meets ALL of the following conditions: - // 1) it is not an instant app or if it is then dexopt is enabled via gservices. - // 2) it is not debuggable. - // 3) it is not on Incremental File System. - // - // Note that we do not dexopt instant apps by default. dexopt can take some time to - // complete, so we skip this step during installation. Instead, we'll take extra time - // the first time the instant app starts. It's preferred to do it this way to provide - // continuous progress to the user instead of mysteriously blocking somewhere in the - // middle of running an instant app. The default behaviour can be overridden - // via gservices. - // - // Furthermore, dexopt may be skipped, depending on the install scenario and current - // state of the device. + private static boolean shouldCallArtService(InstallRequest installRequest) { final boolean isApex = ((installRequest.getScanFlags() & SCAN_AS_APEX) != 0); + // Historically, we did not dexopt instant apps, and we have no plan to do so in the + // future, so there is no need to call into ART Service. final boolean instantApp = ((installRequest.getScanFlags() & SCAN_AS_INSTANT_APP) != 0); final PackageSetting ps = installRequest.getScannedPackageSetting(); final AndroidPackage pkg = ps.getPkg(); - final boolean onIncremental = isIncrementalPath(ps.getPathString()); - final boolean performDexOptForRollback = Flags.recoverabilityDetection() - ? !(installRequest.isRollback() - && installRequest.getInstallSource().mInitiatingPackageName.equals("android")) - : true; - - // Don't skip the dexopt call if the compiler filter is "skip". Instead, call dexopt with - // the "skip" filter so that ART Service gets notified and skips dexopt itself. - return (!instantApp || Global.getInt(context.getContentResolver(), - Global.INSTANT_APP_DEXOPT_ENABLED, 0) != 0) - && pkg != null - && (!onIncremental) - && !isApex - && performDexOptForRollback; + final boolean performDexOptForRollback = + !(installRequest.isRollback() + && installRequest + .getInstallSource() + .mInitiatingPackageName + .equals("android")); + + // THINK TWICE when you add a new condition here. You probably want to add a condition to + // `shouldSkipDexopt` instead. In that way, ART Service will be called with the "skip" + // compiler filter and it will have the chance to decide whether to skip dexopt. + return !instantApp && pkg != null && !isApex && performDexOptForRollback; } private static class StagedApexObserver extends IStagedApexObserver.Stub { diff --git a/services/core/java/com/android/server/pm/InstallPackageHelper.java b/services/core/java/com/android/server/pm/InstallPackageHelper.java index 0c2782393879..476ba7bafdc4 100644 --- a/services/core/java/com/android/server/pm/InstallPackageHelper.java +++ b/services/core/java/com/android/server/pm/InstallPackageHelper.java @@ -1159,7 +1159,7 @@ final class InstallPackageHelper { } request.setKeepArtProfile(true); // TODO(b/388159696): Use performDexoptIfNeededAsync. - DexOptHelper.performDexoptIfNeeded(request, mDexManager, mContext, null); + DexOptHelper.performDexoptIfNeeded(request, mDexManager, null /* installLock */); } } @@ -2732,8 +2732,8 @@ final class InstallPackageHelper { | Installer.FLAG_CLEAR_CODE_CACHE_ONLY); } - DexOptHelper.performDexoptIfNeeded(installRequest, mDexManager, mContext, - mPm.mInstallLock.getRawLock()); + DexOptHelper.performDexoptIfNeeded( + installRequest, mDexManager, mPm.mInstallLock.getRawLock()); } } PackageManagerServiceUtils.waitForNativeBinariesExtractionForIncremental( diff --git a/services/core/java/com/android/server/pm/UserManagerService.java b/services/core/java/com/android/server/pm/UserManagerService.java index 7de7dde8c260..c7737e9f8bbd 100644 --- a/services/core/java/com/android/server/pm/UserManagerService.java +++ b/services/core/java/com/android/server/pm/UserManagerService.java @@ -129,6 +129,7 @@ import android.os.UserHandle; import android.os.UserManager; import android.os.UserManager.EnforcingUser; import android.os.UserManager.QuietModeFlag; +import android.os.UserManager.UserLogoutability; import android.os.storage.StorageManager; import android.os.storage.StorageManagerInternal; import android.provider.Settings; @@ -1472,10 +1473,13 @@ public class UserManagerService extends IUserManager.Stub { return UserHandle.USER_NULL; } - @Override public @CanBeNULL @UserIdInt int getPreviousFullUserToEnterForeground() { checkQueryOrCreateUsersPermission("get previous user"); + return getPreviousFullUserToEnterForegroundUnchecked(); + } + + private int getPreviousFullUserToEnterForegroundUnchecked() { int previousUser = UserHandle.USER_NULL; long latestEnteredTime = 0; final int currentUser = getCurrentUserId(); @@ -2915,7 +2919,8 @@ public class UserManagerService extends IUserManager.Stub { * @return A {@link UserManager.UserSwitchabilityResult} flag indicating if the user is * switchable. */ - public @UserManager.UserSwitchabilityResult int getUserSwitchability(int userId) { + @Override + public @UserManager.UserSwitchabilityResult int getUserSwitchability(@UserIdInt int userId) { if (Flags.getUserSwitchabilityPermission()) { if (!hasManageUsersOrPermission(android.Manifest.permission.INTERACT_ACROSS_USERS)) { throw new SecurityException( @@ -2994,6 +2999,49 @@ public class UserManagerService extends IUserManager.Stub { } @Override + public @UserLogoutability int getUserLogoutability(@UserIdInt int userId) { + if (!android.multiuser.Flags.logoutUserApi()) { + throw new UnsupportedOperationException( + "aconfig flag android.multiuser.logout_user_api not enabled"); + } + + checkManageUsersPermission("getUserLogoutability"); + + if (userId == UserHandle.USER_SYSTEM) { + return UserManager.LOGOUTABILITY_STATUS_CANNOT_LOGOUT_SYSTEM_USER; + } + + if (userId != getCurrentUserId()) { + // TODO(b/393656514): Decide what to do with non-current/background users. + // As of now, we are not going to logout a background user. A background user should + // simply be stopped instead. + return UserManager.LOGOUTABILITY_STATUS_CANNOT_SWITCH; + } + + if (getUserSwitchability(userId) != UserManager.SWITCHABILITY_STATUS_OK) { + return UserManager.LOGOUTABILITY_STATUS_CANNOT_SWITCH; + } + + if (getUserToLogoutCurrentUserTo() == UserHandle.USER_NULL) { + return UserManager.LOGOUTABILITY_STATUS_NO_SUITABLE_USER_TO_LOGOUT_TO; + } + + return UserManager.LOGOUTABILITY_STATUS_OK; + } + + /** + * Returns the user to switch to, when logging out current user. If in HSUM and has interactive + * system user, then logout would switch to the system user. Otherwise, logout would switch to + * the previous foreground user. + */ + private @UserIdInt int getUserToLogoutCurrentUserTo() { + if (isHeadlessSystemUserMode() && canSwitchToHeadlessSystemUser()) { + return USER_SYSTEM; + } + return getPreviousFullUserToEnterForegroundUnchecked(); + } + + @Override public boolean isUserSwitcherEnabled(boolean showEvenIfNotActionable, @UserIdInt int userId) { if (!isUserSwitcherEnabled(userId)) { diff --git a/services/core/java/com/android/server/power/stats/BatteryHistoryDirectory.java b/services/core/java/com/android/server/power/stats/BatteryHistoryDirectory.java new file mode 100644 index 000000000000..adf308a522ed --- /dev/null +++ b/services/core/java/com/android/server/power/stats/BatteryHistoryDirectory.java @@ -0,0 +1,573 @@ +/* + * Copyright (C) 2025 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.power.stats; + +import static android.os.Trace.TRACE_TAG_SYSTEM_SERVER; + +import android.annotation.NonNull; +import android.os.SystemClock; +import android.os.Trace; +import android.util.ArraySet; +import android.util.AtomicFile; +import android.util.Slog; + +import com.android.internal.annotations.VisibleForTesting; +import com.android.internal.os.BackgroundThread; +import com.android.internal.os.BatteryStatsHistory; +import com.android.internal.os.BatteryStatsHistory.BatteryHistoryFragment; + +import org.apache.commons.compress.compressors.gzip.GzipCompressorOutputStream; +import org.apache.commons.compress.compressors.gzip.GzipParameters; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.Locale; +import java.util.Set; +import java.util.concurrent.locks.ReentrantLock; +import java.util.zip.Deflater; +import java.util.zip.GZIPInputStream; + +public class BatteryHistoryDirectory implements BatteryStatsHistory.BatteryHistoryStore { + public static final String TAG = "BatteryHistoryDirectory"; + private static final boolean DEBUG = false; + + private static final String FILE_SUFFIX = ".bh"; + + // Size of the magic number written at the start of each history file + private static final int FILE_FORMAT_BYTES = 4; + private static final byte[] FILE_FORMAT_PARCEL = {0x50, 0x52, 0x43, 0x4c}; // PRCL + private static final byte[] FILE_FORMAT_COMPRESSED_PARCEL = {0x47, 0x5a, 0x49, 0x50}; // GZIP + + static class BatteryHistoryFile extends BatteryHistoryFragment { + public final AtomicFile atomicFile; + + BatteryHistoryFile(File directory, long monotonicTimeMs) { + super(monotonicTimeMs); + atomicFile = new AtomicFile(new File(directory, monotonicTimeMs + FILE_SUFFIX)); + } + + @Override + public String toString() { + return atomicFile.getBaseFile().toString(); + } + } + + interface Compressor { + void compress(OutputStream stream, byte[] data) throws IOException; + void uncompress(byte[] data, InputStream stream) throws IOException; + + default void readFully(byte[] data, InputStream stream) throws IOException { + int pos = 0; + while (pos < data.length) { + int count = stream.read(data, pos, data.length - pos); + if (count == -1) { + throw new IOException("Invalid battery history file format"); + } + pos += count; + } + } + } + + static final Compressor DEFAULT_COMPRESSOR = new Compressor() { + @Override + public void compress(OutputStream stream, byte[] data) throws IOException { + // With the BEST_SPEED hint, we see ~4x improvement in write latency over + // GZIPOutputStream. + GzipParameters parameters = new GzipParameters(); + parameters.setCompressionLevel(Deflater.BEST_SPEED); + GzipCompressorOutputStream os = new GzipCompressorOutputStream(stream, parameters); + os.write(data); + os.finish(); + os.flush(); + } + + @Override + public void uncompress(byte[] data, InputStream stream) throws IOException { + readFully(data, new GZIPInputStream(stream)); + } + }; + + private final File mDirectory; + private int mMaxHistorySize; + private boolean mInitialized; + private final List<BatteryHistoryFile> mHistoryFiles = new ArrayList<>(); + private final ReentrantLock mLock = new ReentrantLock(); + private final Compressor mCompressor; + private boolean mWaitForDirectoryLock = false; + private boolean mFileCompressionEnabled; + + public BatteryHistoryDirectory(@NonNull File directory, int maxHistorySize) { + this(directory, maxHistorySize, DEFAULT_COMPRESSOR); + } + + public BatteryHistoryDirectory(@NonNull File directory, int maxHistorySize, + Compressor compressor) { + mDirectory = directory; + mMaxHistorySize = maxHistorySize; + if (mMaxHistorySize == 0) { + Slog.w(TAG, "maxHistorySize should not be zero"); + } + mCompressor = compressor; + } + + public void setFileCompressionEnabled(boolean enabled) { + mFileCompressionEnabled = enabled; + } + + void setMaxHistorySize(int maxHistorySize) { + mMaxHistorySize = maxHistorySize; + trim(); + } + + /** + * Returns the maximum storage size allocated to battery history. + */ + public int getMaxHistorySize() { + return mMaxHistorySize; + } + + @Override + public void lock() { + mLock.lock(); + } + + /** + * Turns "tryLock" into "lock" to prevent flaky unit tests. + * Should only be called from unit tests. + */ + @VisibleForTesting + void makeDirectoryLockUnconditional() { + mWaitForDirectoryLock = true; + } + + @Override + public boolean tryLock() { + if (mWaitForDirectoryLock) { + mLock.lock(); + return true; + } + return mLock.tryLock(); + } + + @Override + public void writeFragment(BatteryHistoryFragment fragment, + @NonNull byte[] data, boolean fragmentComplete) { + AtomicFile file = ((BatteryHistoryFile) fragment).atomicFile; + FileOutputStream fos = null; + try { + final long startTimeMs = SystemClock.uptimeMillis(); + fos = file.startWrite(); + fos.write(FILE_FORMAT_PARCEL); + writeInt(fos, data.length); + fos.write(data); + fos.flush(); + file.finishWrite(fos); + if (DEBUG) { + Slog.d(TAG, "writeHistoryFragment file:" + file.getBaseFile().getPath() + + " duration ms:" + (SystemClock.uptimeMillis() - startTimeMs) + + " bytes:" + data.length); + } + if (fragmentComplete) { + if (mFileCompressionEnabled) { + BackgroundThread.getHandler().post( + () -> writeHistoryFragmentCompressed(file, data)); + } + BackgroundThread.getHandler().post(()-> trim()); + } + } catch (IOException e) { + Slog.w(TAG, "Error writing battery history fragment", e); + file.failWrite(fos); + } + } + + private void writeHistoryFragmentCompressed(AtomicFile file, byte[] data) { + long uncompressedSize = data.length; + if (uncompressedSize == 0) { + return; + } + + Trace.traceBegin(TRACE_TAG_SYSTEM_SERVER, "BatteryStatsHistory.compressHistoryFile"); + lock(); + FileOutputStream fos = null; + try { + long startTimeNs = System.nanoTime(); + fos = file.startWrite(); + fos.write(FILE_FORMAT_COMPRESSED_PARCEL); + writeInt(fos, data.length); + + mCompressor.compress(fos, data); + file.finishWrite(fos); + + if (DEBUG) { + long endTimeNs = System.nanoTime(); + long compressedSize = file.getBaseFile().length(); + Slog.i(TAG, String.format(Locale.ENGLISH, + "Compressed battery history file %s original size: %d compressed: %d " + + "(%.1f%%) elapsed: %.2f ms", + file.getBaseFile(), uncompressedSize, compressedSize, + (uncompressedSize - compressedSize) * 100.0 / uncompressedSize, + (endTimeNs - startTimeNs) / 1000000.0)); + } + } catch (Exception e) { + Slog.w(TAG, "Error compressing battery history chunk " + file, e); + file.failWrite(fos); + } finally { + unlock(); + Trace.traceEnd(TRACE_TAG_SYSTEM_SERVER); + } + } + + @Override + public byte[] readFragment(BatteryHistoryFragment fragment) { + AtomicFile file = ((BatteryHistoryFile) fragment).atomicFile; + if (!file.exists()) { + deleteFragment(fragment); + return null; + } + final long start = SystemClock.uptimeMillis(); + Trace.traceBegin(TRACE_TAG_SYSTEM_SERVER, "BatteryStatsHistory.read"); + try (FileInputStream stream = file.openRead()) { + byte[] header = new byte[FILE_FORMAT_BYTES]; + if (stream.read(header, 0, FILE_FORMAT_BYTES) == -1) { + Slog.e(TAG, "Invalid battery history file format " + file.getBaseFile()); + deleteFragment(fragment); + return null; + } + + boolean isCompressed; + if (Arrays.equals(header, FILE_FORMAT_COMPRESSED_PARCEL)) { + isCompressed = true; + } else if (Arrays.equals(header, FILE_FORMAT_PARCEL)) { + isCompressed = false; + } else { + Slog.e(TAG, "Invalid battery history file format " + file.getBaseFile()); + deleteFragment(fragment); + return null; + } + + int size = readInt(stream); + if (size < 0 || size > 10000000) { // Validity check to avoid a crash + Slog.e(TAG, "Invalid battery history file format " + file.getBaseFile()); + deleteFragment(fragment); + return null; + } + + byte[] data = new byte[size]; + if (isCompressed) { + mCompressor.uncompress(data, stream); + } else { + int pos = 0; + while (pos < data.length) { + int count = stream.read(data, pos, data.length - pos); + if (count == -1) { + throw new IOException("Invalid battery history file format"); + } + pos += count; + } + } + if (DEBUG) { + Slog.d(TAG, "readHistoryFragment:" + file.getBaseFile().getPath() + + " duration ms:" + (SystemClock.uptimeMillis() - start)); + } + return data; + } catch (Exception e) { + Slog.e(TAG, "Error reading file " + file.getBaseFile().getPath(), e); + deleteFragment(fragment); + return null; + } finally { + Trace.traceEnd(TRACE_TAG_SYSTEM_SERVER); + } + } + + private void deleteFragment(BatteryHistoryFragment fragment) { + mHistoryFiles.remove(fragment); + ((BatteryHistoryFile) fragment).atomicFile.delete(); + } + + @Override + public void unlock() { + mLock.unlock(); + } + + @Override + public boolean isLocked() { + return mLock.isLocked(); + } + + private void ensureInitialized() { + if (mInitialized) { + return; + } + + Trace.asyncTraceBegin(TRACE_TAG_SYSTEM_SERVER, "BatteryStatsHistory.load", 0); + mDirectory.mkdirs(); + if (!mDirectory.exists()) { + Slog.wtf(TAG, "HistoryDir does not exist:" + mDirectory.getPath()); + } + + final List<File> toRemove = new ArrayList<>(); + final Set<BatteryHistoryFile> dedup = new ArraySet<>(); + mDirectory.listFiles((dir, name) -> { + final int b = name.lastIndexOf(FILE_SUFFIX); + if (b <= 0) { + toRemove.add(new File(dir, name)); + return false; + } + try { + long monotonicTime = Long.parseLong(name.substring(0, b)); + dedup.add(new BatteryHistoryFile(mDirectory, monotonicTime)); + } catch (NumberFormatException e) { + toRemove.add(new File(dir, name)); + return false; + } + return true; + }); + if (!dedup.isEmpty()) { + mHistoryFiles.addAll(dedup); + Collections.sort(mHistoryFiles); + } + mInitialized = true; + if (!toRemove.isEmpty()) { + // Clear out legacy history files, which did not follow the X-Y.bin naming format. + BackgroundThread.getHandler().post(() -> { + lock(); + try { + for (File file : toRemove) { + file.delete(); + } + } finally { + unlock(); + Trace.asyncTraceEnd(TRACE_TAG_SYSTEM_SERVER, "BatteryStatsHistory.load", 0); + } + }); + } else { + Trace.asyncTraceEnd(TRACE_TAG_SYSTEM_SERVER, "BatteryStatsHistory.load", 0); + } + } + + @SuppressWarnings("unchecked") + @Override + public List<BatteryHistoryFragment> getFragments() { + ensureInitialized(); + return (List<BatteryHistoryFragment>) + (List<? extends BatteryHistoryFragment>) mHistoryFiles; + } + + @VisibleForTesting + List<String> getFileNames() { + ensureInitialized(); + lock(); + try { + List<String> names = new ArrayList<>(); + for (BatteryHistoryFile historyFile : mHistoryFiles) { + names.add(historyFile.atomicFile.getBaseFile().getName()); + } + return names; + } finally { + unlock(); + } + } + + @Override + public BatteryHistoryFragment getEarliestFragment() { + ensureInitialized(); + lock(); + try { + if (!mHistoryFiles.isEmpty()) { + return mHistoryFiles.get(0); + } + return null; + } finally { + unlock(); + } + } + + @Override + public BatteryHistoryFragment getLatestFragment() { + ensureInitialized(); + lock(); + try { + if (!mHistoryFiles.isEmpty()) { + return mHistoryFiles.get(mHistoryFiles.size() - 1); + } + return null; + } finally { + unlock(); + } + } + + @Override + public BatteryHistoryFragment createFragment(long monotonicStartTime) { + ensureInitialized(); + + BatteryHistoryFile file = new BatteryHistoryFile(mDirectory, monotonicStartTime); + lock(); + try { + try { + file.atomicFile.getBaseFile().createNewFile(); + } catch (IOException e) { + Slog.e(TAG, "Could not create history file: " + file); + } + mHistoryFiles.add(file); + } finally { + unlock(); + } + + return file; + } + + @Override + public BatteryHistoryFragment getNextFragment(BatteryHistoryFragment current, long startTimeMs, + long endTimeMs) { + ensureInitialized(); + + if (!mLock.isHeldByCurrentThread()) { + throw new IllegalStateException("Iterating battery history without a lock"); + } + + int nextFileIndex = 0; + int firstFileIndex = 0; + // skip the last file because its data is in history buffer. + int lastFileIndex = mHistoryFiles.size() - 2; + for (int i = lastFileIndex; i >= 0; i--) { + BatteryHistoryFragment fragment = mHistoryFiles.get(i); + if (current != null && fragment.monotonicTimeMs == current.monotonicTimeMs) { + nextFileIndex = i + 1; + } + if (fragment.monotonicTimeMs > endTimeMs) { + lastFileIndex = i - 1; + } + if (fragment.monotonicTimeMs <= startTimeMs) { + firstFileIndex = i; + break; + } + } + + if (nextFileIndex < firstFileIndex) { + nextFileIndex = firstFileIndex; + } + + if (nextFileIndex <= lastFileIndex) { + return mHistoryFiles.get(nextFileIndex); + } + + return null; + } + + @Override + public boolean hasCompletedFragments() { + ensureInitialized(); + + lock(); + try { + // Active file is partial and does not count as "competed" + return mHistoryFiles.size() > 1; + } finally { + unlock(); + } + } + + @Override + public int getSize() { + ensureInitialized(); + + lock(); + try { + int ret = 0; + for (int i = 0; i < mHistoryFiles.size() - 1; i++) { + ret += (int) mHistoryFiles.get(i).atomicFile.getBaseFile().length(); + } + return ret; + } finally { + unlock(); + } + } + + @Override + public void reset() { + ensureInitialized(); + + lock(); + try { + if (DEBUG) { + Slog.i(TAG, "********** CLEARING HISTORY!"); + } + for (BatteryHistoryFile file : mHistoryFiles) { + file.atomicFile.delete(); + } + mHistoryFiles.clear(); + } finally { + unlock(); + } + } + + private void trim() { + ensureInitialized(); + + Trace.traceBegin(TRACE_TAG_SYSTEM_SERVER, "BatteryStatsHistory.trim"); + try { + lock(); + try { + // if there is more history stored than allowed, delete oldest history files. + int size = 0; + for (int i = 0; i < mHistoryFiles.size(); i++) { + size += (int) mHistoryFiles.get(i).atomicFile.getBaseFile().length(); + } + while (size > mMaxHistorySize) { + BatteryHistoryFile oldest = mHistoryFiles.get(0); + int length = (int) oldest.atomicFile.getBaseFile().length(); + oldest.atomicFile.delete(); + mHistoryFiles.remove(0); + size -= length; + } + } finally { + unlock(); + } + } finally { + Trace.traceEnd(TRACE_TAG_SYSTEM_SERVER); + } + } + + private static void writeInt(OutputStream stream, int value) throws IOException { + stream.write(value >> 24); + stream.write(value >> 16); + stream.write(value >> 8); + stream.write(value >> 0); + } + + private static int readInt(InputStream stream) throws IOException { + return (readByte(stream) << 24) + | (readByte(stream) << 16) + | (readByte(stream) << 8) + | (readByte(stream) << 0); + } + + private static int readByte(InputStream stream) throws IOException { + int out = stream.read(); + if (out == -1) { + throw new IOException(); + } + return out; + } +} diff --git a/services/core/java/com/android/server/power/stats/BatteryStatsImpl.java b/services/core/java/com/android/server/power/stats/BatteryStatsImpl.java index 68768b8fa223..90bc54b06c0a 100644 --- a/services/core/java/com/android/server/power/stats/BatteryStatsImpl.java +++ b/services/core/java/com/android/server/power/stats/BatteryStatsImpl.java @@ -195,6 +195,8 @@ public class BatteryStatsImpl extends BatteryStats { private static final boolean DEBUG_BINDER_STATS = false; private static final boolean DEBUG_MEMORY = false; + private static final String HISTORY_DIR = "battery-history"; + // TODO: remove "tcp" from network methods, since we measure total stats. // Current on-disk Parcel version. Must be updated when the format of the parcelable changes @@ -1143,6 +1145,8 @@ public class BatteryStatsImpl extends BatteryStats { private int mBatteryTemperature; private int mBatteryVoltageMv; + @Nullable + private final BatteryHistoryDirectory mBatteryHistoryDirectory; @NonNull private final BatteryStatsHistory mHistory; @@ -11476,7 +11480,10 @@ public class BatteryStatsImpl extends BatteryStats { @NonNull UserInfoProvider userInfoProvider, @NonNull PowerProfile powerProfile, @NonNull CpuScalingPolicies cpuScalingPolicies, @NonNull PowerStatsUidResolver powerStatsUidResolver) { - this(config, clock, monotonicClock, systemDir, handler, platformIdleStateCallback, + this(config, clock, monotonicClock, systemDir, + systemDir != null ? new BatteryHistoryDirectory(new File(systemDir, HISTORY_DIR), + config.getMaxHistorySizeBytes()) : null, + handler, platformIdleStateCallback, energyStatsRetriever, userInfoProvider, powerProfile, cpuScalingPolicies, powerStatsUidResolver, new FrameworkStatsLogger(), new BatteryStatsHistory.TraceDelegate(), new BatteryStatsHistory.EventLogger()); @@ -11484,6 +11491,7 @@ public class BatteryStatsImpl extends BatteryStats { public BatteryStatsImpl(@NonNull BatteryStatsConfig config, @NonNull Clock clock, @NonNull MonotonicClock monotonicClock, @Nullable File systemDir, + @Nullable BatteryHistoryDirectory batteryHistoryDirectory, @NonNull Handler handler, @Nullable PlatformIdleStateCallback platformIdleStateCallback, @Nullable EnergyStatsRetriever energyStatsRetriever, @NonNull UserInfoProvider userInfoProvider, @NonNull PowerProfile powerProfile, @@ -11517,9 +11525,10 @@ public class BatteryStatsImpl extends BatteryStats { mDailyFile = null; } - mHistory = new BatteryStatsHistory(null /* historyBuffer */, systemDir, - mConstants.MAX_HISTORY_SIZE, mConstants.MAX_HISTORY_BUFFER, mStepDetailsCalculator, - mClock, mMonotonicClock, traceDelegate, eventLogger); + mBatteryHistoryDirectory = batteryHistoryDirectory; + mHistory = new BatteryStatsHistory(null /* historyBuffer */, mConstants.MAX_HISTORY_BUFFER, + mBatteryHistoryDirectory, mStepDetailsCalculator, mClock, mMonotonicClock, + traceDelegate, eventLogger); mCpuPowerStatsCollector = new CpuPowerStatsCollector(mPowerStatsCollectorInjector); mCpuPowerStatsCollector.addConsumer(this::recordPowerStats); @@ -12060,7 +12069,7 @@ public class BatteryStatsImpl extends BatteryStats { } public int getHistoryTotalSize() { - return mHistory.getMaxHistorySize(); + return mBatteryHistoryDirectory.getMaxHistorySize(); } public int getHistoryUsedSize() { @@ -12160,6 +12169,13 @@ public class BatteryStatsImpl extends BatteryStats { mResetBatteryHistoryOnNewSession = enabled; } + /** + * Enables or disables battery history file compression. + */ + public void setBatteryHistoryCompressionEnabled(boolean enabled) { + mBatteryHistoryDirectory.setFileCompressionEnabled(enabled); + } + @GuardedBy("this") public void resetAllStatsAndHistoryLocked(int reason) { final long mSecUptime = mClock.uptimeMillis(); @@ -16354,7 +16370,9 @@ public class BatteryStatsImpl extends BatteryStats { */ @VisibleForTesting public void onChange() { - mHistory.setMaxHistorySize(MAX_HISTORY_SIZE); + if (mBatteryHistoryDirectory != null) { + mBatteryHistoryDirectory.setMaxHistorySize(MAX_HISTORY_SIZE); + } mHistory.setMaxHistoryBufferSize(MAX_HISTORY_BUFFER); } diff --git a/services/core/java/com/android/server/power/stats/OWNERS b/services/core/java/com/android/server/power/stats/OWNERS index 4068e2bc03b7..208b2ddb5e54 100644 --- a/services/core/java/com/android/server/power/stats/OWNERS +++ b/services/core/java/com/android/server/power/stats/OWNERS @@ -1 +1,4 @@ +# Bug component: 987260 +set noparent + include /BATTERY_STATS_OWNERS diff --git a/services/core/java/com/android/server/power/stats/flags.aconfig b/services/core/java/com/android/server/power/stats/flags.aconfig index c8dbbd29823c..521ee58decea 100644 --- a/services/core/java/com/android/server/power/stats/flags.aconfig +++ b/services/core/java/com/android/server/power/stats/flags.aconfig @@ -97,3 +97,13 @@ flag { purpose: PURPOSE_BUGFIX } } + +flag { + name: "extended_battery_history_compression_enabled" + namespace: "backstage_power" + description: "Compress each battery history chunk on disk" + bug: "381937912" + metadata { + purpose: PURPOSE_BUGFIX + } +} diff --git a/services/core/java/com/android/server/sensorprivacy/SensorPrivacyService.java b/services/core/java/com/android/server/sensorprivacy/SensorPrivacyService.java index 81217014bafe..16658e360cba 100644 --- a/services/core/java/com/android/server/sensorprivacy/SensorPrivacyService.java +++ b/services/core/java/com/android/server/sensorprivacy/SensorPrivacyService.java @@ -536,8 +536,12 @@ public final class SensorPrivacyService extends SystemService { user.getIdentifier()); String inputMethodPackageName = null; if (inputMethodComponent != null) { - inputMethodPackageName = ComponentName.unflattenFromString( - inputMethodComponent).getPackageName(); + ComponentName component = ComponentName.unflattenFromString(inputMethodComponent); + if (component != null) { + inputMethodPackageName = component.getPackageName(); + } else { + Log.w(TAG, "Failed to parse inputMethodComponent: " + inputMethodComponent); + } } int capability; diff --git a/services/core/java/com/android/server/wm/ActivityStarter.java b/services/core/java/com/android/server/wm/ActivityStarter.java index 6f76618b0029..247264f049d6 100644 --- a/services/core/java/com/android/server/wm/ActivityStarter.java +++ b/services/core/java/com/android/server/wm/ActivityStarter.java @@ -3035,6 +3035,12 @@ class ActivityStarter { } } + if (com.android.window.flags.Flags.fixLayoutExistingTask()) { + // Layout the task to ensure the Task is in correct bounds. + mSupervisor.getLaunchParamsController().layoutTask(intentTask, + mStartActivity.info.windowLayout, mStartActivity, mSourceRecord, mOptions); + } + // If the target task is not in the front, then we need to bring it to the front. final boolean differentTopTask; if (mTargetRootTask.getDisplayArea() == mPreferredTaskDisplayArea) { diff --git a/services/core/java/com/android/server/wm/AppCompatConfiguration.java b/services/core/java/com/android/server/wm/AppCompatConfiguration.java index 9a15c4a8bff2..0d8950b6cc45 100644 --- a/services/core/java/com/android/server/wm/AppCompatConfiguration.java +++ b/services/core/java/com/android/server/wm/AppCompatConfiguration.java @@ -311,7 +311,7 @@ final class AppCompatConfiguration { // Whether should ignore app requested orientation in response to an app // calling Activity#setRequestedOrientation. See - // LetterboxUiController#shouldIgnoreRequestedOrientation for details. + // AppCompatOrientationPolicy#shouldIgnoreRequestedOrientation for details. private final boolean mIsPolicyForIgnoringRequestedOrientationEnabled; // Flags dynamically updated with {@link android.provider.DeviceConfig}. @@ -1259,7 +1259,7 @@ final class AppCompatConfiguration { /** * Whether should ignore app requested orientation in response to an app calling * {@link android.app.Activity#setRequestedOrientation}. See {@link - * LetterboxUiController#shouldIgnoreRequestedOrientation} for details. + * AppCompatOrientationPolicy#shouldIgnoreRequestedOrientation} for details. */ boolean isPolicyForIgnoringRequestedOrientationEnabled() { return mIsPolicyForIgnoringRequestedOrientationEnabled; diff --git a/services/core/java/com/android/server/wm/AppCompatReachabilityPolicy.java b/services/core/java/com/android/server/wm/AppCompatReachabilityPolicy.java index a7c52bd1fc38..b47786675fc9 100644 --- a/services/core/java/com/android/server/wm/AppCompatReachabilityPolicy.java +++ b/services/core/java/com/android/server/wm/AppCompatReachabilityPolicy.java @@ -32,6 +32,7 @@ import android.annotation.Nullable; import android.graphics.Rect; import com.android.internal.annotations.VisibleForTesting; +import com.android.window.flags.Flags; import java.io.PrintWriter; import java.util.function.Supplier; @@ -97,8 +98,11 @@ class AppCompatReachabilityPolicy { private void handleHorizontalDoubleTap(int x) { final AppCompatReachabilityOverrides reachabilityOverrides = mActivityRecord.mAppCompatController.getReachabilityOverrides(); - if (!reachabilityOverrides.isHorizontalReachabilityEnabled() - || mActivityRecord.isInTransition()) { + // We don't return early when the Shell letterbox implementation is enabled because + // double tap is always sent via transitions. + final boolean isInTransition = !Flags.appCompatRefactoring() + && mActivityRecord.isInTransition(); + if (!reachabilityOverrides.isHorizontalReachabilityEnabled() || isInTransition) { return; } final Rect letterboxInnerFrame = getLetterboxInnerFrame(); @@ -143,8 +147,11 @@ class AppCompatReachabilityPolicy { private void handleVerticalDoubleTap(int y) { final AppCompatReachabilityOverrides reachabilityOverrides = mActivityRecord.mAppCompatController.getReachabilityOverrides(); - if (!reachabilityOverrides.isVerticalReachabilityEnabled() - || mActivityRecord.isInTransition()) { + // We don't return early when the Shell letterbox implementation is enabled because + // double tap is always sent via transitions. + final boolean isInTransition = !Flags.appCompatRefactoring() + && mActivityRecord.isInTransition(); + if (!reachabilityOverrides.isVerticalReachabilityEnabled() || isInTransition) { return; } final Rect letterboxInnerFrame = getLetterboxInnerFrame(); diff --git a/services/core/java/com/android/server/wm/DesktopModeLaunchParamsModifier.java b/services/core/java/com/android/server/wm/DesktopModeLaunchParamsModifier.java index 548addbef39d..ac987929a142 100644 --- a/services/core/java/com/android/server/wm/DesktopModeLaunchParamsModifier.java +++ b/services/core/java/com/android/server/wm/DesktopModeLaunchParamsModifier.java @@ -74,6 +74,12 @@ class DesktopModeLaunchParamsModifier implements LaunchParamsModifier { appendLog("task null, skipping"); return RESULT_SKIP; } + if (com.android.window.flags.Flags.fixLayoutExistingTask() + && task.getOrganizedTask() != null) { + appendLog("task is organized, skipping"); + return RESULT_SKIP; + } + if (!task.isActivityTypeStandardOrUndefined()) { appendLog("not standard or undefined activity type, skipping"); return RESULT_SKIP; diff --git a/services/core/java/com/android/server/wm/LaunchParamsController.java b/services/core/java/com/android/server/wm/LaunchParamsController.java index 4f5c0c8ecf6e..fa65bda7104d 100644 --- a/services/core/java/com/android/server/wm/LaunchParamsController.java +++ b/services/core/java/com/android/server/wm/LaunchParamsController.java @@ -124,31 +124,19 @@ class LaunchParamsController { } } - /** - * A convenience method for laying out a task. - * @return {@code true} if bounds were set on the task. {@code false} otherwise. - */ - boolean layoutTask(Task task, WindowLayout layout) { - return layoutTask(task, layout, null /*activity*/, null /*source*/, null /*options*/); - } - + /** @return {@code true} if bounds were set on the task. {@code false} otherwise. */ boolean layoutTask(Task task, WindowLayout layout, ActivityRecord activity, ActivityRecord source, ActivityOptions options) { calculate(task, layout, activity, source, options, null /* request */, PHASE_BOUNDS, mTmpParams); // No changes, return. - if (mTmpParams.isEmpty()) { + if (mTmpParams.isEmpty() || mTmpParams.mBounds.isEmpty()) { return false; } mService.deferWindowLayout(); - try { - if (mTmpParams.mBounds.isEmpty()) { - return false; - } - if (task.getRootTask().inMultiWindowMode()) { task.setBounds(mTmpParams.mBounds); return true; diff --git a/services/core/java/com/android/server/wm/Task.java b/services/core/java/com/android/server/wm/Task.java index a8686d3e4ea7..4b07e9e232be 100644 --- a/services/core/java/com/android/server/wm/Task.java +++ b/services/core/java/com/android/server/wm/Task.java @@ -5232,7 +5232,6 @@ class Task extends TaskFragment { final boolean[] resumed = new boolean[1]; final TaskFragment topFragment = topActivity.getTaskFragment(); - resumed[0] = topFragment.resumeTopActivity(prev, options, deferPause); forAllLeafTaskFragments(f -> { if (topFragment == f) { return; @@ -5242,6 +5241,7 @@ class Task extends TaskFragment { } resumed[0] |= f.resumeTopActivity(prev, options, deferPause); }, true); + resumed[0] |= topFragment.resumeTopActivity(prev, options, deferPause); return resumed[0]; } @@ -6033,7 +6033,7 @@ class Task extends TaskFragment { IVoiceInteractor voiceInteractor, boolean toTop, ActivityRecord activity, ActivityRecord source, ActivityOptions options) { - Task task; + final Task task; if (canReuseAsLeafTask()) { // This root task will only contain one task, so just return itself since all root // tasks ara now tasks and all tasks are now root tasks. @@ -6043,7 +6043,6 @@ class Task extends TaskFragment { final int taskId = activity != null ? mTaskSupervisor.getNextTaskIdForUser(activity.mUserId) : mTaskSupervisor.getNextTaskIdForUser(); - final int activityType = getActivityType(); task = new Task.Builder(mAtmService) .setTaskId(taskId) .setActivityInfo(info) @@ -6056,17 +6055,21 @@ class Task extends TaskFragment { .build(); } - int displayId = getDisplayId(); - if (displayId == INVALID_DISPLAY) displayId = DEFAULT_DISPLAY; - final boolean isLockscreenShown = mAtmService.mTaskSupervisor.getKeyguardController() - .isKeyguardOrAodShowing(displayId); - if (!mTaskSupervisor.getLaunchParamsController() - .layoutTask(task, info.windowLayout, activity, source, options) - && !getRequestedOverrideBounds().isEmpty() - && task.isResizeable() && !isLockscreenShown) { - task.setBounds(getRequestedOverrideBounds()); + if (com.android.window.flags.Flags.fixLayoutExistingTask()) { + mTaskSupervisor.getLaunchParamsController() + .layoutTask(task, info.windowLayout, activity, source, options); + } else { + int displayId = getDisplayId(); + if (displayId == INVALID_DISPLAY) displayId = DEFAULT_DISPLAY; + final boolean isLockscreenShown = + mAtmService.mKeyguardController.isKeyguardOrAodShowing(displayId); + if (!mTaskSupervisor.getLaunchParamsController() + .layoutTask(task, info.windowLayout, activity, source, options) + && !getRequestedOverrideBounds().isEmpty() + && task.isResizeable() && !isLockscreenShown) { + task.setBounds(getRequestedOverrideBounds()); + } } - return task; } diff --git a/services/core/java/com/android/server/wm/WindowOrganizerController.java b/services/core/java/com/android/server/wm/WindowOrganizerController.java index b4c2c0173767..a11f4b1f3fc3 100644 --- a/services/core/java/com/android/server/wm/WindowOrganizerController.java +++ b/services/core/java/com/android/server/wm/WindowOrganizerController.java @@ -52,6 +52,7 @@ import static android.window.WindowContainerTransaction.Change.CHANGE_FOCUSABLE; import static android.window.WindowContainerTransaction.Change.CHANGE_FORCE_TRANSLUCENT; import static android.window.WindowContainerTransaction.Change.CHANGE_HIDDEN; import static android.window.WindowContainerTransaction.Change.CHANGE_RELATIVE_BOUNDS; +import static android.window.WindowContainerTransaction.HierarchyOp.HIERARCHY_OP_TYPE_APP_COMPAT_REACHABILITY; import static android.window.WindowContainerTransaction.HierarchyOp.HIERARCHY_OP_TYPE_REMOVE_ROOT_TASK; import static android.window.WindowContainerTransaction.HierarchyOp.HIERARCHY_OP_TYPE_SET_KEYGUARD_STATE; import static android.window.WindowContainerTransaction.HierarchyOp.HIERARCHY_OP_TYPE_ADD_INSETS_FRAME_PROVIDER; @@ -77,6 +78,8 @@ import static android.window.WindowContainerTransaction.HierarchyOp.HIERARCHY_OP import static android.window.WindowContainerTransaction.HierarchyOp.HIERARCHY_OP_TYPE_SET_LAUNCH_ROOT; import static android.window.WindowContainerTransaction.HierarchyOp.HIERARCHY_OP_TYPE_SET_REPARENT_LEAF_TASK_IF_RELAUNCH; import static android.window.WindowContainerTransaction.HierarchyOp.HIERARCHY_OP_TYPE_START_SHORTCUT; +import static android.window.WindowContainerTransaction.HierarchyOp.REACHABILITY_EVENT_X; +import static android.window.WindowContainerTransaction.HierarchyOp.REACHABILITY_EVENT_Y; import static com.android.internal.protolog.WmProtoLogGroups.WM_DEBUG_WINDOW_ORGANIZER; import static com.android.server.wm.ActivityRecord.State.PAUSING; @@ -1196,6 +1199,30 @@ class WindowOrganizerController extends IWindowOrganizerController.Stub caller.mPid, caller.mUid, taskId, safeOptions)); break; } + case HIERARCHY_OP_TYPE_APP_COMPAT_REACHABILITY: { + int doubleTapX = hop.getAppCompatOptions().getInt(REACHABILITY_EVENT_X); + int doubleTapY = hop.getAppCompatOptions().getInt(REACHABILITY_EVENT_Y); + final WindowContainer<?> wc = WindowContainer.fromBinder(hop.getContainer()); + if (wc == null) { + break; + } + final Task currentTask = wc.asTask(); + if (chain.mTransition != null) { + chain.mTransition.collect(wc); + } + if (currentTask != null) { + final ActivityRecord top = currentTask.topRunningActivity(); + if (top != null) { + if (chain.mTransition != null) { + chain.mTransition.collect(top); + } + top.mAppCompatController.getReachabilityPolicy().handleDoubleTap(doubleTapX, + doubleTapY); + } + } + effects |= TRANSACT_EFFECTS_CLIENT_CONFIG; + break; + } case HIERARCHY_OP_TYPE_REORDER: case HIERARCHY_OP_TYPE_REPARENT: { final WindowContainer wc = WindowContainer.fromBinder(hop.getContainer()); diff --git a/services/tests/InputMethodSystemServerTests/src/com/android/inputmethodservice/InputMethodServiceTest.java b/services/tests/InputMethodSystemServerTests/src/com/android/inputmethodservice/InputMethodServiceTest.java index d08715586580..c954b185914c 100644 --- a/services/tests/InputMethodSystemServerTests/src/com/android/inputmethodservice/InputMethodServiceTest.java +++ b/services/tests/InputMethodSystemServerTests/src/com/android/inputmethodservice/InputMethodServiceTest.java @@ -183,7 +183,7 @@ public class InputMethodServiceTest { setShowImeWithHardKeyboard(true /* enabled */); // Triggers to show IME via public API. - verifyInputViewStatus( + verifyInputViewStatusOnMainSync( () -> assertThat(mActivity.showImeWithWindowInsetsController()).isTrue(), true /* expected */, true /* inputViewStarted */); @@ -211,7 +211,6 @@ public class InputMethodServiceTest { * lose flags like HIDE_IMPLICIT_ONLY. */ @Test - @RequiresFlagsDisabled(Flags.FLAG_REFACTOR_INSETS_CONTROLLER) public void testShowHideSelf() throws Exception { setShowImeWithHardKeyboard(true /* enabled */); @@ -223,13 +222,16 @@ public class InputMethodServiceTest { true /* inputViewStarted */); assertThat(mInputMethodService.isInputViewShown()).isTrue(); - // IME request to hide itself with flag HIDE_IMPLICIT_ONLY, expect not hide (shown). - Log.i(TAG, "Call IMS#requestHideSelf(InputMethodManager.HIDE_IMPLICIT_ONLY)"); - verifyInputViewStatusOnMainSync( - () -> mInputMethodService.requestHideSelf(InputMethodManager.HIDE_IMPLICIT_ONLY), - false /* expected */, - true /* inputViewStarted */); - assertThat(mInputMethodService.isInputViewShown()).isTrue(); + if (!mFlagsValueProvider.getBoolean(Flags.FLAG_REFACTOR_INSETS_CONTROLLER)) { + // IME request to hide itself with flag HIDE_IMPLICIT_ONLY, expect not hide (shown). + Log.i(TAG, "Call IMS#requestHideSelf(InputMethodManager.HIDE_IMPLICIT_ONLY)"); + verifyInputViewStatusOnMainSync( + () -> mInputMethodService.requestHideSelf( + InputMethodManager.HIDE_IMPLICIT_ONLY), + false /* expected */, + true /* inputViewStarted */); + assertThat(mInputMethodService.isInputViewShown()).isTrue(); + } // IME request to hide itself without any flags, expect hidden. Log.i(TAG, "Call IMS#requestHideSelf(0)"); @@ -237,23 +239,32 @@ public class InputMethodServiceTest { () -> mInputMethodService.requestHideSelf(0 /* flags */), true /* expected */, false /* inputViewStarted */); - assertThat(mInputMethodService.isInputViewShown()).isFalse(); + if (mFlagsValueProvider.getBoolean(Flags.FLAG_REFACTOR_INSETS_CONTROLLER)) { + // The IME visibility is only sent at the end of the animation. Therefore, we have to + // wait until the visibility was sent to the server and the IME window hidden. + eventually(() -> assertThat(mInputMethodService.isInputViewShown()).isFalse()); + } else { + assertThat(mInputMethodService.isInputViewShown()).isFalse(); + } - // IME request to show itself with flag SHOW_IMPLICIT, expect shown. - Log.i(TAG, "Call IMS#requestShowSelf(InputMethodManager.SHOW_IMPLICIT)"); - verifyInputViewStatusOnMainSync( - () -> mInputMethodService.requestShowSelf(InputMethodManager.SHOW_IMPLICIT), - true /* expected */, - true /* inputViewStarted */); - assertThat(mInputMethodService.isInputViewShown()).isTrue(); + if (!mFlagsValueProvider.getBoolean(Flags.FLAG_REFACTOR_INSETS_CONTROLLER)) { + // IME request to show itself with flag SHOW_IMPLICIT, expect shown. + Log.i(TAG, "Call IMS#requestShowSelf(InputMethodManager.SHOW_IMPLICIT)"); + verifyInputViewStatusOnMainSync( + () -> mInputMethodService.requestShowSelf(InputMethodManager.SHOW_IMPLICIT), + true /* expected */, + true /* inputViewStarted */); + assertThat(mInputMethodService.isInputViewShown()).isTrue(); - // IME request to hide itself with flag HIDE_IMPLICIT_ONLY, expect hidden. - Log.i(TAG, "Call IMS#requestHideSelf(InputMethodManager.HIDE_IMPLICIT_ONLY)"); - verifyInputViewStatusOnMainSync( - () -> mInputMethodService.requestHideSelf(InputMethodManager.HIDE_IMPLICIT_ONLY), - true /* expected */, - false /* inputViewStarted */); - assertThat(mInputMethodService.isInputViewShown()).isFalse(); + // IME request to hide itself with flag HIDE_IMPLICIT_ONLY, expect hidden. + Log.i(TAG, "Call IMS#requestHideSelf(InputMethodManager.HIDE_IMPLICIT_ONLY)"); + verifyInputViewStatusOnMainSync( + () -> mInputMethodService.requestHideSelf( + InputMethodManager.HIDE_IMPLICIT_ONLY), + true /* expected */, + false /* inputViewStarted */); + assertThat(mInputMethodService.isInputViewShown()).isFalse(); + } } /** @@ -992,35 +1003,26 @@ public class InputMethodServiceTest { * @param expected whether the runnable is expected to trigger the signal. * @param orientationPortrait whether the orientation is expected to be portrait. */ - private void verifyFullscreenMode( - Runnable runnable, boolean expected, boolean orientationPortrait) - throws InterruptedException { - CountDownLatch signal = new CountDownLatch(1); - mInputMethodService.setCountDownLatchForTesting(signal); - - // Runnable to trigger onConfigurationChanged() - try { - runnable.run(); - } catch (Exception e) { - throw new RuntimeException(e); - } - // Waits for onConfigurationChanged() to finish. - mInstrumentation.waitForIdleSync(); - boolean completed = signal.await(TIMEOUT_IN_SECONDS, TimeUnit.SECONDS); - if (expected && !completed) { - fail("Timed out waiting for onConfigurationChanged()"); - } else if (!expected && completed) { - fail("Unexpected call onConfigurationChanged()"); + private void verifyFullscreenMode(@NonNull Runnable runnable, boolean expected, + boolean orientationPortrait) throws InterruptedException { + verifyInputViewStatus(runnable, expected, false /* inputViewStarted */); + if (expected) { + // Wait for the TestActivity to be recreated. + eventually(() -> + assertThat(TestActivity.getLastCreatedInstance()).isNotEqualTo(mActivity)); + // Get the new TestActivity. + mActivity = TestActivity.getLastCreatedInstance(); } - clickOnEditorText(); - eventually(() -> assertThat(mInputMethodService.isInputViewShown()).isTrue()); + verifyInputViewStatusOnMainSync( + () -> mActivity.showImeWithWindowInsetsController(), + true /* expected */, + true /* inputViewStarted */); + assertThat(mInputMethodService.isInputViewShown()).isTrue(); assertThat(mInputMethodService.getResources().getConfiguration().orientation) - .isEqualTo( - orientationPortrait - ? Configuration.ORIENTATION_PORTRAIT - : Configuration.ORIENTATION_LANDSCAPE); + .isEqualTo(orientationPortrait + ? Configuration.ORIENTATION_PORTRAIT : Configuration.ORIENTATION_LANDSCAPE); EditorInfo editorInfo = mInputMethodService.getCurrentInputEditorInfo(); assertThat(editorInfo.imeOptions & EditorInfo.IME_FLAG_NO_FULLSCREEN).isEqualTo(0); assertThat(editorInfo.internalImeOptions & EditorInfo.IME_INTERNAL_FLAG_APP_WINDOW_PORTRAIT) @@ -1029,7 +1031,19 @@ public class InputMethodServiceTest { assertThat(mInputMethodService.onEvaluateFullscreenMode()).isEqualTo(!orientationPortrait); assertThat(mInputMethodService.isFullscreenMode()).isEqualTo(!orientationPortrait); - mUiDevice.pressBack(); + // Hide IME before finishing the run. + verifyInputViewStatusOnMainSync( + () -> mActivity.hideImeWithWindowInsetsController(), + true /* expected */, + false /* inputViewStarted */); + + if (mFlagsValueProvider.getBoolean(Flags.FLAG_REFACTOR_INSETS_CONTROLLER)) { + // The IME visibility is only sent at the end of the animation. Therefore, we have to + // wait until the visibility was sent to the server and the IME window hidden. + eventually(() -> assertThat(mInputMethodService.isInputViewShown()).isFalse()); + } else { + assertThat(mInputMethodService.isInputViewShown()).isFalse(); + } } private void prepareIme() throws Exception { diff --git a/services/tests/displayservicetests/src/com/android/server/display/DisplayTopologyCoordinatorTest.kt b/services/tests/displayservicetests/src/com/android/server/display/DisplayTopologyCoordinatorTest.kt index ca670488f6e3..3c134b5d5482 100644 --- a/services/tests/displayservicetests/src/com/android/server/display/DisplayTopologyCoordinatorTest.kt +++ b/services/tests/displayservicetests/src/com/android/server/display/DisplayTopologyCoordinatorTest.kt @@ -61,6 +61,7 @@ class DisplayTopologyCoordinatorTest { info.logicalWidth = i * 300 info.logicalHeight = i * 200 info.logicalDensityDpi = i * 100 + info.type = Display.TYPE_EXTERNAL return@map info } @@ -115,7 +116,98 @@ class DisplayTopologyCoordinatorTest { } @Test - fun addDisplay_extendedDisplaysDisabled() { + fun addDisplay_internal() { + displayInfos[0].displayId = Display.DEFAULT_DISPLAY + displayInfos[0].type = Display.TYPE_INTERNAL + coordinator.onDisplayAdded(displayInfos[0]) + + val widthDp = + pxToDp(displayInfos[0].logicalWidth.toFloat(), displayInfos[0].logicalDensityDpi) + val heightDp = + pxToDp(displayInfos[0].logicalHeight.toFloat(), displayInfos[0].logicalDensityDpi) + verify(mockTopology).addDisplay(displayInfos[0].displayId, widthDp, heightDp) + verify(mockTopologyChangedCallback).invoke( + android.util.Pair( + mockTopologyCopy, + mockTopologyGraph + ) + ) + } + + @Test + fun addDisplay_overlay() { + displayInfos[0].type = Display.TYPE_OVERLAY + coordinator.onDisplayAdded(displayInfos[0]) + + val widthDp = + pxToDp(displayInfos[0].logicalWidth.toFloat(), displayInfos[0].logicalDensityDpi) + val heightDp = + pxToDp(displayInfos[0].logicalHeight.toFloat(), displayInfos[0].logicalDensityDpi) + verify(mockTopology).addDisplay(displayInfos[0].displayId, widthDp, heightDp) + verify(mockTopologyChangedCallback).invoke( + android.util.Pair( + mockTopologyCopy, + mockTopologyGraph + ) + ) + } + + @Test + fun addDisplay_typeUnknown() { + displayInfos[0].type = Display.TYPE_UNKNOWN + + coordinator.onDisplayAdded(displayInfos[0]) + + verify(mockTopology, never()).addDisplay(anyInt(), anyFloat(), anyFloat()) + verify(mockTopologyChangedCallback, never()).invoke(any()) + } + + @Test + fun addDisplay_wifi() { + displayInfos[0].type = Display.TYPE_WIFI + + coordinator.onDisplayAdded(displayInfos[0]) + + verify(mockTopology, never()).addDisplay(anyInt(), anyFloat(), anyFloat()) + verify(mockTopologyChangedCallback, never()).invoke(any()) + } + + @Test + fun addDisplay_virtual() { + displayInfos[0].type = Display.TYPE_VIRTUAL + + coordinator.onDisplayAdded(displayInfos[0]) + + verify(mockTopology, never()).addDisplay(anyInt(), anyFloat(), anyFloat()) + verify(mockTopologyChangedCallback, never()).invoke(any()) + } + + @Test + fun addDisplay_internal_nonDefault() { + displayInfos[0].displayId = 2 + displayInfos[0].type = Display.TYPE_INTERNAL + + coordinator.onDisplayAdded(displayInfos[0]) + + verify(mockTopology, never()).addDisplay(anyInt(), anyFloat(), anyFloat()) + verify(mockTopologyChangedCallback, never()).invoke(any()) + } + + @Test + fun addDisplay_external_extendedDisplaysDisabled() { + whenever(mockIsExtendedDisplayEnabled()).thenReturn(false) + + for (displayInfo in displayInfos) { + coordinator.onDisplayAdded(displayInfo) + } + + verify(mockTopology, never()).addDisplay(anyInt(), anyFloat(), anyFloat()) + verify(mockTopologyChangedCallback, never()).invoke(any()) + } + + @Test + fun addDisplay_overlay_extendedDisplaysDisabled() { + displayInfos[0].type = Display.TYPE_OVERLAY whenever(mockIsExtendedDisplayEnabled()).thenReturn(false) for (displayInfo in displayInfos) { @@ -144,9 +236,16 @@ class DisplayTopologyCoordinatorTest { .thenReturn(true) addDisplay() - displayInfos[0].logicalDensityDpi += 10 + displayInfos[0].logicalWidth += 100 + displayInfos[0].logicalHeight += 100 coordinator.onDisplayChanged(displayInfos[0]) + val widthDp = + pxToDp(displayInfos[0].logicalWidth.toFloat(), displayInfos[0].logicalDensityDpi) + val heightDp = + pxToDp(displayInfos[0].logicalHeight.toFloat(), displayInfos[0].logicalDensityDpi) + verify(mockTopology).updateDisplay(displayInfos[0].displayId, widthDp, heightDp) + val captor = ArgumentCaptor.forClass(SparseIntArray::class.java) verify(mockTopologyCopy).getGraph(captor.capture()) val densities = captor.value @@ -180,11 +279,56 @@ class DisplayTopologyCoordinatorTest { } @Test - fun updateDisplay_extendedDisplaysDisabled() { + fun updateDisplay_typeUnknown() { + displayInfos[0].type = Display.TYPE_UNKNOWN + + coordinator.onDisplayChanged(displayInfos[0]) + + verify(mockTopology, never()).updateDisplay(anyInt(), anyFloat(), anyFloat()) + verify(mockTopologyCopy, never()).getGraph(any()) + verify(mockTopologyChangedCallback, never()).invoke(any()) + } + + @Test + fun updateDisplay_wifi() { + displayInfos[0].type = Display.TYPE_WIFI + + coordinator.onDisplayChanged(displayInfos[0]) + + verify(mockTopology, never()).updateDisplay(anyInt(), anyFloat(), anyFloat()) + verify(mockTopologyCopy, never()).getGraph(any()) + verify(mockTopologyChangedCallback, never()).invoke(any()) + } + + @Test + fun updateDisplay_virtual() { + displayInfos[0].type = Display.TYPE_VIRTUAL + + coordinator.onDisplayChanged(displayInfos[0]) + + verify(mockTopology, never()).updateDisplay(anyInt(), anyFloat(), anyFloat()) + verify(mockTopologyCopy, never()).getGraph(any()) + verify(mockTopologyChangedCallback, never()).invoke(any()) + } + + @Test + fun updateDisplay_internal_nonDefault() { + displayInfos[0].displayId = 2 + displayInfos[0].type = Display.TYPE_INTERNAL + + coordinator.onDisplayChanged(displayInfos[0]) + + verify(mockTopology, never()).updateDisplay(anyInt(), anyFloat(), anyFloat()) + verify(mockTopologyCopy, never()).getGraph(any()) + verify(mockTopologyChangedCallback, never()).invoke(any()) + } + + @Test + fun updateDisplay_external_extendedDisplaysDisabled() { whenever(mockIsExtendedDisplayEnabled()).thenReturn(false) for (displayInfo in displayInfos) { - coordinator.onDisplayAdded(displayInfo) + coordinator.onDisplayChanged(displayInfo) } verify(mockTopology, never()).updateDisplay(anyInt(), anyFloat(), anyFloat()) @@ -193,10 +337,22 @@ class DisplayTopologyCoordinatorTest { } @Test + fun updateDisplay_overlay_extendedDisplaysDisabled() { + displayInfos[0].type = Display.TYPE_OVERLAY + whenever(mockIsExtendedDisplayEnabled()).thenReturn(false) + + coordinator.onDisplayChanged(displayInfos[0]) + + verify(mockTopology, never()).updateDisplay(anyInt(), anyFloat(), anyFloat()) + verify(mockTopologyChangedCallback, never()).invoke(any()) + verify(mockTopologyStore, never()).restoreTopology(any()) + } + + @Test fun updateDisplay_notInDefaultDisplayGroup() { displayInfos[0].displayGroupId = Display.DEFAULT_DISPLAY_GROUP + 1 - coordinator.onDisplayAdded(displayInfos[0]) + coordinator.onDisplayChanged(displayInfos[0]) verify(mockTopology, never()).updateDisplay(anyInt(), anyFloat(), anyFloat()) verify(mockTopologyCopy, never()).getGraph(any()) @@ -233,9 +389,7 @@ class DisplayTopologyCoordinatorTest { @Test fun removeDisplay_notChanged() { - for (displayInfo in displayInfos) { - coordinator.onDisplayRemoved(displayInfo.displayId) - } + coordinator.onDisplayRemoved(100) verify(mockTopologyChangedCallback, never()).invoke(any()) verify(mockTopologyStore, never()).restoreTopology(any()) diff --git a/services/tests/mockingservicestests/src/com/android/server/pm/UserManagerServiceTest.java b/services/tests/mockingservicestests/src/com/android/server/pm/UserManagerServiceTest.java index b4e885fe5661..f79cb1105611 100644 --- a/services/tests/mockingservicestests/src/com/android/server/pm/UserManagerServiceTest.java +++ b/services/tests/mockingservicestests/src/com/android/server/pm/UserManagerServiceTest.java @@ -61,9 +61,12 @@ import android.os.SystemProperties; import android.os.UserHandle; import android.os.UserManager; import android.os.storage.StorageManager; +import android.platform.test.annotations.DisableFlags; +import android.platform.test.annotations.EnableFlags; import android.platform.test.annotations.RequiresFlagsEnabled; import android.platform.test.flag.junit.SetFlagsRule; import android.provider.Settings; +import android.telecom.TelecomManager; import android.util.Log; import android.util.Pair; import android.util.SparseArray; @@ -166,6 +169,7 @@ public final class UserManagerServiceTest { private @Mock PackageManagerInternal mPackageManagerInternal; private @Mock KeyguardManager mKeyguardManager; private @Mock PowerManager mPowerManager; + private @Mock TelecomManager mTelecomManager; /** * Reference to the {@link UserManagerService} being tested. @@ -192,6 +196,7 @@ public final class UserManagerServiceTest { when(mSpiedContext.getSystemService(StorageManager.class)).thenReturn(mStorageManager); doReturn(mKeyguardManager).when(mSpiedContext).getSystemService(KeyguardManager.class); when(mSpiedContext.getSystemService(PowerManager.class)).thenReturn(mPowerManager); + when(mSpiedContext.getSystemService(TelecomManager.class)).thenReturn(mTelecomManager); mockGetLocalService(LockSettingsInternal.class, mLockSettingsInternal); mockGetLocalService(PackageManagerInternal.class, mPackageManagerInternal); doNothing().when(mSpiedContext).sendBroadcastAsUser(any(), any(), any()); @@ -885,9 +890,7 @@ public final class UserManagerServiceTest { .getInteger(com.android.internal.R.integer.config_hsumBootStrategy); // Even if the headless system user switchable flag is true, the boot user should be the // first switchable full user. - doReturn(true) - .when(mSpyResources) - .getBoolean(com.android.internal.R.bool.config_canSwitchToHeadlessSystemUser); + mockCanSwitchToHeadlessSystemUser(true); assertThat(mUms.getBootUser()).isEqualTo(USER_ID); } @@ -906,6 +909,75 @@ public final class UserManagerServiceTest { () -> mUms.getBootUser()); } + @Test + @EnableFlags(android.multiuser.Flags.FLAG_LOGOUT_USER_API) + public void testGetUserLogoutability_HsumAndInteractiveHeadlessSystem_UserCanLogout() + throws Exception { + setSystemUserHeadless(true); + addUser(USER_ID); + setLastForegroundTime(USER_ID, 1_000_000L); + mockCurrentUser(USER_ID); + + mockCanSwitchToHeadlessSystemUser(true); + mockUserIsInCall(false); + + assertThat(mUms.getUserLogoutability(USER_ID)) + .isEqualTo(UserManager.LOGOUTABILITY_STATUS_OK); + } + + @Test + @EnableFlags(android.multiuser.Flags.FLAG_LOGOUT_USER_API) + public void testGetUserLogoutability_HsumAndNonInteractiveHeadlessSystem_UserCannotLogout() + throws Exception { + setSystemUserHeadless(true); + mockCanSwitchToHeadlessSystemUser(false); + addUser(USER_ID); + setLastForegroundTime(USER_ID, 1_000_000L); + mockCurrentUser(USER_ID); + mockUserIsInCall(false); + + assertThat(mUms.getUserLogoutability(USER_ID)) + .isEqualTo(UserManager.LOGOUTABILITY_STATUS_NO_SUITABLE_USER_TO_LOGOUT_TO); + } + + @Test + @EnableFlags(android.multiuser.Flags.FLAG_LOGOUT_USER_API) + public void testGetUserLogoutability_Hsum_SystemUserCannotLogout() throws Exception { + setSystemUserHeadless(true); + mockCurrentUser(UserHandle.USER_SYSTEM); + assertThat(mUms.getUserLogoutability(UserHandle.USER_SYSTEM)) + .isEqualTo(UserManager.LOGOUTABILITY_STATUS_CANNOT_LOGOUT_SYSTEM_USER); + } + + @Test + @EnableFlags(android.multiuser.Flags.FLAG_LOGOUT_USER_API) + public void testGetUserLogoutability_NonHsum_SystemUserCannotLogout() throws Exception { + setSystemUserHeadless(false); + mockCurrentUser(UserHandle.USER_SYSTEM); + assertThat( + mUms.getUserLogoutability(UserHandle.USER_SYSTEM)).isEqualTo( + UserManager.LOGOUTABILITY_STATUS_CANNOT_LOGOUT_SYSTEM_USER); + } + + @Test + @EnableFlags(android.multiuser.Flags.FLAG_LOGOUT_USER_API) + public void testGetUserLogoutability_CannotSwitch_CannotLogout() throws Exception { + setSystemUserHeadless(true); + addUser(USER_ID); + addUser(OTHER_USER_ID); + setLastForegroundTime(OTHER_USER_ID, 1_000_000L); + mockCurrentUser(USER_ID); + mUms.setUserRestriction(DISALLOW_USER_SWITCH, true, USER_ID); + assertThat(mUms.getUserLogoutability(USER_ID)) + .isEqualTo(UserManager.LOGOUTABILITY_STATUS_CANNOT_SWITCH); + } + + @Test + @DisableFlags(android.multiuser.Flags.FLAG_LOGOUT_USER_API) + public void testGetUserLogoutability_LogoutDisabled() throws Exception { + assertThrows(UnsupportedOperationException.class, () -> mUms.getUserLogoutability(USER_ID)); + } + /** * Returns true if the user's XML file has Default restrictions * @param userId Id of the user. @@ -1021,6 +1093,16 @@ public final class UserManagerServiceTest { doReturn(service).when(() -> LocalServices.getService(serviceClass)); } + private void mockCanSwitchToHeadlessSystemUser(boolean canSwitch) { + doReturn(canSwitch) + .when(mSpyResources) + .getBoolean(com.android.internal.R.bool.config_canSwitchToHeadlessSystemUser); + } + + private void mockUserIsInCall(boolean isInCall) { + when(mTelecomManager.isInCall()).thenReturn(isInCall); + } + private void addDefaultProfileAndParent() { addUser(PARENT_USER_ID); addProfile(PROFILE_USER_ID, PARENT_USER_ID); @@ -1063,6 +1145,7 @@ public final class UserManagerServiceTest { private void addUserData(TestUserData userData) { Log.d(TAG, "Adding " + userData); mUsers.put(userData.info.id, userData); + mUms.putUserInfo(userData.info); } private void setSystemUserHeadless(boolean headless) { diff --git a/services/tests/powerstatstests/res/raw/history_01 b/services/tests/powerstatstests/res/raw/history_01 Binary files differnew file mode 100644 index 000000000000..f69eb275f2c6 --- /dev/null +++ b/services/tests/powerstatstests/res/raw/history_01 diff --git a/services/tests/powerstatstests/res/raw/history_02 b/services/tests/powerstatstests/res/raw/history_02 Binary files differnew file mode 100644 index 000000000000..1a536ab920db --- /dev/null +++ b/services/tests/powerstatstests/res/raw/history_02 diff --git a/services/tests/powerstatstests/res/raw/history_03 b/services/tests/powerstatstests/res/raw/history_03 Binary files differnew file mode 100644 index 000000000000..76a3c7b69f01 --- /dev/null +++ b/services/tests/powerstatstests/res/raw/history_03 diff --git a/services/tests/powerstatstests/res/raw/history_04 b/services/tests/powerstatstests/res/raw/history_04 Binary files differnew file mode 100644 index 000000000000..7e43ac6281cc --- /dev/null +++ b/services/tests/powerstatstests/res/raw/history_04 diff --git a/services/tests/powerstatstests/res/raw/history_05 b/services/tests/powerstatstests/res/raw/history_05 Binary files differnew file mode 100644 index 000000000000..b587723b7d1b --- /dev/null +++ b/services/tests/powerstatstests/res/raw/history_05 diff --git a/services/tests/powerstatstests/src/com/android/server/power/stats/BatteryStatsHistoryCompressionPerfTest.java b/services/tests/powerstatstests/src/com/android/server/power/stats/BatteryStatsHistoryCompressionPerfTest.java new file mode 100644 index 000000000000..48e0daa9dba0 --- /dev/null +++ b/services/tests/powerstatstests/src/com/android/server/power/stats/BatteryStatsHistoryCompressionPerfTest.java @@ -0,0 +1,280 @@ +/* + * Copyright (C) 2025 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.power.stats; + +import android.app.Activity; +import android.content.Context; +import android.content.res.Resources; +import android.os.Bundle; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.platform.test.annotations.LargeTest; + +import androidx.test.InstrumentationRegistry; +import androidx.test.ext.junit.runners.AndroidJUnit4; + +import libcore.io.Streams; + +import org.apache.commons.compress.compressors.bzip2.BZip2CompressorInputStream; +import org.apache.commons.compress.compressors.bzip2.BZip2CompressorOutputStream; +import org.apache.commons.compress.compressors.deflate.DeflateCompressorInputStream; +import org.apache.commons.compress.compressors.deflate.DeflateCompressorOutputStream; +import org.apache.commons.compress.compressors.gzip.GzipCompressorInputStream; +import org.apache.commons.compress.compressors.gzip.GzipCompressorOutputStream; +import org.apache.commons.compress.compressors.gzip.GzipParameters; +import org.apache.commons.compress.compressors.lz4.BlockLZ4CompressorInputStream; +import org.apache.commons.compress.compressors.lz4.BlockLZ4CompressorOutputStream; +import org.apache.commons.compress.compressors.lz4.FramedLZ4CompressorInputStream; +import org.apache.commons.compress.compressors.lz4.FramedLZ4CompressorOutputStream; +import org.apache.commons.compress.compressors.xz.XZCompressorInputStream; +import org.apache.commons.compress.compressors.xz.XZCompressorOutputStream; +import org.junit.Before; +import org.junit.Ignore; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; +import org.junit.runner.RunWith; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Random; +import java.util.zip.Deflater; +import java.util.zip.GZIPInputStream; +import java.util.zip.GZIPOutputStream; + +@RunWith(AndroidJUnit4.class) +@LargeTest +@android.platform.test.annotations.DisabledOnRavenwood(reason = "Performance test") +@Ignore("Performance experiment. Comment out @Ignore to run") +public class BatteryStatsHistoryCompressionPerfTest { + + @Rule + public final PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + + @Rule + public final TestName mTestName = new TestName(); + + private final List<byte[]> mHistorySamples = new ArrayList<>(); + + @Before + public void loadHistorySamples() throws IOException { + Context context = InstrumentationRegistry.getContext(); + Resources resources = context.getResources(); + + for (String sampleResource + : List.of("history_01", "history_02", "history_03", "history_04", "history_05")) { + int resId = resources.getIdentifier(sampleResource, "raw", context.getPackageName()); + try (InputStream stream = resources.openRawResource(resId)) { + byte[] data = Streams.readFully(stream); + mHistorySamples.add(data); + } + } + } + + private interface StreamWrapper<T> { + T wrap(T stream) throws IOException; + } + + private static class CompressorTester implements BatteryHistoryDirectory.Compressor { + private final StreamWrapper<OutputStream> mCompressorSupplier; + private final StreamWrapper<InputStream> mUncompressorSupplier; + private final ByteArrayOutputStream mOutputStream = new ByteArrayOutputStream(200000); + private final Random mRandom = new Random(); + + private static class Sample { + public byte[] uncompressed; + public byte[] compressed; + } + + private final List<Sample> mSamples; + + CompressorTester(StreamWrapper<OutputStream> compressorSupplier, + StreamWrapper<InputStream> uncompressorSupplier, + List<byte[]> uncompressedSamples) throws IOException { + mCompressorSupplier = compressorSupplier; + mUncompressorSupplier = uncompressorSupplier; + mSamples = new ArrayList<>(); + for (byte[] uncompressed : uncompressedSamples) { + Sample s = new Sample(); + s.uncompressed = Arrays.copyOf(uncompressed, uncompressed.length); + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + compress(baos, s.uncompressed); + s.compressed = baos.toByteArray(); + mSamples.add(s); + } + } + + float getCompressionRatio() { + long totalUncompressed = 0; + long totalCompressed = 0; + for (Sample sample : mSamples) { + totalUncompressed += sample.uncompressed.length; + totalCompressed += sample.compressed.length; + } + return (float) totalUncompressed / totalCompressed; + } + + void compressSample() throws IOException { + Sample sample = mSamples.get(mRandom.nextInt(mSamples.size())); + mOutputStream.reset(); + compress(mOutputStream, sample.uncompressed); + // Absence of an exception indicates success + } + + void uncompressSample() throws IOException { + Sample sample = mSamples.get(mRandom.nextInt(mSamples.size())); + uncompress(sample.uncompressed, new ByteArrayInputStream(sample.compressed)); + // Absence of an exception indicates success + } + + @Override + public void compress(OutputStream stream, byte[] data) throws IOException { + OutputStream cos = mCompressorSupplier.wrap(stream); + cos.write(data); + cos.close(); + } + + @Override + public void uncompress(byte[] data, InputStream stream) throws IOException { + InputStream cos = mUncompressorSupplier.wrap(stream); + readFully(data, cos); + } + } + + private void benchmarkCompress(StreamWrapper<OutputStream> compressorSupplier) + throws IOException { + CompressorTester tester = new CompressorTester(compressorSupplier, null, mHistorySamples); + final BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + tester.compressSample(); + } + Bundle status = new Bundle(); + status.putFloat(mTestName.getMethodName() + "_compressionRatio", + tester.getCompressionRatio()); + InstrumentationRegistry.getInstrumentation().sendStatus(Activity.RESULT_OK, status); + } + + private void benchmarkUncompress(StreamWrapper<OutputStream> compressorSupplier, + StreamWrapper<InputStream> uncompressorSupplier) throws IOException { + CompressorTester tester = new CompressorTester(compressorSupplier, uncompressorSupplier, + mHistorySamples); + final BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + tester.uncompressSample(); + } + } + + @Test + public void block_lz4_compress() throws IOException { + benchmarkCompress(BlockLZ4CompressorOutputStream::new); + } + + @Test + public void block_lz4_uncompress() throws IOException { + benchmarkUncompress(BlockLZ4CompressorOutputStream::new, + BlockLZ4CompressorInputStream::new); + } + + @Test + public void framed_lz4_compress() throws IOException { + benchmarkCompress(FramedLZ4CompressorOutputStream::new); + } + + @Test + public void framed_lz4_uncompress() throws IOException { + benchmarkUncompress(FramedLZ4CompressorOutputStream::new, + FramedLZ4CompressorInputStream::new); + } + + @Test + public void gzip_compress() throws IOException { + benchmarkCompress(GzipCompressorOutputStream::new); + } + + @Test + public void gzip_uncompress() throws IOException { + benchmarkUncompress(GzipCompressorOutputStream::new, + GzipCompressorInputStream::new); + } + + @Test + public void best_speed_gzip_compress() throws IOException { + benchmarkCompress(stream -> { + GzipParameters parameters = new GzipParameters(); + parameters.setCompressionLevel(Deflater.BEST_SPEED); + return new GzipCompressorOutputStream(stream, parameters); + }); + } + + @Test + public void best_speed_gzip_uncompress() throws IOException { + benchmarkUncompress(stream -> { + GzipParameters parameters = new GzipParameters(); + parameters.setCompressionLevel(Deflater.BEST_SPEED); + return new GzipCompressorOutputStream(stream, parameters); + }, GzipCompressorInputStream::new); + } + + @Test + public void java_util_gzip_compress() throws IOException { + benchmarkCompress(GZIPOutputStream::new); + } + + @Test + public void java_util_gzip_uncompress() throws IOException { + benchmarkUncompress(GZIPOutputStream::new, + GZIPInputStream::new); + } + + @Test + public void bzip2_compress() throws IOException { + benchmarkCompress(BZip2CompressorOutputStream::new); + } + + @Test + public void bzip2_uncompress() throws IOException { + benchmarkUncompress(BZip2CompressorOutputStream::new, + BZip2CompressorInputStream::new); + } + + @Test + public void xz_compress() throws IOException { + benchmarkCompress(XZCompressorOutputStream::new); + } + + @Test + public void xz_uncompress() throws IOException { + benchmarkUncompress(XZCompressorOutputStream::new, + XZCompressorInputStream::new); + } + + @Test + public void deflate_compress() throws IOException { + benchmarkCompress(DeflateCompressorOutputStream::new); + } + + @Test + public void deflate_uncompress() throws IOException { + benchmarkUncompress(DeflateCompressorOutputStream::new, + DeflateCompressorInputStream::new); + } +} diff --git a/services/tests/powerstatstests/src/com/android/server/power/stats/BatteryStatsHistoryTest.java b/services/tests/powerstatstests/src/com/android/server/power/stats/BatteryStatsHistoryTest.java index 164eec6fbc49..8fad93184732 100644 --- a/services/tests/powerstatstests/src/com/android/server/power/stats/BatteryStatsHistoryTest.java +++ b/services/tests/powerstatstests/src/com/android/server/power/stats/BatteryStatsHistoryTest.java @@ -17,6 +17,7 @@ package com.android.server.power.stats; import static com.google.common.truth.Truth.assertThat; +import static com.google.common.truth.Truth.assertWithMessage; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; @@ -30,18 +31,20 @@ import android.os.BatteryConsumer; import android.os.BatteryManager; import android.os.BatteryStats; import android.os.BatteryStats.HistoryItem; +import android.os.ConditionVariable; import android.os.Parcel; import android.os.PersistableBundle; import android.os.Process; import android.os.UserHandle; import android.platform.test.annotations.EnableFlags; import android.platform.test.flag.junit.SetFlagsRule; +import android.platform.test.ravenwood.RavenwoodRule; import android.telephony.NetworkRegistrationInfo; -import android.util.AtomicFile; import android.util.Log; import androidx.test.runner.AndroidJUnit4; +import com.android.internal.os.BackgroundThread; import com.android.internal.os.BatteryStatsHistory; import com.android.internal.os.BatteryStatsHistoryIterator; import com.android.internal.os.MonotonicClock; @@ -58,6 +61,8 @@ import org.mockito.MockitoAnnotations; import java.io.File; import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; import java.io.PrintWriter; import java.io.StringWriter; import java.nio.file.Files; @@ -85,6 +90,7 @@ public class BatteryStatsHistoryTest { private File mHistoryDir; private final MockClock mClock = new MockClock(); private final MonotonicClock mMonotonicClock = new MonotonicClock(0, mClock); + private BatteryHistoryDirectory mDirectory; private BatteryStatsHistory mHistory; private BatteryStats.HistoryPrinter mHistoryPrinter; @Mock @@ -108,11 +114,30 @@ public class BatteryStatsHistoryTest { } mHistoryDir.delete(); + + BatteryHistoryDirectory.Compressor compressor; + if (RavenwoodRule.isOnRavenwood()) { + compressor = new BatteryHistoryDirectory.Compressor() { + @Override + public void compress(OutputStream stream, byte[] data) throws IOException { + stream.write(data); + } + + @Override + public void uncompress(byte[] data, InputStream stream) throws IOException { + readFully(data, stream); + } + }; + } else { + compressor = BatteryHistoryDirectory.DEFAULT_COMPRESSOR; + } + mDirectory = new BatteryHistoryDirectory(mHistoryDir, 32768, compressor); + mClock.realtime = 123; mClock.currentTime = 1743645660000L; // 2025-04-03, 2:01:00 AM - mHistory = new BatteryStatsHistory(mHistoryBuffer, mSystemDir, 32768, - MAX_HISTORY_BUFFER_SIZE, mStepDetailsCalculator, mClock, mMonotonicClock, mTracer, + mHistory = new BatteryStatsHistory(mHistoryBuffer, MAX_HISTORY_BUFFER_SIZE, mDirectory, + mStepDetailsCalculator, mClock, mMonotonicClock, mTracer, mEventLogger); mHistory.forceRecordAllHistory(); mHistory.startRecordingHistory(mClock.realtime, mClock.uptime, false); @@ -210,8 +235,9 @@ public class BatteryStatsHistoryTest { } @Test - public void testStartNextFile() throws Exception { + public void testStartNextFile() { mHistory.forceRecordAllHistory(); + mDirectory.setFileCompressionEnabled(false); mClock.realtime = 123; @@ -225,7 +251,7 @@ public class BatteryStatsHistoryTest { mClock.realtime = 1000 * i; fileList.add(mClock.realtime + ".bh"); - mHistory.startNextFile(mClock.realtime); + mHistory.startNextFragment(mClock.realtime); createActiveFile(mHistory); fillActiveFile(mHistory); @@ -235,8 +261,9 @@ public class BatteryStatsHistoryTest { // create file 32 mClock.realtime = 1000 * 32; - mHistory.startNextFile(mClock.realtime); + mHistory.startNextFragment(mClock.realtime); createActiveFile(mHistory); + fillActiveFile(mHistory); fileList.add("32000.bh"); fileList.remove(0); // verify file 0 is deleted. @@ -244,21 +271,22 @@ public class BatteryStatsHistoryTest { verifyFileNames(mHistory, fileList); verifyActiveFile(mHistory, "32000.bh"); - fillActiveFile(mHistory); - // create file 33 mClock.realtime = 1000 * 33; - mHistory.startNextFile(mClock.realtime); + mHistory.startNextFragment(mClock.realtime); createActiveFile(mHistory); - // verify file 1 is deleted + fillActiveFile(mHistory); fileList.add("33000.bh"); fileList.remove(0); + mHistory.writeHistory(); + + // verify file 1 is deleted verifyFileDeleted("1000.bh"); verifyFileNames(mHistory, fileList); verifyActiveFile(mHistory, "33000.bh"); // create a new BatteryStatsHistory object, it will pick up existing history files. - BatteryStatsHistory history2 = new BatteryStatsHistory(mHistoryBuffer, mSystemDir, 32, 1024, + BatteryStatsHistory history2 = new BatteryStatsHistory(mHistoryBuffer, 1024, mDirectory, null, mClock, mMonotonicClock, mTracer, mEventLogger); // verify constructor can pick up all files from file system. verifyFileNames(history2, fileList); @@ -281,7 +309,7 @@ public class BatteryStatsHistoryTest { // create file 1. mClock.realtime = 2345678; - history2.startNextFile(mClock.realtime); + history2.startNextFragment(mClock.realtime); createActiveFile(history2); verifyFileNames(history2, Arrays.asList("1234567.bh", "2345678.bh")); verifyActiveFile(history2, "2345678.bh"); @@ -297,10 +325,10 @@ public class BatteryStatsHistoryTest { mHistory = spy(mHistory.copy()); doAnswer(invocation -> { - AtomicFile file = invocation.getArgument(1); - mReadFiles.add(file.getBaseFile().getName()); + BatteryHistoryDirectory.BatteryHistoryFile file = invocation.getArgument(1); + mReadFiles.add(file.atomicFile.getBaseFile().getName()); return invocation.callRealMethod(); - }).when(mHistory).readFileToParcel(any(), any()); + }).when(mHistory).readFragmentToParcel(any(), any()); // Prepare history for iteration mHistory.iterate(0, MonotonicClock.UNDEFINED); @@ -339,10 +367,10 @@ public class BatteryStatsHistoryTest { mHistory = spy(mHistory.copy()); doAnswer(invocation -> { - AtomicFile file = invocation.getArgument(1); - mReadFiles.add(file.getBaseFile().getName()); + BatteryHistoryDirectory.BatteryHistoryFile file = invocation.getArgument(1); + mReadFiles.add(file.atomicFile.getBaseFile().getName()); return invocation.callRealMethod(); - }).when(mHistory).readFileToParcel(any(), any()); + }).when(mHistory).readFragmentToParcel(any(), any()); // Prepare history for iteration mHistory.iterate(1000, 3000); @@ -371,14 +399,14 @@ public class BatteryStatsHistoryTest { mHistory.recordEvent(mClock.realtime, mClock.uptime, BatteryStats.HistoryItem.EVENT_JOB_START, "job", 42); - mHistory.startNextFile(mClock.realtime); // 1000.bh + mHistory.startNextFragment(mClock.realtime); // 1000.bh mClock.realtime = 2000; mClock.uptime = 2000; mHistory.recordEvent(mClock.realtime, mClock.uptime, BatteryStats.HistoryItem.EVENT_JOB_FINISH, "job", 42); - mHistory.startNextFile(mClock.realtime); // 2000.bh + mHistory.startNextFragment(mClock.realtime); // 2000.bh mClock.realtime = 3000; mClock.uptime = 3000; @@ -386,30 +414,37 @@ public class BatteryStatsHistoryTest { HistoryItem.EVENT_ALARM, "alarm", 42); // Flush accumulated history to disk - mHistory.startNextFile(mClock.realtime); + mHistory.startNextFragment(mClock.realtime); } private void verifyActiveFile(BatteryStatsHistory history, String file) { final File expectedFile = new File(mHistoryDir, file); - assertEquals(expectedFile.getPath(), history.getActiveFile().getBaseFile().getPath()); + assertEquals(expectedFile.getPath(), + ((BatteryHistoryDirectory.BatteryHistoryFile) history.getActiveFragment()) + .atomicFile.getBaseFile().getPath()); assertTrue(expectedFile.exists()); } private void verifyFileNames(BatteryStatsHistory history, List<String> fileList) { - assertEquals(fileList.size(), history.getFilesNames().size()); + awaitCompletion(); + List<String> fileNames = + ((BatteryHistoryDirectory) history.getBatteryHistoryStore()).getFileNames(); + assertThat(fileNames).isEqualTo(fileList); for (int i = 0; i < fileList.size(); i++) { - assertEquals(fileList.get(i), history.getFilesNames().get(i)); final File expectedFile = new File(mHistoryDir, fileList.get(i)); - assertTrue(expectedFile.exists()); + assertWithMessage("File does not exist " + expectedFile) + .that(expectedFile.exists()).isTrue(); } } private void verifyFileDeleted(String file) { + awaitCompletion(); assertFalse(new File(mHistoryDir, file).exists()); } private void createActiveFile(BatteryStatsHistory history) { - final File file = history.getActiveFile().getBaseFile(); + File file = ((BatteryHistoryDirectory.BatteryHistoryFile) history.getActiveFragment()) + .atomicFile.getBaseFile(); if (file.exists()) { return; } @@ -561,7 +596,7 @@ public class BatteryStatsHistoryTest { public void largeTagPool() { // Keep the preserved part of history short - we only need to capture the very tail of // history. - mHistory = new BatteryStatsHistory(mHistoryBuffer, mSystemDir, 1, 6000, + mHistory = new BatteryStatsHistory(mHistoryBuffer, 6000, mDirectory, mStepDetailsCalculator, mClock, mMonotonicClock, mTracer, mEventLogger); mHistory.forceRecordAllHistory(); @@ -699,7 +734,7 @@ public class BatteryStatsHistoryTest { assertThat(size).isGreaterThan(lastHistorySize); lastHistorySize = size; - mHistory.startNextFile(mClock.realtime); + mHistory.startNextFragment(mClock.realtime); size = mHistory.getMonotonicHistorySize(); assertThat(size).isEqualTo(lastHistorySize); @@ -713,7 +748,7 @@ public class BatteryStatsHistoryTest { assertThat(size).isGreaterThan(lastHistorySize); lastHistorySize = size; - mHistory.startNextFile(mClock.realtime); + mHistory.startNextFragment(mClock.realtime); mClock.realtime = 3000; mClock.uptime = 3000; @@ -788,4 +823,58 @@ public class BatteryStatsHistoryTest { parcel.recycle(); } + + @Test + public void compressHistoryFiles() { + // The first history file will be uncompressed + mDirectory.setFileCompressionEnabled(false); + + mClock.realtime = 1000; + mClock.uptime = 1000; + mHistory.recordEvent(mClock.realtime, mClock.uptime, + BatteryStats.HistoryItem.EVENT_JOB_START, "job", 42); + + mHistory.startNextFragment(mClock.realtime); + + // The second file will be compressed + mDirectory.setFileCompressionEnabled(true); + + mClock.realtime = 2000; + mClock.uptime = 2000; + mHistory.recordEvent(mClock.realtime, mClock.uptime, + BatteryStats.HistoryItem.EVENT_JOB_FINISH, "job", 42); + + mHistory.startNextFragment(mClock.realtime); + + awaitCompletion(); + + assertThat(historySummary(mHistory)).isEqualTo(List.of("+42:job", "-42:job")); + + Parcel parcel = Parcel.obtain(); + mHistory.writeToBatteryUsageStatsParcel(parcel, Long.MAX_VALUE); + parcel.setDataPosition(0); + + BatteryStatsHistory actual = BatteryStatsHistory.createFromBatteryUsageStatsParcel(parcel); + assertThat(historySummary(actual)).isEqualTo(List.of("+42:job", "-42:job")); + } + + private List<String> historySummary(BatteryStatsHistory history) { + List<String> events = new ArrayList<>(); + try (BatteryStatsHistoryIterator it = history.iterate(0, Long.MAX_VALUE)) { + HistoryItem item; + while ((item = it.next()) != null) { + if ((item.eventCode & HistoryItem.EVENT_TYPE_MASK) == HistoryItem.EVENT_JOB) { + events.add(((item.eventCode & HistoryItem.EVENT_FLAG_START) != 0 ? "+" : "-") + + item.eventTag.uid + ":" + item.eventTag.string); + } + } + } + return events; + } + + private static void awaitCompletion() { + ConditionVariable done = new ConditionVariable(); + BackgroundThread.getHandler().post(done::open); + done.block(); + } } diff --git a/services/tests/powerstatstests/src/com/android/server/power/stats/BatteryUsageStatsProviderTest.java b/services/tests/powerstatstests/src/com/android/server/power/stats/BatteryUsageStatsProviderTest.java index e94ef5bb4871..31ff50f8ca58 100644 --- a/services/tests/powerstatstests/src/com/android/server/power/stats/BatteryUsageStatsProviderTest.java +++ b/services/tests/powerstatstests/src/com/android/server/power/stats/BatteryUsageStatsProviderTest.java @@ -877,9 +877,19 @@ public class BatteryUsageStatsProviderTest { } @Test - @EnableFlags(Flags.FLAG_EXTENDED_BATTERY_HISTORY_CONTINUOUS_COLLECTION_ENABLED) + @EnableFlags({ + Flags.FLAG_EXTENDED_BATTERY_HISTORY_CONTINUOUS_COLLECTION_ENABLED, + Flags.FLAG_EXTENDED_BATTERY_HISTORY_COMPRESSION_ENABLED + }) public void testIncludeSubsetOfHistory() throws IOException { MockBatteryStatsImpl batteryStats = mStatsRule.getBatteryStats(); + BatteryHistoryDirectory store = + (BatteryHistoryDirectory) batteryStats.getHistory().getBatteryHistoryStore(); + store.setFileCompressionEnabled(true); + // Make history fragment size predictable. Without this protection, holding the history + // directory lock in the background would prevent new fragments from being created. + store.makeDirectoryLockUnconditional(); + batteryStats.getHistory().setMaxHistoryBufferSize(100); synchronized (batteryStats) { batteryStats.setRecordAllHistoryLocked(true); diff --git a/services/tests/powerstatstests/src/com/android/server/power/stats/MockBatteryStatsImpl.java b/services/tests/powerstatstests/src/com/android/server/power/stats/MockBatteryStatsImpl.java index a69e2fdb0b03..c7a19ce7b233 100644 --- a/services/tests/powerstatstests/src/com/android/server/power/stats/MockBatteryStatsImpl.java +++ b/services/tests/powerstatstests/src/com/android/server/power/stats/MockBatteryStatsImpl.java @@ -41,6 +41,9 @@ import com.android.internal.os.PowerProfile; import com.android.internal.power.EnergyConsumerStats; import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; import java.util.ArrayList; import java.util.Arrays; import java.util.Queue; @@ -49,6 +52,18 @@ import java.util.Queue; * Mocks a BatteryStatsImpl object. */ public class MockBatteryStatsImpl extends BatteryStatsImpl { + public static final BatteryHistoryDirectory.Compressor PASS_THROUGH_COMPRESSOR = + new BatteryHistoryDirectory.Compressor() { + @Override + public void compress(OutputStream stream, byte[] data) throws IOException { + stream.write(data); + } + + @Override + public void uncompress(byte[] data, InputStream stream) throws IOException { + readFully(data, stream); + } + }; public boolean mForceOnBattery; // The mNetworkStats will be used for both wifi and mobile categories private NetworkStats mNetworkStats; @@ -83,7 +98,11 @@ public class MockBatteryStatsImpl extends BatteryStatsImpl { MockBatteryStatsImpl(BatteryStatsConfig config, Clock clock, MonotonicClock monotonicClock, File historyDirectory, Handler handler, PowerProfile powerProfile, PowerStatsUidResolver powerStatsUidResolver) { - super(config, clock, monotonicClock, historyDirectory, handler, + super(config, clock, monotonicClock, historyDirectory, + historyDirectory != null ? new BatteryHistoryDirectory( + new File(historyDirectory, "battery-history"), + config.getMaxHistorySizeBytes(), PASS_THROUGH_COMPRESSOR) : null, + handler, mock(PlatformIdleStateCallback.class), mock(EnergyStatsRetriever.class), mock(UserInfoProvider.class), powerProfile, new CpuScalingPolicies(new SparseArray<>(), new SparseArray<>()), diff --git a/services/tests/powerstatstests/src/com/android/server/power/stats/processor/PowerStatsAggregatorTest.java b/services/tests/powerstatstests/src/com/android/server/power/stats/processor/PowerStatsAggregatorTest.java index 3bdbcb50e601..73d491c93bb5 100644 --- a/services/tests/powerstatstests/src/com/android/server/power/stats/processor/PowerStatsAggregatorTest.java +++ b/services/tests/powerstatstests/src/com/android/server/power/stats/processor/PowerStatsAggregatorTest.java @@ -59,7 +59,7 @@ public class PowerStatsAggregatorTest { @Before public void setup() throws ParseException { - mHistory = new BatteryStatsHistory(null, null, 0, 1024, + mHistory = new BatteryStatsHistory(null, 1024, null, mock(BatteryStatsHistory.HistoryStepDetailsCalculator.class), mClock, mMonotonicClock, mock(BatteryStatsHistory.TraceDelegate.class), null); diff --git a/services/tests/powerstatstests/src/com/android/server/power/stats/processor/PowerStatsExporterTest.java b/services/tests/powerstatstests/src/com/android/server/power/stats/processor/PowerStatsExporterTest.java index d243f92a139f..9ef58cc28a69 100644 --- a/services/tests/powerstatstests/src/com/android/server/power/stats/processor/PowerStatsExporterTest.java +++ b/services/tests/powerstatstests/src/com/android/server/power/stats/processor/PowerStatsExporterTest.java @@ -42,6 +42,7 @@ import com.android.internal.os.CpuScalingPolicies; import com.android.internal.os.MonotonicClock; import com.android.internal.os.PowerProfile; import com.android.internal.os.PowerStats; +import com.android.server.power.stats.BatteryHistoryDirectory; import com.android.server.power.stats.BatteryUsageStatsRule; import com.android.server.power.stats.MockClock; import com.android.server.power.stats.PowerStatsStore; @@ -84,6 +85,7 @@ public class PowerStatsExporterTest { private PowerStatsStore mPowerStatsStore; private PowerStatsAggregator mPowerStatsAggregator; private MultiStatePowerAttributor mPowerAttributor; + private BatteryHistoryDirectory mDirectory; private BatteryStatsHistory mHistory; private CpuPowerStatsLayout mCpuStatsArrayLayout; private PowerStats.Descriptor mPowerStatsDescriptor; @@ -117,7 +119,8 @@ public class PowerStatsExporterTest { AggregatedPowerStatsConfig.STATE_PROCESS_STATE); mPowerStatsStore = new PowerStatsStore(storeDirectory, new TestHandler()); - mHistory = new BatteryStatsHistory(Parcel.obtain(), storeDirectory, 0, 10000, + mDirectory = new BatteryHistoryDirectory(storeDirectory, 0); + mHistory = new BatteryStatsHistory(Parcel.obtain(), 10000, mDirectory, mock(BatteryStatsHistory.HistoryStepDetailsCalculator.class), mClock, mMonotonicClock, null, null); mPowerStatsAggregator = new PowerStatsAggregator(config); diff --git a/services/tests/powerstatstests/src/com/android/server/power/stats/processor/WakelockPowerStatsProcessorTest.java b/services/tests/powerstatstests/src/com/android/server/power/stats/processor/WakelockPowerStatsProcessorTest.java index ed3cda0f76ef..8257d714a5d5 100644 --- a/services/tests/powerstatstests/src/com/android/server/power/stats/processor/WakelockPowerStatsProcessorTest.java +++ b/services/tests/powerstatstests/src/com/android/server/power/stats/processor/WakelockPowerStatsProcessorTest.java @@ -87,7 +87,7 @@ public class WakelockPowerStatsProcessorTest { PowerStats ps = new PowerStats(descriptor); long[] uidStats = new long[descriptor.uidStatsArrayLength]; - BatteryStatsHistory history = new BatteryStatsHistory(null, null, 0, 10000, + BatteryStatsHistory history = new BatteryStatsHistory(null, 10000, null, mock(BatteryStatsHistory.HistoryStepDetailsCalculator.class), mStatsRule.getMockClock(), new MonotonicClock(START_TIME, mStatsRule.getMockClock()), null, null); diff --git a/services/tests/servicestests/src/com/android/server/location/contexthub/ContextHubEndpointTest.java b/services/tests/servicestests/src/com/android/server/location/contexthub/ContextHubEndpointTest.java new file mode 100644 index 000000000000..2e489a81c43a --- /dev/null +++ b/services/tests/servicestests/src/com/android/server/location/contexthub/ContextHubEndpointTest.java @@ -0,0 +1,124 @@ +/* + * Copyright (C) 2025 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.location.contexthub; + +import static com.google.common.truth.Truth.assertThat; + +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.when; + +import android.content.Context; +import android.hardware.contexthub.HubEndpointInfo; +import android.hardware.contexthub.HubEndpointInfo.HubEndpointIdentifier; +import android.hardware.contexthub.IContextHubEndpoint; +import android.hardware.contexthub.IContextHubEndpointCallback; +import android.hardware.contexthub.IEndpointCommunication; +import android.os.Binder; +import android.os.RemoteException; +import android.platform.test.annotations.Postsubmit; + +import androidx.test.ext.junit.runners.AndroidJUnit4; +import androidx.test.platform.app.InstrumentationRegistry; + +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mock; +import org.mockito.junit.MockitoJUnit; +import org.mockito.junit.MockitoRule; + +import java.util.Collections; + +@RunWith(AndroidJUnit4.class) +@Postsubmit +// TODO(b/378944402): Enable test in presubmit +public class ContextHubEndpointTest { + private static final int SESSION_ID_RANGE = ContextHubEndpointManager.SERVICE_SESSION_RANGE; + private static final int MIN_SESSION_ID = 0; + private static final int MAX_SESSION_ID = MIN_SESSION_ID + SESSION_ID_RANGE - 1; + + private static final String ENDPOINT_NAME = "Example test endpoint"; + private static final int ENDPOINT_ID = 1; + private static final String ENDPOINT_PACKAGE_NAME = "com.android.server.location.contexthub"; + + private ContextHubClientManager mClientManager; + private ContextHubEndpointManager mEndpointManager; + private HubInfoRegistry mHubInfoRegistry; + private ContextHubTransactionManager mTransactionManager; + private Context mContext; + @Mock private IEndpointCommunication mMockEndpointCommunications; + @Mock private IContextHubWrapper mMockContextHubWrapper; + @Mock private IContextHubEndpointCallback mMockCallback; + @Rule public final MockitoRule mockito = MockitoJUnit.rule(); + + @Before + public void setUp() throws RemoteException, InstantiationException { + when(mMockContextHubWrapper.getHubs()).thenReturn(Collections.emptyList()); + when(mMockContextHubWrapper.getEndpoints()).thenReturn(Collections.emptyList()); + when(mMockContextHubWrapper.registerEndpointHub(any(), any())) + .thenReturn(mMockEndpointCommunications); + when(mMockEndpointCommunications.requestSessionIdRange(SESSION_ID_RANGE)) + .thenReturn(new int[] {MIN_SESSION_ID, MAX_SESSION_ID}); + when(mMockCallback.asBinder()).thenReturn(new Binder()); + + mContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); + mHubInfoRegistry = new HubInfoRegistry(mContext, mMockContextHubWrapper); + mClientManager = new ContextHubClientManager(mContext, mMockContextHubWrapper); + mTransactionManager = + new ContextHubTransactionManager( + mMockContextHubWrapper, mClientManager, new NanoAppStateManager()); + mEndpointManager = + new ContextHubEndpointManager( + mContext, mMockContextHubWrapper, mHubInfoRegistry, mTransactionManager); + mEndpointManager.init(); + } + + @Test + public void testRegisterEndpoint() throws RemoteException { + // Register an endpoint and confirm we can get a valid IContextHubEndoint reference + HubEndpointInfo info = + new HubEndpointInfo( + ENDPOINT_NAME, ENDPOINT_ID, ENDPOINT_PACKAGE_NAME, Collections.emptyList()); + IContextHubEndpoint endpoint = + mEndpointManager.registerEndpoint( + info, mMockCallback, ENDPOINT_PACKAGE_NAME, /* attributionTag= */ null); + assertThat(mEndpointManager.getNumRegisteredClients()).isEqualTo(1); + assertThat(endpoint).isNotNull(); + HubEndpointInfo assignedInfo = endpoint.getAssignedHubEndpointInfo(); + assertThat(assignedInfo).isNotNull(); + HubEndpointIdentifier assignedIdentifier = assignedInfo.getIdentifier(); + assertThat(assignedIdentifier).isNotNull(); + + // Unregister the endpoint and confirm proper clean-up + mEndpointManager.unregisterEndpoint(assignedIdentifier.getEndpoint()); + assertThat(mEndpointManager.getNumRegisteredClients()).isEqualTo(0); + } + + @Test + public void testReserveSessionId() { + assertThat(mEndpointManager.getNumAvailableSessions()).isEqualTo(SESSION_ID_RANGE); + + int sessionId = mEndpointManager.reserveSessionId(); + assertThat(sessionId).isAtLeast(MIN_SESSION_ID); + assertThat(sessionId).isAtMost(MAX_SESSION_ID); + assertThat(mEndpointManager.getNumAvailableSessions()).isEqualTo(SESSION_ID_RANGE - 1); + + mEndpointManager.returnSessionId(sessionId); + assertThat(mEndpointManager.getNumAvailableSessions()).isEqualTo(SESSION_ID_RANGE); + } +} diff --git a/services/tests/servicestests/src/com/android/server/memory/OWNERS b/services/tests/servicestests/src/com/android/server/memory/OWNERS new file mode 100644 index 000000000000..4df08c1fbc2e --- /dev/null +++ b/services/tests/servicestests/src/com/android/server/memory/OWNERS @@ -0,0 +1,3 @@ +include /MEMORY_OWNERS + +per-file ZramMaintenanceTest.kt = kawasin@google.com diff --git a/services/tests/servicestests/src/com/android/server/zram/ZramMaintenanceTest.kt b/services/tests/servicestests/src/com/android/server/memory/ZramMaintenanceTest.kt index 5448a05aafc3..1f59f45b05bf 100644 --- a/services/tests/servicestests/src/com/android/server/zram/ZramMaintenanceTest.kt +++ b/services/tests/servicestests/src/com/android/server/memory/ZramMaintenanceTest.kt @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.android.server.zram +package com.android.server.memory import android.app.job.JobInfo import android.app.job.JobParameters @@ -26,7 +26,6 @@ import android.testing.TestableContext import androidx.test.filters.SmallTest import androidx.test.platform.app.InstrumentationRegistry -import com.android.server.ZramMaintenance import com.google.common.truth.Truth.assertThat import org.junit.Before 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 01d34b697def..3aa95449cc98 100644 --- a/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java +++ b/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java @@ -606,8 +606,7 @@ public class NotificationManagerServiceTest extends UiServiceTestCase { @Parameters(name = "{0}") public static List<FlagsParameterization> getParams() { - return FlagsParameterization.allCombinationsOf( - FLAG_NOTIFICATION_CLASSIFICATION, FLAG_NM_BINDER_PERF_CACHE_CHANNELS); + return FlagsParameterization.allCombinationsOf(); } public NotificationManagerServiceTest(FlagsParameterization flags) { diff --git a/services/tests/wmtests/src/com/android/server/wm/LaunchParamsControllerTests.java b/services/tests/wmtests/src/com/android/server/wm/LaunchParamsControllerTests.java index 5265b442c968..67a95de8a5c1 100644 --- a/services/tests/wmtests/src/com/android/server/wm/LaunchParamsControllerTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/LaunchParamsControllerTests.java @@ -39,6 +39,7 @@ import static com.android.server.wm.LaunchParamsController.LaunchParamsModifier. import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotEquals; +import android.annotation.NonNull; import android.app.ActivityOptions; import android.content.ComponentName; import android.content.pm.ActivityInfo.WindowLayout; @@ -293,7 +294,7 @@ public class LaunchParamsControllerTests extends WindowTestsBase { final int beforeWindowMode = task.getWindowingMode(); assertNotEquals(windowingMode, beforeWindowMode); - mController.layoutTask(task, null /* windowLayout */); + layoutTask(task); final int afterWindowMode = task.getWindowingMode(); assertEquals(afterWindowMode, beforeWindowMode); @@ -317,7 +318,7 @@ public class LaunchParamsControllerTests extends WindowTestsBase { assertNotEquals(expected, task.getBounds()); - mController.layoutTask(task, null /* windowLayout */); + layoutTask(task); // Task will make adjustments to requested bounds. We only need to guarantee that the // reuqested bounds are expected. @@ -342,7 +343,7 @@ public class LaunchParamsControllerTests extends WindowTestsBase { assertNotEquals(expected, task.getBounds()); - mController.layoutTask(task, null /* windowLayout */); + layoutTask(task); assertEquals(expected, task.getRequestedOverrideBounds()); } @@ -365,7 +366,7 @@ public class LaunchParamsControllerTests extends WindowTestsBase { assertNotEquals(expected, task.getBounds()); - mController.layoutTask(task, null /* windowLayout */); + layoutTask(task); assertNotEquals(expected, task.getBounds()); assertEquals(expected, task.mLastNonFullscreenBounds); @@ -467,4 +468,9 @@ public class LaunchParamsControllerTests extends WindowTestsBase { private TestDisplayContent createNewDisplayContent() { return addNewDisplayContentAt(DisplayContent.POSITION_TOP); } + + private void layoutTask(@NonNull Task task) { + mController.layoutTask(task, null /* layout */, null /* activity */, null /* source */, + null /* options */); + } } diff --git a/services/tests/wmtests/src/com/android/server/wm/WindowContainerTransactionTests.java b/services/tests/wmtests/src/com/android/server/wm/WindowContainerTransactionTests.java index 369600c3f8d7..dcb68620e361 100644 --- a/services/tests/wmtests/src/com/android/server/wm/WindowContainerTransactionTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/WindowContainerTransactionTests.java @@ -18,20 +18,30 @@ package com.android.server.wm; import static android.app.WindowConfiguration.WINDOWING_MODE_FREEFORM; import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN; +import static android.window.WindowContainerTransaction.HierarchyOp.HIERARCHY_OP_TYPE_APP_COMPAT_REACHABILITY; +import static android.window.WindowContainerTransaction.HierarchyOp.LAUNCH_KEY_TASK_ID; +import static android.window.WindowContainerTransaction.HierarchyOp.REACHABILITY_EVENT_X; +import static android.window.WindowContainerTransaction.HierarchyOp.REACHABILITY_EVENT_Y; +import static com.android.dx.mockito.inline.extended.ExtendedMockito.doReturn; +import static com.android.dx.mockito.inline.extended.ExtendedMockito.spyOn; import static com.android.dx.mockito.inline.extended.ExtendedMockito.verify; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertSame; import static org.junit.Assert.assertTrue; import static org.mockito.Mockito.atLeast; import static org.mockito.Mockito.times; import android.content.Intent; +import android.os.Binder; +import android.os.Bundle; import android.platform.test.annotations.Presubmit; import android.window.WindowContainerToken; import android.window.WindowContainerTransaction; +import android.window.WindowContainerTransaction.HierarchyOp; import androidx.annotation.NonNull; import androidx.test.filters.SmallTest; @@ -223,6 +233,31 @@ public class WindowContainerTransactionTests extends WindowTestsBase { < tda.mChildren.indexOf(desktopOrganizer.mTasks.get(2).getRootTask())); } + @Test + public void testAppCompat_setReachabilityOffsets() { + final Task task = createTask(/* taskId */ 37); + final WindowContainerToken containerToken = task.getTaskInfo().token; + spyOn(containerToken); + final Binder asBinder = new Binder(); + doReturn(asBinder).when(containerToken).asBinder(); + final WindowContainerTransaction wct = new WindowContainerTransaction(); + wct.setReachabilityOffset(containerToken, /* taskId */ task.mTaskId, 10, 20); + + final List<HierarchyOp> hierarchyOps = wct.getHierarchyOps().stream() + .filter(op -> op.getType() == HIERARCHY_OP_TYPE_APP_COMPAT_REACHABILITY) + .toList(); + + assertEquals(1, hierarchyOps.size()); + final HierarchyOp appCompatOp = hierarchyOps.getFirst(); + assertNotNull(appCompatOp); + final Bundle appCompatOptions = appCompatOp.getAppCompatOptions(); + + assertEquals(task.mTaskId, appCompatOptions.getInt(LAUNCH_KEY_TASK_ID)); + assertEquals(10, appCompatOptions.getInt(REACHABILITY_EVENT_X)); + assertEquals(20, appCompatOptions.getInt(REACHABILITY_EVENT_Y)); + assertSame(asBinder, appCompatOp.getContainer()); + } + private Task createTask(int taskId) { return new Task.Builder(mAtm) .setTaskId(taskId) diff --git a/telecomm/java/com/android/internal/telecom/ITelecomService.aidl b/telecomm/java/com/android/internal/telecom/ITelecomService.aidl index 4d9df4666016..6fb3bcb51d35 100644 --- a/telecomm/java/com/android/internal/telecom/ITelecomService.aidl +++ b/telecomm/java/com/android/internal/telecom/ITelecomService.aidl @@ -416,4 +416,9 @@ interface ITelecomService { boolean hasForegroundServiceDelegation(in PhoneAccountHandle phoneAccountHandle, String callingPackage); void setMetricsTestMode(boolean enabled); + + /** + * @see TelecomServiceImpl#waitForAudioToUpdate + */ + void waitForAudioToUpdate(boolean expectActive); } diff --git a/telephony/java/android/telephony/SubscriptionInfo.java b/telephony/java/android/telephony/SubscriptionInfo.java index d164c8851f5b..4b175c134d84 100644 --- a/telephony/java/android/telephony/SubscriptionInfo.java +++ b/telephony/java/android/telephony/SubscriptionInfo.java @@ -618,9 +618,9 @@ public class SubscriptionInfo implements Parcelable { @Deprecated public int getMcc() { try { - return mMcc == null ? 0 : Integer.parseInt(mMcc); + return TextUtils.isEmpty(mMcc) ? 0 : Integer.parseInt(mMcc); } catch (NumberFormatException e) { - Log.w(SubscriptionInfo.class.getSimpleName(), "MCC string is not a number"); + Log.w(SubscriptionInfo.class.getSimpleName(), "MCC string is not a number: " + mMcc); return 0; } } @@ -633,9 +633,9 @@ public class SubscriptionInfo implements Parcelable { @Deprecated public int getMnc() { try { - return mMnc == null ? 0 : Integer.parseInt(mMnc); + return TextUtils.isEmpty(mMnc) ? 0 : Integer.parseInt(mMnc); } catch (NumberFormatException e) { - Log.w(SubscriptionInfo.class.getSimpleName(), "MNC string is not a number"); + Log.w(SubscriptionInfo.class.getSimpleName(), "MNC string is not a number: " + mMnc); return 0; } } diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index 73ea68bc3547..504605d0a1a2 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -19432,7 +19432,6 @@ public class TelephonyManager { * and integrity algorithms in use * @hide */ - @FlaggedApi(Flags.FLAG_ENABLE_MODEM_CIPHER_TRANSPARENCY) @RequiresPermission(Manifest.permission.MODIFY_PHONE_STATE) @SystemApi public void setNullCipherNotificationsEnabled(boolean enable) { @@ -19459,7 +19458,6 @@ public class TelephonyManager { * and integrity algorithms in use * @hide */ - @FlaggedApi(Flags.FLAG_ENABLE_MODEM_CIPHER_TRANSPARENCY) @RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE) @SystemApi public boolean isNullCipherNotificationsEnabled() { |