Search in sources :

Example 81 with AudioManager

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();
}
Also used : AudioManager(android.media.AudioManager)

Example 82 with AudioManager

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);
    }
}
Also used : AudioManager(android.media.AudioManager)

Example 83 with AudioManager

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);
}
Also used : AudioManager(android.media.AudioManager)

Example 84 with AudioManager

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();
}
Also used : AudioManager(android.media.AudioManager)

Example 85 with AudioManager

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);
}
Also used : AudioManager(android.media.AudioManager) CardScrollView(com.google.android.glass.widget.CardScrollView) AdapterView(android.widget.AdapterView) CardAdapter(com.google.android.glass.sample.apidemo.card.CardAdapter) CardScrollView(com.google.android.glass.widget.CardScrollView) View(android.view.View) AdapterView(android.widget.AdapterView)

Aggregations

AudioManager (android.media.AudioManager)159 MediaPlayer (android.media.MediaPlayer)50 AudioEffect (android.media.audiofx.AudioEffect)42 LargeTest (android.test.suitebuilder.annotation.LargeTest)42 EnergyProbe (com.android.mediaframeworktest.functional.EnergyProbe)24 Context (android.content.Context)9 Intent (android.content.Intent)7 IOException (java.io.IOException)7 Cea708CaptionRenderer (android.media.Cea708CaptionRenderer)5 ClosedCaptionRenderer (android.media.ClosedCaptionRenderer)5 MediaFormat (android.media.MediaFormat)5 Ringtone (android.media.Ringtone)5 SubtitleController (android.media.SubtitleController)5 TtmlRenderer (android.media.TtmlRenderer)5 WebVttRenderer (android.media.WebVttRenderer)5 PowerManager (android.os.PowerManager)5 InputStream (java.io.InputStream)5 View (android.view.View)4 NotificationManager (android.app.NotificationManager)3 PendingIntent (android.app.PendingIntent)3