summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/dragndrop/AddItemActivity.java
diff options
context:
space:
mode:
authorSunny Goyal <sunnygoyal@google.com>2017-03-20 15:08:06 -0700
committerSunny Goyal <sunnygoyal@google.com>2017-03-28 09:36:52 -0700
commit5a81c3806b31c7763734e287d4cf2ed11294281d (patch)
tree8fc72b6ca9b469fee3a31bb1487de2da85269c6e /src/com/android/launcher3/dragndrop/AddItemActivity.java
parent66485063d0681ad3d8aaaed9d902e70545512a93 (diff)
downloadandroid_packages_apps_Trebuchet-5a81c3806b31c7763734e287d4cf2ed11294281d.tar.gz
android_packages_apps_Trebuchet-5a81c3806b31c7763734e287d4cf2ed11294281d.tar.bz2
android_packages_apps_Trebuchet-5a81c3806b31c7763734e287d4cf2ed11294281d.zip
Fixing multiwindow drag operation during with rotation.
> Finishing activity when rotation preference change. This ensures that any prefenrece change is immediately applied instead of waiting for resume as the new activity is always started with proper setting. > Clearing task when starting drag in landscape mode. This ensures that a new activity instance is started in this case, which overrides previous locked rotation by launcher activity. > Handling drag request in onCreate and enabling rotation based on it. > Clearing any request from the launcher intent once the drag operation is complete Bug: 36226746 Change-Id: I69f56c13827c25f3e1bc84935cb2acc59b6bd349
Diffstat (limited to 'src/com/android/launcher3/dragndrop/AddItemActivity.java')
-rw-r--r--src/com/android/launcher3/dragndrop/AddItemActivity.java12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/com/android/launcher3/dragndrop/AddItemActivity.java b/src/com/android/launcher3/dragndrop/AddItemActivity.java
index c2a4820c8..629f78ab3 100644
--- a/src/com/android/launcher3/dragndrop/AddItemActivity.java
+++ b/src/com/android/launcher3/dragndrop/AddItemActivity.java
@@ -23,6 +23,7 @@ import android.appwidget.AppWidgetManager;
import android.content.ClipData;
import android.content.ClipDescription;
import android.content.Intent;
+import android.content.res.Configuration;
import android.graphics.Canvas;
import android.graphics.Point;
import android.graphics.PointF;
@@ -40,6 +41,7 @@ import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherAppState;
import com.android.launcher3.LauncherAppWidgetProviderInfo;
import com.android.launcher3.R;
+import com.android.launcher3.Utilities;
import com.android.launcher3.compat.AppWidgetManagerCompat;
import com.android.launcher3.compat.PinItemRequestCompat;
import com.android.launcher3.model.WidgetItem;
@@ -132,6 +134,16 @@ public class AddItemActivity extends BaseActivity implements OnLongClickListener
.setPackage(getPackageName())
.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
.putExtra(PinItemDragListener.EXTRA_PIN_ITEM_DRAG_LISTENER, listener);
+
+ if (!getResources().getBoolean(R.bool.allow_rotation) &&
+ !Utilities.isAllowRotationPrefEnabled(this) &&
+ (getResources().getConfiguration().orientation ==
+ Configuration.ORIENTATION_LANDSCAPE && !isInMultiWindowMode())) {
+ // If we are starting the drag in landscape even though home is locked in portrait,
+ // restart the home activity to temporarily allow rotation.
+ homeIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
+ }
+
startActivity(homeIntent,
ActivityOptions.makeCustomAnimation(this, 0, android.R.anim.fade_out).toBundle());