diff options
author | Dheeraj Shetty <dshetty@codeaurora.org> | 2016-04-13 20:55:54 -0700 |
---|---|---|
committer | Steve Kondik <steve@cyngn.com> | 2016-07-02 10:55:01 -0700 |
commit | e93e6b5ade17936021e5ef69f4bd82c44cb701b8 (patch) | |
tree | 7d6d4570fe206f025c8a3479fba2b37048a95f9e | |
parent | a8208a51278a86fe62a5187d4a93c3e59f49b521 (diff) | |
download | android_frameworks_opt_telephony-e93e6b5ade17936021e5ef69f4bd82c44cb701b8.tar.gz android_frameworks_opt_telephony-e93e6b5ade17936021e5ef69f4bd82c44cb701b8.tar.bz2 android_frameworks_opt_telephony-e93e6b5ade17936021e5ef69f4bd82c44cb701b8.zip |
Use EVS codec for HD if carrier supports it.
If the audio codec is EVS_WB, EVS_NWB or EVS_FB and the carrier
config to use HD for EVS codec is set to true, then set HD to true.
Change-Id: I5550e6c9660c0ccd25418a33c44ee2c71ddd47b9
CRs-fixed: 986961
-rw-r--r-- | src/java/com/android/internal/telephony/imsphone/ImsPhoneConnection.java | 43 |
1 files changed, 38 insertions, 5 deletions
diff --git a/src/java/com/android/internal/telephony/imsphone/ImsPhoneConnection.java b/src/java/com/android/internal/telephony/imsphone/ImsPhoneConnection.java index 090c93ce8..089cd5705 100644 --- a/src/java/com/android/internal/telephony/imsphone/ImsPhoneConnection.java +++ b/src/java/com/android/internal/telephony/imsphone/ImsPhoneConnection.java @@ -986,8 +986,10 @@ public class ImsPhoneConnection extends Connection { /** * Determines the {@link ImsPhoneConnection} audio quality based on the local and remote - * {@link ImsCallProfile}. If indicate a HQ audio call if the local stream profile - * indicates AMR_WB or EVRC_WB and there is no remote restrict cause. + * {@link ImsCallProfile}. Indicate a HD audio call if the local stream profile + * is AMR_WB, EVRC_WB, EVS_WB, EVS_SWB, EVS_FB (EVS codec is considered only if the + * operator supports HD on EVS) and + * there is no remote restrict cause. * * @param localCallProfile The local call profile. * @param remoteCallProfile The remote call profile. @@ -1000,15 +1002,47 @@ public class ImsPhoneConnection extends Connection { return AUDIO_QUALITY_STANDARD; } - boolean isHighDef = (localCallProfile.mMediaProfile.mAudioQuality + final boolean isEvsCodecHighDef = getBooleanCarrierConfig(mOwner.mPhone.getContext(), + CarrierConfigManager.KEY_IMS_SUPPORT_EVS_HD_ICON_BOOL) && + (localCallProfile.mMediaProfile.mAudioQuality + == ImsStreamMediaProfile.AUDIO_QUALITY_EVS_WB + || localCallProfile.mMediaProfile.mAudioQuality + == ImsStreamMediaProfile.AUDIO_QUALITY_EVS_SWB + || localCallProfile.mMediaProfile.mAudioQuality + == ImsStreamMediaProfile.AUDIO_QUALITY_EVS_FB); + + final boolean isHighDef = (localCallProfile.mMediaProfile.mAudioQuality == ImsStreamMediaProfile.AUDIO_QUALITY_AMR_WB || localCallProfile.mMediaProfile.mAudioQuality - == ImsStreamMediaProfile.AUDIO_QUALITY_EVRC_WB) + == ImsStreamMediaProfile.AUDIO_QUALITY_EVRC_WB + || isEvsCodecHighDef) && remoteCallProfile.mRestrictCause == ImsCallProfile.CALL_RESTRICT_CAUSE_NONE; return isHighDef ? AUDIO_QUALITY_HIGH_DEFINITION : AUDIO_QUALITY_STANDARD; } /** + * Get the boolean config from carrier config manager. + * + * @param context the context to get carrier service + * @param key config key defined in CarrierConfigManager + * @return boolean value of corresponding key. + */ + private boolean getBooleanCarrierConfig(Context context, String key) { + CarrierConfigManager configManager = (CarrierConfigManager) context.getSystemService( + Context.CARRIER_CONFIG_SERVICE); + PersistableBundle b = null; + if (configManager != null) { + b = configManager.getConfig(); + } + if (b != null) { + return b.getBoolean(key); + } else { + // Return static default defined in CarrierConfigManager. + return CarrierConfigManager.getDefaultConfig().getBoolean(key); + } + } + + /** * Provides a string representation of the {@link ImsPhoneConnection}. Primarily intended for * use in log statements. * @@ -1039,4 +1073,3 @@ public class ImsPhoneConnection extends Connection { return mIsEmergency; } } - |