[Large screen] Show full screen CreateShortcutActivity

Show full screen for CreateShortcutActivity because

-Launcher startActivityForResult for Intent.ACTION_CREATE_SHORTCUT and
 activity stack starts from launcher, CreateShortcutActivity will not
 follows SplitPaitRule registered by Settings.

- There is no CreateShortcutActivity entry point from Settings app UI.

Bug: 200916507
Test: manual
      Launcher menu ->  Widgets -> Settings -> select an item.
      Observe if it goes back go launcher.
Change-Id: I437ff9b82d5a4548e10aed7bd083fd01352433f4
diff --git a/src/com/android/settings/SettingsActivity.java b/src/com/android/settings/SettingsActivity.java
index dc5d68f..634a646 100644
--- a/src/com/android/settings/SettingsActivity.java
+++ b/src/com/android/settings/SettingsActivity.java
@@ -52,13 +52,13 @@
 
 import com.android.internal.util.ArrayUtils;
 import com.android.settings.Settings.WifiSettingsActivity;
+import com.android.settings.activityembedding.ActivityEmbeddingUtils;
 import com.android.settings.applications.manageapplications.ManageApplications;
 import com.android.settings.core.OnActivityResultListener;
 import com.android.settings.core.SettingsBaseActivity;
 import com.android.settings.core.SubSettingLauncher;
 import com.android.settings.core.gateway.SettingsGateway;
 import com.android.settings.dashboard.DashboardFeatureProvider;
-import com.android.settings.activityembedding.ActivityEmbeddingUtils;
 import com.android.settings.homepage.SettingsHomepageActivity;
 import com.android.settings.homepage.TopLevelSettings;
 import com.android.settings.overlay.FeatureFactory;
@@ -356,11 +356,29 @@
 
     /** Returns true if the Activity is started by a deep link intent for large screen devices. */
     private boolean launchHomepageForTwonPaneDeepLink() {
+        final Intent intent = getIntent();
+        if (!shouldShowTwoPaneDeepLink(intent)) {
+            return false;
+        }
+
+        // It's a deep link intent, SettingsHomepageActivity will set SplitPairRule and start it.
+        final Intent trampolineIntent =
+                new Intent(android.provider.Settings.ACTION_SETTINGS_LARGE_SCREEN_DEEP_LINK);
+        trampolineIntent.replaceExtras(intent);
+        trampolineIntent.putExtra(
+                android.provider.Settings.EXTRA_SETTINGS_LARGE_SCREEN_DEEP_LINK_INTENT_URI,
+                intent.toUri(Intent.URI_INTENT_SCHEME));
+        trampolineIntent.addFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT);
+        startActivity(trampolineIntent);
+
+        return true;
+    }
+
+    private boolean shouldShowTwoPaneDeepLink(Intent intent) {
         if (!ActivityEmbeddingUtils.isEmbeddingActivityEnabled(this)) {
             return false;
         }
 
-        final Intent intent = getIntent();
         // Only starts trampoline for deep links. Should return false for all the cases that
         // Settings app starts SettingsActivity or SubSetting by itself.
         if (intent.getAction() == null) {
@@ -377,15 +395,14 @@
             return false;
         }
 
-        // It's a deep link intent, SettingsHomepageActivity will set SplitPairRule and start it.
-        final Intent trampolineIntent =
-                new Intent(android.provider.Settings.ACTION_SETTINGS_LARGE_SCREEN_DEEP_LINK);
-        trampolineIntent.replaceExtras(intent);
-        trampolineIntent.putExtra(
-                android.provider.Settings.EXTRA_SETTINGS_LARGE_SCREEN_DEEP_LINK_INTENT_URI,
-                intent.toUri(Intent.URI_INTENT_SCHEME));
-        trampolineIntent.addFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT);
-        startActivity(trampolineIntent);
+        if (TextUtils.equals(intent.getAction(), Intent.ACTION_CREATE_SHORTCUT)) {
+            // Returns false to show full screen for Intent.ACTION_CREATE_SHORTCUT because
+            // - Launcher startActivityForResult for Intent.ACTION_CREATE_SHORTCUT and activity
+            //   stack starts from launcher, CreateShortcutActivity will not follows SplitPaitRule
+            //   registered by Settings.
+            // - There is no CreateShortcutActivity entry point from Settings app UI.
+            return false;
+        }
 
         return true;
     }