Improve Settings launch performance for normal phones
1. Initialize ActivitEmbedding component only if necessary 2. Early return to avoid executing long execution time operations ex: initialize ActivityEmbedding component, feature flag operations Test: manual - launch settings and profile Test: run v2/android-crystalball-eng/health/microbench/startup/firstparty/open-settings on affacted devices Test: atest SettingsHomepageActivityTest TopLevelWallpaperPreferenceControllerTest DashboardFeatureProviderImplTest TopLevelSettingsTest TopLevelWallpaperPreferenceControllerTest SearchResultTrampolineTest Test: atest CtsSettingsTestCases Fixes: 281505190 Change-Id: I0c1a1dc50f26c4ded02de82190dd7aad59c20c01
This commit is contained in:
@@ -57,7 +57,6 @@ import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.fragment.app.FragmentTransaction;
|
||||
import androidx.window.embedding.ActivityEmbeddingController;
|
||||
import androidx.window.embedding.SplitRule;
|
||||
|
||||
import com.android.settings.R;
|
||||
@@ -108,7 +107,6 @@ public class SettingsHomepageActivity extends FragmentActivity implements
|
||||
private View mTwoPaneSuggestionView;
|
||||
private CategoryMixin mCategoryMixin;
|
||||
private Set<HomepageLoadedListener> mLoadedListeners;
|
||||
private ActivityEmbeddingController mActivityEmbeddingController;
|
||||
private boolean mIsEmbeddingActivityEnabled;
|
||||
private boolean mIsTwoPane;
|
||||
// A regular layout shows icons on homepage, whereas a simplified layout doesn't.
|
||||
@@ -200,8 +198,7 @@ public class SettingsHomepageActivity extends FragmentActivity implements
|
||||
setupEdgeToEdge();
|
||||
setContentView(R.layout.settings_homepage_container);
|
||||
|
||||
mActivityEmbeddingController = ActivityEmbeddingController.getInstance(this);
|
||||
mIsTwoPane = mActivityEmbeddingController.isActivityEmbedded(this);
|
||||
mIsTwoPane = ActivityEmbeddingUtils.isAlreadyEmbedded(this);
|
||||
|
||||
updateAppBarMinHeight();
|
||||
initHomepageContainer();
|
||||
@@ -242,7 +239,7 @@ public class SettingsHomepageActivity extends FragmentActivity implements
|
||||
|
||||
// Settings app may be launched on an existing task. Reset SplitPairRule of SubSettings here
|
||||
// to prevent SplitPairRule of an existing task applied on a new started Settings app.
|
||||
if (ActivityEmbeddingUtils.isEmbeddingActivityEnabled(this)
|
||||
if (mIsEmbeddingActivityEnabled
|
||||
&& (getIntent().getFlags() & Intent.FLAG_ACTIVITY_CLEAR_TOP) != 0) {
|
||||
initSplitPairRules();
|
||||
}
|
||||
@@ -284,7 +281,7 @@ public class SettingsHomepageActivity extends FragmentActivity implements
|
||||
@Override
|
||||
public void onConfigurationChanged(Configuration newConfig) {
|
||||
super.onConfigurationChanged(newConfig);
|
||||
final boolean newTwoPaneState = mActivityEmbeddingController.isActivityEmbedded(this);
|
||||
final boolean newTwoPaneState = ActivityEmbeddingUtils.isAlreadyEmbedded(this);
|
||||
if (mIsTwoPane != newTwoPaneState) {
|
||||
mIsTwoPane = newTwoPaneState;
|
||||
updateHomepageAppBar();
|
||||
@@ -427,8 +424,9 @@ public class SettingsHomepageActivity extends FragmentActivity implements
|
||||
}
|
||||
|
||||
private boolean shouldLaunchDeepLinkIntentToRight() {
|
||||
if (!FeatureFlagUtils.isEnabled(this, FeatureFlagUtils.SETTINGS_SUPPORT_LARGE_SCREEN)
|
||||
|| !ActivityEmbeddingUtils.isSettingsSplitEnabled(this)) {
|
||||
if (!ActivityEmbeddingUtils.isSettingsSplitEnabled(this)
|
||||
|| !FeatureFlagUtils.isEnabled(this,
|
||||
FeatureFlagUtils.SETTINGS_SUPPORT_LARGE_SCREEN)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user