From 589cb3480a01498bfaa9a8cf55e3c30a7ca07cc2 Mon Sep 17 00:00:00 2001 From: Brian Isganitis Date: Wed, 1 Mar 2023 18:05:51 -0800 Subject: [PATCH] Treat setup wizard default home as null. During setup, default home progresses setup -> null -> launcher, which can lead us to unintentionally preload the fallback overview. Fix: 258022658 Test: Manual Change-Id: I952b7923b06f2d4b058f42834d1f840719c73fd0 --- quickstep/res/values/config.xml | 2 ++ .../com/android/quickstep/OverviewComponentObserver.java | 9 +++++++++ .../com/android/quickstep/TouchInteractionService.java | 4 ++++ 3 files changed, 15 insertions(+) diff --git a/quickstep/res/values/config.xml b/quickstep/res/values/config.xml index a91507ce92..d58158207d 100644 --- a/quickstep/res/values/config.xml +++ b/quickstep/res/values/config.xml @@ -49,4 +49,6 @@ @*android:dimen/config_wallpaperMaxScale + + diff --git a/quickstep/src/com/android/quickstep/OverviewComponentObserver.java b/quickstep/src/com/android/quickstep/OverviewComponentObserver.java index 589459f5c6..a8f3c3af46 100644 --- a/quickstep/src/com/android/quickstep/OverviewComponentObserver.java +++ b/quickstep/src/com/android/quickstep/OverviewComponentObserver.java @@ -37,6 +37,7 @@ import android.util.SparseIntArray; import androidx.annotation.NonNull; import androidx.annotation.Nullable; +import com.android.launcher3.R; import com.android.launcher3.tracing.OverviewComponentObserverProto; import com.android.launcher3.tracing.TouchInteractionServiceProto; import com.android.launcher3.util.SimpleBroadcastReceiver; @@ -65,6 +66,7 @@ public final class OverviewComponentObserver { private final Intent mMyHomeIntent; private final Intent mFallbackIntent; private final SparseIntArray mConfigChangesMap = new SparseIntArray(); + private final String mSetupWizardPkg; private Consumer mOverviewChangeListener = b -> { }; @@ -86,6 +88,7 @@ public final class OverviewComponentObserver { new ComponentName(context.getPackageName(), info.activityInfo.name); mMyHomeIntent.setComponent(myHomeComponent); mConfigChangesMap.append(myHomeComponent.hashCode(), info.activityInfo.configChanges); + mSetupWizardPkg = context.getString(R.string.setup_wizard_pkg); ComponentName fallbackComponent = new ComponentName(mContext, RecentsActivity.class); mFallbackIntent = new Intent(Intent.ACTION_MAIN) @@ -127,6 +130,12 @@ public final class OverviewComponentObserver { private void updateOverviewTargets() { ComponentName defaultHome = PackageManagerWrapper.getInstance() .getHomeActivities(new ArrayList<>()); + if (defaultHome != null && defaultHome.getPackageName().equals(mSetupWizardPkg)) { + // Treat setup wizard as null default home, because there is a period between setup and + // launcher being default home where it is briefly null. Otherwise, it would appear as + // if overview targets are changing twice, giving the listener an incorrect signal. + defaultHome = null; + } mIsHomeDisabled = mDeviceState.isHomeDisabled(); mIsDefaultHome = Objects.equals(mMyHomeIntent.getComponent(), defaultHome); diff --git a/quickstep/src/com/android/quickstep/TouchInteractionService.java b/quickstep/src/com/android/quickstep/TouchInteractionService.java index 61caef2724..faa00b4a62 100644 --- a/quickstep/src/com/android/quickstep/TouchInteractionService.java +++ b/quickstep/src/com/android/quickstep/TouchInteractionService.java @@ -1130,6 +1130,10 @@ public class TouchInteractionService extends Service return; } + // TODO(b/258022658): Remove temporary logging. + Log.i(TAG, "preloadOverview: forSUWAllSet=" + forSUWAllSet + + ", isHomeAndOverviewSame=" + mOverviewComponentObserver.isHomeAndOverviewSame()); + mTaskAnimationManager.preloadRecentsAnimation(overviewIntent); }