Search in sources :

Example 76 with LargeTest

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

the class CameraFunctionalTest method testFunctionalCameraExposureCompensation.

/**
     * Functional test iterating on the range of supported exposure compensation levels
     */
@LargeTest
public void testFunctionalCameraExposureCompensation() throws Exception {
    try {
        SurfaceHolder surfaceHolder = MediaFrameworkTest.mSurfaceView.getHolder();
        Parameters params = mCameraTestHelper.getCameraParameters();
        int min = params.getMinExposureCompensation();
        int max = params.getMaxExposureCompensation();
        assertFalse("Adjusting exposure not supported", (max == 0 && min == 0));
        float step = params.getExposureCompensationStep();
        int stepsPerEV = (int) Math.round(Math.pow((double) step, -1));
        // only get integer values for exposure compensation
        for (int i = min; i <= max; i += stepsPerEV) {
            runOnLooper(new Runnable() {

                @Override
                public void run() {
                    mCameraTestHelper.setupCameraTest();
                }
            });
            Log.v(TAG, "Setting exposure compensation index to " + i);
            params.setExposureCompensation(i);
            mCameraTestHelper.setParameters(params);
            mCameraTestHelper.startCameraPreview(surfaceHolder);
            mCameraTestHelper.capturePhoto();
        }
        mCameraTestHelper.cleanupTestImages();
    } catch (Exception e) {
        Log.e(TAG, e.toString());
        fail("Camera exposure compensation test Exception");
    }
}
Also used : SurfaceHolder(android.view.SurfaceHolder) Parameters(android.hardware.Camera.Parameters) IOException(java.io.IOException) LargeTest(android.test.suitebuilder.annotation.LargeTest)

Example 77 with LargeTest

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

the class MediaRecorderTest method testDeviceSpecificCodec.

@LargeTest
public //test cases for the new codec
void testDeviceSpecificCodec() throws Exception {
    int noOfFailure = 0;
    boolean recordSuccess = false;
    String deviceType = MediaProfileReader.getDeviceType();
    Log.v(TAG, "deviceType = " + deviceType);
    List<VideoEncoderCap> videoEncoders = MediaProfileReader.getVideoEncoders();
    List<AudioEncoderCap> audioEncoders = MediaProfileReader.getAudioEncoders();
    for (int k = 0; k < 2; k++) {
        for (VideoEncoderCap videoEncoder : videoEncoders) {
            for (AudioEncoderCap audioEncoder : audioEncoders) {
                if (k == 0) {
                    recordSuccess = recordVideoWithPara(videoEncoder, audioEncoder, true);
                } else {
                    recordSuccess = recordVideoWithPara(videoEncoder, audioEncoder, false);
                }
                if (!recordSuccess) {
                    Log.v(TAG, "testDeviceSpecificCodec failed");
                    Log.v(TAG, "Encoder = " + videoEncoder.mCodec + "Audio Encoder = " + audioEncoder.mCodec);
                    noOfFailure++;
                }
            }
        }
    }
    if (noOfFailure != 0) {
        assertTrue("testDeviceSpecificCodec", false);
    }
}
Also used : AudioEncoderCap(android.media.EncoderCapabilities.AudioEncoderCap) VideoEncoderCap(android.media.EncoderCapabilities.VideoEncoderCap) LargeTest(android.test.suitebuilder.annotation.LargeTest)

Example 78 with LargeTest

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

the class MediaAudioTrackTest method testPlaybackHeadPositionAfterFlush.

//Test case 3: getPlaybackHeadPosition() is 0 after flush();
@LargeTest
public void testPlaybackHeadPositionAfterFlush() throws Exception {
    // constants for test
    final String TEST_NAME = "testPlaybackHeadPositionAfterFlush";
    final int TEST_SR = 22050;
    final int TEST_CONF = AudioFormat.CHANNEL_OUT_STEREO;
    final int TEST_FORMAT = AudioFormat.ENCODING_PCM_16BIT;
    final int TEST_MODE = AudioTrack.MODE_STREAM;
    final int TEST_STREAM_TYPE = AudioManager.STREAM_MUSIC;
    //-------- initialization --------------
    int minBuffSize = AudioTrack.getMinBufferSize(TEST_SR, TEST_CONF, TEST_FORMAT);
    AudioTrack track = new AudioTrack(TEST_STREAM_TYPE, TEST_SR, TEST_CONF, TEST_FORMAT, minBuffSize, TEST_MODE);
    byte[] data = new byte[minBuffSize / 2];
    //--------    test        --------------
    assumeTrue(TEST_NAME, track.getState() == AudioTrack.STATE_INITIALIZED);
    track.write(data, 0, data.length);
    track.write(data, 0, data.length);
    track.play();
    Thread.sleep(100);
    track.stop();
    track.flush();
    log(TEST_NAME, "position =" + track.getPlaybackHeadPosition());
    assertTrue(TEST_NAME, track.getPlaybackHeadPosition() == 0);
    //-------- tear down      --------------
    track.release();
}
Also used : AudioTrack(android.media.AudioTrack) LargeTest(android.test.suitebuilder.annotation.LargeTest)

Example 79 with LargeTest

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

the class MediaBassBoostTest method test0_0ConstructorAndRelease.

//-----------------------------------------------------------------
// BASS BOOST TESTS:
//----------------------------------
//-----------------------------------------------------------------
// 0 - constructor
//----------------------------------
//Test case 0.0: test constructor and release
@LargeTest
public void test0_0ConstructorAndRelease() throws Exception {
    boolean result = false;
    String msg = "test1_0ConstructorAndRelease()";
    BassBoost bb = null;
    try {
        bb = new BassBoost(0, 0);
        assertNotNull(msg + ": could not create BassBoost", bb);
        try {
            assertTrue(msg + ": invalid effect ID", (bb.getId() != 0));
        } catch (IllegalStateException e) {
            msg = msg.concat(": BassBoost not initialized");
        }
        result = true;
    } catch (IllegalArgumentException e) {
        msg = msg.concat(": BassBoost not found");
    } catch (UnsupportedOperationException e) {
        msg = msg.concat(": Effect library not loaded");
    } finally {
        if (bb != null) {
            bb.release();
        }
    }
    assertTrue(msg, result);
}
Also used : BassBoost(android.media.audiofx.BassBoost) LargeTest(android.test.suitebuilder.annotation.LargeTest)

Example 80 with LargeTest

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

the class MediaPresetReverbTest method test2_1InsertSoundModification.

//Test case 2.1: test actual insert reverb influence on sound
@LargeTest
public void test2_1InsertSoundModification() throws Exception {
    boolean result = false;
    String msg = "test2_1InsertSoundModification()";
    EnergyProbe probe = null;
    AudioEffect vc = null;
    MediaPlayer mp = null;
    AudioEffect rvb = null;
    AudioManager am = (AudioManager) getActivity().getSystemService(Context.AUDIO_SERVICE);
    int ringerMode = am.getRingerMode();
    am.setRingerMode(AudioManager.RINGER_MODE_NORMAL);
    int volume = am.getStreamMaxVolume(AudioManager.STREAM_MUSIC);
    am.setStreamVolume(AudioManager.STREAM_MUSIC, am.getStreamMaxVolume(AudioManager.STREAM_MUSIC), 0);
    try {
        // creating a volume controller on output mix ensures that ro.audio.silent mutes
        // audio after the effects and not before
        vc = new AudioEffect(AudioEffect.EFFECT_TYPE_NULL, VOLUME_EFFECT_UUID, 0, 0);
        vc.setEnabled(true);
        mp = new MediaPlayer();
        mp.setDataSource(MediaNames.SINE_200_1000);
        mp.setAudioStreamType(AudioManager.STREAM_MUSIC);
        // 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, PRESET_REVERB_EFFECT_UUID, 0, 0);
        rvb.setParameter(PresetReverb.PARAM_PRESET, PresetReverb.PRESET_PLATE);
        rvb.setEnabled(true);
        // create probe after reverb so that it is chained behind the reverb in the
        // effect chain
        probe = new EnergyProbe(0);
        mp.prepare();
        mp.start();
        Thread.sleep(1000);
        mp.stop();
        Thread.sleep(200);
        // measure energy around 1kHz after media player was stopped for 200 ms
        int energy1000 = probe.capture(1000);
        assertTrue(msg + ": reverb has no effect", energy1000 > 0);
        result = true;
    } catch (IllegalArgumentException e) {
        msg = msg.concat(": Bad parameter value");
        loge(msg, "Bad parameter value");
    } catch (UnsupportedOperationException e) {
        msg = msg.concat(": get parameter() rejected");
        loge(msg, "get parameter() rejected");
    } catch (IllegalStateException e) {
        msg = msg.concat("get parameter() called in wrong state");
        loge(msg, "get parameter() called in wrong state");
    } catch (InterruptedException e) {
        loge(msg, "sleep() interrupted");
    } finally {
        if (mp != null) {
            mp.release();
        }
        if (vc != null) {
            vc.release();
        }
        if (rvb != null) {
            rvb.release();
        }
        if (probe != null) {
            probe.release();
        }
        am.setStreamVolume(AudioManager.STREAM_MUSIC, volume, 0);
        am.setRingerMode(ringerMode);
    }
    assertTrue(msg, result);
}
Also used : AudioManager(android.media.AudioManager) EnergyProbe(com.android.mediaframeworktest.functional.EnergyProbe) AudioEffect(android.media.audiofx.AudioEffect) MediaPlayer(android.media.MediaPlayer) 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