1 /* 2 * Copyright (C) 2019 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.intent; 18 19 import android.app.Activity; 20 import android.content.Intent; 21 import android.os.Bundle; 22 23 /** 24 * A collection of activities with various launch modes used in the intent tests. 25 * Each activity is named after the LaunchMode it has enabled. 26 * 27 * They reflect the activities present in the IntentPlayground app. The IntentPlayground app 28 * resides in development/samples/IntentPlayground 29 */ 30 public class Activities { 31 32 private static class BaseActivity extends Activity { 33 @Override onCreate(Bundle savedInstanceState)34 protected void onCreate(Bundle savedInstanceState) { 35 super.onCreate(savedInstanceState); 36 setTitle(getClass().getSimpleName()); 37 } 38 } 39 40 public static class TrackerActivity extends BaseActivity { 41 } 42 43 public static class RegularActivity extends BaseActivity { 44 public boolean mIsOnNewIntentCalled = false; 45 46 @Override onNewIntent(Intent intent)47 protected void onNewIntent(Intent intent) { 48 super.onNewIntent(intent); 49 mIsOnNewIntentCalled = true; 50 } 51 } 52 53 public static class SingleTopActivity extends BaseActivity { 54 } 55 56 public static class SingleInstanceActivity extends BaseActivity { 57 } 58 59 public static class SingleInstanceActivity2 extends BaseActivity { 60 } 61 62 public static class SingleTaskActivity extends BaseActivity { 63 } 64 65 public static class SingleTaskActivity2 extends BaseActivity { 66 } 67 68 public static class SingleInstancePerTaskActivity extends BaseActivity { 69 } 70 71 public static class SingleInstancePerTaskDocumentNeverActivity extends BaseActivity { 72 } 73 74 public static class TaskAffinity1Activity extends BaseActivity { 75 } 76 77 public static class TaskAffinity1Activity2 extends BaseActivity { 78 } 79 80 public static class TaskAffinity1SingleTopActivity extends BaseActivity { 81 } 82 83 public static class TaskAffinity2Activity extends BaseActivity { 84 } 85 86 public static class TaskAffinity3Activity extends BaseActivity { 87 } 88 89 public static class ClearTaskOnLaunchActivity extends BaseActivity { 90 } 91 92 public static class DocumentLaunchIntoActivity extends BaseActivity { 93 } 94 95 public static class DocumentLaunchAlwaysActivity extends BaseActivity { 96 } 97 98 public static class DocumentLaunchNeverActivity extends BaseActivity { 99 } 100 101 public static class NoHistoryActivity extends BaseActivity { 102 } 103 104 public static class LauncherActivity extends BaseActivity { 105 } 106 107 public static class RelinquishTaskIdentityActivity extends BaseActivity { 108 } 109 110 public static class TaskAffinity1RelinquishTaskIdentityActivity extends BaseActivity { 111 } 112 } 113