Fix different behaviors of deeplink in one/two pane
Test: manual - Reproducible steps mentioned in bug fixes: 207740082 Change-Id: I1163e38c177307ccac8798eb649271d0466ab1c8
This commit is contained in:
committed by
Tsung-Mao Fang
parent
17423d1682
commit
a8c97980a6
@@ -77,8 +77,8 @@ public class ActivityEmbeddingRulesController {
|
|||||||
ComponentName primaryComponent,
|
ComponentName primaryComponent,
|
||||||
ComponentName secondaryComponent,
|
ComponentName secondaryComponent,
|
||||||
String secondaryIntentAction,
|
String secondaryIntentAction,
|
||||||
boolean finishPrimaryWithSecondary,
|
int finishPrimaryWithSecondary,
|
||||||
boolean finishSecondaryWithPrimary,
|
int finishSecondaryWithPrimary,
|
||||||
boolean clearTop) {
|
boolean clearTop) {
|
||||||
if (!ActivityEmbeddingUtils.isEmbeddingActivityEnabled(context)) {
|
if (!ActivityEmbeddingUtils.isEmbeddingActivityEnabled(context)) {
|
||||||
return;
|
return;
|
||||||
@@ -88,8 +88,8 @@ public class ActivityEmbeddingRulesController {
|
|||||||
secondaryIntentAction));
|
secondaryIntentAction));
|
||||||
|
|
||||||
SplitController.getInstance().registerRule(new SplitPairRule(filters,
|
SplitController.getInstance().registerRule(new SplitPairRule(filters,
|
||||||
finishPrimaryWithSecondary ? SplitRule.FINISH_ADJACENT : SplitRule.FINISH_NEVER,
|
finishPrimaryWithSecondary,
|
||||||
finishSecondaryWithPrimary ? SplitRule.FINISH_ADJACENT : SplitRule.FINISH_NEVER,
|
finishSecondaryWithPrimary,
|
||||||
clearTop,
|
clearTop,
|
||||||
ActivityEmbeddingUtils.getMinCurrentScreenSplitWidthPx(context),
|
ActivityEmbeddingUtils.getMinCurrentScreenSplitWidthPx(context),
|
||||||
ActivityEmbeddingUtils.getMinSmallestScreenSplitWidthPx(context),
|
ActivityEmbeddingUtils.getMinSmallestScreenSplitWidthPx(context),
|
||||||
@@ -117,17 +117,8 @@ public class ActivityEmbeddingRulesController {
|
|||||||
getComponentName(context, Settings.class),
|
getComponentName(context, Settings.class),
|
||||||
secondaryComponent,
|
secondaryComponent,
|
||||||
secondaryIntentAction,
|
secondaryIntentAction,
|
||||||
finishPrimaryWithSecondary,
|
finishPrimaryWithSecondary ? SplitRule.FINISH_ADJACENT : SplitRule.FINISH_NEVER,
|
||||||
finishSecondaryWithPrimary,
|
finishSecondaryWithPrimary ? SplitRule.FINISH_ADJACENT : SplitRule.FINISH_NEVER,
|
||||||
clearTop);
|
|
||||||
|
|
||||||
registerTwoPanePairRule(
|
|
||||||
context,
|
|
||||||
new ComponentName(context, DeepLinkHomepageActivity.class),
|
|
||||||
secondaryComponent,
|
|
||||||
secondaryIntentAction,
|
|
||||||
finishPrimaryWithSecondary,
|
|
||||||
finishSecondaryWithPrimary,
|
|
||||||
clearTop);
|
clearTop);
|
||||||
|
|
||||||
registerTwoPanePairRule(
|
registerTwoPanePairRule(
|
||||||
@@ -135,8 +126,19 @@ public class ActivityEmbeddingRulesController {
|
|||||||
getComponentName(context, SettingsHomepageActivity.class),
|
getComponentName(context, SettingsHomepageActivity.class),
|
||||||
secondaryComponent,
|
secondaryComponent,
|
||||||
secondaryIntentAction,
|
secondaryIntentAction,
|
||||||
finishPrimaryWithSecondary,
|
finishPrimaryWithSecondary ? SplitRule.FINISH_ADJACENT : SplitRule.FINISH_NEVER,
|
||||||
finishSecondaryWithPrimary,
|
finishSecondaryWithPrimary ? SplitRule.FINISH_ADJACENT : SplitRule.FINISH_NEVER,
|
||||||
|
clearTop);
|
||||||
|
|
||||||
|
// We should finish HomePageActivity altogether even if it shows in single pane for all deep
|
||||||
|
// link cases.
|
||||||
|
registerTwoPanePairRule(
|
||||||
|
context,
|
||||||
|
new ComponentName(context, DeepLinkHomepageActivity.class),
|
||||||
|
secondaryComponent,
|
||||||
|
secondaryIntentAction,
|
||||||
|
finishPrimaryWithSecondary ? SplitRule.FINISH_ALWAYS : SplitRule.FINISH_NEVER,
|
||||||
|
finishSecondaryWithPrimary ? SplitRule.FINISH_ALWAYS : SplitRule.FINISH_NEVER,
|
||||||
clearTop);
|
clearTop);
|
||||||
|
|
||||||
registerTwoPanePairRule(
|
registerTwoPanePairRule(
|
||||||
@@ -144,8 +146,8 @@ public class ActivityEmbeddingRulesController {
|
|||||||
getComponentName(context, SliceDeepLinkHomepageActivity.class),
|
getComponentName(context, SliceDeepLinkHomepageActivity.class),
|
||||||
secondaryComponent,
|
secondaryComponent,
|
||||||
secondaryIntentAction,
|
secondaryIntentAction,
|
||||||
finishPrimaryWithSecondary,
|
finishPrimaryWithSecondary ? SplitRule.FINISH_ALWAYS : SplitRule.FINISH_NEVER,
|
||||||
finishSecondaryWithPrimary,
|
finishSecondaryWithPrimary ? SplitRule.FINISH_ALWAYS : SplitRule.FINISH_NEVER,
|
||||||
clearTop);
|
clearTop);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -40,6 +40,7 @@ import androidx.fragment.app.Fragment;
|
|||||||
import androidx.fragment.app.FragmentActivity;
|
import androidx.fragment.app.FragmentActivity;
|
||||||
import androidx.fragment.app.FragmentManager;
|
import androidx.fragment.app.FragmentManager;
|
||||||
import androidx.fragment.app.FragmentTransaction;
|
import androidx.fragment.app.FragmentTransaction;
|
||||||
|
import androidx.window.embedding.SplitRule;
|
||||||
|
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
import com.android.settings.Settings;
|
import com.android.settings.Settings;
|
||||||
@@ -338,15 +339,15 @@ public class SettingsHomepageActivity extends FragmentActivity implements
|
|||||||
new ComponentName(getApplicationContext(), getClass()),
|
new ComponentName(getApplicationContext(), getClass()),
|
||||||
targetComponentName,
|
targetComponentName,
|
||||||
targetIntent.getAction(),
|
targetIntent.getAction(),
|
||||||
true /* finishPrimaryWithSecondary */,
|
SplitRule.FINISH_ALWAYS,
|
||||||
true /* finishSecondaryWithPrimary */,
|
SplitRule.FINISH_ALWAYS,
|
||||||
true /* clearTop*/);
|
true /* clearTop*/);
|
||||||
ActivityEmbeddingRulesController.registerTwoPanePairRule(this,
|
ActivityEmbeddingRulesController.registerTwoPanePairRule(this,
|
||||||
new ComponentName(Settings.class.getPackageName(), Settings.class.getName()),
|
new ComponentName(Settings.class.getPackageName(), Settings.class.getName()),
|
||||||
targetComponentName,
|
targetComponentName,
|
||||||
targetIntent.getAction(),
|
targetIntent.getAction(),
|
||||||
true /* finishPrimaryWithSecondary */,
|
SplitRule.FINISH_ALWAYS,
|
||||||
true /* finishSecondaryWithPrimary */,
|
SplitRule.FINISH_ALWAYS,
|
||||||
true /* clearTop*/);
|
true /* clearTop*/);
|
||||||
startActivity(targetIntent);
|
startActivity(targetIntent);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user