{"id":110,"date":"2020-02-20T15:49:39","date_gmt":"2020-02-20T23:49:39","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/surface-duo\/?p=110"},"modified":"2020-03-05T14:48:18","modified_gmt":"2020-03-05T22:48:18","slug":"the-surface-duo-sdk-preview-is-getting-an-update-feb-202020","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/surface-duo\/the-surface-duo-sdk-preview-is-getting-an-update-feb-202020\/","title":{"rendered":"The Surface Duo SDK Preview is getting an update &#8211; Feb 20,2020"},"content":{"rendered":"<p>Hello Dual Screen developers!<\/p>\n<p>We are proud to be part of this growing community and excited to share with you the latest on the #SurfaceDuo SDK front in these devblogs.<\/p>\n<p>Don\u2019t forget to read our <a href=\"https:\/\/devblogs.microsoft.com\/surface-duo\/\">previous editions<\/a> for additional Dev goodies, and let us know (feedback links below) on what else you would like us to cover.<\/p>\n<p>For today\u2019s blog on 02\/20\/2020, we are going to focus on the Surface Duo Emulator Image refresh (Yes, almost a palindrome, if you\u2019re into numbers).<\/p>\n<h2>Summary of changes in the 02202020 update<\/h2>\n<p>We have spent the past few weeks with fixing some bugs with some great results. We have updated how we report the display size, modified the DisplayMask API to improve app compatibility, and fixed several bugs that our users have reported.<\/p>\n<p>You can download the refresh image for Mac, Windows and Ubuntu using this <a href=\"https:\/\/www.microsoft.com\/en-us\/download\/details.aspx?id=100847\">link<\/a><\/p>\n<p>In details:<\/p>\n<h3>Change #1: Changes to how size is reported to an App<strong>:<\/strong><\/h3>\n<p>We have been busy setting up an App Compat lab where we test against the top apps from the Google Play Store.<\/p>\n<p>We found some inconsistencies in how activity, window, and display metrics were returned to apps and games. We have made the changes to how size is reported so that the app gets sizes appropriate to the displays it is on. In the case of:<\/p>\n<ul>\n<li>For apps on a single display, windows and display metrics will be related to a single display<\/li>\n<li>For apps across both displays, window and display metrics will be in relation to both displays, including the display mask<\/li>\n<\/ul>\n<p>Our <a href=\"https:\/\/github.com\/microsoft\/surface-duo-sdk-samples\">Java<\/a> and <a href=\"https:\/\/github.com\/microsoft\/surface-duo-sdk-samples-kotlin\">Kotlin<\/a> samples have been updated to reflect this change.<\/p>\n<p>Try it out on your app and let us know if you\u2019ve seen any issues.<\/p>\n<h3>Change #2: Updates to DisplayMask API<\/h3>\n<p>Display Metrics based on apps window and DisplayMask API change to return hinge mask relative to apps window:<\/p>\n<p>Display Mask has been updated to return a bounding rectangle relative to the display metrics based on the app context. When running in single screen the DisplayMask will now return an empty list it will not intersect with the window. When running in dual screen the display mask bounding rectangle shall identify the area under the hardware hinge in relation to the app window<\/p>\n<p>As consumer of this API apps run in one of the following scenarios:<\/p>\n<ul>\n<li>App running in single screen mode: DisplayMask will be an empty list<\/li>\n<li>App running in spanned mode: DisplayMask = hinge mask rectangle<\/li>\n<\/ul>\n<p>Note: a service that created a view at any point will fall into one of the categories above<\/p>\n<h3>Change #3: Surface Duo Image Build Flavor is now a USER build and not USERDEBUG<\/h3>\n<p>This image refresh contains a USER build flavor which will result in less logging and faster image access within the emulator.<\/p>\n<p>Note that the ADB commands will continue to work as usual without the need to enable Developer Options in settings.<\/p>\n<p><img decoding=\"async\" width=\"2256\" height=\"1453\" class=\"wp-image-111\" src=\"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2020\/02\/word-image.png\" srcset=\"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2020\/02\/word-image.png 2256w, https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2020\/02\/word-image-300x193.png 300w, https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2020\/02\/word-image-1024x660.png 1024w, https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2020\/02\/word-image-768x495.png 768w, https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2020\/02\/word-image-1536x989.png 1536w, https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2020\/02\/word-image-2048x1319.png 2048w\" sizes=\"(max-width: 2256px) 100vw, 2256px\" \/> Figure 1: The Surface Duo emulator image with Drag and Drop Sample<\/p>\n<h3>Behind the scenes on these changes:<\/h3>\n<p>If you\u2019re interested in the behind the scenes on these changes, this section is for you.<\/p>\n<p>Apps query their active window and active display information using a common class \u2013 <a href=\"https:\/\/developer.android.com\/reference\/android\/view\/Display.html\">android.view.Display<\/a>.<\/p>\n<p>The common behaviors and API\u2019s within android.view.Display are:<\/p>\n<ul>\n<li>Getting current App Windows metrics (getSize \/ getMetrics) which returns the display size available to the app adjusted for specific system d\u00e9cor (cut-outs, nav bar, etc.) and compatibility.\n<ul>\n<li>When called within an activity with an app window this returns the size available to the app with specific system d\u00e9cor subtracted.<\/li>\n<li>When called within an activity without an app window this returns the full display size<\/li>\n<\/ul>\n<\/li>\n<li>Getting the current \u201creal\u201d display metrics (getRealSize \/ getRealMetrics) which returns the display size available to the active WindowManager adjusted by any rotation. \u201cReal\u201d in this context is at times Windows Manager may run in a smaller display than the actual full available display.<\/li>\n<\/ul>\n<p>The Surface Duo Emulator Image supports these standard API\u2019s that apps depend on, but the API\u2019s will further define \u201creal\u201d display based on current posture and app context.<\/p>\n<p>If you would like to read more \u201cbehind-the-scenes\u201d content, please let us know on the Surface Duo <a href=\"http:\/\/aka.ms\/SurfaceDuoSDK-Feedback\">feedback forum<\/a>.<\/p>\n<h4>Microsoft Surface Duo Emulator definitions<\/h4>\n<p>The Surface Duo emulator image has two displays. The gap between both displays is 84 pixels. The entire virtual display is represented as 2784&#215;1800.<\/p>\n<p>Android abstracts pixel size and resolution into a <a href=\"https:\/\/material.io\/design\/layout\/pixel-density.html\">display-independent pixel<\/a> metric so apps can use a single metric across devices. This is calculated as:<\/p>\n<p>dp = (width in pixels * 160) \/ screen density<\/p>\n<table>\n<tbody>\n<tr>\n<td><\/td>\n<td>Native resolution<\/td>\n<td>Resolution in dp<\/td>\n<\/tr>\n<tr>\n<td>Single Display<\/td>\n<td>1350 x 1800<\/td>\n<td>540 x 720<\/td>\n<\/tr>\n<tr>\n<td>Dual Display + Mask<\/td>\n<td>2784 x 1800<\/td>\n<td>1114 x 720<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Per the Material Guidelines, this would be classified as:<\/p>\n<table style=\"height: 84px; width: 22.1751%; border-style: inset;\">\n<tbody>\n<tr style=\"height: 28px;\">\n<td style=\"height: 28px;\"><\/td>\n<td style=\"height: 28px;\">dp<\/td>\n<td style=\"height: 28px;\">Classification<\/td>\n<\/tr>\n<tr style=\"height: 28px;\">\n<td style=\"height: 28px;\">Single Portrait Width<\/td>\n<td style=\"height: 28px;\">540dp<\/td>\n<td style=\"height: 28px;\">large handset<\/td>\n<\/tr>\n<tr style=\"height: 28px;\">\n<td style=\"height: 28px;\">Single &amp; Dual Landscape Width<\/td>\n<td style=\"height: 28px;\">720dp<\/td>\n<td style=\"height: 28px;\">large handset<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Because the default behavior for any activity creating a window is to be launched on a single screen, the display metric return value to all non-windowed activities will also be updated to be the size of a single screen to reduce discrepancies in an app default launch behavior.<\/p>\n<p>To keep within the bounds of a large handset, future Surface Duo devices would need to keep a single display within the bounds of:<\/p>\n<ul>\n<li>Portrait Width of 400-599dp or 2.5\u201d \u2013 3.74\u201d (Surface Duo Emulator is 3.375\u201d)<\/li>\n<li>Landscape width of 720-959dp or 4.5\u201d \u2013 5.99\u201d (Surface Duo Emulator is 4.5\u201d)<\/li>\n<\/ul>\n<p>The minimum aspect ratio recommended for Android based phones is 4:3\/3:4 (which is what Surface Duo is).<\/p>\n<h3>We\u2019d love your feedback<\/h3>\n<p>We would love to hear from you about your experiences using the SDK and emulator.<\/p>\n<p>Please reach out using our <a href=\"http:\/\/aka.ms\/SurfaceDuoSDK-Feedback\">feedback forum<\/a> and let us know how we can help you be more productive, ask questions, make suggestions, or upvote other suggestions.<\/p>\n<p>Our online Docs are at <a href=\"https:\/\/nam06.safelinks.protection.outlook.com\/?url=https%3A%2F%2Fdocs.microsoft.com%2Fdual-screen%2F&amp;data=02%7C01%7Cguym%40microsoft.com%7Ca122dccdb0f449096ff008d7b4a7ebf2%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637176505612845094&amp;sdata=VPCCNZGu6MaaMlzHx%2FbA5K1uq8FpYiPBmmXAcsJArxQ%3D&amp;reserved=0\">https:\/\/docs.microsoft.com\/dual-screen\/<\/a> and in case you missed it, the <a href=\"https:\/\/www.youtube.com\/channel\/UCV_6HOhwxYLXAGd-JOqKPoQ\">M365 Dual Screen Developer day recordings<\/a> are now available.<\/p>\n<p>And as always, you can message me on <a href=\"https:\/\/twitter.com\/gmerin\">Twitter<\/a> or <a href=\"https:\/\/github.com\/guymerin\">GitHub<\/a>.<\/p>\n<p>Thank you,<\/p>\n<p>Guy Merin, Development Manager, Surface Duo Developer Experience Team<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hello Dual Screen developers! We are proud to be part of this growing community and excited to share with you the latest on the #SurfaceDuo SDK front in these devblogs. Don\u2019t forget to read our previous editions for additional Dev goodies, and let us know (feedback links below) on what else you would like us [&hellip;]<\/p>\n","protected":false},"author":17398,"featured_media":75,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[31,46,29,30],"class_list":["post-110","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-surface-duo-sdk","tag-dual-screen-development","tag-surface-duo","tag-surfaceduo","tag-surfaceduo-sdk"],"acf":[],"blog_post_summary":"<p>Hello Dual Screen developers! We are proud to be part of this growing community and excited to share with you the latest on the #SurfaceDuo SDK front in these devblogs. Don\u2019t forget to read our previous editions for additional Dev goodies, and let us know (feedback links below) on what else you would like us [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-json\/wp\/v2\/posts\/110","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-json\/wp\/v2\/users\/17398"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-json\/wp\/v2\/comments?post=110"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-json\/wp\/v2\/posts\/110\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-json\/wp\/v2\/media\/75"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-json\/wp\/v2\/media?parent=110"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-json\/wp\/v2\/categories?post=110"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-json\/wp\/v2\/tags?post=110"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}