Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 65837ced authored by Eric Laurent's avatar Eric Laurent Committed by Android (Google) Code Review
Browse files

Merge "Fix issue 5355047: Automated effect tests fail."

parents 651e4667 5e7acae2
Loading
Loading
Loading
Loading
+10 −5
Original line number Diff line number Diff line
@@ -46,6 +46,10 @@ public class MediaBassBoostTest extends ActivityInstrumentationTestCase2<MediaFr
    private final static int MIN_ENERGY_RATIO_2 = 3;
    private final static short TEST_STRENGTH = 500;
    private final static int TEST_VOLUME = 4;
    // Implementor UUID for volume controller effect defined in
    // frameworks/base/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp
    private final static UUID VOLUME_EFFECT_UUID =
        UUID.fromString("119341a0-8469-11df-81f9-0002a5d5c51b");

    private BassBoost mBassBoost = null;
    private int mSession = -1;
@@ -202,13 +206,14 @@ public class MediaBassBoostTest extends ActivityInstrumentationTestCase2<MediaFr
            // audio after the effects and not before
            vc = new AudioEffect(
                                AudioEffect.EFFECT_TYPE_NULL,
                    UUID.fromString("119341a0-8469-11df-81f9-0002a5d5c51b"),
                                VOLUME_EFFECT_UUID,
                                0,
                                0);
            vc.setEnabled(true);

            mp = new MediaPlayer();
            mp.setDataSource(MediaNames.SINE_200_1000);
            mp.setLooping(true);
            mp.setAudioStreamType(AudioManager.STREAM_MUSIC);
            getBassBoost(mp.getAudioSessionId());
            mp.prepare();
@@ -219,7 +224,7 @@ public class MediaBassBoostTest extends ActivityInstrumentationTestCase2<MediaFr
            int refEnergy1000 = probe.capture(1000);
            mBassBoost.setStrength((short)1000);
            mBassBoost.setEnabled(true);
            Thread.sleep(500);
            Thread.sleep(4000);
            // measure energy around 1kHz with band level at min
            int energy200 = probe.capture(200);
            int energy1000 = probe.capture(1000);
+17 −9
Original line number Diff line number Diff line
@@ -49,6 +49,14 @@ public class MediaEnvReverbTest extends ActivityInstrumentationTestCase2<MediaFr
    private final static float DELAY_TOLERANCE = 1.05f;
    // allow +/- 5% tolerance between set and get ratios
    private final static float RATIO_TOLERANCE = 1.05f;
    // Implementor UUID for volume controller effect defined in
    // frameworks/base/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp
    private final static UUID VOLUME_EFFECT_UUID =
        UUID.fromString("119341a0-8469-11df-81f9-0002a5d5c51b");
    // Implementor UUID for environmental reverb effect defined in
    // frameworks/base/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp
    private final static UUID ENV_REVERB_EFFECT_UUID =
        UUID.fromString("c7a511a0-a3bb-11df-860e-0002a5d5c51b");

    private EnvironmentalReverb mReverb = null;
    private int mSession = -1;
@@ -355,7 +363,7 @@ public class MediaEnvReverbTest extends ActivityInstrumentationTestCase2<MediaFr
            // audio after the effects and not before
            vc = new AudioEffect(
                                AudioEffect.EFFECT_TYPE_NULL,
                    UUID.fromString("119341a0-8469-11df-81f9-0002a5d5c51b"),
                                VOLUME_EFFECT_UUID,
                                0,
                                0);
            vc.setEnabled(true);
@@ -425,7 +433,7 @@ public class MediaEnvReverbTest extends ActivityInstrumentationTestCase2<MediaFr
            // audio after the effects and not before
            vc = new AudioEffect(
                                AudioEffect.EFFECT_TYPE_NULL,
                    UUID.fromString("119341a0-8469-11df-81f9-0002a5d5c51b"),
                                VOLUME_EFFECT_UUID,
                                0,
                                0);
            vc.setEnabled(true);
@@ -438,7 +446,7 @@ public class MediaEnvReverbTest extends ActivityInstrumentationTestCase2<MediaFr
            // auxiliary reverb will be chosen by the effect framework as we are on session 0
            rvb = new AudioEffect(
                        AudioEffect.EFFECT_TYPE_NULL,
                        UUID.fromString("c7a511a0-a3bb-11df-860e-0002a5d5c51b"),
                        ENV_REVERB_EFFECT_UUID,
                        0,
                        0);

+9 −4
Original line number Diff line number Diff line
@@ -49,6 +49,11 @@ public class MediaEqualizerTest extends ActivityInstrumentationTestCase2<MediaFr
    private final static int TEST_FREQUENCY_MILLIHERTZ = 1000000;
    private final static int MIN_NUMBER_OF_PRESETS = 4;
    private final static int TEST_VOLUME = 4;
    // Implementor UUID for volume controller effect defined in
    // frameworks/base/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp
    private final static UUID VOLUME_EFFECT_UUID =
        UUID.fromString("119341a0-8469-11df-81f9-0002a5d5c51b");

    private Equalizer mEqualizer = null;
    private int mSession = -1;

@@ -268,7 +273,7 @@ public class MediaEqualizerTest extends ActivityInstrumentationTestCase2<MediaFr
            // audio after the effects and not before
            vc = new AudioEffect(
                                AudioEffect.EFFECT_TYPE_NULL,
                    UUID.fromString("119341a0-8469-11df-81f9-0002a5d5c51b"),
                                VOLUME_EFFECT_UUID,
                                0,
                                0);
            vc.setEnabled(true);
+17 −13
Original line number Diff line number Diff line
@@ -43,6 +43,14 @@ import java.util.UUID;
 */
public class MediaPresetReverbTest extends ActivityInstrumentationTestCase2<MediaFrameworkTest> {
    private String TAG = "MediaPresetReverbTest";
    // Implementor UUID for volume controller effect defined in
    // frameworks/base/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp
    private final static UUID VOLUME_EFFECT_UUID =
        UUID.fromString("119341a0-8469-11df-81f9-0002a5d5c51b");
    // Implementor UUID for preset reverb effect defined in
    // frameworks/base/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp
    private final static UUID PRESET_REVERB_EFFECT_UUID =
        UUID.fromString("172cdf00-a3bc-11df-a72f-0002a5d5c51b");

    private PresetReverb mReverb = null;
    private int mSession = -1;
@@ -200,7 +208,7 @@ public class MediaPresetReverbTest extends ActivityInstrumentationTestCase2<Medi
            // audio after the effects and not before
            vc = new AudioEffect(
                                AudioEffect.EFFECT_TYPE_NULL,
                    UUID.fromString("119341a0-8469-11df-81f9-0002a5d5c51b"),
                                VOLUME_EFFECT_UUID,
                                0,
                                0);
            vc.setEnabled(true);
@@ -268,7 +276,7 @@ public class MediaPresetReverbTest extends ActivityInstrumentationTestCase2<Medi
            // audio after the effects and not before
            vc = new AudioEffect(
                                AudioEffect.EFFECT_TYPE_NULL,
                    UUID.fromString("119341a0-8469-11df-81f9-0002a5d5c51b"),
                                VOLUME_EFFECT_UUID,
                                0,
                                0);
            vc.setEnabled(true);
@@ -276,15 +284,12 @@ public class MediaPresetReverbTest extends ActivityInstrumentationTestCase2<Medi
            mp = new MediaPlayer();
            mp.setDataSource(MediaNames.SINE_200_1000);
            mp.setAudioStreamType(AudioManager.STREAM_MUSIC);
            getReverb(mp.getAudioSessionId());
            mReverb.setPreset((short)PresetReverb.PRESET_PLATE);
            mReverb.setEnabled(true);

            // create reverb with UUID instead of PresetReverb constructor otherwise an auxiliary
            // reverb will be chosen by the effect framework as we are on session 0
            rvb = new AudioEffect(
                        AudioEffect.EFFECT_TYPE_NULL,
                        UUID.fromString("172cdf00-a3bc-11df-a72f-0002a5d5c51b"),
                        PRESET_REVERB_EFFECT_UUID,
                        0,
                        0);

@@ -317,7 +322,6 @@ public class MediaPresetReverbTest extends ActivityInstrumentationTestCase2<Medi
            loge(msg, "sleep() interrupted");
        }
        finally {
            releaseReverb();
            if (mp != null) {
                mp.release();
            }
+12 −7
Original line number Diff line number Diff line
@@ -43,9 +43,13 @@ import java.util.UUID;
 */
public class MediaVirtualizerTest extends ActivityInstrumentationTestCase2<MediaFrameworkTest> {
    private String TAG = "MediaVirtualizerTest";
    private final static int MIN_ENERGY_RATIO_2 = 3;
    private final static int MIN_ENERGY_RATIO_2 = 2;
    private final static short TEST_STRENGTH = 500;
    private final static int TEST_VOLUME = 4;
    // Implementor UUID for volume controller effect defined in
    // frameworks/base/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp
    private final static UUID VOLUME_EFFECT_UUID =
        UUID.fromString("119341a0-8469-11df-81f9-0002a5d5c51b");

    private Virtualizer mVirtualizer = null;
    private int mSession = -1;
@@ -203,13 +207,14 @@ public class MediaVirtualizerTest extends ActivityInstrumentationTestCase2<Media
            // audio after the effects and not before
            vc = new AudioEffect(
                                AudioEffect.EFFECT_TYPE_NULL,
                    UUID.fromString("119341a0-8469-11df-81f9-0002a5d5c51b"),
                                VOLUME_EFFECT_UUID,
                                0,
                                0);
            vc.setEnabled(true);

            mp = new MediaPlayer();
            mp.setDataSource(MediaNames.SINE_200_1000);
            mp.setLooping(true);
            mp.setAudioStreamType(AudioManager.STREAM_MUSIC);
            getVirtualizer(mp.getAudioSessionId());
            mp.prepare();
@@ -220,7 +225,7 @@ public class MediaVirtualizerTest extends ActivityInstrumentationTestCase2<Media
            int refEnergy1000 = probe.capture(1000);
            mVirtualizer.setStrength((short)1000);
            mVirtualizer.setEnabled(true);
            Thread.sleep(500);
            Thread.sleep(4000);
            // measure energy around 1kHz with band level at min
            int energy200 = probe.capture(200);
            int energy1000 = probe.capture(1000);
@@ -230,7 +235,7 @@ public class MediaVirtualizerTest extends ActivityInstrumentationTestCase2<Media
            // audio file but is not the primary effect of the virtualizer. A better way would
            // be to have a stereo PCM capture and check that a strongly paned input is centered
            // when output. However, we cannot capture stereo with the visualizer.
            assertTrue(msg + ": virtiualizer has no effect",
            assertTrue(msg + ": virtualizer has no effect",
                    ((float)energy200/(float)energy1000) >
                    (MIN_ENERGY_RATIO_2 * ((float)refEnergy200/(float)refEnergy1000)));
            result = true;
Loading