diff options
251 files changed, 4256 insertions, 663 deletions
diff --git a/core/api/system-current.txt b/core/api/system-current.txt index 441dcaea5e54..2a3593b2c481 100644 --- a/core/api/system-current.txt +++ b/core/api/system-current.txt @@ -133,6 +133,7 @@ package android { field public static final String FORCE_STOP_PACKAGES = "android.permission.FORCE_STOP_PACKAGES"; field public static final String GET_APP_METADATA = "android.permission.GET_APP_METADATA"; field public static final String GET_APP_OPS_STATS = "android.permission.GET_APP_OPS_STATS"; + field @FlaggedApi("android.app.get_binding_uid_importance") public static final String GET_BINDING_UID_IMPORTANCE = "android.permission.GET_BINDING_UID_IMPORTANCE"; field public static final String GET_HISTORICAL_APP_OPS_STATS = "android.permission.GET_HISTORICAL_APP_OPS_STATS"; field public static final String GET_PROCESS_STATE_AND_OOM_SCORE = "android.permission.GET_PROCESS_STATE_AND_OOM_SCORE"; field public static final String GET_RUNTIME_PERMISSIONS = "android.permission.GET_RUNTIME_PERMISSIONS"; @@ -543,6 +544,7 @@ package android.app { public class ActivityManager { method @RequiresPermission(android.Manifest.permission.PACKAGE_USAGE_STATS) public void addOnUidImportanceListener(android.app.ActivityManager.OnUidImportanceListener, int); method @RequiresPermission(android.Manifest.permission.FORCE_STOP_PACKAGES) public void forceStopPackage(String); + method @FlaggedApi("android.app.get_binding_uid_importance") @RequiresPermission(android.Manifest.permission.GET_BINDING_UID_IMPORTANCE) public int getBindingUidImportance(int); method @RequiresPermission(anyOf={"android.permission.INTERACT_ACROSS_USERS", "android.permission.INTERACT_ACROSS_USERS_FULL"}) public static int getCurrentUser(); method @FlaggedApi("android.app.app_start_info") @NonNull @RequiresPermission(android.Manifest.permission.DUMP) public java.util.List<android.app.ApplicationStartInfo> getExternalHistoricalProcessStartReasons(@NonNull String, @IntRange(from=0) int); method @RequiresPermission(android.Manifest.permission.PACKAGE_USAGE_STATS) public int getPackageImportance(String); diff --git a/core/java/android/app/ActivityManager.java b/core/java/android/app/ActivityManager.java index f68681b54e48..8b4ebaee04c5 100644 --- a/core/java/android/app/ActivityManager.java +++ b/core/java/android/app/ActivityManager.java @@ -73,7 +73,6 @@ import android.os.PowerExemptionManager.ReasonCode; import android.os.Process; import android.os.RemoteException; import android.os.ServiceManager; -import android.os.SystemClock; import android.os.SystemProperties; import android.os.UserHandle; import android.os.UserManager; @@ -4269,6 +4268,33 @@ public class ActivityManager { } /** + * Same as {@link #getUidImportance(int)}, but it only works on UIDs that currently + * have a service binding, or provider reference, to the calling UID, even if the target UID + * belong to another android user or profile. + * + * <p>This will return {@link RunningAppProcessInfo#IMPORTANCE_GONE} on all other UIDs, + * regardless of if they're valid or not. + * + * <p>Privileged system apps may prefer this API to {@link #getUidImportance(int)} to + * avoid requesting the permission {@link Manifest.permission#PACKAGE_USAGE_STATS}, which + * would allow access to APIs that return more senstive information. + * + * @hide + */ + @FlaggedApi(Flags.FLAG_GET_BINDING_UID_IMPORTANCE) + @SystemApi + @RequiresPermission(Manifest.permission.GET_BINDING_UID_IMPORTANCE) + public @RunningAppProcessInfo.Importance int getBindingUidImportance(int uid) { + try { + int procState = getService().getBindingUidProcessState(uid, + mContext.getOpPackageName()); + return RunningAppProcessInfo.procStateToImportanceForClient(procState, mContext); + } catch (RemoteException e) { + throw e.rethrowFromSystemServer(); + } + } + + /** * Callback to get reports about changes to the importance of a uid. Use with * {@link #addOnUidImportanceListener}. * @hide diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java index dfb416abd495..3b6ea14ab0b6 100644 --- a/core/java/android/app/ActivityThread.java +++ b/core/java/android/app/ActivityThread.java @@ -56,7 +56,7 @@ import android.app.backup.BackupAnnotations.BackupDestination; import android.app.backup.BackupAnnotations.OperationType; import android.app.compat.CompatChanges; import android.app.sdksandbox.sandboxactivity.ActivityContextInfo; -import android.app.sdksandbox.sandboxactivity.SdkSandboxActivityAuthority; +import android.app.sdksandbox.sandboxactivity.ActivityContextInfoProvider; import android.app.servertransaction.ActivityLifecycleItem; import android.app.servertransaction.ActivityLifecycleItem.LifecycleState; import android.app.servertransaction.ActivityRelaunchItem; @@ -2272,8 +2272,7 @@ public final class ActivityThread extends ClientTransactionHandler case DUMP_HEAP: return "DUMP_HEAP"; case DUMP_ACTIVITY: return "DUMP_ACTIVITY"; case SET_CORE_SETTINGS: return "SET_CORE_SETTINGS"; - case UPDATE_PACKAGE_COMPATIBILITY_INFO: - return "UPDATE_PACKAGE_COMPATIBILITY_INFO"; + case UPDATE_PACKAGE_COMPATIBILITY_INFO: return "UPDATE_PACKAGE_COMPATIBILITY_INFO"; case DUMP_PROVIDER: return "DUMP_PROVIDER"; case UNSTABLE_PROVIDER_DIED: return "UNSTABLE_PROVIDER_DIED"; case REQUEST_ASSIST_CONTEXT_EXTRAS: return "REQUEST_ASSIST_CONTEXT_EXTRAS"; @@ -3777,10 +3776,8 @@ public final class ActivityThread extends ClientTransactionHandler r.activityInfo.targetActivity); } - boolean isSandboxActivityContext = - sandboxActivitySdkBasedContext() - && SdkSandboxActivityAuthority.isSdkSandboxActivity( - mSystemContext, r.intent); + boolean isSandboxActivityContext = sandboxActivitySdkBasedContext() + && r.intent.isSandboxActivity(mSystemContext); boolean isSandboxedSdkContextUsed = false; ContextImpl activityBaseContext; if (isSandboxActivityContext) { @@ -4025,12 +4022,11 @@ public final class ActivityThread extends ClientTransactionHandler */ @Nullable private ContextImpl createBaseContextForSandboxActivity(@NonNull ActivityClientRecord r) { - SdkSandboxActivityAuthority sdkSandboxActivityAuthority = - SdkSandboxActivityAuthority.getInstance(); + ActivityContextInfoProvider contextInfoProvider = ActivityContextInfoProvider.getInstance(); ActivityContextInfo contextInfo; try { - contextInfo = sdkSandboxActivityAuthority.getActivityContextInfo(r.intent); + contextInfo = contextInfoProvider.getActivityContextInfo(r.intent); } catch (IllegalArgumentException e) { Log.e(TAG, "Passed intent does not match an expected sandbox activity", e); return null; diff --git a/core/java/android/app/IActivityManager.aidl b/core/java/android/app/IActivityManager.aidl index 520bf7dc890c..260e9859c72d 100644 --- a/core/java/android/app/IActivityManager.aidl +++ b/core/java/android/app/IActivityManager.aidl @@ -949,4 +949,5 @@ interface IActivityManager { * @param err The binder transaction error */ oneway void frozenBinderTransactionDetected(int debugPid, int code, int flags, int err); + int getBindingUidProcessState(int uid, in String callingPackage); } diff --git a/core/java/android/app/activity_manager.aconfig b/core/java/android/app/activity_manager.aconfig index 2076e85828a6..b303ea64406c 100644 --- a/core/java/android/app/activity_manager.aconfig +++ b/core/java/android/app/activity_manager.aconfig @@ -5,4 +5,11 @@ flag { name: "app_start_info" description: "Control collecting of ApplicationStartInfo records and APIs." bug: "247814855" -}
\ No newline at end of file +} + +flag { + namespace: "backstage_power" + name: "get_binding_uid_importance" + description: "API to get importance of UID that's binding to the caller" + bug: "292533010" +} diff --git a/core/java/android/content/Intent.java b/core/java/android/content/Intent.java index 02e0cf6c5203..ea54c912d4b9 100644 --- a/core/java/android/content/Intent.java +++ b/core/java/android/content/Intent.java @@ -12587,12 +12587,8 @@ public class Intent implements Parcelable, Cloneable { return (mFlags & FLAG_ACTIVITY_NEW_DOCUMENT) == FLAG_ACTIVITY_NEW_DOCUMENT; } - /** - * @deprecated Use {@link SdkSandboxActivityAuthority#isSdkSandboxActivity} instead. - * Once the other API is finalized this method will be removed. - * @hide - */ - @Deprecated + // TODO(b/299109198): Refactor into the {@link SdkSandboxManagerLocal} + /** @hide */ public boolean isSandboxActivity(@NonNull Context context) { if (mAction != null && mAction.equals(ACTION_START_SANDBOXED_ACTIVITY)) { return true; diff --git a/core/java/android/credentials/flags.aconfig b/core/java/android/credentials/flags.aconfig index 9b819a792f8f..ec96215525d3 100644 --- a/core/java/android/credentials/flags.aconfig +++ b/core/java/android/credentials/flags.aconfig @@ -13,3 +13,10 @@ flag { description: "Enables Credential Manager to work with Instant Apps" bug: "302190269" } + +flag { + namespace: "credential_manager" + name: "clear_session_enabled" + description: "Enables clearing of Credential Manager sessions when client process dies" + bug: "308470501" +} diff --git a/core/java/android/provider/Telephony.java b/core/java/android/provider/Telephony.java index bcda25a1bf3b..27ad45de69e6 100644 --- a/core/java/android/provider/Telephony.java +++ b/core/java/android/provider/Telephony.java @@ -3206,15 +3206,6 @@ public final class Telephony { public static final String INFRASTRUCTURE_BITMASK = "infrastructure_bitmask"; /** - * Indicating if the APN is used for eSIM bootsrap provisioning. The default value is 0 (Not - * used for eSIM bootstrap provisioning). - * - * <P>Type: INTEGER</P> - * @hide - */ - public static final String ESIM_BOOTSTRAP_PROVISIONING = "esim_bootstrap_provisioning"; - - /** * MVNO type: * {@code SPN (Service Provider Name), IMSI, GID (Group Identifier Level 1)}. * <P>Type: TEXT</P> diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml index ab0ef7d3b187..d5d912f286a0 100644 --- a/core/res/AndroidManifest.xml +++ b/core/res/AndroidManifest.xml @@ -7782,6 +7782,15 @@ <permission android:name="android.permission.WRITE_FLAGS" android:protectionLevel="signature" /> + <!-- @hide @SystemApi + @FlaggedApi("android.app.get_binding_uid_importance") + Allows to get the importance of an UID that has a service + binding to the app. + <p>Protection level: signature|privileged + --> + <permission android:name="android.permission.GET_BINDING_UID_IMPORTANCE" + android:protectionLevel="signature|privileged" /> + <!-- @hide Allows internal applications to manage displays. <p>This means intercept internal signals about displays being (dis-)connected and being able to enable or disable the external displays. diff --git a/core/res/res/xml/sms_short_codes.xml b/core/res/res/xml/sms_short_codes.xml index 3a2e50aa06e8..709646b00e5c 100644 --- a/core/res/res/xml/sms_short_codes.xml +++ b/core/res/res/xml/sms_short_codes.xml @@ -34,7 +34,7 @@ http://smscoin.net/software/engine/WordPress/Paid+SMS-registration/ --> <!-- Arab Emirates --> - <shortcode country="ae" pattern="\\d{1,5}" free="1017|1355|3214" /> + <shortcode country="ae" pattern="\\d{1,5}" free="1017|1355|3214|6253" /> <!-- Albania: 5 digits, known short codes listed --> <shortcode country="al" pattern="\\d{5}" premium="15191|55[56]00" /> @@ -155,7 +155,7 @@ <shortcode country="ie" pattern="\\d{5}" premium="5[3-9]\\d{3}" free="50\\d{3}|116\\d{3}" standard="5[12]\\d{3}" /> <!-- Israel: 4 digits, known premium codes listed --> - <shortcode country="il" pattern="\\d{4}" premium="4422|4545" /> + <shortcode country="il" pattern="\\d{1,5}" premium="4422|4545" free="37477" /> <!-- Italy: 5 digits (premium=41xxx,42xxx), plus EU: https://www.itu.int/dms_pub/itu-t/oth/02/02/T020200006B0001PDFE.pdf --> @@ -198,6 +198,9 @@ <!-- Malaysia: 5 digits: http://www.skmm.gov.my/attachment/Consumer_Regulation/Mobile_Content_Services_FAQs.pdf --> <shortcode country="my" pattern="\\d{5}" premium="32298|33776" free="22099|28288|66668" /> + <!-- Namibia: 5 digits --> + <shortcode country="na" pattern="\\d{1,5}" free="40005" /> + <!-- The Netherlands, 4 digits, known premium codes listed, plus EU --> <shortcode country="nl" pattern="\\d{4}" premium="4466|5040" free="116\\d{3}|2223|6225|2223|1662" /> diff --git a/data/etc/privapp-permissions-platform.xml b/data/etc/privapp-permissions-platform.xml index 69aa40156e78..ab18a500fc03 100644 --- a/data/etc/privapp-permissions-platform.xml +++ b/data/etc/privapp-permissions-platform.xml @@ -529,6 +529,7 @@ applications that come with the platform <permission name="android.permission.LAUNCH_CREDENTIAL_SELECTOR"/> <!-- Permission required for CTS test IntentRedirectionTest --> <permission name="android.permission.QUERY_CLONED_APPS"/> + <permission name="android.permission.GET_BINDING_UID_IMPORTANCE"/> </privapp-permissions> <privapp-permissions package="com.android.statementservice"> diff --git a/libs/WindowManager/Shell/res/drawable/bubble_manage_btn_bg.xml b/libs/WindowManager/Shell/res/drawable/bubble_manage_btn_bg.xml index d2360e9b1ae0..657720ee6088 100644 --- a/libs/WindowManager/Shell/res/drawable/bubble_manage_btn_bg.xml +++ b/libs/WindowManager/Shell/res/drawable/bubble_manage_btn_bg.xml @@ -21,7 +21,7 @@ <solid android:color="?androidprv:attr/materialColorSurfaceContainerHigh" /> - <corners android:radius="20dp" /> + <corners android:radius="18sp" /> <padding android:left="20dp" diff --git a/libs/WindowManager/Shell/res/values/dimen.xml b/libs/WindowManager/Shell/res/values/dimen.xml index 55a91323295a..de9d2a292540 100644 --- a/libs/WindowManager/Shell/res/values/dimen.xml +++ b/libs/WindowManager/Shell/res/values/dimen.xml @@ -185,10 +185,11 @@ <dimen name="bubble_pointer_overlap">1dp</dimen> <!-- Extra padding around the dismiss target for bubbles --> <dimen name="bubble_dismiss_slop">16dp</dimen> - <!-- Height of button allowing users to adjust settings for bubbles. --> - <dimen name="bubble_manage_button_height">36dp</dimen> - <!-- Height of manage button including margins. --> - <dimen name="bubble_manage_button_total_height">68dp</dimen> + <!-- Height of button allowing users to adjust settings for bubbles. We use sp so that the + button can scale with the font size. --> + <dimen name="bubble_manage_button_height">36sp</dimen> + <!-- Touch area height of the manage button. --> + <dimen name="bubble_manage_button_touch_area_height">48dp</dimen> <!-- The margin around the outside of the manage button. --> <dimen name="bubble_manage_button_margin">16dp</dimen> <!-- Height of an item in the bubble manage menu. --> 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 0568edaa7ab6..c7ab6aa3934e 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 @@ -57,6 +57,7 @@ import android.util.Log; import android.util.TypedValue; import android.view.ContextThemeWrapper; import android.view.LayoutInflater; +import android.view.TouchDelegate; import android.view.View; import android.view.ViewGroup; import android.view.ViewOutlineProvider; @@ -470,6 +471,17 @@ public class BubbleExpandedView extends LinearLayout { R.layout.bubble_manage_button, this /* parent */, false /* attach */); addView(mManageButton); mManageButton.setVisibility(visibility); + post(() -> { + int touchAreaHeight = + getResources().getDimensionPixelSize( + R.dimen.bubble_manage_button_touch_area_height); + Rect r = new Rect(); + mManageButton.getHitRect(r); + int extraTouchArea = (touchAreaHeight - r.height()) / 2; + r.top -= extraTouchArea; + r.bottom += extraTouchArea; + setTouchDelegate(new TouchDelegate(r, mManageButton)); + }); } } 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 17e06e93b3a8..144c456f8838 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 @@ -198,9 +198,10 @@ public class BubblePositioner { mPointerHeight = res.getDimensionPixelSize(R.dimen.bubble_pointer_height); mPointerMargin = res.getDimensionPixelSize(R.dimen.bubble_pointer_margin); mPointerOverlap = res.getDimensionPixelSize(R.dimen.bubble_pointer_overlap); - mManageButtonHeightIncludingMargins = - res.getDimensionPixelSize(R.dimen.bubble_manage_button_total_height); mManageButtonHeight = res.getDimensionPixelSize(R.dimen.bubble_manage_button_height); + mManageButtonHeightIncludingMargins = + mManageButtonHeight + + 2 * res.getDimensionPixelSize(R.dimen.bubble_manage_button_margin); mExpandedViewMinHeight = res.getDimensionPixelSize(R.dimen.bubble_expanded_default_height); mOverflowHeight = res.getDimensionPixelSize(R.dimen.bubble_overflow_height); mMinimumFlyoutWidthLargeScreen = res.getDimensionPixelSize( diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleStackView.java b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleStackView.java index 9402d028ecc4..87461dcb0515 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleStackView.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleStackView.java @@ -1829,9 +1829,12 @@ public class BubbleStackView extends FrameLayout } bubble.cleanupViews(); // cleans up the icon view updateExpandedView(); // resets state for no expanded bubble + mExpandedBubble = null; }); logBubbleEvent(bubble, FrameworkStatsLog.BUBBLE_UICHANGED__ACTION__DISMISSED); return; + } else if (getBubbleCount() == 1) { + mExpandedBubble = null; } // Remove it from the views for (int i = 0; i < getBubbleCount(); i++) { @@ -2420,14 +2423,13 @@ public class BubbleStackView extends FrameLayout mExpandedAnimationController.notifyPreparingToCollapse(); updateOverflowDotVisibility(false /* expanding */); - final Runnable collapseBackToStack = () -> mExpandedAnimationController.collapseBackToStack( - mStackAnimationController - .getStackPositionAlongNearestHorizontalEdge() - /* collapseTo */, - () -> { - mBubbleContainer.setActiveController(mStackAnimationController); - updateOverflowVisibility(); - }); + final Runnable collapseBackToStack = () -> + mExpandedAnimationController.collapseBackToStack( + mStackAnimationController.getStackPositionAlongNearestHorizontalEdge(), + () -> { + mBubbleContainer.setActiveController(mStackAnimationController); + updateOverflowVisibility(); + }); final Runnable after = () -> { final BubbleViewProvider previouslySelected = mExpandedBubble; diff --git a/packages/Shell/AndroidManifest.xml b/packages/Shell/AndroidManifest.xml index c7e5bf98850a..36e1bfa2140e 100644 --- a/packages/Shell/AndroidManifest.xml +++ b/packages/Shell/AndroidManifest.xml @@ -864,6 +864,7 @@ <!-- Permissions required for CTS test - CtsVoiceInteractionTestCases --> <uses-permission android:name="android.permission.RESET_HOTWORD_TRAINING_DATA_EGRESS_COUNT" /> <uses-permission android:name="android.permission.RECEIVE_SANDBOXED_DETECTION_TRAINING_DATA" /> + <uses-permission android:name="android.permission.GET_BINDING_UID_IMPORTANCE" /> <application android:label="@string/app_label" diff --git a/packages/SystemUI/TEST_MAPPING b/packages/SystemUI/TEST_MAPPING index 28539ddfadc6..0480b9dbfc8e 100644 --- a/packages/SystemUI/TEST_MAPPING +++ b/packages/SystemUI/TEST_MAPPING @@ -88,20 +88,6 @@ "include-filter": "android.permissionui.cts.CameraMicIndicatorsPermissionTest" } ] - }, - { - "name": "SystemUIGoogleScreenshotTests", - "options": [ - { - "exclude-annotation": "org.junit.Ignore" - }, - { - "exclude-annotation": "android.platform.test.annotations.FlakyTest" - }, - { - "include-annotation": "android.platform.test.annotations.Postsubmit" - } - ] } ], @@ -171,12 +157,6 @@ }, { "include-annotation": "androidx.test.filters.FlakyTest" - }, - { - "include-annotation": "android.platform.test.annotations.FlakyTest" - }, - { - "include-annotation": "android.platform.test.annotations.Postsubmit" } ] }, @@ -188,28 +168,18 @@ }, { "include-annotation": "androidx.test.filters.FlakyTest" - }, - { - "include-annotation": "android.platform.test.annotations.FlakyTest" - }, - { - "include-annotation": "android.platform.test.annotations.Postsubmit" } ] }, - { "name": "SystemUIGoogleBiometricsScreenshotTests", + { + // TODO(b/251476085): Consider merging with SystemUIGoogleScreenshotTests (in U+) + "name": "SystemUIGoogleBiometricsScreenshotTests", "options": [ { "exclude-annotation": "org.junit.Ignore" }, { "include-annotation": "androidx.test.filters.FlakyTest" - }, - { - "include-annotation": "android.platform.test.annotations.FlakyTest" - }, - { - "include-annotation": "android.platform.test.annotations.Postsubmit" } ] } diff --git a/packages/SystemUI/compose/scene/tests/utils/src/com/android/compose/animation/scene/TestSceneScope.kt b/packages/SystemUI/compose/scene/tests/utils/src/com/android/compose/animation/scene/TestSceneScope.kt new file mode 100644 index 000000000000..de46f7209c84 --- /dev/null +++ b/packages/SystemUI/compose/scene/tests/utils/src/com/android/compose/animation/scene/TestSceneScope.kt @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.compose.animation.scene + +import androidx.compose.runtime.Composable +import androidx.compose.runtime.remember +import androidx.compose.ui.Modifier + +/** `SceneScope` for tests, which allows a single scene to be drawn in a [SceneTransitionLayout]. */ +@Composable +fun TestSceneScope( + modifier: Modifier = Modifier, + content: @Composable SceneScope.() -> Unit, +) { + val currentScene = remember { SceneKey("current") } + SceneTransitionLayout( + currentScene, + onChangeScene = { /* do nothing */}, + transitions = remember { transitions {} }, + modifier, + ) { + scene(currentScene, content = content) + } +} diff --git a/packages/SystemUI/proguard_common.flags b/packages/SystemUI/proguard_common.flags index 445bdc2c1936..73ae59abcadf 100644 --- a/packages/SystemUI/proguard_common.flags +++ b/packages/SystemUI/proguard_common.flags @@ -20,8 +20,6 @@ public <init>(android.content.Context, android.util.AttributeSet); } --keep class com.android.systemui.tuner.* - # The plugins and core log subpackages act as shared libraries that might be referenced in # dynamically-loaded plugin APKs. -keep class com.android.systemui.plugins.** { diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitchController.java b/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitchController.java index f9eb686828c6..6b8009d6cf9f 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitchController.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitchController.java @@ -47,6 +47,7 @@ import com.android.systemui.keyguard.KeyguardUnlockAnimationController; import com.android.systemui.keyguard.domain.interactor.KeyguardClockInteractor; import com.android.systemui.keyguard.domain.interactor.KeyguardInteractor; import com.android.systemui.keyguard.ui.binder.KeyguardRootViewBinder; +import com.android.systemui.keyguard.ui.view.InWindowLauncherUnlockAnimationManager; import com.android.systemui.keyguard.ui.viewmodel.KeyguardRootViewModel; import com.android.systemui.log.LogBuffer; import com.android.systemui.log.core.LogLevel; @@ -123,6 +124,7 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS private View mSmartspaceView; private final KeyguardUnlockAnimationController mKeyguardUnlockAnimationController; + private final InWindowLauncherUnlockAnimationManager mInWindowLauncherUnlockAnimationManager; private boolean mShownOnSecondaryDisplay = false; private boolean mOnlyClock = false; @@ -190,7 +192,8 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS AlwaysOnDisplayNotificationIconViewStore aodIconViewStore, KeyguardInteractor keyguardInteractor, KeyguardClockInteractor keyguardClockInteractor, - FeatureFlagsClassic featureFlags) { + FeatureFlagsClassic featureFlags, + InWindowLauncherUnlockAnimationManager inWindowLauncherUnlockAnimationManager) { super(keyguardClockSwitch); mStatusBarStateController = statusBarStateController; mClockRegistry = clockRegistry; @@ -214,6 +217,7 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS mFeatureFlags = featureFlags; mKeyguardInteractor = keyguardInteractor; mKeyguardClockInteractor = keyguardClockInteractor; + mInWindowLauncherUnlockAnimationManager = inWindowLauncherUnlockAnimationManager; mClockChangedListener = new ClockRegistry.ClockChangeListener() { @Override @@ -438,6 +442,8 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS mSmartspaceView.setPaddingRelative(startPadding, 0, endPadding, 0); mKeyguardUnlockAnimationController.setLockscreenSmartspace(mSmartspaceView); + mInWindowLauncherUnlockAnimationManager.setLockscreenSmartspace(mSmartspaceView); + mView.setSmartspace(mSmartspaceView); } diff --git a/packages/SystemUI/src/com/android/systemui/display/ui/view/MirroringConfirmationDialog.kt b/packages/SystemUI/src/com/android/systemui/display/ui/view/MirroringConfirmationDialog.kt index 87b0f0177d0d..d500d1c2d238 100644 --- a/packages/SystemUI/src/com/android/systemui/display/ui/view/MirroringConfirmationDialog.kt +++ b/packages/SystemUI/src/com/android/systemui/display/ui/view/MirroringConfirmationDialog.kt @@ -20,7 +20,6 @@ import android.os.Bundle import android.view.View import android.widget.TextView import androidx.core.view.updatePadding -import com.android.systemui.biometrics.Utils import com.android.systemui.res.R import com.android.systemui.statusbar.phone.SystemUIBottomSheetDialog import com.android.systemui.statusbar.policy.ConfigurationController @@ -36,6 +35,7 @@ class MirroringConfirmationDialog( context: Context, private val onStartMirroringClickListener: View.OnClickListener, private val onCancelMirroring: View.OnClickListener, + private val navbarBottomInsetsProvider: () -> Int, configurationController: ConfigurationController? = null, theme: Int = R.style.Theme_SystemUI_Dialog, ) : SystemUIBottomSheetDialog(context, configurationController, theme) { @@ -67,12 +67,12 @@ class MirroringConfirmationDialog( private fun setupInsets() { // This avoids overlap between dialog content and navigation bars. requireViewById<View>(R.id.cd_bottom_sheet).apply { - val navbarInsets = Utils.getNavbarInsets(context) + val navbarInsets = navbarBottomInsetsProvider() val defaultDialogBottomInset = context.resources.getDimensionPixelSize(R.dimen.dialog_bottom_padding) // we only care about the bottom inset as in all other configuration where navigations // are in other display sides there is no overlap with the dialog. - updatePadding(bottom = max(navbarInsets.bottom, defaultDialogBottomInset)) + updatePadding(bottom = max(navbarInsets, defaultDialogBottomInset)) } } diff --git a/packages/SystemUI/src/com/android/systemui/display/ui/viewmodel/ConnectingDisplayViewModel.kt b/packages/SystemUI/src/com/android/systemui/display/ui/viewmodel/ConnectingDisplayViewModel.kt index 91f535df586a..19b4d2220558 100644 --- a/packages/SystemUI/src/com/android/systemui/display/ui/viewmodel/ConnectingDisplayViewModel.kt +++ b/packages/SystemUI/src/com/android/systemui/display/ui/viewmodel/ConnectingDisplayViewModel.kt @@ -17,6 +17,7 @@ package com.android.systemui.display.ui.viewmodel import android.app.Dialog import android.content.Context +import com.android.systemui.biometrics.Utils import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.qualifiers.Application import com.android.systemui.dagger.qualifiers.Background @@ -74,7 +75,8 @@ constructor( scope.launch(bgDispatcher) { pendingDisplay.ignore() } hideDialog() }, - configurationController + navbarBottomInsetsProvider = { Utils.getNavbarInsets(context).bottom }, + configurationController, ) .apply { show() } } diff --git a/packages/SystemUI/src/com/android/systemui/flags/Flags.kt b/packages/SystemUI/src/com/android/systemui/flags/Flags.kt index 20925fe3c137..77384c49882a 100644 --- a/packages/SystemUI/src/com/android/systemui/flags/Flags.kt +++ b/packages/SystemUI/src/com/android/systemui/flags/Flags.kt @@ -68,9 +68,6 @@ object Flags { "notification_drag_to_contents" ) - // TODO(b/254512538): Tracking Bug - val INSTANT_VOICE_REPLY = unreleasedFlag("instant_voice_reply") - /** * This flag controls whether we register a listener for StatsD notification memory reports. * For statsd to actually call the listener however, a server-side toggle needs to be @@ -394,7 +391,7 @@ object Flags { @JvmField val SIGNAL_CALLBACK_DEPRECATION = releasedFlag("signal_callback_deprecation") // TODO(b/301610137): Tracking bug - @JvmField val NEW_NETWORK_SLICE_UI = unreleasedFlag("new_network_slice_ui", teamfood = true) + @JvmField val NEW_NETWORK_SLICE_UI = releasedFlag("new_network_slice_ui") // TODO(b/308138154): Tracking bug val FILTER_PROVISIONING_NETWORK_SUBSCRIPTIONS = @@ -792,10 +789,6 @@ object Flags { @JvmField val SHARE_WIFI_QS_BUTTON = releasedFlag("share_wifi_qs_button") - /** Enable haptic slider component in the brightness slider */ - @JvmField - val HAPTIC_BRIGHTNESS_SLIDER = unreleasedFlag("haptic_brightness_slider", teamfood = true) - // TODO(b/287205379): Tracking bug @JvmField val QS_CONTAINER_GRAPH_OPTIMIZER = releasedFlag( "qs_container_graph_optimizer") diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/data/repository/InWindowLauncherUnlockAnimationRepository.kt b/packages/SystemUI/src/com/android/systemui/keyguard/data/repository/InWindowLauncherUnlockAnimationRepository.kt new file mode 100644 index 000000000000..d23899be427b --- /dev/null +++ b/packages/SystemUI/src/com/android/systemui/keyguard/data/repository/InWindowLauncherUnlockAnimationRepository.kt @@ -0,0 +1,89 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.systemui.keyguard.data.repository + +import com.android.systemui.dagger.SysUISingleton +import com.android.systemui.keyguard.domain.interactor.InWindowLauncherUnlockAnimationInteractor +import com.android.systemui.shared.system.smartspace.ILauncherUnlockAnimationController +import com.android.systemui.shared.system.smartspace.SmartspaceState +import javax.inject.Inject +import kotlinx.coroutines.flow.MutableStateFlow + +/** + * State related to System UI's handling of the in-window Launcher unlock animations. This includes + * the staggered icon entry animation that plays during unlock, as well as the smartspace shared + * element animation, if supported. + * + * While the animations themselves occur fully in the Launcher window, System UI is responsible for + * preparing/starting the animations, as well as synchronizing the smartspace state so that the two + * smartspaces appear visually identical for the shared element animation. + */ +@SysUISingleton +class InWindowLauncherUnlockAnimationRepository @Inject constructor() { + + /** + * Whether we have called [ILauncherUnlockAnimationController.playUnlockAnimation] during this + * unlock sequence. This value is set back to false once + * [InWindowLauncherUnlockAnimationInteractor.shouldStartInWindowAnimation] reverts to false, + * which happens when we're no longer in transition to GONE or if the remote animation ends or + * is cancelled. + */ + val startedUnlockAnimation = MutableStateFlow(false) + + /** + * The unlock amount we've explicitly passed to + * [ILauncherUnlockAnimationController.setUnlockAmount]. This is used whenever System UI is + * directly controlling the amount of the unlock animation, such as during a manual swipe to + * unlock gesture. + * + * This value is *not* updated if we called + * [ILauncherUnlockAnimationController.playUnlockAnimation] to ask Launcher to animate all the + * way unlocked, since that animator is running in the Launcher window. + */ + val manualUnlockAmount: MutableStateFlow<Float?> = MutableStateFlow(null) + + /** + * The class name of the Launcher activity that provided us with a + * [ILauncherUnlockAnimationController], if applicable. We can use this to check if that + * launcher is underneath the lockscreen before playing in-window animations. + * + * If null, we have not been provided with a launcher unlock animation controller. + */ + val launcherActivityClass: MutableStateFlow<String?> = MutableStateFlow(null) + + /** + * Information about the Launcher's smartspace, which is passed to us via + * [ILauncherUnlockAnimationController]. + */ + val launcherSmartspaceState: MutableStateFlow<SmartspaceState?> = MutableStateFlow(null) + + fun setStartedUnlockAnimation(started: Boolean) { + startedUnlockAnimation.value = started + } + + fun setManualUnlockAmount(amount: Float?) { + manualUnlockAmount.value = amount + } + + fun setLauncherActivityClass(className: String) { + launcherActivityClass.value = className + } + + fun setLauncherSmartspaceState(state: SmartspaceState?) { + launcherSmartspaceState.value = state + } +} diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/data/repository/KeyguardSurfaceBehindRepository.kt b/packages/SystemUI/src/com/android/systemui/keyguard/data/repository/KeyguardSurfaceBehindRepository.kt index 014b7fa0aeeb..6121b633d3c1 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/data/repository/KeyguardSurfaceBehindRepository.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/data/repository/KeyguardSurfaceBehindRepository.kt @@ -31,8 +31,14 @@ interface KeyguardSurfaceBehindRepository { /** Whether we're running animations on the surface. */ val isAnimatingSurface: Flow<Boolean> + /** Whether we have a RemoteAnimationTarget to run animations on the surface. */ + val isSurfaceRemoteAnimationTargetAvailable: Flow<Boolean> + /** Set whether we're running animations on the surface. */ fun setAnimatingSurface(animating: Boolean) + + /** Set whether we have a RemoteAnimationTarget with which to run animations on the surface. */ + fun setSurfaceRemoteAnimationTargetAvailable(available: Boolean) } @SysUISingleton @@ -40,7 +46,15 @@ class KeyguardSurfaceBehindRepositoryImpl @Inject constructor() : KeyguardSurfac private val _isAnimatingSurface = MutableStateFlow(false) override val isAnimatingSurface = _isAnimatingSurface.asStateFlow() + private val _isSurfaceRemoteAnimationTargetAvailable = MutableStateFlow(false) + override val isSurfaceRemoteAnimationTargetAvailable = + _isSurfaceRemoteAnimationTargetAvailable.asStateFlow() + override fun setAnimatingSurface(animating: Boolean) { _isAnimatingSurface.value = animating } + + override fun setSurfaceRemoteAnimationTargetAvailable(available: Boolean) { + _isSurfaceRemoteAnimationTargetAvailable.value = available + } } diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/FromLockscreenTransitionInteractor.kt b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/FromLockscreenTransitionInteractor.kt index c4962a1e1d17..ea40ba0376d4 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/FromLockscreenTransitionInteractor.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/FromLockscreenTransitionInteractor.kt @@ -35,6 +35,7 @@ import com.android.systemui.shade.data.repository.ShadeRepository import com.android.systemui.util.kotlin.Utils.Companion.toQuad import com.android.systemui.util.kotlin.Utils.Companion.toTriple import com.android.systemui.util.kotlin.sample +import dagger.Lazy import java.util.UUID import javax.inject.Inject import kotlin.time.Duration.Companion.milliseconds @@ -56,6 +57,7 @@ constructor( private val flags: FeatureFlags, private val shadeRepository: ShadeRepository, private val powerInteractor: PowerInteractor, + inWindowLauncherUnlockAnimationInteractor: Lazy<InWindowLauncherUnlockAnimationInteractor>, ) : TransitionInteractor( fromState = KeyguardState.LOCKSCREEN, @@ -104,12 +106,21 @@ constructor( val surfaceBehindModel: Flow<KeyguardSurfaceBehindModel?> = combine( transitionInteractor.startedKeyguardTransitionStep, - transitionInteractor.transitionStepsFromState(KeyguardState.LOCKSCREEN) - ) { startedStep, fromLockscreenStep -> + transitionInteractor.transitionStepsFromState(KeyguardState.LOCKSCREEN), + inWindowLauncherUnlockAnimationInteractor + .get() + .transitioningToGoneWithInWindowAnimation, + ) { startedStep, fromLockscreenStep, transitioningToGoneWithInWindowAnimation -> if (startedStep.to != KeyguardState.GONE) { // Only LOCKSCREEN -> GONE has specific surface params (for the unlock // animation). return@combine null + } else if (transitioningToGoneWithInWindowAnimation) { + // If we're prepared for the in-window unlock, we're going to play an animation + // in the window. Make it fully visible. + KeyguardSurfaceBehindModel( + alpha = 1f, + ) } else if (fromLockscreenStep.value > 0.5f) { // Start the animation once we're 50% transitioned to GONE. KeyguardSurfaceBehindModel( diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/InWindowLauncherUnlockAnimationInteractor.kt b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/InWindowLauncherUnlockAnimationInteractor.kt new file mode 100644 index 000000000000..e7d74a5c2056 --- /dev/null +++ b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/InWindowLauncherUnlockAnimationInteractor.kt @@ -0,0 +1,103 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.systemui.keyguard.domain.interactor + +import com.android.systemui.dagger.SysUISingleton +import com.android.systemui.dagger.qualifiers.Application +import com.android.systemui.keyguard.data.repository.InWindowLauncherUnlockAnimationRepository +import com.android.systemui.keyguard.data.repository.KeyguardSurfaceBehindRepository +import com.android.systemui.keyguard.shared.model.KeyguardState +import com.android.systemui.shared.system.ActivityManagerWrapper +import com.android.systemui.shared.system.smartspace.SmartspaceState +import com.android.systemui.util.kotlin.sample +import javax.inject.Inject +import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.flow.SharingStarted +import kotlinx.coroutines.flow.StateFlow +import kotlinx.coroutines.flow.asStateFlow +import kotlinx.coroutines.flow.combine +import kotlinx.coroutines.flow.map +import kotlinx.coroutines.flow.stateIn + +@SysUISingleton +class InWindowLauncherUnlockAnimationInteractor +@Inject +constructor( + private val repository: InWindowLauncherUnlockAnimationRepository, + @Application scope: CoroutineScope, + transitionInteractor: KeyguardTransitionInteractor, + surfaceBehindRepository: dagger.Lazy<KeyguardSurfaceBehindRepository>, + private val activityManager: ActivityManagerWrapper, +) { + val startedUnlockAnimation = repository.startedUnlockAnimation.asStateFlow() + + /** + * Whether we've STARTED but not FINISHED a transition to GONE, and the preconditions are met to + * play the in-window unlock animation. + */ + val transitioningToGoneWithInWindowAnimation: StateFlow<Boolean> = + transitionInteractor + .isInTransitionToState(KeyguardState.GONE) + .sample(repository.launcherActivityClass, ::Pair) + .map { (isTransitioningToGone, launcherActivityClass) -> + isTransitioningToGone && isActivityClassUnderneath(launcherActivityClass) + } + .stateIn(scope, SharingStarted.Eagerly, false) + + /** + * Whether we should start the in-window unlock animation. + * + * This emits true once the Launcher surface becomes available while we're + * [transitioningToGoneWithInWindowAnimation]. + */ + val shouldStartInWindowAnimation: StateFlow<Boolean> = + combine( + transitioningToGoneWithInWindowAnimation, + surfaceBehindRepository.get().isSurfaceRemoteAnimationTargetAvailable, + ) { transitioningWithInWindowAnimation, isSurfaceAvailable -> + transitioningWithInWindowAnimation && isSurfaceAvailable + } + .stateIn(scope, SharingStarted.Eagerly, false) + + /** Sets whether we've started */ + fun setStartedUnlockAnimation(started: Boolean) { + repository.setStartedUnlockAnimation(started) + } + + fun setManualUnlockAmount(amount: Float) { + repository.setManualUnlockAmount(amount) + } + + fun setLauncherActivityClass(className: String) { + repository.setLauncherActivityClass(className) + } + + fun setLauncherSmartspaceState(state: SmartspaceState?) { + repository.setLauncherSmartspaceState(state) + } + + /** + * Whether an activity with the given [activityClass] name is currently underneath the + * lockscreen (it's at the top of the activity task stack). + */ + private fun isActivityClassUnderneath(activityClass: String?): Boolean { + return activityClass?.let { + activityManager.runningTask?.topActivity?.className?.equals(it) + } + ?: false + } +} diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardSurfaceBehindInteractor.kt b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardSurfaceBehindInteractor.kt index bf04f8f82430..efbe2611e960 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardSurfaceBehindInteractor.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardSurfaceBehindInteractor.kt @@ -20,13 +20,13 @@ import com.android.systemui.dagger.SysUISingleton import com.android.systemui.keyguard.data.repository.KeyguardSurfaceBehindRepository import com.android.systemui.keyguard.shared.model.KeyguardState import com.android.systemui.keyguard.shared.model.KeyguardSurfaceBehindModel +import javax.inject.Inject import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.combine import kotlinx.coroutines.flow.flatMapLatest import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.flow.map -import javax.inject.Inject @SysUISingleton class KeyguardSurfaceBehindInteractor @@ -40,19 +40,18 @@ constructor( @OptIn(ExperimentalCoroutinesApi::class) val viewParams: Flow<KeyguardSurfaceBehindModel> = - transitionInteractor.isInTransitionToAnyState - .flatMapLatest { isInTransition -> - if (!isInTransition) { - defaultParams - } else { - combine( - transitionSpecificViewParams, - defaultParams, - ) { transitionParams, defaultParams -> - transitionParams ?: defaultParams - } + transitionInteractor.isInTransitionToAnyState.flatMapLatest { isInTransition -> + if (!isInTransition) { + defaultParams + } else { + combine( + transitionSpecificViewParams, + defaultParams, + ) { transitionParams, defaultParams -> + transitionParams ?: defaultParams } } + } val isAnimatingSurface = repository.isAnimatingSurface @@ -86,4 +85,8 @@ constructor( fun setAnimatingSurface(animating: Boolean) { repository.setAnimatingSurface(animating) } + + fun setSurfaceRemoteAnimationTargetAvailable(available: Boolean) { + repository.setSurfaceRemoteAnimationTargetAvailable(available) + } } diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/InWindowLauncherAnimationViewBinder.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/InWindowLauncherAnimationViewBinder.kt new file mode 100644 index 000000000000..56a6e9b127f6 --- /dev/null +++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/InWindowLauncherAnimationViewBinder.kt @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.systemui.keyguard.ui.binder + +import com.android.systemui.keyguard.ui.view.InWindowLauncherUnlockAnimationManager +import com.android.systemui.keyguard.ui.viewmodel.InWindowLauncherAnimationViewModel +import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.launch + +/** + * Binds the [InWindowLauncherUnlockAnimationManager] "view", which manages the lifecycle and state + * of the in-window Launcher animation. + */ +object InWindowLauncherAnimationViewBinder { + + @JvmStatic + fun bind( + viewModel: InWindowLauncherAnimationViewModel, + inWindowLauncherUnlockAnimationManager: InWindowLauncherUnlockAnimationManager, + scope: CoroutineScope + ) { + scope.launch { + viewModel.shouldPrepareForInWindowAnimation.collect { shouldPrepare -> + if (shouldPrepare) { + inWindowLauncherUnlockAnimationManager.prepareForUnlock() + } else { + // If we no longer meet the conditions to prepare for unlock, we'll need to + // manually set Launcher unlocked if we didn't start the unlock animation, or it + // will remain "prepared" (blank) forever. + inWindowLauncherUnlockAnimationManager.ensureUnlockedOrAnimatingUnlocked() + } + } + } + + scope.launch { + viewModel.shouldStartInWindowAnimation.collect { shouldStart -> + if (shouldStart) { + inWindowLauncherUnlockAnimationManager.playUnlockAnimation(unlocked = true) + } else { + // Once the conditions to start the animation are no longer met, clear whether + // we started the animation, since we'll need to start it again if the + // conditions become true again. + inWindowLauncherUnlockAnimationManager.clearStartedUnlockAnimation() + } + } + } + } +} diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardSurfaceBehindParamsApplier.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardSurfaceBehindParamsApplier.kt index c8dab3223d33..8587022a24b7 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardSurfaceBehindParamsApplier.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardSurfaceBehindParamsApplier.kt @@ -51,6 +51,11 @@ constructor( private val interactor: KeyguardSurfaceBehindInteractor, ) { private var surfaceBehind: RemoteAnimationTarget? = null + set(value) { + field = value + interactor.setSurfaceRemoteAnimationTargetAvailable(value != null) + } + private val surfaceTransactionApplier: SyncRtSurfaceTransactionApplier get() = SyncRtSurfaceTransactionApplier(keyguardViewController.viewRootImpl.view) @@ -66,7 +71,7 @@ constructor( dampingRatio = 1f } addUpdateListener { _, _, _ -> applyToSurfaceBehind() } - addEndListener { _, _, _, _ -> + addEndListener { _, _, _, _ -> try { updateIsAnimatingSurface() } catch (e: NullPointerException) { @@ -112,6 +117,7 @@ constructor( fun applyParamsToSurface(surface: RemoteAnimationTarget) { this.surfaceBehind = surface startOrUpdateAnimators() + applyToSurfaceBehind() } /** diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/InWindowLauncherUnlockAnimationManager.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/InWindowLauncherUnlockAnimationManager.kt new file mode 100644 index 000000000000..eb005f226cf1 --- /dev/null +++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/InWindowLauncherUnlockAnimationManager.kt @@ -0,0 +1,199 @@ +/* + * + * * Copyright (C) 2023 The Android Open Source Project + * * + * * Licensed under the Apache License, Version 2.0 (the "License"); + * * you may not use this file except in compliance with the License. + * * You may obtain a copy of the License at + * * + * * http://www.apache.org/licenses/LICENSE-2.0 + * * + * * Unless required by applicable law or agreed to in writing, software + * * distributed under the License is distributed on an "AS IS" BASIS, + * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * * See the License for the specific language governing permissions and + * * limitations under the License. + * + * + */ +package com.android.systemui.keyguard.ui.view + +import android.graphics.Rect +import android.util.Log +import android.view.View +import com.android.systemui.dagger.SysUISingleton +import com.android.systemui.dagger.qualifiers.Application +import com.android.systemui.keyguard.domain.interactor.InWindowLauncherUnlockAnimationInteractor +import com.android.systemui.keyguard.ui.binder.InWindowLauncherAnimationViewBinder +import com.android.systemui.keyguard.ui.viewmodel.InWindowLauncherAnimationViewModel +import com.android.systemui.shared.system.smartspace.ILauncherUnlockAnimationController +import com.android.systemui.shared.system.smartspace.ISysuiUnlockAnimationController +import com.android.systemui.shared.system.smartspace.SmartspaceState +import javax.inject.Inject +import kotlinx.coroutines.CoroutineScope + +private val TAG = InWindowLauncherUnlockAnimationManager::class.simpleName +private const val UNLOCK_ANIMATION_DURATION = 633L +private const val UNLOCK_START_DELAY = 100L + +/** + * Handles interactions between System UI and Launcher related to the in-window unlock animation. + * + * Launcher registers its unlock controller with us here, and we use that to prepare for and start + * the unlock animation. + */ +@SysUISingleton +class InWindowLauncherUnlockAnimationManager +@Inject +constructor( + val interactor: InWindowLauncherUnlockAnimationInteractor, + val viewModel: InWindowLauncherAnimationViewModel, + @Application val scope: CoroutineScope, +) : ISysuiUnlockAnimationController.Stub() { + + /** + * The smartspace view on the lockscreen. This is used to perform the shared element animation + * between the lockscreen smartspace and the launcher one. + */ + var lockscreenSmartspace: View? = null + + private var launcherAnimationController: ILauncherUnlockAnimationController? = null + + /** + * Whether we've called [ILauncherUnlockAnimationController.prepareForUnlock], and have *not* + * subsequently called [ILauncherUnlockAnimationController.playUnlockAnimation] or + * [ILauncherUnlockAnimationController.setUnlockAmount]. + */ + private var preparedForUnlock = false + + /** + * Most recent value passed to [ILauncherUnlockAnimationController.setUnlockAmount] during this + * unlock. + * + * Null if we have not set a manual unlock amount, or once [ensureUnlockedOrAnimatingUnlocked] + * has been called. + */ + private var manualUnlockAmount: Float? = null + + /** + * Called from [OverviewProxyService] to provide us with the launcher unlock animation + * controller, which can be used to start and update the unlock animation in the launcher + * process. + */ + override fun setLauncherUnlockController( + activityClass: String, + launcherController: ILauncherUnlockAnimationController, + ) { + interactor.setLauncherActivityClass(activityClass) + launcherAnimationController = launcherController + + // Bind once we have a launcher controller. + InWindowLauncherAnimationViewBinder.bind(viewModel, this, scope) + } + + /** + * Called from the launcher process when their smartspace state updates something we should know + * about. + */ + override fun onLauncherSmartspaceStateUpdated(state: SmartspaceState?) { + interactor.setLauncherSmartspaceState(state) + } + + /** + * Requests that the launcher prepare for unlock by becoming blank and optionally positioning + * its smartspace at the same position as the lockscreen smartspace. + * + * This state is dangerous - the launcher will remain blank until we ask it to animate unlocked, + * either via [playUnlockAnimation] or [setUnlockAmount]. If you don't want to get funny but bad + * bugs titled "tiny launcher" or "Expected: launcher icons; Actual: no icons ever", be very + * careful here. + */ + fun prepareForUnlock() { + launcherAnimationController?.let { launcher -> + if (!preparedForUnlock) { + preparedForUnlock = true + manualUnlockAmount = null + + launcher.prepareForUnlock( + false, + Rect(), + 0 + ) // TODO(b/293894758): Add smartspace animation support. + } + } + } + + /** Ensures that the launcher is either fully visible, or animating to be fully visible. */ + fun ensureUnlockedOrAnimatingUnlocked() { + val preparedButDidNotStartAnimation = + preparedForUnlock && !interactor.startedUnlockAnimation.value + val manualUnlockSetButNotFullyVisible = + manualUnlockAmount != null && manualUnlockAmount != 1f + + if (preparedButDidNotStartAnimation) { + Log.e( + TAG, + "Called prepareForUnlock(), but not playUnlockAnimation(). " + + "Failing-safe by calling setUnlockAmount(1f)" + ) + setUnlockAmount(1f, forceIfAnimating = true) + } else if (manualUnlockSetButNotFullyVisible) { + Log.e( + TAG, + "Unlock has ended, but manual unlock amount != 1f. " + + "Failing-safe by calling setUnlockAmount(1f)" + ) + setUnlockAmount(1f, forceIfAnimating = true) + } + + manualUnlockAmount = null // Un-set the manual unlock amount as we're now visible. + } + + /** + * Asks launcher to play the in-window unlock animation with the specified parameters. + * + * Once this is called, we're no longer [preparedForUnlock] as unlock is underway. + */ + fun playUnlockAnimation( + unlocked: Boolean, + duration: Long = UNLOCK_ANIMATION_DURATION, + startDelay: Long = UNLOCK_START_DELAY, + ) { + if (preparedForUnlock) { + launcherAnimationController?.let { launcher -> + launcher.playUnlockAnimation(unlocked, duration, startDelay) + interactor.setStartedUnlockAnimation(true) + } + } else { + Log.e(TAG, "Attempted to call playUnlockAnimation() before prepareToUnlock().") + } + + preparedForUnlock = false + } + + /** + * Clears the played unlock animation flag. Since we don't have access to an onAnimationEnd + * event for the launcher animation (since it's in a different process), this is called whenever + * the transition to GONE ends or the surface becomes unavailable. In both cases, we'd need to + * play the animation next time we unlock. + */ + fun clearStartedUnlockAnimation() { + interactor.setStartedUnlockAnimation(false) + } + + /** + * Manually sets the unlock amount on launcher. This is used to explicitly set us to fully + * unlocked, or to manually control the animation (such as during a swipe to unlock). + * + * Once this is called, we're no longer [preparedForUnlock] since the Launcher icons are not + * configured to be invisible for the start of the unlock animation. + */ + fun setUnlockAmount(amount: Float, forceIfAnimating: Boolean) { + preparedForUnlock = false + + launcherAnimationController?.let { + manualUnlockAmount = amount + it.setUnlockAmount(amount, forceIfAnimating) + } + } +} diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/InWindowLauncherAnimationViewModel.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/InWindowLauncherAnimationViewModel.kt new file mode 100644 index 000000000000..2807558adc7c --- /dev/null +++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/InWindowLauncherAnimationViewModel.kt @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.systemui.keyguard.ui.viewmodel + +import com.android.systemui.dagger.SysUISingleton +import com.android.systemui.keyguard.domain.interactor.InWindowLauncherUnlockAnimationInteractor +import javax.inject.Inject + +@SysUISingleton +class InWindowLauncherAnimationViewModel +@Inject +constructor(interactor: InWindowLauncherUnlockAnimationInteractor) { + + /** + * Whether we should call [ILauncherUnlockAnimationController.prepareForUnlock] to set up the + * Launcher icons for the in-window unlock. + * + * We'll do this as soon as we're transitioning to GONE when the necessary preconditions are + * met. + */ + val shouldPrepareForInWindowAnimation = interactor.transitioningToGoneWithInWindowAnimation + + /** + * Whether we should call [ILauncherUnlockAnimationController.playUnlockAnimation] to start the + * in-window unlock animation. + */ + val shouldStartInWindowAnimation = interactor.shouldStartInWindowAnimation +} diff --git a/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java b/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java index 1334660ea4d5..377803fa6639 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java +++ b/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java @@ -85,8 +85,10 @@ import com.android.systemui.dagger.SysUISingleton; import com.android.systemui.dagger.qualifiers.Main; import com.android.systemui.dump.DumpManager; import com.android.systemui.flags.FeatureFlags; +import com.android.systemui.flags.Flags; import com.android.systemui.keyguard.KeyguardUnlockAnimationController; import com.android.systemui.keyguard.WakefulnessLifecycle; +import com.android.systemui.keyguard.ui.view.InWindowLauncherUnlockAnimationManager; import com.android.systemui.model.SysUiState; import com.android.systemui.navigationbar.NavigationBar; import com.android.systemui.navigationbar.NavigationBarController; @@ -102,6 +104,7 @@ import com.android.systemui.shade.ShadeViewController; import com.android.systemui.shared.recents.IOverviewProxy; import com.android.systemui.shared.recents.ISystemUiProxy; import com.android.systemui.shared.system.QuickStepContract; +import com.android.systemui.shared.system.smartspace.ISysuiUnlockAnimationController; import com.android.systemui.statusbar.CommandQueue; import com.android.systemui.statusbar.NotificationShadeWindowController; import com.android.systemui.statusbar.phone.StatusBarWindowCallback; @@ -109,8 +112,6 @@ import com.android.systemui.statusbar.policy.CallbackController; import com.android.systemui.unfold.progress.UnfoldTransitionProgressForwarder; import com.android.wm.shell.sysui.ShellInterface; -import dagger.Lazy; - import java.io.PrintWriter; import java.util.ArrayList; import java.util.List; @@ -122,6 +123,8 @@ import java.util.function.Supplier; import javax.inject.Inject; import javax.inject.Provider; +import dagger.Lazy; + /** * Class to send information from overview to launcher with a binder. */ @@ -160,7 +163,7 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis private final ScreenshotHelper mScreenshotHelper; private final CommandQueue mCommandQueue; private final UserTracker mUserTracker; - private final KeyguardUnlockAnimationController mSysuiUnlockAnimationController; + private final ISysuiUnlockAnimationController mSysuiUnlockAnimationController; private final Optional<UnfoldTransitionProgressForwarder> mUnfoldTransitionProgressForwarder; private final UiEventLogger mUiEventLogger; private final DisplayTracker mDisplayTracker; @@ -580,6 +583,7 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis UiEventLogger uiEventLogger, DisplayTracker displayTracker, KeyguardUnlockAnimationController sysuiUnlockAnimationController, + InWindowLauncherUnlockAnimationManager inWindowLauncherUnlockAnimationManager, AssistUtils assistUtils, FeatureFlags featureFlags, SceneContainerFlags sceneContainerFlags, @@ -613,7 +617,12 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis mUiEventLogger = uiEventLogger; mDisplayTracker = displayTracker; mUnfoldTransitionProgressForwarder = unfoldTransitionProgressForwarder; - mSysuiUnlockAnimationController = sysuiUnlockAnimationController; + + if (!featureFlags.isEnabled(Flags.KEYGUARD_WM_STATE_REFACTOR)) { + mSysuiUnlockAnimationController = sysuiUnlockAnimationController; + } else { + mSysuiUnlockAnimationController = inWindowLauncherUnlockAnimationManager; + } dumpManager.registerDumpable(getClass().getSimpleName(), this); diff --git a/packages/SystemUI/src/com/android/systemui/settings/brightness/BrightnessSliderController.java b/packages/SystemUI/src/com/android/systemui/settings/brightness/BrightnessSliderController.java index 6fa592c6dd78..b30bc56aeeb0 100644 --- a/packages/SystemUI/src/com/android/systemui/settings/brightness/BrightnessSliderController.java +++ b/packages/SystemUI/src/com/android/systemui/settings/brightness/BrightnessSliderController.java @@ -16,7 +16,7 @@ package com.android.systemui.settings.brightness; -import static com.android.systemui.flags.Flags.HAPTIC_BRIGHTNESS_SLIDER; +import static com.android.systemui.Flags.hapticBrightnessSlider; import android.content.Context; import android.view.LayoutInflater; @@ -32,7 +32,6 @@ import com.android.settingslib.RestrictedLockUtils; import com.android.systemui.Gefingerpoken; import com.android.systemui.classifier.Classifier; import com.android.systemui.dagger.qualifiers.Main; -import com.android.systemui.flags.FeatureFlagsClassic; import com.android.systemui.haptics.slider.SeekableSliderEventProducer; import com.android.systemui.plugins.ActivityStarter; import com.android.systemui.plugins.FalsingManager; @@ -280,7 +279,6 @@ public class BrightnessSliderController extends ViewController<BrightnessSliderV private final FalsingManager mFalsingManager; private final UiEventLogger mUiEventLogger; - private final FeatureFlagsClassic mFeatureFlags; private final VibratorHelper mVibratorHelper; private final SystemClock mSystemClock; private final CoroutineDispatcher mMainDispatcher; @@ -292,12 +290,10 @@ public class BrightnessSliderController extends ViewController<BrightnessSliderV UiEventLogger uiEventLogger, VibratorHelper vibratorHelper, SystemClock clock, - FeatureFlagsClassic featureFlags, @Main CoroutineDispatcher mainDispatcher, ActivityStarter activityStarter) { mFalsingManager = falsingManager; mUiEventLogger = uiEventLogger; - mFeatureFlags = featureFlags; mVibratorHelper = vibratorHelper; mSystemClock = clock; mMainDispatcher = mainDispatcher; @@ -320,7 +316,7 @@ public class BrightnessSliderController extends ViewController<BrightnessSliderV root.setActivityStarter(mActivityStarter); BrightnessSliderHapticPlugin plugin; - if (mFeatureFlags.isEnabled(HAPTIC_BRIGHTNESS_SLIDER)) { + if (hapticBrightnessSlider()) { plugin = new BrightnessSliderHapticPluginImpl( mVibratorHelper, mSystemClock, diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/icon/ui/viewbinder/NotificationIconContainerViewBinder.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/icon/ui/viewbinder/NotificationIconContainerViewBinder.kt index db0fa99af440..65b798a14e0b 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/icon/ui/viewbinder/NotificationIconContainerViewBinder.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/icon/ui/viewbinder/NotificationIconContainerViewBinder.kt @@ -251,7 +251,7 @@ object NotificationIconContainerViewBinder { val replacingIcons = iconsDiff.groupReplacements.mapValuesNotNullTo(ArrayMap()) { (_, v) -> - viewStore.iconView(v.notifKey)?.statusBarIcon + viewStore.iconView(v.notifKey).statusBarIcon } view.setReplacingIcons(replacingIcons) @@ -264,7 +264,7 @@ object NotificationIconContainerViewBinder { .mapNotNull { key -> childrenByNotifKey[key] } .forEach { child -> view.removeView(child) } - val toAdd = iconsDiff.added.mapNotNull { viewStore.iconView(it.notifKey) } + val toAdd = iconsDiff.added.map { viewStore.iconView(it.notifKey) } for ((i, sbiv) in toAdd.withIndex()) { // The view might still be transiently added if it was just removed // and added again @@ -277,7 +277,7 @@ object NotificationIconContainerViewBinder { val childCount = view.childCount for (i in 0 until childCount) { val actual = view.getChildAt(i) - val expected = viewStore.iconView(iconsData.visibleKeys[i].notifKey)!! + val expected = viewStore.iconView(iconsData.visibleKeys[i].notifKey) if (actual === expected) { continue } @@ -314,7 +314,7 @@ object NotificationIconContainerViewBinder { /** External storage for [StatusBarIconView] instances. */ fun interface IconViewStore { - fun iconView(key: String): StatusBarIconView? + fun iconView(key: String): StatusBarIconView } @ColorInt private val DEFAULT_AOD_ICON_COLOR = Color.WHITE @@ -326,8 +326,10 @@ class ShelfNotificationIconViewStore constructor( private val notifCollection: NotifCollection, ) : IconViewStore { - override fun iconView(key: String): StatusBarIconView? = - notifCollection.getEntry(key)?.icons?.shelfIcon + override fun iconView(key: String): StatusBarIconView { + val entry = notifCollection.getEntry(key) ?: error("No entry found for key: $key") + return entry.icons.shelfIcon ?: error("No shelf IconView found for key: $key") + } } /** [IconViewStore] for the always-on display. */ @@ -336,8 +338,10 @@ class AlwaysOnDisplayNotificationIconViewStore constructor( private val notifCollection: NotifCollection, ) : IconViewStore { - override fun iconView(key: String): StatusBarIconView? = - notifCollection.getEntry(key)?.icons?.aodIcon + override fun iconView(key: String): StatusBarIconView { + val entry = notifCollection.getEntry(key) ?: error("No entry found for key: $key") + return entry.icons.aodIcon ?: error("No AOD IconView found for key: $key") + } } /** [IconViewStore] for the status bar. */ @@ -346,8 +350,10 @@ class StatusBarNotificationIconViewStore constructor( private val notifCollection: NotifCollection, ) : IconViewStore { - override fun iconView(key: String): StatusBarIconView? = - notifCollection.getEntry(key)?.icons?.statusBarIcon + override fun iconView(key: String): StatusBarIconView { + val entry = notifCollection.getEntry(key) ?: error("No entry found for key: $key") + return entry.icons.statusBarIcon ?: error("No status bar IconView found for key: $key") + } } private val View.viewBounds: Rect diff --git a/packages/SystemUI/src/com/android/systemui/tuner/LockscreenFragment.java b/packages/SystemUI/src/com/android/systemui/tuner/LockscreenFragment.java index 771a8c8a0cfd..799e5af7e01d 100644 --- a/packages/SystemUI/src/com/android/systemui/tuner/LockscreenFragment.java +++ b/packages/SystemUI/src/com/android/systemui/tuner/LockscreenFragment.java @@ -48,6 +48,8 @@ import com.android.systemui.statusbar.phone.ExpandableIndicator; import com.android.systemui.statusbar.policy.ExtensionController.TunerFactory; import com.android.systemui.tuner.ShortcutParser.Shortcut; import com.android.systemui.tuner.TunerService.Tunable; +import com.android.tools.r8.keepanno.annotations.KeepTarget; +import com.android.tools.r8.keepanno.annotations.UsesReflection; import java.util.ArrayList; import java.util.Map; @@ -69,6 +71,9 @@ public class LockscreenFragment extends PreferenceFragment { private TunerService mTunerService; private Handler mHandler; + // aapt doesn't generate keep rules for android:fragment references in <Preference> tags, so + // explicitly declare references per usage in `R.xml.lockscreen_settings`. See b/120445169. + @UsesReflection(@KeepTarget(classConstant = ShortcutPicker.class)) @Override public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { mTunerService = Dependency.get(TunerService.class); diff --git a/packages/SystemUI/src/com/android/systemui/tuner/OtherPrefs.java b/packages/SystemUI/src/com/android/systemui/tuner/OtherPrefs.java index 32b1b2607323..8d8599900530 100644 --- a/packages/SystemUI/src/com/android/systemui/tuner/OtherPrefs.java +++ b/packages/SystemUI/src/com/android/systemui/tuner/OtherPrefs.java @@ -19,8 +19,13 @@ import android.os.Bundle; import androidx.preference.PreferenceFragment; import com.android.systemui.res.R; +import com.android.tools.r8.keepanno.annotations.KeepTarget; +import com.android.tools.r8.keepanno.annotations.UsesReflection; public class OtherPrefs extends PreferenceFragment { + // aapt doesn't generate keep rules for android:fragment references in <Preference> tags, so + // explicitly declare references per usage in `R.xml.other_settings`. See b/120445169. + @UsesReflection(@KeepTarget(classConstant = PowerNotificationControlsFragment.class)) @Override public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { addPreferencesFromResource(R.xml.other_settings); diff --git a/packages/SystemUI/src/com/android/systemui/tuner/TunerFragment.java b/packages/SystemUI/src/com/android/systemui/tuner/TunerFragment.java index 9cc526a1c0f3..873b6d55de75 100644 --- a/packages/SystemUI/src/com/android/systemui/tuner/TunerFragment.java +++ b/packages/SystemUI/src/com/android/systemui/tuner/TunerFragment.java @@ -35,6 +35,8 @@ import com.android.internal.logging.MetricsLogger; import com.android.internal.logging.nano.MetricsProto.MetricsEvent; import com.android.systemui.res.R; import com.android.systemui.shared.plugins.PluginPrefs; +import com.android.tools.r8.keepanno.annotations.KeepTarget; +import com.android.tools.r8.keepanno.annotations.UsesReflection; public class TunerFragment extends PreferenceFragment { @@ -77,6 +79,13 @@ public class TunerFragment extends PreferenceFragment { getActivity().getActionBar().setDisplayHomeAsUpEnabled(true); } + // aapt doesn't generate keep rules for android:fragment references in <Preference> tags, so + // explicitly declare references per usage in `R.xml.tuner_prefs`. See b/120445169. + @UsesReflection({ + @KeepTarget(classConstant = LockscreenFragment.class), + @KeepTarget(classConstant = NavBarTuner.class), + @KeepTarget(classConstant = PluginFragment.class), + }) @Override public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { addPreferencesFromResource(R.xml.tuner_prefs); diff --git a/packages/SystemUI/tests/src/com/android/TestMocksModule.kt b/packages/SystemUI/tests/src/com/android/TestMocksModule.kt index 0cb913b10764..fd50f15dc5fc 100644 --- a/packages/SystemUI/tests/src/com/android/TestMocksModule.kt +++ b/packages/SystemUI/tests/src/com/android/TestMocksModule.kt @@ -38,6 +38,7 @@ import com.android.systemui.model.SysUiState import com.android.systemui.plugins.ActivityStarter import com.android.systemui.plugins.DarkIconDispatcher import com.android.systemui.plugins.statusbar.StatusBarStateController +import com.android.systemui.shared.system.ActivityManagerWrapper import com.android.systemui.statusbar.LockscreenShadeTransitionController import com.android.systemui.statusbar.NotificationListener import com.android.systemui.statusbar.NotificationLockscreenUserManager @@ -66,6 +67,7 @@ import java.util.Optional @Module(includes = [TestMocksModule.Bindings::class]) data class TestMocksModule( @get:Provides val activityStarter: ActivityStarter = mock(), + @get:Provides val activityManagerWrapper: ActivityManagerWrapper = mock(), @get:Provides val ambientState: AmbientState = mock(), @get:Provides val bubbles: Optional<Bubbles> = Optional.of(mock()), @get:Provides val darkIconDispatcher: DarkIconDispatcher = mock(), diff --git a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardClockSwitchControllerBaseTest.java b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardClockSwitchControllerBaseTest.java index aabe63304f26..a38ba00d898f 100644 --- a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardClockSwitchControllerBaseTest.java +++ b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardClockSwitchControllerBaseTest.java @@ -43,6 +43,7 @@ import com.android.systemui.flags.FakeFeatureFlags; import com.android.systemui.keyguard.KeyguardUnlockAnimationController; import com.android.systemui.keyguard.domain.interactor.KeyguardClockInteractor; import com.android.systemui.keyguard.domain.interactor.KeyguardInteractorFactory; +import com.android.systemui.keyguard.ui.view.InWindowLauncherUnlockAnimationManager; import com.android.systemui.keyguard.ui.viewmodel.KeyguardRootViewModel; import com.android.systemui.log.LogBuffer; import com.android.systemui.plugins.ClockAnimations; @@ -204,7 +205,8 @@ public class KeyguardClockSwitchControllerBaseTest extends SysuiTestCase { mock(AlwaysOnDisplayNotificationIconViewStore.class), KeyguardInteractorFactory.create(mFakeFeatureFlags).getKeyguardInteractor(), mKeyguardClockInteractor, - mFakeFeatureFlags + mFakeFeatureFlags, + mock(InWindowLauncherUnlockAnimationManager.class) ); when(mStatusBarStateController.getState()).thenReturn(StatusBarState.SHADE); diff --git a/packages/SystemUI/tests/src/com/android/systemui/display/ui/view/MirroringConfirmationDialogTest.kt b/packages/SystemUI/tests/src/com/android/systemui/display/ui/view/MirroringConfirmationDialogTest.kt index dcc15ae0e2c3..b25fb6e2757a 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/display/ui/view/MirroringConfirmationDialogTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/display/ui/view/MirroringConfirmationDialogTest.kt @@ -20,8 +20,8 @@ import android.testing.AndroidTestingRunner import android.testing.TestableLooper import android.view.View import androidx.test.filters.SmallTest -import com.android.systemui.res.R import com.android.systemui.SysuiTestCase +import com.android.systemui.res.R import com.android.systemui.util.mockito.any import com.android.systemui.util.mockito.mock import org.junit.After @@ -45,7 +45,13 @@ class MirroringConfirmationDialogTest : SysuiTestCase() { fun setUp() { MockitoAnnotations.initMocks(this) - dialog = MirroringConfirmationDialog(context, onStartMirroringCallback, onCancelCallback) + dialog = + MirroringConfirmationDialog( + context, + onStartMirroringCallback, + onCancelCallback, + navbarBottomInsetsProvider = { 0 }, + ) } @Test diff --git a/packages/SystemUI/tests/src/com/android/systemui/keyguard/domain/interactor/FromLockscreenTransitionInteractorTest.kt b/packages/SystemUI/tests/src/com/android/systemui/keyguard/domain/interactor/FromLockscreenTransitionInteractorTest.kt index 4f6ec7147a57..b439fcf8c98a 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/keyguard/domain/interactor/FromLockscreenTransitionInteractorTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/keyguard/domain/interactor/FromLockscreenTransitionInteractorTest.kt @@ -18,23 +18,34 @@ package com.android.systemui.keyguard.domain.interactor import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest +import com.android.SysUITestModule +import com.android.TestMocksModule +import com.android.systemui.SysuiTestCase import com.android.systemui.coroutines.collectValues -import com.android.systemui.flags.FakeFeatureFlags +import com.android.systemui.dagger.SysUISingleton +import com.android.systemui.keyguard.data.repository.FakeKeyguardSurfaceBehindRepository +import com.android.systemui.keyguard.data.repository.FakeKeyguardTransitionRepository +import com.android.systemui.keyguard.data.repository.InWindowLauncherUnlockAnimationRepository import com.android.systemui.keyguard.shared.model.KeyguardState import com.android.systemui.keyguard.shared.model.TransitionState import com.android.systemui.keyguard.shared.model.TransitionStep -import com.android.systemui.power.domain.interactor.PowerInteractorFactory -import com.android.systemui.shade.data.repository.FakeShadeRepository +import com.android.systemui.keyguard.util.mockTopActivityClassName +import com.android.systemui.shared.system.ActivityManagerWrapper +import dagger.BindsInstance +import dagger.Component import dagger.Lazy import junit.framework.Assert.assertEquals import junit.framework.Assert.assertTrue import junit.framework.Assert.fail import kotlinx.coroutines.ExperimentalCoroutinesApi +import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Before import org.junit.Test import org.junit.runner.RunWith +import org.mockito.Mock +import org.mockito.MockitoAnnotations @OptIn(ExperimentalCoroutinesApi::class) @SmallTest @@ -49,20 +60,30 @@ class FromLockscreenTransitionInteractorTest : KeyguardTransitionInteractorTestC underTest } + private lateinit var testComponent: TestComponent + @Mock private lateinit var activityManagerWrapper: ActivityManagerWrapper + + private var topActivityClassName = "launcher" + @Before override fun setUp() { super.setUp() + MockitoAnnotations.initMocks(this) - underTest = - FromLockscreenTransitionInteractor( - transitionRepository = super.transitionRepository, - transitionInteractor = super.transitionInteractor, - scope = super.testScope.backgroundScope, - keyguardInteractor = super.keyguardInteractor, - flags = FakeFeatureFlags(), - shadeRepository = FakeShadeRepository(), - powerInteractor = PowerInteractorFactory.create().powerInteractor, - ) + testComponent = + DaggerFromLockscreenTransitionInteractorTest_TestComponent.factory() + .create( + test = this, + mocks = + TestMocksModule( + activityManagerWrapper = activityManagerWrapper, + ), + ) + underTest = testComponent.underTest + testScope = testComponent.testScope + transitionRepository = testComponent.transitionRepository + + activityManagerWrapper.mockTopActivityClassName(topActivityClassName) } @Test @@ -189,4 +210,73 @@ class FromLockscreenTransitionInteractorTest : KeyguardTransitionInteractorTestC fail("surfaceBehindModel was unexpectedly null.") } } + + @Test + fun testSurfaceBehindModel_alpha1_whenTransitioningWithInWindowAnimation() = + testScope.runTest { + testComponent.inWindowLauncherUnlockAnimationRepository.setLauncherActivityClass( + topActivityClassName + ) + runCurrent() + + val values by collectValues(underTest.surfaceBehindModel) + runCurrent() + + transitionRepository.sendTransitionStep( + TransitionStep( + transitionState = TransitionState.STARTED, + from = KeyguardState.LOCKSCREEN, + to = KeyguardState.GONE, + ) + ) + runCurrent() + + assertEquals(1f, values[values.size - 1]?.alpha) + } + + @Test + fun testSurfaceBehindModel_alphaZero_whenNotTransitioningWithInWindowAnimation() = + testScope.runTest { + testComponent.inWindowLauncherUnlockAnimationRepository.setLauncherActivityClass( + "not_launcher" + ) + runCurrent() + + val values by collectValues(underTest.surfaceBehindModel) + runCurrent() + + transitionRepository.sendTransitionStep( + TransitionStep( + transitionState = TransitionState.STARTED, + from = KeyguardState.LOCKSCREEN, + to = KeyguardState.GONE, + ) + ) + runCurrent() + + assertEquals(0f, values[values.size - 1]?.alpha) + } + + @SysUISingleton + @Component( + modules = + [ + SysUITestModule::class, + ] + ) + interface TestComponent { + val underTest: FromLockscreenTransitionInteractor + val testScope: TestScope + val transitionRepository: FakeKeyguardTransitionRepository + val surfaceBehindRepository: FakeKeyguardSurfaceBehindRepository + val inWindowLauncherUnlockAnimationRepository: InWindowLauncherUnlockAnimationRepository + + @Component.Factory + interface Factory { + fun create( + @BindsInstance test: SysuiTestCase, + mocks: TestMocksModule, + ): TestComponent + } + } } diff --git a/packages/SystemUI/tests/src/com/android/systemui/keyguard/domain/interactor/InWindowLauncherUnlockAnimationInteractorTest.kt b/packages/SystemUI/tests/src/com/android/systemui/keyguard/domain/interactor/InWindowLauncherUnlockAnimationInteractorTest.kt new file mode 100644 index 000000000000..7fb0dd55eef2 --- /dev/null +++ b/packages/SystemUI/tests/src/com/android/systemui/keyguard/domain/interactor/InWindowLauncherUnlockAnimationInteractorTest.kt @@ -0,0 +1,454 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.systemui.keyguard.domain.interactor + +import androidx.test.ext.junit.runners.AndroidJUnit4 +import androidx.test.filters.SmallTest +import com.android.SysUITestModule +import com.android.TestMocksModule +import com.android.systemui.SysuiTestCase +import com.android.systemui.coroutines.collectValues +import com.android.systemui.dagger.SysUISingleton +import com.android.systemui.keyguard.data.repository.FakeKeyguardSurfaceBehindRepository +import com.android.systemui.keyguard.data.repository.FakeKeyguardTransitionRepository +import com.android.systemui.keyguard.data.repository.InWindowLauncherUnlockAnimationRepository +import com.android.systemui.keyguard.shared.model.KeyguardState +import com.android.systemui.keyguard.shared.model.TransitionState +import com.android.systemui.keyguard.shared.model.TransitionStep +import com.android.systemui.keyguard.util.mockTopActivityClassName +import com.android.systemui.shared.system.ActivityManagerWrapper +import dagger.BindsInstance +import dagger.Component +import junit.framework.Assert.assertEquals +import kotlinx.coroutines.test.TestScope +import kotlinx.coroutines.test.runCurrent +import kotlinx.coroutines.test.runTest +import org.junit.Before +import org.junit.Test +import org.junit.runner.RunWith +import org.mockito.Mock +import org.mockito.MockitoAnnotations + +@SmallTest +@RunWith(AndroidJUnit4::class) +@kotlinx.coroutines.ExperimentalCoroutinesApi +class InWindowLauncherUnlockAnimationInteractorTest : SysuiTestCase() { + private lateinit var underTest: InWindowLauncherUnlockAnimationInteractor + + private lateinit var testComponent: TestComponent + private lateinit var testScope: TestScope + private lateinit var transitionRepository: FakeKeyguardTransitionRepository + @Mock private lateinit var activityManagerWrapper: ActivityManagerWrapper + + private val launcherClassName = "launcher" + + @Before + fun setUp() { + MockitoAnnotations.initMocks(this) + + testComponent = + DaggerInWindowLauncherUnlockAnimationInteractorTest_TestComponent.factory() + .create( + test = this, + mocks = + TestMocksModule( + activityManagerWrapper = activityManagerWrapper, + ), + ) + underTest = testComponent.underTest + testScope = testComponent.testScope + transitionRepository = testComponent.transitionRepository + + activityManagerWrapper.mockTopActivityClassName(launcherClassName) + } + + @Test + fun testTransitioningToGoneWithInWindowAnimation_trueIfTopActivityIsLauncher_andTransitioningToGone() = + testScope.runTest { + val values by collectValues(underTest.transitioningToGoneWithInWindowAnimation) + runCurrent() + + assertEquals( + listOf( + false, // False by default. + ), + values + ) + + // Put launcher on top + testComponent.inWindowLauncherUnlockAnimationRepository.setLauncherActivityClass( + launcherClassName + ) + activityManagerWrapper.mockTopActivityClassName(launcherClassName) + runCurrent() + + // Should still be false since we're not transitioning to GONE. + assertEquals( + listOf( + false, // False by default. + ), + values + ) + + transitionRepository.sendTransitionStep( + TransitionStep( + transitionState = TransitionState.STARTED, + from = KeyguardState.LOCKSCREEN, + to = KeyguardState.GONE, + ) + ) + runCurrent() + + assertEquals( + listOf( + false, + true, // -> GONE + launcher is behind + ), + values + ) + + activityManagerWrapper.mockTopActivityClassName("not_launcher") + transitionRepository.sendTransitionStep( + TransitionStep( + transitionState = TransitionState.RUNNING, + from = KeyguardState.LOCKSCREEN, + to = KeyguardState.GONE, + ) + ) + runCurrent() + + assertEquals( + listOf( + false, + true, // Top activity should be sampled, if it changes midway it should not + // matter. + ), + values + ) + + transitionRepository.sendTransitionStep( + TransitionStep( + transitionState = TransitionState.FINISHED, + from = KeyguardState.LOCKSCREEN, + to = KeyguardState.GONE, + ) + ) + runCurrent() + + assertEquals( + listOf( + false, + true, + false, // False once we're not transitioning anymore. + ), + values + ) + } + + @Test + fun testTransitioningToGoneWithInWindowAnimation_falseIfTopActivityIsLauncherPartwayThrough() = + testScope.runTest { + val values by collectValues(underTest.transitioningToGoneWithInWindowAnimation) + runCurrent() + + assertEquals( + listOf( + false, // False by default. + ), + values + ) + + // Put not launcher on top + testComponent.inWindowLauncherUnlockAnimationRepository.setLauncherActivityClass( + launcherClassName + ) + activityManagerWrapper.mockTopActivityClassName("not_launcher") + runCurrent() + + assertEquals( + listOf( + false, + ), + values + ) + + transitionRepository.sendTransitionStep( + TransitionStep( + transitionState = TransitionState.STARTED, + from = KeyguardState.LOCKSCREEN, + to = KeyguardState.GONE, + ) + ) + runCurrent() + + assertEquals( + listOf( + false, + ), + values + ) + + activityManagerWrapper.mockTopActivityClassName(launcherClassName) + transitionRepository.sendTransitionStep( + TransitionStep( + transitionState = TransitionState.RUNNING, + from = KeyguardState.LOCKSCREEN, + to = KeyguardState.GONE, + ) + ) + runCurrent() + + assertEquals( + listOf( + false, + ), + values + ) + + transitionRepository.sendTransitionStep( + TransitionStep( + transitionState = TransitionState.FINISHED, + from = KeyguardState.LOCKSCREEN, + to = KeyguardState.GONE, + ) + ) + runCurrent() + + assertEquals( + listOf( + false, + ), + values + ) + } + + @Test + fun testTransitioningToGoneWithInWindowAnimation_falseIfTopActivityIsLauncherWhileNotTransitioningToGone() = + testScope.runTest { + val values by collectValues(underTest.transitioningToGoneWithInWindowAnimation) + runCurrent() + + assertEquals( + listOf( + false, // False by default. + ), + values + ) + + // Put launcher on top + testComponent.inWindowLauncherUnlockAnimationRepository.setLauncherActivityClass( + launcherClassName + ) + activityManagerWrapper.mockTopActivityClassName(launcherClassName) + runCurrent() + + assertEquals( + listOf( + false, + ), + values + ) + + transitionRepository.sendTransitionStep( + TransitionStep( + transitionState = TransitionState.STARTED, + from = KeyguardState.AOD, + to = KeyguardState.LOCKSCREEN, + ) + ) + runCurrent() + + assertEquals( + listOf( + false, + ), + values + ) + } + + @Test + fun testShouldStartInWindowAnimation_trueOnceSurfaceAvailable_falseWhenTransitionEnds() = + testScope.runTest { + val values by collectValues(underTest.shouldStartInWindowAnimation) + runCurrent() + + assertEquals( + listOf( + false, // False by default. + ), + values + ) + + // Put Launcher on top and begin transitioning to GONE. + testComponent.inWindowLauncherUnlockAnimationRepository.setLauncherActivityClass( + launcherClassName + ) + activityManagerWrapper.mockTopActivityClassName(launcherClassName) + transitionRepository.sendTransitionStep( + TransitionStep( + transitionState = TransitionState.STARTED, + from = KeyguardState.LOCKSCREEN, + to = KeyguardState.GONE, + ) + ) + runCurrent() + + assertEquals( + listOf( + false, + ), + values + ) + + testComponent.surfaceBehindRepository.setSurfaceRemoteAnimationTargetAvailable(true) + runCurrent() + + assertEquals( + listOf( + false, + true, // The surface is now available, so we should start the animation. + ), + values + ) + + transitionRepository.sendTransitionStep( + TransitionStep( + transitionState = TransitionState.FINISHED, + from = KeyguardState.LOCKSCREEN, + to = KeyguardState.GONE, + ) + ) + runCurrent() + + assertEquals( + listOf( + false, + true, + false, + ), + values + ) + } + + @Test + fun testShouldStartInWindowAnimation_neverTrueIfSurfaceNotAvailable() = + testScope.runTest { + val values by collectValues(underTest.shouldStartInWindowAnimation) + runCurrent() + + assertEquals( + listOf( + false, // False by default. + ), + values + ) + + // Put Launcher on top and begin transitioning to GONE. + testComponent.inWindowLauncherUnlockAnimationRepository.setLauncherActivityClass( + launcherClassName + ) + activityManagerWrapper.mockTopActivityClassName(launcherClassName) + transitionRepository.sendTransitionStep( + TransitionStep( + transitionState = TransitionState.STARTED, + from = KeyguardState.LOCKSCREEN, + to = KeyguardState.GONE, + ) + ) + transitionRepository.sendTransitionStep( + TransitionStep( + transitionState = TransitionState.FINISHED, + from = KeyguardState.LOCKSCREEN, + to = KeyguardState.GONE, + ) + ) + runCurrent() + + assertEquals( + listOf( + false, + ), + values + ) + } + + @Test + fun testShouldStartInWindowAnimation_falseIfSurfaceAvailable_afterTransitionInterrupted() = + testScope.runTest { + val values by collectValues(underTest.shouldStartInWindowAnimation) + runCurrent() + + assertEquals( + listOf( + false, // False by default. + ), + values + ) + + // Put Launcher on top and begin transitioning to GONE. + testComponent.inWindowLauncherUnlockAnimationRepository.setLauncherActivityClass( + launcherClassName + ) + activityManagerWrapper.mockTopActivityClassName(launcherClassName) + transitionRepository.sendTransitionStep( + TransitionStep( + transitionState = TransitionState.STARTED, + from = KeyguardState.LOCKSCREEN, + to = KeyguardState.GONE, + ) + ) + transitionRepository.sendTransitionStep( + TransitionStep( + transitionState = TransitionState.STARTED, + from = KeyguardState.GONE, + to = KeyguardState.AOD, + ) + ) + testComponent.surfaceBehindRepository.setSurfaceRemoteAnimationTargetAvailable(true) + runCurrent() + + assertEquals( + listOf( + false, + ), + values + ) + } + + @SysUISingleton + @Component( + modules = + [ + SysUITestModule::class, + ] + ) + interface TestComponent { + val underTest: InWindowLauncherUnlockAnimationInteractor + val testScope: TestScope + val transitionRepository: FakeKeyguardTransitionRepository + val surfaceBehindRepository: FakeKeyguardSurfaceBehindRepository + val inWindowLauncherUnlockAnimationRepository: InWindowLauncherUnlockAnimationRepository + + @Component.Factory + interface Factory { + fun create( + @BindsInstance test: SysuiTestCase, + mocks: TestMocksModule, + ): TestComponent + } + } +} diff --git a/packages/SystemUI/tests/src/com/android/systemui/keyguard/domain/interactor/KeyguardTransitionInteractorTestCase.kt b/packages/SystemUI/tests/src/com/android/systemui/keyguard/domain/interactor/KeyguardTransitionInteractorTestCase.kt index 8db19aef1aa6..339fd22259db 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/keyguard/domain/interactor/KeyguardTransitionInteractorTestCase.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/keyguard/domain/interactor/KeyguardTransitionInteractorTestCase.kt @@ -26,7 +26,7 @@ import kotlinx.coroutines.test.TestScope open class KeyguardTransitionInteractorTestCase : SysuiTestCase() { val testDispatcher = StandardTestDispatcher() - val testScope = TestScope(testDispatcher) + var testScope = TestScope(testDispatcher) lateinit var keyguardRepository: FakeKeyguardRepository lateinit var transitionRepository: FakeKeyguardTransitionRepository diff --git a/packages/SystemUI/tests/src/com/android/systemui/keyguard/domain/interactor/KeyguardTransitionScenariosTest.kt b/packages/SystemUI/tests/src/com/android/systemui/keyguard/domain/interactor/KeyguardTransitionScenariosTest.kt index 275ac804b321..c29210270caf 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/keyguard/domain/interactor/KeyguardTransitionScenariosTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/keyguard/domain/interactor/KeyguardTransitionScenariosTest.kt @@ -27,7 +27,9 @@ import com.android.systemui.flags.FakeFeatureFlags import com.android.systemui.flags.Flags import com.android.systemui.keyguard.data.repository.FakeCommandQueue import com.android.systemui.keyguard.data.repository.FakeKeyguardRepository +import com.android.systemui.keyguard.data.repository.FakeKeyguardSurfaceBehindRepository import com.android.systemui.keyguard.data.repository.FakeKeyguardTransitionRepository +import com.android.systemui.keyguard.data.repository.InWindowLauncherUnlockAnimationRepository import com.android.systemui.keyguard.shared.model.BiometricUnlockModel import com.android.systemui.keyguard.shared.model.DozeStateModel import com.android.systemui.keyguard.shared.model.DozeTransitionModel @@ -44,6 +46,7 @@ import com.android.systemui.shade.data.repository.FakeShadeRepository import com.android.systemui.shade.domain.model.ShadeModel import com.android.systemui.user.domain.interactor.SelectedUserInteractor import com.android.systemui.util.mockito.any +import com.android.systemui.util.mockito.mock import com.android.systemui.util.mockito.whenever import com.android.systemui.util.mockito.withArgCaptor import com.google.common.truth.Truth.assertThat @@ -147,6 +150,15 @@ class KeyguardTransitionScenariosTest : SysuiTestCase() { flags = featureFlags, shadeRepository = shadeRepository, powerInteractor = powerInteractor, + inWindowLauncherUnlockAnimationInteractor = { + InWindowLauncherUnlockAnimationInteractor( + InWindowLauncherUnlockAnimationRepository(), + testScope, + transitionInteractor, + { FakeKeyguardSurfaceBehindRepository() }, + mock(), + ) + }, ) .apply { start() } diff --git a/packages/SystemUI/tests/src/com/android/systemui/keyguard/ui/binder/InWindowLauncherUnlockAnimationManagerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/keyguard/ui/binder/InWindowLauncherUnlockAnimationManagerTest.kt new file mode 100644 index 000000000000..570dfb3f0a9e --- /dev/null +++ b/packages/SystemUI/tests/src/com/android/systemui/keyguard/ui/binder/InWindowLauncherUnlockAnimationManagerTest.kt @@ -0,0 +1,134 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.systemui.keyguard.ui.binder + +import androidx.test.ext.junit.runners.AndroidJUnit4 +import androidx.test.filters.SmallTest +import com.android.SysUITestModule +import com.android.systemui.SysuiTestCase +import com.android.systemui.dagger.SysUISingleton +import com.android.systemui.keyguard.ui.view.InWindowLauncherUnlockAnimationManager +import com.android.systemui.shared.system.smartspace.ILauncherUnlockAnimationController +import com.android.systemui.util.mockito.any +import dagger.BindsInstance +import dagger.Component +import kotlinx.coroutines.test.TestScope +import kotlinx.coroutines.test.runTest +import org.junit.Before +import org.junit.Test +import org.junit.runner.RunWith +import org.mockito.Mock +import org.mockito.Mockito.anyBoolean +import org.mockito.Mockito.anyInt +import org.mockito.Mockito.never +import org.mockito.Mockito.verify +import org.mockito.Mockito.verifyNoMoreInteractions +import org.mockito.MockitoAnnotations + +@SmallTest +@RunWith(AndroidJUnit4::class) +@kotlinx.coroutines.ExperimentalCoroutinesApi +class InWindowLauncherUnlockAnimationManagerTest : SysuiTestCase() { + private lateinit var underTest: InWindowLauncherUnlockAnimationManager + + private lateinit var testComponent: TestComponent + private lateinit var testScope: TestScope + + @Mock private lateinit var launcherUnlockAnimationController: ILauncherUnlockAnimationController + + @Before + fun setUp() { + MockitoAnnotations.initMocks(this) + + testComponent = + DaggerInWindowLauncherUnlockAnimationManagerTest_TestComponent.factory() + .create( + test = this, + ) + underTest = testComponent.underTest + testScope = testComponent.testScope + + underTest.setLauncherUnlockController("launcherClass", launcherUnlockAnimationController) + } + + @Test + fun testPrepareForUnlock_calledOnlyOnce() = + testScope.runTest { + underTest.prepareForUnlock() + underTest.prepareForUnlock() + + verify(launcherUnlockAnimationController) + .prepareForUnlock(anyBoolean(), any(), anyInt()) + } + + @Test + fun testPlayUnlockAnimation_onlyCalledIfPrepared() = + testScope.runTest { + underTest.playUnlockAnimation(true, 200, 0) + verify(launcherUnlockAnimationController, never()) + .playUnlockAnimation(any(), any(), any()) + } + + @Test + fun testForceUnlocked_ifPreparedButNeverStarted() = + testScope.runTest { + underTest.prepareForUnlock() + underTest.ensureUnlockedOrAnimatingUnlocked() + + verify(launcherUnlockAnimationController).setUnlockAmount(1f, true) + } + + @Test + fun testForceUnlocked_ifManualUnlockAmountLessThan1() = + testScope.runTest { + underTest.prepareForUnlock() + underTest.setUnlockAmount(0.5f, false) + underTest.ensureUnlockedOrAnimatingUnlocked() + + verify(launcherUnlockAnimationController).prepareForUnlock(any(), any(), any()) + verify(launcherUnlockAnimationController).setUnlockAmount(0.5f, false) + verify(launcherUnlockAnimationController).setUnlockAmount(1f, true) + verifyNoMoreInteractions(launcherUnlockAnimationController) + } + + @Test + fun testDoesNotForceUnlocked_ifNeverPrepared() = + testScope.runTest { + underTest.ensureUnlockedOrAnimatingUnlocked() + + verifyNoMoreInteractions(launcherUnlockAnimationController) + } + + @SysUISingleton + @Component( + modules = + [ + SysUITestModule::class, + ] + ) + interface TestComponent { + val underTest: InWindowLauncherUnlockAnimationManager + val testScope: TestScope + + @Component.Factory + interface Factory { + fun create( + @BindsInstance test: SysuiTestCase, + ): TestComponent + } + } +} diff --git a/packages/SystemUI/tests/src/com/android/systemui/keyguard/util/ActivityManagerWrapperMock.kt b/packages/SystemUI/tests/src/com/android/systemui/keyguard/util/ActivityManagerWrapperMock.kt new file mode 100644 index 000000000000..2cb7e6523fd2 --- /dev/null +++ b/packages/SystemUI/tests/src/com/android/systemui/keyguard/util/ActivityManagerWrapperMock.kt @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the + * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the specific language governing + * permissions and limitations under the License. + * + */ + +package com.android.systemui.keyguard.util + +import android.app.ActivityManager +import android.content.ComponentName +import com.android.systemui.shared.system.ActivityManagerWrapper +import com.android.systemui.util.mockito.mock +import com.android.systemui.util.mockito.whenever + +/** + * Configures an ActivityManagerWrapper mock to return the given class name whenever we ask for the + * running task's top activity class name. + */ +fun ActivityManagerWrapper.mockTopActivityClassName(name: String) { + val topActivityMock = mock<ComponentName>().apply { whenever(className).thenReturn(name) } + + whenever(runningTask) + .thenReturn(ActivityManager.RunningTaskInfo().apply { topActivity = topActivityMock }) +} diff --git a/packages/SystemUI/tests/src/com/android/systemui/recents/OverviewProxyServiceTest.kt b/packages/SystemUI/tests/src/com/android/systemui/recents/OverviewProxyServiceTest.kt index 6d358dbf05b7..70a48f574949 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/recents/OverviewProxyServiceTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/recents/OverviewProxyServiceTest.kt @@ -30,8 +30,10 @@ import com.android.systemui.SysuiTestCase import com.android.systemui.dagger.qualifiers.Main import com.android.systemui.dump.DumpManager import com.android.systemui.flags.FakeFeatureFlags +import com.android.systemui.flags.Flags import com.android.systemui.keyguard.KeyguardUnlockAnimationController import com.android.systemui.keyguard.WakefulnessLifecycle +import com.android.systemui.keyguard.ui.view.InWindowLauncherUnlockAnimationManager import com.android.systemui.model.SysUiState import com.android.systemui.navigationbar.NavigationBarController import com.android.systemui.navigationbar.NavigationModeController @@ -100,6 +102,9 @@ class OverviewProxyServiceTest : SysuiTestCase() { @Mock private lateinit var userTracker: UserTracker @Mock private lateinit var uiEventLogger: UiEventLogger @Mock private lateinit var sysuiUnlockAnimationController: KeyguardUnlockAnimationController + @Mock + private lateinit var inWindowLauncherUnlockAnimationManager: + InWindowLauncherUnlockAnimationManager @Mock private lateinit var assistUtils: AssistUtils @Mock private lateinit var unfoldTransitionProgressForwarder: @@ -126,6 +131,7 @@ class OverviewProxyServiceTest : SysuiTestCase() { whenever(packageManager.resolveServiceAsUser(any(), anyInt(), anyInt())) .thenReturn(mock(ResolveInfo::class.java)) + featureFlags.set(Flags.KEYGUARD_WM_STATE_REFACTOR, false) subject = OverviewProxyService( context, @@ -144,6 +150,7 @@ class OverviewProxyServiceTest : SysuiTestCase() { uiEventLogger, displayTracker, sysuiUnlockAnimationController, + inWindowLauncherUnlockAnimationManager, assistUtils, featureFlags, FakeSceneContainerFlags(), diff --git a/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationShadeWindowControllerImplTest.java b/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationShadeWindowControllerImplTest.java index 55a44ae34ac6..a7e1e9d35024 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationShadeWindowControllerImplTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationShadeWindowControllerImplTest.java @@ -59,9 +59,12 @@ import com.android.systemui.flags.FakeFeatureFlagsClassic; import com.android.systemui.keyguard.KeyguardViewMediator; import com.android.systemui.keyguard.data.repository.FakeCommandQueue; import com.android.systemui.keyguard.data.repository.FakeKeyguardRepository; +import com.android.systemui.keyguard.data.repository.FakeKeyguardSurfaceBehindRepository; import com.android.systemui.keyguard.data.repository.FakeKeyguardTransitionRepository; +import com.android.systemui.keyguard.data.repository.InWindowLauncherUnlockAnimationRepository; import com.android.systemui.keyguard.domain.interactor.FromLockscreenTransitionInteractor; import com.android.systemui.keyguard.domain.interactor.FromPrimaryBouncerTransitionInteractor; +import com.android.systemui.keyguard.domain.interactor.InWindowLauncherUnlockAnimationInteractor; import com.android.systemui.keyguard.domain.interactor.KeyguardInteractor; import com.android.systemui.keyguard.domain.interactor.KeyguardTransitionInteractor; import com.android.systemui.plugins.statusbar.StatusBarStateController; @@ -76,6 +79,7 @@ import com.android.systemui.scene.shared.flag.FakeSceneContainerFlags; import com.android.systemui.scene.shared.logger.SceneLogger; import com.android.systemui.shade.data.repository.FakeShadeRepository; import com.android.systemui.shade.domain.interactor.ShadeInteractor; +import com.android.systemui.shared.system.ActivityManagerWrapper; import com.android.systemui.statusbar.StatusBarState; import com.android.systemui.statusbar.SysuiStatusBarStateController; import com.android.systemui.statusbar.disableflags.data.repository.FakeDisableFlagsRepository; @@ -207,7 +211,16 @@ public class NotificationShadeWindowControllerImplTest extends SysuiTestCase { keyguardInteractor, featureFlags, shadeRepository, - powerInteractor); + powerInteractor, + () -> + new InWindowLauncherUnlockAnimationInteractor( + new InWindowLauncherUnlockAnimationRepository(), + mTestScope.getBackgroundScope(), + keyguardTransitionInteractor, + () -> new FakeKeyguardSurfaceBehindRepository(), + mock(ActivityManagerWrapper.class) + ) + ); mFromPrimaryBouncerTransitionInteractor = new FromPrimaryBouncerTransitionInteractor( keyguardTransitionRepository, diff --git a/packages/SystemUI/tests/src/com/android/systemui/shade/QuickSettingsControllerBaseTest.java b/packages/SystemUI/tests/src/com/android/systemui/shade/QuickSettingsControllerBaseTest.java index d4b35a9b1515..6d0488706133 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/shade/QuickSettingsControllerBaseTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/shade/QuickSettingsControllerBaseTest.java @@ -45,9 +45,12 @@ import com.android.systemui.flags.FeatureFlags; import com.android.systemui.fragments.FragmentHostManager; import com.android.systemui.keyguard.data.repository.FakeCommandQueue; import com.android.systemui.keyguard.data.repository.FakeKeyguardRepository; +import com.android.systemui.keyguard.data.repository.FakeKeyguardSurfaceBehindRepository; import com.android.systemui.keyguard.data.repository.FakeKeyguardTransitionRepository; +import com.android.systemui.keyguard.data.repository.InWindowLauncherUnlockAnimationRepository; import com.android.systemui.keyguard.domain.interactor.FromLockscreenTransitionInteractor; import com.android.systemui.keyguard.domain.interactor.FromPrimaryBouncerTransitionInteractor; +import com.android.systemui.keyguard.domain.interactor.InWindowLauncherUnlockAnimationInteractor; import com.android.systemui.keyguard.domain.interactor.KeyguardFaceAuthInteractor; import com.android.systemui.keyguard.domain.interactor.KeyguardInteractor; import com.android.systemui.keyguard.domain.interactor.KeyguardTransitionInteractor; @@ -68,6 +71,7 @@ import com.android.systemui.screenrecord.RecordingController; import com.android.systemui.shade.data.repository.FakeShadeRepository; import com.android.systemui.shade.domain.interactor.ShadeInteractor; import com.android.systemui.shade.transition.ShadeTransitionController; +import com.android.systemui.shared.system.ActivityManagerWrapper; import com.android.systemui.statusbar.LockscreenShadeTransitionController; import com.android.systemui.statusbar.NotificationRemoteInputManager; import com.android.systemui.statusbar.NotificationShadeDepthController; @@ -241,7 +245,16 @@ public class QuickSettingsControllerBaseTest extends SysuiTestCase { keyguardInteractor, featureFlags, mShadeRepository, - powerInteractor); + powerInteractor, + () -> + new InWindowLauncherUnlockAnimationInteractor( + new InWindowLauncherUnlockAnimationRepository(), + mTestScope.getBackgroundScope(), + keyguardTransitionInteractor, + () -> new FakeKeyguardSurfaceBehindRepository(), + mock(ActivityManagerWrapper.class) + ) + ); mFromPrimaryBouncerTransitionInteractor = new FromPrimaryBouncerTransitionInteractor( keyguardTransitionRepository, diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/StatusBarStateControllerImplTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/StatusBarStateControllerImplTest.kt index d6dfc5e928a7..4b79a499bf90 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/StatusBarStateControllerImplTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/StatusBarStateControllerImplTest.kt @@ -29,9 +29,12 @@ import com.android.systemui.common.ui.data.repository.FakeConfigurationRepositor import com.android.systemui.flags.FakeFeatureFlagsClassic import com.android.systemui.keyguard.data.repository.FakeCommandQueue import com.android.systemui.keyguard.data.repository.FakeKeyguardRepository +import com.android.systemui.keyguard.data.repository.FakeKeyguardSurfaceBehindRepository import com.android.systemui.keyguard.data.repository.FakeKeyguardTransitionRepository +import com.android.systemui.keyguard.data.repository.InWindowLauncherUnlockAnimationRepository import com.android.systemui.keyguard.domain.interactor.FromLockscreenTransitionInteractor import com.android.systemui.keyguard.domain.interactor.FromPrimaryBouncerTransitionInteractor +import com.android.systemui.keyguard.domain.interactor.InWindowLauncherUnlockAnimationInteractor import com.android.systemui.keyguard.domain.interactor.KeyguardInteractor import com.android.systemui.keyguard.domain.interactor.KeyguardTransitionInteractor import com.android.systemui.plugins.statusbar.StatusBarStateController @@ -131,7 +134,16 @@ class StatusBarStateControllerImplTest : SysuiTestCase() { keyguardInteractor, featureFlags, shadeRepository, - powerInteractor) + powerInteractor, + { + InWindowLauncherUnlockAnimationInteractor( + InWindowLauncherUnlockAnimationRepository(), + testScope, + keyguardTransitionInteractor, + { FakeKeyguardSurfaceBehindRepository() }, + mock(), + ) + }) fromPrimaryBouncerTransitionInteractor = FromPrimaryBouncerTransitionInteractor( keyguardTransitionRepository, keyguardTransitionInteractor, 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 2e191b140e10..4f19742b26d9 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/wmshell/BubblesTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/wmshell/BubblesTest.java @@ -102,9 +102,12 @@ import com.android.systemui.flags.FakeFeatureFlagsClassic; import com.android.systemui.keyguard.KeyguardViewMediator; import com.android.systemui.keyguard.data.repository.FakeCommandQueue; import com.android.systemui.keyguard.data.repository.FakeKeyguardRepository; +import com.android.systemui.keyguard.data.repository.FakeKeyguardSurfaceBehindRepository; import com.android.systemui.keyguard.data.repository.FakeKeyguardTransitionRepository; +import com.android.systemui.keyguard.data.repository.InWindowLauncherUnlockAnimationRepository; import com.android.systemui.keyguard.domain.interactor.FromLockscreenTransitionInteractor; import com.android.systemui.keyguard.domain.interactor.FromPrimaryBouncerTransitionInteractor; +import com.android.systemui.keyguard.domain.interactor.InWindowLauncherUnlockAnimationInteractor; import com.android.systemui.keyguard.domain.interactor.KeyguardInteractor; import com.android.systemui.keyguard.domain.interactor.KeyguardTransitionInteractor; import com.android.systemui.model.SysUiState; @@ -126,6 +129,7 @@ import com.android.systemui.shade.ShadeExpansionStateManager; import com.android.systemui.shade.ShadeWindowLogger; import com.android.systemui.shade.data.repository.FakeShadeRepository; import com.android.systemui.shade.domain.interactor.ShadeInteractor; +import com.android.systemui.shared.system.ActivityManagerWrapper; import com.android.systemui.shared.system.QuickStepContract; import com.android.systemui.statusbar.NotificationEntryHelper; import com.android.systemui.statusbar.NotificationLockscreenUserManager; @@ -429,7 +433,16 @@ public class BubblesTest extends SysuiTestCase { keyguardInteractor, featureFlags, shadeRepository, - powerInteractor); + powerInteractor, + () -> + new InWindowLauncherUnlockAnimationInteractor( + new InWindowLauncherUnlockAnimationRepository(), + mTestScope.getBackgroundScope(), + keyguardTransitionInteractor, + () -> new FakeKeyguardSurfaceBehindRepository(), + mock(ActivityManagerWrapper.class) + ) + ); mFromPrimaryBouncerTransitionInteractor = new FromPrimaryBouncerTransitionInteractor( keyguardTransitionRepository, diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/data/FakeKeyguardDataLayerModule.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/data/FakeKeyguardDataLayerModule.kt index abf72af0e1d5..6838e7676a23 100644 --- a/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/data/FakeKeyguardDataLayerModule.kt +++ b/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/data/FakeKeyguardDataLayerModule.kt @@ -17,6 +17,7 @@ package com.android.systemui.keyguard.data import com.android.systemui.keyguard.data.repository.FakeCommandQueueModule import com.android.systemui.keyguard.data.repository.FakeKeyguardRepositoryModule +import com.android.systemui.keyguard.data.repository.FakeKeyguardSurfaceBehindRepositoryModule import com.android.systemui.keyguard.data.repository.FakeKeyguardTransitionRepositoryModule import dagger.Module @@ -26,6 +27,7 @@ import dagger.Module FakeCommandQueueModule::class, FakeKeyguardRepositoryModule::class, FakeKeyguardTransitionRepositoryModule::class, + FakeKeyguardSurfaceBehindRepositoryModule::class, ] ) object FakeKeyguardDataLayerModule diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/data/repository/FakeKeyguardSurfaceBehindRepository.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/data/repository/FakeKeyguardSurfaceBehindRepository.kt index 823f29a910d1..70de05f042ba 100644 --- a/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/data/repository/FakeKeyguardSurfaceBehindRepository.kt +++ b/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/data/repository/FakeKeyguardSurfaceBehindRepository.kt @@ -16,14 +16,31 @@ package com.android.systemui.keyguard.data.repository +import com.android.systemui.dagger.SysUISingleton +import dagger.Binds +import dagger.Module +import javax.inject.Inject import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.asStateFlow -class FakeKeyguardSurfaceBehindRepository : KeyguardSurfaceBehindRepository { +@SysUISingleton +class FakeKeyguardSurfaceBehindRepository @Inject constructor() : KeyguardSurfaceBehindRepository { private val _isAnimatingSurface = MutableStateFlow(false) override val isAnimatingSurface = _isAnimatingSurface.asStateFlow() + private val _isSurfaceAvailable = MutableStateFlow(false) + override val isSurfaceRemoteAnimationTargetAvailable = _isSurfaceAvailable.asStateFlow() + override fun setAnimatingSurface(animating: Boolean) { _isAnimatingSurface.value = animating } + + override fun setSurfaceRemoteAnimationTargetAvailable(available: Boolean) { + _isSurfaceAvailable.value = available + } +} + +@Module +interface FakeKeyguardSurfaceBehindRepositoryModule { + @Binds fun bindFake(fake: FakeKeyguardSurfaceBehindRepository): KeyguardSurfaceBehindRepository } diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/scene/SceneTestUtils.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/scene/SceneTestUtils.kt index 10110e219d21..f97d6b3d262f 100644 --- a/packages/SystemUI/tests/utils/src/com/android/systemui/scene/SceneTestUtils.kt +++ b/packages/SystemUI/tests/utils/src/com/android/systemui/scene/SceneTestUtils.kt @@ -16,6 +16,7 @@ package com.android.systemui.scene +import android.content.Context import android.content.pm.UserInfo import android.graphics.Bitmap import android.graphics.drawable.BitmapDrawable @@ -81,8 +82,10 @@ import kotlinx.coroutines.test.currentTime */ @OptIn(ExperimentalCoroutinesApi::class) class SceneTestUtils( - test: SysuiTestCase, + private val context: Context, ) { + constructor(test: SysuiTestCase) : this(context = test.context) + val kosmos = Kosmos() val testDispatcher = kosmos.testDispatcher val testScope = kosmos.testScope @@ -115,8 +118,6 @@ class SceneTestUtils( } } - private val context = test.context - private val falsingCollectorFake: FalsingCollector by lazy { FalsingCollectorFake() } private var falsingInteractor: FalsingInteractor? = null diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java index 1566113b7f47..514be1586e42 100644 --- a/services/core/java/com/android/server/am/ActivityManagerService.java +++ b/services/core/java/com/android/server/am/ActivityManagerService.java @@ -79,6 +79,7 @@ import static android.os.PowerExemptionManager.REASON_ACTIVITY_VISIBILITY_GRACE_ import static android.os.PowerExemptionManager.REASON_BACKGROUND_ACTIVITY_PERMISSION; import static android.os.PowerExemptionManager.REASON_BOOT_COMPLETED; import static android.os.PowerExemptionManager.REASON_COMPANION_DEVICE_MANAGER; +import static android.os.PowerExemptionManager.REASON_DENIED; import static android.os.PowerExemptionManager.REASON_INSTR_BACKGROUND_ACTIVITY_PERMISSION; import static android.os.PowerExemptionManager.REASON_LOCKED_BOOT_COMPLETED; import static android.os.PowerExemptionManager.REASON_PROC_STATE_BTOP; @@ -7715,13 +7716,99 @@ public class ActivityManagerService extends IActivityManager.Stub "getUidProcessState", callingPackage); // Ignore return value synchronized (mProcLock) { - if (mPendingStartActivityUids.isPendingTopUid(uid)) { - return PROCESS_STATE_TOP; + return getUidProcessStateInnerLOSP(uid); + } + } + + @Override + public int getBindingUidProcessState(int targetUid, String callingPackage) { + if (!hasUsageStatsPermission(callingPackage)) { + enforceCallingPermission(android.Manifest.permission.GET_BINDING_UID_IMPORTANCE, + "getBindingUidProcessState"); + } + // We don't need to do a cross-user check here (unlike getUidProcessState), + // because we only allow to see UIDs that are actively communicating with the caller. + + final int callingUid = Binder.getCallingUid(); + final long token = Binder.clearCallingIdentity(); + try { + synchronized (this) { + final boolean allowed = (callingUid == targetUid) + || hasServiceBindingOrProviderUseLocked(callingUid, targetUid); + if (!allowed) { + return PROCESS_STATE_NONEXISTENT; + } + return getUidProcessStateInnerLOSP(targetUid); } - return mProcessList.getUidProcStateLOSP(uid); + } finally { + Binder.restoreCallingIdentity(token); } } + @GuardedBy(anyOf = {"this", "mProcLock"}) + private int getUidProcessStateInnerLOSP(int uid) { + if (mPendingStartActivityUids.isPendingTopUid(uid)) { + return PROCESS_STATE_TOP; + } + return mProcessList.getUidProcStateLOSP(uid); + } + + /** + * Ensure that {@code clientUid} has a bound service client to {@code callingUid} + */ + @GuardedBy("this") + private boolean hasServiceBindingOrProviderUseLocked(int callingUid, int clientUid) { + // See if there's a service binding + final Boolean hasBinding = mProcessList.searchEachLruProcessesLOSP( + false, pr -> { + if (pr.uid == callingUid) { + final ProcessServiceRecord psr = pr.mServices; + final int serviceCount = psr.mServices.size(); + for (int svc = 0; svc < serviceCount; svc++) { + final ArrayMap<IBinder, ArrayList<ConnectionRecord>> conns = + psr.mServices.valueAt(svc).getConnections(); + final int size = conns.size(); + for (int conni = 0; conni < size; conni++) { + final ArrayList<ConnectionRecord> crs = conns.valueAt(conni); + for (int con = 0; con < crs.size(); con++) { + final ConnectionRecord cr = crs.get(con); + final ProcessRecord clientPr = cr.binding.client; + + if (clientPr.uid == clientUid) { + return Boolean.TRUE; + } + } + } + } + } + return null; + }); + if (Boolean.TRUE.equals(hasBinding)) { + return true; + } + + final Boolean hasProviderClient = mProcessList.searchEachLruProcessesLOSP( + false, pr -> { + if (pr.uid == callingUid) { + final ProcessProviderRecord ppr = pr.mProviders; + for (int provi = ppr.numberOfProviders() - 1; provi >= 0; provi--) { + ContentProviderRecord cpr = ppr.getProviderAt(provi); + + for (int i = cpr.connections.size() - 1; i >= 0; i--) { + ContentProviderConnection conn = cpr.connections.get(i); + ProcessRecord client = conn.client; + if (client.uid == clientUid) { + return Boolean.TRUE; + } + } + } + } + return null; + }); + + return Boolean.TRUE.equals(hasProviderClient); + } + @Override public @ProcessCapability int getUidProcessCapabilities(int uid, String callingPackage) { if (!hasUsageStatsPermission(callingPackage)) { diff --git a/services/core/java/com/android/server/wm/ActivityTaskManagerService.java b/services/core/java/com/android/server/wm/ActivityTaskManagerService.java index f0698be4d834..f462efc00ce6 100644 --- a/services/core/java/com/android/server/wm/ActivityTaskManagerService.java +++ b/services/core/java/com/android/server/wm/ActivityTaskManagerService.java @@ -125,7 +125,6 @@ import static com.android.server.wm.RootWindowContainer.MATCH_ATTACHED_TASK_OR_R import static com.android.server.wm.Task.REPARENT_KEEP_ROOT_TASK_AT_FRONT; import static com.android.server.wm.WindowManagerService.MY_PID; import static com.android.server.wm.WindowManagerService.UPDATE_FOCUS_NORMAL; -import static com.android.sdksandbox.flags.Flags.sandboxActivitySdkBasedContext; import android.Manifest; import android.annotation.IntDef; @@ -166,7 +165,6 @@ import android.app.assist.ActivityId; import android.app.assist.AssistContent; import android.app.assist.AssistStructure; import android.app.compat.CompatChanges; -import android.app.sdksandbox.sandboxactivity.SdkSandboxActivityAuthority; import android.app.usage.UsageStatsManagerInternal; import android.content.ActivityNotFoundException; import android.content.ComponentName; @@ -1260,13 +1258,6 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { true /*validateIncomingUser*/); } - static boolean isSdkSandboxActivity(Context context, Intent intent) { - return intent != null - && (sandboxActivitySdkBasedContext() - ? SdkSandboxActivityAuthority.isSdkSandboxActivity(context, intent) - : intent.isSandboxActivity(context)); - } - private int startActivityAsUser(IApplicationThread caller, String callingPackage, @Nullable String callingFeatureId, Intent intent, String resolvedType, IBinder resultTo, String resultWho, int requestCode, int startFlags, @@ -1277,7 +1268,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { assertPackageMatchesCallingUid(callingPackage); enforceNotIsolatedCaller("startActivityAsUser"); - if (isSdkSandboxActivity(mContext, intent)) { + if (intent != null && intent.isSandboxActivity(mContext)) { SdkSandboxManagerLocal sdkSandboxManagerLocal = LocalManagerRegistry.getManager( SdkSandboxManagerLocal.class); sdkSandboxManagerLocal.enforceAllowedToHostSandboxedActivity( diff --git a/services/core/java/com/android/server/wm/ActivityTaskSupervisor.java b/services/core/java/com/android/server/wm/ActivityTaskSupervisor.java index e5eb3033f86a..777b5cd4337b 100644 --- a/services/core/java/com/android/server/wm/ActivityTaskSupervisor.java +++ b/services/core/java/com/android/server/wm/ActivityTaskSupervisor.java @@ -1089,7 +1089,7 @@ public class ActivityTaskSupervisor implements RecentTasks.Callbacks { // Remove the process record so it won't be considered as alive. mService.mProcessNames.remove(wpc.mName, wpc.mUid); mService.mProcessMap.remove(wpc.getPid()); - } else if (ActivityTaskManagerService.isSdkSandboxActivity(mService.mContext, r.intent)) { + } else if (r.intent.isSandboxActivity(mService.mContext)) { Slog.e(TAG, "Abort sandbox activity launching as no sandbox process to host it."); r.finishIfPossible("No sandbox process for the activity", false /* oomAdj */); r.launchFailed = true; diff --git a/telephony/java/android/telephony/data/ApnSetting.java b/telephony/java/android/telephony/data/ApnSetting.java index cb7926ca0608..11cbcb1c149d 100644 --- a/telephony/java/android/telephony/data/ApnSetting.java +++ b/telephony/java/android/telephony/data/ApnSetting.java @@ -568,7 +568,6 @@ public class ApnSetting implements Parcelable { private final int mSkip464Xlat; private final boolean mAlwaysOn; private final @InfrastructureBitmask int mInfrastructureBitmask; - private final boolean mEsimBootstrapProvisioning; /** * Returns the default MTU (Maximum Transmission Unit) size in bytes of the IPv4 routes brought @@ -980,18 +979,6 @@ public class ApnSetting implements Parcelable { return mInfrastructureBitmask; } - /** - * Returns esim bootstrap provisioning flag for which the APN can be used on. For example, - * some APNs are only allowed to bring up network, when the device esim bootstrap provisioning - * is being activated. - * - * {@code true} if the APN is used for eSIM bootstrap provisioning, {@code false} otherwise. - * @hide - */ - public boolean isEsimBootstrapProvisioning() { - return mEsimBootstrapProvisioning; - } - private ApnSetting(Builder builder) { this.mEntryName = builder.mEntryName; this.mApnName = builder.mApnName; @@ -1029,7 +1016,6 @@ public class ApnSetting implements Parcelable { this.mSkip464Xlat = builder.mSkip464Xlat; this.mAlwaysOn = builder.mAlwaysOn; this.mInfrastructureBitmask = builder.mInfrastructureBitmask; - this.mEsimBootstrapProvisioning = builder.mEsimBootstrapProvisioning; } /** @@ -1111,8 +1097,6 @@ public class ApnSetting implements Parcelable { .setAlwaysOn(cursor.getInt(cursor.getColumnIndexOrThrow(Carriers.ALWAYS_ON)) == 1) .setInfrastructureBitmask(cursor.getInt(cursor.getColumnIndexOrThrow( Telephony.Carriers.INFRASTRUCTURE_BITMASK))) - .setEsimBootstrapProvisioning(cursor.getInt( - cursor.getColumnIndexOrThrow(Carriers.ESIM_BOOTSTRAP_PROVISIONING)) == 1) .buildWithoutCheck(); } @@ -1153,7 +1137,6 @@ public class ApnSetting implements Parcelable { .setSkip464Xlat(apn.mSkip464Xlat) .setAlwaysOn(apn.mAlwaysOn) .setInfrastructureBitmask(apn.mInfrastructureBitmask) - .setEsimBootstrapProvisioning(apn.mEsimBootstrapProvisioning) .buildWithoutCheck(); } @@ -1201,7 +1184,6 @@ public class ApnSetting implements Parcelable { sb.append(", ").append(mAlwaysOn); sb.append(", ").append(mInfrastructureBitmask); sb.append(", ").append(Objects.hash(mUser, mPassword)); - sb.append(", ").append(mEsimBootstrapProvisioning); return sb.toString(); } @@ -1265,7 +1247,7 @@ public class ApnSetting implements Parcelable { mProtocol, mRoamingProtocol, mMtuV4, mMtuV6, mCarrierEnabled, mNetworkTypeBitmask, mLingeringNetworkTypeBitmask, mProfileId, mPersistent, mMaxConns, mWaitTime, mMaxConnsTime, mMvnoType, mMvnoMatchData, mApnSetId, mCarrierId, mSkip464Xlat, - mAlwaysOn, mInfrastructureBitmask, mEsimBootstrapProvisioning); + mAlwaysOn, mInfrastructureBitmask); } @Override @@ -1307,8 +1289,7 @@ public class ApnSetting implements Parcelable { && mCarrierId == other.mCarrierId && mSkip464Xlat == other.mSkip464Xlat && mAlwaysOn == other.mAlwaysOn - && mInfrastructureBitmask == other.mInfrastructureBitmask - && Objects.equals(mEsimBootstrapProvisioning, other.mEsimBootstrapProvisioning); + && mInfrastructureBitmask == other.mInfrastructureBitmask; } /** @@ -1359,8 +1340,7 @@ public class ApnSetting implements Parcelable { && Objects.equals(mCarrierId, other.mCarrierId) && Objects.equals(mSkip464Xlat, other.mSkip464Xlat) && Objects.equals(mAlwaysOn, other.mAlwaysOn) - && Objects.equals(mInfrastructureBitmask, other.mInfrastructureBitmask) - && Objects.equals(mEsimBootstrapProvisioning, other.mEsimBootstrapProvisioning); + && Objects.equals(mInfrastructureBitmask, other.mInfrastructureBitmask); } /** @@ -1398,9 +1378,7 @@ public class ApnSetting implements Parcelable { && Objects.equals(this.mCarrierId, other.mCarrierId) && Objects.equals(this.mSkip464Xlat, other.mSkip464Xlat) && Objects.equals(this.mAlwaysOn, other.mAlwaysOn) - && Objects.equals(this.mInfrastructureBitmask, other.mInfrastructureBitmask) - && Objects.equals(this.mEsimBootstrapProvisioning, - other.mEsimBootstrapProvisioning); + && Objects.equals(this.mInfrastructureBitmask, other.mInfrastructureBitmask); } // Equal or one is null. @@ -1473,7 +1451,6 @@ public class ApnSetting implements Parcelable { apnValue.put(Telephony.Carriers.SKIP_464XLAT, mSkip464Xlat); apnValue.put(Telephony.Carriers.ALWAYS_ON, mAlwaysOn); apnValue.put(Telephony.Carriers.INFRASTRUCTURE_BITMASK, mInfrastructureBitmask); - apnValue.put(Carriers.ESIM_BOOTSTRAP_PROVISIONING, mEsimBootstrapProvisioning); return apnValue; } @@ -1747,7 +1724,6 @@ public class ApnSetting implements Parcelable { dest.writeInt(mSkip464Xlat); dest.writeBoolean(mAlwaysOn); dest.writeInt(mInfrastructureBitmask); - dest.writeBoolean(mEsimBootstrapProvisioning); } private static ApnSetting readFromParcel(Parcel in) { @@ -1784,7 +1760,6 @@ public class ApnSetting implements Parcelable { .setSkip464Xlat(in.readInt()) .setAlwaysOn(in.readBoolean()) .setInfrastructureBitmask(in.readInt()) - .setEsimBootstrapProvisioning(in.readBoolean()) .buildWithoutCheck(); } @@ -1867,7 +1842,6 @@ public class ApnSetting implements Parcelable { private int mSkip464Xlat = Carriers.SKIP_464XLAT_DEFAULT; private boolean mAlwaysOn; private int mInfrastructureBitmask = INFRASTRUCTURE_CELLULAR; - private boolean mEsimBootstrapProvisioning; /** * Default constructor for Builder. @@ -2306,19 +2280,6 @@ public class ApnSetting implements Parcelable { } /** - * Sets esim bootstrap provisioning flag - * - * @param esimBootstrapProvisioning {@code true} if the APN is used for eSIM bootstrap - * provisioning, {@code false} otherwise. - * @hide - */ - @NonNull - public Builder setEsimBootstrapProvisioning(boolean esimBootstrapProvisioning) { - this.mEsimBootstrapProvisioning = esimBootstrapProvisioning; - return this; - } - - /** * Builds {@link ApnSetting} from this builder. * * @return {@code null} if {@link #setApnName(String)} or {@link #setEntryName(String)} diff --git a/tests/FlickerTests/ActivityEmbedding/Android.bp b/tests/FlickerTests/ActivityEmbedding/Android.bp new file mode 100644 index 000000000000..9eeec7c8ddda --- /dev/null +++ b/tests/FlickerTests/ActivityEmbedding/Android.bp @@ -0,0 +1,34 @@ +// +// Copyright (C) 2018 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 { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "frameworks_base_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["frameworks_base_license"], +} + +android_test { + name: "FlickerTestsOther", + defaults: ["FlickerTestsDefault"], + manifest: "AndroidManifest.xml", + package_name: "com.android.server.wm.flicker", + instrumentation_target_package: "com.android.server.wm.flicker", + srcs: ["src/**/*"], + static_libs: ["FlickerTestsBase"], +} diff --git a/tests/FlickerTests/manifests/AndroidManifest.xml b/tests/FlickerTests/ActivityEmbedding/AndroidManifest.xml index 6bc7cbe88589..f867ffb679c5 100644 --- a/tests/FlickerTests/manifests/AndroidManifest.xml +++ b/tests/FlickerTests/ActivityEmbedding/AndroidManifest.xml @@ -17,7 +17,7 @@ <manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" - package="com.android.server.wm.flicker"> + package="com.android.server.wm.flick"> <uses-sdk android:minSdkVersion="29" android:targetSdkVersion="29"/> <!-- Read and write traces from external storage --> @@ -59,4 +59,9 @@ android:authorities="${applicationId}.androidx-startup" tools:node="remove" /> </application> + + <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner" + android:targetPackage="com.android.server.wm.flicker" + android:label="WindowManager Flicker Tests"> + </instrumentation> </manifest> diff --git a/tests/FlickerTests/ActivityEmbedding/AndroidTestTemplate.xml b/tests/FlickerTests/ActivityEmbedding/AndroidTestTemplate.xml new file mode 100644 index 000000000000..439cf136c220 --- /dev/null +++ b/tests/FlickerTests/ActivityEmbedding/AndroidTestTemplate.xml @@ -0,0 +1,90 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Copyright 2018 Google Inc. All Rights Reserved. + --> +<configuration description="Runs WindowManager {MODULE}"> + <option name="test-tag" value="FlickerTests"/> + <!-- Needed for storing the perfetto trace files in the sdcard/test_results--> + <option name="isolated-storage" value="false"/> + + <target_preparer class="com.android.tradefed.targetprep.DeviceSetup"> + <!-- keeps the screen on during tests --> + <option name="screen-always-on" value="on"/> + <!-- prevents the phone from restarting --> + <option name="force-skip-system-props" value="true"/> + <!-- set WM tracing verbose level to all --> + <option name="run-command" value="cmd window tracing level all"/> + <!-- set WM tracing to frame (avoid incomplete states) --> + <option name="run-command" value="cmd window tracing frame"/> + <!-- ensure lock screen mode is swipe --> + <option name="run-command" value="locksettings set-disabled false"/> + <!-- disable betterbug as it's log collection dialogues cause flakes in e2e tests --> + <option name="run-command" value="pm disable com.google.android.internal.betterbug"/> + <!-- restart launcher to activate TAPL --> + <option name="run-command" + value="setprop ro.test_harness 1 ; am force-stop com.google.android.apps.nexuslauncher"/> + <!-- Increase trace size: 20mb for WM and 80mb for SF --> + <option name="run-command" value="cmd window tracing size 20480"/> + <option name="run-command" value="su root service call SurfaceFlinger 1029 i32 81920"/> + <!-- b/307664397 - Ensure camera has the correct permissions and doesn't show a dialog --> + <option name="run-command" + value="pm grant com.google.android.GoogleCamera android.permission.CAMERA"/> + <option name="run-command" + value="pm grant com.google.android.GoogleCamera android.permission.RECORD_AUDIO"/> + <option name="run-command" + value="pm grant com.google.android.GoogleCamera android.permission.ACCESS_FINE_LOCATION"/> + <option name="run-command" + value="pm grant com.google.android.GoogleCamera android.permission.ACCESS_COARSE_LOCATION"/> + </target_preparer> + <target_preparer class="com.android.tradefed.targetprep.RunCommandTargetPreparer"> + <option name="test-user-token" value="%TEST_USER%"/> + <option name="run-command" value="rm -rf /data/user/%TEST_USER%/files/*"/> + <option name="run-command" value="settings put secure show_ime_with_hard_keyboard 1"/> + <option name="run-command" value="settings put system show_touches 1"/> + <option name="run-command" value="settings put system pointer_location 1"/> + <option name="teardown-command" + value="settings delete secure show_ime_with_hard_keyboard"/> + <option name="teardown-command" value="settings delete system show_touches"/> + <option name="teardown-command" value="settings delete system pointer_location"/> + <option name="teardown-command" + value="cmd overlay enable com.android.internal.systemui.navbar.gestural"/> + </target_preparer> + <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller"> + <option name="cleanup-apks" value="true"/> + <option name="test-file-name" value="{MODULE}.apk"/> + <option name="test-file-name" value="FlickerTestApp.apk"/> + </target_preparer> + <!-- Needed for pushing the trace config file --> + <target_preparer class="com.android.tradefed.targetprep.RootTargetPreparer"/> + <target_preparer class="com.android.tradefed.targetprep.PushFilePreparer"> + <option name="push-file" + key="trace_config.textproto" + value="/data/misc/perfetto-traces/trace_config.textproto" + /> + <!--Install the content provider automatically when we push some file in sdcard folder.--> + <!--Needed to avoid the installation during the test suite.--> + <option name="push-file" key="trace_config.textproto" value="/sdcard/sample.textproto"/> + </target_preparer> + <test class="com.android.tradefed.testtype.AndroidJUnitTest"> + <option name="package" value="{PACKAGE}"/> + <option name="shell-timeout" value="6600s"/> + <option name="test-timeout" value="6600s"/> + <option name="hidden-api-checks" value="false"/> + <option name="device-listeners" value="android.device.collectors.PerfettoListener"/> + <!-- PerfettoListener related arguments --> + <option name="instrumentation-arg" key="perfetto_config_text_proto" value="true"/> + <option name="instrumentation-arg" + key="perfetto_config_file" + value="trace_config.textproto" + /> + <option name="instrumentation-arg" key="per_run" value="true"/> + </test> + <!-- Needed for pulling the collected trace config on to the host --> + <metrics_collector class="com.android.tradefed.device.metric.FilePullerLogCollector"> + <option name="pull-pattern-keys" value="perfetto_file_path"/> + <option name="directory-keys" + value="/data/user/0/com.android.server.wm.flicker/files"/> + <option name="collect-on-run-ended-only" value="true"/> + <option name="clean-up" value="true"/> + </metrics_collector> +</configuration> diff --git a/tests/FlickerTests/ActivityEmbedding/res/anim/show_hide_show_3000ms.xml b/tests/FlickerTests/ActivityEmbedding/res/anim/show_hide_show_3000ms.xml new file mode 100644 index 000000000000..7b3f07e3a2f5 --- /dev/null +++ b/tests/FlickerTests/ActivityEmbedding/res/anim/show_hide_show_3000ms.xml @@ -0,0 +1,31 @@ +<!-- + ~ Copyright (C) 2022 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. + --> + +<set + xmlns:android="http://schemas.android.com/apk/res/android" + android:fillAfter="true"> + + <alpha + android:fromAlpha="1.0" + android:toAlpha="0.0" + android:duration="1000" /> + + <alpha + android:startOffset="2000" + android:fromAlpha="1.0" + android:toAlpha="1.0" + android:duration="1000" /> +</set>
\ No newline at end of file diff --git a/tests/FlickerTests/manifests/AndroidManifestOther.xml b/tests/FlickerTests/ActivityEmbedding/res/xml/network_security_config.xml index 47749b8133b1..4bd9ca049f55 100644 --- a/tests/FlickerTests/manifests/AndroidManifestOther.xml +++ b/tests/FlickerTests/ActivityEmbedding/res/xml/network_security_config.xml @@ -1,3 +1,4 @@ +<?xml version="1.0" encoding="utf-8"?> <!-- ~ Copyright (C) 2023 The Android Open Source Project ~ @@ -14,11 +15,8 @@ ~ limitations under the License. --> -<manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.android.server.wm.flicker"> - - <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner" - android:targetPackage="com.android.server.wm.flicker" - android:label="WindowManager Flicker Tests"> - </instrumentation> -</manifest> +<network-security-config> + <domain-config cleartextTrafficPermitted="true"> + <domain includeSubdomains="true">localhost</domain> + </domain-config> +</network-security-config> diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/activityembedding/ActivityEmbeddingTestBase.kt b/tests/FlickerTests/ActivityEmbedding/src/com/android/server/wm/flicker/activityembedding/ActivityEmbeddingTestBase.kt index 6209a0838d9b..6209a0838d9b 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/activityembedding/ActivityEmbeddingTestBase.kt +++ b/tests/FlickerTests/ActivityEmbedding/src/com/android/server/wm/flicker/activityembedding/ActivityEmbeddingTestBase.kt diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/activityembedding/close/CloseSecondaryActivityInSplitTest.kt b/tests/FlickerTests/ActivityEmbedding/src/com/android/server/wm/flicker/activityembedding/close/CloseSecondaryActivityInSplitTest.kt index 0c36c59a8a83..0c36c59a8a83 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/activityembedding/close/CloseSecondaryActivityInSplitTest.kt +++ b/tests/FlickerTests/ActivityEmbedding/src/com/android/server/wm/flicker/activityembedding/close/CloseSecondaryActivityInSplitTest.kt diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/activityembedding/layoutchange/HorizontalSplitChangeRatioTest.kt b/tests/FlickerTests/ActivityEmbedding/src/com/android/server/wm/flicker/activityembedding/layoutchange/HorizontalSplitChangeRatioTest.kt index adff5792c42d..955e801e7e0a 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/activityembedding/layoutchange/HorizontalSplitChangeRatioTest.kt +++ b/tests/FlickerTests/ActivityEmbedding/src/com/android/server/wm/flicker/activityembedding/layoutchange/HorizontalSplitChangeRatioTest.kt @@ -23,9 +23,9 @@ import android.tools.device.flicker.legacy.FlickerBuilder import android.tools.device.flicker.legacy.LegacyFlickerTest import android.tools.device.flicker.legacy.LegacyFlickerTestFactory import androidx.test.filters.FlakyTest +import androidx.test.filters.RequiresDevice import com.android.server.wm.flicker.activityembedding.ActivityEmbeddingTestBase import com.android.server.wm.flicker.helpers.ActivityEmbeddingAppHelper -import androidx.test.filters.RequiresDevice import org.junit.FixMethodOrder import org.junit.Test import org.junit.runner.RunWith diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/activityembedding/open/MainActivityStartsSecondaryWithAlwaysExpandTest.kt b/tests/FlickerTests/ActivityEmbedding/src/com/android/server/wm/flicker/activityembedding/open/MainActivityStartsSecondaryWithAlwaysExpandTest.kt index ce9c337ff9bd..ce9c337ff9bd 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/activityembedding/open/MainActivityStartsSecondaryWithAlwaysExpandTest.kt +++ b/tests/FlickerTests/ActivityEmbedding/src/com/android/server/wm/flicker/activityembedding/open/MainActivityStartsSecondaryWithAlwaysExpandTest.kt diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/activityembedding/open/OpenActivityEmbeddingPlaceholderSplitTest.kt b/tests/FlickerTests/ActivityEmbedding/src/com/android/server/wm/flicker/activityembedding/open/OpenActivityEmbeddingPlaceholderSplitTest.kt index 59ff0c65c4fc..59ff0c65c4fc 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/activityembedding/open/OpenActivityEmbeddingPlaceholderSplitTest.kt +++ b/tests/FlickerTests/ActivityEmbedding/src/com/android/server/wm/flicker/activityembedding/open/OpenActivityEmbeddingPlaceholderSplitTest.kt diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/activityembedding/open/OpenActivityEmbeddingSecondaryToSplitTest.kt b/tests/FlickerTests/ActivityEmbedding/src/com/android/server/wm/flicker/activityembedding/open/OpenActivityEmbeddingSecondaryToSplitTest.kt index 365782012c54..365782012c54 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/activityembedding/open/OpenActivityEmbeddingSecondaryToSplitTest.kt +++ b/tests/FlickerTests/ActivityEmbedding/src/com/android/server/wm/flicker/activityembedding/open/OpenActivityEmbeddingSecondaryToSplitTest.kt diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/activityembedding/open/OpenThirdActivityOverSplitTest.kt b/tests/FlickerTests/ActivityEmbedding/src/com/android/server/wm/flicker/activityembedding/open/OpenThirdActivityOverSplitTest.kt index 9f9fc23081c5..9f9fc23081c5 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/activityembedding/open/OpenThirdActivityOverSplitTest.kt +++ b/tests/FlickerTests/ActivityEmbedding/src/com/android/server/wm/flicker/activityembedding/open/OpenThirdActivityOverSplitTest.kt diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/activityembedding/open/OpenTrampolineActivityTest.kt b/tests/FlickerTests/ActivityEmbedding/src/com/android/server/wm/flicker/activityembedding/open/OpenTrampolineActivityTest.kt index 30e833f433a8..30e833f433a8 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/activityembedding/open/OpenTrampolineActivityTest.kt +++ b/tests/FlickerTests/ActivityEmbedding/src/com/android/server/wm/flicker/activityembedding/open/OpenTrampolineActivityTest.kt diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/activityembedding/pip/SecondaryActivityEnterPipTest.kt b/tests/FlickerTests/ActivityEmbedding/src/com/android/server/wm/flicker/activityembedding/pip/SecondaryActivityEnterPipTest.kt index 47d6d235848f..790da34b1b08 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/activityembedding/pip/SecondaryActivityEnterPipTest.kt +++ b/tests/FlickerTests/ActivityEmbedding/src/com/android/server/wm/flicker/activityembedding/pip/SecondaryActivityEnterPipTest.kt @@ -36,9 +36,8 @@ import org.junit.runners.Parameterized /** * Test launching a secondary Activity into Picture-In-Picture mode. * - * Setup: Start from a split A|B. - * Transition: B enters PIP, observe the window first goes fullscreen then shrink to the bottom - * right corner on screen. + * Setup: Start from a split A|B. Transition: B enters PIP, observe the window first goes fullscreen + * then shrink to the bottom right corner on screen. * * To run this test: `atest FlickerTestsOther:SecondaryActivityEnterPipTest` */ @@ -64,16 +63,10 @@ class SecondaryActivityEnterPipTest(flicker: LegacyFlickerTest) : } } - /** - * We expect the background layer to be visible during this transition. - */ - @Presubmit - @Test - override fun backgroundLayerNeverVisible(): Unit {} + /** We expect the background layer to be visible during this transition. */ + @Presubmit @Test override fun backgroundLayerNeverVisible() {} - /** - * Main and secondary activity start from a split each taking half of the screen. - */ + /** Main and secondary activity start from a split each taking half of the screen. */ @Presubmit @Test fun layersStartFromEqualSplit() { diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/activityembedding/rotation/RotateSplitNoChangeTest.kt b/tests/FlickerTests/ActivityEmbedding/src/com/android/server/wm/flicker/activityembedding/rotation/RotateSplitNoChangeTest.kt index 4f7d8a474da1..e8389d1917d8 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/activityembedding/rotation/RotateSplitNoChangeTest.kt +++ b/tests/FlickerTests/ActivityEmbedding/src/com/android/server/wm/flicker/activityembedding/rotation/RotateSplitNoChangeTest.kt @@ -23,9 +23,7 @@ import android.tools.device.flicker.legacy.FlickerBuilder import android.tools.device.flicker.legacy.LegacyFlickerTest import android.tools.device.flicker.legacy.LegacyFlickerTestFactory import androidx.test.filters.RequiresDevice -import com.android.server.wm.flicker.activityembedding.ActivityEmbeddingTestBase import com.android.server.wm.flicker.helpers.ActivityEmbeddingAppHelper -import com.android.server.wm.flicker.rotation.RotationTransition import org.junit.FixMethodOrder import org.junit.Test import org.junit.runner.RunWith diff --git a/tests/FlickerTests/ActivityEmbedding/src/com/android/server/wm/flicker/activityembedding/rotation/RotationTransition.kt b/tests/FlickerTests/ActivityEmbedding/src/com/android/server/wm/flicker/activityembedding/rotation/RotationTransition.kt new file mode 100644 index 000000000000..1123c5bb6ea8 --- /dev/null +++ b/tests/FlickerTests/ActivityEmbedding/src/com/android/server/wm/flicker/activityembedding/rotation/RotationTransition.kt @@ -0,0 +1,82 @@ +/* + * Copyright (C) 2021 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.wm.flicker.activityembedding.rotation + +import android.platform.test.annotations.Presubmit +import android.tools.common.traces.component.ComponentNameMatcher +import android.tools.device.apphelpers.StandardAppHelper +import android.tools.device.flicker.legacy.FlickerBuilder +import android.tools.device.flicker.legacy.LegacyFlickerTest +import com.android.server.wm.flicker.BaseTest +import com.android.server.wm.flicker.helpers.setRotation +import org.junit.Test + +/** Base class for app rotation tests */ +abstract class RotationTransition(flicker: LegacyFlickerTest) : BaseTest(flicker) { + protected abstract val testApp: StandardAppHelper + + /** {@inheritDoc} */ + override val transition: FlickerBuilder.() -> Unit = { + setup { this.setRotation(flicker.scenario.startRotation) } + teardown { testApp.exit(wmHelper) } + transitions { this.setRotation(flicker.scenario.endRotation) } + } + + /** {@inheritDoc} */ + @Presubmit + @Test + override fun visibleLayersShownMoreThanOneConsecutiveEntry() { + flicker.assertLayers { + this.visibleLayersShownMoreThanOneConsecutiveEntry( + ignoreLayers = + listOf( + ComponentNameMatcher.SPLASH_SCREEN, + ComponentNameMatcher.SNAPSHOT, + ComponentNameMatcher("", "SecondaryHomeHandle") + ) + ) + } + } + + /** Checks that [testApp] layer covers the entire screen at the start of the transition */ + @Presubmit + @Test + open fun appLayerRotates_StartingPos() { + flicker.assertLayersStart { + this.entry.displays.map { display -> + this.visibleRegion(testApp).coversExactly(display.layerStackSpace) + } + } + } + + /** Checks that [testApp] layer covers the entire screen at the end of the transition */ + @Presubmit + @Test + open fun appLayerRotates_EndingPos() { + flicker.assertLayersEnd { + this.entry.displays.map { display -> + this.visibleRegion(testApp).coversExactly(display.layerStackSpace) + } + } + } + + override fun cujCompleted() { + super.cujCompleted() + appLayerRotates_StartingPos() + appLayerRotates_EndingPos() + } +} diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/activityembedding/rtl/RTLStartSecondaryWithPlaceholderTest.kt b/tests/FlickerTests/ActivityEmbedding/src/com/android/server/wm/flicker/activityembedding/rtl/RTLStartSecondaryWithPlaceholderTest.kt index 6be78f829b34..6be78f829b34 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/activityembedding/rtl/RTLStartSecondaryWithPlaceholderTest.kt +++ b/tests/FlickerTests/ActivityEmbedding/src/com/android/server/wm/flicker/activityembedding/rtl/RTLStartSecondaryWithPlaceholderTest.kt diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/activityembedding/splitscreen/EnterSystemSplitTest.kt b/tests/FlickerTests/ActivityEmbedding/src/com/android/server/wm/flicker/activityembedding/splitscreen/EnterSystemSplitTest.kt index 93a5bf5bcb4e..576eec847066 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/activityembedding/splitscreen/EnterSystemSplitTest.kt +++ b/tests/FlickerTests/ActivityEmbedding/src/com/android/server/wm/flicker/activityembedding/splitscreen/EnterSystemSplitTest.kt @@ -24,8 +24,8 @@ import android.tools.device.flicker.legacy.FlickerBuilder import android.tools.device.flicker.legacy.LegacyFlickerTest import android.tools.device.flicker.legacy.LegacyFlickerTestFactory import android.tools.device.traces.parsers.toFlickerComponent -import com.android.server.wm.flicker.helpers.ActivityEmbeddingAppHelper import com.android.server.wm.flicker.activityembedding.ActivityEmbeddingTestBase +import com.android.server.wm.flicker.helpers.ActivityEmbeddingAppHelper import com.android.server.wm.flicker.testapp.ActivityOptions import com.android.wm.shell.flicker.utils.SPLIT_SCREEN_DIVIDER_COMPONENT import com.android.wm.shell.flicker.utils.SplitScreenUtils @@ -39,11 +39,11 @@ import org.junit.runner.RunWith import org.junit.runners.MethodSorters import org.junit.runners.Parameterized -/*** +/** * Test entering System SplitScreen with Activity Embedding Split and another app. * - * Setup: Launch A|B in split and secondaryApp, return to home. - * Transitions: Let AE Split A|B enter splitscreen with secondaryApp. Resulting in A|B|secondaryApp. + * Setup: Launch A|B in split and secondaryApp, return to home. Transitions: Let AE Split A|B enter + * splitscreen with secondaryApp. Resulting in A|B|secondaryApp. * * To run this test: `atest FlickerTestsOther:EnterSystemSplitTest` */ @@ -51,8 +51,7 @@ import org.junit.runners.Parameterized @RunWith(Parameterized::class) @Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class) @FixMethodOrder(MethodSorters.NAME_ASCENDING) -class EnterSystemSplitTest(flicker: LegacyFlickerTest) : - ActivityEmbeddingTestBase(flicker) { +class EnterSystemSplitTest(flicker: LegacyFlickerTest) : ActivityEmbeddingTestBase(flicker) { private val secondaryApp = SplitScreenUtils.getPrimary(instrumentation) override val transition: FlickerBuilder.() -> Unit = { @@ -62,17 +61,22 @@ class EnterSystemSplitTest(flicker: LegacyFlickerTest) : secondaryApp.launchViaIntent(wmHelper) tapl.goHome() wmHelper - .StateSyncBuilder() - .withAppTransitionIdle() - .withHomeActivityVisible() - .waitForAndVerify() + .StateSyncBuilder() + .withAppTransitionIdle() + .withHomeActivityVisible() + .waitForAndVerify() startDisplayBounds = - wmHelper.currentState.layerState.physicalDisplayBounds - ?: error("Display not found") + wmHelper.currentState.layerState.physicalDisplayBounds ?: error("Display not found") } transitions { - SplitScreenUtils.enterSplit(wmHelper, tapl, device, testApp, secondaryApp, - flicker.scenario.startRotation) + SplitScreenUtils.enterSplit( + wmHelper, + tapl, + device, + testApp, + secondaryApp, + flicker.scenario.startRotation + ) SplitScreenUtils.waitForSplitComplete(wmHelper, testApp, secondaryApp) } } @@ -85,7 +89,10 @@ class EnterSystemSplitTest(flicker: LegacyFlickerTest) : @Test fun activityEmbeddingSplitLayerBecomesVisible() { flicker.splitAppLayerBoundsIsVisibleAtEnd( - testApp, landscapePosLeft = tapl.isTablet, portraitPosTop = false) + testApp, + landscapePosLeft = tapl.isTablet, + portraitPosTop = false + ) } @Presubmit @@ -96,7 +103,10 @@ class EnterSystemSplitTest(flicker: LegacyFlickerTest) : @Test fun secondaryLayerBecomesVisible() { flicker.splitAppLayerBoundsIsVisibleAtEnd( - secondaryApp, landscapePosLeft = !tapl.isTablet, portraitPosTop = true) + secondaryApp, + landscapePosLeft = !tapl.isTablet, + portraitPosTop = true + ) } @Presubmit @@ -105,73 +115,73 @@ class EnterSystemSplitTest(flicker: LegacyFlickerTest) : /** * After the transition there should be both ActivityEmbedding activities, - * SplitScreenPrimaryActivity and the system split divider on screen. - * Verify the layers are in expected sizes. + * SplitScreenPrimaryActivity and the system split divider on screen. Verify the layers are in + * expected sizes. */ @Presubmit @Test fun activityEmbeddingSplitSurfaceAreEven() { flicker.assertLayersEnd { val leftAELayerRegion = - visibleRegion(ActivityEmbeddingAppHelper.MAIN_ACTIVITY_COMPONENT) + visibleRegion(ActivityEmbeddingAppHelper.MAIN_ACTIVITY_COMPONENT) val rightAELayerRegion = - visibleRegion(ActivityEmbeddingAppHelper.SECONDARY_ACTIVITY_COMPONENT) + visibleRegion(ActivityEmbeddingAppHelper.SECONDARY_ACTIVITY_COMPONENT) val secondaryAppLayerRegion = - visibleRegion( - ActivityOptions.SplitScreen.Primary.COMPONENT.toFlickerComponent()) + visibleRegion(ActivityOptions.SplitScreen.Primary.COMPONENT.toFlickerComponent()) val systemDivider = visibleRegion(SPLIT_SCREEN_DIVIDER_COMPONENT) leftAELayerRegion - .plus(rightAELayerRegion.region) - .plus(secondaryAppLayerRegion.region) - .plus(systemDivider.region) - .coversExactly(startDisplayBounds) + .plus(rightAELayerRegion.region) + .plus(secondaryAppLayerRegion.region) + .plus(systemDivider.region) + .coversExactly(startDisplayBounds) check { "ActivityEmbeddingSplitHeight" } - .that(leftAELayerRegion.region.height) - .isEqual(rightAELayerRegion.region.height) + .that(leftAELayerRegion.region.height) + .isEqual(rightAELayerRegion.region.height) check { "SystemSplitHeight" } - .that(rightAELayerRegion.region.height) - .isEqual(secondaryAppLayerRegion.region.height) + .that(rightAELayerRegion.region.height) + .isEqual(secondaryAppLayerRegion.region.height) // TODO(b/292283182): Remove this special case handling. check { "ActivityEmbeddingSplitWidth" } - .that(Math.abs( - leftAELayerRegion.region.width - rightAELayerRegion.region.width)) - .isLower(2) + .that(Math.abs(leftAELayerRegion.region.width - rightAELayerRegion.region.width)) + .isLower(2) check { "SystemSplitWidth" } - .that(Math.abs(secondaryAppLayerRegion.region.width - - 2 * rightAELayerRegion.region.width)) - .isLower(2) + .that( + Math.abs( + secondaryAppLayerRegion.region.width - 2 * rightAELayerRegion.region.width + ) + ) + .isLower(2) } } - /** - * Verify the windows are in expected sizes. - */ + /** Verify the windows are in expected sizes. */ @Presubmit @Test fun activityEmbeddingSplitWindowsAreEven() { flicker.assertWmEnd { val leftAEWindowRegion = - visibleRegion(ActivityEmbeddingAppHelper.MAIN_ACTIVITY_COMPONENT) + visibleRegion(ActivityEmbeddingAppHelper.MAIN_ACTIVITY_COMPONENT) val rightAEWindowRegion = - visibleRegion(ActivityEmbeddingAppHelper.SECONDARY_ACTIVITY_COMPONENT) + visibleRegion(ActivityEmbeddingAppHelper.SECONDARY_ACTIVITY_COMPONENT) // There's no window for the divider bar. val secondaryAppLayerRegion = - visibleRegion( - ActivityOptions.SplitScreen.Primary.COMPONENT.toFlickerComponent()) + visibleRegion(ActivityOptions.SplitScreen.Primary.COMPONENT.toFlickerComponent()) check { "ActivityEmbeddingSplitHeight" } - .that(leftAEWindowRegion.region.height) - .isEqual(rightAEWindowRegion.region.height) + .that(leftAEWindowRegion.region.height) + .isEqual(rightAEWindowRegion.region.height) check { "SystemSplitHeight" } - .that(rightAEWindowRegion.region.height) - .isEqual(secondaryAppLayerRegion.region.height) + .that(rightAEWindowRegion.region.height) + .isEqual(secondaryAppLayerRegion.region.height) check { "ActivityEmbeddingSplitWidth" } - .that(Math.abs( - leftAEWindowRegion.region.width - rightAEWindowRegion.region.width)) - .isLower(2) + .that(Math.abs(leftAEWindowRegion.region.width - rightAEWindowRegion.region.width)) + .isLower(2) check { "SystemSplitWidth" } - .that(Math.abs(secondaryAppLayerRegion.region.width - - 2 * rightAEWindowRegion.region.width)) - .isLower(2) + .that( + Math.abs( + secondaryAppLayerRegion.region.width - 2 * rightAEWindowRegion.region.width + ) + ) + .isLower(2) } } @@ -191,4 +201,4 @@ class EnterSystemSplitTest(flicker: LegacyFlickerTest) : @JvmStatic fun getParams() = LegacyFlickerTestFactory.nonRotationTests() } -}
\ No newline at end of file +} diff --git a/tests/FlickerTests/trace_config/trace_config.textproto b/tests/FlickerTests/ActivityEmbedding/trace_config/trace_config.textproto index c9a35aca9085..c9a35aca9085 100644 --- a/tests/FlickerTests/trace_config/trace_config.textproto +++ b/tests/FlickerTests/ActivityEmbedding/trace_config/trace_config.textproto diff --git a/tests/FlickerTests/Android.bp b/tests/FlickerTests/Android.bp index 3d49d81a0f5a..514f89511fb1 100644 --- a/tests/FlickerTests/Android.bp +++ b/tests/FlickerTests/Android.bp @@ -24,75 +24,14 @@ package { } filegroup { - name: "FlickerTestsBase-src", - srcs: ["src/com/android/server/wm/flicker/*.kt"], -} - -filegroup { - name: "FlickerTestsAppClose-src", - srcs: ["src/**/close/*.kt"], -} - -filegroup { - name: "FlickerTestsActivityEmbedding-src", - srcs: [ - "src/**/activityembedding/*.kt", - "src/**/activityembedding/open/*.kt", - "src/**/activityembedding/close/*.kt", - "src/**/activityembedding/layoutchange/*.kt", - "src/**/activityembedding/pip/*.kt", - "src/**/activityembedding/rotation/*.kt", - "src/**/activityembedding/rtl/*.kt", - "src/**/activityembedding/splitscreen/*.kt", - ], -} - -filegroup { - name: "FlickerTestsIme-src", - srcs: ["src/**/ime/*.kt"], -} - -filegroup { - name: "FlickerTestsAppLaunchCommon-src", - srcs: ["src/**/launch/common/*.kt"], -} - -filegroup { - name: "FlickerTestsAppLaunch1-src", - srcs: ["src/**/launch/OpenApp*.kt"], -} - -filegroup { - name: "FlickerTestsAppLaunch2-src", - srcs: ["src/**/launch/*.kt"], -} - -filegroup { - name: "FlickerTestsNotification-src", - srcs: ["src/**/notification/*.kt"], -} - -filegroup { - name: "FlickerTestsQuickswitch-src", - srcs: ["src/**/quickswitch/*.kt"], -} - -filegroup { - name: "FlickerTestsRotation-src", - srcs: ["src/**/rotation/*.kt"], -} - -filegroup { name: "FlickerServiceTests-src", srcs: [ - "src/com/android/server/wm/flicker/service/**/*.kt", + "src/**/*", ], } java_defaults { name: "FlickerTestsDefault", - manifest: "manifests/AndroidManifest.xml", - test_config_template: "AndroidTestTemplate.xml", platform_apis: true, certificate: "platform", optimize: { @@ -116,139 +55,6 @@ java_defaults { ], } -android_test { - name: "FlickerTestsOther", - defaults: ["FlickerTestsDefault"], - additional_manifests: ["manifests/AndroidManifestOther.xml"], - package_name: "com.android.server.wm.flicker", - instrumentation_target_package: "com.android.server.wm.flicker", - srcs: [ - "src/**/*.java", - "src/**/*.kt", - ], - exclude_srcs: [ - ":FlickerTestsAppClose-src", - ":FlickerTestsIme-src", - ":FlickerTestsAppLaunch1-src", - ":FlickerTestsAppLaunch2-src", - ":FlickerTestsQuickswitch-src", - ":FlickerTestsRotation-src", - ":FlickerTestsNotification-src", - ":FlickerServiceTests-src", - ], -} - -android_test { - name: "FlickerTestsAppClose", - defaults: ["FlickerTestsDefault"], - additional_manifests: ["manifests/AndroidManifestAppClose.xml"], - package_name: "com.android.server.wm.flicker.close", - instrumentation_target_package: "com.android.server.wm.flicker.close", - srcs: [ - ":FlickerTestsBase-src", - ":FlickerTestsAppClose-src", - ], - exclude_srcs: [ - ":FlickerTestsActivityEmbedding-src", - ], -} - -android_test { - name: "FlickerTestsIme", - defaults: ["FlickerTestsDefault"], - additional_manifests: ["manifests/AndroidManifestIme.xml"], - package_name: "com.android.server.wm.flicker.ime", - instrumentation_target_package: "com.android.server.wm.flicker.ime", - srcs: [ - ":FlickerTestsBase-src", - ":FlickerTestsIme-src", - ], -} - -android_test { - name: "FlickerTestsAppLaunch1", - defaults: ["FlickerTestsDefault"], - additional_manifests: ["manifests/AndroidManifestAppLaunch.xml"], - package_name: "com.android.server.wm.flicker.launch", - instrumentation_target_package: "com.android.server.wm.flicker.launch", - srcs: [ - ":FlickerTestsBase-src", - ":FlickerTestsAppLaunchCommon-src", - ":FlickerTestsAppLaunch1-src", - ], - exclude_srcs: [ - ":FlickerTestsActivityEmbedding-src", - ], -} - -android_test { - name: "FlickerTestsAppLaunch2", - defaults: ["FlickerTestsDefault"], - additional_manifests: ["manifests/AndroidManifestAppLaunch.xml"], - package_name: "com.android.server.wm.flicker.launch", - instrumentation_target_package: "com.android.server.wm.flicker.launch", - srcs: [ - ":FlickerTestsBase-src", - ":FlickerTestsAppLaunchCommon-src", - ":FlickerTestsAppLaunch2-src", - ], - exclude_srcs: [ - ":FlickerTestsActivityEmbedding-src", - ":FlickerTestsAppLaunch1-src", - ], -} - -android_test { - name: "FlickerTestsNotification", - defaults: ["FlickerTestsDefault"], - additional_manifests: ["manifests/AndroidManifestNotification.xml"], - package_name: "com.android.server.wm.flicker.notification", - instrumentation_target_package: "com.android.server.wm.flicker.notification", - srcs: [ - ":FlickerTestsBase-src", - ":FlickerTestsNotification-src", - ], -} - -android_test { - name: "FlickerTestsQuickswitch", - defaults: ["FlickerTestsDefault"], - additional_manifests: ["manifests/AndroidManifestQuickswitch.xml"], - package_name: "com.android.server.wm.flicker.quickswitch", - instrumentation_target_package: "com.android.server.wm.flicker.quickswitch", - srcs: [ - ":FlickerTestsBase-src", - ":FlickerTestsQuickswitch-src", - ], -} - -android_test { - name: "FlickerTestsRotation", - defaults: ["FlickerTestsDefault"], - additional_manifests: ["manifests/AndroidManifestRotation.xml"], - package_name: "com.android.server.wm.flicker.rotation", - instrumentation_target_package: "com.android.server.wm.flicker.rotation", - srcs: [ - ":FlickerTestsBase-src", - ":FlickerTestsRotation-src", - ], - exclude_srcs: [ - ":FlickerTestsActivityEmbedding-src", - ], -} - -android_test { - name: "FlickerServiceTests", - defaults: ["FlickerTestsDefault"], - additional_manifests: ["manifests/AndroidManifestService.xml"], - package_name: "com.android.server.wm.flicker.service", - instrumentation_target_package: "com.android.server.wm.flicker.service", - srcs: [ - ":FlickerTestsBase-src", - ":FlickerServiceTests-src", - ], -} - java_library { name: "wm-flicker-common-assertions", platform_apis: true, @@ -259,9 +65,6 @@ java_library { "src/**/*Assertions.java", "src/**/*Assertions.kt", ], - exclude_srcs: [ - "**/helpers/*", - ], static_libs: [ "flickerlib", "flickerlib-helpers", @@ -270,26 +73,6 @@ java_library { ], } -java_library { - name: "wm-flicker-common-app-helpers", - platform_apis: true, - optimize: { - enabled: false, - }, - srcs: [ - "**/helpers/*", - ], - static_libs: [ - "flickertestapplib", - "flickerlib", - "flickerlib-apphelpers", - "flickerlib-helpers", - "truth", - "app-helpers-core", - "wm-flicker-window-extensions", - ], -} - android_library_import { name: "wm-flicker-window-extensions_nodeps", aars: ["libs/window-extensions-release.aar"], @@ -304,3 +87,9 @@ java_library { ], installable: false, } + +java_library { + name: "FlickerTestsBase", + defaults: ["FlickerTestsDefault"], + srcs: ["src/**/*"], +} diff --git a/tests/FlickerTests/AppClose/Android.bp b/tests/FlickerTests/AppClose/Android.bp new file mode 100644 index 000000000000..151d12f2a8ca --- /dev/null +++ b/tests/FlickerTests/AppClose/Android.bp @@ -0,0 +1,33 @@ +// +// Copyright (C) 2018 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 { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "frameworks_base_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["frameworks_base_license"], +} + +android_test { + name: "FlickerTestsAppClose", + defaults: ["FlickerTestsDefault"], + manifest: "AndroidManifest.xml", + test_config_template: "AndroidTestTemplate.xml", + srcs: ["src/**/*"], + static_libs: ["FlickerTestsBase"], +} diff --git a/tests/FlickerTests/AppClose/AndroidManifest.xml b/tests/FlickerTests/AppClose/AndroidManifest.xml new file mode 100644 index 000000000000..e75e178b388c --- /dev/null +++ b/tests/FlickerTests/AppClose/AndroidManifest.xml @@ -0,0 +1,67 @@ +<?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. + --> + +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools" + package="com.android.server.wm.flicker.close"> + + <uses-sdk android:minSdkVersion="29" android:targetSdkVersion="29"/> + <!-- Read and write traces from external storage --> + <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> + <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> + <!-- Allow the test to write directly to /sdcard/ --> + <uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" /> + <!-- Write secure settings --> + <uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS" /> + <!-- Capture screen contents --> + <uses-permission android:name="android.permission.ACCESS_SURFACE_FLINGER" /> + <!-- Enable / Disable tracing !--> + <uses-permission android:name="android.permission.DUMP" /> + <!-- Force-stop test apps --> + <uses-permission android:name="android.permission.FORCE_STOP_PACKAGES"/> + <!-- Run layers trace --> + <uses-permission android:name="android.permission.HARDWARE_TEST"/> + <!-- Capture screen recording --> + <uses-permission android:name="android.permission.CAPTURE_VIDEO_OUTPUT"/> + <!-- Workaround grant runtime permission exception from b/152733071 --> + <uses-permission android:name="android.permission.PACKAGE_USAGE_STATS"/> + <uses-permission android:name="android.permission.READ_LOGS"/> + <!-- ATM.removeRootTasksWithActivityTypes() --> + <uses-permission android:name="android.permission.MANAGE_ACTIVITY_TASKS" /> + <!-- ActivityOptions.makeCustomTaskAnimation() --> + <uses-permission android:name="android.permission.START_TASKS_FROM_RECENTS" /> + <!-- Allow the test to connect to perfetto trace processor --> + <uses-permission android:name="android.permission.INTERNET"/> + <!-- Allow the test to write directly to /sdcard/ and connect to trace processor --> + <application android:requestLegacyExternalStorage="true" + android:networkSecurityConfig="@xml/network_security_config" + android:largeHeap="true"> + <uses-library android:name="android.test.runner"/> + <uses-library android:name="androidx.window.extensions" android:required="false"/> + + <!-- (b/197936012) Remove startup provider due to test timeout issue --> + <provider + android:name="androidx.startup.InitializationProvider" + android:authorities="${applicationId}.androidx-startup" + tools:node="remove" /> + </application> + + <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner" + android:targetPackage="com.android.server.wm.flicker.close" + android:label="WindowManager Flicker Tests"> + </instrumentation> +</manifest> diff --git a/tests/FlickerTests/AppClose/AndroidTestTemplate.xml b/tests/FlickerTests/AppClose/AndroidTestTemplate.xml new file mode 100644 index 000000000000..4b6224efaf60 --- /dev/null +++ b/tests/FlickerTests/AppClose/AndroidTestTemplate.xml @@ -0,0 +1,90 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Copyright 2018 Google Inc. All Rights Reserved. + --> +<configuration description="Runs WindowManager {MODULE}"> + <option name="test-tag" value="FlickerTests"/> + <!-- Needed for storing the perfetto trace files in the sdcard/test_results--> + <option name="isolated-storage" value="false"/> + + <target_preparer class="com.android.tradefed.targetprep.DeviceSetup"> + <!-- keeps the screen on during tests --> + <option name="screen-always-on" value="on"/> + <!-- prevents the phone from restarting --> + <option name="force-skip-system-props" value="true"/> + <!-- set WM tracing verbose level to all --> + <option name="run-command" value="cmd window tracing level all"/> + <!-- set WM tracing to frame (avoid incomplete states) --> + <option name="run-command" value="cmd window tracing frame"/> + <!-- ensure lock screen mode is swipe --> + <option name="run-command" value="locksettings set-disabled false"/> + <!-- disable betterbug as it's log collection dialogues cause flakes in e2e tests --> + <option name="run-command" value="pm disable com.google.android.internal.betterbug"/> + <!-- restart launcher to activate TAPL --> + <option name="run-command" + value="setprop ro.test_harness 1 ; am force-stop com.google.android.apps.nexuslauncher"/> + <!-- Increase trace size: 20mb for WM and 80mb for SF --> + <option name="run-command" value="cmd window tracing size 20480"/> + <option name="run-command" value="su root service call SurfaceFlinger 1029 i32 81920"/> + <!-- b/307664397 - Ensure camera has the correct permissions and doesn't show a dialog --> + <option name="run-command" + value="pm grant com.google.android.GoogleCamera android.permission.CAMERA"/> + <option name="run-command" + value="pm grant com.google.android.GoogleCamera android.permission.RECORD_AUDIO"/> + <option name="run-command" + value="pm grant com.google.android.GoogleCamera android.permission.ACCESS_FINE_LOCATION"/> + <option name="run-command" + value="pm grant com.google.android.GoogleCamera android.permission.ACCESS_COARSE_LOCATION"/> + </target_preparer> + <target_preparer class="com.android.tradefed.targetprep.RunCommandTargetPreparer"> + <option name="test-user-token" value="%TEST_USER%"/> + <option name="run-command" value="rm -rf /data/user/%TEST_USER%/files/*"/> + <option name="run-command" value="settings put secure show_ime_with_hard_keyboard 1"/> + <option name="run-command" value="settings put system show_touches 1"/> + <option name="run-command" value="settings put system pointer_location 1"/> + <option name="teardown-command" + value="settings delete secure show_ime_with_hard_keyboard"/> + <option name="teardown-command" value="settings delete system show_touches"/> + <option name="teardown-command" value="settings delete system pointer_location"/> + <option name="teardown-command" + value="cmd overlay enable com.android.internal.systemui.navbar.gestural"/> + </target_preparer> + <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller"> + <option name="cleanup-apks" value="true"/> + <option name="test-file-name" value="{MODULE}.apk"/> + <option name="test-file-name" value="FlickerTestApp.apk"/> + </target_preparer> + <!-- Needed for pushing the trace config file --> + <target_preparer class="com.android.tradefed.targetprep.RootTargetPreparer"/> + <target_preparer class="com.android.tradefed.targetprep.PushFilePreparer"> + <option name="push-file" + key="trace_config.textproto" + value="/data/misc/perfetto-traces/trace_config.textproto" + /> + <!--Install the content provider automatically when we push some file in sdcard folder.--> + <!--Needed to avoid the installation during the test suite.--> + <option name="push-file" key="trace_config.textproto" value="/sdcard/sample.textproto"/> + </target_preparer> + <test class="com.android.tradefed.testtype.AndroidJUnitTest"> + <option name="package" value="{PACKAGE}"/> + <option name="shell-timeout" value="6600s"/> + <option name="test-timeout" value="6600s"/> + <option name="hidden-api-checks" value="false"/> + <option name="device-listeners" value="android.device.collectors.PerfettoListener"/> + <!-- PerfettoListener related arguments --> + <option name="instrumentation-arg" key="perfetto_config_text_proto" value="true"/> + <option name="instrumentation-arg" + key="perfetto_config_file" + value="trace_config.textproto" + /> + <option name="instrumentation-arg" key="per_run" value="true"/> + </test> + <!-- Needed for pulling the collected trace config on to the host --> + <metrics_collector class="com.android.tradefed.device.metric.FilePullerLogCollector"> + <option name="pull-pattern-keys" value="perfetto_file_path"/> + <option name="directory-keys" + value="/data/user/0/com.android.server.wm.flicker.close/files"/> + <option name="collect-on-run-ended-only" value="true"/> + <option name="clean-up" value="true"/> + </metrics_collector> +</configuration> diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/close/OWNERS b/tests/FlickerTests/AppClose/OWNERS index f7c0a87f5dac..f7c0a87f5dac 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/close/OWNERS +++ b/tests/FlickerTests/AppClose/OWNERS diff --git a/tests/FlickerTests/AppClose/res/anim/show_hide_show_3000ms.xml b/tests/FlickerTests/AppClose/res/anim/show_hide_show_3000ms.xml new file mode 100644 index 000000000000..7b3f07e3a2f5 --- /dev/null +++ b/tests/FlickerTests/AppClose/res/anim/show_hide_show_3000ms.xml @@ -0,0 +1,31 @@ +<!-- + ~ Copyright (C) 2022 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. + --> + +<set + xmlns:android="http://schemas.android.com/apk/res/android" + android:fillAfter="true"> + + <alpha + android:fromAlpha="1.0" + android:toAlpha="0.0" + android:duration="1000" /> + + <alpha + android:startOffset="2000" + android:fromAlpha="1.0" + android:toAlpha="1.0" + android:duration="1000" /> +</set>
\ No newline at end of file diff --git a/tests/FlickerTests/manifests/AndroidManifestIme.xml b/tests/FlickerTests/AppClose/res/xml/network_security_config.xml index abd03af4888a..4bd9ca049f55 100644 --- a/tests/FlickerTests/manifests/AndroidManifestIme.xml +++ b/tests/FlickerTests/AppClose/res/xml/network_security_config.xml @@ -1,3 +1,4 @@ +<?xml version="1.0" encoding="utf-8"?> <!-- ~ Copyright (C) 2023 The Android Open Source Project ~ @@ -14,11 +15,8 @@ ~ limitations under the License. --> -<manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.android.server.wm.flicker.ime"> - - <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner" - android:targetPackage="com.android.server.wm.flicker.ime" - android:label="WindowManager Flicker Tests"> - </instrumentation> -</manifest> +<network-security-config> + <domain-config cleartextTrafficPermitted="true"> + <domain includeSubdomains="true">localhost</domain> + </domain-config> +</network-security-config> diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/close/CloseAppBackButtonTest.kt b/tests/FlickerTests/AppClose/src/com/android/server/wm/flicker/close/CloseAppBackButtonTest.kt index 288558aeb3b1..64dd44d8b6e0 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/close/CloseAppBackButtonTest.kt +++ b/tests/FlickerTests/AppClose/src/com/android/server/wm/flicker/close/CloseAppBackButtonTest.kt @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020 The Android Open Source Project + * 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. diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/close/CloseAppHomeButtonTest.kt b/tests/FlickerTests/AppClose/src/com/android/server/wm/flicker/close/CloseAppHomeButtonTest.kt index 32305c6c9a33..eb256b56193d 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/close/CloseAppHomeButtonTest.kt +++ b/tests/FlickerTests/AppClose/src/com/android/server/wm/flicker/close/CloseAppHomeButtonTest.kt @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020 The Android Open Source Project + * 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. diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/close/CloseAppTransition.kt b/tests/FlickerTests/AppClose/src/com/android/server/wm/flicker/close/CloseAppTransition.kt index 8d752ccd275e..ea025c74b8db 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/close/CloseAppTransition.kt +++ b/tests/FlickerTests/AppClose/src/com/android/server/wm/flicker/close/CloseAppTransition.kt @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 The Android Open Source Project + * 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. diff --git a/tests/FlickerTests/AppClose/trace_config/trace_config.textproto b/tests/FlickerTests/AppClose/trace_config/trace_config.textproto new file mode 100644 index 000000000000..c9a35aca9085 --- /dev/null +++ b/tests/FlickerTests/AppClose/trace_config/trace_config.textproto @@ -0,0 +1,77 @@ +# 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. + +# proto-message: TraceConfig + +# Enable periodic flushing of the trace buffer into the output file. +write_into_file: true + +# Writes the userspace buffer into the file every 1s. +file_write_period_ms: 2500 + +# See b/126487238 - we need to guarantee ordering of events. +flush_period_ms: 30000 + +# The trace buffers needs to be big enough to hold |file_write_period_ms| of +# trace data. The trace buffer sizing depends on the number of trace categories +# enabled and the device activity. + +# RSS events +buffers: { + size_kb: 63488 + fill_policy: RING_BUFFER +} + +data_sources { + config { + name: "linux.process_stats" + target_buffer: 0 + # polled per-process memory counters and process/thread names. + # If you don't want the polled counters, remove the "process_stats_config" + # section, but keep the data source itself as it still provides on-demand + # thread/process naming for ftrace data below. + process_stats_config { + scan_all_processes_on_start: true + } + } +} + +data_sources: { + config { + name: "linux.ftrace" + ftrace_config { + ftrace_events: "ftrace/print" + ftrace_events: "task/task_newtask" + ftrace_events: "task/task_rename" + atrace_categories: "ss" + atrace_categories: "wm" + atrace_categories: "am" + atrace_categories: "aidl" + atrace_categories: "input" + atrace_categories: "binder_driver" + atrace_categories: "sched_process_exit" + atrace_apps: "com.android.server.wm.flicker" + atrace_apps: "com.android.server.wm.flicker.other" + atrace_apps: "com.android.server.wm.flicker.close" + atrace_apps: "com.android.server.wm.flicker.ime" + atrace_apps: "com.android.server.wm.flicker.launch" + atrace_apps: "com.android.server.wm.flicker.quickswitch" + atrace_apps: "com.android.server.wm.flicker.rotation" + atrace_apps: "com.android.server.wm.flicker.testapp" + atrace_apps: "com.android.systemui" + atrace_apps: "com.google.android.apps.nexuslauncher" + } + } +} + diff --git a/tests/FlickerTests/AppLaunch/Android.bp b/tests/FlickerTests/AppLaunch/Android.bp new file mode 100644 index 000000000000..f33384df6e7f --- /dev/null +++ b/tests/FlickerTests/AppLaunch/Android.bp @@ -0,0 +1,69 @@ +// +// Copyright (C) 2018 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 { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "frameworks_base_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["frameworks_base_license"], +} + +filegroup { + name: "FlickerTestsAppLaunchCommon-src", + srcs: ["src/**/common/*"], +} + +filegroup { + name: "FlickerTestsAppLaunch1-src", + srcs: ["src/**/OpenApp*"], +} + +java_library { + name: "FlickerTestsAppLaunchCommon", + defaults: ["FlickerTestsDefault"], + srcs: [":FlickerTestsAppLaunchCommon-src"], + static_libs: ["FlickerTestsBase"], +} + +android_test { + name: "FlickerTestsAppLaunch1", + defaults: ["FlickerTestsDefault"], + manifest: "AndroidManifest.xml", + test_config_template: "AndroidTestTemplate.xml", + srcs: [":FlickerTestsAppLaunch1-src"], + static_libs: [ + "FlickerTestsBase", + "FlickerTestsAppLaunchCommon", + ], +} + +android_test { + name: "FlickerTestsAppLaunch2", + defaults: ["FlickerTestsDefault"], + manifest: "AndroidManifest.xml", + test_config_template: "AndroidTestTemplate.xml", + srcs: ["src/**/*"], + exclude_srcs: [ + ":FlickerTestsAppLaunchCommon-src", + ":FlickerTestsAppLaunch1-src", + ], + static_libs: [ + "FlickerTestsBase", + "FlickerTestsAppLaunchCommon", + ], +} diff --git a/tests/FlickerTests/AppLaunch/AndroidManifest.xml b/tests/FlickerTests/AppLaunch/AndroidManifest.xml new file mode 100644 index 000000000000..b89af1a5260b --- /dev/null +++ b/tests/FlickerTests/AppLaunch/AndroidManifest.xml @@ -0,0 +1,67 @@ +<?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. + --> + +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools" + package="com.android.server.wm.flicker.launch"> + + <uses-sdk android:minSdkVersion="29" android:targetSdkVersion="29"/> + <!-- Read and write traces from external storage --> + <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> + <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> + <!-- Allow the test to write directly to /sdcard/ --> + <uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" /> + <!-- Write secure settings --> + <uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS" /> + <!-- Capture screen contents --> + <uses-permission android:name="android.permission.ACCESS_SURFACE_FLINGER" /> + <!-- Enable / Disable tracing !--> + <uses-permission android:name="android.permission.DUMP" /> + <!-- Force-stop test apps --> + <uses-permission android:name="android.permission.FORCE_STOP_PACKAGES"/> + <!-- Run layers trace --> + <uses-permission android:name="android.permission.HARDWARE_TEST"/> + <!-- Capture screen recording --> + <uses-permission android:name="android.permission.CAPTURE_VIDEO_OUTPUT"/> + <!-- Workaround grant runtime permission exception from b/152733071 --> + <uses-permission android:name="android.permission.PACKAGE_USAGE_STATS"/> + <uses-permission android:name="android.permission.READ_LOGS"/> + <!-- ATM.removeRootTasksWithActivityTypes() --> + <uses-permission android:name="android.permission.MANAGE_ACTIVITY_TASKS" /> + <!-- ActivityOptions.makeCustomTaskAnimation() --> + <uses-permission android:name="android.permission.START_TASKS_FROM_RECENTS" /> + <!-- Allow the test to connect to perfetto trace processor --> + <uses-permission android:name="android.permission.INTERNET"/> + <!-- Allow the test to write directly to /sdcard/ and connect to trace processor --> + <application android:requestLegacyExternalStorage="true" + android:networkSecurityConfig="@xml/network_security_config" + android:largeHeap="true"> + <uses-library android:name="android.test.runner"/> + <uses-library android:name="androidx.window.extensions" android:required="false"/> + + <!-- (b/197936012) Remove startup provider due to test timeout issue --> + <provider + android:name="androidx.startup.InitializationProvider" + android:authorities="${applicationId}.androidx-startup" + tools:node="remove" /> + </application> + + <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner" + android:targetPackage="com.android.server.wm.flicker.launch" + android:label="WindowManager Flicker Tests"> + </instrumentation> +</manifest> diff --git a/tests/FlickerTests/AppLaunch/AndroidTestTemplate.xml b/tests/FlickerTests/AppLaunch/AndroidTestTemplate.xml new file mode 100644 index 000000000000..583bcb74ffc2 --- /dev/null +++ b/tests/FlickerTests/AppLaunch/AndroidTestTemplate.xml @@ -0,0 +1,90 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Copyright 2018 Google Inc. All Rights Reserved. + --> +<configuration description="Runs WindowManager {MODULE}"> + <option name="test-tag" value="FlickerTests"/> + <!-- Needed for storing the perfetto trace files in the sdcard/test_results--> + <option name="isolated-storage" value="false"/> + + <target_preparer class="com.android.tradefed.targetprep.DeviceSetup"> + <!-- keeps the screen on during tests --> + <option name="screen-always-on" value="on"/> + <!-- prevents the phone from restarting --> + <option name="force-skip-system-props" value="true"/> + <!-- set WM tracing verbose level to all --> + <option name="run-command" value="cmd window tracing level all"/> + <!-- set WM tracing to frame (avoid incomplete states) --> + <option name="run-command" value="cmd window tracing frame"/> + <!-- ensure lock screen mode is swipe --> + <option name="run-command" value="locksettings set-disabled false"/> + <!-- disable betterbug as it's log collection dialogues cause flakes in e2e tests --> + <option name="run-command" value="pm disable com.google.android.internal.betterbug"/> + <!-- restart launcher to activate TAPL --> + <option name="run-command" + value="setprop ro.test_harness 1 ; am force-stop com.google.android.apps.nexuslauncher"/> + <!-- Increase trace size: 20mb for WM and 80mb for SF --> + <option name="run-command" value="cmd window tracing size 20480"/> + <option name="run-command" value="su root service call SurfaceFlinger 1029 i32 81920"/> + <!-- b/307664397 - Ensure camera has the correct permissions and doesn't show a dialog --> + <option name="run-command" + value="pm grant com.google.android.GoogleCamera android.permission.CAMERA"/> + <option name="run-command" + value="pm grant com.google.android.GoogleCamera android.permission.RECORD_AUDIO"/> + <option name="run-command" + value="pm grant com.google.android.GoogleCamera android.permission.ACCESS_FINE_LOCATION"/> + <option name="run-command" + value="pm grant com.google.android.GoogleCamera android.permission.ACCESS_COARSE_LOCATION"/> + </target_preparer> + <target_preparer class="com.android.tradefed.targetprep.RunCommandTargetPreparer"> + <option name="test-user-token" value="%TEST_USER%"/> + <option name="run-command" value="rm -rf /data/user/%TEST_USER%/files/*"/> + <option name="run-command" value="settings put secure show_ime_with_hard_keyboard 1"/> + <option name="run-command" value="settings put system show_touches 1"/> + <option name="run-command" value="settings put system pointer_location 1"/> + <option name="teardown-command" + value="settings delete secure show_ime_with_hard_keyboard"/> + <option name="teardown-command" value="settings delete system show_touches"/> + <option name="teardown-command" value="settings delete system pointer_location"/> + <option name="teardown-command" + value="cmd overlay enable com.android.internal.systemui.navbar.gestural"/> + </target_preparer> + <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller"> + <option name="cleanup-apks" value="true"/> + <option name="test-file-name" value="{MODULE}.apk"/> + <option name="test-file-name" value="FlickerTestApp.apk"/> + </target_preparer> + <!-- Needed for pushing the trace config file --> + <target_preparer class="com.android.tradefed.targetprep.RootTargetPreparer"/> + <target_preparer class="com.android.tradefed.targetprep.PushFilePreparer"> + <option name="push-file" + key="trace_config.textproto" + value="/data/misc/perfetto-traces/trace_config.textproto" + /> + <!--Install the content provider automatically when we push some file in sdcard folder.--> + <!--Needed to avoid the installation during the test suite.--> + <option name="push-file" key="trace_config.textproto" value="/sdcard/sample.textproto"/> + </target_preparer> + <test class="com.android.tradefed.testtype.AndroidJUnitTest"> + <option name="package" value="{PACKAGE}"/> + <option name="shell-timeout" value="6600s"/> + <option name="test-timeout" value="6600s"/> + <option name="hidden-api-checks" value="false"/> + <option name="device-listeners" value="android.device.collectors.PerfettoListener"/> + <!-- PerfettoListener related arguments --> + <option name="instrumentation-arg" key="perfetto_config_text_proto" value="true"/> + <option name="instrumentation-arg" + key="perfetto_config_file" + value="trace_config.textproto" + /> + <option name="instrumentation-arg" key="per_run" value="true"/> + </test> + <!-- Needed for pulling the collected trace config on to the host --> + <metrics_collector class="com.android.tradefed.device.metric.FilePullerLogCollector"> + <option name="pull-pattern-keys" value="perfetto_file_path"/> + <option name="directory-keys" + value="/data/user/0/com.android.server.wm.flicker.launch/files"/> + <option name="collect-on-run-ended-only" value="true"/> + <option name="clean-up" value="true"/> + </metrics_collector> +</configuration> diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OWNERS b/tests/FlickerTests/AppLaunch/OWNERS index 2c414a27cacb..2c414a27cacb 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OWNERS +++ b/tests/FlickerTests/AppLaunch/OWNERS diff --git a/tests/FlickerTests/AppLaunch/res/anim/show_hide_show_3000ms.xml b/tests/FlickerTests/AppLaunch/res/anim/show_hide_show_3000ms.xml new file mode 100644 index 000000000000..7b3f07e3a2f5 --- /dev/null +++ b/tests/FlickerTests/AppLaunch/res/anim/show_hide_show_3000ms.xml @@ -0,0 +1,31 @@ +<!-- + ~ Copyright (C) 2022 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. + --> + +<set + xmlns:android="http://schemas.android.com/apk/res/android" + android:fillAfter="true"> + + <alpha + android:fromAlpha="1.0" + android:toAlpha="0.0" + android:duration="1000" /> + + <alpha + android:startOffset="2000" + android:fromAlpha="1.0" + android:toAlpha="1.0" + android:duration="1000" /> +</set>
\ No newline at end of file diff --git a/tests/FlickerTests/manifests/AndroidManifestAppClose.xml b/tests/FlickerTests/AppLaunch/res/xml/network_security_config.xml index 4cdcb903b498..4bd9ca049f55 100644 --- a/tests/FlickerTests/manifests/AndroidManifestAppClose.xml +++ b/tests/FlickerTests/AppLaunch/res/xml/network_security_config.xml @@ -1,3 +1,4 @@ +<?xml version="1.0" encoding="utf-8"?> <!-- ~ Copyright (C) 2023 The Android Open Source Project ~ @@ -14,11 +15,8 @@ ~ limitations under the License. --> -<manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.android.server.wm.flicker.close"> - - <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner" - android:targetPackage="com.android.server.wm.flicker.close" - android:label="WindowManager Flicker Tests"> - </instrumentation> -</manifest> +<network-security-config> + <domain-config cleartextTrafficPermitted="true"> + <domain includeSubdomains="true">localhost</domain> + </domain-config> +</network-security-config> diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/launch/ActivityTransitionTest.kt b/tests/FlickerTests/AppLaunch/src/com/android/server/wm/flicker/launch/ActivityTransitionTest.kt index 89ab41e49270..89ab41e49270 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/launch/ActivityTransitionTest.kt +++ b/tests/FlickerTests/AppLaunch/src/com/android/server/wm/flicker/launch/ActivityTransitionTest.kt diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppFromIconColdTest.kt b/tests/FlickerTests/AppLaunch/src/com/android/server/wm/flicker/launch/OpenAppFromIconColdTest.kt index f788efae4c59..413767ce7618 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppFromIconColdTest.kt +++ b/tests/FlickerTests/AppLaunch/src/com/android/server/wm/flicker/launch/OpenAppFromIconColdTest.kt @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 The Android Open Source Project + * 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. diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppFromIntentColdAfterCameraTest.kt b/tests/FlickerTests/AppLaunch/src/com/android/server/wm/flicker/launch/OpenAppFromIntentColdAfterCameraTest.kt index d86dc50b3a5c..4168bdc705f1 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppFromIntentColdAfterCameraTest.kt +++ b/tests/FlickerTests/AppLaunch/src/com/android/server/wm/flicker/launch/OpenAppFromIntentColdAfterCameraTest.kt @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 The Android Open Source Project + * 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. diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppFromIntentColdTest.kt b/tests/FlickerTests/AppLaunch/src/com/android/server/wm/flicker/launch/OpenAppFromIntentColdTest.kt index be07053f3039..9c55c98a8f4f 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppFromIntentColdTest.kt +++ b/tests/FlickerTests/AppLaunch/src/com/android/server/wm/flicker/launch/OpenAppFromIntentColdTest.kt @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020 The Android Open Source Project + * 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. diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppFromIntentWarmTest.kt b/tests/FlickerTests/AppLaunch/src/com/android/server/wm/flicker/launch/OpenAppFromIntentWarmTest.kt index f66eff9b4cb0..fc6cdb1ee01e 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppFromIntentWarmTest.kt +++ b/tests/FlickerTests/AppLaunch/src/com/android/server/wm/flicker/launch/OpenAppFromIntentWarmTest.kt @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020 The Android Open Source Project + * 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. diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppFromLockscreenViaIntentTest.kt b/tests/FlickerTests/AppLaunch/src/com/android/server/wm/flicker/launch/OpenAppFromLockscreenViaIntentTest.kt index 65214764f0ac..de666dd42877 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppFromLockscreenViaIntentTest.kt +++ b/tests/FlickerTests/AppLaunch/src/com/android/server/wm/flicker/launch/OpenAppFromLockscreenViaIntentTest.kt @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 The Android Open Source Project + * 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. diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppFromOverviewTest.kt b/tests/FlickerTests/AppLaunch/src/com/android/server/wm/flicker/launch/OpenAppFromOverviewTest.kt index 4d31c28b1231..f8a9961d1d28 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppFromOverviewTest.kt +++ b/tests/FlickerTests/AppLaunch/src/com/android/server/wm/flicker/launch/OpenAppFromOverviewTest.kt @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020 The Android Open Source Project + * 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. diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenCameraFromHomeOnDoubleClickPowerButtonTest.kt b/tests/FlickerTests/AppLaunch/src/com/android/server/wm/flicker/launch/OpenCameraFromHomeOnDoubleClickPowerButtonTest.kt index 42e34b313d8e..0aceb354dec6 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenCameraFromHomeOnDoubleClickPowerButtonTest.kt +++ b/tests/FlickerTests/AppLaunch/src/com/android/server/wm/flicker/launch/OpenCameraFromHomeOnDoubleClickPowerButtonTest.kt @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 The Android Open Source Project + * 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. diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/launch/common/OpenTransferSplashscreenAppFromLauncherTransition.kt b/tests/FlickerTests/AppLaunch/src/com/android/server/wm/flicker/launch/OpenTransferSplashscreenAppFromLauncherTransition.kt index 97ba99e0f7ec..f41a2a297ad9 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/launch/common/OpenTransferSplashscreenAppFromLauncherTransition.kt +++ b/tests/FlickerTests/AppLaunch/src/com/android/server/wm/flicker/launch/OpenTransferSplashscreenAppFromLauncherTransition.kt @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.android.server.wm.flicker.launch.common +package com.android.server.wm.flicker.launch import android.platform.test.annotations.Presubmit import android.tools.common.traces.component.ComponentNameMatcher @@ -24,6 +24,7 @@ import android.tools.device.flicker.legacy.LegacyFlickerTestFactory import androidx.test.filters.FlakyTest import androidx.test.filters.RequiresDevice import com.android.server.wm.flicker.helpers.TransferSplashscreenAppHelper +import com.android.server.wm.flicker.launch.common.OpenAppFromIconTransition import org.junit.FixMethodOrder import org.junit.Test import org.junit.runner.RunWith diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OverrideTaskTransitionTest.kt b/tests/FlickerTests/AppLaunch/src/com/android/server/wm/flicker/launch/OverrideTaskTransitionTest.kt index 98e3646f4083..93ca41c4181c 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OverrideTaskTransitionTest.kt +++ b/tests/FlickerTests/AppLaunch/src/com/android/server/wm/flicker/launch/OverrideTaskTransitionTest.kt @@ -31,7 +31,6 @@ import android.tools.device.flicker.rules.RemoveAllTasksButHomeRule import android.tools.device.helpers.wakeUpAndGoToHomeScreen import androidx.test.filters.RequiresDevice import androidx.test.platform.app.InstrumentationRegistry -import com.android.server.wm.flicker.R import com.android.server.wm.flicker.helpers.SimpleAppHelper import com.android.server.wm.flicker.helpers.setRotation import org.junit.FixMethodOrder diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/launch/TaskTransitionTest.kt b/tests/FlickerTests/AppLaunch/src/com/android/server/wm/flicker/launch/TaskTransitionTest.kt index b82a12901681..9c2899ac6087 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/launch/TaskTransitionTest.kt +++ b/tests/FlickerTests/AppLaunch/src/com/android/server/wm/flicker/launch/TaskTransitionTest.kt @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 The Android Open Source Project + * 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. diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/launch/common/OpenAppFromIconTransition.kt b/tests/FlickerTests/AppLaunch/src/com/android/server/wm/flicker/launch/common/OpenAppFromIconTransition.kt index c8547015b92b..802c755116af 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/launch/common/OpenAppFromIconTransition.kt +++ b/tests/FlickerTests/AppLaunch/src/com/android/server/wm/flicker/launch/common/OpenAppFromIconTransition.kt @@ -44,4 +44,4 @@ abstract class OpenAppFromIconTransition(flicker: LegacyFlickerTest) : } teardown { testApp.exit(wmHelper) } } -}
\ No newline at end of file +} diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/launch/common/OpenAppFromLauncherTransition.kt b/tests/FlickerTests/AppLaunch/src/com/android/server/wm/flicker/launch/common/OpenAppFromLauncherTransition.kt index 9d7096ea0e73..9d7096ea0e73 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/launch/common/OpenAppFromLauncherTransition.kt +++ b/tests/FlickerTests/AppLaunch/src/com/android/server/wm/flicker/launch/common/OpenAppFromLauncherTransition.kt diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/launch/common/OpenAppFromLockscreenTransition.kt b/tests/FlickerTests/AppLaunch/src/com/android/server/wm/flicker/launch/common/OpenAppFromLockscreenTransition.kt index 7b088431b0bb..7b088431b0bb 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/launch/common/OpenAppFromLockscreenTransition.kt +++ b/tests/FlickerTests/AppLaunch/src/com/android/server/wm/flicker/launch/common/OpenAppFromLockscreenTransition.kt diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/launch/common/OpenAppTransition.kt b/tests/FlickerTests/AppLaunch/src/com/android/server/wm/flicker/launch/common/OpenAppTransition.kt index 989619e08d98..989619e08d98 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/launch/common/OpenAppTransition.kt +++ b/tests/FlickerTests/AppLaunch/src/com/android/server/wm/flicker/launch/common/OpenAppTransition.kt diff --git a/tests/FlickerTests/AppLaunch/trace_config/trace_config.textproto b/tests/FlickerTests/AppLaunch/trace_config/trace_config.textproto new file mode 100644 index 000000000000..c9a35aca9085 --- /dev/null +++ b/tests/FlickerTests/AppLaunch/trace_config/trace_config.textproto @@ -0,0 +1,77 @@ +# 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. + +# proto-message: TraceConfig + +# Enable periodic flushing of the trace buffer into the output file. +write_into_file: true + +# Writes the userspace buffer into the file every 1s. +file_write_period_ms: 2500 + +# See b/126487238 - we need to guarantee ordering of events. +flush_period_ms: 30000 + +# The trace buffers needs to be big enough to hold |file_write_period_ms| of +# trace data. The trace buffer sizing depends on the number of trace categories +# enabled and the device activity. + +# RSS events +buffers: { + size_kb: 63488 + fill_policy: RING_BUFFER +} + +data_sources { + config { + name: "linux.process_stats" + target_buffer: 0 + # polled per-process memory counters and process/thread names. + # If you don't want the polled counters, remove the "process_stats_config" + # section, but keep the data source itself as it still provides on-demand + # thread/process naming for ftrace data below. + process_stats_config { + scan_all_processes_on_start: true + } + } +} + +data_sources: { + config { + name: "linux.ftrace" + ftrace_config { + ftrace_events: "ftrace/print" + ftrace_events: "task/task_newtask" + ftrace_events: "task/task_rename" + atrace_categories: "ss" + atrace_categories: "wm" + atrace_categories: "am" + atrace_categories: "aidl" + atrace_categories: "input" + atrace_categories: "binder_driver" + atrace_categories: "sched_process_exit" + atrace_apps: "com.android.server.wm.flicker" + atrace_apps: "com.android.server.wm.flicker.other" + atrace_apps: "com.android.server.wm.flicker.close" + atrace_apps: "com.android.server.wm.flicker.ime" + atrace_apps: "com.android.server.wm.flicker.launch" + atrace_apps: "com.android.server.wm.flicker.quickswitch" + atrace_apps: "com.android.server.wm.flicker.rotation" + atrace_apps: "com.android.server.wm.flicker.testapp" + atrace_apps: "com.android.systemui" + atrace_apps: "com.google.android.apps.nexuslauncher" + } + } +} + diff --git a/tests/FlickerTests/FlickerService/Android.bp b/tests/FlickerTests/FlickerService/Android.bp new file mode 100644 index 000000000000..1a381150dfb0 --- /dev/null +++ b/tests/FlickerTests/FlickerService/Android.bp @@ -0,0 +1,33 @@ +// +// Copyright (C) 2018 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 { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "frameworks_base_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["frameworks_base_license"], +} + +android_test { + name: "FlickerServiceTests", + defaults: ["FlickerTestsDefault"], + manifest: "AndroidManifest.xml", + test_config_template: "AndroidTestTemplate.xml", + srcs: ["src/**/*"], + static_libs: ["FlickerTestsBase"], +} diff --git a/tests/FlickerTests/FlickerService/AndroidManifest.xml b/tests/FlickerTests/FlickerService/AndroidManifest.xml new file mode 100644 index 000000000000..f31e8206a28d --- /dev/null +++ b/tests/FlickerTests/FlickerService/AndroidManifest.xml @@ -0,0 +1,67 @@ +<?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. + --> + +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools" + package="com.android.server.wm.flicker.service"> + + <uses-sdk android:minSdkVersion="29" android:targetSdkVersion="29"/> + <!-- Read and write traces from external storage --> + <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> + <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> + <!-- Allow the test to write directly to /sdcard/ --> + <uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" /> + <!-- Write secure settings --> + <uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS" /> + <!-- Capture screen contents --> + <uses-permission android:name="android.permission.ACCESS_SURFACE_FLINGER" /> + <!-- Enable / Disable tracing !--> + <uses-permission android:name="android.permission.DUMP" /> + <!-- Force-stop test apps --> + <uses-permission android:name="android.permission.FORCE_STOP_PACKAGES"/> + <!-- Run layers trace --> + <uses-permission android:name="android.permission.HARDWARE_TEST"/> + <!-- Capture screen recording --> + <uses-permission android:name="android.permission.CAPTURE_VIDEO_OUTPUT"/> + <!-- Workaround grant runtime permission exception from b/152733071 --> + <uses-permission android:name="android.permission.PACKAGE_USAGE_STATS"/> + <uses-permission android:name="android.permission.READ_LOGS"/> + <!-- ATM.removeRootTasksWithActivityTypes() --> + <uses-permission android:name="android.permission.MANAGE_ACTIVITY_TASKS" /> + <!-- ActivityOptions.makeCustomTaskAnimation() --> + <uses-permission android:name="android.permission.START_TASKS_FROM_RECENTS" /> + <!-- Allow the test to connect to perfetto trace processor --> + <uses-permission android:name="android.permission.INTERNET"/> + <!-- Allow the test to write directly to /sdcard/ and connect to trace processor --> + <application android:requestLegacyExternalStorage="true" + android:networkSecurityConfig="@xml/network_security_config" + android:largeHeap="true"> + <uses-library android:name="android.test.runner"/> + <uses-library android:name="androidx.window.extensions" android:required="false"/> + + <!-- (b/197936012) Remove startup provider due to test timeout issue --> + <provider + android:name="androidx.startup.InitializationProvider" + android:authorities="${applicationId}.androidx-startup" + tools:node="remove" /> + </application> + + <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner" + android:targetPackage="com.android.server.wm.flicker.service" + android:label="WindowManager Flicker Tests"> + </instrumentation> +</manifest> diff --git a/tests/FlickerTests/FlickerService/AndroidTestTemplate.xml b/tests/FlickerTests/FlickerService/AndroidTestTemplate.xml new file mode 100644 index 000000000000..d6ae2b3a5d94 --- /dev/null +++ b/tests/FlickerTests/FlickerService/AndroidTestTemplate.xml @@ -0,0 +1,90 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Copyright 2018 Google Inc. All Rights Reserved. + --> +<configuration description="Runs WindowManager {MODULE}"> + <option name="test-tag" value="FlickerTests"/> + <!-- Needed for storing the perfetto trace files in the sdcard/test_results--> + <option name="isolated-storage" value="false"/> + + <target_preparer class="com.android.tradefed.targetprep.DeviceSetup"> + <!-- keeps the screen on during tests --> + <option name="screen-always-on" value="on"/> + <!-- prevents the phone from restarting --> + <option name="force-skip-system-props" value="true"/> + <!-- set WM tracing verbose level to all --> + <option name="run-command" value="cmd window tracing level all"/> + <!-- set WM tracing to frame (avoid incomplete states) --> + <option name="run-command" value="cmd window tracing frame"/> + <!-- ensure lock screen mode is swipe --> + <option name="run-command" value="locksettings set-disabled false"/> + <!-- disable betterbug as it's log collection dialogues cause flakes in e2e tests --> + <option name="run-command" value="pm disable com.google.android.internal.betterbug"/> + <!-- restart launcher to activate TAPL --> + <option name="run-command" + value="setprop ro.test_harness 1 ; am force-stop com.google.android.apps.nexuslauncher"/> + <!-- Increase trace size: 20mb for WM and 80mb for SF --> + <option name="run-command" value="cmd window tracing size 20480"/> + <option name="run-command" value="su root service call SurfaceFlinger 1029 i32 81920"/> + <!-- b/307664397 - Ensure camera has the correct permissions and doesn't show a dialog --> + <option name="run-command" + value="pm grant com.google.android.GoogleCamera android.permission.CAMERA"/> + <option name="run-command" + value="pm grant com.google.android.GoogleCamera android.permission.RECORD_AUDIO"/> + <option name="run-command" + value="pm grant com.google.android.GoogleCamera android.permission.ACCESS_FINE_LOCATION"/> + <option name="run-command" + value="pm grant com.google.android.GoogleCamera android.permission.ACCESS_COARSE_LOCATION"/> + </target_preparer> + <target_preparer class="com.android.tradefed.targetprep.RunCommandTargetPreparer"> + <option name="test-user-token" value="%TEST_USER%"/> + <option name="run-command" value="rm -rf /data/user/%TEST_USER%/files/*"/> + <option name="run-command" value="settings put secure show_ime_with_hard_keyboard 1"/> + <option name="run-command" value="settings put system show_touches 1"/> + <option name="run-command" value="settings put system pointer_location 1"/> + <option name="teardown-command" + value="settings delete secure show_ime_with_hard_keyboard"/> + <option name="teardown-command" value="settings delete system show_touches"/> + <option name="teardown-command" value="settings delete system pointer_location"/> + <option name="teardown-command" + value="cmd overlay enable com.android.internal.systemui.navbar.gestural"/> + </target_preparer> + <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller"> + <option name="cleanup-apks" value="true"/> + <option name="test-file-name" value="{MODULE}.apk"/> + <option name="test-file-name" value="FlickerTestApp.apk"/> + </target_preparer> + <!-- Needed for pushing the trace config file --> + <target_preparer class="com.android.tradefed.targetprep.RootTargetPreparer"/> + <target_preparer class="com.android.tradefed.targetprep.PushFilePreparer"> + <option name="push-file" + key="trace_config.textproto" + value="/data/misc/perfetto-traces/trace_config.textproto" + /> + <!--Install the content provider automatically when we push some file in sdcard folder.--> + <!--Needed to avoid the installation during the test suite.--> + <option name="push-file" key="trace_config.textproto" value="/sdcard/sample.textproto"/> + </target_preparer> + <test class="com.android.tradefed.testtype.AndroidJUnitTest"> + <option name="package" value="{PACKAGE}"/> + <option name="shell-timeout" value="6600s"/> + <option name="test-timeout" value="6600s"/> + <option name="hidden-api-checks" value="false"/> + <option name="device-listeners" value="android.device.collectors.PerfettoListener"/> + <!-- PerfettoListener related arguments --> + <option name="instrumentation-arg" key="perfetto_config_text_proto" value="true"/> + <option name="instrumentation-arg" + key="perfetto_config_file" + value="trace_config.textproto" + /> + <option name="instrumentation-arg" key="per_run" value="true"/> + </test> + <!-- Needed for pulling the collected trace config on to the host --> + <metrics_collector class="com.android.tradefed.device.metric.FilePullerLogCollector"> + <option name="pull-pattern-keys" value="perfetto_file_path"/> + <option name="directory-keys" + value="/data/user/0/com.android.server.wm.flicker.service/files"/> + <option name="collect-on-run-ended-only" value="true"/> + <option name="clean-up" value="true"/> + </metrics_collector> +</configuration> diff --git a/tests/FlickerTests/FlickerService/res/anim/show_hide_show_3000ms.xml b/tests/FlickerTests/FlickerService/res/anim/show_hide_show_3000ms.xml new file mode 100644 index 000000000000..7b3f07e3a2f5 --- /dev/null +++ b/tests/FlickerTests/FlickerService/res/anim/show_hide_show_3000ms.xml @@ -0,0 +1,31 @@ +<!-- + ~ Copyright (C) 2022 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. + --> + +<set + xmlns:android="http://schemas.android.com/apk/res/android" + android:fillAfter="true"> + + <alpha + android:fromAlpha="1.0" + android:toAlpha="0.0" + android:duration="1000" /> + + <alpha + android:startOffset="2000" + android:fromAlpha="1.0" + android:toAlpha="1.0" + android:duration="1000" /> +</set>
\ No newline at end of file diff --git a/tests/FlickerTests/manifests/AndroidManifestAppLaunch.xml b/tests/FlickerTests/FlickerService/res/xml/network_security_config.xml index 659a745ba480..4bd9ca049f55 100644 --- a/tests/FlickerTests/manifests/AndroidManifestAppLaunch.xml +++ b/tests/FlickerTests/FlickerService/res/xml/network_security_config.xml @@ -1,3 +1,4 @@ +<?xml version="1.0" encoding="utf-8"?> <!-- ~ Copyright (C) 2023 The Android Open Source Project ~ @@ -14,11 +15,8 @@ ~ limitations under the License. --> -<manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.android.server.wm.flicker.launch"> - - <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner" - android:targetPackage="com.android.server.wm.flicker.launch" - android:label="WindowManager Flicker Tests"> - </instrumentation> -</manifest> +<network-security-config> + <domain-config cleartextTrafficPermitted="true"> + <domain includeSubdomains="true">localhost</domain> + </domain-config> +</network-security-config> diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/service/Utils.kt b/tests/FlickerTests/FlickerService/src/com/android/server/wm/flicker/service/Utils.kt index 8242e9a31992..8242e9a31992 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/service/Utils.kt +++ b/tests/FlickerTests/FlickerService/src/com/android/server/wm/flicker/service/Utils.kt diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/service/close/flicker/CloseAppBackButton3ButtonLandscape.kt b/tests/FlickerTests/FlickerService/src/com/android/server/wm/flicker/service/close/flicker/CloseAppBackButton3ButtonLandscape.kt index b3c9c96c614c..b3c9c96c614c 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/service/close/flicker/CloseAppBackButton3ButtonLandscape.kt +++ b/tests/FlickerTests/FlickerService/src/com/android/server/wm/flicker/service/close/flicker/CloseAppBackButton3ButtonLandscape.kt diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/service/close/flicker/CloseAppBackButton3ButtonPortrait.kt b/tests/FlickerTests/FlickerService/src/com/android/server/wm/flicker/service/close/flicker/CloseAppBackButton3ButtonPortrait.kt index 29c11a4257f6..29c11a4257f6 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/service/close/flicker/CloseAppBackButton3ButtonPortrait.kt +++ b/tests/FlickerTests/FlickerService/src/com/android/server/wm/flicker/service/close/flicker/CloseAppBackButton3ButtonPortrait.kt diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/service/close/flicker/CloseAppBackButtonGesturalNavLandscape.kt b/tests/FlickerTests/FlickerService/src/com/android/server/wm/flicker/service/close/flicker/CloseAppBackButtonGesturalNavLandscape.kt index 1bb4a253ff41..1bb4a253ff41 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/service/close/flicker/CloseAppBackButtonGesturalNavLandscape.kt +++ b/tests/FlickerTests/FlickerService/src/com/android/server/wm/flicker/service/close/flicker/CloseAppBackButtonGesturalNavLandscape.kt diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/service/close/flicker/CloseAppBackButtonGesturalNavPortrait.kt b/tests/FlickerTests/FlickerService/src/com/android/server/wm/flicker/service/close/flicker/CloseAppBackButtonGesturalNavPortrait.kt index 17cb6e194ec3..17cb6e194ec3 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/service/close/flicker/CloseAppBackButtonGesturalNavPortrait.kt +++ b/tests/FlickerTests/FlickerService/src/com/android/server/wm/flicker/service/close/flicker/CloseAppBackButtonGesturalNavPortrait.kt diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/service/close/flicker/CloseAppHomeButton3ButtonLandscape.kt b/tests/FlickerTests/FlickerService/src/com/android/server/wm/flicker/service/close/flicker/CloseAppHomeButton3ButtonLandscape.kt index 47c25294f66e..47c25294f66e 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/service/close/flicker/CloseAppHomeButton3ButtonLandscape.kt +++ b/tests/FlickerTests/FlickerService/src/com/android/server/wm/flicker/service/close/flicker/CloseAppHomeButton3ButtonLandscape.kt diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/service/close/flicker/CloseAppHomeButton3ButtonPortrait.kt b/tests/FlickerTests/FlickerService/src/com/android/server/wm/flicker/service/close/flicker/CloseAppHomeButton3ButtonPortrait.kt index b18148f97759..b18148f97759 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/service/close/flicker/CloseAppHomeButton3ButtonPortrait.kt +++ b/tests/FlickerTests/FlickerService/src/com/android/server/wm/flicker/service/close/flicker/CloseAppHomeButton3ButtonPortrait.kt diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/service/close/flicker/CloseAppSwipeToHomeGesturalNavLandscape.kt b/tests/FlickerTests/FlickerService/src/com/android/server/wm/flicker/service/close/flicker/CloseAppSwipeToHomeGesturalNavLandscape.kt index 85430154e202..85430154e202 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/service/close/flicker/CloseAppSwipeToHomeGesturalNavLandscape.kt +++ b/tests/FlickerTests/FlickerService/src/com/android/server/wm/flicker/service/close/flicker/CloseAppSwipeToHomeGesturalNavLandscape.kt diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/service/close/flicker/CloseAppSwipeToHomeGesturalNavPortrait.kt b/tests/FlickerTests/FlickerService/src/com/android/server/wm/flicker/service/close/flicker/CloseAppSwipeToHomeGesturalNavPortrait.kt index f88963b7a341..f88963b7a341 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/service/close/flicker/CloseAppSwipeToHomeGesturalNavPortrait.kt +++ b/tests/FlickerTests/FlickerService/src/com/android/server/wm/flicker/service/close/flicker/CloseAppSwipeToHomeGesturalNavPortrait.kt diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/service/close/scenarios/CloseAppBackButton.kt b/tests/FlickerTests/FlickerService/src/com/android/server/wm/flicker/service/close/scenarios/CloseAppBackButton.kt index 2aaacde52547..2aaacde52547 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/service/close/scenarios/CloseAppBackButton.kt +++ b/tests/FlickerTests/FlickerService/src/com/android/server/wm/flicker/service/close/scenarios/CloseAppBackButton.kt diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/service/close/scenarios/CloseAppHomeButton.kt b/tests/FlickerTests/FlickerService/src/com/android/server/wm/flicker/service/close/scenarios/CloseAppHomeButton.kt index 08683a3ab43d..08683a3ab43d 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/service/close/scenarios/CloseAppHomeButton.kt +++ b/tests/FlickerTests/FlickerService/src/com/android/server/wm/flicker/service/close/scenarios/CloseAppHomeButton.kt diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/service/close/scenarios/CloseAppSwipeToHome.kt b/tests/FlickerTests/FlickerService/src/com/android/server/wm/flicker/service/close/scenarios/CloseAppSwipeToHome.kt index 360e11408c92..360e11408c92 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/service/close/scenarios/CloseAppSwipeToHome.kt +++ b/tests/FlickerTests/FlickerService/src/com/android/server/wm/flicker/service/close/scenarios/CloseAppSwipeToHome.kt diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/service/notification/flicker/OpenAppFromLockscreenNotificationCold3ButtonNavLandscape.kt b/tests/FlickerTests/FlickerService/src/com/android/server/wm/flicker/service/notification/flicker/OpenAppFromLockscreenNotificationCold3ButtonNavLandscape.kt index bb18770a8e7c..bb18770a8e7c 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/service/notification/flicker/OpenAppFromLockscreenNotificationCold3ButtonNavLandscape.kt +++ b/tests/FlickerTests/FlickerService/src/com/android/server/wm/flicker/service/notification/flicker/OpenAppFromLockscreenNotificationCold3ButtonNavLandscape.kt diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/service/notification/flicker/OpenAppFromLockscreenNotificationCold3ButtonNavPortrait.kt b/tests/FlickerTests/FlickerService/src/com/android/server/wm/flicker/service/notification/flicker/OpenAppFromLockscreenNotificationCold3ButtonNavPortrait.kt index 1c3cc2188c7c..1c3cc2188c7c 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/service/notification/flicker/OpenAppFromLockscreenNotificationCold3ButtonNavPortrait.kt +++ b/tests/FlickerTests/FlickerService/src/com/android/server/wm/flicker/service/notification/flicker/OpenAppFromLockscreenNotificationCold3ButtonNavPortrait.kt diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/service/notification/flicker/OpenAppFromLockscreenNotificationColdGesturalNavLandscape.kt b/tests/FlickerTests/FlickerService/src/com/android/server/wm/flicker/service/notification/flicker/OpenAppFromLockscreenNotificationColdGesturalNavLandscape.kt index 46d36dbd6b09..46d36dbd6b09 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/service/notification/flicker/OpenAppFromLockscreenNotificationColdGesturalNavLandscape.kt +++ b/tests/FlickerTests/FlickerService/src/com/android/server/wm/flicker/service/notification/flicker/OpenAppFromLockscreenNotificationColdGesturalNavLandscape.kt diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/service/notification/flicker/OpenAppFromLockscreenNotificationColdGesturalNavPortrait.kt b/tests/FlickerTests/FlickerService/src/com/android/server/wm/flicker/service/notification/flicker/OpenAppFromLockscreenNotificationColdGesturalNavPortrait.kt index f6a668feeed6..f6a668feeed6 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/service/notification/flicker/OpenAppFromLockscreenNotificationColdGesturalNavPortrait.kt +++ b/tests/FlickerTests/FlickerService/src/com/android/server/wm/flicker/service/notification/flicker/OpenAppFromLockscreenNotificationColdGesturalNavPortrait.kt diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/service/notification/flicker/OpenAppFromLockscreenNotificationWarm3ButtonNavLandscape.kt b/tests/FlickerTests/FlickerService/src/com/android/server/wm/flicker/service/notification/flicker/OpenAppFromLockscreenNotificationWarm3ButtonNavLandscape.kt index 93200ba1b6fe..93200ba1b6fe 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/service/notification/flicker/OpenAppFromLockscreenNotificationWarm3ButtonNavLandscape.kt +++ b/tests/FlickerTests/FlickerService/src/com/android/server/wm/flicker/service/notification/flicker/OpenAppFromLockscreenNotificationWarm3ButtonNavLandscape.kt diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/service/notification/flicker/OpenAppFromLockscreenNotificationWarm3ButtonNavPortrait.kt b/tests/FlickerTests/FlickerService/src/com/android/server/wm/flicker/service/notification/flicker/OpenAppFromLockscreenNotificationWarm3ButtonNavPortrait.kt index f5d41d250b1e..f5d41d250b1e 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/service/notification/flicker/OpenAppFromLockscreenNotificationWarm3ButtonNavPortrait.kt +++ b/tests/FlickerTests/FlickerService/src/com/android/server/wm/flicker/service/notification/flicker/OpenAppFromLockscreenNotificationWarm3ButtonNavPortrait.kt diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/service/notification/flicker/OpenAppFromLockscreenNotificationWarmGesturalNavLandscape.kt b/tests/FlickerTests/FlickerService/src/com/android/server/wm/flicker/service/notification/flicker/OpenAppFromLockscreenNotificationWarmGesturalNavLandscape.kt index 28f322bee130..28f322bee130 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/service/notification/flicker/OpenAppFromLockscreenNotificationWarmGesturalNavLandscape.kt +++ b/tests/FlickerTests/FlickerService/src/com/android/server/wm/flicker/service/notification/flicker/OpenAppFromLockscreenNotificationWarmGesturalNavLandscape.kt diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/service/notification/flicker/OpenAppFromLockscreenNotificationWarmGesturalNavPortrait.kt b/tests/FlickerTests/FlickerService/src/com/android/server/wm/flicker/service/notification/flicker/OpenAppFromLockscreenNotificationWarmGesturalNavPortrait.kt index beb3fae8be48..beb3fae8be48 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/service/notification/flicker/OpenAppFromLockscreenNotificationWarmGesturalNavPortrait.kt +++ b/tests/FlickerTests/FlickerService/src/com/android/server/wm/flicker/service/notification/flicker/OpenAppFromLockscreenNotificationWarmGesturalNavPortrait.kt diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/service/notification/flicker/OpenAppFromLockscreenNotificationWithOverlayApp3ButtonNavLandscape.kt b/tests/FlickerTests/FlickerService/src/com/android/server/wm/flicker/service/notification/flicker/OpenAppFromLockscreenNotificationWithOverlayApp3ButtonNavLandscape.kt index 4adcc8bf5f0b..4adcc8bf5f0b 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/service/notification/flicker/OpenAppFromLockscreenNotificationWithOverlayApp3ButtonNavLandscape.kt +++ b/tests/FlickerTests/FlickerService/src/com/android/server/wm/flicker/service/notification/flicker/OpenAppFromLockscreenNotificationWithOverlayApp3ButtonNavLandscape.kt diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/service/notification/flicker/OpenAppFromLockscreenNotificationWithOverlayApp3ButtonNavPortrait.kt b/tests/FlickerTests/FlickerService/src/com/android/server/wm/flicker/service/notification/flicker/OpenAppFromLockscreenNotificationWithOverlayApp3ButtonNavPortrait.kt index f7211e7287cf..f7211e7287cf 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/service/notification/flicker/OpenAppFromLockscreenNotificationWithOverlayApp3ButtonNavPortrait.kt +++ b/tests/FlickerTests/FlickerService/src/com/android/server/wm/flicker/service/notification/flicker/OpenAppFromLockscreenNotificationWithOverlayApp3ButtonNavPortrait.kt diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/service/notification/flicker/OpenAppFromLockscreenNotificationWithOverlayAppGesturalNavLandscape.kt b/tests/FlickerTests/FlickerService/src/com/android/server/wm/flicker/service/notification/flicker/OpenAppFromLockscreenNotificationWithOverlayAppGesturalNavLandscape.kt index 1ade9560d90f..1ade9560d90f 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/service/notification/flicker/OpenAppFromLockscreenNotificationWithOverlayAppGesturalNavLandscape.kt +++ b/tests/FlickerTests/FlickerService/src/com/android/server/wm/flicker/service/notification/flicker/OpenAppFromLockscreenNotificationWithOverlayAppGesturalNavLandscape.kt diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/service/notification/flicker/OpenAppFromLockscreenNotificationWithOverlayAppGesturalNavPortrait.kt b/tests/FlickerTests/FlickerService/src/com/android/server/wm/flicker/service/notification/flicker/OpenAppFromLockscreenNotificationWithOverlayAppGesturalNavPortrait.kt index ea26f0867c7f..ea26f0867c7f 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/service/notification/flicker/OpenAppFromLockscreenNotificationWithOverlayAppGesturalNavPortrait.kt +++ b/tests/FlickerTests/FlickerService/src/com/android/server/wm/flicker/service/notification/flicker/OpenAppFromLockscreenNotificationWithOverlayAppGesturalNavPortrait.kt diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/service/notification/flicker/OpenAppFromNotificationCold3ButtonNavLandscape.kt b/tests/FlickerTests/FlickerService/src/com/android/server/wm/flicker/service/notification/flicker/OpenAppFromNotificationCold3ButtonNavLandscape.kt index 866190f78827..866190f78827 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/service/notification/flicker/OpenAppFromNotificationCold3ButtonNavLandscape.kt +++ b/tests/FlickerTests/FlickerService/src/com/android/server/wm/flicker/service/notification/flicker/OpenAppFromNotificationCold3ButtonNavLandscape.kt diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/service/notification/flicker/OpenAppFromNotificationCold3ButtonNavPortrait.kt b/tests/FlickerTests/FlickerService/src/com/android/server/wm/flicker/service/notification/flicker/OpenAppFromNotificationCold3ButtonNavPortrait.kt index a8d628328ed9..a8d628328ed9 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/service/notification/flicker/OpenAppFromNotificationCold3ButtonNavPortrait.kt +++ b/tests/FlickerTests/FlickerService/src/com/android/server/wm/flicker/service/notification/flicker/OpenAppFromNotificationCold3ButtonNavPortrait.kt diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/service/notification/flicker/OpenAppFromNotificationColdGesturalNavLandscape.kt b/tests/FlickerTests/FlickerService/src/com/android/server/wm/flicker/service/notification/flicker/OpenAppFromNotificationColdGesturalNavLandscape.kt index ef84c3f1177e..ef84c3f1177e 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/service/notification/flicker/OpenAppFromNotificationColdGesturalNavLandscape.kt +++ b/tests/FlickerTests/FlickerService/src/com/android/server/wm/flicker/service/notification/flicker/OpenAppFromNotificationColdGesturalNavLandscape.kt diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/service/notification/flicker/OpenAppFromNotificationColdGesturalNavPortrait.kt b/tests/FlickerTests/FlickerService/src/com/android/server/wm/flicker/service/notification/flicker/OpenAppFromNotificationColdGesturalNavPortrait.kt index 5bb6b3713e9f..5bb6b3713e9f 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/service/notification/flicker/OpenAppFromNotificationColdGesturalNavPortrait.kt +++ b/tests/FlickerTests/FlickerService/src/com/android/server/wm/flicker/service/notification/flicker/OpenAppFromNotificationColdGesturalNavPortrait.kt diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/service/notification/flicker/OpenAppFromNotificationWarm3ButtonNavLandscape.kt b/tests/FlickerTests/FlickerService/src/com/android/server/wm/flicker/service/notification/flicker/OpenAppFromNotificationWarm3ButtonNavLandscape.kt index 39f25e97f04c..39f25e97f04c 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/service/notification/flicker/OpenAppFromNotificationWarm3ButtonNavLandscape.kt +++ b/tests/FlickerTests/FlickerService/src/com/android/server/wm/flicker/service/notification/flicker/OpenAppFromNotificationWarm3ButtonNavLandscape.kt diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/service/notification/flicker/OpenAppFromNotificationWarm3ButtonNavPortrait.kt b/tests/FlickerTests/FlickerService/src/com/android/server/wm/flicker/service/notification/flicker/OpenAppFromNotificationWarm3ButtonNavPortrait.kt index 28816bcba2a1..28816bcba2a1 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/service/notification/flicker/OpenAppFromNotificationWarm3ButtonNavPortrait.kt +++ b/tests/FlickerTests/FlickerService/src/com/android/server/wm/flicker/service/notification/flicker/OpenAppFromNotificationWarm3ButtonNavPortrait.kt diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/service/notification/flicker/OpenAppFromNotificationWarmGesturalNavLandscape.kt b/tests/FlickerTests/FlickerService/src/com/android/server/wm/flicker/service/notification/flicker/OpenAppFromNotificationWarmGesturalNavLandscape.kt index 94ffe4e57994..94ffe4e57994 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/service/notification/flicker/OpenAppFromNotificationWarmGesturalNavLandscape.kt +++ b/tests/FlickerTests/FlickerService/src/com/android/server/wm/flicker/service/notification/flicker/OpenAppFromNotificationWarmGesturalNavLandscape.kt diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/service/notification/flicker/OpenAppFromNotificationWarmGesturalNavPortrait.kt b/tests/FlickerTests/FlickerService/src/com/android/server/wm/flicker/service/notification/flicker/OpenAppFromNotificationWarmGesturalNavPortrait.kt index e5f5ec4a6fe8..e5f5ec4a6fe8 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/service/notification/flicker/OpenAppFromNotificationWarmGesturalNavPortrait.kt +++ b/tests/FlickerTests/FlickerService/src/com/android/server/wm/flicker/service/notification/flicker/OpenAppFromNotificationWarmGesturalNavPortrait.kt diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/service/notification/scenarios/NotificationUtils.kt b/tests/FlickerTests/FlickerService/src/com/android/server/wm/flicker/service/notification/scenarios/NotificationUtils.kt index ac4e16969bad..ac4e16969bad 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/service/notification/scenarios/NotificationUtils.kt +++ b/tests/FlickerTests/FlickerService/src/com/android/server/wm/flicker/service/notification/scenarios/NotificationUtils.kt diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/service/notification/scenarios/OpenAppFromLockscreenNotificationCold.kt b/tests/FlickerTests/FlickerService/src/com/android/server/wm/flicker/service/notification/scenarios/OpenAppFromLockscreenNotificationCold.kt index 9c53ab30e8cd..9c53ab30e8cd 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/service/notification/scenarios/OpenAppFromLockscreenNotificationCold.kt +++ b/tests/FlickerTests/FlickerService/src/com/android/server/wm/flicker/service/notification/scenarios/OpenAppFromLockscreenNotificationCold.kt diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/service/notification/scenarios/OpenAppFromLockscreenNotificationWarm.kt b/tests/FlickerTests/FlickerService/src/com/android/server/wm/flicker/service/notification/scenarios/OpenAppFromLockscreenNotificationWarm.kt index 31f55d9d2e99..31f55d9d2e99 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/service/notification/scenarios/OpenAppFromLockscreenNotificationWarm.kt +++ b/tests/FlickerTests/FlickerService/src/com/android/server/wm/flicker/service/notification/scenarios/OpenAppFromLockscreenNotificationWarm.kt diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/service/notification/scenarios/OpenAppFromLockscreenNotificationWithOverlayApp.kt b/tests/FlickerTests/FlickerService/src/com/android/server/wm/flicker/service/notification/scenarios/OpenAppFromLockscreenNotificationWithOverlayApp.kt index b971555f2747..b971555f2747 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/service/notification/scenarios/OpenAppFromLockscreenNotificationWithOverlayApp.kt +++ b/tests/FlickerTests/FlickerService/src/com/android/server/wm/flicker/service/notification/scenarios/OpenAppFromLockscreenNotificationWithOverlayApp.kt diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/service/notification/scenarios/OpenAppFromNotificationCold.kt b/tests/FlickerTests/FlickerService/src/com/android/server/wm/flicker/service/notification/scenarios/OpenAppFromNotificationCold.kt index fed077ed0e50..fed077ed0e50 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/service/notification/scenarios/OpenAppFromNotificationCold.kt +++ b/tests/FlickerTests/FlickerService/src/com/android/server/wm/flicker/service/notification/scenarios/OpenAppFromNotificationCold.kt diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/service/notification/scenarios/OpenAppFromNotificationWarm.kt b/tests/FlickerTests/FlickerService/src/com/android/server/wm/flicker/service/notification/scenarios/OpenAppFromNotificationWarm.kt index 403790e904d8..403790e904d8 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/service/notification/scenarios/OpenAppFromNotificationWarm.kt +++ b/tests/FlickerTests/FlickerService/src/com/android/server/wm/flicker/service/notification/scenarios/OpenAppFromNotificationWarm.kt diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/service/quickswitch/flicker/QuickSwitchBetweenTwoAppsBackGesturalNavLandscape.kt b/tests/FlickerTests/FlickerService/src/com/android/server/wm/flicker/service/quickswitch/flicker/QuickSwitchBetweenTwoAppsBackGesturalNavLandscape.kt index d611a420edcb..d611a420edcb 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/service/quickswitch/flicker/QuickSwitchBetweenTwoAppsBackGesturalNavLandscape.kt +++ b/tests/FlickerTests/FlickerService/src/com/android/server/wm/flicker/service/quickswitch/flicker/QuickSwitchBetweenTwoAppsBackGesturalNavLandscape.kt diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/service/quickswitch/flicker/QuickSwitchBetweenTwoAppsBackGesturalNavPortrait.kt b/tests/FlickerTests/FlickerService/src/com/android/server/wm/flicker/service/quickswitch/flicker/QuickSwitchBetweenTwoAppsBackGesturalNavPortrait.kt index e6bcbba661f3..e6bcbba661f3 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/service/quickswitch/flicker/QuickSwitchBetweenTwoAppsBackGesturalNavPortrait.kt +++ b/tests/FlickerTests/FlickerService/src/com/android/server/wm/flicker/service/quickswitch/flicker/QuickSwitchBetweenTwoAppsBackGesturalNavPortrait.kt diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/service/quickswitch/flicker/QuickSwitchBetweenTwoAppsForwardGesturalNavLandscape.kt b/tests/FlickerTests/FlickerService/src/com/android/server/wm/flicker/service/quickswitch/flicker/QuickSwitchBetweenTwoAppsForwardGesturalNavLandscape.kt index 2a26d633adaf..2a26d633adaf 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/service/quickswitch/flicker/QuickSwitchBetweenTwoAppsForwardGesturalNavLandscape.kt +++ b/tests/FlickerTests/FlickerService/src/com/android/server/wm/flicker/service/quickswitch/flicker/QuickSwitchBetweenTwoAppsForwardGesturalNavLandscape.kt diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/service/quickswitch/flicker/QuickSwitchBetweenTwoAppsForwardGesturalNavPortrait.kt b/tests/FlickerTests/FlickerService/src/com/android/server/wm/flicker/service/quickswitch/flicker/QuickSwitchBetweenTwoAppsForwardGesturalNavPortrait.kt index 5ce714371db0..5ce714371db0 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/service/quickswitch/flicker/QuickSwitchBetweenTwoAppsForwardGesturalNavPortrait.kt +++ b/tests/FlickerTests/FlickerService/src/com/android/server/wm/flicker/service/quickswitch/flicker/QuickSwitchBetweenTwoAppsForwardGesturalNavPortrait.kt diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/service/quickswitch/flicker/QuickSwitchFromLauncherGesturalNavLandscape.kt b/tests/FlickerTests/FlickerService/src/com/android/server/wm/flicker/service/quickswitch/flicker/QuickSwitchFromLauncherGesturalNavLandscape.kt index cff47bb8cc19..cff47bb8cc19 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/service/quickswitch/flicker/QuickSwitchFromLauncherGesturalNavLandscape.kt +++ b/tests/FlickerTests/FlickerService/src/com/android/server/wm/flicker/service/quickswitch/flicker/QuickSwitchFromLauncherGesturalNavLandscape.kt diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/service/quickswitch/flicker/QuickSwitchFromLauncherGesturalNavPortrait.kt b/tests/FlickerTests/FlickerService/src/com/android/server/wm/flicker/service/quickswitch/flicker/QuickSwitchFromLauncherGesturalNavPortrait.kt index 33095a6ac078..33095a6ac078 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/service/quickswitch/flicker/QuickSwitchFromLauncherGesturalNavPortrait.kt +++ b/tests/FlickerTests/FlickerService/src/com/android/server/wm/flicker/service/quickswitch/flicker/QuickSwitchFromLauncherGesturalNavPortrait.kt diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/service/quickswitch/scenarios/QuickSwitchBetweenTwoAppsBack.kt b/tests/FlickerTests/FlickerService/src/com/android/server/wm/flicker/service/quickswitch/scenarios/QuickSwitchBetweenTwoAppsBack.kt index a1708fe3a4b6..a1708fe3a4b6 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/service/quickswitch/scenarios/QuickSwitchBetweenTwoAppsBack.kt +++ b/tests/FlickerTests/FlickerService/src/com/android/server/wm/flicker/service/quickswitch/scenarios/QuickSwitchBetweenTwoAppsBack.kt diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/service/quickswitch/scenarios/QuickSwitchBetweenTwoAppsForward.kt b/tests/FlickerTests/FlickerService/src/com/android/server/wm/flicker/service/quickswitch/scenarios/QuickSwitchBetweenTwoAppsForward.kt index 3cae1c43285b..fcf442a4e300 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/service/quickswitch/scenarios/QuickSwitchBetweenTwoAppsForward.kt +++ b/tests/FlickerTests/FlickerService/src/com/android/server/wm/flicker/service/quickswitch/scenarios/QuickSwitchBetweenTwoAppsForward.kt @@ -19,6 +19,7 @@ package com.android.server.wm.flicker.service.quickswitch.scenarios import android.app.Instrumentation import android.tools.common.NavBar import android.tools.common.Rotation +import android.tools.device.flicker.rules.ChangeDisplayOrientationRule import android.tools.device.traces.parsers.WindowManagerStateHelper import androidx.test.platform.app.InstrumentationRegistry import com.android.launcher3.tapl.LauncherInstrumentation @@ -30,7 +31,6 @@ import org.junit.Before import org.junit.Ignore import org.junit.Rule import org.junit.Test -import android.tools.device.flicker.rules.ChangeDisplayOrientationRule @Ignore("Base Test Class") abstract class QuickSwitchBetweenTwoAppsForward(val rotation: Rotation = Rotation.ROTATION_0) { diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/service/quickswitch/scenarios/QuickSwitchFromLauncher.kt b/tests/FlickerTests/FlickerService/src/com/android/server/wm/flicker/service/quickswitch/scenarios/QuickSwitchFromLauncher.kt index 7afe5268ede4..7afe5268ede4 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/service/quickswitch/scenarios/QuickSwitchFromLauncher.kt +++ b/tests/FlickerTests/FlickerService/src/com/android/server/wm/flicker/service/quickswitch/scenarios/QuickSwitchFromLauncher.kt diff --git a/tests/FlickerTests/FlickerService/trace_config/trace_config.textproto b/tests/FlickerTests/FlickerService/trace_config/trace_config.textproto new file mode 100644 index 000000000000..c9a35aca9085 --- /dev/null +++ b/tests/FlickerTests/FlickerService/trace_config/trace_config.textproto @@ -0,0 +1,77 @@ +# 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. + +# proto-message: TraceConfig + +# Enable periodic flushing of the trace buffer into the output file. +write_into_file: true + +# Writes the userspace buffer into the file every 1s. +file_write_period_ms: 2500 + +# See b/126487238 - we need to guarantee ordering of events. +flush_period_ms: 30000 + +# The trace buffers needs to be big enough to hold |file_write_period_ms| of +# trace data. The trace buffer sizing depends on the number of trace categories +# enabled and the device activity. + +# RSS events +buffers: { + size_kb: 63488 + fill_policy: RING_BUFFER +} + +data_sources { + config { + name: "linux.process_stats" + target_buffer: 0 + # polled per-process memory counters and process/thread names. + # If you don't want the polled counters, remove the "process_stats_config" + # section, but keep the data source itself as it still provides on-demand + # thread/process naming for ftrace data below. + process_stats_config { + scan_all_processes_on_start: true + } + } +} + +data_sources: { + config { + name: "linux.ftrace" + ftrace_config { + ftrace_events: "ftrace/print" + ftrace_events: "task/task_newtask" + ftrace_events: "task/task_rename" + atrace_categories: "ss" + atrace_categories: "wm" + atrace_categories: "am" + atrace_categories: "aidl" + atrace_categories: "input" + atrace_categories: "binder_driver" + atrace_categories: "sched_process_exit" + atrace_apps: "com.android.server.wm.flicker" + atrace_apps: "com.android.server.wm.flicker.other" + atrace_apps: "com.android.server.wm.flicker.close" + atrace_apps: "com.android.server.wm.flicker.ime" + atrace_apps: "com.android.server.wm.flicker.launch" + atrace_apps: "com.android.server.wm.flicker.quickswitch" + atrace_apps: "com.android.server.wm.flicker.rotation" + atrace_apps: "com.android.server.wm.flicker.testapp" + atrace_apps: "com.android.systemui" + atrace_apps: "com.google.android.apps.nexuslauncher" + } + } +} + diff --git a/tests/FlickerTests/IME/Android.bp b/tests/FlickerTests/IME/Android.bp new file mode 100644 index 000000000000..057d9fcdb796 --- /dev/null +++ b/tests/FlickerTests/IME/Android.bp @@ -0,0 +1,78 @@ +// +// Copyright (C) 2018 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 { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "frameworks_base_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["frameworks_base_license"], +} + +filegroup { + name: "FlickerTestsImeCommon-src", + srcs: ["src/**/common/*"], +} + +filegroup { + name: "FlickerTestsIme1-src", + srcs: ["src/**/Close*"], +} + +android_test { + name: "FlickerTestsIme", + defaults: ["FlickerTestsDefault"], + manifest: "AndroidManifest.xml", + test_config_template: "AndroidTestTemplate.xml", + srcs: ["src/**/*"], + static_libs: ["FlickerTestsBase"], +} + +java_library { + name: "FlickerTestsImeCommon", + defaults: ["FlickerTestsDefault"], + srcs: [":FlickerTestsImeCommon-src"], + static_libs: ["FlickerTestsBase"], +} + +android_test { + name: "FlickerTestsIme1", + defaults: ["FlickerTestsDefault"], + manifest: "AndroidManifest.xml", + test_config_template: "AndroidTestTemplate.xml", + srcs: [":FlickerTestsIme1-src"], + static_libs: [ + "FlickerTestsBase", + "FlickerTestsImeCommon", + ], +} + +android_test { + name: "FlickerTestsIme2", + defaults: ["FlickerTestsDefault"], + manifest: "AndroidManifest.xml", + test_config_template: "AndroidTestTemplate.xml", + srcs: ["src/**/*"], + exclude_srcs: [ + ":FlickerTestsIme1-src", + ":FlickerTestsImeCommon-src", + ], + static_libs: [ + "FlickerTestsBase", + "FlickerTestsImeCommon", + ], +} diff --git a/tests/FlickerTests/IME/AndroidManifest.xml b/tests/FlickerTests/IME/AndroidManifest.xml new file mode 100644 index 000000000000..d6ca683e13f2 --- /dev/null +++ b/tests/FlickerTests/IME/AndroidManifest.xml @@ -0,0 +1,67 @@ +<?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. + --> + +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools" + package="com.android.server.wm.flicker.ime"> + + <uses-sdk android:minSdkVersion="29" android:targetSdkVersion="29"/> + <!-- Read and write traces from external storage --> + <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> + <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> + <!-- Allow the test to write directly to /sdcard/ --> + <uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" /> + <!-- Write secure settings --> + <uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS" /> + <!-- Capture screen contents --> + <uses-permission android:name="android.permission.ACCESS_SURFACE_FLINGER" /> + <!-- Enable / Disable tracing !--> + <uses-permission android:name="android.permission.DUMP" /> + <!-- Force-stop test apps --> + <uses-permission android:name="android.permission.FORCE_STOP_PACKAGES"/> + <!-- Run layers trace --> + <uses-permission android:name="android.permission.HARDWARE_TEST"/> + <!-- Capture screen recording --> + <uses-permission android:name="android.permission.CAPTURE_VIDEO_OUTPUT"/> + <!-- Workaround grant runtime permission exception from b/152733071 --> + <uses-permission android:name="android.permission.PACKAGE_USAGE_STATS"/> + <uses-permission android:name="android.permission.READ_LOGS"/> + <!-- ATM.removeRootTasksWithActivityTypes() --> + <uses-permission android:name="android.permission.MANAGE_ACTIVITY_TASKS" /> + <!-- ActivityOptions.makeCustomTaskAnimation() --> + <uses-permission android:name="android.permission.START_TASKS_FROM_RECENTS" /> + <!-- Allow the test to connect to perfetto trace processor --> + <uses-permission android:name="android.permission.INTERNET"/> + <!-- Allow the test to write directly to /sdcard/ and connect to trace processor --> + <application android:requestLegacyExternalStorage="true" + android:networkSecurityConfig="@xml/network_security_config" + android:largeHeap="true"> + <uses-library android:name="android.test.runner"/> + <uses-library android:name="androidx.window.extensions" android:required="false"/> + + <!-- (b/197936012) Remove startup provider due to test timeout issue --> + <provider + android:name="androidx.startup.InitializationProvider" + android:authorities="${applicationId}.androidx-startup" + tools:node="remove" /> + </application> + + <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner" + android:targetPackage="com.android.server.wm.flicker.ime" + android:label="WindowManager Flicker Tests"> + </instrumentation> +</manifest> diff --git a/tests/FlickerTests/IME/AndroidTestTemplate.xml b/tests/FlickerTests/IME/AndroidTestTemplate.xml new file mode 100644 index 000000000000..988f76f4175c --- /dev/null +++ b/tests/FlickerTests/IME/AndroidTestTemplate.xml @@ -0,0 +1,90 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Copyright 2018 Google Inc. All Rights Reserved. + --> +<configuration description="Runs WindowManager {MODULE}"> + <option name="test-tag" value="FlickerTests"/> + <!-- Needed for storing the perfetto trace files in the sdcard/test_results--> + <option name="isolated-storage" value="false"/> + + <target_preparer class="com.android.tradefed.targetprep.DeviceSetup"> + <!-- keeps the screen on during tests --> + <option name="screen-always-on" value="on"/> + <!-- prevents the phone from restarting --> + <option name="force-skip-system-props" value="true"/> + <!-- set WM tracing verbose level to all --> + <option name="run-command" value="cmd window tracing level all"/> + <!-- set WM tracing to frame (avoid incomplete states) --> + <option name="run-command" value="cmd window tracing frame"/> + <!-- ensure lock screen mode is swipe --> + <option name="run-command" value="locksettings set-disabled false"/> + <!-- disable betterbug as it's log collection dialogues cause flakes in e2e tests --> + <option name="run-command" value="pm disable com.google.android.internal.betterbug"/> + <!-- restart launcher to activate TAPL --> + <option name="run-command" + value="setprop ro.test_harness 1 ; am force-stop com.google.android.apps.nexuslauncher"/> + <!-- Increase trace size: 20mb for WM and 80mb for SF --> + <option name="run-command" value="cmd window tracing size 20480"/> + <option name="run-command" value="su root service call SurfaceFlinger 1029 i32 81920"/> + <!-- b/307664397 - Ensure camera has the correct permissions and doesn't show a dialog --> + <option name="run-command" + value="pm grant com.google.android.GoogleCamera android.permission.CAMERA"/> + <option name="run-command" + value="pm grant com.google.android.GoogleCamera android.permission.RECORD_AUDIO"/> + <option name="run-command" + value="pm grant com.google.android.GoogleCamera android.permission.ACCESS_FINE_LOCATION"/> + <option name="run-command" + value="pm grant com.google.android.GoogleCamera android.permission.ACCESS_COARSE_LOCATION"/> + </target_preparer> + <target_preparer class="com.android.tradefed.targetprep.RunCommandTargetPreparer"> + <option name="test-user-token" value="%TEST_USER%"/> + <option name="run-command" value="rm -rf /data/user/%TEST_USER%/files/*"/> + <option name="run-command" value="settings put secure show_ime_with_hard_keyboard 1"/> + <option name="run-command" value="settings put system show_touches 1"/> + <option name="run-command" value="settings put system pointer_location 1"/> + <option name="teardown-command" + value="settings delete secure show_ime_with_hard_keyboard"/> + <option name="teardown-command" value="settings delete system show_touches"/> + <option name="teardown-command" value="settings delete system pointer_location"/> + <option name="teardown-command" + value="cmd overlay enable com.android.internal.systemui.navbar.gestural"/> + </target_preparer> + <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller"> + <option name="cleanup-apks" value="true"/> + <option name="test-file-name" value="{MODULE}.apk"/> + <option name="test-file-name" value="FlickerTestApp.apk"/> + </target_preparer> + <!-- Needed for pushing the trace config file --> + <target_preparer class="com.android.tradefed.targetprep.RootTargetPreparer"/> + <target_preparer class="com.android.tradefed.targetprep.PushFilePreparer"> + <option name="push-file" + key="trace_config.textproto" + value="/data/misc/perfetto-traces/trace_config.textproto" + /> + <!--Install the content provider automatically when we push some file in sdcard folder.--> + <!--Needed to avoid the installation during the test suite.--> + <option name="push-file" key="trace_config.textproto" value="/sdcard/sample.textproto"/> + </target_preparer> + <test class="com.android.tradefed.testtype.AndroidJUnitTest"> + <option name="package" value="{PACKAGE}"/> + <option name="shell-timeout" value="6600s"/> + <option name="test-timeout" value="6600s"/> + <option name="hidden-api-checks" value="false"/> + <option name="device-listeners" value="android.device.collectors.PerfettoListener"/> + <!-- PerfettoListener related arguments --> + <option name="instrumentation-arg" key="perfetto_config_text_proto" value="true"/> + <option name="instrumentation-arg" + key="perfetto_config_file" + value="trace_config.textproto" + /> + <option name="instrumentation-arg" key="per_run" value="true"/> + </test> + <!-- Needed for pulling the collected trace config on to the host --> + <metrics_collector class="com.android.tradefed.device.metric.FilePullerLogCollector"> + <option name="pull-pattern-keys" value="perfetto_file_path"/> + <option name="directory-keys" + value="/data/user/0/com.android.server.wm.flicker.ime/files"/> + <option name="collect-on-run-ended-only" value="true"/> + <option name="clean-up" value="true"/> + </metrics_collector> +</configuration> diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/ime/OWNERS b/tests/FlickerTests/IME/OWNERS index 301fafa5309e..301fafa5309e 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/ime/OWNERS +++ b/tests/FlickerTests/IME/OWNERS diff --git a/tests/FlickerTests/IME/res/anim/show_hide_show_3000ms.xml b/tests/FlickerTests/IME/res/anim/show_hide_show_3000ms.xml new file mode 100644 index 000000000000..7b3f07e3a2f5 --- /dev/null +++ b/tests/FlickerTests/IME/res/anim/show_hide_show_3000ms.xml @@ -0,0 +1,31 @@ +<!-- + ~ Copyright (C) 2022 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. + --> + +<set + xmlns:android="http://schemas.android.com/apk/res/android" + android:fillAfter="true"> + + <alpha + android:fromAlpha="1.0" + android:toAlpha="0.0" + android:duration="1000" /> + + <alpha + android:startOffset="2000" + android:fromAlpha="1.0" + android:toAlpha="1.0" + android:duration="1000" /> +</set>
\ No newline at end of file diff --git a/tests/FlickerTests/IME/res/xml/network_security_config.xml b/tests/FlickerTests/IME/res/xml/network_security_config.xml new file mode 100644 index 000000000000..4bd9ca049f55 --- /dev/null +++ b/tests/FlickerTests/IME/res/xml/network_security_config.xml @@ -0,0 +1,22 @@ +<?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. + --> + +<network-security-config> + <domain-config cleartextTrafficPermitted="true"> + <domain includeSubdomains="true">localhost</domain> + </domain-config> +</network-security-config> diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/ime/CloseImeOnDismissPopupDialogTest.kt b/tests/FlickerTests/IME/src/com/android/server/wm/flicker/ime/CloseImeOnDismissPopupDialogTest.kt index 47a1619e0e9c..47a1619e0e9c 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/ime/CloseImeOnDismissPopupDialogTest.kt +++ b/tests/FlickerTests/IME/src/com/android/server/wm/flicker/ime/CloseImeOnDismissPopupDialogTest.kt diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/ime/CloseImeOnGoHomeTest.kt b/tests/FlickerTests/IME/src/com/android/server/wm/flicker/ime/CloseImeOnGoHomeTest.kt index 48c54eabc5e2..48c54eabc5e2 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/ime/CloseImeOnGoHomeTest.kt +++ b/tests/FlickerTests/IME/src/com/android/server/wm/flicker/ime/CloseImeOnGoHomeTest.kt diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/ime/CloseImeShownOnAppStartOnGoHomeTest.kt b/tests/FlickerTests/IME/src/com/android/server/wm/flicker/ime/CloseImeShownOnAppStartOnGoHomeTest.kt index 31d5d7f837d5..31d5d7f837d5 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/ime/CloseImeShownOnAppStartOnGoHomeTest.kt +++ b/tests/FlickerTests/IME/src/com/android/server/wm/flicker/ime/CloseImeShownOnAppStartOnGoHomeTest.kt diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/ime/CloseImeShownOnAppStartToAppOnPressBackTest.kt b/tests/FlickerTests/IME/src/com/android/server/wm/flicker/ime/CloseImeShownOnAppStartToAppOnPressBackTest.kt index 180ae5d6f097..180ae5d6f097 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/ime/CloseImeShownOnAppStartToAppOnPressBackTest.kt +++ b/tests/FlickerTests/IME/src/com/android/server/wm/flicker/ime/CloseImeShownOnAppStartToAppOnPressBackTest.kt diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/ime/CloseImeToAppOnPressBackTest.kt b/tests/FlickerTests/IME/src/com/android/server/wm/flicker/ime/CloseImeToAppOnPressBackTest.kt index a0573b7b4b16..a0573b7b4b16 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/ime/CloseImeToAppOnPressBackTest.kt +++ b/tests/FlickerTests/IME/src/com/android/server/wm/flicker/ime/CloseImeToAppOnPressBackTest.kt diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/ime/CloseImeToHomeOnFinishActivityTest.kt b/tests/FlickerTests/IME/src/com/android/server/wm/flicker/ime/CloseImeToHomeOnFinishActivityTest.kt index b44f1a607b05..b44f1a607b05 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/ime/CloseImeToHomeOnFinishActivityTest.kt +++ b/tests/FlickerTests/IME/src/com/android/server/wm/flicker/ime/CloseImeToHomeOnFinishActivityTest.kt diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/ime/OpenImeWindowToFixedPortraitAppTest.kt b/tests/FlickerTests/IME/src/com/android/server/wm/flicker/ime/OpenImeWindowToFixedPortraitAppTest.kt index 976ac82c8bb5..976ac82c8bb5 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/ime/OpenImeWindowToFixedPortraitAppTest.kt +++ b/tests/FlickerTests/IME/src/com/android/server/wm/flicker/ime/OpenImeWindowToFixedPortraitAppTest.kt diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/ime/ShowImeOnAppStartWhenLaunchingAppFromFixedOrientationTest.kt b/tests/FlickerTests/IME/src/com/android/server/wm/flicker/ime/ShowImeOnAppStartWhenLaunchingAppFromFixedOrientationTest.kt index ea7c7c4276dc..ea7c7c4276dc 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/ime/ShowImeOnAppStartWhenLaunchingAppFromFixedOrientationTest.kt +++ b/tests/FlickerTests/IME/src/com/android/server/wm/flicker/ime/ShowImeOnAppStartWhenLaunchingAppFromFixedOrientationTest.kt diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/ime/ShowImeOnAppStartWhenLaunchingAppFromOverviewTest.kt b/tests/FlickerTests/IME/src/com/android/server/wm/flicker/ime/ShowImeOnAppStartWhenLaunchingAppFromOverviewTest.kt index 05babd67758c..05babd67758c 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/ime/ShowImeOnAppStartWhenLaunchingAppFromOverviewTest.kt +++ b/tests/FlickerTests/IME/src/com/android/server/wm/flicker/ime/ShowImeOnAppStartWhenLaunchingAppFromOverviewTest.kt diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/ime/ShowImeOnAppStartWhenLaunchingAppFromQuickSwitchTest.kt b/tests/FlickerTests/IME/src/com/android/server/wm/flicker/ime/ShowImeOnAppStartWhenLaunchingAppFromQuickSwitchTest.kt index aff8e657bec0..aff8e657bec0 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/ime/ShowImeOnAppStartWhenLaunchingAppFromQuickSwitchTest.kt +++ b/tests/FlickerTests/IME/src/com/android/server/wm/flicker/ime/ShowImeOnAppStartWhenLaunchingAppFromQuickSwitchTest.kt diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/ime/ShowImeOnAppStartWhenLaunchingAppTest.kt b/tests/FlickerTests/IME/src/com/android/server/wm/flicker/ime/ShowImeOnAppStartWhenLaunchingAppTest.kt index 4ffdcea455ba..4ffdcea455ba 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/ime/ShowImeOnAppStartWhenLaunchingAppTest.kt +++ b/tests/FlickerTests/IME/src/com/android/server/wm/flicker/ime/ShowImeOnAppStartWhenLaunchingAppTest.kt diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/ime/ShowImeWhenFocusingOnInputFieldTest.kt b/tests/FlickerTests/IME/src/com/android/server/wm/flicker/ime/ShowImeWhenFocusingOnInputFieldTest.kt index 918e1ea3bcd0..918e1ea3bcd0 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/ime/ShowImeWhenFocusingOnInputFieldTest.kt +++ b/tests/FlickerTests/IME/src/com/android/server/wm/flicker/ime/ShowImeWhenFocusingOnInputFieldTest.kt diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/ime/ShowImeWhileDismissingThemedPopupDialogTest.kt b/tests/FlickerTests/IME/src/com/android/server/wm/flicker/ime/ShowImeWhileDismissingThemedPopupDialogTest.kt index 6ad235ce892e..6ad235ce892e 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/ime/ShowImeWhileDismissingThemedPopupDialogTest.kt +++ b/tests/FlickerTests/IME/src/com/android/server/wm/flicker/ime/ShowImeWhileDismissingThemedPopupDialogTest.kt diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/ime/ShowImeWhileEnteringOverviewTest.kt b/tests/FlickerTests/IME/src/com/android/server/wm/flicker/ime/ShowImeWhileEnteringOverviewTest.kt index f1bc125b99dc..f1bc125b99dc 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/ime/ShowImeWhileEnteringOverviewTest.kt +++ b/tests/FlickerTests/IME/src/com/android/server/wm/flicker/ime/ShowImeWhileEnteringOverviewTest.kt diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/ime/CommonAssertions.kt b/tests/FlickerTests/IME/src/com/android/server/wm/flicker/ime/common/CommonAssertions.kt index 777231e001f7..777231e001f7 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/ime/CommonAssertions.kt +++ b/tests/FlickerTests/IME/src/com/android/server/wm/flicker/ime/common/CommonAssertions.kt diff --git a/tests/FlickerTests/IME/trace_config/trace_config.textproto b/tests/FlickerTests/IME/trace_config/trace_config.textproto new file mode 100644 index 000000000000..c9a35aca9085 --- /dev/null +++ b/tests/FlickerTests/IME/trace_config/trace_config.textproto @@ -0,0 +1,77 @@ +# 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. + +# proto-message: TraceConfig + +# Enable periodic flushing of the trace buffer into the output file. +write_into_file: true + +# Writes the userspace buffer into the file every 1s. +file_write_period_ms: 2500 + +# See b/126487238 - we need to guarantee ordering of events. +flush_period_ms: 30000 + +# The trace buffers needs to be big enough to hold |file_write_period_ms| of +# trace data. The trace buffer sizing depends on the number of trace categories +# enabled and the device activity. + +# RSS events +buffers: { + size_kb: 63488 + fill_policy: RING_BUFFER +} + +data_sources { + config { + name: "linux.process_stats" + target_buffer: 0 + # polled per-process memory counters and process/thread names. + # If you don't want the polled counters, remove the "process_stats_config" + # section, but keep the data source itself as it still provides on-demand + # thread/process naming for ftrace data below. + process_stats_config { + scan_all_processes_on_start: true + } + } +} + +data_sources: { + config { + name: "linux.ftrace" + ftrace_config { + ftrace_events: "ftrace/print" + ftrace_events: "task/task_newtask" + ftrace_events: "task/task_rename" + atrace_categories: "ss" + atrace_categories: "wm" + atrace_categories: "am" + atrace_categories: "aidl" + atrace_categories: "input" + atrace_categories: "binder_driver" + atrace_categories: "sched_process_exit" + atrace_apps: "com.android.server.wm.flicker" + atrace_apps: "com.android.server.wm.flicker.other" + atrace_apps: "com.android.server.wm.flicker.close" + atrace_apps: "com.android.server.wm.flicker.ime" + atrace_apps: "com.android.server.wm.flicker.launch" + atrace_apps: "com.android.server.wm.flicker.quickswitch" + atrace_apps: "com.android.server.wm.flicker.rotation" + atrace_apps: "com.android.server.wm.flicker.testapp" + atrace_apps: "com.android.systemui" + atrace_apps: "com.google.android.apps.nexuslauncher" + } + } +} + diff --git a/tests/FlickerTests/Notification/Android.bp b/tests/FlickerTests/Notification/Android.bp new file mode 100644 index 000000000000..5bed568aacd1 --- /dev/null +++ b/tests/FlickerTests/Notification/Android.bp @@ -0,0 +1,33 @@ +// +// Copyright (C) 2018 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 { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "frameworks_base_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["frameworks_base_license"], +} + +android_test { + name: "FlickerTestsNotification", + defaults: ["FlickerTestsDefault"], + manifest: "AndroidManifest.xml", + test_config_template: "AndroidTestTemplate.xml", + srcs: ["src/**/*"], + static_libs: ["FlickerTestsBase"], +} diff --git a/tests/FlickerTests/Notification/AndroidManifest.xml b/tests/FlickerTests/Notification/AndroidManifest.xml new file mode 100644 index 000000000000..d212c10ff414 --- /dev/null +++ b/tests/FlickerTests/Notification/AndroidManifest.xml @@ -0,0 +1,67 @@ +<?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. + --> + +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools" + package="com.android.server.wm.flicker.notification"> + + <uses-sdk android:minSdkVersion="29" android:targetSdkVersion="29"/> + <!-- Read and write traces from external storage --> + <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> + <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> + <!-- Allow the test to write directly to /sdcard/ --> + <uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" /> + <!-- Write secure settings --> + <uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS" /> + <!-- Capture screen contents --> + <uses-permission android:name="android.permission.ACCESS_SURFACE_FLINGER" /> + <!-- Enable / Disable tracing !--> + <uses-permission android:name="android.permission.DUMP" /> + <!-- Force-stop test apps --> + <uses-permission android:name="android.permission.FORCE_STOP_PACKAGES"/> + <!-- Run layers trace --> + <uses-permission android:name="android.permission.HARDWARE_TEST"/> + <!-- Capture screen recording --> + <uses-permission android:name="android.permission.CAPTURE_VIDEO_OUTPUT"/> + <!-- Workaround grant runtime permission exception from b/152733071 --> + <uses-permission android:name="android.permission.PACKAGE_USAGE_STATS"/> + <uses-permission android:name="android.permission.READ_LOGS"/> + <!-- ATM.removeRootTasksWithActivityTypes() --> + <uses-permission android:name="android.permission.MANAGE_ACTIVITY_TASKS" /> + <!-- ActivityOptions.makeCustomTaskAnimation() --> + <uses-permission android:name="android.permission.START_TASKS_FROM_RECENTS" /> + <!-- Allow the test to connect to perfetto trace processor --> + <uses-permission android:name="android.permission.INTERNET"/> + <!-- Allow the test to write directly to /sdcard/ and connect to trace processor --> + <application android:requestLegacyExternalStorage="true" + android:networkSecurityConfig="@xml/network_security_config" + android:largeHeap="true"> + <uses-library android:name="android.test.runner"/> + <uses-library android:name="androidx.window.extensions" android:required="false"/> + + <!-- (b/197936012) Remove startup provider due to test timeout issue --> + <provider + android:name="androidx.startup.InitializationProvider" + android:authorities="${applicationId}.androidx-startup" + tools:node="remove" /> + </application> + + <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner" + android:targetPackage="com.android.server.wm.flicker.notification" + android:label="WindowManager Flicker Tests"> + </instrumentation> +</manifest> diff --git a/tests/FlickerTests/AndroidTestTemplate.xml b/tests/FlickerTests/Notification/AndroidTestTemplate.xml index ed71531d4eab..403685831be7 100644 --- a/tests/FlickerTests/AndroidTestTemplate.xml +++ b/tests/FlickerTests/Notification/AndroidTestTemplate.xml @@ -83,21 +83,7 @@ <metrics_collector class="com.android.tradefed.device.metric.FilePullerLogCollector"> <option name="pull-pattern-keys" value="perfetto_file_path"/> <option name="directory-keys" - value="/data/user/0/com.android.server.wm.flicker/files"/> - <option name="directory-keys" - value="/data/user/0/com.android.server.wm.flicker.close/files"/> - <option name="directory-keys" - value="/data/user/0/com.android.server.wm.flicker.ime/files"/> - <option name="directory-keys" - value="/data/user/0/com.android.server.wm.flicker.launch/files"/> - <option name="directory-keys" - value="/data/user/0/com.android.server.wm.flicker.quickswitch/files"/> - <option name="directory-keys" - value="/data/user/0/com.android.server.wm.flicker.rotation/files"/> - <option name="directory-keys" value="/data/user/0/com.android.server.wm.flicker.notification/files"/> - <option name="directory-keys" - value="/data/user/0/com.android.server.wm.flicker.service/files"/> <option name="collect-on-run-ended-only" value="true"/> <option name="clean-up" value="true"/> </metrics_collector> diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/notification/OWNERS b/tests/FlickerTests/Notification/OWNERS index 68c37bd82faa..68c37bd82faa 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/notification/OWNERS +++ b/tests/FlickerTests/Notification/OWNERS diff --git a/tests/FlickerTests/Notification/res/anim/show_hide_show_3000ms.xml b/tests/FlickerTests/Notification/res/anim/show_hide_show_3000ms.xml new file mode 100644 index 000000000000..7b3f07e3a2f5 --- /dev/null +++ b/tests/FlickerTests/Notification/res/anim/show_hide_show_3000ms.xml @@ -0,0 +1,31 @@ +<!-- + ~ Copyright (C) 2022 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. + --> + +<set + xmlns:android="http://schemas.android.com/apk/res/android" + android:fillAfter="true"> + + <alpha + android:fromAlpha="1.0" + android:toAlpha="0.0" + android:duration="1000" /> + + <alpha + android:startOffset="2000" + android:fromAlpha="1.0" + android:toAlpha="1.0" + android:duration="1000" /> +</set>
\ No newline at end of file diff --git a/tests/FlickerTests/Notification/res/xml/network_security_config.xml b/tests/FlickerTests/Notification/res/xml/network_security_config.xml new file mode 100644 index 000000000000..4bd9ca049f55 --- /dev/null +++ b/tests/FlickerTests/Notification/res/xml/network_security_config.xml @@ -0,0 +1,22 @@ +<?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. + --> + +<network-security-config> + <domain-config cleartextTrafficPermitted="true"> + <domain includeSubdomains="true">localhost</domain> + </domain-config> +</network-security-config> diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/notification/Consts.kt b/tests/FlickerTests/Notification/src/com/android/server/wm/flicker/notification/Consts.kt index b81439e8a1d1..b81439e8a1d1 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/notification/Consts.kt +++ b/tests/FlickerTests/Notification/src/com/android/server/wm/flicker/notification/Consts.kt diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/notification/OpenAppFromLockscreenNotificationColdTest.kt b/tests/FlickerTests/Notification/src/com/android/server/wm/flicker/notification/OpenAppFromLockscreenNotificationColdTest.kt index 6819a38c9067..6819a38c9067 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/notification/OpenAppFromLockscreenNotificationColdTest.kt +++ b/tests/FlickerTests/Notification/src/com/android/server/wm/flicker/notification/OpenAppFromLockscreenNotificationColdTest.kt diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/notification/OpenAppFromLockscreenNotificationWarmTest.kt b/tests/FlickerTests/Notification/src/com/android/server/wm/flicker/notification/OpenAppFromLockscreenNotificationWarmTest.kt index 972221640363..972221640363 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/notification/OpenAppFromLockscreenNotificationWarmTest.kt +++ b/tests/FlickerTests/Notification/src/com/android/server/wm/flicker/notification/OpenAppFromLockscreenNotificationWarmTest.kt diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/notification/OpenAppFromLockscreenNotificationWithOverlayAppTest.kt b/tests/FlickerTests/Notification/src/com/android/server/wm/flicker/notification/OpenAppFromLockscreenNotificationWithOverlayAppTest.kt index ffd81716e728..ffd81716e728 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/notification/OpenAppFromLockscreenNotificationWithOverlayAppTest.kt +++ b/tests/FlickerTests/Notification/src/com/android/server/wm/flicker/notification/OpenAppFromLockscreenNotificationWithOverlayAppTest.kt diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/notification/OpenAppFromNotificationColdTest.kt b/tests/FlickerTests/Notification/src/com/android/server/wm/flicker/notification/OpenAppFromNotificationColdTest.kt index fbdba7b71d0f..fbdba7b71d0f 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/notification/OpenAppFromNotificationColdTest.kt +++ b/tests/FlickerTests/Notification/src/com/android/server/wm/flicker/notification/OpenAppFromNotificationColdTest.kt diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/notification/OpenAppFromNotificationWarmTest.kt b/tests/FlickerTests/Notification/src/com/android/server/wm/flicker/notification/OpenAppFromNotificationWarmTest.kt index 2aa444e45ea2..2aa444e45ea2 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/notification/OpenAppFromNotificationWarmTest.kt +++ b/tests/FlickerTests/Notification/src/com/android/server/wm/flicker/notification/OpenAppFromNotificationWarmTest.kt diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/notification/OpenAppTransition.kt b/tests/FlickerTests/Notification/src/com/android/server/wm/flicker/notification/OpenAppTransition.kt index 684b4b70f950..684b4b70f950 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/notification/OpenAppTransition.kt +++ b/tests/FlickerTests/Notification/src/com/android/server/wm/flicker/notification/OpenAppTransition.kt diff --git a/tests/FlickerTests/Notification/trace_config/trace_config.textproto b/tests/FlickerTests/Notification/trace_config/trace_config.textproto new file mode 100644 index 000000000000..c9a35aca9085 --- /dev/null +++ b/tests/FlickerTests/Notification/trace_config/trace_config.textproto @@ -0,0 +1,77 @@ +# 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. + +# proto-message: TraceConfig + +# Enable periodic flushing of the trace buffer into the output file. +write_into_file: true + +# Writes the userspace buffer into the file every 1s. +file_write_period_ms: 2500 + +# See b/126487238 - we need to guarantee ordering of events. +flush_period_ms: 30000 + +# The trace buffers needs to be big enough to hold |file_write_period_ms| of +# trace data. The trace buffer sizing depends on the number of trace categories +# enabled and the device activity. + +# RSS events +buffers: { + size_kb: 63488 + fill_policy: RING_BUFFER +} + +data_sources { + config { + name: "linux.process_stats" + target_buffer: 0 + # polled per-process memory counters and process/thread names. + # If you don't want the polled counters, remove the "process_stats_config" + # section, but keep the data source itself as it still provides on-demand + # thread/process naming for ftrace data below. + process_stats_config { + scan_all_processes_on_start: true + } + } +} + +data_sources: { + config { + name: "linux.ftrace" + ftrace_config { + ftrace_events: "ftrace/print" + ftrace_events: "task/task_newtask" + ftrace_events: "task/task_rename" + atrace_categories: "ss" + atrace_categories: "wm" + atrace_categories: "am" + atrace_categories: "aidl" + atrace_categories: "input" + atrace_categories: "binder_driver" + atrace_categories: "sched_process_exit" + atrace_apps: "com.android.server.wm.flicker" + atrace_apps: "com.android.server.wm.flicker.other" + atrace_apps: "com.android.server.wm.flicker.close" + atrace_apps: "com.android.server.wm.flicker.ime" + atrace_apps: "com.android.server.wm.flicker.launch" + atrace_apps: "com.android.server.wm.flicker.quickswitch" + atrace_apps: "com.android.server.wm.flicker.rotation" + atrace_apps: "com.android.server.wm.flicker.testapp" + atrace_apps: "com.android.systemui" + atrace_apps: "com.google.android.apps.nexuslauncher" + } + } +} + diff --git a/tests/FlickerTests/QuickSwitch/Android.bp b/tests/FlickerTests/QuickSwitch/Android.bp new file mode 100644 index 000000000000..64f718333a59 --- /dev/null +++ b/tests/FlickerTests/QuickSwitch/Android.bp @@ -0,0 +1,33 @@ +// +// Copyright (C) 2018 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 { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "frameworks_base_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["frameworks_base_license"], +} + +android_test { + name: "FlickerTestsQuickswitch", + defaults: ["FlickerTestsDefault"], + manifest: "AndroidManifest.xml", + test_config_template: "AndroidTestTemplate.xml", + srcs: ["src/**/*"], + static_libs: ["FlickerTestsBase"], +} diff --git a/tests/FlickerTests/QuickSwitch/AndroidManifest.xml b/tests/FlickerTests/QuickSwitch/AndroidManifest.xml new file mode 100644 index 000000000000..41b0cd41f0ba --- /dev/null +++ b/tests/FlickerTests/QuickSwitch/AndroidManifest.xml @@ -0,0 +1,67 @@ +<?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. + --> + +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools" + package="com.android.server.wm.flicker.quickswitch"> + + <uses-sdk android:minSdkVersion="29" android:targetSdkVersion="29"/> + <!-- Read and write traces from external storage --> + <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> + <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> + <!-- Allow the test to write directly to /sdcard/ --> + <uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" /> + <!-- Write secure settings --> + <uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS" /> + <!-- Capture screen contents --> + <uses-permission android:name="android.permission.ACCESS_SURFACE_FLINGER" /> + <!-- Enable / Disable tracing !--> + <uses-permission android:name="android.permission.DUMP" /> + <!-- Force-stop test apps --> + <uses-permission android:name="android.permission.FORCE_STOP_PACKAGES"/> + <!-- Run layers trace --> + <uses-permission android:name="android.permission.HARDWARE_TEST"/> + <!-- Capture screen recording --> + <uses-permission android:name="android.permission.CAPTURE_VIDEO_OUTPUT"/> + <!-- Workaround grant runtime permission exception from b/152733071 --> + <uses-permission android:name="android.permission.PACKAGE_USAGE_STATS"/> + <uses-permission android:name="android.permission.READ_LOGS"/> + <!-- ATM.removeRootTasksWithActivityTypes() --> + <uses-permission android:name="android.permission.MANAGE_ACTIVITY_TASKS" /> + <!-- ActivityOptions.makeCustomTaskAnimation() --> + <uses-permission android:name="android.permission.START_TASKS_FROM_RECENTS" /> + <!-- Allow the test to connect to perfetto trace processor --> + <uses-permission android:name="android.permission.INTERNET"/> + <!-- Allow the test to write directly to /sdcard/ and connect to trace processor --> + <application android:requestLegacyExternalStorage="true" + android:networkSecurityConfig="@xml/network_security_config" + android:largeHeap="true"> + <uses-library android:name="android.test.runner"/> + <uses-library android:name="androidx.window.extensions" android:required="false"/> + + <!-- (b/197936012) Remove startup provider due to test timeout issue --> + <provider + android:name="androidx.startup.InitializationProvider" + android:authorities="${applicationId}.androidx-startup" + tools:node="remove" /> + </application> + + <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner" + android:targetPackage="com.android.server.wm.flicker.quickswitch" + android:label="WindowManager Flicker Tests"> + </instrumentation> +</manifest> diff --git a/tests/FlickerTests/QuickSwitch/AndroidTestTemplate.xml b/tests/FlickerTests/QuickSwitch/AndroidTestTemplate.xml new file mode 100644 index 000000000000..797ca4eacd5f --- /dev/null +++ b/tests/FlickerTests/QuickSwitch/AndroidTestTemplate.xml @@ -0,0 +1,90 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Copyright 2018 Google Inc. All Rights Reserved. + --> +<configuration description="Runs WindowManager {MODULE}"> + <option name="test-tag" value="FlickerTests"/> + <!-- Needed for storing the perfetto trace files in the sdcard/test_results--> + <option name="isolated-storage" value="false"/> + + <target_preparer class="com.android.tradefed.targetprep.DeviceSetup"> + <!-- keeps the screen on during tests --> + <option name="screen-always-on" value="on"/> + <!-- prevents the phone from restarting --> + <option name="force-skip-system-props" value="true"/> + <!-- set WM tracing verbose level to all --> + <option name="run-command" value="cmd window tracing level all"/> + <!-- set WM tracing to frame (avoid incomplete states) --> + <option name="run-command" value="cmd window tracing frame"/> + <!-- ensure lock screen mode is swipe --> + <option name="run-command" value="locksettings set-disabled false"/> + <!-- disable betterbug as it's log collection dialogues cause flakes in e2e tests --> + <option name="run-command" value="pm disable com.google.android.internal.betterbug"/> + <!-- restart launcher to activate TAPL --> + <option name="run-command" + value="setprop ro.test_harness 1 ; am force-stop com.google.android.apps.nexuslauncher"/> + <!-- Increase trace size: 20mb for WM and 80mb for SF --> + <option name="run-command" value="cmd window tracing size 20480"/> + <option name="run-command" value="su root service call SurfaceFlinger 1029 i32 81920"/> + <!-- b/307664397 - Ensure camera has the correct permissions and doesn't show a dialog --> + <option name="run-command" + value="pm grant com.google.android.GoogleCamera android.permission.CAMERA"/> + <option name="run-command" + value="pm grant com.google.android.GoogleCamera android.permission.RECORD_AUDIO"/> + <option name="run-command" + value="pm grant com.google.android.GoogleCamera android.permission.ACCESS_FINE_LOCATION"/> + <option name="run-command" + value="pm grant com.google.android.GoogleCamera android.permission.ACCESS_COARSE_LOCATION"/> + </target_preparer> + <target_preparer class="com.android.tradefed.targetprep.RunCommandTargetPreparer"> + <option name="test-user-token" value="%TEST_USER%"/> + <option name="run-command" value="rm -rf /data/user/%TEST_USER%/files/*"/> + <option name="run-command" value="settings put secure show_ime_with_hard_keyboard 1"/> + <option name="run-command" value="settings put system show_touches 1"/> + <option name="run-command" value="settings put system pointer_location 1"/> + <option name="teardown-command" + value="settings delete secure show_ime_with_hard_keyboard"/> + <option name="teardown-command" value="settings delete system show_touches"/> + <option name="teardown-command" value="settings delete system pointer_location"/> + <option name="teardown-command" + value="cmd overlay enable com.android.internal.systemui.navbar.gestural"/> + </target_preparer> + <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller"> + <option name="cleanup-apks" value="true"/> + <option name="test-file-name" value="{MODULE}.apk"/> + <option name="test-file-name" value="FlickerTestApp.apk"/> + </target_preparer> + <!-- Needed for pushing the trace config file --> + <target_preparer class="com.android.tradefed.targetprep.RootTargetPreparer"/> + <target_preparer class="com.android.tradefed.targetprep.PushFilePreparer"> + <option name="push-file" + key="trace_config.textproto" + value="/data/misc/perfetto-traces/trace_config.textproto" + /> + <!--Install the content provider automatically when we push some file in sdcard folder.--> + <!--Needed to avoid the installation during the test suite.--> + <option name="push-file" key="trace_config.textproto" value="/sdcard/sample.textproto"/> + </target_preparer> + <test class="com.android.tradefed.testtype.AndroidJUnitTest"> + <option name="package" value="{PACKAGE}"/> + <option name="shell-timeout" value="6600s"/> + <option name="test-timeout" value="6600s"/> + <option name="hidden-api-checks" value="false"/> + <option name="device-listeners" value="android.device.collectors.PerfettoListener"/> + <!-- PerfettoListener related arguments --> + <option name="instrumentation-arg" key="perfetto_config_text_proto" value="true"/> + <option name="instrumentation-arg" + key="perfetto_config_file" + value="trace_config.textproto" + /> + <option name="instrumentation-arg" key="per_run" value="true"/> + </test> + <!-- Needed for pulling the collected trace config on to the host --> + <metrics_collector class="com.android.tradefed.device.metric.FilePullerLogCollector"> + <option name="pull-pattern-keys" value="perfetto_file_path"/> + <option name="directory-keys" + value="/data/user/0/com.android.server.wm.flicker.quickswitch/files"/> + <option name="collect-on-run-ended-only" value="true"/> + <option name="clean-up" value="true"/> + </metrics_collector> +</configuration> diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/quickswitch/OWNERS b/tests/FlickerTests/QuickSwitch/OWNERS index 897fe5dee7fb..897fe5dee7fb 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/quickswitch/OWNERS +++ b/tests/FlickerTests/QuickSwitch/OWNERS diff --git a/tests/FlickerTests/QuickSwitch/res/anim/show_hide_show_3000ms.xml b/tests/FlickerTests/QuickSwitch/res/anim/show_hide_show_3000ms.xml new file mode 100644 index 000000000000..7b3f07e3a2f5 --- /dev/null +++ b/tests/FlickerTests/QuickSwitch/res/anim/show_hide_show_3000ms.xml @@ -0,0 +1,31 @@ +<!-- + ~ Copyright (C) 2022 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. + --> + +<set + xmlns:android="http://schemas.android.com/apk/res/android" + android:fillAfter="true"> + + <alpha + android:fromAlpha="1.0" + android:toAlpha="0.0" + android:duration="1000" /> + + <alpha + android:startOffset="2000" + android:fromAlpha="1.0" + android:toAlpha="1.0" + android:duration="1000" /> +</set>
\ No newline at end of file diff --git a/tests/FlickerTests/QuickSwitch/res/xml/network_security_config.xml b/tests/FlickerTests/QuickSwitch/res/xml/network_security_config.xml new file mode 100644 index 000000000000..4bd9ca049f55 --- /dev/null +++ b/tests/FlickerTests/QuickSwitch/res/xml/network_security_config.xml @@ -0,0 +1,22 @@ +<?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. + --> + +<network-security-config> + <domain-config cleartextTrafficPermitted="true"> + <domain includeSubdomains="true">localhost</domain> + </domain-config> +</network-security-config> diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/quickswitch/QuickSwitchBetweenTwoAppsBackTest.kt b/tests/FlickerTests/QuickSwitch/src/com/android/server/wm/flicker/quickswitch/QuickSwitchBetweenTwoAppsBackTest.kt index 13fcc2ba0b54..13fcc2ba0b54 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/quickswitch/QuickSwitchBetweenTwoAppsBackTest.kt +++ b/tests/FlickerTests/QuickSwitch/src/com/android/server/wm/flicker/quickswitch/QuickSwitchBetweenTwoAppsBackTest.kt diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/quickswitch/QuickSwitchBetweenTwoAppsForwardTest.kt b/tests/FlickerTests/QuickSwitch/src/com/android/server/wm/flicker/quickswitch/QuickSwitchBetweenTwoAppsForwardTest.kt index badd7c8c712c..badd7c8c712c 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/quickswitch/QuickSwitchBetweenTwoAppsForwardTest.kt +++ b/tests/FlickerTests/QuickSwitch/src/com/android/server/wm/flicker/quickswitch/QuickSwitchBetweenTwoAppsForwardTest.kt diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/quickswitch/QuickSwitchFromLauncherTest.kt b/tests/FlickerTests/QuickSwitch/src/com/android/server/wm/flicker/quickswitch/QuickSwitchFromLauncherTest.kt index f51be908750a..f51be908750a 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/quickswitch/QuickSwitchFromLauncherTest.kt +++ b/tests/FlickerTests/QuickSwitch/src/com/android/server/wm/flicker/quickswitch/QuickSwitchFromLauncherTest.kt diff --git a/tests/FlickerTests/QuickSwitch/trace_config/trace_config.textproto b/tests/FlickerTests/QuickSwitch/trace_config/trace_config.textproto new file mode 100644 index 000000000000..c9a35aca9085 --- /dev/null +++ b/tests/FlickerTests/QuickSwitch/trace_config/trace_config.textproto @@ -0,0 +1,77 @@ +# 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. + +# proto-message: TraceConfig + +# Enable periodic flushing of the trace buffer into the output file. +write_into_file: true + +# Writes the userspace buffer into the file every 1s. +file_write_period_ms: 2500 + +# See b/126487238 - we need to guarantee ordering of events. +flush_period_ms: 30000 + +# The trace buffers needs to be big enough to hold |file_write_period_ms| of +# trace data. The trace buffer sizing depends on the number of trace categories +# enabled and the device activity. + +# RSS events +buffers: { + size_kb: 63488 + fill_policy: RING_BUFFER +} + +data_sources { + config { + name: "linux.process_stats" + target_buffer: 0 + # polled per-process memory counters and process/thread names. + # If you don't want the polled counters, remove the "process_stats_config" + # section, but keep the data source itself as it still provides on-demand + # thread/process naming for ftrace data below. + process_stats_config { + scan_all_processes_on_start: true + } + } +} + +data_sources: { + config { + name: "linux.ftrace" + ftrace_config { + ftrace_events: "ftrace/print" + ftrace_events: "task/task_newtask" + ftrace_events: "task/task_rename" + atrace_categories: "ss" + atrace_categories: "wm" + atrace_categories: "am" + atrace_categories: "aidl" + atrace_categories: "input" + atrace_categories: "binder_driver" + atrace_categories: "sched_process_exit" + atrace_apps: "com.android.server.wm.flicker" + atrace_apps: "com.android.server.wm.flicker.other" + atrace_apps: "com.android.server.wm.flicker.close" + atrace_apps: "com.android.server.wm.flicker.ime" + atrace_apps: "com.android.server.wm.flicker.launch" + atrace_apps: "com.android.server.wm.flicker.quickswitch" + atrace_apps: "com.android.server.wm.flicker.rotation" + atrace_apps: "com.android.server.wm.flicker.testapp" + atrace_apps: "com.android.systemui" + atrace_apps: "com.google.android.apps.nexuslauncher" + } + } +} + diff --git a/tests/FlickerTests/Rotation/Android.bp b/tests/FlickerTests/Rotation/Android.bp new file mode 100644 index 000000000000..8e93b5b340c4 --- /dev/null +++ b/tests/FlickerTests/Rotation/Android.bp @@ -0,0 +1,33 @@ +// +// Copyright (C) 2018 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 { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "frameworks_base_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["frameworks_base_license"], +} + +android_test { + name: "FlickerTestsRotation", + defaults: ["FlickerTestsDefault"], + manifest: "AndroidManifest.xml", + test_config_template: "AndroidTestTemplate.xml", + srcs: ["src/**/*"], + static_libs: ["FlickerTestsBase"], +} diff --git a/tests/FlickerTests/Rotation/AndroidManifest.xml b/tests/FlickerTests/Rotation/AndroidManifest.xml new file mode 100644 index 000000000000..6bbb1f6c0d08 --- /dev/null +++ b/tests/FlickerTests/Rotation/AndroidManifest.xml @@ -0,0 +1,67 @@ +<?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. + --> + +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools" + package="com.android.server.wm.flicker.rotation"> + + <uses-sdk android:minSdkVersion="29" android:targetSdkVersion="29"/> + <!-- Read and write traces from external storage --> + <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> + <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> + <!-- Allow the test to write directly to /sdcard/ --> + <uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" /> + <!-- Write secure settings --> + <uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS" /> + <!-- Capture screen contents --> + <uses-permission android:name="android.permission.ACCESS_SURFACE_FLINGER" /> + <!-- Enable / Disable tracing !--> + <uses-permission android:name="android.permission.DUMP" /> + <!-- Force-stop test apps --> + <uses-permission android:name="android.permission.FORCE_STOP_PACKAGES"/> + <!-- Run layers trace --> + <uses-permission android:name="android.permission.HARDWARE_TEST"/> + <!-- Capture screen recording --> + <uses-permission android:name="android.permission.CAPTURE_VIDEO_OUTPUT"/> + <!-- Workaround grant runtime permission exception from b/152733071 --> + <uses-permission android:name="android.permission.PACKAGE_USAGE_STATS"/> + <uses-permission android:name="android.permission.READ_LOGS"/> + <!-- ATM.removeRootTasksWithActivityTypes() --> + <uses-permission android:name="android.permission.MANAGE_ACTIVITY_TASKS" /> + <!-- ActivityOptions.makeCustomTaskAnimation() --> + <uses-permission android:name="android.permission.START_TASKS_FROM_RECENTS" /> + <!-- Allow the test to connect to perfetto trace processor --> + <uses-permission android:name="android.permission.INTERNET"/> + <!-- Allow the test to write directly to /sdcard/ and connect to trace processor --> + <application android:requestLegacyExternalStorage="true" + android:networkSecurityConfig="@xml/network_security_config" + android:largeHeap="true"> + <uses-library android:name="android.test.runner"/> + <uses-library android:name="androidx.window.extensions" android:required="false"/> + + <!-- (b/197936012) Remove startup provider due to test timeout issue --> + <provider + android:name="androidx.startup.InitializationProvider" + android:authorities="${applicationId}.androidx-startup" + tools:node="remove" /> + </application> + + <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner" + android:targetPackage="com.android.server.wm.flicker.rotation" + android:label="WindowManager Flicker Tests"> + </instrumentation> +</manifest> diff --git a/tests/FlickerTests/Rotation/AndroidTestTemplate.xml b/tests/FlickerTests/Rotation/AndroidTestTemplate.xml new file mode 100644 index 000000000000..b5ea7390e9ba --- /dev/null +++ b/tests/FlickerTests/Rotation/AndroidTestTemplate.xml @@ -0,0 +1,90 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Copyright 2018 Google Inc. All Rights Reserved. + --> +<configuration description="Runs WindowManager {MODULE}"> + <option name="test-tag" value="FlickerTests"/> + <!-- Needed for storing the perfetto trace files in the sdcard/test_results--> + <option name="isolated-storage" value="false"/> + + <target_preparer class="com.android.tradefed.targetprep.DeviceSetup"> + <!-- keeps the screen on during tests --> + <option name="screen-always-on" value="on"/> + <!-- prevents the phone from restarting --> + <option name="force-skip-system-props" value="true"/> + <!-- set WM tracing verbose level to all --> + <option name="run-command" value="cmd window tracing level all"/> + <!-- set WM tracing to frame (avoid incomplete states) --> + <option name="run-command" value="cmd window tracing frame"/> + <!-- ensure lock screen mode is swipe --> + <option name="run-command" value="locksettings set-disabled false"/> + <!-- disable betterbug as it's log collection dialogues cause flakes in e2e tests --> + <option name="run-command" value="pm disable com.google.android.internal.betterbug"/> + <!-- restart launcher to activate TAPL --> + <option name="run-command" + value="setprop ro.test_harness 1 ; am force-stop com.google.android.apps.nexuslauncher"/> + <!-- Increase trace size: 20mb for WM and 80mb for SF --> + <option name="run-command" value="cmd window tracing size 20480"/> + <option name="run-command" value="su root service call SurfaceFlinger 1029 i32 81920"/> + <!-- b/307664397 - Ensure camera has the correct permissions and doesn't show a dialog --> + <option name="run-command" + value="pm grant com.google.android.GoogleCamera android.permission.CAMERA"/> + <option name="run-command" + value="pm grant com.google.android.GoogleCamera android.permission.RECORD_AUDIO"/> + <option name="run-command" + value="pm grant com.google.android.GoogleCamera android.permission.ACCESS_FINE_LOCATION"/> + <option name="run-command" + value="pm grant com.google.android.GoogleCamera android.permission.ACCESS_COARSE_LOCATION"/> + </target_preparer> + <target_preparer class="com.android.tradefed.targetprep.RunCommandTargetPreparer"> + <option name="test-user-token" value="%TEST_USER%"/> + <option name="run-command" value="rm -rf /data/user/%TEST_USER%/files/*"/> + <option name="run-command" value="settings put secure show_ime_with_hard_keyboard 1"/> + <option name="run-command" value="settings put system show_touches 1"/> + <option name="run-command" value="settings put system pointer_location 1"/> + <option name="teardown-command" + value="settings delete secure show_ime_with_hard_keyboard"/> + <option name="teardown-command" value="settings delete system show_touches"/> + <option name="teardown-command" value="settings delete system pointer_location"/> + <option name="teardown-command" + value="cmd overlay enable com.android.internal.systemui.navbar.gestural"/> + </target_preparer> + <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller"> + <option name="cleanup-apks" value="true"/> + <option name="test-file-name" value="{MODULE}.apk"/> + <option name="test-file-name" value="FlickerTestApp.apk"/> + </target_preparer> + <!-- Needed for pushing the trace config file --> + <target_preparer class="com.android.tradefed.targetprep.RootTargetPreparer"/> + <target_preparer class="com.android.tradefed.targetprep.PushFilePreparer"> + <option name="push-file" + key="trace_config.textproto" + value="/data/misc/perfetto-traces/trace_config.textproto" + /> + <!--Install the content provider automatically when we push some file in sdcard folder.--> + <!--Needed to avoid the installation during the test suite.--> + <option name="push-file" key="trace_config.textproto" value="/sdcard/sample.textproto"/> + </target_preparer> + <test class="com.android.tradefed.testtype.AndroidJUnitTest"> + <option name="package" value="{PACKAGE}"/> + <option name="shell-timeout" value="6600s"/> + <option name="test-timeout" value="6600s"/> + <option name="hidden-api-checks" value="false"/> + <option name="device-listeners" value="android.device.collectors.PerfettoListener"/> + <!-- PerfettoListener related arguments --> + <option name="instrumentation-arg" key="perfetto_config_text_proto" value="true"/> + <option name="instrumentation-arg" + key="perfetto_config_file" + value="trace_config.textproto" + /> + <option name="instrumentation-arg" key="per_run" value="true"/> + </test> + <!-- Needed for pulling the collected trace config on to the host --> + <metrics_collector class="com.android.tradefed.device.metric.FilePullerLogCollector"> + <option name="pull-pattern-keys" value="perfetto_file_path"/> + <option name="directory-keys" + value="/data/user/0/com.android.server.wm.flicker.rotation/files"/> + <option name="collect-on-run-ended-only" value="true"/> + <option name="clean-up" value="true"/> + </metrics_collector> +</configuration> diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/rotation/OWNERS b/tests/FlickerTests/Rotation/OWNERS index f7c0a87f5dac..f7c0a87f5dac 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/rotation/OWNERS +++ b/tests/FlickerTests/Rotation/OWNERS diff --git a/tests/FlickerTests/Rotation/res/anim/show_hide_show_3000ms.xml b/tests/FlickerTests/Rotation/res/anim/show_hide_show_3000ms.xml new file mode 100644 index 000000000000..7b3f07e3a2f5 --- /dev/null +++ b/tests/FlickerTests/Rotation/res/anim/show_hide_show_3000ms.xml @@ -0,0 +1,31 @@ +<!-- + ~ Copyright (C) 2022 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. + --> + +<set + xmlns:android="http://schemas.android.com/apk/res/android" + android:fillAfter="true"> + + <alpha + android:fromAlpha="1.0" + android:toAlpha="0.0" + android:duration="1000" /> + + <alpha + android:startOffset="2000" + android:fromAlpha="1.0" + android:toAlpha="1.0" + android:duration="1000" /> +</set>
\ No newline at end of file diff --git a/tests/FlickerTests/Rotation/res/xml/network_security_config.xml b/tests/FlickerTests/Rotation/res/xml/network_security_config.xml new file mode 100644 index 000000000000..4bd9ca049f55 --- /dev/null +++ b/tests/FlickerTests/Rotation/res/xml/network_security_config.xml @@ -0,0 +1,22 @@ +<?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. + --> + +<network-security-config> + <domain-config cleartextTrafficPermitted="true"> + <domain includeSubdomains="true">localhost</domain> + </domain-config> +</network-security-config> diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/rotation/ChangeAppRotationTest.kt b/tests/FlickerTests/Rotation/src/com/android/server/wm/flicker/rotation/ChangeAppRotationTest.kt index bdbf0d24e624..bdbf0d24e624 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/rotation/ChangeAppRotationTest.kt +++ b/tests/FlickerTests/Rotation/src/com/android/server/wm/flicker/rotation/ChangeAppRotationTest.kt diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/rotation/RotationTransition.kt b/tests/FlickerTests/Rotation/src/com/android/server/wm/flicker/rotation/RotationTransition.kt index b0ca4d230e12..b0ca4d230e12 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/rotation/RotationTransition.kt +++ b/tests/FlickerTests/Rotation/src/com/android/server/wm/flicker/rotation/RotationTransition.kt diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/rotation/SeamlessAppRotationTest.kt b/tests/FlickerTests/Rotation/src/com/android/server/wm/flicker/rotation/SeamlessAppRotationTest.kt index 6d3ae43c1472..6d3ae43c1472 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/rotation/SeamlessAppRotationTest.kt +++ b/tests/FlickerTests/Rotation/src/com/android/server/wm/flicker/rotation/SeamlessAppRotationTest.kt diff --git a/tests/FlickerTests/Rotation/trace_config/trace_config.textproto b/tests/FlickerTests/Rotation/trace_config/trace_config.textproto new file mode 100644 index 000000000000..c9a35aca9085 --- /dev/null +++ b/tests/FlickerTests/Rotation/trace_config/trace_config.textproto @@ -0,0 +1,77 @@ +# 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. + +# proto-message: TraceConfig + +# Enable periodic flushing of the trace buffer into the output file. +write_into_file: true + +# Writes the userspace buffer into the file every 1s. +file_write_period_ms: 2500 + +# See b/126487238 - we need to guarantee ordering of events. +flush_period_ms: 30000 + +# The trace buffers needs to be big enough to hold |file_write_period_ms| of +# trace data. The trace buffer sizing depends on the number of trace categories +# enabled and the device activity. + +# RSS events +buffers: { + size_kb: 63488 + fill_policy: RING_BUFFER +} + +data_sources { + config { + name: "linux.process_stats" + target_buffer: 0 + # polled per-process memory counters and process/thread names. + # If you don't want the polled counters, remove the "process_stats_config" + # section, but keep the data source itself as it still provides on-demand + # thread/process naming for ftrace data below. + process_stats_config { + scan_all_processes_on_start: true + } + } +} + +data_sources: { + config { + name: "linux.ftrace" + ftrace_config { + ftrace_events: "ftrace/print" + ftrace_events: "task/task_newtask" + ftrace_events: "task/task_rename" + atrace_categories: "ss" + atrace_categories: "wm" + atrace_categories: "am" + atrace_categories: "aidl" + atrace_categories: "input" + atrace_categories: "binder_driver" + atrace_categories: "sched_process_exit" + atrace_apps: "com.android.server.wm.flicker" + atrace_apps: "com.android.server.wm.flicker.other" + atrace_apps: "com.android.server.wm.flicker.close" + atrace_apps: "com.android.server.wm.flicker.ime" + atrace_apps: "com.android.server.wm.flicker.launch" + atrace_apps: "com.android.server.wm.flicker.quickswitch" + atrace_apps: "com.android.server.wm.flicker.rotation" + atrace_apps: "com.android.server.wm.flicker.testapp" + atrace_apps: "com.android.systemui" + atrace_apps: "com.google.android.apps.nexuslauncher" + } + } +} + diff --git a/tests/FlickerTests/manifests/AndroidManifestNotification.xml b/tests/FlickerTests/manifests/AndroidManifestNotification.xml deleted file mode 100644 index ad33deef8cc3..000000000000 --- a/tests/FlickerTests/manifests/AndroidManifestNotification.xml +++ /dev/null @@ -1,24 +0,0 @@ -<!-- - ~ Copyright (C) 2023 The Android Open Source Project - ~ - ~ Licensed under the Apache License, Version 2.0 (the "License"); - ~ you may not use this file except in compliance with the License. - ~ You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License. - --> - -<manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.android.server.wm.flicker.close"> - - <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner" - android:targetPackage="com.android.server.wm.flicker.notification" - android:label="WindowManager Flicker Tests"> - </instrumentation> -</manifest> diff --git a/tests/FlickerTests/manifests/AndroidManifestQuickswitch.xml b/tests/FlickerTests/manifests/AndroidManifestQuickswitch.xml deleted file mode 100644 index 203035d30584..000000000000 --- a/tests/FlickerTests/manifests/AndroidManifestQuickswitch.xml +++ /dev/null @@ -1,24 +0,0 @@ -<!-- - ~ Copyright (C) 2023 The Android Open Source Project - ~ - ~ Licensed under the Apache License, Version 2.0 (the "License"); - ~ you may not use this file except in compliance with the License. - ~ You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License. - --> - -<manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.android.server.wm.flicker.quickswitch"> - - <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner" - android:targetPackage="com.android.server.wm.flicker.quickswitch" - android:label="WindowManager Flicker Tests"> - </instrumentation> -</manifest> diff --git a/tests/FlickerTests/manifests/AndroidManifestRotation.xml b/tests/FlickerTests/manifests/AndroidManifestRotation.xml deleted file mode 100644 index 2852cf23a35b..000000000000 --- a/tests/FlickerTests/manifests/AndroidManifestRotation.xml +++ /dev/null @@ -1,24 +0,0 @@ -<!-- - ~ Copyright (C) 2023 The Android Open Source Project - ~ - ~ Licensed under the Apache License, Version 2.0 (the "License"); - ~ you may not use this file except in compliance with the License. - ~ You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License. - --> - -<manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.android.server.wm.flicker.rotation"> - - <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner" - android:targetPackage="com.android.server.wm.flicker.rotation" - android:label="WindowManager Flicker Tests"> - </instrumentation> -</manifest> diff --git a/tests/FlickerTests/manifests/AndroidManifestService.xml b/tests/FlickerTests/manifests/AndroidManifestService.xml deleted file mode 100644 index 3a7bc5095c08..000000000000 --- a/tests/FlickerTests/manifests/AndroidManifestService.xml +++ /dev/null @@ -1,24 +0,0 @@ -<!-- - ~ Copyright (C) 2023 The Android Open Source Project - ~ - ~ Licensed under the Apache License, Version 2.0 (the "License"); - ~ you may not use this file except in compliance with the License. - ~ You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License. - --> - -<manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.android.server.wm.flicker.service"> - - <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner" - android:targetPackage="com.android.server.wm.flicker.service" - android:label="WindowManager Flicker Service Tests"> - </instrumentation> -</manifest> diff --git a/tests/FlickerTests/test-apps/app-helpers/Android.bp b/tests/FlickerTests/test-apps/app-helpers/Android.bp new file mode 100644 index 000000000000..fc4d71c652d5 --- /dev/null +++ b/tests/FlickerTests/test-apps/app-helpers/Android.bp @@ -0,0 +1,42 @@ +// +// Copyright (C) 2018 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 { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "frameworks_base_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["frameworks_base_license"], +} + +java_library { + name: "wm-flicker-common-app-helpers", + platform_apis: true, + optimize: { + enabled: false, + }, + srcs: ["src/**/*"], + static_libs: [ + "flickertestapplib", + "flickerlib", + "flickerlib-apphelpers", + "flickerlib-helpers", + "truth", + "app-helpers-core", + "wm-flicker-window-extensions", + ], +} diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/ActivityEmbeddingAppHelper.kt b/tests/FlickerTests/test-apps/app-helpers/src/com/android/server/wm/flicker/helpers/ActivityEmbeddingAppHelper.kt index 11e6bbe4eb13..11e6bbe4eb13 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/ActivityEmbeddingAppHelper.kt +++ b/tests/FlickerTests/test-apps/app-helpers/src/com/android/server/wm/flicker/helpers/ActivityEmbeddingAppHelper.kt diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/AppPairsHelper.kt b/tests/FlickerTests/test-apps/app-helpers/src/com/android/server/wm/flicker/helpers/AppPairsHelper.kt index 94ac1a6e1e02..94ac1a6e1e02 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/AppPairsHelper.kt +++ b/tests/FlickerTests/test-apps/app-helpers/src/com/android/server/wm/flicker/helpers/AppPairsHelper.kt diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/AssistantAppHelper.kt b/tests/FlickerTests/test-apps/app-helpers/src/com/android/server/wm/flicker/helpers/AssistantAppHelper.kt index fde098199042..fde098199042 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/AssistantAppHelper.kt +++ b/tests/FlickerTests/test-apps/app-helpers/src/com/android/server/wm/flicker/helpers/AssistantAppHelper.kt diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/FixedOrientationAppHelper.kt b/tests/FlickerTests/test-apps/app-helpers/src/com/android/server/wm/flicker/helpers/FixedOrientationAppHelper.kt index c6fa1bb89220..c6fa1bb89220 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/FixedOrientationAppHelper.kt +++ b/tests/FlickerTests/test-apps/app-helpers/src/com/android/server/wm/flicker/helpers/FixedOrientationAppHelper.kt diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/FlickerExtensions.kt b/tests/FlickerTests/test-apps/app-helpers/src/com/android/server/wm/flicker/helpers/FlickerExtensions.kt index 5c8cbe49d7cf..5c8cbe49d7cf 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/FlickerExtensions.kt +++ b/tests/FlickerTests/test-apps/app-helpers/src/com/android/server/wm/flicker/helpers/FlickerExtensions.kt diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/GameAppHelper.kt b/tests/FlickerTests/test-apps/app-helpers/src/com/android/server/wm/flicker/helpers/GameAppHelper.kt index 3146139757c1..3146139757c1 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/GameAppHelper.kt +++ b/tests/FlickerTests/test-apps/app-helpers/src/com/android/server/wm/flicker/helpers/GameAppHelper.kt diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/GestureHelper.java b/tests/FlickerTests/test-apps/app-helpers/src/com/android/server/wm/flicker/helpers/GestureHelper.java index eeee7b4dfc6b..eeee7b4dfc6b 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/GestureHelper.java +++ b/tests/FlickerTests/test-apps/app-helpers/src/com/android/server/wm/flicker/helpers/GestureHelper.java diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/ImeAppHelper.kt b/tests/FlickerTests/test-apps/app-helpers/src/com/android/server/wm/flicker/helpers/ImeAppHelper.kt index 252f7d3e1bed..252f7d3e1bed 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/ImeAppHelper.kt +++ b/tests/FlickerTests/test-apps/app-helpers/src/com/android/server/wm/flicker/helpers/ImeAppHelper.kt diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/ImeEditorPopupDialogAppHelper.kt b/tests/FlickerTests/test-apps/app-helpers/src/com/android/server/wm/flicker/helpers/ImeEditorPopupDialogAppHelper.kt index 7a8d780c3d9f..7a8d780c3d9f 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/ImeEditorPopupDialogAppHelper.kt +++ b/tests/FlickerTests/test-apps/app-helpers/src/com/android/server/wm/flicker/helpers/ImeEditorPopupDialogAppHelper.kt diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/ImeShownOnAppStartHelper.kt b/tests/FlickerTests/test-apps/app-helpers/src/com/android/server/wm/flicker/helpers/ImeShownOnAppStartHelper.kt index e106f656ec64..d3cee645cd99 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/ImeShownOnAppStartHelper.kt +++ b/tests/FlickerTests/test-apps/app-helpers/src/com/android/server/wm/flicker/helpers/ImeShownOnAppStartHelper.kt @@ -121,7 +121,7 @@ constructor( else -> null } if (matcher != null && matcher.find()) { - return matcher.group(1).equals("VISIBLE") + return matcher.group(1) == "VISIBLE" } } return false diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/ImeStateInitializeHelper.kt b/tests/FlickerTests/test-apps/app-helpers/src/com/android/server/wm/flicker/helpers/ImeStateInitializeHelper.kt index b2aeb14aaf78..b2aeb14aaf78 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/ImeStateInitializeHelper.kt +++ b/tests/FlickerTests/test-apps/app-helpers/src/com/android/server/wm/flicker/helpers/ImeStateInitializeHelper.kt diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/LaunchBubbleHelper.kt b/tests/FlickerTests/test-apps/app-helpers/src/com/android/server/wm/flicker/helpers/LaunchBubbleHelper.kt index b95d86b72f34..b95d86b72f34 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/LaunchBubbleHelper.kt +++ b/tests/FlickerTests/test-apps/app-helpers/src/com/android/server/wm/flicker/helpers/LaunchBubbleHelper.kt diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/LetterboxAppHelper.kt b/tests/FlickerTests/test-apps/app-helpers/src/com/android/server/wm/flicker/helpers/LetterboxAppHelper.kt index 9b539c8641d4..9b539c8641d4 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/LetterboxAppHelper.kt +++ b/tests/FlickerTests/test-apps/app-helpers/src/com/android/server/wm/flicker/helpers/LetterboxAppHelper.kt diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/MailAppHelper.kt b/tests/FlickerTests/test-apps/app-helpers/src/com/android/server/wm/flicker/helpers/MailAppHelper.kt index 9895bda7f590..9895bda7f590 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/MailAppHelper.kt +++ b/tests/FlickerTests/test-apps/app-helpers/src/com/android/server/wm/flicker/helpers/MailAppHelper.kt diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/MultiWindowUtils.kt b/tests/FlickerTests/test-apps/app-helpers/src/com/android/server/wm/flicker/helpers/MultiWindowUtils.kt index 65175ef33afb..65175ef33afb 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/MultiWindowUtils.kt +++ b/tests/FlickerTests/test-apps/app-helpers/src/com/android/server/wm/flicker/helpers/MultiWindowUtils.kt diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/NewTasksAppHelper.kt b/tests/FlickerTests/test-apps/app-helpers/src/com/android/server/wm/flicker/helpers/NewTasksAppHelper.kt index b2f8d4748c07..b2f8d4748c07 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/NewTasksAppHelper.kt +++ b/tests/FlickerTests/test-apps/app-helpers/src/com/android/server/wm/flicker/helpers/NewTasksAppHelper.kt diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/NonResizeableAppHelper.kt b/tests/FlickerTests/test-apps/app-helpers/src/com/android/server/wm/flicker/helpers/NonResizeableAppHelper.kt index ee65004e9e78..ee65004e9e78 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/NonResizeableAppHelper.kt +++ b/tests/FlickerTests/test-apps/app-helpers/src/com/android/server/wm/flicker/helpers/NonResizeableAppHelper.kt diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/NotificationAppHelper.kt b/tests/FlickerTests/test-apps/app-helpers/src/com/android/server/wm/flicker/helpers/NotificationAppHelper.kt index e60c20df9967..e60c20df9967 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/NotificationAppHelper.kt +++ b/tests/FlickerTests/test-apps/app-helpers/src/com/android/server/wm/flicker/helpers/NotificationAppHelper.kt diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/PipAppHelper.kt b/tests/FlickerTests/test-apps/app-helpers/src/com/android/server/wm/flicker/helpers/PipAppHelper.kt index da51eff24dc1..73cc2f2b4d18 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/PipAppHelper.kt +++ b/tests/FlickerTests/test-apps/app-helpers/src/com/android/server/wm/flicker/helpers/PipAppHelper.kt @@ -250,11 +250,12 @@ open class PipAppHelper(instrumentation: Instrumentation) : launchedAppComponentMatcherOverride, action, stringExtras, - waitConditionsBuilder = wmHelper - .StateSyncBuilder() - .add(ConditionsFactory.isWMStateComplete()) - .withAppTransitionIdle() - .add(ConditionsFactory.hasPipWindow()) + waitConditionsBuilder = + wmHelper + .StateSyncBuilder() + .add(ConditionsFactory.isWMStateComplete()) + .withAppTransitionIdle() + .add(ConditionsFactory.hasPipWindow()) ) wmHelper @@ -265,8 +266,7 @@ open class PipAppHelper(instrumentation: Instrumentation) : } /** Expand the PIP window back to full screen via intent and wait until the app is visible */ - fun exitPipToFullScreenViaIntent(wmHelper: WindowManagerStateHelper) = - launchViaIntent(wmHelper) + fun exitPipToFullScreenViaIntent(wmHelper: WindowManagerStateHelper) = launchViaIntent(wmHelper) fun changeAspectRatio() { val intent = Intent("com.android.wm.shell.flicker.testapp.ASPECT_RATIO") diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/SeamlessRotationAppHelper.kt b/tests/FlickerTests/test-apps/app-helpers/src/com/android/server/wm/flicker/helpers/SeamlessRotationAppHelper.kt index cac3530399de..cac3530399de 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/SeamlessRotationAppHelper.kt +++ b/tests/FlickerTests/test-apps/app-helpers/src/com/android/server/wm/flicker/helpers/SeamlessRotationAppHelper.kt diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/ShowWhenLockedAppHelper.kt b/tests/FlickerTests/test-apps/app-helpers/src/com/android/server/wm/flicker/helpers/ShowWhenLockedAppHelper.kt index 8366a7a1fe41..8366a7a1fe41 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/ShowWhenLockedAppHelper.kt +++ b/tests/FlickerTests/test-apps/app-helpers/src/com/android/server/wm/flicker/helpers/ShowWhenLockedAppHelper.kt diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/SimpleAppHelper.kt b/tests/FlickerTests/test-apps/app-helpers/src/com/android/server/wm/flicker/helpers/SimpleAppHelper.kt index 89c6c35af47d..89c6c35af47d 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/SimpleAppHelper.kt +++ b/tests/FlickerTests/test-apps/app-helpers/src/com/android/server/wm/flicker/helpers/SimpleAppHelper.kt diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/TransferSplashscreenAppHelper.kt b/tests/FlickerTests/test-apps/app-helpers/src/com/android/server/wm/flicker/helpers/TransferSplashscreenAppHelper.kt index 6311678f1a04..6311678f1a04 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/TransferSplashscreenAppHelper.kt +++ b/tests/FlickerTests/test-apps/app-helpers/src/com/android/server/wm/flicker/helpers/TransferSplashscreenAppHelper.kt diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/TwoActivitiesAppHelper.kt b/tests/FlickerTests/test-apps/app-helpers/src/com/android/server/wm/flicker/helpers/TwoActivitiesAppHelper.kt index 8be5769f47cf..8be5769f47cf 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/TwoActivitiesAppHelper.kt +++ b/tests/FlickerTests/test-apps/app-helpers/src/com/android/server/wm/flicker/helpers/TwoActivitiesAppHelper.kt diff --git a/tools/fonts/update_font_metadata.py b/tools/fonts/update_font_metadata.py index c07a98a1e3d2..04a552886d42 100755 --- a/tools/fonts/update_font_metadata.py +++ b/tools/fonts/update_font_metadata.py @@ -19,7 +19,7 @@ def main(): args_parser.add_argument('--revision', help='Updated font revision. Use + to update revision based on the current revision') args = args_parser.parse_args() - font = ttLib.TTFont(args.input) + font = ttLib.TTFont(args.input, recalcTimestamp=False) update_font_revision(font, args.revision) font.save(args.output) |