Merge "[Large screen] Show full screen CreateShortcutActivity" into sc-v2-dev am: d749c4eadf
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/15919134 Change-Id: Ibd8b3c84ecdcc881e9c9e92f75792cba02f41dcc
This commit is contained in:
@@ -52,13 +52,13 @@ import androidx.preference.PreferenceManager;
|
|||||||
|
|
||||||
import com.android.internal.util.ArrayUtils;
|
import com.android.internal.util.ArrayUtils;
|
||||||
import com.android.settings.Settings.WifiSettingsActivity;
|
import com.android.settings.Settings.WifiSettingsActivity;
|
||||||
|
import com.android.settings.activityembedding.ActivityEmbeddingUtils;
|
||||||
import com.android.settings.applications.manageapplications.ManageApplications;
|
import com.android.settings.applications.manageapplications.ManageApplications;
|
||||||
import com.android.settings.core.OnActivityResultListener;
|
import com.android.settings.core.OnActivityResultListener;
|
||||||
import com.android.settings.core.SettingsBaseActivity;
|
import com.android.settings.core.SettingsBaseActivity;
|
||||||
import com.android.settings.core.SubSettingLauncher;
|
import com.android.settings.core.SubSettingLauncher;
|
||||||
import com.android.settings.core.gateway.SettingsGateway;
|
import com.android.settings.core.gateway.SettingsGateway;
|
||||||
import com.android.settings.dashboard.DashboardFeatureProvider;
|
import com.android.settings.dashboard.DashboardFeatureProvider;
|
||||||
import com.android.settings.activityembedding.ActivityEmbeddingUtils;
|
|
||||||
import com.android.settings.homepage.SettingsHomepageActivity;
|
import com.android.settings.homepage.SettingsHomepageActivity;
|
||||||
import com.android.settings.homepage.TopLevelSettings;
|
import com.android.settings.homepage.TopLevelSettings;
|
||||||
import com.android.settings.overlay.FeatureFactory;
|
import com.android.settings.overlay.FeatureFactory;
|
||||||
@@ -356,11 +356,29 @@ public class SettingsActivity extends SettingsBaseActivity
|
|||||||
|
|
||||||
/** Returns true if the Activity is started by a deep link intent for large screen devices. */
|
/** Returns true if the Activity is started by a deep link intent for large screen devices. */
|
||||||
private boolean launchHomepageForTwonPaneDeepLink() {
|
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)) {
|
if (!ActivityEmbeddingUtils.isEmbeddingActivityEnabled(this)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
final Intent intent = getIntent();
|
|
||||||
// Only starts trampoline for deep links. Should return false for all the cases that
|
// Only starts trampoline for deep links. Should return false for all the cases that
|
||||||
// Settings app starts SettingsActivity or SubSetting by itself.
|
// Settings app starts SettingsActivity or SubSetting by itself.
|
||||||
if (intent.getAction() == null) {
|
if (intent.getAction() == null) {
|
||||||
@@ -377,15 +395,14 @@ public class SettingsActivity extends SettingsBaseActivity
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// It's a deep link intent, SettingsHomepageActivity will set SplitPairRule and start it.
|
if (TextUtils.equals(intent.getAction(), Intent.ACTION_CREATE_SHORTCUT)) {
|
||||||
final Intent trampolineIntent =
|
// Returns false to show full screen for Intent.ACTION_CREATE_SHORTCUT because
|
||||||
new Intent(android.provider.Settings.ACTION_SETTINGS_LARGE_SCREEN_DEEP_LINK);
|
// - Launcher startActivityForResult for Intent.ACTION_CREATE_SHORTCUT and activity
|
||||||
trampolineIntent.replaceExtras(intent);
|
// stack starts from launcher, CreateShortcutActivity will not follows SplitPaitRule
|
||||||
trampolineIntent.putExtra(
|
// registered by Settings.
|
||||||
android.provider.Settings.EXTRA_SETTINGS_LARGE_SCREEN_DEEP_LINK_INTENT_URI,
|
// - There is no CreateShortcutActivity entry point from Settings app UI.
|
||||||
intent.toUri(Intent.URI_INTENT_SCHEME));
|
return false;
|
||||||
trampolineIntent.addFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT);
|
}
|
||||||
startActivity(trampolineIntent);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user