Search in sources :

Example 36 with ToneGenerator

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

the class TonesAutoTest method tonesDtmfTest.

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

Example 37 with ToneGenerator

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

the class VolumeDialogController method onPlaySoundW.

protected void onPlaySoundW(int streamType, int flags) {
    // If preference is no sound - just exit here
    if (CMSettings.System.getInt(mContext.getContentResolver(), CMSettings.System.VOLUME_ADJUST_SOUNDS_ENABLED, 1) == 0) {
        return;
    }
    if (mWorker.hasMessages(W.STOP_SOUNDS)) {
        mWorker.removeMessages(W.STOP_SOUNDS);
        // Force stop right now
        onStopSoundsW();
    }
    ToneGenerator toneGen = getOrCreateToneGeneratorW(streamType);
    if (toneGen != null) {
        toneGen.startTone(ToneGenerator.TONE_PROP_BEEP);
        mWorker.sendMessageDelayed(mWorker.obtainMessage(W.STOP_SOUNDS), BEEP_DURATION);
    }
    mWorker.removeMessages(W.FREE_RESOURCES);
    mWorker.sendMessageDelayed(mWorker.obtainMessage(W.FREE_RESOURCES), FREE_DELAY);
}
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