Merge "Register rule for wallpaper entry" into sc-v2-dev am: 6c24e5bc33
am: d34752cce6
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/16180475 Change-Id: I90e42051ccdf056da7899bf5a04125d3d945fe20
This commit is contained in:
@@ -73,6 +73,9 @@ public class ActivityEmbeddingRulesController {
|
|||||||
boolean finishPrimaryWithSecondary,
|
boolean finishPrimaryWithSecondary,
|
||||||
boolean finishSecondaryWithPrimary,
|
boolean finishSecondaryWithPrimary,
|
||||||
boolean clearTop) {
|
boolean clearTop) {
|
||||||
|
if (!ActivityEmbeddingUtils.isEmbeddingActivityEnabled(context)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
final Set<SplitPairFilter> filters = new HashSet<>();
|
final Set<SplitPairFilter> filters = new HashSet<>();
|
||||||
filters.add(new SplitPairFilter(primaryComponent, secondaryComponent,
|
filters.add(new SplitPairFilter(primaryComponent, secondaryComponent,
|
||||||
secondaryIntentAction));
|
secondaryIntentAction));
|
||||||
@@ -87,18 +90,45 @@ public class ActivityEmbeddingRulesController {
|
|||||||
LayoutDirection.LOCALE));
|
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. */
|
/** 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)) {
|
if (!ActivityEmbeddingUtils.isEmbeddingActivityEnabled(context)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
registerTwoPanePairRule(context,
|
registerTwoPanePairRuleForSettingsHome(
|
||||||
getComponentName(context, Settings.class),
|
context,
|
||||||
getComponentName(context, SubSettings.class),
|
getComponentName(context, SubSettings.class),
|
||||||
null /* secondaryIntentAction */,
|
null /* secondaryIntentAction */,
|
||||||
true /* finishPrimaryWithSecondary */,
|
|
||||||
true /* finishSecondaryWithPrimary */,
|
|
||||||
clearTop);
|
clearTop);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -175,14 +175,10 @@ public class DashboardFeatureProviderImpl implements DashboardFeatureProvider {
|
|||||||
if (fragment instanceof TopLevelSettings
|
if (fragment instanceof TopLevelSettings
|
||||||
&& ActivityEmbeddingUtils.isEmbeddingActivityEnabled(mContext)) {
|
&& ActivityEmbeddingUtils.isEmbeddingActivityEnabled(mContext)) {
|
||||||
// Register the rule for injected apps.
|
// Register the rule for injected apps.
|
||||||
ActivityEmbeddingRulesController.registerTwoPanePairRule(mContext,
|
ActivityEmbeddingRulesController.registerTwoPanePairRuleForSettingsHome(
|
||||||
new ComponentName(activity.getPackageName(),
|
mContext,
|
||||||
com.android.settings.Settings.class.getName()),
|
new ComponentName(tile.getPackageName(), tile.getComponentName()),
|
||||||
new ComponentName(tile.getPackageName(),
|
|
||||||
tile.getComponentName()),
|
|
||||||
null /* secondaryIntentAction */,
|
null /* secondaryIntentAction */,
|
||||||
true /* finishPrimaryWithSecondary */,
|
|
||||||
true /* finishSecondaryWithPrimary */,
|
|
||||||
true /* clearTop */);
|
true /* clearTop */);
|
||||||
|
|
||||||
// Highlight preference ui.
|
// Highlight preference ui.
|
||||||
|
@@ -31,6 +31,7 @@ import androidx.preference.Preference;
|
|||||||
import androidx.preference.PreferenceScreen;
|
import androidx.preference.PreferenceScreen;
|
||||||
|
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
|
import com.android.settings.activityembedding.ActivityEmbeddingRulesController;
|
||||||
import com.android.settings.activityembedding.ActivityEmbeddingUtils;
|
import com.android.settings.activityembedding.ActivityEmbeddingUtils;
|
||||||
import com.android.settings.core.BasePreferenceController;
|
import com.android.settings.core.BasePreferenceController;
|
||||||
import com.android.settingslib.RestrictedLockUtilsInternal;
|
import com.android.settingslib.RestrictedLockUtilsInternal;
|
||||||
@@ -102,6 +103,11 @@ public class TopLevelWallpaperPreferenceController extends BasePreferenceControl
|
|||||||
mContext)) {
|
mContext)) {
|
||||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
||||||
}
|
}
|
||||||
|
ActivityEmbeddingRulesController.registerTwoPanePairRuleForSettingsHome(
|
||||||
|
mContext,
|
||||||
|
intent.getComponent(),
|
||||||
|
null /* secondaryIntentAction */,
|
||||||
|
true /* clearTop */);
|
||||||
preference.getContext().startActivity(intent);
|
preference.getContext().startActivity(intent);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@@ -100,7 +100,7 @@ public class TopLevelSettings extends DashboardFragment implements
|
|||||||
@Override
|
@Override
|
||||||
public boolean onPreferenceTreeClick(Preference preference) {
|
public boolean onPreferenceTreeClick(Preference preference) {
|
||||||
// Register SplitPairRule for SubSettings.
|
// Register SplitPairRule for SubSettings.
|
||||||
ActivityEmbeddingRulesController.registerSubSettingsPairRuleIfNeeded(getContext(),
|
ActivityEmbeddingRulesController.registerSubSettingsPairRule(getContext(),
|
||||||
true /* clearTop */);
|
true /* clearTop */);
|
||||||
|
|
||||||
setHighlightPreferenceKey(preference.getKey());
|
setHighlightPreferenceKey(preference.getKey());
|
||||||
|
@@ -97,7 +97,7 @@ public class SearchResultTrampoline extends Activity {
|
|||||||
} else if (isFromSettingsIntelligence(callingActivity)) {
|
} else if (isFromSettingsIntelligence(callingActivity)) {
|
||||||
// Register SplitPairRule for SubSettings, set clearTop false to prevent unexpected back
|
// Register SplitPairRule for SubSettings, set clearTop false to prevent unexpected back
|
||||||
// navigation behavior.
|
// navigation behavior.
|
||||||
ActivityEmbeddingRulesController.registerSubSettingsPairRuleIfNeeded(this,
|
ActivityEmbeddingRulesController.registerSubSettingsPairRule(this,
|
||||||
false /* clearTop */);
|
false /* clearTop */);
|
||||||
// TODO: pass menu key to homepage
|
// TODO: pass menu key to homepage
|
||||||
intent.setFlags(intent.getFlags() & ~Intent.FLAG_ACTIVITY_NEW_TASK);
|
intent.setFlags(intent.getFlags() & ~Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
|
Reference in New Issue
Block a user