diff options
author | Geo Piskas <geopiskas@gmail.com> | 2012-12-31 14:04:31 +0200 |
---|---|---|
committer | Geo Piskas <geopiskas@gmail.com> | 2012-12-31 17:39:01 +0200 |
commit | 5fa827cc38511a4c673fcf08134a0dd2ab49cf6d (patch) | |
tree | f831a316dfd8f0ebd26b8a455984f8c9501f742d /src/java/com | |
parent | dac9376cc94f2a9b5261dbcaed63db4c29c221a3 (diff) | |
download | frameworks_opt_telephony-5fa827cc38511a4c673fcf08134a0dd2ab49cf6d.zip frameworks_opt_telephony-5fa827cc38511a4c673fcf08134a0dd2ab49cf6d.tar.gz frameworks_opt_telephony-5fa827cc38511a4c673fcf08134a0dd2ab49cf6d.tar.bz2 |
Fixed FC on calling unregisterReceiver with non registered receiver arg.
Crash Log: http://pastebin.com/r0qSGvbb
Patchset 1: Fixed a tab.
Patchset 2: Fixed spacing.
Change-Id: Idd3a7d28d62a980e5d8841535b0c9b57ea6e6a01
Diffstat (limited to 'src/java/com')
-rw-r--r-- | src/java/com/android/internal/telephony/CallManager.java | 38 |
1 files changed, 22 insertions, 16 deletions
diff --git a/src/java/com/android/internal/telephony/CallManager.java b/src/java/com/android/internal/telephony/CallManager.java index f292aee..4bba6ae 100644 --- a/src/java/com/android/internal/telephony/CallManager.java +++ b/src/java/com/android/internal/telephony/CallManager.java @@ -106,6 +106,8 @@ public final class CallManager { private boolean mSpeedUpAudioForMtCall = false; + private boolean mRingVolumeReceiverIsRegistered = false; + // state registrants protected final RegistrantList mPreciseCallStateRegistrants = new RegistrantList(); @@ -449,8 +451,12 @@ public final class CallManager { if (state == PhoneConstants.State.RINGING && lastAudioMode != AudioManager.MODE_RINGTONE) { context.registerReceiver(mRingVolumeChangeReceiver, new IntentFilter(AudioManager.VOLUME_CHANGED_ACTION)); + mRingVolumeReceiverIsRegistered = true; } else if (state != PhoneConstants.State.RINGING && lastAudioMode == AudioManager.MODE_RINGTONE) { - context.unregisterReceiver(mRingVolumeChangeReceiver); + if (mRingVolumeReceiverIsRegistered) { + context.unregisterReceiver(mRingVolumeChangeReceiver); + mRingVolumeReceiverIsRegistered = false; + } } } @@ -461,9 +467,9 @@ public final class CallManager { // make user aware of an incoming call by // attenuating the music he may be listening to ? AudioManager.AUDIOFOCUS_GAIN_TRANSIENT_MAY_DUCK - // if we're going to play the ring tone, silence - // other sound sources - : AudioManager.AUDIOFOCUS_GAIN_TRANSIENT; + // if we're going to play the ring tone, silence + // other sound sources + : AudioManager.AUDIOFOCUS_GAIN_TRANSIENT; if (VDBG) Log.d(LOG_TAG, "requestAudioFocus on STREAM_RING"); audioManager.requestAudioFocusForCall(AudioManager.STREAM_RING, hint); @@ -600,7 +606,7 @@ public final class CallManager { int currMode = audioManager.getMode(); if ((currMode != AudioManager.MODE_IN_CALL) && !(ringingPhone instanceof SipPhone)) { Log.d(LOG_TAG, "setAudioMode Setting audio mode from " + - currMode + " to " + AudioManager.MODE_IN_CALL); + currMode + " to " + AudioManager.MODE_IN_CALL); audioManager.setMode(AudioManager.MODE_IN_CALL); mSpeedUpAudioForMtCall = true; } @@ -712,7 +718,7 @@ public final class CallManager { if (foregroundPhone == backgroundPhone) { getActiveFgCall().hangup(); } else { - // the call to be hangup and resumed belongs to different phones + // the call to be hangup and resumed belongs to different phones getActiveFgCall().hangup(); switchHoldingAndActive(heldCall); } @@ -875,16 +881,16 @@ public final class CallManager { && !hasRingingCall && !allLinesTaken && ((fgCallState == Call.State.ACTIVE) - || (fgCallState == Call.State.IDLE) - || (fgCallState == Call.State.DISCONNECTED))); + || (fgCallState == Call.State.IDLE) + || (fgCallState == Call.State.DISCONNECTED))); if (result == false) { Log.d(LOG_TAG, "canDial serviceState=" + serviceState - + " hasRingingCall=" + hasRingingCall - + " hasActiveCall=" + hasActiveCall - + " hasHoldingCall=" + hasHoldingCall - + " allLinesTaken=" + allLinesTaken - + " fgCallState=" + fgCallState); + + " hasRingingCall=" + hasRingingCall + + " hasActiveCall=" + hasActiveCall + + " hasHoldingCall=" + hasHoldingCall + + " allLinesTaken=" + allLinesTaken + + " fgCallState=" + fgCallState); } return result; } @@ -1641,7 +1647,7 @@ public final class CallManager { if (call == null) { call = (mDefaultPhone == null) ? null - : mDefaultPhone.getForegroundCall(); + : mDefaultPhone.getForegroundCall(); } return call; } @@ -1678,7 +1684,7 @@ public final class CallManager { if (call == null) { call = (mDefaultPhone == null) ? null - : mDefaultPhone.getBackgroundCall(); + : mDefaultPhone.getBackgroundCall(); } return call; } @@ -1701,7 +1707,7 @@ public final class CallManager { if (call == null) { call = (mDefaultPhone == null) ? null - : mDefaultPhone.getRingingCall(); + : mDefaultPhone.getRingingCall(); } return call; } |