1 /*
2  * Copyright (C) 2018 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package android.server.wm.app;
18 
19 import android.content.ComponentName;
20 import android.server.wm.TestJournalProvider;
21 import android.server.wm.component.ComponentsBase;
22 
23 public class Components extends ComponentsBase {
24     public static final ComponentName ALT_LAUNCHING_ACTIVITY = component("AltLaunchingActivity");
25     public static final ComponentName ALWAYS_FOCUSABLE_PIP_ACTIVITY =
26             component("AlwaysFocusablePipActivity");
27     public static final ComponentName ANIMATION_TEST_ACTIVITY = component("AnimationTestActivity");
28     public static final ComponentName ASSISTANT_ACTIVITY = component("AssistantActivity");
29     public static final ComponentName BOTTOM_ACTIVITY = component("BottomActivity");
30     public static final ComponentName BOTTOM_NON_RESIZABLE_ACTIVITY = component("BottomNonResizableActivity");
31     public static final ComponentName BOTTOM_LEFT_LAYOUT_ACTIVITY =
32             component("BottomLeftLayoutActivity");
33     public static final ComponentName BOTTOM_RIGHT_LAYOUT_ACTIVITY =
34             component("BottomRightLayoutActivity");
35     public static final ComponentName BROADCAST_RECEIVER_ACTIVITY =
36             component("BroadcastReceiverActivity");
37     public static final ComponentName DIALOG_WHEN_LARGE_ACTIVITY =
38             component("DialogWhenLargeActivity");
39     public static final ComponentName DISMISS_KEYGUARD_ACTIVITY =
40             component("DismissKeyguardActivity");
41     public static final ComponentName DISMISS_KEYGUARD_METHOD_ACTIVITY =
42             component("DismissKeyguardMethodActivity");
43     public static final ComponentName DOCKED_ACTIVITY = component("DockedActivity");
44     /**
45      * This activity is an alias activity pointing {@link TrampolineActivity}
46      * in AndroidManifest.xml
47      */
48     public static final ComponentName ENTRY_POINT_ALIAS_ACTIVITY =
49             component("EntryPointAliasActivity");
50     public static final ComponentName FONT_SCALE_ACTIVITY = component("FontScaleActivity");
51     public static final ComponentName FONT_SCALE_NO_RELAUNCH_ACTIVITY =
52             component("FontScaleNoRelaunchActivity");
53     public static final ComponentName FREEFORM_ACTIVITY = component("FreeformActivity");
54     public static final ComponentName HOST_ACTIVITY = component("HostActivity");
55     public static final ComponentName HIDE_OVERLAY_WINDOWS_ACTIVITY =
56             component("HideOverlayWindowsActivity");
57     public static final ComponentName KEYGUARD_LOCK_ACTIVITY = component("KeyguardLockActivity");
58     public static final ComponentName LANDSCAPE_ORIENTATION_ACTIVITY =
59             component("LandscapeOrientationActivity");
60     public static final ComponentName LAUNCH_ASSISTANT_ACTIVITY_FROM_SESSION =
61             component("LaunchAssistantActivityFromSession");
62     public static final ComponentName LAUNCH_ASSISTANT_ACTIVITY_INTO_STACK  =
63             component("LaunchAssistantActivityIntoAssistantStack");
64     public static final ComponentName LAUNCH_ENTER_PIP_ACTIVITY =
65             component("LaunchEnterPipActivity");
66     public static final ComponentName LAUNCH_INTO_PINNED_STACK_PIP_ACTIVITY =
67             component("LaunchIntoPinnedStackPipActivity");
68     public static final ComponentName LAUNCH_PIP_ON_PIP_ACTIVITY =
69             component("LaunchPipOnPipActivity");
70     public static final ComponentName LAUNCHING_ACTIVITY = component("LaunchingActivity");
71     public static final ComponentName LOG_CONFIGURATION_ACTIVITY =
72             component("LogConfigurationActivity");
73     public static final ComponentName MOVE_TASK_TO_BACK_ACTIVITY =
74             component("MoveTaskToBackActivity");
75     public static final ComponentName MULTI_WINDOW_FULLSCREEN_ACTIVITY =
76             component("MultiWindowFullscreenActivity");
77     public static final ComponentName NIGHT_MODE_ACTIVITY = component("NightModeActivity");
78     public static final ComponentName NO_DISPLAY_ACTIVITY = component("NoDisplayActivity");
79     public static final ComponentName NO_HISTORY_ACTIVITY = component("NoHistoryActivity");
80     public static final ComponentName NO_HISTORY_ACTIVITY2 = component("NoHistoryActivity2");
81     public static final ComponentName NO_RELAUNCH_ACTIVITY = component("NoRelaunchActivity");
82     public static final ComponentName NON_RESIZEABLE_ACTIVITY = component("NonResizeableActivity");
83     public static final ComponentName PRESENTATION_ACTIVITY = component("PresentationActivity");
84     public static final ComponentName PIP_ACTIVITY = component("PipActivity");
85     public static final ComponentName PIP_ACTIVITY2 = component("PipActivity2");
86     public static final ComponentName PIP_ACTIVITY_WITH_MINIMAL_SIZE = component(
87             "PipActivityWithMinimalSize");
88     public static final ComponentName PIP_ACTIVITY_WITH_TINY_MINIMAL_SIZE = component(
89             "PipActivityWithTinyMinimalSize");
90     public static final ComponentName PIP_ACTIVITY_WITH_SAME_AFFINITY =
91             component("PipActivityWithSameAffinity");
92     public static final ComponentName PIP_ON_STOP_ACTIVITY = component("PipOnStopActivity");
93     public static final ComponentName LAUNCH_INTO_PIP_HOST_ACTIVITY =
94             component("LaunchIntoPipHostActivity");
95     public static final ComponentName LAUNCH_INTO_PIP_CONTAINER_ACTIVITY =
96             component("LaunchIntoPipContainerActivity");
97     public static final ComponentName PORTRAIT_ORIENTATION_ACTIVITY =
98             component("PortraitOrientationActivity");
99     public static final ComponentName RECURSIVE_ACTIVITY = component("RecursiveActivity");
100     public static final ComponentName REPORT_FULLY_DRAWN_ACTIVITY =
101             component("ReportFullyDrawnActivity");
102     public static final ComponentName RESIZEABLE_ACTIVITY = component("ResizeableActivity");
103     public static final ComponentName RESUME_WHILE_PAUSING_ACTIVITY =
104             component("ResumeWhilePausingActivity");
105     public static final ComponentName SHOW_WHEN_LOCKED_ACTIVITY =
106             component("ShowWhenLockedActivity");
107     public static final ComponentName SHOW_WHEN_LOCKED_ATTR_IME_ACTIVITY =
108             component("ShowWhenLockedAttrImeActivity");
109     public static final ComponentName SHOW_WHEN_LOCKED_ATTR_ACTIVITY =
110             component("ShowWhenLockedAttrActivity");
111     public static final ComponentName SHOW_WHEN_LOCKED_ATTR_ROTATION_ACTIVITY =
112             component("ShowWhenLockedAttrRotationActivity");
113     public static final ComponentName SHOW_WHEN_LOCKED_ATTR_REMOVE_ATTR_ACTIVITY =
114             component("ShowWhenLockedAttrRemoveAttrActivity");
115     public static final ComponentName INHERIT_SHOW_WHEN_LOCKED_ADD_ACTIVITY =
116             component("InheritShowWhenLockedAddActivity");
117     public static final ComponentName INHERIT_SHOW_WHEN_LOCKED_ATTR_ACTIVITY =
118             component("InheritShowWhenLockedAttrActivity");
119     public static final ComponentName INHERIT_SHOW_WHEN_LOCKED_REMOVE_ACTIVITY =
120             component("InheritShowWhenLockedRemoveActivity");
121     public static final ComponentName NO_INHERIT_SHOW_WHEN_LOCKED_ATTR_ACTIVITY =
122             component("NoInheritShowWhenLockedAttrActivity");
123     public static final ComponentName SHOW_WHEN_LOCKED_DIALOG_ACTIVITY =
124             component("ShowWhenLockedDialogActivity");
125     public static final ComponentName SHOW_WHEN_LOCKED_TRANSLUCENT_ACTIVITY =
126             component("ShowWhenLockedTranslucentActivity");
127     public static final ComponentName SHOW_WHEN_LOCKED_WITH_DIALOG_ACTIVITY =
128             component("ShowWhenLockedWithDialogActivity");
129     public static final ComponentName SINGLE_INSTANCE_ACTIVITY =
130             component("SingleInstanceActivity");
131     public static final ComponentName HOME_ACTIVITY = component("HomeActivity");
132     public static final ComponentName SECONDARY_HOME_ACTIVITY = component("SecondaryHomeActivity");
133     public static final ComponentName UI_SCALING_TEST_ACTIVITY =
134             component("UiScalingTestActivity");
135     public static final ComponentName SINGLE_HOME_ACTIVITY = component("SingleHomeActivity");
136     public static final ComponentName SINGLE_SECONDARY_HOME_ACTIVITY =
137             component("SingleSecondaryHomeActivity");
138     public static final ComponentName SINGLE_TASK_ACTIVITY = component("SingleTaskActivity");
139     public static final ComponentName SINGLE_TOP_ACTIVITY = component("SingleTopActivity");
140     public static final ComponentName SPLASHSCREEN_ACTIVITY = component("SplashscreenActivity");
141     public static final ComponentName DISABLE_PREVIEW_ACTIVITY =
142             component("DisablePreviewActivity");
143     public static final ComponentName SHOW_WHEN_LOCKED_NO_PREVIEW_ACTIVITY =
144             component("ShowWhenLockedNoPreviewActivity");
145     public static final ComponentName SHOW_WHEN_LOCKED_ATTR_NO_PREVIEW_ACTIVITY =
146             component("ShowWhenLockedAttrNoPreviewActivity");
147     public static final ComponentName SHOW_WHEN_LOCKED_ATTR_REMOVE_ATTR_NO_PREVIEW_ACTIVITY =
148             component("ShowWhenLockedAttrRemoveAttrNoPreviewActivity");
149     public static final ComponentName SHOW_WHEN_LOCKED_WITH_DIALOG_NO_PREVIEW_ACTIVITY =
150             component("ShowWhenLockedWithDialogNoPreviewActivity");
151 
152     public static final ComponentName TEST_ACTIVITY = component("TestActivity");
153     public static final ComponentName TOAST_ACTIVITY = component("ToastActivity");
154     public static final ComponentName TOP_ACTIVITY = component("TopActivity");
155     public static final ComponentName TOP_NON_RESIZABLE_ACTIVITY = component("TopNonResizableActivity");
156     public static final ComponentName TOP_NON_RESIZABLE_WALLPAPER_ACTIVITY = component("TopNonResizableWallpaperActivity");
157     public static final ComponentName TOP_WALLPAPER_ACTIVITY = component("TopWallpaperActivity");
158     public static final ComponentName TEST_ACTIVITY_WITH_SAME_AFFINITY =
159             component("TestActivityWithSameAffinity");
160     public static final ComponentName TEST_LIVE_WALLPAPER_SERVICE = component("LiveWallpaper");
161     public static final ComponentName TEST_INTERACTIVE_LIVE_WALLPAPER_SERVICE = component(
162             "InteractiveLiveWallpaper");
163     public static final ComponentName TOP_LEFT_LAYOUT_ACTIVITY = component("TopLeftLayoutActivity");
164     public static final ComponentName TOP_RIGHT_LAYOUT_ACTIVITY =
165             component("TopRightLayoutActivity");
166     public static final ComponentName TRANSLUCENT_ACTIVITY = component("TranslucentActivity");
167     public static final ComponentName TRANSLUCENT_ASSISTANT_ACTIVITY =
168             component("TranslucentAssistantActivity");
169     public static final ComponentName TRANSLUCENT_TOP_ACTIVITY =
170             component("TranslucentTopActivity");
171     public static final ComponentName TRANSLUCENT_TOP_WALLPAPER_ACTIVITY =
172             component("TranslucentTopWallpaperActivity");
173     public static final ComponentName TRANSLUCENT_TOP_NON_RESIZABLE_ACTIVITY =
174         component("TranslucentTopNonResizableActivity");
175     public static final ComponentName TRANSLUCENT_TEST_ACTIVITY =
176             component("TranslucentTestActivity");
177     public static final ComponentName TURN_SCREEN_ON_ACTIVITY = component("TurnScreenOnActivity");
178     public static final ComponentName TURN_SCREEN_ON_ATTR_ACTIVITY =
179             component("TurnScreenOnAttrActivity");
180     public static final ComponentName TURN_SCREEN_ON_ATTR_DISMISS_KEYGUARD_ACTIVITY =
181             component("TurnScreenOnAttrDismissKeyguardActivity");
182     public static final ComponentName TURN_SCREEN_ON_ATTR_REMOVE_ATTR_ACTIVITY =
183             component("TurnScreenOnAttrRemoveAttrActivity");
184     public static final ComponentName TURN_SCREEN_ON_DISMISS_KEYGUARD_ACTIVITY =
185             component("TurnScreenOnDismissKeyguardActivity");
186     public static final ComponentName TURN_SCREEN_ON_SHOW_ON_LOCK_ACTIVITY =
187             component("TurnScreenOnShowOnLockActivity");
188     public static final ComponentName TURN_SCREEN_ON_SINGLE_TASK_ACTIVITY =
189             component("TurnScreenOnSingleTaskActivity");
190     public static final ComponentName TURN_SCREEN_ON_WITH_RELAYOUT_ACTIVITY =
191             component("TurnScreenOnWithRelayoutActivity");
192     public static final ComponentName UNRESPONSIVE_ACTIVITY = component("UnresponsiveActivity");
193     public static final ComponentName VIRTUAL_DISPLAY_ACTIVITY =
194             component("VirtualDisplayActivity");
195     public static final ComponentName VR_TEST_ACTIVITY = component("VrTestActivity");
196     public static final ComponentName WALLPAPAER_ACTIVITY = component("WallpaperActivity");
197     public static final ComponentName LAUNCH_TEST_ON_DESTROY_ACTIVITY = component(
198             "LaunchTestOnDestroyActivity");
199     public static final ComponentName ALIAS_TEST_ACTIVITY = component("AliasTestActivity");
200     public static final ComponentName DISPLAY_ACCESS_CHECK_EMBEDDING_ACTIVITY = component(
201             "DisplayAccessCheckEmbeddingActivity");
202     public static final ComponentName MAX_ASPECT_RATIO_ACTIVITY =
203             component("MaxAspectRatioActivity");
204     public static final ComponentName MAX_ASPECT_RATIO_RESIZABLE_ACTIVITY =
205             component("MaxAspectRatioResizableActivity");
206     public static final ComponentName MAX_ASPECT_RATIO_UNSET_ACTIVITY =
207             component("MaxAspectRatioUnsetActivity");
208     public static final ComponentName META_DATA_MAX_ASPECT_RATIO_ACTIVITY =
209             component("MetaDataMaxAspectRatioActivity");
210     public static final ComponentName MIN_ASPECT_RATIO_ACTIVITY =
211             component("MinAspectRatioActivity");
212     public static final ComponentName MIN_ASPECT_RATIO_LANDSCAPE_ACTIVITY =
213             component("MinAspectRatioLandscapeActivity");
214     public static final ComponentName MIN_ASPECT_RATIO_PORTRAIT_ACTIVITY =
215             component("MinAspectRatioPortraitActivity");
216     public static final ComponentName MIN_ASPECT_RATIO_UNSET_ACTIVITY =
217             component("MinAspectRatioUnsetActivity");
218 
219     public static final ComponentName ASSISTANT_VOICE_INTERACTION_SERVICE =
220             component("AssistantVoiceInteractionService");
221 
222     public static final ComponentName LAUNCH_BROADCAST_RECEIVER =
223             component("LaunchBroadcastReceiver");
224 
225     public static final ComponentName CLICKABLE_TOAST_ACTIVITY =
226             component("ClickableToastActivity");
227 
228     public static final ComponentName WALLPAPER_TARGET_ACTIVITY =
229             component("WallpaperTargetActivity");
230 
231     public static class LaunchBroadcastReceiver {
232         public static final String LAUNCH_BROADCAST_ACTION =
233                 "android.server.wm.app.LAUNCH_BROADCAST_ACTION";
234 
235         public static final String ACTION_TEST_ACTIVITY_START =
236                 "android.server.wm.app.ACTION_TEST_ACTIVITY_START";
237         public static final String EXTRA_COMPONENT_NAME = "component_name";
238         public static final String EXTRA_TARGET_DISPLAY = "target_display";
239     }
240 
241     public static final ComponentName SINGLE_TASK_INSTANCE_DISPLAY_ACTIVITY =
242             component("SingleTaskInstanceDisplayActivity");
243     public static final ComponentName SINGLE_TASK_INSTANCE_DISPLAY_ACTIVITY2 =
244             component("SingleTaskInstanceDisplayActivity2");
245     public static final ComponentName SINGLE_TASK_INSTANCE_DISPLAY_ACTIVITY3 =
246             component("SingleTaskInstanceDisplayActivity3");
247 
248     public static final ComponentName MPP_ACTIVITY =
249             component("MinimalPostProcessingActivity");
250 
251     public static final ComponentName MPP_ACTIVITY2 =
252             component("MinimalPostProcessingActivity2");
253 
254     public static final ComponentName MPP_ACTIVITY3 =
255             component("MinimalPostProcessingManifestActivity");
256 
257     public static final ComponentName POPUP_MPP_ACTIVITY =
258             component("PopupMinimalPostProcessingActivity");
259 
260     public static final ComponentName CRASHING_ACTIVITY =
261             component("CrashingActivity");
262 
263     public static final ComponentName HANDLE_SPLASH_SCREEN_EXIT_ACTIVITY =
264             component("HandleSplashScreenExitActivity");
265     public static final ComponentName SPLASH_SCREEN_REPLACE_ICON_ACTIVITY =
266             component("SplashScreenReplaceIconActivity");
267     public static final ComponentName SPLASH_SCREEN_REPLACE_THEME_ACTIVITY =
268             component("SplashScreenReplaceThemeActivity");
269     public static final ComponentName SPLASH_SCREEN_STYLE_THEME_ACTIVITY =
270             component("SplashScreenStyleThemeActivity");
271 
272     public static final ComponentName TEST_DREAM_SERVICE =
273             component("TestDream");
274 
275     public static final ComponentName TEST_STUBBORN_DREAM_SERVICE =
276             component("TestStubbornDream");
277 
278     public static final ComponentName OVERLAY_TEST_SERVICE =
279             component("OverlayTestService");
280 
281     public static final ComponentName KEEP_CLEAR_RECTS_ACTIVITY =
282             component("KeepClearRectsActivity");
283 
284     public static final ComponentName KEEP_CLEAR_RECTS_ACTIVITY2 =
285             component("KeepClearRectsActivity2");
286 
287     /**
288      * The keys are used for {@link TestJournalProvider} when testing starting window.
289      */
290     public static class TestStartingWindowKeys {
291         public static final String HANDLE_SPLASH_SCREEN_EXIT = "HandleSplashScreenExitActivity";
292         public static final String REPLACE_ICON_EXIT = "SplashScreenReplaceIconActivity";
293         public static final String RECEIVE_SPLASH_SCREEN_EXIT = "receive_splash_screen_exit";
294         public static final String CONTAINS_CENTER_VIEW = "contains_center_view";
295         public static final String CONTAINS_BRANDING_VIEW = "contains_branding_view";
296         public static final String ICON_BACKGROUND_COLOR = "icon_background_color";
297         public static final String ICON_ANIMATION_DURATION = "icon_animation_duration";
298         public static final String ICON_ANIMATION_START = "icon_animation_start";
299         public static final String CENTER_VIEW_IS_SURFACE_VIEW = "center_view_is_surface_view";
300 
301         public static final String REQUEST_HANDLE_EXIT_ON_CREATE = "handle_exit_onCreate";
302         public static final String REQUEST_HANDLE_EXIT_ON_RESUME = "handle_exit_onResume";
303         public static final String CANCEL_HANDLE_EXIT = "cancel_handle_exit";
304 
305         public static final String REQUEST_SET_NIGHT_MODE_ON_CREATE = "night_mode_onCreate";
306         public static final String GET_NIGHT_MODE_ACTIVITY_CHANGED = "get_night_mode_activity";
307         public static final String DELAY_RESUME = "delay_resume";
308         public static final String OVERRIDE_THEME_ENABLED = "override_theme_enabled";
309         public static final String OVERRIDE_THEME_COLOR = "override_theme_color";
310         public static final String OVERRIDE_THEME_COMPONENT = "override_theme_component";
311         public static final String STYLE_THEME_COMPONENT = "style_theme_component";
312     }
313 
314     /**
315      * The keys are used for {@link TestJournalProvider} when testing wallpaper
316      * component.
317      */
318     public static class TestLiveWallpaperKeys {
319         public static final String COMPONENT = "LiveWallpaper";
320         public static final String ENGINE_CREATED = "engine_created";
321         public static final String ENGINE_DISPLAY_ID = "engine_display_Id";
322     }
323 
324     /**
325      * The keys are used for {@link TestJournalProvider} when testing interactive wallpaper
326      * component.
327      */
328     public static class TestInteractiveLiveWallpaperKeys {
329         public static final String COMPONENT = "InteractiveLiveWallpaper";
330         public static final String LAST_RECEIVED_MOTION_EVENT = "LastReceivedMotionEvent";
331     }
332 
333     /**
334      * Action and extra key constants for {@link #TEST_ACTIVITY}.
335      *
336      * TODO(b/73346885): These constants should be in {@link android.server.wm.app.TestActivity}
337      * once the activity is moved to test APK.
338      */
339     public static class TestActivity {
340         // Finishes the activity
341         public static final String TEST_ACTIVITY_ACTION_FINISH_SELF =
342                 "android.server.wm.app.TestActivity.finish_self";
343         // Sets the fixed orientation (can be one of {@link ActivityInfo.ScreenOrientation}
344         public static final String EXTRA_FIXED_ORIENTATION = "fixed_orientation";
345         public static final String EXTRA_CONFIGURATION = "configuration";
346         public static final String EXTRA_CONFIG_ASSETS_SEQ = "config_assets_seq";
347         public static final String EXTRA_INTENT = "intent";
348         public static final String EXTRA_INTENTS = "intents";
349         public static final String EXTRA_NO_IDLE = "no_idle";
350         public static final String COMMAND_NAVIGATE_UP_TO = "navigate_up_to";
351         public static final String COMMAND_START_ACTIVITY = "start_activity";
352         public static final String COMMAND_START_ACTIVITIES = "start_activities";
353         public static final String EXTRA_OPTION = "option";
354     }
355 
356     /**
357      * Extra key constants for {@link #LAUNCH_ASSISTANT_ACTIVITY_INTO_STACK} and
358      * {@link #LAUNCH_ASSISTANT_ACTIVITY_FROM_SESSION}.
359      *
360      * TODO(b/73346885): These constants should be in
361      * {@link android.server.wm.app.AssistantActivity} once the activity is moved to test APK.
362      */
363     public static class AssistantActivity {
364         // Launches the given activity in onResume
365         public static final String EXTRA_ASSISTANT_LAUNCH_NEW_TASK = "launch_new_task";
366         // Finishes this activity in onResume, this happens after EXTRA_ASSISTANT_LAUNCH_NEW_TASK
367         public static final String EXTRA_ASSISTANT_FINISH_SELF = "finish_self";
368         // Attempts to enter picture-in-picture in onResume
369         public static final String EXTRA_ASSISTANT_ENTER_PIP = "enter_pip";
370         // Display on which Assistant runs
371         public static final String EXTRA_ASSISTANT_DISPLAY_ID = "assistant_display_id";
372     }
373 
374     /**
375      * Extra key constants for {@link android.server.wm.app.BottomActivity}.
376      *
377      * TODO(b/73346885): These constants should be in {@link android.server.wm.app.BottomActivity}
378      * once the activity is moved to test APK.
379      */
380     public static class BottomActivity {
381         public static final String EXTRA_BOTTOM_WALLPAPER = "USE_WALLPAPER";
382         public static final String EXTRA_STOP_DELAY = "STOP_DELAY";
383     }
384 
385     /**
386      * Extra key constants for {@link android.server.wm.app.BroadcastReceiverActivity}.
387      *
388      * TODO(b/73346885): These constants should be in
389      * {@link android.server.wm.app.BroadcastReceiverActivity} once the activity is moved to test APK.
390      */
391     public static class BroadcastReceiverActivity {
392         public static final String ACTION_TRIGGER_BROADCAST = "trigger_broadcast";
393         public static final String EXTRA_DISMISS_KEYGUARD = "dismissKeyguard";
394         public static final String EXTRA_DISMISS_KEYGUARD_METHOD = "dismissKeyguardMethod";
395         public static final String EXTRA_FINISH_BROADCAST = "finish";
396         public static final String EXTRA_MOVE_BROADCAST_TO_BACK = "moveToBack";
397         public static final String EXTRA_BROADCAST_ORIENTATION = "orientation";
398         public static final String EXTRA_CUTOUT_EXISTS = "cutoutExists";
399     }
400 
401     /** Extra key constants for {@link android.server.wm.app.LandscapeOrientationActivity}. */
402     public static class LandscapeOrientationActivity {
403         public static final String EXTRA_APP_CONFIG_INFO = "app_config_info";
404         public static final String EXTRA_CONFIG_INFO_IN_ON_CREATE = "config_info_in_on_create";
405         public static final String EXTRA_DISPLAY_REAL_SIZE = "display_real_size";
406         public static final String EXTRA_SYSTEM_RESOURCES_CONFIG_INFO = "sys_config_info";
407     }
408 
409     /** Extra key constants for {@link android.server.wm.app.FontScaleActivity}. */
410     public static class FontScaleActivity {
411         public static final String EXTRA_FONT_PIXEL_SIZE = "fontPixelSize";
412         public static final String EXTRA_FONT_ACTIVITY_DPI = "fontActivityDpi";
413     }
414 
415     /** Extra key constants for {@link android.server.wm.app.NoHistoryActivity}. */
416     public static class NoHistoryActivity {
417         public static final String EXTRA_SHOW_WHEN_LOCKED = "showWhenLocked";
418     }
419 
420     /** Extra key constants for {@link android.server.wm.app.TurnScreenOnActivity}. */
421     public static class TurnScreenOnActivity {
422         // Turn on screen by window flags or APIs.
423         public static final String EXTRA_USE_WINDOW_FLAGS = "useWindowFlags";
424         public static final String EXTRA_SHOW_WHEN_LOCKED = "useShowWhenLocked";
425         public static final String EXTRA_SLEEP_MS_IN_ON_CREATE = "sleepMsInOnCreate";
426     }
427 
428     /** Extra key constants for {@link android.server.wm.app.MinimalPostProcessingActivity}. */
429     public static class MinimalPostProcessingActivity {
430         // Turn on minimal post processing (if available).
431         public static final String EXTRA_PREFER_MPP = "preferMinimalPostProcessing";
432     }
433 
434     /**
435      *  Logging constants for {@link android.server.wm.app.KeyguardDismissLoggerCallback}.
436      *
437      * TODO(b/73346885): These constants should be in
438      * {@link android.server.wm.app.KeyguardDismissLoggerCallback} once the class is moved to test APK.
439      */
440     public static class KeyguardDismissLoggerCallback {
441         public static final String KEYGUARD_DISMISS_LOG_TAG = "KeyguardDismissLoggerCallback";
442         public static final String ENTRY_ON_DISMISS_CANCELLED = "onDismissCancelled";
443         public static final String ENTRY_ON_DISMISS_ERROR = "onDismissError";
444         public static final String ENTRY_ON_DISMISS_SUCCEEDED = "onDismissSucceeded";
445     }
446 
447     /**
448      * Extra key constants for {@link #LAUNCH_ASSISTANT_ACTIVITY_INTO_STACK}.
449      *
450      * TODO(b/73346885): These constants should be in
451      * {@link android.server.wm.app.LaunchAssistantActivityIntoAssistantStack} once the activity is
452      * moved to test APK.
453      */
454     public static class LaunchAssistantActivityIntoAssistantStack {
455         // Launches the translucent assist activity
456         public static final String EXTRA_ASSISTANT_IS_TRANSLUCENT = "is_translucent";
457     }
458 
459     /**
460      * Extra constants for {@link android.server.wm.app.MoveTaskToBackActivity}.
461      *
462      * TODO(b/73346885): These constants should be in
463      * {@link android.server.wm.app.MoveTaskToBackActivity} once the activity is moved to test APK.
464      */
465     public static class MoveTaskToBackActivity {
466         public static final String EXTRA_FINISH_POINT = "finish_point";
467         public static final String FINISH_POINT_ON_PAUSE = "on_pause";
468         public static final String FINISH_POINT_ON_STOP = "on_stop";
469     }
470 
471     /**
472      * Action and extra key constants for {@link android.server.wm.app.PipActivity}.
473      *
474      * TODO(b/73346885): These constants should be in {@link android.server.wm.app.PipActivity}
475      * once the activity is moved to test APK.
476      */
477     public static class PipActivity {
478         // Intent action that this activity dynamically registers to enter picture-in-picture
479         public static final String ACTION_ENTER_PIP = "android.server.wm.app.PipActivity.enter_pip";
480         // Intent action that this activity dynamically registers to move itself to the back
481         public static final String ACTION_MOVE_TO_BACK =
482                 "android.server.wm.app.PipActivity.move_to_back";
483         // Intent action that this activity dynamically registers to expand itself.
484         // If EXTRA_SET_ASPECT_RATIO_WITH_DELAY is set, it will also attempt to apply the aspect
485         // ratio after a short delay.
486         public static final String ACTION_EXPAND_PIP =
487                 "android.server.wm.app.PipActivity.expand_pip";
488         // Intent action that this activity dynamically registers to receive update callback.
489         // If EXTRA_SET_PIP_STASH is set, then onPictureInPictureStateChanged will be called
490         // with the value.
491         public static final String ACTION_UPDATE_PIP_STATE =
492                 "android.server.wm.app.PipActivity.update_pip_state";
493         // Intent action that this activity dynamically registers to enter picture-in-picture
494         // then wait for the onPictureInPictureUiStateChanged callback.
495         public static final String ACTION_ENTER_PIP_AND_WAIT_FOR_UI_STATE =
496                 "android.server.wm.app.PipActivity.enter_pip_and_wait_for_ui_state";
497         // Intent action that this activity dynamically registers to set requested orientation.
498         // Will apply the orientation to the value set in the EXTRA_FIXED_ORIENTATION extra.
499         public static final String ACTION_SET_REQUESTED_ORIENTATION =
500                 "android.server.wm.app.PipActivity.set_requested_orientation";
501         // Intent action that will finish this activity
502         public static final String ACTION_FINISH = "android.server.wm.app.PipActivity.finish";
503         // Intent action that will request that the activity enters picture-in-picture.
504         public static final String ACTION_ON_PIP_REQUESTED =
505                 "android.server.wm.app.PipActivity.on_pip_requested";
506         // Intent action that will request that the activity initiates launch-into-pip
507         public static final String ACTION_START_LAUNCH_INTO_PIP_CONTAINER =
508                 "android.server.wm.app.LaunchIntoPip.start_container_activity";
509         // Intent action that will request the host activity of launch-into-pip to finish itself
510         public static final String ACTION_FINISH_LAUNCH_INTO_PIP_HOST =
511                 "android.server.wm.app.LaunchIntoPip.finish_host_activity";
512         // Intent action that will request the activity to change the PiP aspect ratio
513         public static final String ACTION_CHANGE_ASPECT_RATIO =
514                 "android.server.wm.app.LaunchIntoPip.change_aspect_ratio";
515         // Intent action that will request the activity to start a new translucent activity
516         public static final String ACTION_LAUNCH_TRANSLUCENT_ACTIVITY =
517                 "android.server.wm.app.LaunchIntoPip.launch_translucent_activity";
518         // Intent action that sets a RemoteCallback in PipActivity that will receive the
519         // isInPictureInPictureMode result
520         public static final String ACTION_SET_ON_PAUSE_REMOTE_CALLBACK =
521                 "android.server.wm.app.PipActivity.set_on_pause_remote_callback";
522 
523         // Adds an assertion that we do not ever get onStop() before we enter picture in picture
524         public static final String EXTRA_ASSERT_NO_ON_STOP_BEFORE_PIP =
525                 "assert_no_on_stop_before_pip";
526         // Calls enterPictureInPicture() on creation
527         public static final String EXTRA_ENTER_PIP = "enter_pip";
528         // Used with EXTRA_AUTO_ENTER_PIP, value specifies the aspect ratio to enter PIP with
529         public static final String EXTRA_ENTER_PIP_ASPECT_RATIO_NUMERATOR =
530                 "enter_pip_aspect_ratio_numerator";
531         // Used with EXTRA_AUTO_ENTER_PIP, value specifies the aspect ratio to enter PIP with
532         public static final String EXTRA_ENTER_PIP_ASPECT_RATIO_DENOMINATOR =
533                 "enter_pip_aspect_ratio_denominator";
534         // Calls requestAutoEnterPictureInPicture() with the value provided
535         public static final String EXTRA_ENTER_PIP_ON_PAUSE = "enter_pip_on_pause";
536         // Calls requestAutoEnterPictureInPicture() with the value provided
537         public static final String EXTRA_ENTER_PIP_ON_USER_LEAVE_HINT =
538                 "enter_pip_on_user_leave_hint";
539         // Calls requestAutoEnterPictureInPicture() with the value provided
540         public static final String EXTRA_ENTER_PIP_ON_PIP_REQUESTED =
541                 "enter_pip_on_pip_requested";
542         // Calls enterPictureInPictureMode when activity receives onBackPressed
543         public static final String EXTRA_ENTER_PIP_ON_BACK_PRESSED =
544                 "enter_pip_on_back_pressed";
545         public static final String EXTRA_EXPANDED_PIP_ASPECT_RATIO_NUMERATOR =
546                 "expanded_pip_numerator";
547         public static final String EXTRA_EXPANDED_PIP_ASPECT_RATIO_DENOMINATOR =
548                 "expanded_pip_denomenator";
549         // Sets auto PIP allowed on the activity picture-in-picture params.
550         public static final String EXTRA_ALLOW_AUTO_PIP = "enter_pip_auto_pip_allowed";
551         // Sets seamless resize enabled on the activity picture-in-picture params.
552         public static final String EXTRA_IS_SEAMLESS_RESIZE_ENABLED =
553                 "enter_pip_is_seamless_resize_enabled";
554         // Sets the given title on the activity picture-in-picture params.
555         public static final String EXTRA_TITLE = "set_pip_title";
556         // Sets the given subtitle on the activity picture-in-picture params.
557         public static final String EXTRA_SUBTITLE = "set_pip_subtitle";
558         // Finishes the activity at the end of onResume (after EXTRA_START_ACTIVITY is handled)
559         public static final String EXTRA_FINISH_SELF_ON_RESUME = "finish_self_on_resume";
560         // Similar to EXTRA_FINISH_SELF_ON_RESUME but only be used to finish the trampoline
561         // Activity when it receives onResume (after the target Activity is launched).
562         public static final String EXTRA_FINISH_TRAMPOLINE_ON_RESUME =
563                 "finish_trampoline_on_resume";
564         // Sets the fixed orientation (can be one of {@link ActivityInfo.ScreenOrientation}
565         public static final String EXTRA_PIP_ORIENTATION = "fixed_orientation";
566         // The amount to delay to artificially introduce in onPause()
567         // (before EXTRA_ENTER_PIP_ON_PAUSE is processed)
568         public static final String EXTRA_ON_PAUSE_DELAY = "on_pause_delay";
569         // Calls setPictureInPictureAspectRatio with the aspect ratio specified in the value
570         public static final String EXTRA_SET_ASPECT_RATIO_DENOMINATOR =
571                 "set_aspect_ratio_denominator";
572         // Calls setPictureInPictureAspectRatio with the aspect ratio specified in the value
573         public static final String EXTRA_SET_ASPECT_RATIO_NUMERATOR = "set_aspect_ratio_numerator";
574         // Calls setPictureInPictureAspectRatio with the aspect ratio specified in the value with a
575         // fixed delay
576         public static final String EXTRA_SET_ASPECT_RATIO_WITH_DELAY_NUMERATOR =
577                 "set_aspect_ratio_with_delay_numerator";
578         // Calls setPictureInPictureAspectRatio with the aspect ratio specified in the value with a
579         // fixed delay
580         public static final String EXTRA_SET_ASPECT_RATIO_WITH_DELAY_DENOMINATOR =
581                 "set_aspect_ratio_with_delay_denominator";
582         // Calls onPictureInPictureStateChange with the state specified in the value
583         public static final String EXTRA_SET_PIP_STASHED = "set_pip_stashed";
584         // Shows this activity over the keyguard
585         public static final String EXTRA_SHOW_OVER_KEYGUARD = "show_over_keyguard";
586         // Starts the activity (component name) provided by the value at the end of onCreate
587         public static final String EXTRA_START_ACTIVITY = "start_activity";
588         // Adds a click listener to finish this activity when it is clicked
589         public static final String EXTRA_TAP_TO_FINISH = "tap_to_finish";
590         // Dismiss keyguard when activity show.
591         public static final String EXTRA_DISMISS_KEYGUARD = "dismiss_keyguard";
592         // Number of custom actions should be set onto PictureInPictureParams
593         public static final String EXTRA_NUMBER_OF_CUSTOM_ACTIONS = "number_of_custom_actions";
594         // Whether a custom close action should be set in the PictureInPictureParams.
595         public static final String EXTRA_CLOSE_ACTION = "set_pip_close_action";
596         // Supplied when a callback is expected for pip
597         public static final String EXTRA_SET_PIP_CALLBACK = "set_pip_callback";
598         // Supplied when a callback is expected for pip when activity receives onPause
599         public static final String EXTRA_PIP_ON_PAUSE_CALLBACK = "pip_on_pause_callback";
600         // Result key for obtaining the PictureInPictureUiState#isStashed result
601         public static final String UI_STATE_STASHED_RESULT = "ui_state_stashed_result";
602         // Result key for obtaining the PictureInPictureUiState#isEnteringPip result
603         public static final String UI_STATE_ENTERING_PIP_RESULT = "ui_state_entering_result";
604         // Result key for obtaining the Activity#isInPictureInPictureMode result
605         public static final String IS_IN_PIP_MODE_RESULT = "is_in_pip_mode_result";
606     }
607 
608     /**
609      * Extra key constants for {@link android.server.wm.app.TopActivity} and
610      * {@link TranslucentTopActivity}.
611      *
612      * TODO(b/73346885): These constants should be in {@link android.server.wm.app.TopActivity}
613      * once the activity is moved to test APK.
614      */
615     public static class TopActivity {
616         public static final String EXTRA_FINISH_DELAY = "FINISH_DELAY";
617         public static final String EXTRA_FINISH_IN_ON_CREATE = "FINISH_IN_ON_CREATE";
618         public static final String ACTION_CONVERT_TO_TRANSLUCENT = "convert_to_translucent";
619         public static final String ACTION_CONVERT_FROM_TRANSLUCENT = "convert_from_translucent";
620     }
621 
622     public static class UnresponsiveActivity {
623         public static final String EXTRA_ON_CREATE_DELAY_MS = "ON_CREATE_DELAY_MS";
624         public static final String EXTRA_ON_KEYDOWN_DELAY_MS = "ON_KEYDOWN_DELAY_MS";
625         public static final String EXTRA_ON_MOTIONEVENT_DELAY_MS = "ON_MOTIONEVENT_DELAY_MS";
626         public static final String PROCESS_NAME = ".unresponsive_activity_process";
627     }
628 
629     public static class RenderService {
630         public static final String PROCESS_NAME = ".render_process";
631         public static final String EXTRAS_BUNDLE = "EXTRAS_BUNDLE";
632         public static final String EXTRAS_DISPLAY_ID = "EXTRAS_DISPLAY_ID";
633         public static final String EXTRAS_HOST_TOKEN = "EXTRAS_HOST_TOKEN";
634         public static final String BROADCAST_EMBED_CONTENT =
635                 "android.server.wm.app.RenderService.EMBED_CONTENT";
636         public static final String EXTRAS_SURFACE_PACKAGE = "surfacePackage";
637     }
638 
639     public static class MultiWindowFullscreenActivity {
640         public static final String ACTION_REQUEST_FULLSCREEN =
641                 "android.server.wm.app.MultiWindowFullscreenActivity.action_request_fullscreen";
642         public static final String ACTION_RESTORE_FREEFORM =
643                 "android.server.wm.app.MultiWindowFullscreenActivity.action_restore_freeform";
644     }
645 
646     /**
647      * Extra key constants for {@link android.server.wm.app.VirtualDisplayActivity}.
648      *
649      * TODO(b/73346885): These constants should be in
650      * {@link android.server.wm.app.VirtualDisplayActivity} once the activity is moved to test APK.
651      */
652     public static class VirtualDisplayActivity {
653         public static final String VIRTUAL_DISPLAY_PREFIX = "HostedVirtualDisplay";
654         public static final String KEY_CAN_SHOW_WITH_INSECURE_KEYGUARD =
655                 "can_show_with_insecure_keyguard";
656         public static final String KEY_COMMAND = "command";
657         public static final String KEY_COUNT = "count";
658         public static final String KEY_DENSITY_DPI = "density_dpi";
659         public static final String KEY_PUBLIC_DISPLAY = "public_display";
660         public static final String KEY_RESIZE_DISPLAY = "resize_display";
661         public static final String KEY_SHOW_SYSTEM_DECORATIONS = "show_system_decorations";
662         public static final String KEY_PRESENTATION_DISPLAY = "presentation_display";
663         public static final String KEY_SUPPORTS_TOUCH = "supports_touch";
664         // Value constants of {@link #KEY_COMMAND}.
665         public static final String COMMAND_CREATE_DISPLAY = "create_display";
666         public static final String COMMAND_DESTROY_DISPLAY = "destroy_display";
667         public static final String COMMAND_RESIZE_DISPLAY = "resize_display";
668     }
669 
670     public static class ClickableToastActivity {
671         public static final String ACTION_TOAST_DISPLAYED = "toast_displayed";
672         public static final String ACTION_TOAST_TAP_DETECTED = "toast_tap_detected";
673     }
674 
675     public static class PresentationActivity {
676         public static final String KEY_DISPLAY_ID = "display_id";
677     }
678 
679     public static class LaunchingActivity {
680         public static final String KEY_FINISH_BEFORE_LAUNCH = "finish_before_launch";
681     }
682 
683     public static class OverlayTestService {
684         public static final String EXTRA_LAYOUT_PARAMS = "layout_params";
685     }
686 
687     public static class Notifications {
688         public static final String CHANNEL_MAIN = "main";
689         public static final int ID_OVERLAY_TEST_SERVICE = 1;
690     }
691 
692     public static class HideOverlayWindowsActivity {
693         public static final String ACTION = "hide_action";
694         public static final String PONG = "pong_action";
695         public static final String SHOULD_HIDE = "should_hide";
696         public static final String REPORT_TOUCH = "report_touch";
697         public static final String MOTION_EVENT_EXTRA = "motion_event_extra";
698     }
699 
700     public static class BackgroundActivityTransition {
701         public static final String TRANSITION_REQUESTED = "transition_requested";
702     }
703 
704     /**
705      * Extra constants for {@link android.server.wm.app.KeepClearRectsActivity}.
706      */
707     public static class KeepClearRectsActivity {
708         public static final String EXTRA_KEEP_CLEAR_RECTS = "keep_clear_rects";
709     }
710 
711     /**
712      * Extra constants for {@link android.server.wm.app.UiScalingTestActivity}.
713      */
714     public static class UiScalingTestActivity {
715         public static final String SUBVIEW_ID1 = "compat_scale_subview1";
716         public static final String SUBVIEW_ID2 = "compat_scale_subview2";
717 
718         public static final String KEY_COMMAND_SUCCESS = "success";
719         public static final String KEY_RESOURCES_CONFIG = "resources_config";
720         public static final String KEY_SUBVIEW_ID = "subview_id";
721         public static final String KEY_TEXT_SIZE = "text_size";
722         public static final String KEY_VIEW_SIZE = "view_size";
723 
724         public static final String COMMAND_ADD_SUBVIEW = "add_subview";
725         public static final String COMMAND_CLEAR_DEFAULT_VIEW = "clear_default_view";
726         public static final String COMMAND_GET_SUBVIEW_SIZE = "get_subview_size";
727 
728         public static final String COMMAND_GET_RESOURCES_CONFIG = "get_resources_config";
729         public static final String COMMAND_UPDATE_RESOURCES_CONFIG = "update_resources_config";
730     }
731 
732     public static class WallpaperTargetActivity {
733         public static final String EXTRA_ENABLE_WALLPAPER_TOUCH = "enable_wallpaper_touch";
734     }
component(String className)735     private static ComponentName component(String className) {
736         return component(Components.class, className);
737     }
738 
getPackageName()739     public static String getPackageName() {
740         return getPackageName(Components.class);
741     }
742 }
743