android 25_现在在Android 25中

  • Post author:
  • Post category:其他


android 25

Welcome to Now in Android, your ongoing guide to what’s new and notable in the world of Android development.

欢迎使用Android Now,这是您持续不断的关于Android开发领域中的新事物和着名指南。

NiA25视频和播客形式

(

NiA25 in Video and Podcast Form

)

This

Now in Android

is also offered in video and podcast form. It’s the same content, but with less reading required. The article version (keep reading!) is still the place to come for links to all of the content that’s covered.


Android中的

This

Now

也以视频和播客形式提供。 内容相同,但所需的阅读量更少。 仍然可以使用文章版本(请继续阅读!)链接到所涵盖的所有内容。

视频

(

Video

)

播客

(

Podcast

)

Click on the link below, or just subscribe to the podcast in your favorite client app.

单击下面的链接,或只订阅您喜欢的客户端应用程序中的播客。

Android 11:就在这里!

(

Android 11: It’s Here!

)

Image for post

After months of preview and beta releases, we made it: Android 11 is officially launched, with the source code pushed to the

Android Open Source Project (AOSP)

.

经过数月的预览版和Beta版发布,我们做到了:正式启动Android 11,并将源代码推送到

Android Open Source Project(AOSP)

I’ve talked about the features in this release for developers and users already, but here are a few teasers and reminders:

我已经为开发人员和用户讨论过此版本中的功能,但是这里有一些提示和提醒:


  • UI improvements

    , including Conversations in the notifications panel, Bubbles, and synchronized IME animations.


    界面改进

    ,包括“通知”面板中的“对话”,“气泡”和同步的IME动画。


  • Easy access to controls

    for connected devices and media.


    轻松访问所

    连接设备和媒体的

    控件


  • Privacy enhancements

    like one-time and auto-reset permissions, scoped storage improvements, background location, and biometric strength APIs (with additions to the new Jetpack biometrics library for earlier releases).


    隐私增强功能,

    例如一次性和自动重置权限,存储范围的改进,后台位置和生物识别强度API(为早期版本增加了新的Jetpack生物识别库)。


  • Developer enhancements

    like the new

    exit reasons API

    , behavior toggling in the Developer Options panel, ADB incremental installation, and more Kotlin nullability annotations for platform APIs.


    开发人员的增强功能

    包括新的

    退出原因API

    ,“开发人员选项”面板中的行为切换,ADB增量安装以及针对平台API的更多Kotlin可空性注释。

We’ve also made more strides in the Google Play system updates (originally called “mainline” for anyone like me that’s confused by naming changes), to provide support for more modules so that we can enable more frequent updates for core system functionality across the ecosystem.

我们还在Google Play系统更新(对于像我这样因命名更改感到困惑的任何人最初称为“主线”)更新方面取得了更大的进步,以提供对更多模块的支持,以便我们可以对整个系统的核心系统功能进行更频繁的更新生态系统。

If you want a longer list of the features to look forward to in this release, check out

Stephanie Saad Cuthbertson

’s

blog on developer features

as well as Dave Burke’s

article on user features

for the release.

如果您希望本发行版中包含更多功能,请查看

Stephanie Saad Cuthbertson



开发人员功能博客

以及Dave Burke的发行版

用户功能文章

Jetpack数据存储

(

Jetpack DataStore

)


Jetpack DataStore

is a new library available we offer as an alternative to (and improvement upon) Shared Preferences. This new library, which uses Kotlin coroutines and Flow for easier asynchronous reads and writes, is the way forward. It’s only in alpha right now, but check it out to see how to migrate to it eventually.


Jetpack DataStore

是我们提供的新库,可作为共享首选项的替代(并改进)。 这个新的库使用了Kotlin协程和Flow来简化异步读写,是前进的道路。 目前仅处于alpha版本,但请查看它以了解最终如何迁移到该版本。

There are two different APIs/approaches in DataStore. Preferences DataStore, which essentially takes the place of SharedPreferences completely, uses key-value pairs to store simple data, just like SharedPreferences. But Preferences DataStore is more powerful and robust than SharedPreferences, since it automatically handles proper asynchronous reads and writes (instead of SharedPreferences’ approach of synchronous writes… which you then have to figure out how to get off of the UI thread to accomplish).

DataStore中有两种不同的API /方法。 Preferences DataStore本质上完全取代了SharedPreferences,它使用键值对存储简单数据,就像SharedPreferences一样。 但是Preferences DataStore比SharedPreferences更强大和健壮,因为它可以自动处理正确的异步读取和写入(而不是SharedPreferences的同步写入方法,然后您必须弄清楚如何摆脱UI线程来完成)。

The second API is Proto DataStore, which allows you to create a schema for richer, type-safe object data storage, backed by protobufs.

第二个API是Proto DataStore,它允许您创建由protobuf支持的用于更丰富,类型安全的对象数据存储的架构。

Start by checking out the

DataStore article

below. Then try out the

Preferences codelab

and

Proto codelab

to jump-start your learning, and download the

library

.

首先查看下面的数据存储

文章

。 然后尝试使用

Preferences代码实验室



Proto代码实验室

以快速开始学习,并下载



文章和视频

(

Articles & Videos

)

适应最新的Android隐私更改

(

Adapting to Recent Android Privacy Changes

)


Fred Chung

wrote

an article

to help developers understand and adapt to recent privacy changes. Each release brings a handful of changes in this area as we continue to provide better control and transparency for user data access, and Android 11 is no exception. While many of these changes are gated behind a targetSdk flag, you will want to understand and eventually migrate your code, so you might want to read this article to see what to do.


Fred Chung

撰写

了一篇文章,

以帮助开发人员了解和适应最近的隐私更改。 随着我们继续为用户数据访问提供更好的控制和透明度,每个版本都带来了一些方面的变化,Android 11也不例外。 尽管其中许多更改是在targetSdk标志后进行的,但是您将希望了解并最终迁移您的代码,因此您可能需要阅读本文以了解如何做。

In particular, the article talks about:

特别是,本文讨论了:


  • Package access

    : Android 11 limits the visibility of packages on the device. That is, apps can no longer access information about other arbitrary apps on a user’s device. The article discusses the way this now works and also links to an

    implementation guide

    .


    程序包访问

    :Android 11限制了设备上程序包的可见性。 也就是说,应用程序无法再访问有关用户设备上其他任意应用程序的信息。 本文讨论了现在的工作方式,并链接到了

    实施指南


  • Incremental location permissions

    : Android 11 requires location access in foreground+background to be requested incrementally (first foreground, then background, which sends the user to Settings to grant the background location permission).


    增量位置权限

    :Android 11要求以递增方式请求对前台+后台的位置访问(首先是前台,然后是后台,这会将用户发送到“设置”以授予后台位置权限)。


  • Foreground services

    for location, microphone, and camera access.

    位置,麦克风和摄像头访问的

    前台服务


  • Non-resettable IDs

    : This change has evolved over several releases as we weaned developers off of non-resettable device identifiers. In Android 11, calls to getIccId() no longer return useful information, so you should find other means to get the information you need (hint: use resettable identifiers instead). For starters, read the guide we offer on

    Best practices for unique identifiers

    .


    不可重置的ID

    :随着我们使开发人员脱离不可重置的设备标识符,此更改已在多个版本中进行了演变。 在Android 11中,对getIccId()的调用不再返回有用的信息,因此您应该找到其他方式来获取所需的信息(提示:改为使用可重置的标识符)。 首先,请阅读我们提供的有关

    唯一标识符的最佳做法

    的指南。

Android GPU检查器

(

Android GPU inspector

)

Earlier this year, we announced a new profiling tool that you could use to help tune 3D graphics performance. However, it was only available in early preview form as we continued working on it.

今年早些时候,我们宣布了一个新的配置文件工具,您可以使用它来调整3D图形性能。 但是,随着我们继续进行研究,它仅以早期预览形式提供。

Fast forward to… now, and Android GPU Inspector is available in “open beta” form, for everyone to use. (Read: It’s still

beta

, and the team is still working on it, but we’re now ready for more people to bang on it, try it out, and

send us feedback

.)

快进到……现在,Android GPU Inspector以“公开beta”形式提供,供所有人使用。 (阅读:它仍然是

beta版

,并且团队仍在研究它,但是我们现在已经准备好让更多的人喜欢它,尝试一下并向

我们发送反馈

。)

This tool is similar to other profiling tools we offer like Android Studio’s CPU profiler and the standalone

systrace/perfetto tools

, but it contains low-level info specific to GPUs that can help developers (especially those writing games and other performance-sensitive graphics apps) tune their 3D performance.

该工具类似于我们提供的其他性能分析工具,例如Android Studio的CPU分析器和独立的

systrace / perfetto工具

,但它包含特定于GPU的低级信息,可以帮助开发人员(尤其是那些编写游戏和其他对性能敏感的图形应用程序的开发人员)调整其3D性能。

Android GPU Inspector depends on cooperation with device drivers, so

device support

is currently limited to Pixel 4 and Pixel 4 XL, but look for AGI to support more devices in the future.

Android GPU Inspector依赖与设备驱动程序的合作,因此

设备支持

目前仅限于Pixel 4和Pixel 4 XL,但希望AGI在将来支持更多设备。

You can download the tool

here

and learn more with the article and video below.

您可以在

此处

下载该工具



并通过以下文章和视频了解更多信息。

播客情节

(

Podcast Episodes

)

ADB 148:[约束|运动] [布局|编辑器]

(

ADB 148: [Constraint|Motion][Layout|Editor]

)

Image for post


Sean McQuillan

and I talked with

Nicolas Roard

and

John Hoford

about MotionEditor, which

went stable recently

in Android Studio 4.0. But as long as we were talking about that tool, we also talked extensively about MotionLayout in general as well as ConstraintLayout and other design tools.

我和

Sean


McQuillan



Nicolas Roard



John Hoford

讨论了MotionEditor,MotionEditor

最近

在Android Studio 4.0中

变得稳定了

。 但是,只要我们在谈论该工具,我们就还广泛地讨论了MotionLayout以及ConstraintLayout和其他设计工具。

与苹果聊天

(

Talking with Apples

)


Sean McQuillan

joined Peter-John Welcome on his podcast to talk about Jetpack Compose.


肖恩·麦奎伦(Sean McQuillan)

在播客中加入了Peter-John Welcome,谈论Jetpack Compose。

接着…

(

Now then…

)

That’s it for this time. So go

find out about Android 11

! Download the new

Jetpack DataStore

library! Learn about

adapting to the latest privacy changes

! Play with the

Android GPU Inspector

! Listen to the latest

ADB

and

Talking with Apples

podcasts! And come back here soon for the next update from the Android developer universe.

这次就是这样。 因此,请

查找有关Android 11的信息

! 下载新的

Jetpack DataStore

库! 了解有关

适应最新隐私更改的信息

! 玩

Android GPU检查器

! 收听最新的

亚行



与苹果聊天

播客! 并很快返回此处,以获取Android开发人员环境的下一个更新。

翻译自:

https://medium.com/androiddevelopers/now-in-android-25-8596a08554d7

android 25