Merge "[race condition] Improve hotseat availability when launcher is recreated" into ub-launcher3-rvc-dev
diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/OverviewModalTaskState.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/OverviewModalTaskState.java
index d5b0687..fc0dcd5 100644
--- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/OverviewModalTaskState.java
+++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/OverviewModalTaskState.java
@@ -20,6 +20,7 @@
import com.android.launcher3.BaseDraggingActivity;
import com.android.launcher3.Launcher;
+import com.android.launcher3.LauncherState;
import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType;
import com.android.quickstep.views.RecentsView;
@@ -56,6 +57,17 @@
return 1.0f;
}
+ @Override
+ public void onBackPressed(Launcher launcher) {
+ launcher.getStateManager().goToState(LauncherState.OVERVIEW);
+ RecentsView recentsView = launcher.<RecentsView>getOverviewPanel();
+ if (recentsView != null) {
+ recentsView.resetModalVisuals();
+ } else {
+ super.onBackPressed(launcher);
+ }
+ }
+
public static float[] getOverviewScaleAndOffsetForModalState(BaseDraggingActivity activity) {
Rect out = new Rect();
activity.<RecentsView>getOverviewPanel().getTaskSize(out);
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/TaskOverlayFactory.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/TaskOverlayFactory.java
index a6a08cb..177f9a0 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/TaskOverlayFactory.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/TaskOverlayFactory.java
@@ -179,6 +179,12 @@
}
/**
+ * Called when the system wants to reset the modal visuals.
+ */
+ public void resetModalVisuals() {
+ }
+
+ /**
* Gets the modal state system shortcut.
*/
public SystemShortcut getModalStateSystemShortcut(WorkspaceItemInfo itemInfo) {
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java
index 534ef7b..873c672 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java
@@ -30,6 +30,7 @@
import static com.android.launcher3.Utilities.squaredHypot;
import static com.android.launcher3.Utilities.squaredTouchSlop;
import static com.android.launcher3.anim.Interpolators.ACCEL;
+import static com.android.launcher3.anim.Interpolators.ACCEL_0_75;
import static com.android.launcher3.anim.Interpolators.ACCEL_2;
import static com.android.launcher3.anim.Interpolators.FAST_OUT_SLOW_IN;
import static com.android.launcher3.anim.Interpolators.LINEAR;
@@ -1731,7 +1732,7 @@
private void updatePageOffsets() {
float offset = mAdjacentPageOffset * getWidth();
- float modalOffset = mTaskModalness * getWidth();
+ float modalOffset = ACCEL_0_75.getInterpolation(mTaskModalness) * getWidth();
if (mIsRtl) {
offset = -offset;
modalOffset = -modalOffset;
@@ -1759,6 +1760,16 @@
return Math.max(getWidth(), 1);
}
+ /**
+ * Resets the visuals when exit modal state.
+ */
+ public void resetModalVisuals() {
+ TaskView taskView = getCurrentPageTaskView();
+ if (taskView != null) {
+ taskView.getThumbnail().getTaskOverlay().resetModalVisuals();
+ }
+ }
+
private void updateDeadZoneRects() {
// Get the deadzone rect surrounding the clear all button to not dismiss overview to home
mClearAllButtonDeadZoneRect.setEmpty();
diff --git a/quickstep/src/com/android/launcher3/statehandlers/DepthController.java b/quickstep/src/com/android/launcher3/statehandlers/DepthController.java
index ebe9e26..2b08dcd 100644
--- a/quickstep/src/com/android/launcher3/statehandlers/DepthController.java
+++ b/quickstep/src/com/android/launcher3/statehandlers/DepthController.java
@@ -32,6 +32,7 @@
import com.android.launcher3.anim.PendingAnimation;
import com.android.launcher3.statemanager.StateManager.StateHandler;
import com.android.launcher3.states.StateAnimationConfig;
+import com.android.systemui.shared.system.BlurUtils;
import com.android.systemui.shared.system.RemoteAnimationTargetCompat;
import com.android.systemui.shared.system.SurfaceControlCompat;
import com.android.systemui.shared.system.TransactionCompat;
@@ -110,6 +111,10 @@
}
private void ensureDependencies() {
+ if (mWallpaperManager == null) {
+ mMaxBlurRadius = mLauncher.getResources().getInteger(R.integer.max_depth_blur_radius);
+ mWallpaperManager = new WallpaperManagerCompat(mLauncher);
+ }
if (mLauncher.getRootView() != null && mOnAttachListener == null) {
mOnAttachListener = new View.OnAttachStateChangeListener() {
@Override
@@ -127,11 +132,6 @@
};
mLauncher.getRootView().addOnAttachStateChangeListener(mOnAttachListener);
}
- if (mWallpaperManager != null) {
- return;
- }
- mMaxBlurRadius = mLauncher.getResources().getInteger(R.integer.max_depth_blur_radius);
- mWallpaperManager = new WallpaperManagerCompat(mLauncher);
}
/**
@@ -205,7 +205,8 @@
return;
}
- if (mSurface == null || !mSurface.isValid()) {
+ boolean supportsBlur = BlurUtils.supportsBlursOnWindows();
+ if (supportsBlur && (mSurface == null || !mSurface.isValid())) {
return;
}
mDepth = depthF;
@@ -214,17 +215,20 @@
if (windowToken != null) {
mWallpaperManager.setWallpaperZoomOut(windowToken, mDepth);
}
- final int blur;
- if (mLauncher.isInState(LauncherState.ALL_APPS) && mDepth == 1) {
- // All apps has a solid background. We don't need to draw blurs after it's fully
- // visible. This will take us out of GPU composition, saving battery and increasing
- // performance.
- blur = 0;
- } else {
- blur = (int) (mDepth * mMaxBlurRadius);
+
+ if (supportsBlur) {
+ final int blur;
+ if (mLauncher.isInState(LauncherState.ALL_APPS) && mDepth == 1) {
+ // All apps has a solid background. We don't need to draw blurs after it's fully
+ // visible. This will take us out of GPU composition, saving battery and increasing
+ // performance.
+ blur = 0;
+ } else {
+ blur = (int) (mDepth * mMaxBlurRadius);
+ }
+ new TransactionCompat()
+ .setBackgroundBlurRadius(mSurface, blur)
+ .apply();
}
- new TransactionCompat()
- .setBackgroundBlurRadius(mSurface, blur)
- .apply();
}
}
diff --git a/quickstep/src/com/android/quickstep/logging/StatsLogCompatManager.java b/quickstep/src/com/android/quickstep/logging/StatsLogCompatManager.java
index a88ba3c..ebb44e2 100644
--- a/quickstep/src/com/android/quickstep/logging/StatsLogCompatManager.java
+++ b/quickstep/src/com/android/quickstep/logging/StatsLogCompatManager.java
@@ -98,6 +98,22 @@
}
/**
+ * Logs an event.
+ *
+ * @param event an enum implementing EventEnum interface.
+ * @param atomItemInfo item typically containing app or task launch related information.
+ */
+ @Override
+ public void log(EventEnum event, @Nullable LauncherAtom.ItemInfo atomItemInfo, int srcState,
+ int dstState) {
+ write(event, DEFAULT_INSTANCE_ID,
+ atomItemInfo == null ? LauncherAtom.ItemInfo.getDefaultInstance() : atomItemInfo,
+ null,
+ srcState,
+ dstState);
+ }
+
+ /**
* Logs an event and accompanying {@link InstanceId} and {@link LauncherAtom.ItemInfo}.
*/
@Override
@@ -171,7 +187,13 @@
)).build();
}
}
+ write(event, instanceId, atomInfo, info, srcState, dstState);
+ }
+ private static void write(EventEnum event, InstanceId instanceId,
+ LauncherAtom.ItemInfo atomInfo,
+ @Nullable ItemInfo info,
+ int srcState, int dstState) {
if (IS_VERBOSE) {
String name = (event instanceof Enum) ? ((Enum) event).name() :
event.getId() + "";
diff --git a/quickstep/tests/src/com/android/quickstep/FallbackRecentsTest.java b/quickstep/tests/src/com/android/quickstep/FallbackRecentsTest.java
index a726052..a343e7c 100644
--- a/quickstep/tests/src/com/android/quickstep/FallbackRecentsTest.java
+++ b/quickstep/tests/src/com/android/quickstep/FallbackRecentsTest.java
@@ -37,7 +37,6 @@
import static org.junit.Assert.assertTrue;
import android.app.Instrumentation;
-import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ActivityInfo;
@@ -58,10 +57,8 @@
import com.android.launcher3.util.Wait;
import com.android.launcher3.util.rule.FailureRewriterRule;
import com.android.launcher3.util.rule.FailureWatcher;
-import com.android.quickstep.NavigationModeSwitchRule.NavigationModeSwitch;
import com.android.quickstep.views.RecentsView;
-import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.RuleChain;
@@ -95,7 +92,8 @@
mDevice = UiDevice.getInstance(instrumentation);
mDevice.setOrientationNatural();
mLauncher = new LauncherInstrumentation();
- mLauncher.enableCheckEventsForSuccessfulGestures();
+ // b/143488140
+ //mLauncher.enableCheckEventsForSuccessfulGestures();
if (TestHelpers.isInLauncherProcess()) {
Utilities.enableRunningInTestHarnessForTests();
@@ -132,9 +130,9 @@
}
}
- @NavigationModeSwitch
+ // b/143488140
+ //@NavigationModeSwitch
@Test
- @Ignore // b/143488140
public void goToOverviewFromHome() {
mDevice.pressHome();
assertTrue("Fallback Launcher not visible", mDevice.wait(Until.hasObject(By.pkg(
@@ -143,9 +141,9 @@
mLauncher.getBackground().switchToOverview();
}
- @NavigationModeSwitch
+ // b/143488140
+ //@NavigationModeSwitch
@Test
- @Ignore // b/143488140
public void goToOverviewFromApp() {
startAppFast(resolveSystemApp(Intent.CATEGORY_APP_CALCULATOR));
@@ -178,9 +176,9 @@
return mLauncher.getBackground().switchToOverview();
}
- @NavigationModeSwitch
+ // b/143488140
+ //@NavigationModeSwitch
@Test
- @Ignore // b/143488140
public void testOverview() {
startAppFast(getAppPackageName());
startAppFast(resolveSystemApp(Intent.CATEGORY_APP_CALCULATOR));
diff --git a/quickstep/tests/src/com/android/quickstep/StartLauncherViaGestureTests.java b/quickstep/tests/src/com/android/quickstep/StartLauncherViaGestureTests.java
index f20a0ba..0c5b9ad 100644
--- a/quickstep/tests/src/com/android/quickstep/StartLauncherViaGestureTests.java
+++ b/quickstep/tests/src/com/android/quickstep/StartLauncherViaGestureTests.java
@@ -45,6 +45,8 @@
@Before
public void setUp() throws Exception {
super.setUp();
+ // b/143488140
+ mLauncher.pressHome();
// Start an activity where the gestures start.
startAppFast(resolveSystemApp(Intent.CATEGORY_APP_CALCULATOR));
}
@@ -98,7 +100,6 @@
// The test action.
mLauncher.getBackground().switchToOverview();
}
- // Workaround for b/157099707
mLauncher.pressHome();
}
}
\ No newline at end of file
diff --git a/src/com/android/launcher3/logging/StatsLogManager.java b/src/com/android/launcher3/logging/StatsLogManager.java
index e95c062..fee91b0 100644
--- a/src/com/android/launcher3/logging/StatsLogManager.java
+++ b/src/com/android/launcher3/logging/StatsLogManager.java
@@ -21,6 +21,7 @@
import com.android.launcher3.LauncherState;
import com.android.launcher3.R;
+import com.android.launcher3.logger.LauncherAtom;
import com.android.launcher3.logging.StatsLogUtils.LogStateProvider;
import com.android.launcher3.model.data.ItemInfo;
import com.android.launcher3.util.ResourceBasedOverride;
@@ -217,6 +218,16 @@
}
/**
+ * Logs an event and accompanying {@link LauncherState}s.
+ *
+ * @param event an enum implementing EventEnum interface.
+ * @param launcherAtomItemInfo item typically containing app or task launch related information.
+ */
+ public void log(EventEnum event, @Nullable LauncherAtom.ItemInfo launcherAtomItemInfo,
+ int srcState, int dstState) {
+ }
+
+ /**
* Logs an event.
*
* @param event an enum implementing EventEnum interface.