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.am; 18 19 import android.content.ComponentName; 20 import android.server.am.component.ComponentsBase; 21 22 public class Components extends ComponentsBase { 23 public static final ComponentName ALT_LAUNCHING_ACTIVITY = component("AltLaunchingActivity"); 24 public static final ComponentName ALWAYS_FOCUSABLE_PIP_ACTIVITY = 25 component("AlwaysFocusablePipActivity"); 26 public static final ComponentName ANIMATION_TEST_ACTIVITY = component("AnimationTestActivity"); 27 public static final ComponentName ASSISTANT_ACTIVITY = component("AssistantActivity"); 28 public static final ComponentName BOTTOM_ACTIVITY = component("BottomActivity"); 29 public static final ComponentName BOTTOM_LEFT_LAYOUT_ACTIVITY = 30 component("BottomLeftLayoutActivity"); 31 public static final ComponentName BOTTOM_RIGHT_LAYOUT_ACTIVITY = 32 component("BottomRightLayoutActivity"); 33 public static final ComponentName BROADCAST_RECEIVER_ACTIVITY = 34 component("BroadcastReceiverActivity"); 35 public static final ComponentName DIALOG_WHEN_LARGE_ACTIVITY = 36 component("DialogWhenLargeActivity"); 37 public static final ComponentName DISMISS_KEYGUARD_ACTIVITY = 38 component("DismissKeyguardActivity"); 39 public static final ComponentName DISMISS_KEYGUARD_METHOD_ACTIVITY = 40 component("DismissKeyguardMethodActivity"); 41 public static final ComponentName DOCKED_ACTIVITY = component("DockedActivity"); 42 /** This activity is an alias activity pointing {@link TrampolineActivity} in AndroidManifest.xml */ 43 public static final ComponentName ENTRY_POINT_ALIAS_ACTIVITY = 44 component("EntryPointAliasActivity"); 45 public static final ComponentName FONT_SCALE_ACTIVITY = component("FontScaleActivity"); 46 public static final ComponentName FONT_SCALE_NO_RELAUNCH_ACTIVITY = 47 component("FontScaleNoRelaunchActivity"); 48 public static final ComponentName FREEFORM_ACTIVITY = component("FreeformActivity"); 49 public static final ComponentName KEYGUARD_LOCK_ACTIVITY = component("KeyguardLockActivity"); 50 public static final ComponentName LANDSCAPE_ORIENTATION_ACTIVITY = 51 component("LandscapeOrientationActivity"); 52 public static final ComponentName LAUNCH_ASSISTANT_ACTIVITY_FROM_SESSION = 53 component("LaunchAssistantActivityFromSession"); 54 public static final ComponentName LAUNCH_ASSISTANT_ACTIVITY_INTO_STACK = 55 component("LaunchAssistantActivityIntoAssistantStack"); 56 public static final ComponentName LAUNCH_ENTER_PIP_ACTIVITY = 57 component("LaunchEnterPipActivity"); 58 public static final ComponentName LAUNCH_INTO_PINNED_STACK_PIP_ACTIVITY = 59 component("LaunchIntoPinnedStackPipActivity"); 60 public static final ComponentName LAUNCH_PIP_ON_PIP_ACTIVITY = 61 component("LaunchPipOnPipActivity"); 62 public static final ComponentName LAUNCHING_ACTIVITY = component("LaunchingActivity"); 63 public static final ComponentName LOG_CONFIGURATION_ACTIVITY = 64 component("LogConfigurationActivity"); 65 public static final ComponentName MOVE_TASK_TO_BACK_ACTIVITY = 66 component("MoveTaskToBackActivity"); 67 public static final ComponentName NIGHT_MODE_ACTIVITY = component("NightModeActivity"); 68 public static final ComponentName NO_HISTORY_ACTIVITY = component("NoHistoryActivity"); 69 public static final ComponentName NO_RELAUNCH_ACTIVITY = component("NoRelaunchActivity"); 70 public static final ComponentName NON_RESIZEABLE_ACTIVITY = component("NonResizeableActivity"); 71 public static final ComponentName PIP_ACTIVITY = component("PipActivity"); 72 public static final ComponentName PIP_ACTIVITY2 = component("PipActivity2"); 73 public static final ComponentName PIP_ACTIVITY_WITH_SAME_AFFINITY = 74 component("PipActivityWithSameAffinity"); 75 public static final ComponentName PIP_ON_STOP_ACTIVITY = component("PipOnStopActivity"); 76 public static final ComponentName PORTRAIT_ORIENTATION_ACTIVITY = 77 component("PortraitOrientationActivity"); 78 public static final ComponentName RECURSIVE_ACTIVITY = component("RecursiveActivity"); 79 public static final ComponentName RESIZEABLE_ACTIVITY = component("ResizeableActivity"); 80 public static final ComponentName RESUME_WHILE_PAUSING_ACTIVITY = 81 component("ResumeWhilePausingActivity"); 82 public static final ComponentName SHOW_WHEN_LOCKED_ACTIVITY = 83 component("ShowWhenLockedActivity"); 84 public static final ComponentName SHOW_WHEN_LOCKED_ATTR_ACTIVITY = 85 component("ShowWhenLockedAttrActivity"); 86 public static final ComponentName SHOW_WHEN_LOCKED_ATTR_REMOVE_ATTR_ACTIVITY = 87 component("ShowWhenLockedAttrRemoveAttrActivity"); 88 public static final ComponentName SHOW_WHEN_LOCKED_DIALOG_ACTIVITY = 89 component("ShowWhenLockedDialogActivity"); 90 public static final ComponentName SHOW_WHEN_LOCKED_TRANSLUCENT_ACTIVITY = 91 component("ShowWhenLockedTranslucentActivity"); 92 public static final ComponentName SHOW_WHEN_LOCKED_WITH_DIALOG_ACTIVITY = 93 component("ShowWhenLockedWithDialogActivity"); 94 public static final ComponentName SINGLE_INSTANCE_ACTIVITY = 95 component("SingleInstanceActivity"); 96 public static final ComponentName SINGLE_TASK_ACTIVITY = component("SingleTaskActivity"); 97 public static final ComponentName SLOW_CREATE_ACTIVITY = component("SlowCreateActivity"); 98 public static final ComponentName SPLASHSCREEN_ACTIVITY = component("SplashscreenActivity"); 99 public static final ComponentName SWIPE_REFRESH_ACTIVITY = component("SwipeRefreshActivity"); 100 public static final ComponentName TEST_ACTIVITY = component("TestActivity"); 101 public static final ComponentName TOP_ACTIVITY = component("TopActivity"); 102 public static final ComponentName TEST_ACTIVITY_WITH_SAME_AFFINITY = 103 component("TestActivityWithSameAffinity"); 104 public static final ComponentName TOP_LEFT_LAYOUT_ACTIVITY = component("TopLeftLayoutActivity"); 105 public static final ComponentName TOP_RIGHT_LAYOUT_ACTIVITY = 106 component("TopRightLayoutActivity"); 107 public static final ComponentName TRANSLUCENT_ACTIVITY = component("TranslucentActivity"); 108 public static final ComponentName TRANSLUCENT_ASSISTANT_ACTIVITY = 109 component("TranslucentAssistantActivity"); 110 public static final ComponentName TRANSLUCENT_TOP_ACTIVITY = 111 component("TranslucentTopActivity"); 112 public static final ComponentName TRANSLUCENT_TEST_ACTIVITY = 113 component("TranslucentTestActivity"); 114 public static final ComponentName TURN_SCREEN_ON_ACTIVITY = component("TurnScreenOnActivity"); 115 public static final ComponentName TURN_SCREEN_ON_ATTR_ACTIVITY = 116 component("TurnScreenOnAttrActivity"); 117 public static final ComponentName TURN_SCREEN_ON_ATTR_DISMISS_KEYGUARD_ACTIVITY = 118 component("TurnScreenOnAttrDismissKeyguardActivity"); 119 public static final ComponentName TURN_SCREEN_ON_ATTR_REMOVE_ATTR_ACTIVITY = 120 component("TurnScreenOnAttrRemoveAttrActivity"); 121 public static final ComponentName TURN_SCREEN_ON_DISMISS_KEYGUARD_ACTIVITY = 122 component("TurnScreenOnDismissKeyguardActivity"); 123 public static final ComponentName TURN_SCREEN_ON_SHOW_ON_LOCK_ACTIVITY = 124 component("TurnScreenOnShowOnLockActivity"); 125 public static final ComponentName TURN_SCREEN_ON_SINGLE_TASK_ACTIVITY = 126 component("TurnScreenOnSingleTaskActivity"); 127 public static final ComponentName TURN_SCREEN_ON_WITH_RELAYOUT_ACTIVITY = 128 component("TurnScreenOnWithRelayoutActivity"); 129 public static final ComponentName VIRTUAL_DISPLAY_ACTIVITY = 130 component("VirtualDisplayActivity"); 131 public static final ComponentName VR_TEST_ACTIVITY = component("VrTestActivity"); 132 public static final ComponentName WALLPAPAER_ACTIVITY = component("WallpaperActivity"); 133 134 public static final ComponentName ASSISTANT_VOICE_INTERACTION_SERVICE = 135 component("AssistantVoiceInteractionService"); 136 137 public static final ComponentName LAUNCH_BROADCAST_RECEIVER = 138 component("LaunchBroadcastReceiver"); 139 public static final String LAUNCH_BROADCAST_ACTION = 140 getPackageName() + ".LAUNCH_BROADCAST_ACTION"; 141 142 /** 143 * Action and extra key constants for {@link #TEST_ACTIVITY}. 144 * 145 * TODO(b/73346885): These constants should be in {@link android.server.am.TestActivity} once 146 * the activity is moved to test APK. 147 */ 148 public static class TestActivity { 149 // Finishes the activity 150 public static final String TEST_ACTIVITY_ACTION_FINISH_SELF = 151 "android.server.am.TestActivity.finish_self"; 152 // Sets the fixed orientation (can be one of {@link ActivityInfo.ScreenOrientation} 153 public static final String EXTRA_FIXED_ORIENTATION = "fixed_orientation"; 154 } 155 156 /** 157 * Extra key constants for {@link #LAUNCH_ASSISTANT_ACTIVITY_INTO_STACK} and 158 * {@link #LAUNCH_ASSISTANT_ACTIVITY_FROM_SESSION}. 159 * 160 * TODO(b/73346885): These constants should be in {@link android.server.am.AssistantActivity} 161 * once the activity is moved to test APK. 162 */ 163 public static class AssistantActivity { 164 // Launches the given activity in onResume 165 public static final String EXTRA_ASSISTANT_LAUNCH_NEW_TASK = "launch_new_task"; 166 // Finishes this activity in onResume, this happens after EXTRA_ASSISTANT_LAUNCH_NEW_TASK 167 public static final String EXTRA_ASSISTANT_FINISH_SELF = "finish_self"; 168 // Attempts to enter picture-in-picture in onResume 169 public static final String EXTRA_ASSISTANT_ENTER_PIP = "enter_pip"; 170 // Display on which Assistant runs 171 public static final String EXTRA_ASSISTANT_DISPLAY_ID = "assistant_display_id"; 172 } 173 174 /** 175 * Extra key constants for {@link android.server.am.BottomActivity}. 176 * 177 * TODO(b/73346885): These constants should be in {@link android.server.am.BottomActivity} 178 * once the activity is moved to test APK. 179 */ 180 public static class BottomActivity { 181 public static final String EXTRA_BOTTOM_WALLPAPER = "USE_WALLPAPER"; 182 public static final String EXTRA_STOP_DELAY = "STOP_DELAY"; 183 } 184 185 /** 186 * Extra key constants for {@link android.server.am.BroadcastReceiverActivity}. 187 * 188 * TODO(b/73346885): These constants should be in 189 * {@link android.server.am.BroadcastReceiverActivity} once the activity is moved to test APK. 190 */ 191 public static class BroadcastReceiverActivity { 192 public static final String ACTION_TRIGGER_BROADCAST = "trigger_broadcast"; 193 public static final String EXTRA_DISMISS_KEYGUARD = "dismissKeyguard"; 194 public static final String EXTRA_DISMISS_KEYGUARD_METHOD = "dismissKeyguardMethod"; 195 public static final String EXTRA_FINISH_BROADCAST = "finish"; 196 public static final String EXTRA_MOVE_BROADCAST_TO_BACK = "moveToBack"; 197 public static final String EXTRA_BROADCAST_ORIENTATION = "orientation"; 198 } 199 200 /** 201 * Logging constants for {@link android.server.am.KeyguardDismissLoggerCallback}. 202 * 203 * TODO(b/73346885): These constants should be in 204 * {@link android.server.am.KeyguardDismissLoggerCallback} once the class is moved to test APK. 205 */ 206 public static class KeyguardDismissLoggerCallback { 207 public static final String KEYGUARD_DISMISS_LOG_TAG = "KeyguardDismissLoggerCallback"; 208 public static final String ENTRY_ON_DISMISS_CANCELLED = "onDismissCancelled"; 209 public static final String ENTRY_ON_DISMISS_ERROR = "onDismissError"; 210 public static final String ENTRY_ON_DISMISS_SUCCEEDED = "onDismissSucceeded"; 211 } 212 213 /** 214 * Extra key constants for {@link #LAUNCH_ASSISTANT_ACTIVITY_INTO_STACK}. 215 * 216 * TODO(b/73346885): These constants should be in 217 * {@link android.server.am.LaunchAssistantActivityIntoAssistantStack} once the activity is 218 * moved to test APK. 219 */ 220 public static class LaunchAssistantActivityIntoAssistantStack { 221 // Launches the translucent assist activity 222 public static final String EXTRA_ASSISTANT_IS_TRANSLUCENT = "is_translucent"; 223 } 224 225 /** 226 * Extra constants for {@link android.server.am.MoveTaskToBackActivity}. 227 * 228 * TODO(b/73346885): These constants should be in 229 * {@link android.server.am.MoveTaskToBackActivity} once the activity is moved to test APK. 230 */ 231 public static class MoveTaskToBackActivity { 232 public static final String EXTRA_FINISH_POINT = "finish_point"; 233 public static final String FINISH_POINT_ON_PAUSE = "on_pause"; 234 public static final String FINISH_POINT_ON_STOP = "on_stop"; 235 } 236 237 /** 238 * Action and extra key constants for {@link android.server.am.PipActivity}. 239 * 240 * TODO(b/73346885): These constants should be in {@link android.server.am.PipActivity} 241 * once the activity is moved to test APK. 242 */ 243 public static class PipActivity { 244 // Intent action that this activity dynamically registers to enter picture-in-picture 245 public static final String ACTION_ENTER_PIP = "android.server.am.PipActivity.enter_pip"; 246 // Intent action that this activity dynamically registers to move itself to the back 247 public static final String ACTION_MOVE_TO_BACK = 248 "android.server.am.PipActivity.move_to_back"; 249 // Intent action that this activity dynamically registers to expand itself. 250 // If EXTRA_SET_ASPECT_RATIO_WITH_DELAY is set, it will also attempt to apply the aspect 251 // ratio after a short delay. 252 public static final String ACTION_EXPAND_PIP = "android.server.am.PipActivity.expand_pip"; 253 // Intent action that this activity dynamically registers to set requested orientation. 254 // Will apply the oriention to the value set in the EXTRA_FIXED_ORIENTATION extra. 255 public static final String ACTION_SET_REQUESTED_ORIENTATION = 256 "android.server.am.PipActivity.set_requested_orientation"; 257 // Intent action that will finish this activity 258 public static final String ACTION_FINISH = "android.server.am.PipActivity.finish"; 259 260 // Adds an assertion that we do not ever get onStop() before we enter picture in picture 261 public static final String EXTRA_ASSERT_NO_ON_STOP_BEFORE_PIP = 262 "assert_no_on_stop_before_pip"; 263 // Calls enterPictureInPicture() on creation 264 public static final String EXTRA_ENTER_PIP = "enter_pip"; 265 // Used with EXTRA_AUTO_ENTER_PIP, value specifies the aspect ratio to enter PIP with 266 public static final String EXTRA_ENTER_PIP_ASPECT_RATIO_NUMERATOR = 267 "enter_pip_aspect_ratio_numerator"; 268 // Used with EXTRA_AUTO_ENTER_PIP, value specifies the aspect ratio to enter PIP with 269 public static final String EXTRA_ENTER_PIP_ASPECT_RATIO_DENOMINATOR = 270 "enter_pip_aspect_ratio_denominator"; 271 // Calls requestAutoEnterPictureInPicture() with the value provided 272 public static final String EXTRA_ENTER_PIP_ON_PAUSE = "enter_pip_on_pause"; 273 // Finishes the activity at the end of onResume (after EXTRA_START_ACTIVITY is handled) 274 public static final String EXTRA_FINISH_SELF_ON_RESUME = "finish_self_on_resume"; 275 // Sets the fixed orientation (can be one of {@link ActivityInfo.ScreenOrientation} 276 public static final String EXTRA_PIP_ORIENTATION = "fixed_orientation"; 277 // The amount to delay to artificially introduce in onPause() 278 // (before EXTRA_ENTER_PIP_ON_PAUSE is processed) 279 public static final String EXTRA_ON_PAUSE_DELAY = "on_pause_delay"; 280 // Calls enterPictureInPicture() again after onPictureInPictureModeChanged(false) is called 281 public static final String EXTRA_REENTER_PIP_ON_EXIT = "reenter_pip_on_exit"; 282 // Calls setPictureInPictureAspectRatio with the aspect ratio specified in the value 283 public static final String EXTRA_SET_ASPECT_RATIO_DENOMINATOR = 284 "set_aspect_ratio_denominator"; 285 // Calls setPictureInPictureAspectRatio with the aspect ratio specified in the value 286 public static final String EXTRA_SET_ASPECT_RATIO_NUMERATOR = "set_aspect_ratio_numerator"; 287 // Calls setPictureInPictureAspectRatio with the aspect ratio specified in the value with a 288 // fixed delay 289 public static final String EXTRA_SET_ASPECT_RATIO_WITH_DELAY_NUMERATOR = 290 "set_aspect_ratio_with_delay_numerator"; 291 // Calls setPictureInPictureAspectRatio with the aspect ratio specified in the value with a 292 // fixed delay 293 public static final String EXTRA_SET_ASPECT_RATIO_WITH_DELAY_DENOMINATOR = 294 "set_aspect_ratio_with_delay_denominator"; 295 // Shows this activity over the keyguard 296 public static final String EXTRA_SHOW_OVER_KEYGUARD = "show_over_keyguard"; 297 // Starts the activity (component name) provided by the value at the end of onCreate 298 public static final String EXTRA_START_ACTIVITY = "start_activity"; 299 // Adds a click listener to finish this activity when it is clicked 300 public static final String EXTRA_TAP_TO_FINISH = "tap_to_finish"; 301 } 302 303 /** 304 * Extra key constants for {@link android.server.am.TopActivity} and 305 * {@link android.server.am.TranslucentTopActivity}. 306 * 307 * TODO(b/73346885): These constants should be in {@link android.server.am.TopActivity} 308 * once the activity is moved to test APK. 309 */ 310 public static class TopActivity { 311 public static final String EXTRA_FINISH_DELAY = "FINISH_DELAY"; 312 public static final String EXTRA_TOP_WALLPAPER = "USE_WALLPAPER"; 313 } 314 315 /** 316 * Extra key constants for {@link android.server.am.VirtualDisplayActivity}. 317 * 318 * TODO(b/73346885): These constants should be in 319 * {@link android.server.am.VirtualDisplayActivity} once the activity is moved to test APK. 320 */ 321 public static class VirtualDisplayActivity { 322 public static final String VIRTUAL_DISPLAY_PREFIX = "HostedVirtualDisplay"; 323 public static final String KEY_CAN_SHOW_WITH_INSECURE_KEYGUARD = 324 "can_show_with_insecure_keyguard"; 325 public static final String KEY_COMMAND = "command"; 326 public static final String KEY_COUNT = "count"; 327 public static final String KEY_DENSITY_DPI = "density_dpi"; 328 public static final String KEY_LAUNCH_TARGET_COMPONENT = "launch_target_component"; 329 public static final String KEY_PUBLIC_DISPLAY = "public_display"; 330 public static final String KEY_RESIZE_DISPLAY = "resize_display"; 331 // Value constants of {@link #KEY_COMMAND}. 332 public static final String COMMAND_CREATE_DISPLAY = "create_display"; 333 public static final String COMMAND_DESTROY_DISPLAY = "destroy_display"; 334 public static final String COMMAND_RESIZE_DISPLAY = "resize_display"; 335 } 336 component(String className)337 private static ComponentName component(String className) { 338 return component(Components.class, className); 339 } 340 getPackageName()341 private static String getPackageName() { 342 return getPackageName(Components.class); 343 } 344 } 345