Google I/O 2021 news

Share on facebook
Share on linkedin
Share on whatsapp

Introduction

Since 2008, Google has been sharing news and releases related to its systems and tools through a series of talks known as Google I/O. In May of this year, Google held the 2021 Google I/O, where they announced several changes to their tools and products, such as the “not-so-new” Wear OS; LaMDA, a conversational language model; Google Maps; Google Assistant; and Google Chrome, among others. In this article, we will talk about what’s new in the new Android Operating System version for mobile devices, Android 12.

 Widgets

Following the trend of providing robust widget support — launched at the 2020 Apple WWDC —, Google announced improvements to the existing API on Android. According to Google, 84% of users use at least one widget. Therefore, the goal of the updates is to support developers when creating widgets that enrich user experience (for more details, see the video of the Widgets session).

The main behavior changes in widgets are:

Source: https://developer.android.com/about/versions/12/features/widgets

 

  • It is now possible to create widgets that automatically adapt to a visual theme, which is configured by the user and applied throughout the device. Developers can take advantage of this support by using android:style/Theme.DeviceDefault.DayNight and the following color attributes:
    • android:attr/colorAccent
    • android:attr/colorBackground
    • android:attr/textColorPrimary
    • android:attr/textColorSecondary
  • The following UI components have been added: CheckBox, Switch, RadioButton.

Fonte: https://www.youtube.com/watch?v=cHv84zXZf6E&list=PLWz5rJ2EKKc8dQ8oYOANI4qto-0jj9CQ_&index=15

  • It is now possible to add a description to your widget, as well as a preview closer to the real widget. This will make users aware of the purpose and workings of the widget when it is presented in the widget picker. To set the preview and description, new attributes were made available android: previewLayout and android: description, which should be added to the <appwidget-provider>.

Fonte: https://www.youtube.com/watch?v=cHv84zXZf6E&list=PLWz5rJ2EKKc8dQ8oYOANI4qto-0jj9CQ_&index=15

  • It is now possible to define the dimensions and proportions of a widget based on the number of cells of the launcher grid. To configure dimensions per cell, use properties targetCellWidth and targetCellHeight.

 

Fonte: https://www.youtube.com/watch?v=cHv84zXZf6E&list=PLWz5rJ2EKKc8dQ8oYOANI4qto-0jj9CQ_&index=15

 

Toasts

In Android S, the behavior of the ever-present Toasts has changed. From now on, the icon of the app launched the Toast will appear next to Toast messages. Thus, users will be able to identify the app that sent the message.

Restrictions have also been added to the size a Toast message can have and the number of Toasts that can be launched by each app.

If your app needs to send a sizable message, the recommendation is to use a notification. Therefore, it is worth checking the size and frequency of messages sent and making the necessary adaptations.

 

Source: https://9to5google.com/2021/05/18/android-12-beta-1-clipboard-notifications-are-coming-and-toasts-now-show-their-source/

 

App Start (Splash Screen)

In order to improve the visual user experience when opening installed apps and decrease development effort in this regard, the Android System will start adding a splash screen when an application is launched. To build it, the system will use the app icon and the attribute value android: windowBackground.

 

Source: https://developer.android.com/about/versions/12/features/widgets

 

If it is deemed necessary to modify the look, behavior, lasting period or animations of this interface, developers should use the SplashScreenView API to perform customizations. The following XML attributes can also be added to the application themes:

  • android:windowSplashScreenBackground
  • android:windowSplashScrenAnimatedIcon
  • android:windowSplashScreenIconBackground
  • android:splashScreenAnimationDuration

For more details, be sure to check out the article.

 

Privacy & Security

As in almost all Google I/O editions, new restrictions to protect users’ location and connectivity data have been added.

Previously, to find other devices via Bluetooth, apps needed to have location permission, which allows apps to access data beyond what they need. This was one of the main complaints in negative app reviews, since users were faced with the request for permission to access the location of the device, but did not know it was related to Bluetooth use, which ended up raising suspicions (such as spying or data leakage).

Starting in Android 12, applications that need to scan and connect to other devices via bluetooth require a specific user permission. Google has created three new permissions for this:

  • BLUETOOTH_SCAN: Permission needed when an app needs to find other Bluetooth devices in its surroundings.
  • BLUETOOTH_ADVERTISE: Permission needed when an app makes the device available to be found by other Bluetooth devices.
  • BLUETOOTH_CONNECT: Permission needed when an app needs to communicate with connected devices via Bluetooth.

In addition to these new permissions, users will now be able to choose between allowing an app to access their exact or partial location.

Source: https://developer.android.com/about/versions/12/approximate-location

 

For applications that need internet connection information, starting with Android 12, it will no longer be possible to have access to users’ devices’ Mac Address. Thus, it is recommended that dynamic IDs be used for identification.

 

Foreground Services

To prevent applications from being able to interact with users directly, without them requesting or consenting to it, starting in Android 12, apps not currently in use will not be allowed to launch foreground services.

This measure aims to prevent device resources from being consumed in processing activity unrelated to users’ current activity and to protect users from possibly malicious programs.

The best alternative is to replace foreground services by using WorkManager. If it is necessary to perform the work immediately, developers will be able to classify it as Expedited. In this case, the system will prioritize the execution of this work as soon as possible.

Source: https://developer.android.com/about/versions/12/foreground-services

 

Google Play

Starting July 1, 2021, Google will reduce by half the service fee charged on profit received through services offered by its online store of apps, games, books, movies and TV shows. Currently, the rate is 30%. It will be reduced to 15%. The reduction will be applied on the first million dollars in revenue obtained through the services offered by the store.

Regarding the Google Play console, it was announced that it will display a detailed explanation section about the policies applied during approval, suspension or removal of apps from the store, as well as a new section where developers can check the status of requests to add new apps or update existing ones (for more details, see the Google Play session in Google I/O 2021).

Source: https://www.youtube.com/watch?v=tc57iyl06ww&list=PLWz5rJ2EKKc8dQ8oYOANI4qto-0jj9CQ_&index=3

From 1 August onwards, only App Bundles will be accepted for publication of new applications in the store, to the detriment of APKs (Andoid application PacKages). Google uses App Bundles to generate and distribute APKs from apps. These APKs are optimized for each user’s device, which is able to download only the source code and resources it needs to run the application. Thus, users find smaller and more optimized downloads.

This means that those who no longer publish their application in the App Bundle format will have to make adaptations to this new restriction.

 

Notifications

The notification template has been redesigned for Android 12. Its design, typography and even the edges have been modified. However, no modifications will be required to fit applications that use the standard visual model of Android notifications.

For applications that use custom layouts, the recommendation is for their use be removed, as support for custom layouts has been deprecated for Android 12. One of the alternatives presented is to use decorated custom templates, through which it is possible to customize the central content of the notification, as shown in the image below:

Source: https://www.youtube.com/watch?v=D2cU_itNDAI&list=PLWz5rJ2EKKc8dQ8oYOANI4qto-0jj9CQ_&index=2

 

In addition, the use of trampoline notifications has been fully blocked for Android 12. Trampoline notifications occur when an application starts a Service or a Broadcast Receiver after a user interacts with a notification.

The justification for this blocking is that trampoline notifications affect applications’ user experience, due to the extra processing time needed for them. Starting in Android 12, if an app continues to use trampoline notifications, it will not be notified about user interaction with the notification.

 

AVIF

During Google I/O ‘21, support for the AVIF image file format was announced for devices released or updated to Android 12. Using an AVIF file, you can get smaller images that have the same quality as the same image in JPEG. In addition, AVIF files accept HDR and lossless compression. The use of the new format is recommended as a way to reduce the size of apps.

 

Blur Effect and Overscroll Effect

To make life easier for developers when applying blur effect to an image or a visual component, from Android 12 onwards, there is an API that allows the effect to be requested via XML or programmatically, as can be seen below respectively:

Source:

https://www.youtube.com/watch?v=D2cU_itNDAI&list=PLWz5rJ2EKKc8dQ8oYOANI4qto-0jj9CQ_&index=2

 

Source:

https://www.youtube.com/watch?v=D2cU_itNDAI&list=PLWz5rJ2EKKc8dQ8oYOANI4qto-0jj9CQ_&index=2

In addition to this new API, Google introduced a new effect, called overscroll effect, in which visual elements stretch and return to normal in a drag event, and slide and return to normal in a fast-sliding event. Starting with Android 12, this effect will be applied automatically when users reach one of the vertical ends of the screen in the following components:

The effect may impact the current function of applications that use the components above and can be customized through a specific API called EdgeEffect. The use of the effect will only be done on the active component in question.

For applications that have more than one of these components on the same screen and control scroll behavior manually, the animation may be applied strangely. Therefore¸ it is recommended that developers evaluate a redesign of the current implementation, so that all components are rendered into a single component.


Source:https://developer.android.com/about/versions/12/overscroll

 

Android Testing & Performance

 

In Google/IO 2021, news for testing tools are Gradle Managed Virtual Device and Snapshot Emulator (for the full session, see the video on Android Test Tools).

 

Gradle Managed Virtual Devices

Gradle Managed Virtual Devices is a tool to facilitate creation of Instrumented Tests. It manages the entire lifecycle of the virtual device created to run the Instrumented Tests.

The new tool should facilitate integration of Instrumented Tests with Continuous Integration (CI) services, parallel test execution and execution of tests simulating several scenarios in the same test, by defining the group of devices to run the tests.

If you want to know more details about Gradle Managed Virtual Devices and how to use them in practice, be sure to check out Igor Escodro’s article on the subject.

 

Snapshot Emulator

Snapshot Emulator is a new feature that allows developers to collect information about the state of a device when an instrumented tests fails. The Snapshot Emulator, when enabled, captures the device’s screen at the time of failure and adds the snapshot next to the results of the tests performed.

The tool also saves information at the time of failure to allow developers to restore the state of the device at the exact moment of failure with just one click in Android Studio and use debugger to investigate the reason for the failure.

To enable Snapshot Emulator, simply configure the build.gradle as below.

 

Source: https://www.youtube.com/watch?v=juEkViDyzF8

 

 

Machine Learning

In Google I/O ‘21’s Machine Learning session, a version of the Tensor Flow Lite specific to Android was announced. This version will be available along with Google Play Services on all devices, eliminating the need for it to be imported by each app that needs to use it. The main advantage will be reduction in the size of applications, since they will no longer need to import Tensor Flow.

Currently, one of the difficulties to develop Android apps based on identifying patterns through Machine Learning is to balance performance, stability and accuracy for a diverse group of devices.

This is especially important for applications that need specific settings to ensure balance between these metrics — such as apps that use camera data to customize user view at runtime and need to enable GPU acceleration to ensure proper performance.

Thus, to ensure the quality of the service provided, it is necessary to perform tests on multiple devices and analyze the data collected from each device, in order to understand the behavior of the service in each of them.

However, from Tensor Flow 2.3 onwards, this should start to change. Starting in this release, an API will be available to allow developers to know, at runtime, if that device has adequate support for GPU acceleration.

 

Source: https://www.youtube.com/watch?v=uTCQ8rAdPGE&list=PLWz5rJ2EKKc8dQ8oYOANI4qto-0jj9CQ_&index=23

 

In addition, a new feature called Automatic Acceleration will also be made available. The goal of this new feature is to provide an automatic option to find out the best way to run the Machine Learning model provided by the developer. This way, the developer will not need to run tests on a large number of devices to figure out how to configure the behavior of their Machine Learning model and application.

 

Conclusion

Following the trend of previous years, this year’s Google I/O introduced several features to improve user experience in the Android ecosystem as a whole, protecting users from malicious attacks and offering the opportunity to customize devices in the best possible way.

Several tools have been presented to allow developers to build quality applications that interact harmoniously with the rest of the system, respecting customizations made by users.

 

In this article, we have made a summary of the main news presented by Google I/O 2021. To get to know each feature in more detail, watch Google I/O ’21 or see the coverage of New in Android.

 

Links

Vídeos do Google I/O:

What’s new in Android testing tools | Session

What’s new in Android | Keynote

What’s new in Google Play | Keynote

Refreshing widgets | Session

What’s new in Android Machine Learning | Session

Developer Keynote (Google I/O ’21) – American Sign Language

 

Documentação do Android:

https://developer.android.com/about/versions/12/features/widgets

https://developer.android.com/about/versions/12/features/splash-screen
Efeito de rolagem  |  Android 12 Beta  |  Android Developers

Artigos do Medium:

https://medium.com/android-dev-br/implementando-a-core-splashscreen-api-642c7f8c581b

https://proandroiddev.com/running-instrumented-tests-in-gradle-task-83bd483e6edd

Outras fontes:

https://petapixel.com/2021/02/20/android-12-will-support-avif-photos/

https://9to5google.com/2021/05/18/android-12-beta-1-clipboard-notifications-are-coming-and-toasts-now-show-their-source/

Veja mais
Android
Redação Venturus

Google I/O 2021 news

Introduction Since 2008, Google has been sharing news and releases related to its systems and tools through a series of talks known as Google I/O.
Leia mais »
Design
Pedro Barros

Darkmode and the benefits for the user experience

The screens of electronic devices have become part of our day-to-day lives — present from the moment we deactivate the alarm in our cellphone in the morning to when we send a good night text to a loved one.   We spend
Leia mais »