zoukankan      html  css  js  c++  java
  • (转)音频管理器服务

    mAudioManager所在服务如下:
      文件: frameworks/base/media/java/android/media/AudioManager.java

    java代码:

    1. public static final int RINGER_MODE_SILENT = 0;
    2. public static final int RINGER_MODE_VIBRATE = 1;
    3. public static final int RINGER_MODE_NORMAL = 2;
    4. public void setRingerMode(int ringerMode) {
    5. IAudioService service = getService();
    6. try {
    7. service.setRingerMode(ringerMode);
    8. } catch (RemoteException e) {
    9. Log.e(TAG, "Dead object in setRingerMode", e);
    10. }
    11. }


            将铃响模式值传给音频接口服务IaudioService

    java代码:

    1. public static final int VIBRATE_TYPE_RINGER = 0;
    2. public static final int VIBRATE_TYPE_NOTIFICATION = 1;
    3. public static final int VIBRATE_SETTING_OFF = 0;
    4. public static final int VIBRATE_SETTING_ON = 1;
    5. public static final int VIBRATE_SETTING_ONLY_SILENT = 2;
    6. public void setVibrateSetting(int vibrateTyp , int vibrateSetting) {
    7. IAudioService service = getService();
    8. try {
    9. service.setVibrateSetting(vibrateType, vibrateSetting);
    10. } catch (RemoteException e) {
    11. Log.e(TAG, "Dead object in setVibrateSetting", e);
    12. }
    13. }


            将振动类型和振动设置传给音频接口服务IaudioService,IaudioService的定义如下:
            frameworks/base/media/java/android/media/IAudioService.aidl
            frameworks/base/media/java/android/media/AudioService.java
            文件: frameworks/base/media/java/android/media/AudioService.java
            文件: frameworks/base/core/java/android/provider/Settings.java

    java代码:

    1. public void setRingerMode(int ringerMode) {
    2. synchronized (mSettingsLock) {
    3. if (ringerMode != mRingerMode) {
    4. setRingerModeInt(ringerMode, true);
    5. // Send sticky broadcast
    6. broadcastRingerMode();
    7. }
    8. }
    9. }
  • 相关阅读:
    javascript前端如何使用google-protobuf
    【Linux】Linux中常用操作命令
    MyEclipse 安装svn 插件步骤详情
    MultipartFile(文件的上传)--CommonsMultipartResolver
    oracle sql 获取本季度所有月份,上季度所有月份
    git与github安装、配置
    Java使用JaxWsDynamicClientFactory和HttpURLConnection两种方式调取webservice的接口
    三级联动
    Excel的两种导出入门方法(JAVA与JS)
    页面设置遮罩层
  • 原文地址:https://www.cnblogs.com/xingmeng/p/2425239.html
Copyright © 2011-2022 走看看