Search in sources :

Example 16 with ToneGenerator

use of android.media.ToneGenerator in project android_frameworks_base by crdroidandroid.

the class TonesAutoTest method tonesStressTest.

// Test start of new tone without stopping previous one 
public static boolean tonesStressTest() throws Exception {
    Log.v(TAG, "Stress tones test");
    ToneGenerator toneGen;
    int type;
    boolean result = true;
    toneGen = new ToneGenerator(AudioManager.STREAM_MUSIC, 100);
    for (type = ToneGenerator.TONE_DTMF_1; type <= ToneGenerator.TONE_DTMF_9; type++) {
        if (toneGen.startTone(type)) {
            Thread.sleep(200);
        } else {
            result = false;
            break;
        }
    }
    toneGen.release();
    return result;
}
Also used : ToneGenerator(android.media.ToneGenerator)

Example 17 with ToneGenerator

use of android.media.ToneGenerator in project android_frameworks_base by crdroidandroid.

the class TonesAutoTest method tonesProprietaryTest.

// Test all proprietary tones one by one
public static boolean tonesProprietaryTest() throws Exception {
    Log.v(TAG, "Proprietary tones test");
    ToneGenerator toneGen;
    int type;
    boolean result = true;
    toneGen = new ToneGenerator(AudioManager.STREAM_MUSIC, 100);
    for (type = ToneGenerator.TONE_PROP_BEEP; type <= ToneGenerator.TONE_PROP_BEEP2; type++) {
        if (toneGen.startTone(type)) {
            Thread.sleep(1000);
            toneGen.stopTone();
            Thread.sleep(100);
        } else {
            result = false;
            break;
        }
    }
    toneGen.release();
    return result;
}
Also used : ToneGenerator(android.media.ToneGenerator)

Example 18 with ToneGenerator

use of android.media.ToneGenerator in project android_frameworks_base by crdroidandroid.

the class TonesAutoTest method tonesSimultaneousTest.

// Test playback of 2 tones simultaneously
public static boolean tonesSimultaneousTest() throws Exception {
    Log.v(TAG, "Simultaneous tones test");
    ToneGenerator toneGen1;
    ToneGenerator toneGen2;
    int type;
    boolean result = true;
    toneGen1 = new ToneGenerator(AudioManager.STREAM_MUSIC, 100);
    toneGen2 = new ToneGenerator(AudioManager.STREAM_MUSIC, 50);
    if (toneGen1.startTone(ToneGenerator.TONE_DTMF_1)) {
        Thread.sleep(100);
        if (toneGen2.startTone(ToneGenerator.TONE_DTMF_2)) {
            Thread.sleep(500);
            toneGen1.stopTone();
            Thread.sleep(100);
            toneGen2.stopTone();
        } else {
            toneGen1.stopTone();
            result = false;
        }
    } else {
        result = false;
    }
    toneGen1.release();
    toneGen2.release();
    return result;
}
Also used : ToneGenerator(android.media.ToneGenerator)

Example 19 with ToneGenerator

use of android.media.ToneGenerator in project android_frameworks_base by ParanoidAndroid.

the class VolumePanel method onPlaySound.

protected void onPlaySound(int streamType, int flags) {
    if (hasMessages(MSG_STOP_SOUNDS)) {
        removeMessages(MSG_STOP_SOUNDS);
        // Force stop right now
        onStopSounds();
    }
    synchronized (this) {
        ToneGenerator toneGen = getOrCreateToneGenerator(streamType);
        if (toneGen != null) {
            toneGen.startTone(ToneGenerator.TONE_PROP_BEEP);
            sendMessageDelayed(obtainMessage(MSG_STOP_SOUNDS), BEEP_DURATION);
        }
    }
}
Also used : ToneGenerator(android.media.ToneGenerator)

Example 20 with ToneGenerator

use of android.media.ToneGenerator in project android_frameworks_base by ParanoidAndroid.

the class TonesAutoTest method tonesProprietaryTest.

// Test all proprietary tones one by one
public static boolean tonesProprietaryTest() throws Exception {
    Log.v(TAG, "Proprietary tones test");
    ToneGenerator toneGen;
    int type;
    boolean result = true;
    toneGen = new ToneGenerator(AudioManager.STREAM_MUSIC, 100);
    for (type = ToneGenerator.TONE_PROP_BEEP; type <= ToneGenerator.TONE_PROP_BEEP2; type++) {
        if (toneGen.startTone(type)) {
            Thread.sleep(1000);
            toneGen.stopTone();
            Thread.sleep(100);
        } else {
            result = false;
            break;
        }
    }
    toneGen.release();
    return result;
}
Also used : ToneGenerator(android.media.ToneGenerator)

Aggregations

ToneGenerator (android.media.ToneGenerator)37 SearchManager (android.app.SearchManager)2 ActivityNotFoundException (android.content.ActivityNotFoundException)2 Intent (android.content.Intent)2 AudioManager (android.media.AudioManager)2 PowerManager (android.os.PowerManager)2 RemoteException (android.os.RemoteException)2 UserHandle (android.os.UserHandle)2 Vibrator (android.os.Vibrator)2 URISyntaxException (java.net.URISyntaxException)2 IStatusBarService (com.android.internal.statusbar.IStatusBarService)1