Android 11 new features

官网列的比较详细和全面,我这里就大白话简述下我了解的Android 11的部分新特性

wireless debugging

Supports wireless deployment and debugging of applications from a workstation via the Android Debug Bridge (adb). Simply put, there is no need to connect the device via USB, avoiding common USB connection problems. For developers, isn’t it a surprise~~, haha, because in normal development, especially when developing with windows, you often encounter the problem that the USB cannot be connected to the device.
It is recommended to upgrade the sdk to the latest version. The latest sdk version I know is 31.0.2 (April 2021) officially released, which adds preliminary support for wireless pairing. In June another improvement was made to the adb wireless connection.
insert image description here

ADB incremental APK install

For large apks, such as apks with a size above 2G, the installation may take a long time. ADB (Android Debug Bridge) Incremental APK Install can speed up the process by installing enough APKs to launch the app while streaming the remaining data in the background. adb install will automatically use this feature if the device supports it and you have the latest SDK platform-tools installed. If not supported, the system will automatically use the default installation method.
Run the following adb command to use this feature. If the device does not support incremental installs, the command will fail with a verbose explanation.

 adb install --incremental

 在运行 ADB 增量 APK 安装之前,您必须先为 APK 签名并创建一个 APK 签名方案 v4 文件。必须将 v4 签名文件放在 APK 旁边,才能使此功能正常运行。

Starting with Android 11, custom message box views are deprecated. If your app targets Android 11, message boxes containing custom views are blocked when posted from the background Custom message boxes

Example: Custom Toast cannot pop up in the background (note the restrictions: background, custom).
If it is in the background, only the original Toast can pop up. If it is not in the background, a custom Toast can pop up. Toast.getView() Toast.setView() method is deprecated and now returns null

//The following is a custom Toast display text + picture Toast, has been tested

public static void showImageToas(Context context,String message){
    View toastview= LayoutInflater.from(context).inflate(R.layout.toast_image_layout,null);
    TextView text = (TextView) toastview.findViewById(R.id.tv_message);
    text.setText(message);    //要提示的文本
    Toast toast=new Toast(context);   //上下文
    toast.setGravity(Gravity.CENTER,0,0);   //位置居中
    toast.setDuration(Toast.LENGTH_SHORT);  //设置短暂提示
    toast.setView(toastview);   //把定义好的View布局设置到Toast里面
    toast.show();
}

media controls

Android 11 updates the way media controls are displayed. Media controls appear next to quick settings. Sessions from multiple apps are arranged in a swipeable carousel, including streams of sessions playing locally on the phone, remote session streams (such as sessions detected on external devices or cast sessions), and previous sessions that can continue to play sessions (in order of last played). Users can restart a previous session in the carousel without launching the app. Once playback has started, the user can interact with the media controls in the normal way.

For details, please refer to Media Control
Android 11 Carousel Display Multiple Apps
insert image description here

The display method before Android 11 is as follows
insert image description here

5G

Android 11 has added support for 5G networks, and added three functions of "according to traffic, 5G detection, and bandwidth estimation". Once it is determined that the network currently used by the user is not billed by traffic, this function can display content with higher resolution (such as 4k video), upload logs, backup files, and actively download content, etc. The potential of 5G is enormous, and this API ensures users take full advantage of available internet speeds.

The 5G detection function can detect whether the device is connected to a 5G network, and can also display whether it is connected to a 5G NR (independent) network or an NSA (non-independent) network.

Bandwidth Estimation will give an estimated bandwidth value, so that users can choose which video resolution to use independently. When it is necessary to use the network to upload data, select the appropriate data strategy by monitoring the network status,

IME integration (IME probably means input method)

Android 11 introduces new APIs to improve input method (IME) transitions, such as the on-screen keyboard. These APIs allow you to more easily adjust app content, keeping in sync with the appearance and disappearance of IMEs and other elements such as status and navigation bars.

To show the IME when any EditText is focused, call view.getInsetsController().show(Type.ime()) (you can call this method on any view in the same hierarchy as the focused EditText without specifically EditText). To hide the IME, call view.getInsetsController().hide(Type.ime()). You can check whether the IME is currently visible by calling view.getRootWindowInsets().isVisible(Type.ime()). You can also control the animation of the IME or other system bars such as the navigation bar.

Keyboards and other IMEs can now display autofill suggestions inline in a suggestion bar or similar interface, rather than displaying them in a drop-down menu. To protect sensitive information such as passwords and credit card numbers, suggestions are displayed to the user, but the IME is unaware of them until the user selects a suggestion.

Web browsers have brought us so many convenient ways of working that we may now take them for granted. Autofill is one example, and the information we have filled in forms that we have saved in browsers or even third-party applications can bring this. This convenience, especially on a phone where typing is such a chore, has become essential. Both iOS and Android have long had support for this automatic form-filling system, but for a long time, the Android version felt one step closer to being seamless. This is finally fixed in Android 11, you no longer have to hunt around for a credit card to choose the password or credit card information you want to fill in

 由之前在输入框下面列表提示,改成了填充到键盘里

pictures and cameras

Starting in Android 11, apps can use setCameraAudioRestriction() to turn off vibration only, both sound and vibration, or neither when the camera is actively in use.

When we used to record the screen, when a message came at this time, the ringtone of the message would be recorded. Android 11 can now turn off the vibration and sound, so that the screen recording will not be disturbed by the sound lock.

Better support for HEIF images containing multiple frames

HEIF picture is an efficient picture packaging format. At the moment you press the shutter, the video and audio of a few seconds before and after are automatically recorded, and stored in a picture in HEIF format, so that the picture is not just frozen in a certain moment.

Starting with Android 11, if you call ImageDecoder.decodeDrawable() and pass a HEIF image that contains a sequence of frames (such as an animation or a photo burst), the method returns an AnimatedImageDrawable that contains the entire sequence of images. In earlier versions of the Android system, this method returns a BitmapDrawable containing only a single frame.

If a HEIF image contains multiple frames that are not in a sequence, you can retrieve individual frames by calling MediaMetadataRetriever.getImageAtIndex().

App process exit reason

Before Android 11, it was difficult for us to understand the reason and status of the application exit. Now Android 11 introduces the method: ActivityManager.getHistoricalProcessExitReasons(),
which allows us to clearly understand the reason for the application exit.

Guess you like

Origin blog.csdn.net/u010207898/article/details/118358123