/**
* The implementation of the volume manager service.
*
* This implementation focuses on delivering a responsive UI. Most methods are
* asynchronous to external calls. For example, the task of setting a volume
* will update our internal state, but in a separate thread will set the system
* volume and later persist to the database. Similarly, setting the ringer mode
* will update the state and broadcast a change and in a separate thread later
* persist the ringer mode.
*
* @hide
*/
frameworks/base/media/java/android/media/AudioService .java
public class AudioService extends IAudioService.Stub {
}
AudioService .java 提供了audio service 的服务实现, IAudioService.aidl 定义了服务的方法.
private static IAudioService sService;
/**
* @hide
*/
public AudioManager(Context context) {

本文介绍了Android中的AudioService实现,该服务通过IAudioService.Stub扩展,并在AudioManager中封装以获取和设置音量。AudioManager通过getService()获取AudioService实例,提供了设置音量等操作。示例代码展示了如何获取原始音量和调用服务设置音量。
最低0.47元/天 解锁文章
764

被折叠的 条评论
为什么被折叠?



