Fixing fallback recents not getting proper insets on configuration change
> Using common code for Launcher and recents for insets dispatching
> Fixing recents auto closing when there is no running task
Bug: 158750568
Bug: 159133601
Change-Id: Iee25c603a77a1ac546ada1840f3afaf5797b8802
diff --git a/src/com/android/launcher3/LauncherRootView.java b/src/com/android/launcher3/LauncherRootView.java
index 6951ff2..51504ce 100644
--- a/src/com/android/launcher3/LauncherRootView.java
+++ b/src/com/android/launcher3/LauncherRootView.java
@@ -10,6 +10,8 @@
import android.view.ViewDebug;
import android.view.WindowInsets;
+import com.android.launcher3.statemanager.StatefulActivity;
+
import java.util.Collections;
import java.util.List;
@@ -17,7 +19,7 @@
private final Rect mTempRect = new Rect();
- private final Launcher mLauncher;
+ private final StatefulActivity mActivity;
@ViewDebug.ExportedProperty(category = "launcher")
private static final List<Rect> SYSTEM_GESTURE_EXCLUSION_RECT =
@@ -31,17 +33,17 @@
public LauncherRootView(Context context, AttributeSet attrs) {
super(context, attrs);
- mLauncher = Launcher.getLauncher(context);
+ mActivity = StatefulActivity.fromContext(context);
}
private void handleSystemWindowInsets(Rect insets) {
// Update device profile before notifying th children.
- mLauncher.getDeviceProfile().updateInsets(insets);
+ mActivity.getDeviceProfile().updateInsets(insets);
boolean resetState = !insets.equals(mInsets);
setInsets(insets);
if (resetState) {
- mLauncher.getStateManager().reapplyState(true /* cancelCurrentAnimation */);
+ mActivity.getStateManager().reapplyState(true /* cancelCurrentAnimation */);
}
}
@@ -63,7 +65,7 @@
}
public void dispatchInsets() {
- mLauncher.getDeviceProfile().updateInsets(mInsets);
+ mActivity.getDeviceProfile().updateInsets(mInsets);
super.setInsets(mInsets);
}