Search in sources :

Example 56 with LargeTest

use of android.test.suitebuilder.annotation.LargeTest in project android_frameworks_base by ParanoidAndroid.

the class MediaAudioEffectTest method test1_7AuxiliaryOnAudioTrack.

//Test case 1.7: test auxiliary effect attachement on AudioTrack
@LargeTest
public void test1_7AuxiliaryOnAudioTrack() throws Exception {
    boolean result = false;
    String msg = "test1_7AuxiliaryOnAudioTrack()";
    try {
        AudioTrack track = new AudioTrack(AudioManager.STREAM_MUSIC, 44100, AudioFormat.CHANNEL_OUT_MONO, AudioFormat.ENCODING_PCM_16BIT, AudioTrack.getMinBufferSize(44100, AudioFormat.CHANNEL_OUT_MONO, AudioFormat.ENCODING_PCM_16BIT), AudioTrack.MODE_STREAM);
        assertNotNull(msg + ": could not create AudioTrack", track);
        AudioEffect effect = new AudioEffect(AudioEffect.EFFECT_TYPE_ENV_REVERB, AudioEffect.EFFECT_TYPE_NULL, 0, 0);
        track.attachAuxEffect(effect.getId());
        track.setAuxEffectSendLevel(1.0f);
        result = true;
        effect.release();
        track.release();
    } catch (IllegalArgumentException e) {
        msg = msg.concat(": Equalizer not found");
        loge(msg, ": Equalizer not found");
    } catch (UnsupportedOperationException e) {
        msg = msg.concat(": Effect library not loaded");
        loge(msg, ": Effect library not loaded");
    }
    assertTrue(msg, result);
}
Also used : AudioTrack(android.media.AudioTrack) AudioEffect(android.media.audiofx.AudioEffect) LargeTest(android.test.suitebuilder.annotation.LargeTest)

Example 57 with LargeTest

use of android.test.suitebuilder.annotation.LargeTest in project android_frameworks_base by ParanoidAndroid.

the class MediaAudioEffectTest method test2_1SetEnabledAfterRelease.

//Test case 2.1: test setEnabled() throws exception after release
@LargeTest
public void test2_1SetEnabledAfterRelease() throws Exception {
    boolean result = false;
    String msg = "test2_1SetEnabledAfterRelease()";
    try {
        AudioEffect effect = new AudioEffect(AudioEffect.EFFECT_TYPE_EQUALIZER, AudioEffect.EFFECT_TYPE_NULL, 0, 0);
        assertNotNull(msg + ": could not create AudioEffect", effect);
        effect.release();
        try {
            effect.setEnabled(true);
        } catch (IllegalStateException e) {
            result = true;
        }
    } catch (IllegalArgumentException e) {
        msg = msg.concat(": Equalizer not found");
        loge(msg, ": Equalizer not found");
    } catch (UnsupportedOperationException e) {
        msg = msg.concat(": Effect library not loaded");
        loge(msg, ": Effect library not loaded");
    }
    assertTrue(msg, result);
}
Also used : AudioEffect(android.media.audiofx.AudioEffect) LargeTest(android.test.suitebuilder.annotation.LargeTest)

Example 58 with LargeTest

use of android.test.suitebuilder.annotation.LargeTest in project android_frameworks_base by ParanoidAndroid.

the class MediaAudioEffectTest method test4_5GetParameterIntArrayShortArray.

//Test case 4.5: test getParameter(int[], short[])
@LargeTest
public void test4_5GetParameterIntArrayShortArray() throws Exception {
    boolean result = false;
    String msg = "test4_5GetParameterIntArrayShortArray()";
    AudioEffect effect = null;
    try {
        effect = new AudioEffect(AudioEffect.EFFECT_TYPE_EQUALIZER, AudioEffect.EFFECT_TYPE_NULL, 0, 0);
        assertNotNull(msg + ": could not create AudioEffect", effect);
        int[] param = new int[1];
        short[] value = new short[1];
        param[0] = Equalizer.PARAM_CURRENT_PRESET;
        if (!AudioEffect.isError(effect.getParameter(param, value))) {
            result = true;
        }
    } catch (IllegalArgumentException e) {
        msg = msg.concat(": Bad parameter value");
        loge(msg, "Bad parameter value");
    } catch (UnsupportedOperationException e) {
        msg = msg.concat(": getParameter() rejected");
        loge(msg, "getParameter() rejected");
    } catch (IllegalStateException e) {
        msg = msg.concat("getParameter() called in wrong state");
        loge(msg, "getParameter() called in wrong state");
    } finally {
        if (effect != null) {
            effect.release();
        }
    }
    assertTrue(msg, result);
}
Also used : AudioEffect(android.media.audiofx.AudioEffect) LargeTest(android.test.suitebuilder.annotation.LargeTest)

Example 59 with LargeTest

use of android.test.suitebuilder.annotation.LargeTest in project android_frameworks_base by ParanoidAndroid.

the class MediaAudioEffectTest method test6_0Command.

//-----------------------------------------------------------------
// 6 command method
//----------------------------------
//Test case 6.0: test command method
@LargeTest
public void test6_0Command() throws Exception {
    boolean result = false;
    String msg = "test6_0Command()";
    AudioEffect effect = null;
    try {
        effect = new AudioEffect(AudioEffect.EFFECT_TYPE_EQUALIZER, AudioEffect.EFFECT_TYPE_NULL, 0, 0);
        assertNotNull(msg + ": could not create AudioEffect", effect);
        try {
            byte[] cmd = new byte[0];
            byte[] reply = new byte[4];
            int status = effect.command(3, cmd, reply);
            assertFalse(msg + ": command failed", AudioEffect.isError(status));
            assertTrue(msg + ": effect not enabled", effect.getEnabled());
            result = true;
        } catch (IllegalStateException e) {
            msg = msg.concat(": command in illegal state");
        }
    } catch (IllegalArgumentException e) {
        msg = msg.concat(": Equalizer not found");
        loge(msg, ": Equalizer not found");
    } catch (UnsupportedOperationException e) {
        msg = msg.concat(": Effect library not loaded");
        loge(msg, ": Effect library not loaded");
    } catch (Exception e) {
        loge(msg, "Could not create media player:" + e);
    } finally {
        if (effect != null) {
            effect.release();
        }
    }
    assertTrue(msg, result);
}
Also used : AudioEffect(android.media.audiofx.AudioEffect) LargeTest(android.test.suitebuilder.annotation.LargeTest)

Example 60 with LargeTest

use of android.test.suitebuilder.annotation.LargeTest in project android_frameworks_base by ParanoidAndroid.

the class MediaAudioEffectTest method test4_7GetParameterAfterRelease.

//Test case 4.7: test getParameter() throws exception after release()
@LargeTest
public void test4_7GetParameterAfterRelease() throws Exception {
    boolean result = false;
    String msg = "test4_7GetParameterAfterRelease()";
    AudioEffect effect = null;
    try {
        effect = new AudioEffect(AudioEffect.EFFECT_TYPE_EQUALIZER, AudioEffect.EFFECT_TYPE_NULL, 0, 0);
        assertNotNull(msg + ": could not create AudioEffect", effect);
        effect.release();
        short[] value = new short[1];
        effect.getParameter(Equalizer.PARAM_CURRENT_PRESET, value);
    } catch (IllegalArgumentException e) {
        msg = msg.concat(": Bad parameter value");
        loge(msg, "Bad parameter value");
    } catch (UnsupportedOperationException e) {
        msg = msg.concat(": getParameter() rejected");
        loge(msg, "getParameter() rejected");
    } catch (IllegalStateException e) {
        result = true;
    } finally {
        if (effect != null) {
            effect.release();
        }
    }
    assertTrue(msg, result);
}
Also used : AudioEffect(android.media.audiofx.AudioEffect) LargeTest(android.test.suitebuilder.annotation.LargeTest)

Aggregations

LargeTest (android.test.suitebuilder.annotation.LargeTest)1579 AudioEffect (android.media.audiofx.AudioEffect)234 AudioTrack (android.media.AudioTrack)222 View (android.view.View)147 File (java.io.File)144 MediaVideoItem (android.media.videoeditor.MediaVideoItem)115 Uri (android.net.Uri)99 ListView (android.widget.ListView)72 Cursor (android.database.Cursor)69 Bitmap (android.graphics.Bitmap)62 Instrumentation (android.app.Instrumentation)61 MediaPlayer (android.media.MediaPlayer)60 WifiConfiguration (android.net.wifi.WifiConfiguration)53 SurfaceHolder (android.view.SurfaceHolder)50 MediaImageItem (android.media.videoeditor.MediaImageItem)49 IOException (java.io.IOException)48 AudioManager (android.media.AudioManager)42 LegacyVpnInfo (com.android.internal.net.LegacyVpnInfo)42 VpnProfile (com.android.internal.net.VpnProfile)42 Request (android.app.DownloadManager.Request)41