The Android P developer preview is released, and the new features that developers can't miss

Android P application adaptation new features

Private API

Android P prohibits applications from calling the classes, methods, and properties marked by the system hide through reflection. The private interface added to the blacklist will return null or an exception will occur when it is called by reflection.

From the current situation, the blacklist is empty, and all private interfaces are placed in the light gray list and dark gray list. The impact of this feature on the application depends on the API list in the blacklist, and the blacklist API list needs to be further tracked The change.

2 Hole-digging screen adaptation 

Apps can take advantage of the latest punch-hole screen devices to display content. Android P adds support for hole-digging screens and provides related API interfaces.

This feature manages the height of the status bar to separate the content from the crop area. If you have important immersive content, you can also use the new API to view cropped shapes and create full-screen layouts. Developers can call getDisplayCutout() to determine whether the local device has a cutout screen, and then determine the position and shape of the cutout area. Additionally, Android P adds a new window layout property layoutInDisplayCutoutMode that lets developers tell the system how and when to lay out content relative to the clipping area.

The Android P version adds developer options to simulate cropping screens on any device, simplifying the construction and testing process of hole-digging screen support on applications. Developers can perform application testing on the screen cropping function to ensure that the content is displayed correctly.

3FLP/WiFi/GeoFence 

Applications using Google Play Services' FLP and Geofence interfaces will be controlled for positioning in the background, and the frequency of location data reporting will be reduced to once every half an hour, which is consistent with the control strategy of the Android O version. It is mainly used for overseas navigation using Goolge's FLP and Geofence interfaces. Classes and sports and health apps have an impact.

4Multi -camera API 

Android P provides the ability to simultaneously access video streams through two or more physical cameras. Developers can implement innovative features on devices with dual front or dual rear cameras that are not possible with a single camera: such as seamless zoom, bokeh and stereoscopic vision. The API also allows calls to logical or mixed camera video streams that can automatically switch between two or more cameras.

Meanwhile, other improvements to the camera include new session parameters to effectively reduce latency during initial capture, and surface sharing technology that allows the camera client to handle a variety of use cases without restarting the video stream. Additionally, the P version adds display-based flash support and access to API and OIS timestamps for application-level image stabilization and special effects.

5Improving Calling Experience 

The Android P version has extended this feature to support concurrent calls of different APPs; Telecom can track active calls of all applications, but only one application has the call focus and supports free switching among all calls; in addition, applications can use OTT Call The call log is written in the system call log.

6 Call Handover Support

During the use of the Android P version, users can switch to other applications that support this feature when using the system to make calls. This feature can enhance the calling experience between the system and the application.

7  HEIF image format support

Android P adds support for HEIF image encoding, a widely used format that improves photo compression and reduces required storage space and network traffic. If the developer application is compatible with this data format and can be used for sharing or display, you can try to use the HEIF format for image storage. Additionally, developers can use HeifWriter in the alpha version of the new support library to write HEIF still images from word YUV section buffers, surfaces, and bitmaps.

8  Action&Slice key features

Android P adds two key features, Action and Slice.

Action is a direct service, which allows users to use some services provided by the application more quickly.

Slice is similar to a card and can implement an enhanced version of the desktop widget (semantic presentation templates, various input methods).

Application developers can develop unique Actions and Slices according to actual needs, and the system can collect the Actions and Slices of applications. When used in scenarios such as recommendation, search, voice assistant, and negative screen, users can use some services and cards provided by application developers more quickly.

9  Notification styles and notifications for quick replies

Android P will add a quick reply to messages (Remoteinput: setChoices) function in the notification, the appearance of this function will improve the message notification experience of instant messaging applications.

10 Crypto provider removal

Starting from Android P, the Crypto JCA provider function will be removed, and calling SecureRandom.getInstance("SHA1PRNG", "Crypto") will report a NoSuchProviderException error.

Apps that have not been adapted will crash and their functions cannot be used normally.

11 New front desk service permissions 

Android P increases the restriction on the permission of the application to call the foreground service. If the application wants to use the foreground service, it needs to apply for the FOREGROUND_SERVICE permission. This permission is a common permission. If you directly start the foreground service without applying for this permission, a SecurityException will appear.

This feature only affects apps that have been adapted to the Android P system.

12 Delete through the Build.serial get method 

When an application needs to verify the mobile phone serial number, the application must apply for the READ_PHONE_STATE permission. Android P allows the user to control whether the application is allowed to access the platform Build.serial identification code. The application can obtain it through the new Build.getSerial() interface of Android P Mobile phone serial number.

This feature only affects apps that have been adapted to the Android P system.

13 Shared WebView data directory cancel 

Android P no longer supports the ability for applications to share a single WebView data directory across processes, which means that if the application has multiple processes using WebView, CookieManager or other APIs in the android.webkit package, when a second process calls WebView method, the app will crash.

Apps that are not adapted will crash.

14LocalOnlyHotspot 

Android P adds application APIs to enable local collaborative content sharing among multiple devices. Applications can use this API to establish a local SoftAP (it cannot share internet access), and this function enables multiple applications to share the same LOHS.

By sharing the same LOHS, multiple devices can not only achieve cooperative play, but also play local games, which enhances the interactivity of the same application between multiple devices.

 

Please check the following link for details

> Android P Developer Preview:
https://developer.android.google.cn/preview/index.html

> Android Developers official documentation:
https://developer.android.google.cn

 

 Huawei Terminal Open Lab provides open services around P version compatibility

 Huawei Terminal Open Lab P version compatibility test has been launched

In order to promote the compatibility and adaptation of major mobile phone applications and reinforcement enterprises to the Android P version, Huawei's deveco platform has opened the P version's compatibility evaluation function in mid-March. Free testing and improvement suggestions for the adaptation of major applications to the P version.

 "Huawei Terminal Open Lab Community" is online

If you have any technical questions, please enter the Huawei Terminal Open Lab Forum to participate in the discussion

 Android P version compatibility theme event

The Huawei-Google P Lab external adaptation exchange meeting is initially scheduled to be held in Beijing in mid-April. A series of related online and offline activities and salons will be held around the Android P version in the future, so stay tuned~

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325289412&siteId=291194637