summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVinit Nayak <peanutbutter@google.com>2019-07-10 14:25:32 -0700
committerVinit Nayak <peanutbutter@google.com>2019-07-19 11:11:35 -0700
commitf9b585b507bca5afb0e443ec4cfd5f98829a73b1 (patch)
tree4ea4d2115163d24c41b6c68e50a207db7c18d055
parentd3c2a6cecfab92d9852e3c55f9798c207bdd0a9c (diff)
downloadandroid_packages_apps_Trebuchet-f9b585b507bca5afb0e443ec4cfd5f98829a73b1.tar.gz
android_packages_apps_Trebuchet-f9b585b507bca5afb0e443ec4cfd5f98829a73b1.tar.bz2
android_packages_apps_Trebuchet-f9b585b507bca5afb0e443ec4cfd5f98829a73b1.zip
Don't specify 1P Launcher3 type if 3P Launcher is active
Instead of referencing Launcher directly (which may not be present when there's a 3P launcher), reference the lowest common ancestor of Launcher and RecentActivity to avoid ClassCastExceptions. Test: Visually inspected that Pixel Launcher crash dialog no longer pops up. * Install 3P launcher * In developer options enable "enable freeform windows" * Restart phone for settings to take effect * Try to use it on any app you have in recent tasks Fixes: 135419782 Change-Id: Ie1f54880ab46956b23e253850ca7f79b161da9bd
-rw-r--r--quickstep/recents_ui_overrides/src/com/android/quickstep/RecentsActivity.java6
-rw-r--r--quickstep/recents_ui_overrides/src/com/android/quickstep/TaskSystemShortcut.java10
-rw-r--r--src/com/android/launcher3/BaseDraggingActivity.java4
-rw-r--r--src/com/android/launcher3/Launcher.java6
4 files changed, 22 insertions, 4 deletions
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/RecentsActivity.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/RecentsActivity.java
index 60e7b12ec..20330b233 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/RecentsActivity.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/RecentsActivity.java
@@ -136,6 +136,12 @@ public final class RecentsActivity extends BaseRecentsActivity {
}
@Override
+ public void returnToHomescreen() {
+ super.returnToHomescreen();
+ // TODO(b/137318995) This should go home, but doing so removes freeform windows
+ }
+
+ @Override
public ActivityOptions getActivityLaunchOptions(final View v) {
if (!(v instanceof TaskView)) {
return null;
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/TaskSystemShortcut.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/TaskSystemShortcut.java
index 213c5d324..cfd14bb29 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/TaskSystemShortcut.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/TaskSystemShortcut.java
@@ -36,8 +36,6 @@ import android.view.View;
import com.android.launcher3.BaseDraggingActivity;
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.ItemInfo;
-import com.android.launcher3.Launcher;
-import com.android.launcher3.LauncherState;
import com.android.launcher3.R;
import com.android.launcher3.WorkspaceItemInfo;
import com.android.launcher3.popup.SystemShortcut;
@@ -268,12 +266,16 @@ public class TaskSystemShortcut<T extends SystemShortcut> extends SystemShortcut
@Override
protected ActivityOptions makeLaunchOptions(Activity activity) {
- return ActivityOptionsCompat.makeFreeformOptions();
+ ActivityOptions activityOptions = ActivityOptionsCompat.makeFreeformOptions();
+ // Arbitrary bounds only because freeform is in dev mode right now
+ Rect r = new Rect(50, 50, 200, 200);
+ activityOptions.setLaunchBounds(r);
+ return activityOptions;
}
@Override
protected boolean onActivityStarted(BaseDraggingActivity activity) {
- Launcher.getLauncher(activity).getStateManager().goToState(LauncherState.NORMAL);
+ activity.returnToHomescreen();
return true;
}
}
diff --git a/src/com/android/launcher3/BaseDraggingActivity.java b/src/com/android/launcher3/BaseDraggingActivity.java
index 1cdb18c99..8de00691e 100644
--- a/src/com/android/launcher3/BaseDraggingActivity.java
+++ b/src/com/android/launcher3/BaseDraggingActivity.java
@@ -120,6 +120,10 @@ public abstract class BaseDraggingActivity extends BaseActivity
public abstract View getRootView();
+ public void returnToHomescreen() {
+ // no-op
+ }
+
public Rect getViewBounds(View v) {
int[] pos = new int[2];
v.getLocationOnScreen(pos);
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index b86411157..40d76681b 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -2568,6 +2568,12 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns,
return (Launcher) fromContext(context);
}
+ @Override
+ public void returnToHomescreen() {
+ super.returnToHomescreen();
+ getStateManager().goToState(LauncherState.NORMAL);
+ }
+
/**
* Just a wrapper around the type cast to allow easier tracking of calls.
*/