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

Commit 4e71faec authored by Glenn Kasten's avatar Glenn Kasten Committed by Android (Google) Code Review
Browse files

Merge "Simplify throw statements"

parents 0fc11dd0 f4e58051
Loading
Loading
Loading
Loading
+12 −12
Original line number Diff line number Diff line
@@ -322,7 +322,7 @@ public class AudioTrack
        audioBuffSizeCheck(bufferSizeInBytes);

        if (sessionId < 0) {
            throw (new IllegalArgumentException("Invalid audio session ID: "+sessionId));
            throw new IllegalArgumentException("Invalid audio session ID: "+sessionId);
        }

        int[] session = new int[1];
@@ -375,7 +375,7 @@ public class AudioTrack
           && (streamType != AudioManager.STREAM_NOTIFICATION)
           && (streamType != AudioManager.STREAM_BLUETOOTH_SCO)
           && (streamType != AudioManager.STREAM_DTMF)) {
            throw (new IllegalArgumentException("Invalid stream type."));
            throw new IllegalArgumentException("Invalid stream type.");
        } else {
            mStreamType = streamType;
        }
@@ -383,8 +383,8 @@ public class AudioTrack
        //--------------
        // sample rate, note these values are subject to change
        if ( (sampleRateInHz < 4000) || (sampleRateInHz > 48000) ) {
            throw (new IllegalArgumentException(sampleRateInHz
                    + "Hz is not a supported sample rate."));
            throw new IllegalArgumentException(sampleRateInHz
                    + "Hz is not a supported sample rate.");
        } else {
            mSampleRate = sampleRateInHz;
        }
@@ -411,7 +411,7 @@ public class AudioTrack
                mChannelCount = 0;
                mChannels = AudioFormat.CHANNEL_INVALID;
                mChannelConfiguration = AudioFormat.CHANNEL_INVALID;
                throw(new IllegalArgumentException("Unsupported channel configuration."));
                throw new IllegalArgumentException("Unsupported channel configuration.");
            } else {
                mChannels = channelConfig;
                mChannelCount = Integer.bitCount(channelConfig);
@@ -430,14 +430,14 @@ public class AudioTrack
            break;
        default:
            mAudioFormat = AudioFormat.ENCODING_INVALID;
            throw(new IllegalArgumentException("Unsupported sample encoding."
                + " Should be ENCODING_PCM_8BIT or ENCODING_PCM_16BIT."));
            throw new IllegalArgumentException("Unsupported sample encoding."
                + " Should be ENCODING_PCM_8BIT or ENCODING_PCM_16BIT.");
        }

        //--------------
        // audio load mode
        if ( (mode != MODE_STREAM) && (mode != MODE_STATIC) ) {
            throw(new IllegalArgumentException("Invalid mode."));
            throw new IllegalArgumentException("Invalid mode.");
        } else {
            mDataLoadMode = mode;
        }
@@ -487,7 +487,7 @@ public class AudioTrack
        int frameSizeInBytes = mChannelCount
                * (mAudioFormat == AudioFormat.ENCODING_PCM_8BIT ? 1 : 2);
        if ((audioBufferSize % frameSizeInBytes != 0) || (audioBufferSize < 1)) {
            throw (new IllegalArgumentException("Invalid audio buffer size."));
            throw new IllegalArgumentException("Invalid audio buffer size.");
        }

        mNativeBufferSizeInBytes = audioBufferSize;
@@ -894,7 +894,7 @@ public class AudioTrack
    public void play()
    throws IllegalStateException {
        if (mState != STATE_INITIALIZED) {
            throw(new IllegalStateException("play() called on uninitialized AudioTrack."));
            throw new IllegalStateException("play() called on uninitialized AudioTrack.");
        }

        synchronized(mPlayStateLock) {
@@ -914,7 +914,7 @@ public class AudioTrack
    public void stop()
    throws IllegalStateException {
        if (mState != STATE_INITIALIZED) {
            throw(new IllegalStateException("stop() called on uninitialized AudioTrack."));
            throw new IllegalStateException("stop() called on uninitialized AudioTrack.");
        }

        // stop playing
@@ -934,7 +934,7 @@ public class AudioTrack
    public void pause()
    throws IllegalStateException {
        if (mState != STATE_INITIALIZED) {
            throw(new IllegalStateException("pause() called on uninitialized AudioTrack."));
            throw new IllegalStateException("pause() called on uninitialized AudioTrack.");
        }
        //logd("pause()");