use of android.media.AudioManager in project android_frameworks_base by crdroidandroid.
the class PhoneStatusBarPolicy method updateVolumeZen.
private final void updateVolumeZen() {
AudioManager audioManager = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE);
boolean zenVisible = false;
int zenIconId = 0;
String zenDescription = null;
boolean volumeVisible = false;
int volumeIconId = 0;
String volumeDescription = null;
if (DndTile.isVisible(mContext) || DndTile.isCombinedIcon(mContext)) {
zenVisible = mZen != Global.ZEN_MODE_OFF;
switch(mZen) {
case Global.ZEN_MODE_IMPORTANT_INTERRUPTIONS:
zenIconId = R.drawable.stat_sys_dnd_priority;
break;
case Global.ZEN_MODE_NO_INTERRUPTIONS:
zenIconId = R.drawable.stat_sys_dnd_total_silence;
break;
default:
zenIconId = R.drawable.stat_sys_dnd;
break;
}
zenDescription = mContext.getString(R.string.quick_settings_dnd_label);
} else if (mZen == Global.ZEN_MODE_NO_INTERRUPTIONS) {
zenVisible = true;
zenIconId = R.drawable.stat_sys_zen_none;
zenDescription = mContext.getString(R.string.interruption_level_none);
} else if (mZen == Global.ZEN_MODE_IMPORTANT_INTERRUPTIONS) {
zenVisible = true;
zenIconId = R.drawable.stat_sys_zen_important;
zenDescription = mContext.getString(R.string.interruption_level_priority);
}
if (DndTile.isVisible(mContext) && !DndTile.isCombinedIcon(mContext) && audioManager.getRingerModeInternal() == AudioManager.RINGER_MODE_SILENT) {
volumeVisible = true;
volumeIconId = R.drawable.stat_sys_ringer_silent;
volumeDescription = mContext.getString(R.string.accessibility_ringer_silent);
} else if (mZen != Global.ZEN_MODE_NO_INTERRUPTIONS && mZen != Global.ZEN_MODE_ALARMS && audioManager.getRingerModeInternal() == AudioManager.RINGER_MODE_VIBRATE) {
volumeVisible = true;
volumeIconId = R.drawable.stat_sys_ringer_vibrate;
volumeDescription = mContext.getString(R.string.accessibility_ringer_vibrate);
}
if (zenVisible) {
mIconController.setIcon(mSlotZen, zenIconId, zenDescription);
}
if (zenVisible != mZenVisible) {
mIconController.setIconVisibility(mSlotZen, zenVisible);
mZenVisible = zenVisible;
}
if (volumeVisible) {
mIconController.setIcon(mSlotVolume, volumeIconId, volumeDescription);
}
if (volumeVisible != mVolumeVisible) {
mIconController.setIconVisibility(mSlotVolume, volumeVisible);
mVolumeVisible = volumeVisible;
}
updateAlarm();
}
use of android.media.AudioManager in project android_frameworks_base by crdroidandroid.
the class HdmiControlService method setAudioStatus.
void setAudioStatus(boolean mute, int volume) {
AudioManager audioManager = getAudioManager();
boolean muted = audioManager.isStreamMute(AudioManager.STREAM_MUSIC);
if (mute) {
if (!muted) {
audioManager.setStreamMute(AudioManager.STREAM_MUSIC, true);
}
} else {
if (muted) {
audioManager.setStreamMute(AudioManager.STREAM_MUSIC, false);
}
// FLAG_HDMI_SYSTEM_AUDIO_VOLUME prevents audio manager from announcing
// volume change notification back to hdmi control service.
audioManager.setStreamVolume(AudioManager.STREAM_MUSIC, volume, AudioManager.FLAG_SHOW_UI | AudioManager.FLAG_HDMI_SYSTEM_AUDIO_VOLUME);
}
}
use of android.media.AudioManager in project android_frameworks_base by ResurrectionRemix.
the class VolumeTile method handleClick.
@Override
public void handleClick() {
AudioManager am = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE);
am.adjustVolume(AudioManager.ADJUST_SAME, AudioManager.FLAG_SHOW_UI);
}
use of android.media.AudioManager in project glasquare by davidvavra.
the class BaseProgressActivity method showSuccess.
protected void showSuccess(int resourceId) {
vProgressText.setText(resourceId);
vProgressBar.setVisibility(View.GONE);
vProgressText.setVisibility(View.VISIBLE);
AudioManager audio = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
audio.playSoundEffect(Sounds.SUCCESS);
if (vGracePeriodText != null) {
vGracePeriodText.setVisibility(View.GONE);
}
releaseWakeLock();
}
use of android.media.AudioManager in project gdk-apidemo-sample by googleglass.
the class VoiceMenuActivity method onCreate.
@Override
protected void onCreate(Bundle bundle) {
super.onCreate(bundle);
// Requests a voice menu on this activity. As for any other window feature,
// be sure to request this before setContentView() is called
getWindow().requestFeature(WindowUtils.FEATURE_VOICE_COMMANDS);
// Ensure screen stays on during demo.
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
// Sets up a singleton card scroller as content of this activity. Clicking
// on the card toggles the voice menu on and off.
mCardScroller = new CardScrollView(this);
mCardScroller.setAdapter(new CardAdapter(createCards(this)));
mCardScroller.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
// Plays sound.
AudioManager am = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
am.playSoundEffect(Sounds.TAP);
// Toggles voice menu. Invalidates menu to flag change.
mVoiceMenuEnabled = !mVoiceMenuEnabled;
getWindow().invalidatePanelMenu(WindowUtils.FEATURE_VOICE_COMMANDS);
}
});
setContentView(mCardScroller);
}
Aggregations