Fix failed test in order to enable Live Tile (in the next change)

Live tile changes certain assumptions we have for tests, for example
- Launcher will not be in the resumed state after swiping up to Overview

Also, disable live tile for 3rd party launcher for now

Test: presubmit
Fixes: 169694902
Change-Id: Ifd466db0354f59290c4f66a0a2ad4c82f1169f29
This commit is contained in:
Tracy Zhou
2021-03-24 14:12:29 -07:00
parent 29c1e8437e
commit 9d706b1ada
4 changed files with 83 additions and 8 deletions

View File

@@ -20,6 +20,8 @@ import static com.android.launcher3.config.FeatureFlags.ENABLE_QUICKSTEP_LIVE_TI
import android.content.Context;
import com.android.quickstep.OverviewComponentObserver;
import com.android.quickstep.RecentsAnimationDeviceState;
import com.android.quickstep.SysUINavigationMode;
import java.util.function.Predicate;
@@ -35,6 +37,7 @@ public class NavigationModeFeatureFlag implements
private final Supplier<Boolean> mBasePredicate;
private final Predicate<SysUINavigationMode.Mode> mModePredicate;
private boolean mSupported;
private OverviewComponentObserver mObserver;
private NavigationModeFeatureFlag(Supplier<Boolean> basePredicate,
Predicate<SysUINavigationMode.Mode> modePredicate) {
@@ -43,12 +46,16 @@ public class NavigationModeFeatureFlag implements
}
public boolean get() {
return mBasePredicate.get() && mSupported;
return mBasePredicate.get() && mSupported && mObserver.isHomeAndOverviewSame();
}
public void initialize(Context context) {
onNavigationModeChanged(SysUINavigationMode.INSTANCE.get(context).getMode());
SysUINavigationMode.INSTANCE.get(context).addModeChangeListener(this);
// Temporary solution to disable live tile for the fallback launcher
RecentsAnimationDeviceState rads = new RecentsAnimationDeviceState(context);
mObserver = new OverviewComponentObserver(context, rads);
}
@Override