音频管理器服务

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. }

你可能感兴趣的:(管理)