Android 5.0 Behavioral Changes
Media playback
If you want to implement notifications that display media playback status or transport controls, consider using the new Notification.mediastyle template instead of customizing the Remoteviews.remoteview object. Regardless of which method you choose to use, be sure to set the visibility of the notification to visibility_public so that your control can be accessed through the lock screen. Note that starting with Android 5.0, the system no longer displays the Remotecontrolclient object on the lock screen.
Media Controls and Remotecontrolclient
The Remotecontrolclient class is now deprecated. Please switch to the new mediasession API as soon as possible.
The lock screen in Android 5.0 does not display transport controls for mediasession or Remotecontrolclient. However, your app can provide a media playback control from the lock screen via a notification. This allows your app to have more control over the display of media buttons, while providing a consistent experience for users who use locked devices and unlocked devices.
To achieve this, Android 5.0 introduces a new Notification.mediastyle template. Notification.mediastyle converts the notification action you added with Notification.Builder.addAction () to a thin button, embedded in the app's media playback notification. Pass your session token to the Setsession () method to tell the system that the notification controls the media session in progress.
Be sure to set the visibility of the notification to Visibility_public to mark the notification as safe and display it on any lock screen (in a safe way or otherwise).
To display the media playback controls when the app is running on an Android TV or Wear platform, implement the Mediasession class. If your app needs to receive Media button events on Android devices, you should also implement Mediasession
Screen capture and sharing
Android 5.0 introduces a new android.media.projection API that allows you to add screen capture and screen sharing to your app. For example, if you want to enable screen sharing in a video conferencing app, you can use this feature.
The new Createvirtualdisplay () method allows your app to capture the contents of the Home screen (the default display) into a Surface object, and your app can send it to the entire network. The API only allows the collection of non-secure screen content and does not allow the acquisition of system audio. To start capturing the screen, your app must first use the Intent Start Screen Capture dialog box obtained through the Createscreencaptureintent () method to request permission from the user.
Graphics
Support for OpenGL ES 3.1
Android 5.0 adds Java interfaces and native support for Opengles 3.1. The main new features available in OpenGL ES 3.1 include:
The Java interface for OpenGL ES 3.1 on Android is available with GLES31. When using OpenGL ES 3.1, be sure to declare it in the manifest file using the tag and android:glesversion attributes. For example:
<manifest> <uses-feature android:glEsVersion="0x00030001" /> ...</manifest>
Media
Camera API for Advanced camera functionality
Android 5.0 introduces a new ANDROID.HARDWARE.CAMERA2 API to simplify fine-grained photo capture and image processing. You can now use Getcameraidlist () to programmatically access camera devices that are available to the system, and to connect specific devices programmatically using Opencamera (). To begin capturing an image, create a cameracapturesession and specify the Surface object that is used to send the captured image. The cameracapturesession can be configured for single-shot or multiple continuous shooting.
To be notified when a new image is captured, implement the Cameracapturesession.capturecallback listener and set it up in your acquisition request. Now, when the system finishes the image acquisition request, your Cameracapturesession.capturecallback listener receives a call to Oncapturecompleted () and Captureresult To provide you with image acquisition metadata.
The Cameracharacteristics class allows your app to detect the camera features available on your device. The Info_supported_hardware_level property of the object represents the functional level of the camera.
所有设备都至少支持 INFO_SUPPORTED_HARDWARE_LEVEL_LEGACY 硬件级别,该级别具有的能力大致与弃用的 Camera API 相当。支持 INFO_SUPPORTED_HARDWARE_LEVEL_FULL 硬件级别的设备可手动控制采集和后期处理,以及以高帧速率采集高分辨率图像。
Audio playback
This release adds the following changes to Audiotrack:
Media playback Control
Use the new notifications and media APIs to ensure that your system UI understands your media playback and that you can extract and display album art. Now, you can take advantage of the new Mediasession classes and Mediacontroller classes to make it easier to control media playback throughout the UI and service scope.
The new Mediasession class replaces the deprecated Remotecontrolclient class and provides only a set of callback methods to handle transport controls and media buttons. If your app provides media playback and runs on an Android TV or Wear platform, use the Mediasession class to handle your transfer control with the same callback method.
Now you can use the new Mediacontroller class to develop your own media controller app. This class can monitor and control media playback in a thread-safe manner through your app's UI process. Specify a Mediasession.token object when you create the controller so that your app can interact with a given mediasession. You can use the Mediacontroller.transportcontrols method to control media playback on a session by sending commands such as play (), Stop (), Skiptonext (), and setrating (). For controllers, you can also register a Mediacontroller.callback object to listen for metadata and state changes on that session.
In addition, you can use the new Notification.mediastyle class to create rich notifications that allow playback control to bind to media sessions.
Media browsing
Android 5.0 introduces the ability to enable apps to explore other app media content libraries with the new Android.media.browse API. To expose media content within your app, expand the Mediabrowserservice class. The mediabrowserservice you implement should provide access to Mediasession.token so that the app can play media content that is delivered through your service.
To interact with the Media Browser service, use the MediaBrowser class. Specifies the component name for Mediasession when you create an MediaBrowser instance. Your app can then use the browser instance to connect to the associated service and get the Mediasession.token object to play the content exposed through the service.
Android 6.0 Changes
Audio Manager changes
Setting the volume directly through the Audiomanager class or muting a specific audio stream is no longer supported. The Setstreamsolo () method is deprecated and you should call the Requestaudiofocus () method instead. Similarly, the Setstreammute () method is deprecated, call the Adjuststreamvolume () method instead and pass in the direction value Adjust_mute or Adjust_unmute.
Audio features
This release enhances the audio processing features on Android, including:
通过新增的 android.media.midi API 提供了对 MIDI 协议的支持。使用这些 API 可发送和接收 MIDI 事件。新增了 AudioRecord.Builder 类和 AudioTrack.Builder 类,分别用于创建数字音频采集和回放对象,还可用于配置音频源和接收器属性来替换系统默认值。用于关联音频和输入设备的 API 钩子。如果您的应用允许用户通过与 Android TV 相连的游戏控制器或遥控器启动语音搜索,此功能尤为有用。系统会在用户启动搜索时调用新增的 onSearchRequested() 回调。要确定用户的输入设备是否内置麦克风,请从该回调检索 InputDevice 对象,然后调用新的 hasMicrophone() 方法。新增了 getDevices() 方法,让您可以检索系统当前连接的所有音频设备的列表。如果您想让系统在音频设备连接或断开时通知应用,还可以注册一个 AudioDeviceCallback 对象。
Video features
This release adds new features to the video processing API, including:
新增了 MediaSync 类,可帮助应用同步渲染音频流和视频流。音频缓冲区以非锁定方式提交,并通过回调返回。此外,它还支持动态回放速率。新增了 EVENT_SESSION_RECLAIMED 事件,它表示应用打开的会话已被资源管理器收回。如果您的应用使用 DRM 会话,则应处理此事件,并确保不使用收回的会话。新增了 ERROR_RECLAIMED 错误代码,它表示资源管理器收回了编解码器使用的媒体资源。出现此异常时,必须释放编解码器,因为它已转入终止状态。新增了 getMaxSupportedInstances() 接口,用于获取有关支持的编解码器实例最大并发数量的提示。新增了 setPlaybackParams() 方法,用于设置快动作回放或慢动作回放的媒体回放速率。此外,它还会随视频一起自动拉长或加速音频回放。
Camera Features
This release provides the following new APIs for accessing camera flash and camera image re-processing:
Flashlight API
If your camera device has a flash, you can turn the torch mode on or off without turning on the camera device by calling the Settorchmode () method. The app does not have exclusive ownership of the Flash or camera device. The torch mode is turned off and becomes unavailable whenever the camera device is unavailable, or if other camera resources for the torch are not available. Other applications can also call Settorchmode () to turn off the torch mode. The torch mode will be closed when the last application to turn on the torch mode is closed.
You can register a callback to receive notifications about the torch mode status by calling the Registertorchcallback () method. The first time a callback is registered, it is immediately called and returns the torch mode status of all camera devices currently known to be equipped with a flash. If the torch mode is turned on or off successfully, the system calls the Ontorchmodechanged () method.
Reprocessing API
Android 7.0 Behavioral changes
Opengl? ES 3.2 API
Android 7.0 adds a framework interface and platform support for OpenGL ES 3.2, including:
The framework API for OpenGL ES 3.2 on Android 7.0 is provided with the GLES32 class. When using OpenGL ES 3.2, be sure to declare the requirements in your manifest file through the tag and Android:glesversion properties.
Android 7.0 adds the ability to record and play content from the Android TV input service with the new recording API. Built on top of an existing time-lapse API, the TV input service can control how channel data can be recorded, save recorded sessions, and manage user interaction through recorded content.
VR Support
Android 7.0 adds a new VR-mode platform support and optimization to enable developers to create a high-quality mobile VR experience for their users. Some performance enhancements have been added, including allowing VR applications to access a dedicated CPU core. In your application, you can take advantage of intelligent head tracking and stereo notifications designed for VR. Most importantly, the graphics latency of Android 7.0 is very low
Digital Android5.0 to android7.x new features of multimedia technology