Merge "Register rule for wallpaper entry" into sc-v2-dev

This commit is contained in:
TreeHugger Robot
2021-11-05 01:00:08 +00:00
committed by Android (Google) Code Review
5 changed files with 47 additions and 15 deletions

View File

@@ -73,6 +73,9 @@ public class ActivityEmbeddingRulesController {
boolean finishPrimaryWithSecondary,
boolean finishSecondaryWithPrimary,
boolean clearTop) {
if (!ActivityEmbeddingUtils.isEmbeddingActivityEnabled(context)) {
return;
}
final Set<SplitPairFilter> filters = new HashSet<>();
filters.add(new SplitPairFilter(primaryComponent, secondaryComponent,
secondaryIntentAction));
@@ -87,18 +90,45 @@ public class ActivityEmbeddingRulesController {
LayoutDirection.LOCALE));
}
/**
* Register a new SplitPairRule for Settings home. Because homepage is able to be opened by
* {@link Settings} or {@link SettingsHomepageActivity}, we register split rule twice for
* two cases.
*/
public static void registerTwoPanePairRuleForSettingsHome(Context context,
ComponentName secondaryComponent,
String secondaryIntentAction,
boolean clearTop) {
registerTwoPanePairRule(
context,
getComponentName(context, Settings.class),
secondaryComponent,
secondaryIntentAction,
true /* finishPrimaryWithSecondary */,
true /* finishSecondaryWithPrimary */,
clearTop);
registerTwoPanePairRule(
context,
getComponentName(context, SettingsHomepageActivity.class),
secondaryComponent,
secondaryIntentAction,
true /* finishPrimaryWithSecondary */,
true /* finishSecondaryWithPrimary */,
clearTop);
}
/** Register a SplitPairRule for SubSettings if the device supports 2-pane. */
public static void registerSubSettingsPairRuleIfNeeded(Context context, boolean clearTop) {
public static void registerSubSettingsPairRule(Context context, boolean clearTop) {
if (!ActivityEmbeddingUtils.isEmbeddingActivityEnabled(context)) {
return;
}
registerTwoPanePairRule(context,
getComponentName(context, Settings.class),
registerTwoPanePairRuleForSettingsHome(
context,
getComponentName(context, SubSettings.class),
null /* secondaryIntentAction */,
true /* finishPrimaryWithSecondary */,
true /* finishSecondaryWithPrimary */,
clearTop);
}
@@ -140,7 +170,7 @@ public class ActivityEmbeddingRulesController {
@NonNull
private static ComponentName getComponentName(Context context,
Class<? extends Activity> activityClass) {
Class<? extends Activity> activityClass) {
return new ComponentName(context.getPackageName(), activityClass.getName());
}
}