From 80fa41f00f0c468b4ca5bfed801164ec654459cd Mon Sep 17 00:00:00 2001 From: Sunny Goyal Date: Thu, 22 Jun 2017 10:19:55 -0700 Subject: Fixing PinItemActivity not getting dismissed when starting drag-and-drop in multi-window mode Change-Id: Ic5a74dab7cc374efcd32d4c73faa9eb28e9327a4 --- src/com/android/launcher3/dragndrop/AddItemActivity.java | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/com/android/launcher3/dragndrop/AddItemActivity.java') diff --git a/src/com/android/launcher3/dragndrop/AddItemActivity.java b/src/com/android/launcher3/dragndrop/AddItemActivity.java index 29789c82c..01893bdaf 100644 --- a/src/com/android/launcher3/dragndrop/AddItemActivity.java +++ b/src/com/android/launcher3/dragndrop/AddItemActivity.java @@ -84,6 +84,8 @@ public class AddItemActivity extends BaseActivity implements OnLongClickListener private int mPendingBindWidgetId; private Bundle mWidgetOptions; + private boolean mFinishOnPause = false; + @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -163,6 +165,7 @@ public class AddItemActivity extends BaseActivity implements OnLongClickListener startActivity(homeIntent, ActivityOptions.makeCustomAnimation(this, 0, android.R.anim.fade_out).toBundle()); + mFinishOnPause = true; // Start a system drag and drop. We use a transparent bitmap as preview for system drag // as the preview is handled internally by launcher. @@ -182,6 +185,14 @@ public class AddItemActivity extends BaseActivity implements OnLongClickListener return false; } + @Override + protected void onPause() { + super.onPause(); + if (mFinishOnPause) { + finish(); + } + } + private void setupShortcut() { PinShortcutRequestActivityInfo shortcutInfo = new PinShortcutRequestActivityInfo(mRequest, this); -- cgit v1.2.3