8/31/17

Hardening the Kernel in Android Oreo


Posted by Sami Tolvanen, Senior Software Engineer, Android Security



The hardening of Android's userspace has increasingly made the underlying Linux
kernel a more attractive target to attackers. As a result, more than a third of
Android security bugs were found in the kernel last year. In Android 8.0 (Oreo),
significant effort has gone into hardening the kernel to reduce the number and
impact of security bugs.



href="https://android-developers.googleblog.com/2016/07/protecting-android-with-more-linux.html">Android
Nougat worked to protect the kernel by isolating it from userspace processes
with the addition of SELinux ioctl filtering and requiring seccomp-bpf support,
which allows apps to filter access to available system calls when processing
untrusted input. Android 8.0 focuses on kernel self-protection with four
security-hardening features backported from upstream Linux to all Android
kernels supported in devices that first ship with this release.


Hardened usercopy



Usercopy functions are used by the kernel to transfer data from user space to
kernel space memory and back again. Since 2014, missing or invalid bounds
checking has caused about 45% of Android's kernel vulnerabilities. href="https://lwn.net/Articles/695991/">Hardened usercopy adds bounds
checking to usercopy functions, which helps developers spot misuse and fix bugs
in their code. Also, if obscure driver bugs slip through, hardening these
functions prevents the exploitation of such bugs.



This feature href="https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=f5509cc18daa7f82bcc553be70df2117c8eedc16">was
introduced in the upstream kernel version 4.8, and we have backported it to
Android kernels 3.18 and above.





int buggy_driver_function(void __user *src, size_t size)
{
/* potential size_t overflow (don’t do this) */
u8 *buf = kmalloc(size * N, GPF_KERNEL);

/* results in buf smaller than size, and a heap overflow */
if (copy_from_user(buf, src, size))
return -EFAULT;

/* never reached with CONFIG_HARDENED_USERCOPY=y */
}



An example of a security issue that hardened usercopy prevents.


Privileged Access Never (PAN) emulation



While hardened usercopy functions help find and mitigate security issues, they
can only help if developers actually use them. Currently, all kernel code,
including drivers, can access user space memory directly, which can lead to
various security issues.



To mitigate this, CPU vendors have introduced features such as Supervisor Mode
Access Prevention (SMAP) in x86 and Privileged Access Never (PAN) in ARM v8.1.
These features prevent the kernel from accessing user space directly and ensure
developers go through usercopy functions. Unfortunately, these hardware features
are not yet widely available in devices that most Android users have today.



Upstream Linux introduced software emulation for PAN in kernel version href="https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit?id=a5e090acbf545c0a3b04080f8a488b17ec41fe02">4.3
for ARM and 4.10 in ARM64. We
have backported both features to Android kernels starting from 3.18.



Together with hardened usercopy, PAN emulation has helped find and fix bugs in
four kernel drivers in Pixel devices.





int buggy_driver_copy_data(struct mydata *src, void __user *ptr)
{
/* failure to keep track of user space pointers */
struct mydata *dst = (struct mydata *)ptr;

/* read/write from/to an arbitrary user space memory location */
dst->field = … ; /* use copy_(from|to)_user instead! */

/* never reached with PAN (emulation) or SMAP */
}


An example of a security issue that PAN emulation mitigates.


Kernel Address Space Layout Randomization (KASLR)



Android has included support for Address Space Layout Randomization (ASLR) for
years. Randomizing memory layout makes code reuse attacks probabilistic and
therefore more difficult for an attacker to exploit, especially remotely.
Android 8.0 brings this feature to the kernel. While Linux has supported href="https://lwn.net/Articles/569635/">KASLR on x86 since version 3.14, href="https://lwn.net/Articles/673598/">KASLR for ARM64 has only been
available upstream since Linux 4.6. Android 8.0 makes KASLR available in Android
kernels 4.4 and newer.



KASLR helps mitigate kernel vulnerabilities by randomizing the location where
kernel code is loaded on each boot. On ARM64, for example, it adds 13–25 bits of
entropy depending on the memory configuration of the device, which makes code
reuse attacks more difficult.


Post-init read-only memory



The final hardening feature extends existing memory protections in the kernel by
creating a memory region that's marked read-only after the kernel has been
initialized. This makes it possible for developers to improve protection on data
that needs to be writable during initialization, but shouldn't be modified after
that. Having less writable memory reduces the internal attack surface of the
kernel, making exploitation harder.



Post-init read-only memory was
introduced in upstream kernel version 4.6 and we have backported it to Android
kernels 3.18 and newer. While we have applied these protections to some data
structures in the core kernel, this feature is extremely useful for developers
working on kernel drivers.


Conclusion



Android Oreo includes mitigations for the most common source of security bugs in
the kernel. This is especially relevant because 85% of kernel security bugs in
Android have been in vendor drivers that tend to get much less scrutiny. These
updates make it easier for driver developers to discover common bugs during
development, stopping them before they can reach end user devices.

Read more

8/29/17

ARCore: Augmented reality at Android scale

Posted by Dave Burke, VP, Android Engineering


With more than two billion active devices, Android is the largest mobile
platform in the world. And for the past nine years, we've worked to create a
rich set of tools, frameworks and APIs that deliver developers' creations to
people everywhere. Today, we're href="https://developers.google.com/ar/">releasing a preview of a new
software development kit (SDK) called ARCore. It brings augmented reality
capabilities to existing and future Android phones. Developers can start
experimenting with it right now.








We've been developing the fundamental technologies that power mobile AR over the
last three years with Tango, and ARCore is built on that work. But, it works
without any additional hardware, which means it can scale across the Android
ecosystem. ARCore will run on millions of devices, starting today with the Pixel
and Samsung's S8, running 7.0 Nougat and above. We're targeting 100 million
devices at the end of the preview. We're working with manufacturers like
Samsung, Huawei, LG, ASUS and others to make this possible with a consistent bar
for quality and high performance.








ARCore works with Java/OpenGL, Unity and Unreal and focuses on three things:


  • Motion tracking: Using the
    phone's camera to observe feature points in the room and IMU sensor data, ARCore
    determines both the position and orientation (pose) of the phone as it moves.
    Virtual objects remain accurately placed.
  • Environmental understanding:
    It's common for AR objects to be placed on a floor or a table. ARCore can detect
    horizontal surfaces using the same feature points it uses for motion tracking.
  • Light estimation: ARCore
    observes the ambient light in the environment and makes it possible for
    developers to light virtual objects in ways that match their surroundings,
    making their appearance even more realistic.







Alongside ARCore, we've been investing in apps and services which will further
support developers in creating great AR experiences. We built href="https://vr.google.com/blocks/">Blocks and href="https://www.tiltbrush.com/">Tilt Brush to make it easy for anyone to
quickly create great 3D content for use in AR apps. As we href="https://www.blog.google/products/google-vr/latest-vr-and-ar-google-io/">mentioned
at I/O, we're also working on Visual Positioning Service (VPS), a service
which will enable world scale AR experiences well beyond a tabletop. And we
think the Web will be a critical component of the future of AR, so we're also
releasing prototype browsers for web developers so they can start experimenting
with AR, too. These custom browsers allow developers to create AR-enhanced
websites and run them on both Android/ARCore and iOS/ARKit.



ARCore is our next step in bringing AR to everyone, and we'll have more to share
later this year. Let us know what you think through href="http://github.com/google-ar">GitHub, and check outhref="http://experiments.withgoogle.com/ar"> our new AR Experiments showcase
where you can find some fun examples of what's possible. Show us what you build
on social media with #ARCore; we'll be resharing some of our favorites.



Read more

Announcing the 20 finalists and open registration for the Indie Games Festival in San Francisco


Posted by Kacey Fahey, Developer Marketing, Google Play


With so many great mobile games launching this year, we saw a huge amount of
interest from indie developers to showcase their art at the href="https://android-developers.googleblog.com/2017/07/calling-all-indie-developers-in-us.html">Google
Play Indie Games Festival in San Francisco next month. While it was a tough
selection process, we're excited to announce the 20 finalists, as well as our
esteemed judging panel. Fans will be able to play the new and un-released indie
games in a fun festival atmosphere where they can also meet the creators
themselves. To attend and learn more about the event, register now for free at
href="https://goo.gl/Nxydsd">g.co/play/sfindiegamesfest2017.



So how did we choose the 20 finalists? We powered up our phones, put our
game-faces on, and looked for games that not only met the festival requirements,
but also stood out with their overall design, fun, and quality. These are the 20
finalists who will be joining us at the festival to demo their games.




Meet the finalists
















7
Pin Pool


SPG Inc



href="https://play.google.com/store/apps/details?id=com.robotogames.ageofrivals">Age
of Rivals


Roboto Games














href="https://play.google.com/store/apps/details?id=io.v2g.beastbrawlers">Beast
Brawlers - PvP Arena


V2 Games Inc.


Brave Hand

Heart Shaped Games

(game not yet released)














href="https://play.google.com/store/apps/details?id=com.CovensMapTest.RainCrow&e=-EnableAppDetailsPageRedesign">Covens

Raincrow Studios, LLC


href="https://play.google.com/store/apps/details?id=com.pixelbizarre.CrashyCars&e=-EnableAppDetailsPageRedesign">Crashy
Cars


pixelbizarre














href="https://play.google.com/store/apps/details?id=com.makingwonder.dokudo">Dokudo


Sense of Wonder


href="https://play.google.com/store/apps/details?id=com.noodlecake.flippinglegend">Flipping
Legend



Hiding Spot














href="https://play.google.com/store/apps/details?id=com.happiigamerstudio.gladiatorrising">Gladiator
Rising



Happii Gamer Studio


href="https://play.google.com/store/apps/details?id=com.HappySquareStudio.JigsawStory1&hl=en">Jigsaw
Story



Happy Square Studio Inc














href="https://play.google.com/store/apps/details?id=com.gorillabeangames.loterialatinbingo">Loteria
Latin Bingo



Gorilla Bean Games


Maruta Escape


Busan Sanai Games


(game not yet released)














href="https://play.google.com/store/apps/details?id=com.BVP.NoStranger">NoStranger


Black Vein Productions


href="https://play.google.com/store/apps/details?id=com.bluewizard.slayawaycamp&hl=en">Slayaway
Camp



Blue Wizard Digital














href="https://play.google.com/store/apps/details?id=com.SpacewaveStudio.SpaceTunnel">Space
Tunnel



Spacewave Studios


href="https://play.google.com/store/apps/details?id=com.rac7.SplitterCritters&hl=en">Splitter
Critters



RAC7














href="https://play.google.com/store/apps/details?id=com.roguesnail.starvikings&e=-EnableAppDetailsPageRedesign">Star
Vikings Forever



Akupara Games


href="https://play.google.com/store/apps/details?id=com.zombio.stormwars&hl=en">Storm
Wars



Zom.bio














Tiny Bubbles


Pine Street Codeworks


(game not yet released)


href="https://play.google.com/store/apps/details?id=com.kneeko.topsoil">Topsoil


Nico Prins




In addition to playing these games and meeting the developers who made them,
fans will have a chance to vote for their favorites throughout the festival. The
Top 10 will then move on to present a short pitch in pursuit of going home as
one of the three overall festival winners. The winners will be chosen by this
year's panel of judges representing a diverse lineup of gaming expertise.


  • Alex the Gamerette, YouTube Creator
  • Lina Chen, Co-founder & CEO of Nix Hydra
  • Emily Greer, CEO of Kongregate
  • Jamil Moledina, Games Strategic Lead, Google
  • Dean Takahashi, Lead Writer for GamesBeat
  • Sarah Thomson, BD Lead, Indie Games, Google Play


Emceeing this year's event is J.D. Witherspoon, aka href="https://goo.gl/9wvJ83">runJDrun. No stranger to gaming,
YouTuber/actor/comedian, J.D. plays a wide array of games and frequently uploads
gaming, vlog, and comedy content to his channels.



If you want to try out these games and celebrate the indie community, learn more
about the event and register at href="https://goo.gl/Nxydsd">g.co/play/sfindiegamesfest2017.



How useful did you find this blogpost?



href="https://docs.google.com/forms/d/e/1FAIpQLScLTlzFd_aV-3rAdBqO1QxwCsuAcDCIM6fJFXyNcyf7zElVXg/viewform?usp=pp_url&entry.753333049=1%E2%98%85+%E2%80%93+Not+at+all&entry.2056663615&entry.646747778=SFindiefest-07/17" style="color:gold;" >★
href="https://docs.google.com/forms/d/e/1FAIpQLScLTlzFd_aV-3rAdBqO1QxwCsuAcDCIM6fJFXyNcyf7zElVXg/viewform?usp=pp_url&entry.753333049=2%E2%98%85+%E2%80%93+Not+very&entry.2056663615&entry.646747778=SFindiefest-07/17" style="color:gold;" >★
href="https://docs.google.com/forms/d/e/1FAIpQLScLTlzFd_aV-3rAdBqO1QxwCsuAcDCIM6fJFXyNcyf7zElVXg/viewform?usp=pp_url&entry.753333049=3%E2%98%85+%E2%80%93+Somewhat&entry.2056663615&entry.646747778=SFindiefest-07/17" style="color:gold;" >★
href="https://docs.google.com/forms/d/e/1FAIpQLScLTlzFd_aV-3rAdBqO1QxwCsuAcDCIM6fJFXyNcyf7zElVXg/viewform?usp=pp_url&entry.753333049=4%E2%98%85+%E2%80%93+Very&entry.2056663615&entry.646747778=SFindiefest-07/17" style="color:gold;" >★
href="https://docs.google.com/forms/d/e/1FAIpQLScLTlzFd_aV-3rAdBqO1QxwCsuAcDCIM6fJFXyNcyf7zElVXg/viewform?usp=pp_url&entry.753333049=5%E2%98%85+%E2%80%93+Extremely&entry.2056663615&entry.646747778=SFindiefest-07/17" style="color:gold;" >★





Read more

8/25/17

How to improve app design for Wear 2.0

Posted by Steven Tepper, App Quality Consultant, Google Play


href="https://android-developers.googleblog.com/2017/02/AndroidWear2.html">Wear
2.0 launched back in February with added support for new hardware features
in addition to adopting new href="https://www.google.com/design/spec-wear/android-wear/designing-for-watches.html">Material
Design themes,href="https://www.google.com/design/spec-wear/android-wear/designing-for-watches.html">
ghref="https://www.google.com/design/spec-wear/android-wear/designing-for-watches.html">uihref="https://www.google.com/design/spec-wear/android-wear/designing-for-watches.html">dehref="https://www.google.com/design/spec-wear/android-wear/designing-for-watches.html">lihref="https://www.google.com/design/spec-wear/android-wear/designing-for-watches.html">nehref="https://www.google.com/design/spec-wear/android-wear/designing-for-watches.html">s,
and a simpler vertical UI pattern. It also introduces a href="https://developer.android.com/training/wearables/watch-faces/complications.html">complications
API, making it easier for apps to provide data to watch faces, and watch
faces to incorporate external data. The final big update was that, apps
targeting Wear 2.0 now have the ability to operate in a href="https://developer.android.com/training/wearables/apps/standalone-apps.html">standalone
mode, without needing a connection to a companion app on the phone.



There are a few design considerations in relation to navigation, notifications,
the complications API, and the standalone functionality to help you better
optimize for Wear 2.0 devices:


Navigation



  1. Use the href="https://developer.android.com/training/wearables/ui/ui-nav-actions.html#create
    a drawer">WearableDrawerLayout navigation drawer for simple and infrequent
    navigation:
    Simple navigation includes tasks such as accessing app
    settings, switching users or logging out. You can implement
    this on Wear 2.0 to switch between different views or sections of the app via a
    swipe down from the top of the screen, or an action drawer can be set up for
    context-specific actions when swiping up from the bottom of the screen.
  2. Present a navigation drawer as a single-page drawer to enable users
    to navigate views quickly:
    A navigation drawer can be presented as
    either a multi-page or single-page drawer. The single-page layout is useful for
    when the user is expected to navigate quickly between 7 or less views of the
    app. Remember that if the app is using a single-page drawer, the iconography
    should be clear and understandable as there will not be any sort of text
    labeling in this layout. If there are more than 7 views to navigate to or the
    views are not easily represented by icons, you should instead use the multi-page
    drawer layout.





  3. Use multiple app launchers if your app has two or three discrete
    functions:
    For example, if your app supports
    both activity tracking—with various options, actions,
    and views—and historical analysis and management of tracked activities, you can
    use multiple app launchers to handle these tasks. Alternatively, if your app has
    a simple home screen, these features could be placed in line, at the bottom of
    the screen.
  4. Use peeking at the top of the action drawer to provide quick access
    to the primary action:
    If there is no primary action associated with
    the view, override the default behavior and force an overflow button to peek
    instead, exposing all actions at the bottom of a view, when tapped.











Ensure that for devices using Wear 2.0, your app takes advantage of these new UI
patterns to provide a consistent user experience. Check out more training
resources for href="https://developer.android.com/training/wearables/ui/ui-nav-actions.html">Wear
Navigation and Actions and the Material Design specifications for href="https://www.google.com/design/spec-wear/components/navigation-drawer.html">Navigation
and href="https://www.google.com/design/spec-wear/components/action-drawer.html">Action
Drawers.


Notifications



Wear 2.0 uses a simpler vertical navigation pattern, removing the horizontal
swiping gesture to present actions for a notification. Notification actions are
now presented as a single primary action (if applicable) at the bottom of a
notification. If there is no primary action, expanding the notification will
present options in a single, vertically scrollable view.



Notifications will work without needing many changes on both 1.x and 2.0
devices, but appear quite different:








When creating apps for Wear 2.0 devices, improve the user experience with
notifications by applying the following best practices:


  1. Support expandable notifications: Use href="https://developer.android.com/reference/android/support/v4/app/NotificationCompat.BigTextStyle.html">BigTextStyle
    so that users can see more content on their watch.
  2. Use the collapsed view of the notification (if applicable):
    Add the primary action for your notification to the collapsed view of the
    notification using setContentIntent(), where appropriate.
  3. For messaging apps, use the href="https://developer.android.com/training/wearables/notifications/noti-styles.html">MessagingStyle:
    Provide a rich chat app-like experience in the expanded notification using this
    style.
  4. Update user directions which are specific to Wear 1.0:
    Remove any text guiding users to act on a card by swiping horizontally
    (the Wear 1.x pattern).
  5. Enhancing notifications to use inline actions: This allows
    users to do things without needing tap to see the expanded notification details.
    Actions for messaging notifications can use several different input methods
    including Smart Reply presets, voice, and keyboard input. Take advantage of
    these features to provide added functionality and delight users.


To learn more about href="https://developer.android.com/training/wearables/notifications/index.html">adding
wearable features to notifications.


Complications



The complications API in Wear 2.0 makes it much easier for watch face developers
and third-party data providers to surface important information users want, at a
glance. Watch faces that support the API can be configured to use any of the
data providers that have been installed on the watch while maintaining complete
control over their appearance. Apps supporting the complication API allow the
app's data to be accessible on any watch faces that support complications. These
complications can be displayed in a variety of forms (short text, icon, ranged
value, long text, small image, and large image) depending on what the data
provider has configured and how much space has been allocated on the watch face.








To ensure that complications fit the overall design of the watch face and
properly handle their data type, when adding complication support we recommend
watch face makers should:


  1. Use the href="https://developer.android.com/reference/android/support/wearable/complications/rendering/TextRenderer.html">TextRenderer
    class found in the Wear 2.0 SDK:
    This allows the text within
    complications to be adjusted to their bounds by shrinking the text, dynamically
    supporting line breaks or ellipsizing strings when they exceed the bounds of a
    text-based complication.
  2. Use the href="https://developer.android.com/reference/android/support/wearable/complications/rendering/ComplicationDrawable.html">ComplicationDrawable
    class to set the background color, shape, border, and font options for the
    complications:
    This gives complete control of how the complication is
    rendered to the watch face.
  3. Design the watch face to provide a way for users to configure or
    adjust complications on the watch face through a settings menu:
    To
    learn how to construct these settings see the href="https://github.com/googlesamples/android-WatchFace">watch face sample
    on GitHub.
  4. Use the data provider href="https://github.com/googlesamples/android-WearComplicationProvidersTestSuite">test
    suite app to feed dummy data to the watch face complications:
    This
    will enable you to verify that all of the complications render properly and have
    fonts formatted for their bounds.
  5. As a complication data provider, expose relevant data by using the
    href="https://developer.android.com/reference/android/support/wearable/complications/ComplicationProviderService.html">ComplicationProviderService:

    Simply define and configure what types of href="https://developer.android.com/reference/android/support/wearable/complications/ComplicationData.html">ComplicationData
    the app can provide for complications.

Standalone functionality on Wear devices



  1. Make sure your app is able to handle itself if there is no companion
    app installed when using the android.hardware.type.watch hardware feature
    flag
    : Using this feature enables your app to become searchable and
    installable directly on Wear devices without needing to install a companion
    phone app, so ensure your app can handle itself to avoid a confusing or broken
    user experience.
  2. Ensure your wearable app doesn't rely on the phone app for
    sign-in/authentication or primary functionality
    : When requiring
    complicated input for authentication (for example, password entry) your wearable
    app can point to the companion phone, but should rely on web UI for
    account/password entry rather than an app.
  3. Where a companion app must be present on a phone to support your app
    in some other way, the app should use the href="https://developers.google.com/android/reference/com/google/android/gms/wearable/CapabilityApi">CapabilityApi:

    This should be used to properly direct users to the Play Store listing on their
    companion device to install the missing app. Otherwise, the app should function
    on its own, using the Wear built-in Wi-Fi, GPS, or other connectivity functions.





  4. Include wording about any companion app requirements or briefly
    mention how your Wear app should function within the Play Store listing
    description
    : This will help set expectations and guide users to install
    the correct apps for the best possible experience.
  5. Incorporate the href="https://developer.android.com/training/wearables/apps/standalone-apps.html">com.google.android.wearable.standalone
    flag in the manifest if your Wearable app can function without any phone
    companion interaction
    : This flag indicates that the wearable app can be
    installed and will fully function when not paired to an Android or iOS companion
    phone.


Though a lot was covered here, there are additional resources you can use to
ensure that your apps or games are optimized and use the latest patterns and
functionality on Wear. Be sure to href="https://developer.android.com/develop/quality-guidelines/wear-app-quality.html">review
the quality guidelines and check out the developer training documentation to
learn more best practices for href="https://developer.android.com/wear/index.html">wearable app
development and href="https://www.google.com/design/spec-wear/android-wear/introduction.html">wearable
app design in order to build quality apps for Wear.




How useful did you find this blogpost?



href="https://docs.google.com/forms/d/e/1FAIpQLScLTlzFd_aV-3rAdBqO1QxwCsuAcDCIM6fJFXyNcyf7zElVXg/viewform?usp=pp_url&entry.753333049=1%E2%98%85+%E2%80%93+Not+at+all&entry.2056663615&entry.646747778=Wear2.0tips-08/17" style="color:gold;">★
href="https://docs.google.com/forms/d/e/1FAIpQLScLTlzFd_aV-3rAdBqO1QxwCsuAcDCIM6fJFXyNcyf7zElVXg/viewform?usp=pp_url&entry.753333049=2%E2%98%85+%E2%80%93+Not+very&entry.2056663615&entry.646747778=Wear2.0tips-08/17" style="color:gold;">★
href="https://docs.google.com/forms/d/e/1FAIpQLScLTlzFd_aV-3rAdBqO1QxwCsuAcDCIM6fJFXyNcyf7zElVXg/viewform?usp=pp_url&entry.753333049=3%E2%98%85+%E2%80%93+Somewhat&entry.2056663615&entry.646747778=Wear2.0tips-08/17" style="color:gold;">★
href="https://docs.google.com/forms/d/e/1FAIpQLScLTlzFd_aV-3rAdBqO1QxwCsuAcDCIM6fJFXyNcyf7zElVXg/viewform?usp=pp_url&entry.753333049=4%E2%98%85+%E2%80%93+Very&entry.2056663615&entry.646747778=Wear2.0tips-08/17" style="color:gold;">★
href="https://docs.google.com/forms/d/e/1FAIpQLScLTlzFd_aV-3rAdBqO1QxwCsuAcDCIM6fJFXyNcyf7zElVXg/viewform?usp=pp_url&entry.753333049=5%E2%98%85+%E2%80%93+Extremely&entry.2056663615&entry.646747778=Wear2.0tips-08/17" style="color:gold;">★




Read more

Understanding the performance benefits of ConstraintLayout

Posted by Takeshi Hagikura, Developer Programs Engineer


Since announcing href="https://developer.android.com/training/constraint-layout/index.html">ConstraintLayout
at Google I/O last year, we've continued to improve the layout's stability and
layout editor support. We've also added new features specific to
ConstraintLayout that help you build various type of layouts, such
as href="https://developer.android.com/training/constraint-layout/index.html#constrain-chain">introducing
chains and href="https://developer.android.com/training/constraint-layout/index.html#ratio">setting
size as a ratio. In addition to these features, there is a notable
performance benefit by using ConstraintLayout. In this post, we'll
walk through how you can benefit from these performance improvements.

How Android draws views?



To better understand the performance of ConstraintLayout, let's
take a step back and see how Android draws views.



When a user brings an Android view into focus, the Android framework directs the
view to draw itself. This drawing process comprises 3 phases:



  1. Measure


    The system completes a top-down traversal of the view tree to determine how
    large each ViewGroup and View element should be. When a
    ViewGroup is measured, it also measures its children.



  2. Layout


    Another top-down traversal occurs, with each ViewGroup determining
    the positions of its children using the sizes determined in the measure phase.



  3. Draw


    The system performs yet another top-down traversal. For each object in the view
    tree, a Canvas object is created to send a list of drawing commands
    to the GPU. These commands include the ViewGroup and
    View objects' sizes and positions, which the system determined
    during the previous 2 phases.










Figure 1. Example of how the measure phase traverses a view tree



Each phase within the drawing process requires a top-down traversal of the view
tree. Therefore, the more views you embed within each other (or nest) into the
view hierarchy, the more time and computation power it takes for the device to
draw the views. By keeping a flat hierarchy in your Android app layouts, you can
create a fast and responsive user interface for your app.




The expense of a traditional layout hierarchy



With that explanation in mind, let's create a traditional layout hierarchy that
uses LinearLayout and RelativeLayout objects.








Figure 2. Example layout



Let's say we want to build a layout like the image above. If you build it with
traditional layouts, the XML file contains an element hierarchy similar to the
following (for this example, we've omitted the attributes):




class="prettyprint"><RelativeLayout>
<ImageView />
<ImageView />
<RelativeLayout>
<TextView />
<LinearLayout>
<TextView />
<RelativeLayout>
<EditText />
</RelativeLayout>
</LinearLayout>
<LinearLayout>
<TextView />
<RelativeLayout>
<EditText />
</RelativeLayout>
</LinearLayout>
<TextView />
</RelativeLayout>
<LinearLayout >
<Button />
<Button />
</LinearLayout>
</RelativeLayout>


Although there's usually room for improvement in this type of view hierarchy,
you'll almost certainly still need to create a hierarchy with some nested views.



As discussed before, nested hierarchies can adversely affect performance. Let's
take a look at how the nested views actually affect the UI performance using
Android Studio's href="https://developer.android.com/studio/profile/systrace-commandline.html">Systrace
tool. We called the measure and layout phases for each ViewGroup
(ConstraintLayout and RelativeLayout) programmatically
and triggered Systrace while the measure and layout calls are executing. The
following command generates an overview file that contains key events, such as
expensive measure/layout passes, that occur during a 20-second interval:




class="prettyprint">python $ANDROID_HOME/platform-tools/systrace/systrace.py --time=20 -o ~/trace.html gfx view res



For more details about how you can use Systrace, see the href="https://developer.android.com/studio/profile/systrace.html">Analyzing UI
Performance with Systrace guide.



Systrace automatically highlights the (numerous) performance problems with this
layout, as well as suggestions for fixing them. By clicking the "Alerts" tab,
you will find that drawing this view hierarchy requires 80 expensive passes
through the measure and layout phases!



Triggering that many expensive measure and layout phases is far from ideal; such
a large amount of drawing activity could result in skipped frames that users
notice. We can conclude that the layout has poor performance due to the nested
hierarchy as well as the characteristic of RelativeLayout, which
measures each of its children twice.








Figure 3. Looking at the alerts from Systrace for the
layout variant that uses RelativeLayout



You can check the entire code on how we performed these measurements in our href="https://github.com/googlesamples/android-constraint-layout-performance">GitHub
repository.


The benefits of a ConstraintLayout object



If you create the same layout using ConstraintLayout, the XML file
contains an element hierarchy similar to the following (attributes again
omitted):




class="prettyprint"><android.support.constraint.ConstraintLayout>
<ImageView />
<ImageView />
<TextView />
<EditText />
<TextView />
<TextView />
<EditText />
<Button />
<Button />
<TextView />
</android.support.constraint.ConstraintLayout>


As this example shows, the layout now has a completely flat hierarchy. This is
because ConstraintLayout allows you to build complex layouts
without having to nest View and ViewGroup elements.



For example, let's look at the TextView and EditText
in the middle of the layout:








When using a RelativeLayout, you need to create a new
ViewGroup to align the EditText vertically with the
TextView:



class="prettyprint"><LinearLayout
android:id="@+id/camera_area"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_below="@id/title" >

<TextView
android:text="@string/camera"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:id="@+id/cameraLabel"
android:labelFor="@+id/cameraType"
android:layout_marginStart="16dp" />

<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">

<EditText
android:id="@+id/cameraType"
android:ems="10"
android:inputType="textPersonName"
android:text="@string/camera_value"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginTop="8dp"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp" />
</RelativeLayout>
</LinearLayout>


By using ConstraintLayout instead, you can achieve the same effect
just by adding a constraint from the baseline of the TextView to
the baseline of the EditText without creating another
ViewGroup:








Figure 4. Constraint between EditText and TextView



class="prettyprint"><TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintLeft_creator="1"
app:layout_constraintBaseline_creator="1"
app:layout_constraintLeft_toLeftOf="@+id/activity_main_done"
app:layout_constraintBaseline_toBaselineOf="@+id/cameraType" />


When running the Systrace tool for the version of our layout that uses
ConstraintLayout, you see far fewer expensive measure/layout passes
during the same 20-second interval. This improvement in performance makes sense,
now that we're keeping the view hierarchy flat!








Figure 5. Looking at the alerts from Systrace for the
layout variant that uses ConstraintLayout



On a related note, we built the ConstraintLayout variant of our
layout using just the href="https://developer.android.com/training/constraint-layout/index.html">layout
editor instead of editing the XML by hand. To achieve the same visual effect
using RelativeLayout, we probably would have needed to edit the XML
by hand.


Measuring the performance difference



We analyzed how long every measure and layout pass took for two type of layouts,
ConstraintLayout and RelativeLayout, by using
href="https://developer.android.com/reference/android/view/Window.OnFrameMetricsAvailableListener.html">OnFrameMetricsAvailableListener,
which was introduced in Android 7.0 (API level 24). This class allows you to
collect frame-by-frame timing information about your app's UI
rendering.


By calling the following code, you can start recording per-frame UI actions:




class="prettyprint">window.addOnFrameMetricsAvailableListener(
frameMetricsAvailableListener, frameMetricsHandler);


After timing information becomes available, the app triggers the
frameMetricsAvailableListener() callback. We are interested in the
measure/layout performance, so we call href="https://developer.android.com/reference/android/view/FrameMetrics.html#LAYOUT_MEASURE_DURATION">FrameMetrics.LAYOUT_MEASURE_DURATION
when retrieving the actual frame duration.



class="prettyprint">Window.OnFrameMetricsAvailableListener {
_, frameMetrics, _ ->
val frameMetricsCopy = FrameMetrics(frameMetrics);
// Layout measure duration in nanoseconds
val layoutMeasureDurationNs =
frameMetricsCopy.getMetric(FrameMetrics.LAYOUT_MEASURE_DURATION);


To learn more about the other types of duration information that
FrameMetrics can receive, see the href="https://developer.android.com/reference/android/view/FrameMetrics.html">FrameMetrics
API reference.

Measurement results: ConstraintLayout is faster



Our performance comparison shows that ConstraintLayout performs
about 40% better in the measure/layout phase than RelativeLayout:








Figure 6. Measure / Layout (unit: ms, average of 100
frames)



As these results show, ConstraintLayout is likely to be more
performant than traditional layouts. Moreover, ConstraintLayout has
other features that help you build complex and performant layouts, as discussed
in the benefits of a ConstraintLayout
object
section. For details, see the href="https://developer.android.com/training/constraint-layout/index.html">Build
a Responsive UI with ConstraintLayout guide. We recommend that you use
ConstraintLayout when designing your app's layouts. In almost all
cases when you would have previously need a deeply-nested layout,
ConstraintLayout should be your go-to layout for optimal
performance and ease of use.


Appendix: Measurement environment



All the measurements above were performed in the following environment.
















Device
Nexus 5X
Android Version
8.0
ConstraintLayout version
1.0.2


What's next



Check out the href="https://developer.android.com/training/constraint-layout/index.html">developer
guide, the href="https://developer.android.com/reference/android/support/constraint/ConstraintLayout.html">API
reference documentation, and the href="https://medium.com/google-developers/building-interfaces-with-constraintlayout-3958fa38a9f7">article
on Medium to fully understand what ConstraintLayout can provide
for you. And once again, thank you to all who submitted feedback and issues over
the months since our alpha release of ConstraintLayout. We're truly
grateful that we were able to release the production-ready href="http://tools.android.com/recent/constraintlayout10isnowavailable">1.0
version of ConstraintLayout earlier this year.
As we continue to improve ConstraintLayout, please continue to send
us feedback using the Android issue tracker.



Read more

8/24/17

Start on Android and succeed on Google Play



Posted by Karolis Balciunas, VC & Startups Business Development, Google Play


Early Access was launched at Google I/O 2016 as a destination
on Google Play for beta app and game titles still in development, and to attract
early adopters willing to test those titles. The results speak for themselves.
The program has helped over 350 developers launch their titles and generated
over 40M beta installs for their apps and games during just the short window
before their public availability on the Play Store. More importantly, the
average rating for titles that have been through Early Access is 4.3☆ once in
production, putting them in a strong position to be favored in search and
discovery on Google Play.



Early Access also generates positive awareness for new titles. Alumni like href="https://play.google.com/store/apps/details?id=com.simplehabit.simplehabitapp">Simple
Habit and href="https://play.google.com/store/apps/details?id=digit.android">Digit
were chosen as finalists in the "Standout Startup" category at the href="https://play.google.com/store/info/topic?id=merch_topic_30028d2_playwards2017_nomineesTP&hl=en&e=-EnableAppDetailsPageRedesign">Google
Play Awards this year.
Omnidrone's game href="https://play.google.com/store/apps/details?id=com.omnidrone.lanes">Titan
Brawl became the first game to reach 1M testers. Hear more about their
experience in the video below.








Early Access and our work with the venture capital community has taught us a lot
about successful startups. We know you seek rapid iteration towards
product-market fit and are thirsty for the same kind of powerful testing,
analytics, and user feedback that Google's own product teams depend on to launch
successful products. When we know about your startup's plans
well in advance of your launch date, we can impact your trajectory by supporting
you through this understood process of iterative improvement.


Start on Android



Earlier this year we launched Start
on Android
to identify the highest potential Android startups
earlier in their lifecycle and provide tools, perks, and guidance for those who
qualify. We've developed five components that have proven to be most impactful:


  1. Early Access participation enabling developers to recruit beta testers and
    respond to their feedback before it impacts an app's rating on the Play Store.
  2. Pre-launch user interface and user experience reviews from the Play
    editorial team to help optimize onboarding experiences, material design
    implementation, business model execution, and user engagement.
  3. Access to Google perks like the Google Cloud Platform's href="https://cloud.google.com/developers/startups/">Spark Package which
    includes $20K in Google Cloud and Firebase credits, free 12 months of G Suite
    for up to 10 employees, and other financial incentives.
  4. Opportunities to participate in Google Play and other Google teams' programs
    and special events including href="https://cloud.google.com/developers/startups/">Google Cloud Platform,
    Google for Entrepreneurs,
    and Launchpad.
  5. Guidance in the form of videos and content on startup best practices
    available to all at href="http://startonandroid.com">StartonAndroid.com.

We are just getting started



We've already seen a lot of developer interest and received hundreds of public
applications and referrals from venture capitalists and other startup
influencers. Below are a few accepted startups:


  • href="https://play.google.com/store/apps/details?id=org.socratic.android">Socratic
    - A Spark Capital backed company that allows students to solve math problems by
    snapping a photo with their camera and using computer vision to return relevant
    answers and related concepts and video.
  • href="https://play.google.com/store/apps/details?id=com.helloastro.android">Astro
    - A Redpoint
    portfolio company that layers AI on top of your email to help intelligently
    manage your inbox.

  • href="https://play.google.com/store/apps/details?id=com.teampeanut.peanut&rdid=com.teampeanut.peanut">Peanut
    - A Tinder-like app for connecting moms, funded by NEA and Felix Capital.
  • href="https://play.google.com/store/apps/details?id=com.gyroscope.gyroscope">Gyroscope
    - A startup working on an "operating system for the human body".
  • Empower - An exciting new money management
    app backed by Sequoia Capital, coming soon to Android.


We are incredibly proud of every developer we work with and grateful to our
friends within VC firms and the wider community who bring exciting new startups
to our attention.


Get in touch with us



If you would like to be part of Start on Android, complete the form at href="http://startonandroid.com">StartonAndroid.com. We're looking for
developers who are planning to launch on Android soon, or have done so in the
past 6 months.



How useful did you find this blogpost?



href="https://docs.google.com/forms/d/e/1FAIpQLScLTlzFd_aV-3rAdBqO1QxwCsuAcDCIM6fJFXyNcyf7zElVXg/viewform?entry.753333049=1★+–+Not+at+all&entry.2056663615&entry.646747778=startonandroid-08/17" style="color:gold" >★
href="https://docs.google.com/forms/d/e/1FAIpQLScLTlzFd_aV-3rAdBqO1QxwCsuAcDCIM6fJFXyNcyf7zElVXg/viewform?usp=pp_url&entry.753333049=2%E2%98%85+%E2%80%93+Not+very&entry.2056663615&entry.646747778=startonandroid-08/17" style="color:gold" >★
href="https://docs.google.com/forms/d/e/1FAIpQLScLTlzFd_aV-3rAdBqO1QxwCsuAcDCIM6fJFXyNcyf7zElVXg/viewform?usp=pp_url&entry.753333049=3%E2%98%85+%E2%80%93+Somewhat&entry.2056663615&entry.646747778=startonandroid-08/17" style="color:gold" >★
href="https://docs.google.com/forms/d/e/1FAIpQLScLTlzFd_aV-3rAdBqO1QxwCsuAcDCIM6fJFXyNcyf7zElVXg/viewform?usp=pp_url&entry.753333049=4%E2%98%85+%E2%80%93+Very&entry.2056663615&entry.646747778=startonandroid-08/17" style="color:gold" >★
href="https://docs.google.com/forms/d/e/1FAIpQLScLTlzFd_aV-3rAdBqO1QxwCsuAcDCIM6fJFXyNcyf7zElVXg/viewform?usp=pp_url&entry.753333049=5%E2%98%85+%E2%80%93+Extremely&entry.2056663615&entry.646747778=startonandroid-08/17" style="color:gold" >★




Read more

8/23/17

Making it safer to get apps on Android O

Posted by Edward Cunningham. Product Manager, Android Security


Eagle-eyed users of Android O will have noticed the absence of the 'Allow
unknown sources' setting, which has existed since the earliest days of Android
to facilitate the installation of apps from outside of Google Play and other
preloaded stores. In this post we'll talk about the new Install unknown
apps
permission and the security benefits it brings for both Android
users and developers.



Earlier this year we introduced href="https://www.blog.google/products/android/google-play-protect/">Google Play
Protect - comprehensive security services that are always at work to protect
your device from harm. Google Play continues to be one of the safest places for
Android users to download their apps, with the majority of Potentially Harmful
Apps (PHAs) originating from third-party sources.



A common strategy employed by PHA authors is to deliver their apps via a hostile
downloader. For example, a gaming app might not contain malicious code but
instead might notify the user to install a PHA that masquerades as an important
security update. (You can read more about hostile downloaders in the href="https://www.blog.google/topics/connected-workspaces/diverse-protections-diverse-ecosystem-android-security-2016-year-review/">Android
Security 2016 Year in Review). Users who have enabled the installation of
apps from unknown sources leave themselves vulnerable to this deceptive
behavior.








Left (pre-Android O): The install screen for a PHA masquerading as a system
update.
Right (Android O): Before the PHA is installed, the user must first grant
permission to the app that triggered the install.



In Android O, the Install unknown apps permission makes it
safer to install apps from unknown sources. This permission is tied to the app
that prompts the install— just like other runtime permissions—and ensures that
the user grants permission to use the install source before it can prompt the
user to install an app. When used on a device running Android O and higher,
hostile downloaders cannot trick the user into installing an app without having
first been given the go-ahead.



This new permission provides users with transparency, control, and a streamlined
process to enable installs from trusted sources. The Settings app shows the list
of apps that the user has approved for installing unknown apps. Users can
revoke the permission for a particular app at any time.








At any time, users can review the apps that they've allowed for installing
unknown apps. To make the permission-granting process easier, app developers can
choose to direct users to their permission screen as part of the setup
flow.


Developer changes




To take advantage of this new behavior, developers of apps that require the
ability to download and install other apps via the Package Installer may need to
make some changes. If an app uses a targetSdkLevel of 26 or above
and prompts the user to install other apps, the manifest file needs to include
the href="https://developer.android.com/reference/android/Manifest.permission.html#REQUEST_INSTALL_PACKAGES">REQUEST_INSTALL_PACKAGES
permission:



class="prettyprint"><uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />


Apps that haven't declared this permission cannot install other apps, a handy
security protection for apps that have no intention of doing so. You can choose
to pre-emptively direct your users to the Install unknown apps
permission screen using the href="https://developer.android.com/reference/android/provider/Settings.html#ACTION_MANAGE_UNKNOWN_APP_SOURCES">ACTION_MANAGE_UNKNOWN_APP_SOURCES
Intent action. You can also query the state of this permission using the
PackageManager href="https://developer.android.com/reference/android/content/pm/PackageManager.html#canRequestPackageInstalls()">canRequestPackageInstalls()
API.


Remember that href="https://play.google.com/about/developer-content-policy/">Play policies
still apply to apps distributed on Google Play if those apps can install and
update other apps. In the majority of cases, such behavior is inappropriate; you
should instead provide a href="https://developer.android.com/distribute/marketing-tools/linking-to-google-play.html">deep
link to the app's listing on the Play Store.



Be sure to check out the updated href="https://developer.android.com/studio/publish/index.html#publishing-unknown">publishing
guide that provides more information about installing unknown apps, and stay
tuned for more posts on security hardening in Android O.




Read more

8/22/17

Introducing Android 8.0 Oreo

Posted By: Dave Burke, VP of Engineering

After more than a year of development and months of testing by developers and early adopters (thank you!), we're now ready to officially launch Android 8.0 Oreo to the world. Android 8.0 brings a ton of great features such as picture-in-picture, autofill, integrated Instant Apps, Google Play Protect, faster boot time, and much more.

We're pushing the sources to Android Open Source Project (AOSP) for everyone to access today. Pixel and Nexus 5X/6P builds have entered carrier testing and we expect to start rolling out in phases over the next several weeks, alongside Pixel C and Nexus Player. Android Beta users will receive the update to the final version today and images are href="https://developer.android.com/about/versions/o/download.html">available to download and flash manually. We've been working closely with our partners over the last many months, and by the end of this year, hardware makers like Essential, General Mobile, HMD Global Home of Nokia Phones, Huawei, HTC, Kyocera, LG, Motorola, OnePlus, Samsung, Sharp and Sony are scheduled to be launching or upgrading new devices to Android 8.0 Oreo.

What's in Android Oreo?

In Android 8.0 Oreo we focused on creating fluid experiences that make Android even more powerful and easy to use, such as:

  • Picture-in-picture lets users manage two tasks simultaneously on any size screen, and it's href="https://developer.android.com/about/versions/o/android-8.0.html#opip">easy for apps to support it. (Shown at right)

  • Notification dots extend the reach of notifications and offer a new way to surface activity in your apps. Dots href="https://developer.android.com/guide/topics/ui/notifiers/notifications.html#badges">work with zero effort for most apps -- we even extract the color of the dot from your icon.

  • Autofill framework simplifies how users set up a new device and synchronize their passwords. Apps using form data canhref="https://developer.android.com/guide/topics/text/autofill.html"> optimize their apps for Autofill, and password manager apps can use the new APIs to make their services available to users in their favorite apps. Autofill will roll out fully over the next few weeks as part of an update to Google Play Services.




We also invested in Android Vitals, a project focused on optimizing battery life, startup time, graphics rendering, and stability, while giving developers better visibility over the health of their apps:

  • System optimizations: We worked across the system to help apps run faster and smoother -- for example, in the runtime we added a new concurrent compacting garbage collection, code locality, and more.

  • Background limits: We added new href="https://developer.android.com/about/versions/o/background-location-limits.html">limits on background location and wi-fi scans and href="https://developer.android.com/about/versions/o/background.html">changes in the way apps run in the background. These boundaries prevent unintentional overuse of battery and memory and apply to all apps -- make sure you understand and account for these in your apps.

  • Complementary Android Vitals dashboards and IDE profilers: In the Play Console you can now see aggregate data about your app to help you href="https://developer.android.com/topic/performance/vitals/index.html">pinpoint common issues - excessive crash rate, ANR rate, frozen frames, slow rendering, excessive wakeups, and more. You'll also find new performance profilers in Android Studio 3.0, and new instrumentation in the platform.




In Android 8.0 your app can directly pin a specific app shortcut in the launcher to drive engagement (left). Notification dots keep users active in your app and let them jump directly to the app's core functions (right).

For developers, Android Oreo includes many new capabilities to help you build better, more efficient apps. Here are just a few:

  • Autosizing textview: Use href="https://developer.android.com/guide/topics/ui/look-and-feel/autosizing-textview.html">autosizing TextView to automatically fill a TextView with text, regardless of the amount. You can create an array of preset text sizes, or set min and max sizes with a step granularity, and the text will grow and shrink to fill the available TextView space.

  • Fonts in XML: href="https://developer.android.com/guide/topics/ui/look-and-feel/fonts-in-xml.html">Fonts are now a fully supported resource type. You can now use fonts in XML layouts and define font families in XML.

  • Downloadable fonts and emoji: With href="https://developer.android.com/guide/topics/ui/look-and-feel/downloadable-fonts.html">downloadable fonts you can load fonts from a shared provider instead of including them in your APK. The provider and support library manage the download of fonts and shares them across apps. The same implementation also supports downloadable emoji, so you can get updated emoji without being limited to the emoji built into the device.

  • Adaptive icons: You can now create href="https://developer.android.com/guide/practices/ui_guidelines/icon_design_adaptive.html">adaptive icons that the system displays in different shapes, based on a mask selected by a device manufacturer. The system also animates interactions with the icons, and uses them in the launcher, shortcuts, settings, sharing dialogs, and in the overview screen.




Adaptive icons display in a variety of shapes across different device models.
  • Shortcut pinning: App shortcuts and homescreen widgets are great for engaging users and now you can let users add and href="https://android-developers.googleblog.com/2017/07/whats-new-for-shortcuts-and-widgets-in.html">pin shortcuts and widgets to the launcher from within your app. There's also a new option to add a specialized activity to help users create shortcuts. The activity is complete with custom options and confirmation.

  • Wide-gamut color for apps: Imaging apps can now take full advantage of new devices that have a wide-gamut color capable display. To display wide gamut images, apps enable a flag in their manifest files (per activity) and load bitmaps with an embedded href="https://developer.android.com/reference/android/graphics/ColorSpace.html">wide color profile (AdobeRGB, Pro Photo RGB, DCI-P3, etc.).

  • WebView enhancements: In Android Oreo, we've enabled WebView multiprocess mode by default and added an API to let your app href="https://developer.android.com/guide/webapps/managing-webview.html">handle errors and crashes. You can also opt in your app's WebView objects to href="https://developer.android.com/guide/webapps/managing-webview.html#safe-browsing">verify URLs through Google Safe Browsing.

  • Java 8 Language APIs and runtime optimizations: Android now supports several new Java Language APIs, including the new java.time API. In addition, the Android Runtime is faster than ever before, with improvements of up to 2x on some application benchmarks.




Learn more about these and other new features by visiting the href="https://developer.android.com/about/versions/o/index.html">Android 8.0 Oreo site on href="https://developer.android.com/index.html">developer.android.com. Also check out the What's New in Android Oreo? video for an overview of new features for developers.

Make sure your apps are ready

If haven't already, take a few moments today to test your apps and make sure they offer the experience you want for users upgrading to Android Oreo.

Just install your current app from Google Play onto a device or href="https://developer.android.com/studio/run/managing-avds.html">emulator running Android Oreo and test the user flows. The app should run and look great, and handle the Android Oreo href="https://developer.android.com/about/versions/o/android-8.0-changes.html">behavior changes properly. In particular, pay attention to href="https://developer.android.com/about/versions/o/android-8.0-changes.html#abll">background location limits, href="https://developer.android.com/guide/topics/ui/notifiers/notifications.html#ManageChannels">notification channels, and changes in href="https://developer.android.com/about/versions/o/android-8.0-changes.html#networking-all">networking, href="https://developer.android.com/about/versions/o/android-8.0-changes.html#security-all">security, and href="https://developer.android.com/about/versions/o/android-8.0-changes.html#privacy-all">identifiers.

Once you've resolved any issues, publish your app updates to Google Play in your alpha, beta, or production channels so that they're available as users start to receive Android 8.0 Oreo.

Speed your development with Android Studio

When you're ready to build with new APIs in Android Oreo, we recommend updating to the latest version of href="https://android-developers.googleblog.com/2017/05/android-studio-3-0-canary1.html">Android Studio 3.0, available for download from the href="https://developer.android.com/studio/preview/index.html">beta channel. Aside from improved app href="https://developer.android.com/studio/preview/features/android-profiler.html">performance profiling tools, support for the href="http://android-developers.googleblog.com/2017/05/android-announces-support-for-kotlin.html">Kotlin programming language, and Gradle build optimizations, Android Studio 3.0 makes it easier to develop with href="https://android-developers.googleblog.com/2017/05/android-instant-apps-is-open-to-all.html">Instant Apps, href="https://developer.android.com/guide/topics/ui/look-and-feel/fonts-in-xml.html">XML Fonts, href="https://developer.android.com/guide/topics/ui/look-and-feel/downloadable-fonts.html">downloadable fonts, and href="https://developer.android.com/guide/practices/ui_guidelines/icon_design_adaptive.html">adaptive icons.

Android Studio 3.0 includes tools for developing with Android Oreo features, such as previewing XML font resources in your app.

We also recommend updating to the href="https://developer.android.com/topic/libraries/support-library/revisions.html?utm_campaign=android_launch_npreview_061516&utm_source=anddev&utm_medium=blog">Android Support Library 26.0.2, available now from href="https://developer.android.com/studio/build/dependencies.html#google-maven">Google's Maven repository, and to the latest SDK, tools, and emulator system images, available in the SDK Manager.

If you're just getting started building for Android Oreo, read the href="https://developer.android.com/about/versions/o/migration.html#bfa">migration guide first. It gives you an overview of the process and the configuration changes you'll need to make.

To compile against the official Android 8.0 APIs, update your project's compileSdkVersion to API 26. We also recommend updating your app's targetSdkVersion to API 26 to opt-in and test your app with Android Oreo specific href="https://developer.android.com/about/versions/o/behavior-changes.html?utm_campaign=android_launch_npreview_061516&utm_source=anddev&utm_medium=blog">behavior changes. See the href="https://developer.android.com/about/versions/o/migration.html#bfa">migration guide for details on how to set up your environment to build with Android Oreo.

Publish your updates to Google Play

Google Play is open for apps compiled against or targeting API 26. When you're ready, you can publish your APK updates in your alpha, beta, or production channels.

Make sure that your updated app runs well on Android Oreo as well as older versions. We recommend using href="https://developer.android.com/distribute/engage/beta.html?utm_campaign=android_launch_npreview_061516&utm_source=anddev&utm_medium=blog">Google Play's beta testing feature to get early feedback from a small group of users, then do a staged rollout. We're looking forward to seeing your app updates!

What's next for Android Oreo?

We'll soon be closing the Developer Preview issue tracker, but please keep the feedback coming! You can href="https://issuetracker.google.com/issues/new?component=190923&template=841312">file a new issue against Android 8.0 in the AOSP issue tracker.

Thanks again to the many developers and early adopters who participated in the Android O Developer Preview and public beta. You gave us great feedback, and filed hundreds of issues that helped us to make the Android Oreo platform great for consumers and developers.

Read more
loading...