Orientation changes on Surface Duo

To best support dual-screen devices, activities should support resizing and react to configuration changes. To do that, add these lines to the activity manifest:

android:resizeableActivity="true"
android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation"

This also means that the activity will not restart every time its size changes.

On Surface Duo the following actions will fire a configuration change event:

  • Orientation change – the aspect ratio of the app changes
  • Span or un-span – when the user drags the app to span both displays horizontally or vertically

When these events occur your app should adjust layouts to fit the device orientation, and account for the masked area where the hinge appears. There are different options for achieving this:

  • Use the Microsoft DisplayMask API to query the screen and hinge dimensions, and manually update your layouts.
  • Use Google's Jetpack Window Manager API to query the screen and hinge dimensions, and manually update your layouts.
  • Use enhanced controls like the dual-screen library which will automatically adapt to the hinge.

Samples