AudioPresentation: Fix bugs revealed by CTS tests

After adding CTS tests some bugs were found in the new methods for Q.

Bug: 63901775
Test: atest CtsMediaTestCases:AudioPresentationTest
Change-Id: Ia99cc819f1bb15a809b5735a1144c45e72f6b5c6
This commit is contained in:
Mikhail Naganov
2018-11-12 14:52:26 -08:00
parent 3235c5c489
commit 66883fb1a7

View File

@@ -18,7 +18,6 @@ package android.media;
import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.TestApi;
import android.icu.util.ULocale;
import java.lang.annotation.Retention;
@@ -172,6 +171,10 @@ public final class AudioPresentation {
return localeLabels;
}
private Map<ULocale, String> getULabels() {
return mLabels;
}
/**
* @return the locale corresponding to audio presentation's ISO 639-1/639-2 language code.
*/
@@ -231,17 +234,24 @@ public final class AudioPresentation {
AudioPresentation obj = (AudioPresentation) o;
return mPresentationId == obj.getPresentationId()
&& mProgramId == obj.getProgramId()
&& mLanguage == obj.getULocale()
&& mLanguage.equals(obj.getULocale())
&& mMasteringIndication == obj.getMasteringIndication()
&& mAudioDescriptionAvailable == obj.hasAudioDescription()
&& mSpokenSubtitlesAvailable == obj.hasSpokenSubtitles()
&& mDialogueEnhancementAvailable == obj.hasDialogueEnhancement()
&& mLabels.equals(obj.getLabels());
&& mLabels.equals(obj.getULabels());
}
@Override
public int hashCode() {
return Objects.hashCode(mPresentationId);
return Objects.hash(mPresentationId,
mProgramId,
mLanguage.hashCode(),
mMasteringIndication,
mAudioDescriptionAvailable,
mSpokenSubtitlesAvailable,
mDialogueEnhancementAvailable,
mLabels.hashCode());
}
/**