Merge "Fine tune the homepage scrolling behavior" into sc-v2-dev
diff --git a/src/com/android/settings/SettingsActivity.java b/src/com/android/settings/SettingsActivity.java
index 226e1de..957efdf 100644
--- a/src/com/android/settings/SettingsActivity.java
+++ b/src/com/android/settings/SettingsActivity.java
@@ -451,6 +451,11 @@
             return false;
         }
 
+        if (intent.getBooleanExtra(SettingsHomepageActivity.EXTRA_IS_FROM_SETTINGS_HOMEPAGE,
+                /* defaultValue */ false)) {
+            return false;
+        }
+
         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
diff --git a/src/com/android/settings/activityembedding/ActivityEmbeddingRulesController.java b/src/com/android/settings/activityembedding/ActivityEmbeddingRulesController.java
index 53e8020..d3d53a8 100644
--- a/src/com/android/settings/activityembedding/ActivityEmbeddingRulesController.java
+++ b/src/com/android/settings/activityembedding/ActivityEmbeddingRulesController.java
@@ -111,6 +111,16 @@
 
         registerTwoPanePairRule(
                 context,
+                new ComponentName(Utils.SETTINGS_PACKAGE_NAME,
+                        SettingsHomepageActivity.ALIAS_DEEP_LINK),
+                secondaryComponent,
+                secondaryIntentAction,
+                true /* finishPrimaryWithSecondary */,
+                true /* finishSecondaryWithPrimary */,
+                clearTop);
+
+        registerTwoPanePairRule(
+                context,
                 getComponentName(context, SettingsHomepageActivity.class),
                 secondaryComponent,
                 secondaryIntentAction,
diff --git a/src/com/android/settings/homepage/SettingsHomepageActivity.java b/src/com/android/settings/homepage/SettingsHomepageActivity.java
index 067989e..051204d 100644
--- a/src/com/android/settings/homepage/SettingsHomepageActivity.java
+++ b/src/com/android/settings/homepage/SettingsHomepageActivity.java
@@ -64,6 +64,10 @@
     private static final String TAG = "SettingsHomepageActivity";
 
     // Additional extra of Settings#ACTION_SETTINGS_LARGE_SCREEN_DEEP_LINK.
+    // Put true value to the intent when startActivity for a deep link intent from this Activity.
+    public static final String EXTRA_IS_FROM_SETTINGS_HOMEPAGE = "is_from_settings_homepage";
+
+    // Additional extra of Settings#ACTION_SETTINGS_LARGE_SCREEN_DEEP_LINK.
     // Set & get Uri of the Intent separately to prevent failure of Intent#ParseUri.
     public static final String EXTRA_SETTINGS_LARGE_SCREEN_DEEP_LINK_INTENT_DATA =
             "settings_large_screen_deep_link_intent_data";
@@ -268,6 +272,7 @@
         // Sender of intent may want to send intent extra data to the destination of targetIntent.
         targetIntent.replaceExtras(intent);
 
+        targetIntent.putExtra(EXTRA_IS_FROM_SETTINGS_HOMEPAGE, true);
         targetIntent.putExtra(SettingsActivity.EXTRA_IS_FROM_SLICE, false);
 
         targetIntent.setData(intent.getParcelableExtra(