diff options
Diffstat (limited to 'src/com/android/launcher3/dragndrop/AddItemActivity.java')
-rw-r--r-- | src/com/android/launcher3/dragndrop/AddItemActivity.java | 12 |
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 6b27a9992..09592a846 100644 --- a/src/com/android/launcher3/dragndrop/AddItemActivity.java +++ b/src/com/android/launcher3/dragndrop/AddItemActivity.java @@ -28,6 +28,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; @@ -47,6 +48,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; @@ -148,6 +150,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()); |