Revert "Finish HomepageActivity when it's not the root of a task and not singleTask."
This reverts commit 5a305645c14bd10fd500ef2923be7d09f378bdb8.
Reason for revert: b/325861149
Change-Id: I4441f939a46bf65514756a015355ea5089147c1d
diff --git a/src/com/android/settings/homepage/SettingsHomepageActivity.java b/src/com/android/settings/homepage/SettingsHomepageActivity.java
index 6cf3061..d96ec39 100644
--- a/src/com/android/settings/homepage/SettingsHomepageActivity.java
+++ b/src/com/android/settings/homepage/SettingsHomepageActivity.java
@@ -183,12 +183,6 @@
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- if (!isTaskRoot() && !isSingleTask()) {
- Log.i(TAG, "Not task root nor single task, finish");
- finish();
- return;
- }
-
mIsEmbeddingActivityEnabled = ActivityEmbeddingUtils.isEmbeddingActivityEnabled(this);
if (mIsEmbeddingActivityEnabled) {
final UserManager um = getSystemService(UserManager.class);
@@ -314,12 +308,6 @@
updateHomepageUI();
}
- private boolean isSingleTask() {
- ActivityInfo info = getIntent().resolveActivityInfo(getPackageManager(),
- PackageManager.MATCH_DEFAULT_ONLY);
- return info.launchMode == ActivityInfo.LAUNCH_SINGLE_TASK;
- }
-
private void updateSplitLayout() {
if (!mIsEmbeddingActivityEnabled) {
return;
diff --git a/tests/robotests/src/com/android/settings/homepage/SettingsHomepageActivityTest.java b/tests/robotests/src/com/android/settings/homepage/SettingsHomepageActivityTest.java
index 3857e64..c281dca 100644
--- a/tests/robotests/src/com/android/settings/homepage/SettingsHomepageActivityTest.java
+++ b/tests/robotests/src/com/android/settings/homepage/SettingsHomepageActivityTest.java
@@ -29,7 +29,6 @@
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.never;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
@@ -211,28 +210,6 @@
& SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS).isEqualTo(0);
}
- @Test
- public void onCreate_notTaskRoot_shouldFinishActivity() {
- SettingsHomepageActivity activity =
- spy(Robolectric.buildActivity(SettingsHomepageActivity.class).get());
- doReturn(false).when(activity).isTaskRoot();
-
- activity.onCreate(/* savedInstanceState */ null);
-
- verify(activity).finish();
- }
-
- @Test
- public void onCreate_singleTaskActivity_shouldNotFinishActivity() {
- SettingsHomepageActivity activity =
- spy(Robolectric.buildActivity(DeepLinkHomepageActivity.class).get());
- doReturn(false).when(activity).isTaskRoot();
-
- activity.onCreate(/* savedInstanceState */ null);
-
- verify(activity, never()).finish();
- }
-
/** This test is for large screen devices Activity embedding. */
@Test
@Config(shadows = ShadowActivityEmbeddingUtils.class)