use of android.media.ToneGenerator in project android_frameworks_base by AOSPA.
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;
}
use of android.media.ToneGenerator in project android_frameworks_base by DirtyUnicorns.
the class TonesAutoTest method tonesSupervisoryTest.
// Test all supervisory tones one by one
public static boolean tonesSupervisoryTest() throws Exception {
Log.v(TAG, "Supervisory tones test");
ToneGenerator toneGen;
int type;
boolean result = true;
toneGen = new ToneGenerator(AudioManager.STREAM_MUSIC, 100);
for (type = ToneGenerator.TONE_SUP_DIAL; type <= ToneGenerator.TONE_SUP_RINGTONE; type++) {
if (toneGen.startTone(type)) {
Thread.sleep(2000);
toneGen.stopTone();
Thread.sleep(200);
} else {
result = false;
break;
}
}
for (type = ToneGenerator.TONE_SUP_INTERCEPT; type <= ToneGenerator.TONE_SUP_PIP; type++) {
if (toneGen.startTone(type)) {
Thread.sleep(5000);
toneGen.stopTone();
Thread.sleep(200);
} else {
result = false;
break;
}
}
toneGen.release();
return result;
}
use of android.media.ToneGenerator in project android_frameworks_base by DirtyUnicorns.
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;
}
use of android.media.ToneGenerator in project android_frameworks_base by DirtyUnicorns.
the class VolumeDialogController method onPlaySoundW.
protected void onPlaySoundW(int streamType, int flags) {
// If preference is no sound - just exit here
if (Settings.System.getInt(mContext.getContentResolver(), Settings.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);
}
use of android.media.ToneGenerator in project android_frameworks_base by ResurrectionRemix.
the class VolumeDialogController method onPlaySoundW.
protected void onPlaySoundW(int streamType, int flags) {
// If preference is no sound - just exit here
if (Settings.System.getInt(mContext.getContentResolver(), Settings.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);
}
Aggregations