@@ -992,8 +992,6 @@ int setModeInt(int mode, IBinder cb, int pid) {
992992 if (mode != mMode ) {
993993 status = AudioSystem .setPhoneState (mode );
994994 if (status == AudioSystem .AUDIO_STATUS_OK ) {
995- // automatically handle audio focus for mode changes
996- handleFocusForCalls (mMode , mode , cb );
997995 mMode = mode ;
998996 } else {
999997 if (hdlr != null ) {
@@ -1024,40 +1022,6 @@ int setModeInt(int mode, IBinder cb, int pid) {
10241022 return newModeOwnerPid ;
10251023 }
10261024
1027- /** pre-condition: oldMode != newMode */
1028- private void handleFocusForCalls (int oldMode , int newMode , IBinder cb ) {
1029- // if ringing
1030- if (newMode == AudioSystem .MODE_RINGTONE ) {
1031- // if not ringing silently
1032- int ringVolume = AudioService .this .getStreamVolume (AudioManager .STREAM_RING );
1033- if (ringVolume > 0 ) {
1034- // request audio focus for the communication focus entry
1035- requestAudioFocus (AudioManager .STREAM_RING ,
1036- AudioManager .AUDIOFOCUS_GAIN_TRANSIENT , cb ,
1037- null /* IAudioFocusDispatcher allowed to be null only for this clientId */ ,
1038- IN_VOICE_COMM_FOCUS_ID /*clientId*/ ,
1039- "system" );
1040-
1041- }
1042- }
1043- // if entering call
1044- else if ((newMode == AudioSystem .MODE_IN_CALL )
1045- || (newMode == AudioSystem .MODE_IN_COMMUNICATION )) {
1046- // request audio focus for the communication focus entry
1047- // (it's ok if focus was already requested during ringing)
1048- requestAudioFocus (AudioManager .STREAM_RING ,
1049- AudioManager .AUDIOFOCUS_GAIN_TRANSIENT , cb ,
1050- null /* IAudioFocusDispatcher allowed to be null only for this clientId */ ,
1051- IN_VOICE_COMM_FOCUS_ID /*clientId*/ ,
1052- "system" );
1053- }
1054- // if exiting call
1055- else if (newMode == AudioSystem .MODE_NORMAL ) {
1056- // abandon audio focus for communication focus entry
1057- abandonAudioFocus (null , IN_VOICE_COMM_FOCUS_ID );
1058- }
1059- }
1060-
10611025 /** @see AudioManager#getMode() */
10621026 public int getMode () {
10631027 return mMode ;
@@ -2896,9 +2860,10 @@ public void onReceive(Context context, Intent intent) {
28962860 //==========================================================================================
28972861
28982862 /* constant to identify focus stack entry that is used to hold the focus while the phone
2899- * is ringing or during a call
2863+ * is ringing or during a call. Used by com.android.internal.telephony.CallManager when
2864+ * entering and exiting calls.
29002865 */
2901- private final static String IN_VOICE_COMM_FOCUS_ID = "AudioFocus_For_Phone_Ring_And_Calls" ;
2866+ public final static String IN_VOICE_COMM_FOCUS_ID = "AudioFocus_For_Phone_Ring_And_Calls" ;
29022867
29032868 private final static Object mAudioFocusLock = new Object ();
29042869
0 commit comments