Load some recent tasks
Bug: 69166452
Test: Build quickstep
Change-Id: Id4b0172256d6920616a6b9529d61abd1fe0c1a36
diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java
index 6030e08..6ddaf29 100644
--- a/src/com/android/launcher3/DeviceProfile.java
+++ b/src/com/android/launcher3/DeviceProfile.java
@@ -27,7 +27,6 @@
import android.util.DisplayMetrics;
import android.view.Gravity;
import android.view.View;
-import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.widget.FrameLayout;
@@ -681,13 +680,13 @@
}
}
- private int getCurrentWidth() {
+ public int getCurrentWidth() {
return isLandscape
? Math.max(widthPx, heightPx)
: Math.min(widthPx, heightPx);
}
- private int getCurrentHeight() {
+ public int getCurrentHeight() {
return isLandscape
? Math.min(widthPx, heightPx)
: Math.max(widthPx, heightPx);
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index b1b3452..60c00fb 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -63,7 +63,6 @@
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.os.AsyncTask;
-import android.os.Binder;
import android.os.Build;
import android.os.Bundle;
import android.os.Parcelable;
@@ -362,6 +361,8 @@
restoreState(savedInstanceState);
+ InternalStateHandler.handleCreate(this, getIntent());
+
// We only load the page synchronously if the user rotates (or triggers a
// configuration change) while launcher is in the foreground
int currentScreen = PagedView.INVALID_RESTORE_PAGE;
@@ -1347,7 +1348,6 @@
// Check this condition before handling isActionMain, as this will get reset.
boolean shouldMoveToDefaultScreen = alreadyOnHome && isInState(NORMAL)
&& AbstractFloatingView.getTopOpenView(this) == null;
-
boolean isActionMain = Intent.ACTION_MAIN.equals(intent.getAction());
if (isActionMain) {
if (mWorkspace == null) {
@@ -1407,7 +1407,7 @@
});
}
}
- InternalStateHandler.handleIntent(this, intent);
+ InternalStateHandler.handleNewIntent(this, intent, alreadyOnHome);
TraceHelper.endSection("NEW_INTENT");
}
diff --git a/src/com/android/launcher3/states/InternalStateHandler.java b/src/com/android/launcher3/states/InternalStateHandler.java
index a90ed36..c6feefc 100644
--- a/src/com/android/launcher3/states/InternalStateHandler.java
+++ b/src/com/android/launcher3/states/InternalStateHandler.java
@@ -29,15 +29,30 @@
public static final String EXTRA_STATE_HANDLER = "launcher.state_handler";
- public abstract void onNewIntent(Launcher launcher);
+ public abstract void onCreate(Launcher launcher);
+ public abstract void onNewIntent(Launcher launcher, boolean alreadyOnHome);
- public static void handleIntent(Launcher launcher, Intent intent) {
- IBinder stateBinder = intent.getExtras().getBinder(EXTRA_STATE_HANDLER);
- if (stateBinder instanceof InternalStateHandler) {
- InternalStateHandler handler = (InternalStateHandler) stateBinder;
- launcher.setOnResumeCallback(handler);
- handler.onNewIntent(launcher);
+ public static void handleCreate(Launcher launcher, Intent intent) {
+ if (intent.getExtras() != null) {
+ IBinder stateBinder = intent.getExtras().getBinder(EXTRA_STATE_HANDLER);
+ if (stateBinder instanceof InternalStateHandler) {
+ InternalStateHandler handler = (InternalStateHandler) stateBinder;
+ launcher.setOnResumeCallback(handler);
+ handler.onCreate(launcher);
+ }
+ intent.getExtras().remove(EXTRA_STATE_HANDLER);
}
- intent.getExtras().remove(EXTRA_STATE_HANDLER);
+ }
+
+ public static void handleNewIntent(Launcher launcher, Intent intent, boolean alreadyOnHome) {
+ if (intent.getExtras() != null) {
+ IBinder stateBinder = intent.getExtras().getBinder(EXTRA_STATE_HANDLER);
+ if (stateBinder instanceof InternalStateHandler) {
+ InternalStateHandler handler = (InternalStateHandler) stateBinder;
+ launcher.setOnResumeCallback(handler);
+ handler.onNewIntent(launcher, alreadyOnHome);
+ }
+ intent.getExtras().remove(EXTRA_STATE_HANDLER);
+ }
}
}