The base files for the project & activities and XML resources
Test: build and run manually
Change-Id: I6eb7f1a444703e99f592ac9106261f9c6bd90127
diff --git a/samples/IntentPlayground/Android.mk b/samples/IntentPlayground/Android.mk
new file mode 100644
index 0000000..7cd3b5a
--- /dev/null
+++ b/samples/IntentPlayground/Android.mk
@@ -0,0 +1,19 @@
+LOCAL_PATH:= $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_TAGS := samples tests
+
+# Only compile source java files in this apk.
+LOCAL_SRC_FILES := $(call all-java-files-under, src)
+
+LOCAL_STATIC_JAVA_LIBRARIES = android-support-v13
+
+LOCAL_PACKAGE_NAME := IntentPlayground
+
+LOCAL_SDK_VERSION := current
+
+
+include $(BUILD_PACKAGE)
+
+# Use the folloing include to make our test apk.
+include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/samples/IntentPlayground/AndroidManifest.xml b/samples/IntentPlayground/AndroidManifest.xml
new file mode 100644
index 0000000..210df66
--- /dev/null
+++ b/samples/IntentPlayground/AndroidManifest.xml
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2017 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.example.android.intentplayground">
+ <uses-permission android:name="android.permission.REORDER_TASKS" />
+ <application
+ android:icon="@mipmap/ic_launcher"
+ android:label="@string/app_name"
+ android:roundIcon="@mipmap/ic_launcher_round"
+ android:supportsRtl="true"
+ android:theme="@style/AppTheme">
+ <activity
+ android:name=".LauncherActivity"
+ android:launchMode="singleInstance"
+ android:documentLaunchMode="always">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+ <activity
+ android:name=".SingleTopActivity"
+ android:launchMode="singleTop" />
+ <activity
+ android:name=".SingleInstanceActivity"
+ android:launchMode="singleInstance" />
+ <activity
+ android:name=".SingleTaskActivity"
+ android:launchMode="singleTask" />
+ <activity
+ android:name=".TaskAffinity1Activity"
+ android:launchMode="standard"
+ android:allowTaskReparenting="true"
+ android:taskAffinity=".t1" />
+ <activity
+ android:name=".TaskAffinity2Activity"
+ android:launchMode="standard"
+ android:allowTaskReparenting="true"
+ android:taskAffinity=".t2" />
+ <activity
+ android:name=".TaskAffinity3Activity"
+ android:launchMode="standard"
+ android:allowTaskReparenting="true"
+ android:taskAffinity=".t3" />
+ <activity
+ android:name=".ClearTaskOnLaunchActivity"
+ android:launchMode="standard"
+ android:clearTaskOnLaunch="true"
+ android:allowTaskReparenting="true"
+ android:taskAffinity=".t2" />
+ <activity
+ android:name=".DocumentLaunchIntoActivity"
+ android:documentLaunchMode="intoExisting" />
+ <activity
+ android:name=".DocumentLaunchAlwaysActivity"
+ android:documentLaunchMode="always" />
+ <activity
+ android:name=".DocumentLaunchNeverActivity"
+ android:documentLaunchMode="never" />
+ <activity
+ android:name=".NoHistoryActivity"
+ android:noHistory="true" />
+ </application>
+</manifest>
\ No newline at end of file
diff --git a/samples/IntentPlayground/res/drawable/card_background.xml b/samples/IntentPlayground/res/drawable/card_background.xml
new file mode 100644
index 0000000..001247a
--- /dev/null
+++ b/samples/IntentPlayground/res/drawable/card_background.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2017 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.
+-->
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+ <solid android:color="@android:color/background_light"/>
+ <corners android:radius="2dp"/>
+ <padding android:left="0dp" android:top="0dp" android:right="0dp" android:bottom="0dp" />
+</shape>
\ No newline at end of file
diff --git a/samples/IntentPlayground/res/drawable/divider.xml b/samples/IntentPlayground/res/drawable/divider.xml
new file mode 100644
index 0000000..0a0dec3
--- /dev/null
+++ b/samples/IntentPlayground/res/drawable/divider.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2017 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.
+-->
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+ <size android:height="1dp" />
+ <solid android:color="#ffE0E0E0" />
+</shape>
\ No newline at end of file
diff --git a/samples/IntentPlayground/res/drawable/expand_less_mtrl.xml b/samples/IntentPlayground/res/drawable/expand_less_mtrl.xml
new file mode 100644
index 0000000..ee5cddf
--- /dev/null
+++ b/samples/IntentPlayground/res/drawable/expand_less_mtrl.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2017 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24.0"
+ android:viewportHeight="24.0">
+ <path
+ android:fillColor="#FF9E9E9E"
+ android:pathData="M12,8l-6,6 1.41,1.41L12,10.83l4.59,4.58L18,14z"/>
+</vector>
diff --git a/samples/IntentPlayground/res/drawable/expand_more_mtrl.xml b/samples/IntentPlayground/res/drawable/expand_more_mtrl.xml
new file mode 100644
index 0000000..55def3d
--- /dev/null
+++ b/samples/IntentPlayground/res/drawable/expand_more_mtrl.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2017 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24.0"
+ android:viewportHeight="24.0">
+ <path
+ android:fillColor="#FF9E9E9E"
+ android:pathData="M16.59,8.59L12,13.17 7.41,8.59 6,10l6,6 6,-6z"/>
+</vector>
diff --git a/samples/IntentPlayground/res/drawable/expander_group_material.xml b/samples/IntentPlayground/res/drawable/expander_group_material.xml
new file mode 100644
index 0000000..1b497da
--- /dev/null
+++ b/samples/IntentPlayground/res/drawable/expander_group_material.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2017 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.
+-->
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:state_expanded="true" android:drawable="@drawable/expand_more_mtrl" />
+ <item android:drawable="@drawable/expand_less_mtrl" />
+</selector>
diff --git a/samples/IntentPlayground/res/drawable/info_icon.xml b/samples/IntentPlayground/res/drawable/info_icon.xml
new file mode 100644
index 0000000..77ef9f3
--- /dev/null
+++ b/samples/IntentPlayground/res/drawable/info_icon.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2017 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24.0"
+ android:viewportHeight="24.0">
+ <path
+ android:fillColor="#FF000000"
+ android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM13,17h-2v-6h2v6zM13,9h-2L11,7h2v2z"/>
+</vector>
diff --git a/samples/IntentPlayground/res/drawable/success_card_background.xml b/samples/IntentPlayground/res/drawable/success_card_background.xml
new file mode 100644
index 0000000..bc48008
--- /dev/null
+++ b/samples/IntentPlayground/res/drawable/success_card_background.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2017 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.
+-->
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+ <solid android:color="@android:color/holo_green_dark"/>
+ <corners android:radius="2dp"/>
+ <padding android:left="0dp" android:top="0dp" android:right="0dp" android:bottom="0dp" />
+</shape>
\ No newline at end of file
diff --git a/samples/IntentPlayground/res/layout/activity_main.xml b/samples/IntentPlayground/res/layout/activity_main.xml
new file mode 100644
index 0000000..d74e440
--- /dev/null
+++ b/samples/IntentPlayground/res/layout/activity_main.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2017 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.
+-->
+<ScrollView
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:id="@+id/scroll_container"
+ tools:context="com.example.android.intentplayground.BaseActivity">
+
+ <LinearLayout
+ android:id="@+id/fragment_container"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+ android:visibility="visible">
+ </LinearLayout>
+</ScrollView>
diff --git a/samples/IntentPlayground/res/layout/activity_node.xml b/samples/IntentPlayground/res/layout/activity_node.xml
new file mode 100644
index 0000000..bd35d8f
--- /dev/null
+++ b/samples/IntentPlayground/res/layout/activity_node.xml
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2017 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.
+-->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:gravity="center_vertical"
+ android:orientation="horizontal"
+ android:paddingBottom="@dimen/medMargin"
+ android:paddingEnd="@dimen/fullMargin"
+ android:paddingLeft="@dimen/fullMargin"
+ android:paddingRight="@dimen/fullMargin"
+ android:paddingStart="@dimen/fullMargin"
+ android:paddingTop="@dimen/medMargin">
+
+ <FrameLayout
+ android:layout_width="@dimen/listIcon"
+ android:layout_height="@dimen/listIcon"
+ android:clipChildren="true">
+
+ <ImageView
+ android:id="@+id/color_label"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:src="@drawable/card_background"
+ android:tint="@color/defaultTint" />
+
+ <TextView
+ android:id="@+id/activity_label"
+ android:layout_width="@dimen/listLabelTextBox"
+ android:layout_height="@dimen/listLabelTextBox"
+ android:layout_gravity="center"
+ android:text="@string/activity_label"
+ android:textAlignment="center"
+ android:textAppearance="@style/medium"
+ android:textColor="@color/labelText"
+ android:textSize="@dimen/titleText" />
+ </FrameLayout>
+
+ <TextView
+ android:id="@+id/activity_name"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_marginStart="@dimen/medMargin"
+ android:layout_marginEnd="@dimen/smallMargin"
+ android:layout_weight="1"
+ android:text="@string/activity_name"
+ android:textAppearance="@style/normal" />
+
+ <ImageButton
+ android:id="@+id/intent_button"
+ style="?android:attr/borderlessButtonStyle"
+ android:layout_width="@dimen/listIcon"
+ android:layout_height="@dimen/listIcon"
+ android:src="@drawable/info_icon"
+ android:tint="@color/defaultTint"
+ android:tooltipText="@string/intent_button_tooltip"
+ android:contentDescription="@string/intent_button_description" />
+
+</LinearLayout>
diff --git a/samples/IntentPlayground/res/layout/activity_radio_list_item.xml b/samples/IntentPlayground/res/layout/activity_radio_list_item.xml
new file mode 100644
index 0000000..18cccf0
--- /dev/null
+++ b/samples/IntentPlayground/res/layout/activity_radio_list_item.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2017 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.
+-->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+ android:paddingBottom="@dimen/medMargin">
+
+ <RadioButton
+ android:id="@+id/radio_launchMode"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:tag="activityTag"
+ android:text="@string/activity_name_placeholder"
+ android:textAppearance="@style/medium" />
+
+ <TextView
+ android:id="@+id/activity_desc"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginStart="@dimen/blockMargin"
+ android:text="@string/activity_radio_description"
+ android:textAppearance="@style/caption" />
+</LinearLayout>
diff --git a/samples/IntentPlayground/res/layout/checkbox_list_item.xml b/samples/IntentPlayground/res/layout/checkbox_list_item.xml
new file mode 100644
index 0000000..9ffc93c
--- /dev/null
+++ b/samples/IntentPlayground/res/layout/checkbox_list_item.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2017 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.
+-->
+<CheckBox
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/checkBox_item"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:text="@string/checkbox_placeholder"
+ android:textAppearance="@style/normal" />
diff --git a/samples/IntentPlayground/res/layout/dialog_list_item.xml b/samples/IntentPlayground/res/layout/dialog_list_item.xml
new file mode 100644
index 0000000..6be9d74
--- /dev/null
+++ b/samples/IntentPlayground/res/layout/dialog_list_item.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2017 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.
+-->
+<TextView xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/item"
+ android:layout_width="match_parent"
+ android:layout_height="@dimen/listItem"
+ android:gravity="center_vertical"
+ android:paddingLeft="@dimen/fullMargin"
+ android:paddingRight="@dimen/fullMargin"
+ android:text="@string/dialog_intent_flag_placeholder"
+ android:textAppearance="@style/normal"
+ android:textSize="@dimen/regularText">
+
+</TextView>
\ No newline at end of file
diff --git a/samples/IntentPlayground/res/layout/fragment_build_intent.xml b/samples/IntentPlayground/res/layout/fragment_build_intent.xml
new file mode 100644
index 0000000..5cc5f47
--- /dev/null
+++ b/samples/IntentPlayground/res/layout/fragment_build_intent.xml
@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2017 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.
+-->
+<LinearLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:id="@+id/build_intent_container"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginEnd="@dimen/smallMargin"
+ android:layout_marginLeft="@dimen/smallMargin"
+ android:layout_marginRight="@dimen/smallMargin"
+ android:layout_marginStart="@dimen/smallMargin"
+ android:layout_marginTop="@dimen/smallMargin"
+ android:background="@drawable/card_background"
+ android:elevation="@dimen/cardElevation"
+ android:orientation="vertical"
+ android:padding="@dimen/medMargin">
+
+ <TextView
+ android:id="@+id/build_intent"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/build_intent"
+ android:textAppearance="@style/title" />
+
+ <TextView
+ android:id="@+id/flags_hint"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/build_intent_caption" />
+
+ <LinearLayout
+ android:id="@+id/build_intent_flags"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+ android:paddingBottom="@dimen/smallMargin"
+ android:paddingTop="@dimen/smallMargin" />
+
+ <View
+ android:layout_width="match_parent"
+ android:layout_height="@dimen/dividerHeight"
+ android:layout_marginVertical="@dimen/smallMargin"
+ android:background="@drawable/divider" />
+
+ <TextView
+ android:id="@+id/textView"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginVertical="@dimen/smallMargin"
+ android:text="@string/target_activity" />
+
+ <RadioGroup
+ android:id="@+id/radioGroup_launchMode"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:checkedButton="@+id/radio_launchMode_standard"
+ android:orientation="vertical" />
+
+ <Button
+ android:id="@+id/launch_button"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:onClick="launchActivity"
+ android:text="@string/launch_activity_button" />
+</LinearLayout>
\ No newline at end of file
diff --git a/samples/IntentPlayground/res/layout/fragment_current_task.xml b/samples/IntentPlayground/res/layout/fragment_current_task.xml
new file mode 100644
index 0000000..d299f8b
--- /dev/null
+++ b/samples/IntentPlayground/res/layout/fragment_current_task.xml
@@ -0,0 +1,117 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2017 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.
+-->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_margin="@dimen/smallMargin"
+ android:background="@drawable/card_background"
+ android:elevation="@dimen/cardElevation"
+ android:orientation="vertical"
+ android:paddingBottom="@dimen/medMargin"
+ android:paddingEnd="@dimen/fullMargin"
+ android:paddingLeft="@dimen/fullMargin"
+ android:paddingRight="@dimen/fullMargin"
+ android:paddingStart="@dimen/fullMargin"
+ android:paddingTop="@dimen/medMargin">
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="@dimen/medMargin"
+ android:orientation="horizontal">
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginEnd="@dimen/medMargin"
+ android:text="@string/current_task"
+ android:textAppearance="@style/medium" />
+
+ <TextView
+ android:id="@+id/current_task"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:text="@string/current_task_placeholder"
+ android:textAppearance="@style/normal" />
+
+ </LinearLayout>
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="@dimen/medMargin"
+ android:orientation="horizontal">
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginEnd="@dimen/medMargin"
+ android:text="@string/current_activity"
+ android:textAppearance="@style/medium" />
+
+ <TextView
+ android:id="@+id/current_activity"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:text="@string/current_activity_placeholder"
+ android:textAppearance="@style/normal" />
+ </LinearLayout>
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="@dimen/medMargin"
+ android:orientation="horizontal">
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginEnd="@dimen/medMargin"
+ android:text="@string/last_task"
+ android:textAppearance="@style/medium" />
+
+ <TextView
+ android:id="@+id/last_task"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:text="@string/last_task_placeholder"
+ android:textAppearance="@style/normal" />
+ </LinearLayout>
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal">
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginEnd="@dimen/medMargin"
+ android:text="@string/last_activity"
+ android:textAppearance="@style/medium" />
+
+ <TextView
+ android:id="@+id/last_activity"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:text="@string/last_activity_placeholder"
+ android:textAppearance="@style/normal" />
+ </LinearLayout>
+</LinearLayout>
\ No newline at end of file
diff --git a/samples/IntentPlayground/res/layout/fragment_intent.xml b/samples/IntentPlayground/res/layout/fragment_intent.xml
new file mode 100644
index 0000000..76e8857
--- /dev/null
+++ b/samples/IntentPlayground/res/layout/fragment_intent.xml
@@ -0,0 +1,186 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2017 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.
+-->
+<LinearLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/intent_container"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginEnd="@dimen/smallMargin"
+ android:layout_marginLeft="@dimen/smallMargin"
+ android:layout_marginRight="@dimen/smallMargin"
+ android:layout_marginStart="@dimen/smallMargin"
+ android:layout_marginTop="@dimen/smallMargin"
+ android:background="@drawable/card_background"
+ android:elevation="@dimen/cardElevation"
+ android:orientation="vertical"
+ android:padding="@dimen/medMargin">
+
+ <TextView
+ android:id="@+id/editText"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:contentDescription="@string/current_intent_label_description"
+ android:inputType="none"
+ android:maxLines="1"
+ android:text="@string/intent_fragment_title"
+ android:textAppearance="@style/title" />
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_marginTop="@dimen/smallMargin"
+ android:orientation="horizontal">
+
+ <TextView
+ android:id="@+id/actionLabel"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginEnd="@dimen/smallMargin"
+ android:contentDescription="@string/action_label_description"
+ android:text="@string/action_label"
+ android:textAppearance="@style/medium" />
+
+ <TextView
+ android:id="@+id/intentAction"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:text="@string/action_placeholder"
+ android:textAppearance="@style/normal" />
+ </LinearLayout>
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_marginTop="@dimen/smallMargin"
+ android:orientation="horizontal">
+
+ <TextView
+ android:id="@+id/uriLabel"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginEnd="@dimen/smallMargin"
+ android:contentDescription="@string/data_uri_label_description"
+ android:text="@string/data_uri_label"
+ android:textAppearance="@style/medium" />
+
+ <TextView
+ android:id="@+id/intentUri"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:text="@string/data_uri_placeholder"
+ android:textAppearance="@style/normal" />
+ </LinearLayout>
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_marginTop="@dimen/smallMargin"
+ android:orientation="horizontal">
+
+ <TextView
+ android:id="@+id/typeLabel"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginEnd="@dimen/smallMargin"
+ android:contentDescription="@string/type_label_description"
+ android:text="@string/type_label"
+ android:textAppearance="@style/medium" />
+
+ <TextView
+ android:id="@+id/intentType"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:text="@string/type_placeholder"
+ android:textAppearance="@style/normal" />
+ </LinearLayout>
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_marginTop="@dimen/smallMargin"
+ android:orientation="horizontal">
+
+ <TextView
+ android:id="@+id/packageLabel"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginEnd="@dimen/smallMargin"
+ android:contentDescription="@string/package_label_description"
+ android:text="@string/package_label"
+ android:textAppearance="@style/medium" />
+
+ <TextView
+ android:id="@+id/intentPackage"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:text="@string/package_placeholder"
+ android:textAppearance="@style/normal" />
+ </LinearLayout>
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_marginTop="@dimen/smallMargin"
+ android:orientation="vertical">
+
+ <TextView
+ android:id="@+id/categoryLabel"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginEnd="@dimen/smallMargin"
+ android:contentDescription="@string/category_label_description"
+ android:text="@string/category_label"
+ android:textAppearance="@style/medium" />
+
+ <LinearLayout
+ android:id="@+id/intentCategories"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+ android:paddingBottom="@dimen/smallMargin"
+ android:paddingTop="@dimen/smallMargin" />
+
+ </LinearLayout>
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="@dimen/smallMargin"
+ android:orientation="vertical">
+
+ <TextView
+ android:id="@+id/flagsLabel"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginEnd="@dimen/smallMargin"
+ android:contentDescription="@string/flags_label_description"
+ android:text="@string/flags_label"
+ android:textAppearance="@style/medium" />
+
+ <LinearLayout
+ android:id="@+id/intentFlags"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+ android:paddingBottom="@dimen/smallMargin"
+ android:paddingTop="@dimen/smallMargin" />
+
+ </LinearLayout>
+</LinearLayout>
\ No newline at end of file
diff --git a/samples/IntentPlayground/res/layout/fragment_intent_dialog.xml b/samples/IntentPlayground/res/layout/fragment_intent_dialog.xml
new file mode 100644
index 0000000..eb8d6ad
--- /dev/null
+++ b/samples/IntentPlayground/res/layout/fragment_intent_dialog.xml
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2017 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.
+-->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:orientation="vertical" android:layout_width="wrap_content"
+ android:layout_height="match_parent"
+ android:minWidth="@dimen/dialogWidth">
+
+ <ListView
+ android:id="@+id/flag_list"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_weight="1" />
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:gravity="right"
+ android:orientation="horizontal"
+ android:paddingEnd="@dimen/smallMargin">
+
+ <Button
+ android:id="@+id/copy_flags_button"
+ style="@android:style/Widget.Material.Light.Button.Borderless.Colored"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="Use flags for next launch" />
+
+ <Button
+ android:id="@+id/dialog_cancel"
+ style="@android:style/Widget.Material.Light.Button.Borderless.Colored"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginLeft="@dimen/smallMargin"
+ android:text="@android:string/cancel" />
+ </LinearLayout>
+</LinearLayout>
\ No newline at end of file
diff --git a/samples/IntentPlayground/res/layout/fragment_tree.xml b/samples/IntentPlayground/res/layout/fragment_tree.xml
new file mode 100644
index 0000000..8856e79
--- /dev/null
+++ b/samples/IntentPlayground/res/layout/fragment_tree.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2017 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.
+-->
+<LinearLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/task_tree_container"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_margin="@dimen/smallMargin"
+ android:background="@drawable/card_background"
+ android:elevation="@dimen/cardElevation"
+ android:orientation="vertical">
+
+ <TextView
+ android:id="@+id/task_tree_title"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="@dimen/smallMargin"
+ android:layout_marginStart="@dimen/medMargin"
+ android:layout_marginTop="@dimen/medMargin"
+ android:text="@string/task_tree_title"
+ android:textAppearance="@style/title" />
+ <LinearLayout
+ android:id="@+id/task_tree"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+ android:divider="@drawable/divider"
+ android:showDividers="middle"/>
+</LinearLayout>
\ No newline at end of file
diff --git a/samples/IntentPlayground/res/layout/section_header.xml b/samples/IntentPlayground/res/layout/section_header.xml
new file mode 100644
index 0000000..5edf23d
--- /dev/null
+++ b/samples/IntentPlayground/res/layout/section_header.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2017 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.
+-->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="vertical" android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:padding="@dimen/smallMargin">
+
+ <TextView
+ android:id="@+id/header_title"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/intent_section_title"
+ android:textAppearance="@style/subsection" />
+</LinearLayout>
\ No newline at end of file
diff --git a/samples/IntentPlayground/res/layout/simple_list_item.xml b/samples/IntentPlayground/res/layout/simple_list_item.xml
new file mode 100644
index 0000000..02c5d45
--- /dev/null
+++ b/samples/IntentPlayground/res/layout/simple_list_item.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2017 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.
+-->
+<TextView xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/text1"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:text="@string/placeholder" />
\ No newline at end of file
diff --git a/samples/IntentPlayground/res/layout/task_node.xml b/samples/IntentPlayground/res/layout/task_node.xml
new file mode 100644
index 0000000..9d1d0d9
--- /dev/null
+++ b/samples/IntentPlayground/res/layout/task_node.xml
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2017 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.
+-->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:layout_width="match_parent"
+ android:gravity="center_vertical|left"
+ android:layout_height="@dimen/listItem" >
+
+ <TextView
+ android:id="@+id/task_label"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginStart="@dimen/fullMargin"
+ android:layout_weight="0"
+ android:text="@string/placeholder"
+ android:textAppearance="@style/medium"
+ android:textSize="@dimen/regularText" />
+
+ <TextView
+ android:id="@+id/task_id"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_weight="0"
+ android:text="@string/placeholder"
+ android:textAppearance="@style/medium"
+ android:textSize="@dimen/regularText" />
+
+ <TextView
+ android:id="@+id/num_activities"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_marginEnd="@dimen/medMargin"
+ android:layout_marginStart="@dimen/medMargin"
+ android:layout_weight="1"
+ android:text="@string/placeholder"
+ android:textSize="@dimen/smallText" />
+
+ <ImageView
+ android:id="@+id/group_indicator"
+ android:layout_width="@dimen/listControl"
+ android:layout_height="@dimen/listControl"
+ android:layout_marginEnd="@dimen/fullMargin"
+ android:src="@drawable/expand_more_mtrl" />
+</LinearLayout>
diff --git a/samples/IntentPlayground/res/layout/tree_node_composite.xml b/samples/IntentPlayground/res/layout/tree_node_composite.xml
new file mode 100644
index 0000000..e944762
--- /dev/null
+++ b/samples/IntentPlayground/res/layout/tree_node_composite.xml
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2017 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.
+-->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="vertical" android:layout_width="match_parent"
+ android:layout_height="match_parent">
+ <LinearLayout
+ android:id="@+id/group_item"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical" />
+ <LinearLayout
+ android:id="@+id/child_item"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+ android:visibility="gone"
+ android:paddingBottom="@dimen/medMargin" />
+
+ <LinearLayout
+ android:id="@+id/move_task_to_front_bar"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:gravity="end"
+ android:orientation="horizontal"
+ android:paddingBottom="@dimen/medMargin"
+ android:paddingEnd="@dimen/smallMargin"
+ android:paddingStart="@dimen/smallMargin"
+ android:visibility="gone" >
+
+ <Button
+ android:id="@+id/kill_task_button"
+ style="@style/flatButton"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_weight="0"
+ android:text="@string/kill_task_button" />
+
+ <Button
+ android:id="@+id/move_task_to_front_button"
+ style="@style/flatButton"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_weight="0"
+ android:text="@string/move_to_front" />
+
+ </LinearLayout>
+</LinearLayout>
\ No newline at end of file
diff --git a/samples/IntentPlayground/res/mipmap-hdpi/ic_launcher.png b/samples/IntentPlayground/res/mipmap-hdpi/ic_launcher.png
new file mode 100644
index 0000000..cde69bc
--- /dev/null
+++ b/samples/IntentPlayground/res/mipmap-hdpi/ic_launcher.png
Binary files differ
diff --git a/samples/IntentPlayground/res/mipmap-hdpi/ic_launcher_round.png b/samples/IntentPlayground/res/mipmap-hdpi/ic_launcher_round.png
new file mode 100644
index 0000000..9a078e3
--- /dev/null
+++ b/samples/IntentPlayground/res/mipmap-hdpi/ic_launcher_round.png
Binary files differ
diff --git a/samples/IntentPlayground/res/mipmap-mdpi/ic_launcher.png b/samples/IntentPlayground/res/mipmap-mdpi/ic_launcher.png
new file mode 100644
index 0000000..c133a0c
--- /dev/null
+++ b/samples/IntentPlayground/res/mipmap-mdpi/ic_launcher.png
Binary files differ
diff --git a/samples/IntentPlayground/res/mipmap-mdpi/ic_launcher_round.png b/samples/IntentPlayground/res/mipmap-mdpi/ic_launcher_round.png
new file mode 100644
index 0000000..efc028a
--- /dev/null
+++ b/samples/IntentPlayground/res/mipmap-mdpi/ic_launcher_round.png
Binary files differ
diff --git a/samples/IntentPlayground/res/mipmap-xhdpi/ic_launcher.png b/samples/IntentPlayground/res/mipmap-xhdpi/ic_launcher.png
new file mode 100644
index 0000000..bfa42f0
--- /dev/null
+++ b/samples/IntentPlayground/res/mipmap-xhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/IntentPlayground/res/mipmap-xhdpi/ic_launcher_round.png b/samples/IntentPlayground/res/mipmap-xhdpi/ic_launcher_round.png
new file mode 100644
index 0000000..3af2608
--- /dev/null
+++ b/samples/IntentPlayground/res/mipmap-xhdpi/ic_launcher_round.png
Binary files differ
diff --git a/samples/IntentPlayground/res/mipmap-xxhdpi/ic_launcher.png b/samples/IntentPlayground/res/mipmap-xxhdpi/ic_launcher.png
new file mode 100644
index 0000000..324e72c
--- /dev/null
+++ b/samples/IntentPlayground/res/mipmap-xxhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/IntentPlayground/res/mipmap-xxhdpi/ic_launcher_round.png b/samples/IntentPlayground/res/mipmap-xxhdpi/ic_launcher_round.png
new file mode 100644
index 0000000..9bec2e6
--- /dev/null
+++ b/samples/IntentPlayground/res/mipmap-xxhdpi/ic_launcher_round.png
Binary files differ
diff --git a/samples/IntentPlayground/res/mipmap-xxxhdpi/ic_launcher.png b/samples/IntentPlayground/res/mipmap-xxxhdpi/ic_launcher.png
new file mode 100644
index 0000000..aee44e1
--- /dev/null
+++ b/samples/IntentPlayground/res/mipmap-xxxhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/IntentPlayground/res/mipmap-xxxhdpi/ic_launcher_round.png b/samples/IntentPlayground/res/mipmap-xxxhdpi/ic_launcher_round.png
new file mode 100644
index 0000000..34947cd
--- /dev/null
+++ b/samples/IntentPlayground/res/mipmap-xxxhdpi/ic_launcher_round.png
Binary files differ
diff --git a/samples/IntentPlayground/res/values/colors.xml b/samples/IntentPlayground/res/values/colors.xml
new file mode 100644
index 0000000..6e7ce91
--- /dev/null
+++ b/samples/IntentPlayground/res/values/colors.xml
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2017 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<resources>
+ <color name="colorPrimary">#3F51B5</color>
+ <color name="colorPrimaryDark">#303F9F</color>
+ <color name="colorAccent">#FF4081</color>
+ <!-- Material design colours from
+ https://material.io/guidelines/style/color.html#color-color-palette -->
+ <color name="md_red_500">#F44336</color>
+ <color name="md_pink_500">#E91E63</color>
+ <color name="md_purple_500">#9C27B0</color>
+ <color name="md_deep_purple_500">#673AB7</color>
+ <color name="md_indigo_500">#3F51B5</color>
+ <color name="md_blue_500">#2196F3</color>
+ <color name="md_light_blue_500">#03A9F4</color>
+ <color name="md_cyan_500">#00BCD4</color>
+ <color name="md_teal_500">#009688</color>
+ <color name="md_green_500">#4CAF50</color>
+ <color name="md_light_green_500">#8BC34A</color>
+ <color name="md_lime_500">#CDDC39</color>
+ <color name="md_grey_500">#9E9E9E</color>
+ <color name="md_amber_500">#FFC107</color>
+ <color name="md_yellow_500">#FFEB3B</color>
+ <color name="md_orange_500">#FF9800</color>
+ <color name="md_deep_orange_500">#FF5722</color>
+ <color name="md_brown_500">#795548</color>
+ <color name="md_blue_grey_500">#607D8B</color>
+ <color name="defaultTint">@color/md_teal_500</color>
+ <color name="labelText">@android:color/white</color>
+</resources>
diff --git a/samples/IntentPlayground/res/values/dimens.xml b/samples/IntentPlayground/res/values/dimens.xml
new file mode 100644
index 0000000..73e89fe
--- /dev/null
+++ b/samples/IntentPlayground/res/values/dimens.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <dimen name="dialogWidth">@android:dimen/dialog_min_width_major</dimen>
+ <dimen name="smallMargin">8dp</dimen>
+ <dimen name="medMargin">16dp</dimen>
+ <dimen name="fullMargin">24dp</dimen>
+ <dimen name="blockMargin">32dp</dimen>
+ <dimen name="cardElevation">2dp</dimen>
+ <dimen name="titleText">20sp</dimen>
+ <dimen name="regularText">16sp</dimen>
+ <dimen name="smallText">12sp</dimen>
+ <dimen name="listItem">48dp</dimen>
+ <dimen name="listIcon">48dp</dimen>
+ <dimen name="listControl">24dp</dimen>
+ <dimen name="listLabelTextBox">24dp</dimen>
+ <dimen name="dividerHeight">1dp</dimen>
+</resources>
\ No newline at end of file
diff --git a/samples/IntentPlayground/res/values/strings.xml b/samples/IntentPlayground/res/values/strings.xml
new file mode 100644
index 0000000..83f39a8
--- /dev/null
+++ b/samples/IntentPlayground/res/values/strings.xml
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2017 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<resources>
+ <string name="app_name">Intent Playground</string>
+ <string name="task_id">com.example.android.intentplayground.taskId</string>
+ <string name="activity_index">com.example.android.intentplayground.activityIndex</string>
+ <string name="activity_name">CompName</string>
+ <string name="activity_label">#1</string>
+ <string name="intent_button_description">This button triggers the intent list dialog for this activity</string>
+ <string name="build_intent">Build Intent</string>
+ <string name="build_intent_caption">Select flags with which the intent for the launched activity will be built:</string>
+ <string name="target_activity">Select the target activity:</string>
+ <string name="launch_activity_button">Launch activity</string>
+ <string name="activity_name_placeholder">Activity Name</string>
+ <string name="intent_button_tooltip">View Intent flags</string>
+ <string name="activity_radio_description">Activity description</string>
+ <string name="checkbox_placeholder">CheckBox</string>
+ <string name="dialog_intent_flag_placeholder">intent flag</string>
+ <string name="current_task">Current Task</string>
+ <string name="current_task_placeholder">None</string>
+ <string name="current_activity">Current Activity</string>
+ <string name="current_activity_placeholder">None</string>
+ <string name="last_task">Last Task</string>
+ <string name="last_task_placeholder">None</string>
+ <string name="last_activity">Last Activity</string>
+ <string name="last_activity_placeholder">None</string>
+ <string name="current_intent_label_description">Intent passed to current activity</string>
+ <string name="intent_fragment_title">Current Intent</string>
+ <string name="action_label_description">Label for the action of the current intent</string>
+ <string name="action_label">Action</string>
+ <string name="action_placeholder">which action?</string>
+ <string name="data_uri_label_description">Label for the action of the current intent</string>
+ <string name="data_uri_label">Data URI</string>
+ <string name="data_uri_placeholder">://</string>
+ <string name="type_label_description">Label for the action of the current intent</string>
+ <string name="type_label">Type</string>
+ <string name="type_placeholder">which action?</string>
+ <string name="package_label_description">Label for the action of the current intent</string>
+ <string name="package_label">Package</string>
+ <string name="package_placeholder">which action?</string>
+ <string name="category_label_description">Label for the action of the current intent</string>
+ <string name="category_label">Categories</string>
+ <string name="flags_label_description">Label for the action of the current intent</string>
+ <string name="flags_label">Flags</string>
+ <string name="task_tree_title">Hierarchy</string>
+ <string name="intent_section_title">Title</string>
+ <string name="placeholder">placeholder</string>
+ <string name="kill_task_button">remove</string>
+ <string name="move_to_front">Move to front</string>
+ <string name="current_task_hierarchy_title">Current Hierarchy</string>
+ <string name="expected_task_hierarchy_title">Expected Hierarchy</string>
+</resources>
diff --git a/samples/IntentPlayground/res/values/styles.xml b/samples/IntentPlayground/res/values/styles.xml
new file mode 100644
index 0000000..ef4cd22
--- /dev/null
+++ b/samples/IntentPlayground/res/values/styles.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2017 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<resources>
+ <!-- Base application theme. -->
+ <style name="AppTheme" parent="@android:style/Theme.Material.Light">
+ <item name="android:colorPrimary">@color/colorPrimary</item>
+ <item name="android:colorPrimaryDark">@color/colorPrimaryDark</item>
+ <item name="android:colorAccent">@color/colorAccent</item>
+ </style>
+ <style name="flatButton" parent="@android:style/Widget.Material.Light.Button.Borderless.Colored" />
+ <style name="title" parent="@android:style/TextAppearance.Material.Title" />
+ <style name="normal" parent="@android:style/TextAppearance.Material.Body1" />
+ <style name="medium" parent="@android:style/TextAppearance.Material.Body2" />
+ <style name="caption" parent="@android:style/TextAppearance.Material.Caption" />
+ <style name="subsection" parent="@android:style/TextAppearance.Material.Medium" />
+</resources>
diff --git a/samples/IntentPlayground/src/com/example/android/intentplayground/BaseActivity.java b/samples/IntentPlayground/src/com/example/android/intentplayground/BaseActivity.java
new file mode 100644
index 0000000..b9b70e1
--- /dev/null
+++ b/samples/IntentPlayground/src/com/example/android/intentplayground/BaseActivity.java
@@ -0,0 +1,126 @@
+/*
+ * Copyright (C) 2017 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.example.android.intentplayground;
+
+import android.app.Activity;
+import android.app.ActivityManager;
+import android.app.FragmentManager;
+import android.app.FragmentTransaction;
+import android.content.ComponentName;
+import android.content.Intent;
+import android.os.Bundle;
+import android.util.Log;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.CheckBox;
+import android.widget.LinearLayout;
+
+import java.util.ArrayList;
+import java.util.LinkedList;
+import java.util.List;
+
+/**
+ * All of the other activities extend BaseActivity, the shared functionality is implemented here
+ */
+public abstract class BaseActivity extends Activity {
+ public final static String LAUNCH_FORWARD = "com.example.android.launchForward";
+ public final static String BUILDER_FRAGMENT = "com.example.android.builderFragment";
+ protected ComponentName mActivityToLaunch;
+ protected List<ActivityManager.AppTask> mTasks;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_main);
+ if (BuildConfig.DEBUG) Log.d(this.getLocalClassName(), "onCreate()");
+ Intent intent = getIntent();
+ FragmentManager fragmentManager = getFragmentManager();
+ FragmentTransaction transaction = fragmentManager.beginTransaction();
+ transaction.add(R.id.fragment_container, new CurrentTaskFragment());
+ TreeFragment currentTaskFrag = new TreeFragment();
+ Bundle args = new Bundle();
+ args.putString(TreeFragment.FRAGMENT_TITLE,
+ getString(R.string.current_task_hierarchy_title));
+ currentTaskFrag.setArguments(args);
+ transaction.add(R.id.fragment_container, currentTaskFrag);
+
+ if (intent.hasExtra(TestBase.EXPECTED_HIERARCHY)) {
+ // That means this activity was launched as a test show the result fragment
+ TreeFragment expectedView = new TreeFragment();
+ Bundle expectedArgs = new Bundle();
+ expectedArgs.putParcelable(TreeFragment.TREE_NODE,
+ intent.getParcelableExtra(TestBase.EXPECTED_HIERARCHY));
+ expectedArgs.putString(TreeFragment.FRAGMENT_TITLE,
+ getString(R.string.expected_task_hierarchy_title));
+ expectedView.setArguments(expectedArgs);
+ transaction.add(R.id.fragment_container, expectedView);
+ }
+
+ transaction.add(R.id.fragment_container, new IntentFragment());
+ transaction.add(R.id.fragment_container, new IntentBuilderFragment(), BUILDER_FRAGMENT);
+ transaction.commit();
+
+ if (intent.hasExtra(LAUNCH_FORWARD)) {
+ ArrayList<Intent> intents = intent.getParcelableArrayListExtra(LAUNCH_FORWARD);
+ if (!intents.isEmpty()) {
+ Intent nextIntent = intents.remove(0);
+ nextIntent.putParcelableArrayListExtra(LAUNCH_FORWARD, intents);
+ if (BuildConfig.DEBUG) {
+ Log.d(this.getLocalClassName(),
+ LAUNCH_FORWARD + " " + nextIntent.getComponent().toString());
+ }
+ startActivity(nextIntent);
+ }
+ }
+ }
+
+ /**
+ * Launches activity with the selected options
+ */
+ public void launchActivity(View view) {
+ Intent customIntent = new Intent();
+ LinearLayout flagBuilder = findViewById(R.id.build_intent_flags);
+ // Gather flags from flag builder checkbox list
+ childrenOfGroup(flagBuilder, CheckBox.class)
+ .forEach(checkbox -> {
+ int flagVal = FlagUtils.value(checkbox.getText().toString());
+ if (checkbox.isChecked()) customIntent.addFlags(flagVal);
+ else customIntent.removeFlags(flagVal);
+ });
+ customIntent.setComponent(mActivityToLaunch);
+ startActivity(customIntent);
+ }
+
+ /**
+ * Convenience method to retrieve children of a certain type from a {@link ViewGroup}
+ * @param group the ViewGroup to retrieve children from
+ */
+ protected static <T> List<T> childrenOfGroup(ViewGroup group, Class<T> viewType) {
+ List<T> list = new LinkedList<>();
+ for (int i = 0; i < group.getChildCount(); i++) {
+ View v = group.getChildAt(i);
+ if (viewType.isAssignableFrom(v.getClass())) list.add(viewType.cast(v));
+ }
+ return list;
+ }
+
+ @Override
+ protected void onNewIntent(Intent intent) {
+ super.onNewIntent(intent);
+ setIntent(intent);
+ }
+}
diff --git a/samples/IntentPlayground/src/com/example/android/intentplayground/ClearTaskOnLaunchActivity.java b/samples/IntentPlayground/src/com/example/android/intentplayground/ClearTaskOnLaunchActivity.java
new file mode 100644
index 0000000..3eea73c
--- /dev/null
+++ b/samples/IntentPlayground/src/com/example/android/intentplayground/ClearTaskOnLaunchActivity.java
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2017 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.example.android.intentplayground;
+
+/**
+ * An activity with clearTaskOnLaunch flag set in AndroidManifest.xml
+ */
+public class ClearTaskOnLaunchActivity extends BaseActivity {}
diff --git a/samples/IntentPlayground/src/com/example/android/intentplayground/DocumentLaunchAlwaysActivity.java b/samples/IntentPlayground/src/com/example/android/intentplayground/DocumentLaunchAlwaysActivity.java
new file mode 100644
index 0000000..3e018a2
--- /dev/null
+++ b/samples/IntentPlayground/src/com/example/android/intentplayground/DocumentLaunchAlwaysActivity.java
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2017 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.example.android.intentplayground;
+
+/**
+ * An activity with documentLaunch="always" set in AndroidManifest.xml
+ */
+public class DocumentLaunchAlwaysActivity extends BaseActivity {}
diff --git a/samples/IntentPlayground/src/com/example/android/intentplayground/DocumentLaunchIntoActivity.java b/samples/IntentPlayground/src/com/example/android/intentplayground/DocumentLaunchIntoActivity.java
new file mode 100644
index 0000000..b66055c
--- /dev/null
+++ b/samples/IntentPlayground/src/com/example/android/intentplayground/DocumentLaunchIntoActivity.java
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2017 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.example.android.intentplayground;
+
+/**
+ * An activity with documentLaunch="intoExisting" set in AndroidManifest.xml
+ */
+public class DocumentLaunchIntoActivity extends BaseActivity {}
diff --git a/samples/IntentPlayground/src/com/example/android/intentplayground/DocumentLaunchNeverActivity.java b/samples/IntentPlayground/src/com/example/android/intentplayground/DocumentLaunchNeverActivity.java
new file mode 100644
index 0000000..d0e93d6
--- /dev/null
+++ b/samples/IntentPlayground/src/com/example/android/intentplayground/DocumentLaunchNeverActivity.java
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2017 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.example.android.intentplayground;
+
+/**
+ * An activity with documentLaunch="never" set in AndroidManifest.xml
+ */
+public class DocumentLaunchNeverActivity extends BaseActivity {}
diff --git a/samples/IntentPlayground/src/com/example/android/intentplayground/LauncherActivity.java b/samples/IntentPlayground/src/com/example/android/intentplayground/LauncherActivity.java
new file mode 100644
index 0000000..70429e4
--- /dev/null
+++ b/samples/IntentPlayground/src/com/example/android/intentplayground/LauncherActivity.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2017 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.example.android.intentplayground;
+
+import android.content.ComponentName;
+import android.content.Intent;
+import android.os.Bundle;
+
+/**
+ * A singleInstance activity that is responsible for a launching a bootstrap stack of activities
+ */
+public class LauncherActivity extends BaseActivity {
+ private TestBase mTester;
+ public static final String TAG = "LauncherActivity";
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ Node mRoot = new Node(new ComponentName(this, LauncherActivity.class));
+ // Describe initial setup of tasks
+ // create singleTask, singleInstance, and two documents in separate tasks
+ mRoot.addChild( new Node(new ComponentName(this, SingleTaskActivity.class)))
+ .addChild( new Node(new ComponentName(this, DocumentLaunchAlwaysActivity.class)))
+ .addChild( new Node(new ComponentName(this, DocumentLaunchIntoActivity.class)));
+ // Create three tasks with three activities each, with affinity set
+ Node taskAffinity1 = new Node(new ComponentName(this, TaskAffinity1Activity.class));
+ taskAffinity1
+ .addChild(new Node(new ComponentName(this, TaskAffinity1Activity.class)))
+ .addChild(new Node(new ComponentName(this, TaskAffinity1Activity.class)));
+ Node taskAffinity2 = new Node(new ComponentName(this, ClearTaskOnLaunchActivity.class));
+ taskAffinity2
+ .addChild(new Node(new ComponentName(this, TaskAffinity2Activity.class)))
+ .addChild(new Node(new ComponentName(this, TaskAffinity2Activity.class)));
+ Node taskAffinity3 = new Node(new ComponentName(this, TaskAffinity3Activity.class));
+ taskAffinity3
+ .addChild(new Node(new ComponentName(this, TaskAffinity3Activity.class)))
+ .addChild(new Node(new ComponentName(this, TaskAffinity3Activity.class)));
+ mRoot.addChild(taskAffinity1).addChild(taskAffinity2).addChild(taskAffinity3);
+ mTester = new TestBase(this, mRoot);
+ mTester.setupActivities(TestBase.LaunchStyle.TASK_STACK_BUILDER);
+ }
+
+ /**
+ * Launches activity with the selected options
+ */
+ public void launchActivity(Intent customIntent) {
+ customIntent.putExtra(TestBase.EXPECTED_HIERARCHY, mTester.computeExpected(customIntent));
+ startActivity(customIntent);
+ }
+}
\ No newline at end of file
diff --git a/samples/IntentPlayground/src/com/example/android/intentplayground/NoHistoryActivity.java b/samples/IntentPlayground/src/com/example/android/intentplayground/NoHistoryActivity.java
new file mode 100644
index 0000000..06dae25
--- /dev/null
+++ b/samples/IntentPlayground/src/com/example/android/intentplayground/NoHistoryActivity.java
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2017 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.example.android.intentplayground;
+
+/**
+ * An activity with noHistory="true" set in AndroidManifest.xml
+ */
+public class NoHistoryActivity extends BaseActivity {}
\ No newline at end of file
diff --git a/samples/IntentPlayground/src/com/example/android/intentplayground/Shims.java b/samples/IntentPlayground/src/com/example/android/intentplayground/Shims.java
new file mode 100644
index 0000000..46bdaf7
--- /dev/null
+++ b/samples/IntentPlayground/src/com/example/android/intentplayground/Shims.java
@@ -0,0 +1,76 @@
+/** TODO: http://go/java-style#javadoc */
+package com.example.android.intentplayground;
+
+import android.app.Fragment;
+import android.content.ComponentName;
+import android.content.Context;
+import android.content.Intent;
+import android.os.Parcel;
+import android.os.Parcelable;
+import android.view.View;
+
+import java.util.List;
+import java.util.Map;
+
+class TestBase {
+ static final String EXPECTED_HIERARCHY = "";
+ enum LaunchStyle { TASK_STACK_BUILDER, COMMAND_LINE, LAUNCH_FORWARD }
+ TestBase(Context context, Node hierarchy) {}
+ void setupActivities(LaunchStyle style) {}
+ Node computeExpected(Intent intent) { return null; }
+ static Node describeTaskHierarchy(Context context) { return null; }
+
+}
+class TreeFragment extends Fragment {
+ static final String TREE_NODE = "";
+ static final String FRAGMENT_TITLE = "";
+}
+class CurrentTaskFragment extends Fragment {}
+class IntentFragment extends Fragment {}
+class IntentBuilderFragment extends Fragment implements View.OnClickListener {
+ ComponentName mActivityToLaunch;
+ void selectLaunchMode(View view) {}
+ public void onClick(View view) {}
+ void clearFlags() {}
+ void selectFlags(List<String> flags) {}
+}
+class BuildConfig {
+ static final boolean DEBUG = true;
+}
+class Node implements Parcelable, Comparable<Node> {
+ ComponentName name;
+ boolean isTaskNode;
+ int taskId;
+ static final String TAG = "";
+ public static final Creator<Node> CREATOR = new Creator<Node>() {
+ @Override
+ public Node createFromParcel(Parcel in) {
+ return new Node(in);
+ }
+
+ @Override
+ public Node[] newArray(int size) {
+ return new Node[size];
+ }
+ };;
+ List<Node> children;
+ Node(ComponentName data) {}
+ Node(int taskId) {}
+ Node(Node other) {}
+ Node(Parcel in) {}
+ Node addChild(Node child) { return null; }
+ boolean equals(Node other) { return false; }
+ public int compareTo(Node o) {return 0;}
+ @Override
+ public void writeToParcel(Parcel dest, int flags) {}
+ @Override
+ public int describeContents() { return 0; }
+}
+class FlagUtils {
+ static List<String> discoverFlags(Intent intent) { return null; }
+ static List<String> intentFlags() { return null; }
+ static Map<String, List<String>> intentFlagsByCategory() { return null; }
+ static int value(String flagName) { return 0; }
+ static List<String> discoverActivityFlags() { return null; }
+ static String camelify(String snake) { return null; }
+}
\ No newline at end of file
diff --git a/samples/IntentPlayground/src/com/example/android/intentplayground/SingleInstanceActivity.java b/samples/IntentPlayground/src/com/example/android/intentplayground/SingleInstanceActivity.java
new file mode 100644
index 0000000..9687780
--- /dev/null
+++ b/samples/IntentPlayground/src/com/example/android/intentplayground/SingleInstanceActivity.java
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2017 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.example.android.intentplayground;
+
+/**
+ * An activity with launchMode="singleInstance" set in AndroidManifest.xml
+ */
+public class SingleInstanceActivity extends BaseActivity {}
\ No newline at end of file
diff --git a/samples/IntentPlayground/src/com/example/android/intentplayground/SingleTaskActivity.java b/samples/IntentPlayground/src/com/example/android/intentplayground/SingleTaskActivity.java
new file mode 100644
index 0000000..8d3137f
--- /dev/null
+++ b/samples/IntentPlayground/src/com/example/android/intentplayground/SingleTaskActivity.java
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2017 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.example.android.intentplayground;
+
+/**
+ * An activity with launchMode="singleTask" set in AndroidManifest.xml
+ */
+public class SingleTaskActivity extends BaseActivity {}
\ No newline at end of file
diff --git a/samples/IntentPlayground/src/com/example/android/intentplayground/SingleTopActivity.java b/samples/IntentPlayground/src/com/example/android/intentplayground/SingleTopActivity.java
new file mode 100644
index 0000000..b4f846e
--- /dev/null
+++ b/samples/IntentPlayground/src/com/example/android/intentplayground/SingleTopActivity.java
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2017 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.example.android.intentplayground;
+
+/**
+ * An activity with launchMode="singleTop" set in AndroidManifest.xml
+ */
+public class SingleTopActivity extends BaseActivity {}
diff --git a/samples/IntentPlayground/src/com/example/android/intentplayground/TaskAffinity1Activity.java b/samples/IntentPlayground/src/com/example/android/intentplayground/TaskAffinity1Activity.java
new file mode 100644
index 0000000..14609d8
--- /dev/null
+++ b/samples/IntentPlayground/src/com/example/android/intentplayground/TaskAffinity1Activity.java
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2017 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.example.android.intentplayground;
+
+/**
+ * An activity with taskAffinity=".t1" set in AndroidManifest.xml
+ */
+public class TaskAffinity1Activity extends BaseActivity {}
\ No newline at end of file
diff --git a/samples/IntentPlayground/src/com/example/android/intentplayground/TaskAffinity2Activity.java b/samples/IntentPlayground/src/com/example/android/intentplayground/TaskAffinity2Activity.java
new file mode 100644
index 0000000..bf1e9e9
--- /dev/null
+++ b/samples/IntentPlayground/src/com/example/android/intentplayground/TaskAffinity2Activity.java
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2017 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.example.android.intentplayground;
+
+/**
+ * An activity with taskAffinity=".t2" set in AndroidManifest.xml
+ */
+public class TaskAffinity2Activity extends BaseActivity {}
\ No newline at end of file
diff --git a/samples/IntentPlayground/src/com/example/android/intentplayground/TaskAffinity3Activity.java b/samples/IntentPlayground/src/com/example/android/intentplayground/TaskAffinity3Activity.java
new file mode 100644
index 0000000..c48e9fd
--- /dev/null
+++ b/samples/IntentPlayground/src/com/example/android/intentplayground/TaskAffinity3Activity.java
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2017 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.example.android.intentplayground;
+
+/**
+ * An activity with taskAffinity=".t3" set in AndroidManifest.xml
+ */
+public class TaskAffinity3Activity extends BaseActivity {}
\ No newline at end of file