Avoid 2-pane deep link before gone through Setup Wizard

To improve security.

Fix: 238391432
Test: manual
      Flash ROM and check 2-pane bebavior
Change-Id: If96c645319d9df45930644fd438cf479462685b0
This commit is contained in:
Arc Wang
2022-07-08 15:46:40 +08:00
parent b1cb90f7f1
commit be2ea9eb39
3 changed files with 75 additions and 18 deletions

View File

@@ -68,6 +68,8 @@ import com.android.settings.overlay.FeatureFactory;
import com.android.settingslib.Utils;
import com.android.settingslib.core.lifecycle.HideNonSystemOverlayMixin;
import com.google.android.setupcompat.util.WizardManagerHelper;
import java.net.URISyntaxException;
import java.util.Set;
@@ -219,7 +221,9 @@ public class SettingsHomepageActivity extends FragmentActivity implements
}, R.id.main_content);
// Launch the intent from deep link for large screen devices.
launchDeepLinkIntentToRight();
if (shouldLaunchDeepLinkIntentToRight()) {
launchDeepLinkIntentToRight();
}
updateHomepagePaddings();
updateSplitLayout();
}
@@ -242,7 +246,9 @@ public class SettingsHomepageActivity extends FragmentActivity implements
return;
}
// Launch the intent from deep link for large screen devices.
launchDeepLinkIntentToRight();
if (shouldLaunchDeepLinkIntentToRight()) {
launchDeepLinkIntentToRight();
}
}
@Override
@@ -390,17 +396,18 @@ public class SettingsHomepageActivity extends FragmentActivity implements
return showFragment;
}
private boolean shouldLaunchDeepLinkIntentToRight() {
if (!FeatureFlagUtils.isEnabled(this, FeatureFlagUtils.SETTINGS_SUPPORT_LARGE_SCREEN)
|| !SplitController.getInstance().isSplitSupported()) {
return false;
}
Intent intent = getIntent();
return intent != null && TextUtils.equals(intent.getAction(),
ACTION_SETTINGS_EMBED_DEEP_LINK_ACTIVITY);
}
private void launchDeepLinkIntentToRight() {
if (!mIsEmbeddingActivityEnabled) {
return;
}
final Intent intent = getIntent();
if (intent == null || !TextUtils.equals(intent.getAction(),
ACTION_SETTINGS_EMBED_DEEP_LINK_ACTIVITY)) {
return;
}
if (!(this instanceof DeepLinkHomepageActivity
|| this instanceof DeepLinkHomepageActivityInternal)) {
Log.e(TAG, "Not a deep link component");
@@ -408,6 +415,13 @@ public class SettingsHomepageActivity extends FragmentActivity implements
return;
}
if (!WizardManagerHelper.isUserSetupComplete(this)) {
Log.e(TAG, "Cancel deep link before SUW completed");
finish();
return;
}
final Intent intent = getIntent();
final String intentUriString = intent.getStringExtra(
EXTRA_SETTINGS_EMBEDDED_DEEP_LINK_INTENT_URI);
if (TextUtils.isEmpty(intentUriString)) {