Example usage for android.media AudioManager FLAG_PLAY_SOUND

List of usage examples for android.media AudioManager FLAG_PLAY_SOUND

Introduction

In this page you can find the example usage for android.media AudioManager FLAG_PLAY_SOUND.

Prototype

int FLAG_PLAY_SOUND

To view the source code for android.media AudioManager FLAG_PLAY_SOUND.

Click Source Link

Document

Whether to play a sound when changing the volume.

Usage

From source file:org.wso2.emm.agent.AlertActivity.java

/**
 * This method is used to start ringing the phone.
 *//*from   w w  w .  ja v  a2  s .c o  m*/
@TargetApi(21)
private void startRing() {
    if (audio != null) {
        audio.setRingerMode(AudioManager.RINGER_MODE_NORMAL);
        audio.setStreamVolume(AudioManager.STREAM_RING, audio.getStreamMaxVolume(AudioManager.STREAM_RING),
                AudioManager.FLAG_PLAY_SOUND);

        defaultRingtoneUri = RingtoneManager.getActualDefaultRingtoneUri(this, RingtoneManager.TYPE_RINGTONE);

        if (defaultRingtoneUri != null) {
            defaultRingtone = RingtoneManager.getRingtone(this, defaultRingtoneUri);

            if (defaultRingtone != null) {
                if (deviceInfo.getSdkVersion() >= Build.VERSION_CODES.LOLLIPOP) {
                    AudioAttributes attributes = new AudioAttributes.Builder()
                            .setUsage(AudioAttributes.USAGE_NOTIFICATION)
                            .setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION).build();
                    defaultRingtone.setAudioAttributes(attributes);
                } else {
                    defaultRingtone.setStreamType(AudioManager.STREAM_NOTIFICATION);
                }
                defaultRingtone.play();
            }
        }
    }
}

From source file:com.microsoft.mimickeralarm.appcore.AlarmMainActivity.java

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN) {
        mAudioManager.adjustStreamVolume(AudioManager.STREAM_ALARM, AudioManager.ADJUST_LOWER,
                AudioManager.FLAG_SHOW_UI | AudioManager.FLAG_PLAY_SOUND);
    } else if (keyCode == KeyEvent.KEYCODE_VOLUME_UP) {
        mAudioManager.adjustStreamVolume(AudioManager.STREAM_ALARM, AudioManager.ADJUST_RAISE,
                AudioManager.FLAG_SHOW_UI | AudioManager.FLAG_PLAY_SOUND);
    } else {/*w  w  w.  j a  va 2s.c  o  m*/
        return super.onKeyDown(keyCode, event);
    }
    return true;
}

From source file:com.darly.im.ui.CCPActivityBase.java

/**
 *
 * @param keyCode//from  w ww  .ja v  a 2s.com
 * @param event
 * @return
 */
public boolean onKeyDown(int keyCode, KeyEvent event) {

    if ((event.getKeyCode() == KeyEvent.KEYCODE_VOLUME_UP) && mAudioManager != null) {
        int streamVolume = mAudioManager.getStreamVolume(AudioManager.STREAM_MUSIC);

        if (streamVolume >= mMusicMaxVolume) {
            LogUtil.d(LogUtil.getLogUtilsTag(BaseFragment.class), "has set the max volume");
            return true;
        }

        int mean = mMusicMaxVolume / 7;
        if (mean == 0) {
            mean = 1;
        }

        mAudioManager.setStreamVolume(AudioManager.STREAM_MUSIC, streamVolume + mean,
                AudioManager.FLAG_PLAY_SOUND | AudioManager.FLAG_SHOW_UI);
    }
    if ((event.getKeyCode() == KeyEvent.KEYCODE_VOLUME_DOWN) && mAudioManager != null) {
        int streamVolume = mAudioManager.getStreamVolume(AudioManager.STREAM_MUSIC);
        int mean = mMusicMaxVolume / 7;
        if (mean == 0) {
            mean = 1;
        }

        mAudioManager.setStreamVolume(AudioManager.STREAM_MUSIC, streamVolume - mean,
                AudioManager.FLAG_PLAY_SOUND | AudioManager.FLAG_SHOW_UI);
        return true;
    }
    return false;
}

From source file:com.marvin.rocklock.RockLockActivity.java

/**
 * Pick up back button and volume up and down
 */// ww w .j  a v  a 2s  .com
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    switch (keyCode) {
    case KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE:
        mPlayer.togglePlayPause();
        return true;
    case KeyEvent.KEYCODE_MEDIA_NEXT:
        mPlayer.nextTrack(false);
        return true;
    case KeyEvent.KEYCODE_MEDIA_PREVIOUS:
        mPlayer.prevTrack(false);
        return true;
    case KeyEvent.KEYCODE_VOLUME_UP:
        mAudioManager.adjustStreamVolume(AudioManager.STREAM_MUSIC, AudioManager.ADJUST_RAISE,
                AudioManager.FLAG_PLAY_SOUND);
        return true;
    case KeyEvent.KEYCODE_VOLUME_DOWN:
        mAudioManager.adjustStreamVolume(AudioManager.STREAM_MUSIC, AudioManager.ADJUST_LOWER,
                AudioManager.FLAG_PLAY_SOUND);
        return true;
    case KeyEvent.KEYCODE_BACK:
        onBackPressed();
        return true;
    default:
        return super.onKeyDown(keyCode, event);
    }
}

From source file:com.nbplus.vbroadlauncher.RealtimeBroadcastActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    overridePendingTransition(R.anim.fade_in, R.anim.fade_out);
    acquireCpuWakeLock();/*from   ww w .j a  v  a2  s.co  m*/

    KeyguardManager km = (KeyguardManager) getSystemService(Context.KEYGUARD_SERVICE);
    km.inKeyguardRestrictedInputMode();
    if (km.inKeyguardRestrictedInputMode()) {
        Log.i(TAG, " ??");
        isKeyguardRestrictedInputMode = true;
    } else {
        Log.i(TAG, "   ??");
    }

    mLastNetworkStatus = NetworkUtils.isConnected(this);
    Intent intent = getIntent();
    if (intent == null || !PushConstants.ACTION_PUSH_MESSAGE_RECEIVED.equals(intent.getAction())) {
        Log.d(TAG, "empty or none broadcast intent value ...");
        finishActivity();
        return;
    }

    mBroadcastData = intent.getParcelableExtra(Constants.EXTRA_BROADCAST_PAYLOAD_DATA);
    if (mBroadcastData == null) {
        Log.d(TAG, ">> payload data is null");
        finishActivity();
        return;
    }

    mBroadcastPayloadIdx = intent.getLongExtra(Constants.EXTRA_BROADCAST_PAYLOAD_INDEX, -1);
    Log.d(TAG, ">> onCreate() mBroadcastPayloadIdx= " + mBroadcastPayloadIdx);

    // ? ms  ? ?? ? ?   ?  ????
    // broadcast ? .
    //  ?? ?? ??.
    Intent i = new Intent(this, RealtimeBroadcastActivity.class);
    i.setAction(intent.getAction());
    i.putExtra(Constants.EXTRA_BROADCAST_PAYLOAD_DATA, mBroadcastData);
    i.putExtra(Constants.EXTRA_BROADCAST_PAYLOAD_INDEX, mBroadcastPayloadIdx);
    LocalBroadcastManager.getInstance(this).sendBroadcast(i);

    IntentFilter filter = new IntentFilter();
    filter.addAction(PushConstants.ACTION_PUSH_MESSAGE_RECEIVED);
    filter.addAction(Constants.ACTION_BROWSER_ACTIVITY_CLOSE);
    LocalBroadcastManager.getInstance(this).registerReceiver(mBroadcastReceiver, filter);

    IntentFilter intentFilter = new IntentFilter();
    intentFilter.addAction(ConnectivityManager.CONNECTIVITY_ACTION);
    registerReceiver(mBroadcastReceiver, intentFilter);

    hideSystemUI();
    /*
    final Window win = getWindow();
    win.setFlags(
        WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED
                | WindowManager.LayoutParams.FLAG_FULLSCREEN
                | WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON
                | WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD,
        WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED
                | WindowManager.LayoutParams.FLAG_FULLSCREEN
                | WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON
                | WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD);
            
    win.addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED
                | WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON
                | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON
                | WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD
                | WindowManager.LayoutParams.FLAG_ALLOW_LOCK_WHILE_SCREEN_ON);
    */

    if (Constants.PUSH_PAYLOAD_TYPE_TEXT_BROADCAST.equals(mBroadcastData.getServiceType())) {
        setContentView(R.layout.fragment_text_broadcast);
    } else {
        setContentView(R.layout.fragment_audio_broadcast);
    }
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED
            | WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD);

    if (Constants.PUSH_PAYLOAD_TYPE_TEXT_BROADCAST.equals(mBroadcastData.getServiceType())) {
        mcheckText2SpeechLister = this;
        // ?
        mTextView = (TextView) findViewById(R.id.broadcast_text);
        mTextView.setText(mBroadcastData.getMessage());
        mTextView.setVerticalScrollBarEnabled(true);
        mTextView.setHorizontalScrollBarEnabled(false);
        mTextView.setMovementMethod(new ScrollingMovementMethod());

        mHandler.sendEmptyMessageDelayed(HANDLER_MESSAGE_SETUP_CURRENT_PLAYING, 800);
        Log.d(TAG, "text broadcast = " + mBroadcastData.getMessage());

        mText2SpeechHandler = new TextToSpeechHandler(this, this);
        checkText2SpeechAvailable();
        mIsTTS = true;
    } else {
        // , ??
        mWebView = (WebView) findViewById(R.id.webview);
        mWebViewClient = new RealtimeBroadcastWebViewClient(this, mWebView, this);
        mWebViewClient.setBackgroundTransparent();

        String url = mBroadcastData.getMessage();
        if (url.indexOf("?") > 0) {
            if (!url.contains("UUID=")) {
                url += ("&UUID=" + LauncherSettings.getInstance(this).getDeviceID());
            }
            if (!url.contains("APPID=")) {
                url += ("&APPID=" + getApplicationContext().getPackageName());
            }
        } else {
            if (!url.contains("UUID=")) {
                url += ("?UUID=" + LauncherSettings.getInstance(this).getDeviceID());
            }
            if (!url.contains("APPID=")) {
                if (!url.contains("UUID=")) {
                    url += ("?APPID=" + getApplicationContext().getPackageName());
                } else {
                    url += ("&APPID=" + getApplicationContext().getPackageName());
                }
            }
        }

        mWebViewClient.loadUrl(url);
        mIsTTS = false;
    }
    AudioManager audio = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
    mStreamMusicVolume = audio.getStreamVolume(AudioManager.STREAM_MUSIC);
    audio.setStreamVolume(AudioManager.STREAM_MUSIC, audio.getStreamMaxVolume(AudioManager.STREAM_MUSIC),
            AudioManager.FLAG_PLAY_SOUND);

    if (Constants.OPEN_BETA_PHONE && LauncherSettings.getInstance(this).isSmartPhone()) {
        StateListener phoneStateListener = new StateListener();
        TelephonyManager telephonyManager = (TelephonyManager) getSystemService(TELEPHONY_SERVICE);
        telephonyManager.listen(phoneStateListener, PhoneStateListener.LISTEN_CALL_STATE);
    }
}

From source file:edu.stanford.mobisocial.dungbeetle.ui.fragments.AppsViewFragment.java

@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
    if (event.getKeyCode() == KeyEvent.KEYCODE_VOLUME_UP) {
        if (!event.isTracking()) {
            return true;
        }//from  w ww. ja  v a  2s .co  m
        if (!event.isLongPress()) {
            AudioManager audio = (AudioManager) getActivity().getSystemService(Context.AUDIO_SERVICE);
            audio.adjustVolume(AudioManager.ADJUST_RAISE,
                    AudioManager.FLAG_PLAY_SOUND | AudioManager.FLAG_SHOW_UI);
            return true;
        }
    }
    if (event.getKeyCode() == KeyEvent.KEYCODE_VOLUME_DOWN) {
        if (!event.isTracking()) {
            return true;
        }
        if (!event.isLongPress()) {
            AudioManager audio = (AudioManager) getActivity().getSystemService(Context.AUDIO_SERVICE);
            audio.adjustVolume(AudioManager.ADJUST_LOWER,
                    AudioManager.FLAG_PLAY_SOUND | AudioManager.FLAG_SHOW_UI);
            return true;
        }
    }
    return false;
}

From source file:com.nbplus.vbroadlauncher.RadioActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (Constants.OPEN_BETA_PHONE && LauncherSettings.getInstance(this).isSmartPhone()) {
        this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
    }//w  w w .jav  a2  s. c  om

    mSettingsContentObserver = new SettingsContentObserver(this, new Handler());
    getApplicationContext().getContentResolver().registerContentObserver(
            android.provider.Settings.System.CONTENT_URI, true, mSettingsContentObserver);

    showProgressDialog();
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        Window window = getWindow();
        window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
        window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
        window.setStatusBarColor(getResources().getColor(R.color.activity_radio_background));
    }

    overridePendingTransition(R.anim.fade_in, R.anim.fade_out);
    setContentView(R.layout.activity_radio);

    Intent i = getIntent();
    mShortcutData = i.getParcelableExtra(Constants.EXTRA_NAME_SHORTCUT_DATA);
    if (mShortcutData == null) {
        Log.e(TAG, "mShortcutData is not found..");
        finishActivity();
        return;
    }

    IntentFilter filter = new IntentFilter();
    filter.addAction(MusicService.ACTION_PLAYED);
    filter.addAction(MusicService.ACTION_PAUSED);
    filter.addAction(MusicService.ACTION_STOPPED);
    filter.addAction(MusicService.ACTION_COMPLETED);
    filter.addAction(MusicService.ACTION_ERROR);
    filter.addAction(MusicService.ACTION_PLAYING_STATUS);

    LocalBroadcastManager.getInstance(this).registerReceiver(mBroadcastReceiver, filter);
    // send playing status
    Intent queryStatus = new Intent(this, MusicService.class);
    queryStatus.setAction(MusicService.ACTION_PLAYING_STATUS);
    startService(queryStatus);

    // ViewPager .
    // ??? ? ? ? .
    mViewPager = (NbplusViewPager) findViewById(R.id.viewPager);
    mIndicator = (CirclePageIndicator) findViewById(R.id.indicator);

    // close button
    ImageButton closeButton = (ImageButton) findViewById(R.id.btn_close);
    closeButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            finishActivity();
        }
    });

    mActivityLayout = (RelativeLayout) findViewById(R.id.radio_activity_background);
    int wallpaperId = LauncherSettings.getInstance(this).getWallpaperId();
    mActivityLayout.setBackgroundResource(LauncherSettings.landWallpaperResource[wallpaperId]);

    // title.
    mRadioTitle = (TextView) findViewById(R.id.radio_activity_label);

    // media controller
    mPlayToggle = (ImageButton) findViewById(R.id.ic_media_control_play);
    mPlayToggle.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            if (mCurrentPlayingStatus == null) {
                return;
            }
            MusicService.State state = (MusicService.State) mCurrentPlayingStatus
                    .getSerializable(MusicService.EXTRA_PLAYING_STATUS);
            Intent i = new Intent(RadioActivity.this, MusicService.class);
            if (state == MusicService.State.Playing) {
                i.setAction(MusicService.ACTION_PAUSE);
            } else if (state == MusicService.State.Paused) {
                i.setAction(MusicService.ACTION_PLAY);
            }
            startService(i);
        }
    });
    mPlayStop = (ImageButton) findViewById(R.id.ic_media_control_stop);
    mPlayStop.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            if (mCurrentPlayingStatus == null) {
                return;
            }
            MusicService.State state = (MusicService.State) mCurrentPlayingStatus
                    .getSerializable(MusicService.EXTRA_PLAYING_STATUS);
            if (state == MusicService.State.Playing || state == MusicService.State.Paused) {
                Intent i = new Intent(RadioActivity.this, MusicService.class);
                i.setAction(MusicService.ACTION_STOP);
                i.putExtra(MusicService.EXTRA_MUSIC_FORCE_STOP, false);
                startService(i);
            }
        }
    });

    mSoundToggle = (ImageButton) findViewById(R.id.ic_media_control_volume_btn);
    AudioManager audio = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
    int currentVolume = audio.getStreamVolume(AudioManager.STREAM_MUSIC);
    int maxVolume = audio.getStreamMaxVolume(AudioManager.STREAM_MUSIC);
    if (currentVolume <= 0) {
        mSoundToggle.setBackgroundResource(R.drawable.ic_button_radio_sound_off);
    } else {
        mSoundToggle.setBackgroundResource(R.drawable.ic_button_radio_sound_on);
    }
    mSoundToggle.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            AudioManager audio = (AudioManager) getSystemService(Context.AUDIO_SERVICE);

            if (audio.getStreamVolume(AudioManager.STREAM_MUSIC) <= 0) {
                if (mSoundTogglePreviousValue > 0) {
                    audio.setStreamVolume(AudioManager.STREAM_MUSIC, mSoundTogglePreviousValue,
                            AudioManager.FLAG_PLAY_SOUND);
                } else {
                    mSoundTogglePreviousValue = 1;
                    audio.setStreamVolume(AudioManager.STREAM_MUSIC, mSoundTogglePreviousValue,
                            AudioManager.FLAG_PLAY_SOUND);
                }
                mSoundToggle.setBackgroundResource(R.drawable.ic_button_radio_sound_on);
                mSeekbar.setProgress(mSoundTogglePreviousValue);
                mSoundTogglePreviousValue = -1;
            } else {
                mSoundTogglePreviousValue = audio.getStreamVolume(AudioManager.STREAM_MUSIC);
                audio.setStreamVolume(AudioManager.STREAM_MUSIC, 0, AudioManager.FLAG_PLAY_SOUND);
                mSoundToggle.setBackgroundResource(R.drawable.ic_button_radio_sound_off);
            }
        }
    });

    mSeekbar = (SeekBar) findViewById(R.id.ic_media_control_volume_seek);
    mSeekbar.setMax(maxVolume);
    mSeekbar.setProgress(currentVolume);
    mSeekbar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
        @Override
        public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
            if (fromUser) {
                mSoundTogglePreviousValue = -1;
                AudioManager audio = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
                audio.setStreamVolume(AudioManager.STREAM_MUSIC, progress, AudioManager.FLAG_PLAY_SOUND);
            }
        }

        @Override
        public void onStartTrackingTouch(SeekBar seekBar) {

        }

        @Override
        public void onStopTrackingTouch(SeekBar seekBar) {

        }
    });

    getRadioChannelTask = new GetRadioChannelTask();
    if (getRadioChannelTask != null) {
        getRadioChannelTask.setBroadcastApiData(this, mHandler,
                mShortcutData.getDomain() + mShortcutData.getPath());
        mIsExecuteGetRadioChannelTask = true;
        getRadioChannelTask.execute();
    }
}

From source file:com.nbplus.vbroadlauncher.RealtimeBroadcastActivity.java

private void finishActivity() {
    Log.d(TAG, "finishActivity()");
    runOnUiThread(new Runnable() {
        @Override//from w ww.  j a  va 2s  .  c  o  m
        public void run() {
            LauncherSettings.getInstance(getApplicationContext()).setCurrentPlayingBroadcastType(null);

            overridePendingTransition(R.anim.fade_in, R.anim.fade_out);
            if (mText2Speech != null) {
                mText2Speech.shutdown();
            }
            mText2Speech = null;
            mText2SpeechHandler = null;
            mBroadcastPayloadIdx = -1;

            if (mWebView != null) {
                mWebView.removeAllViews();
                mWebView.destroy();
            }
            mWebViewClient = null;
            mWebView = null;
            LocalBroadcastManager.getInstance(getApplicationContext()).unregisterReceiver(mBroadcastReceiver);
            unregisterReceiver(mBroadcastReceiver);

            releaseCpuLock();
            runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    showSystemUI();
                }
            });

            AudioManager audio = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
            audio.setStreamVolume(AudioManager.STREAM_MUSIC, mStreamMusicVolume, AudioManager.FLAG_PLAY_SOUND);

            //finish();
            Log.e(TAG, "RealtimeBroadcastActivity.java call System.exit(0)");
            System.exit(0);
        }
    });
}

From source file:com.plusot.senselib.SenseMain.java

@Override
public boolean dispatchKeyEvent(KeyEvent event) {
    final int action = event.getAction();
    final int keyCode = event.getKeyCode();
    boolean result = false;

    if ((lastAction == action && lastKeyCode == keyCode)) {
        switch (keyCode) {
        case KeyEvent.KEYCODE_CAMERA:
            newInterval();// ww w  .  j a v  a2 s . c  om
            break;
        case KeyEvent.KEYCODE_POWER:
            //if (action == KeyEvent.)
            LLog.d(Globals.TAG, CLASSTAG + " Power button pressed");
            break;
        case KeyEvent.KEYCODE_VOLUME_UP:
            if (action == KeyEvent.ACTION_DOWN) {
                dimScreen(true);
            }
            result = true;
            break;
        case KeyEvent.KEYCODE_VOLUME_DOWN:
            if (action == KeyEvent.ACTION_DOWN) {
                dimScreen(false);
            }
            result = true;
            break;
        }
    } else {
        AudioManager mgr = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
        switch (keyCode) {
        case KeyEvent.KEYCODE_CAMERA:
            newInterval();
            break;
        case KeyEvent.KEYCODE_VOLUME_UP:
            if (sameActionKeyCode < 2 && lastAction == KeyEvent.ACTION_DOWN && action == KeyEvent.ACTION_UP
                    && lastKeyCode == KeyEvent.KEYCODE_VOLUME_UP) {
                mgr.adjustStreamVolume(AudioManager.STREAM_MUSIC, AudioManager.ADJUST_RAISE,
                        AudioManager.FLAG_SHOW_UI | AudioManager.FLAG_PLAY_SOUND);
            }
            result = true;
            break;
        case KeyEvent.KEYCODE_VOLUME_DOWN:
            if (sameActionKeyCode < 2 && lastAction == KeyEvent.ACTION_DOWN && action == KeyEvent.ACTION_UP
                    && lastKeyCode == KeyEvent.KEYCODE_VOLUME_DOWN) {
                mgr.adjustStreamVolume(AudioManager.STREAM_MUSIC, AudioManager.ADJUST_LOWER,
                        AudioManager.FLAG_SHOW_UI | AudioManager.FLAG_PLAY_SOUND);
            }
            result = true;
            break;
        }
    }
    if (!result) {
        // LLog.d(Globals.TAG, CLASSTAG +
        // ".distpatchKeyEvent: Calling super with " + delta);
        result = super.dispatchKeyEvent(event);
    }
    if (lastAction == action && lastKeyCode == keyCode) {
        sameActionKeyCode++;
    } else
        sameActionKeyCode = 0;

    lastKeyCode = keyCode;
    lastAction = action;
    return result;

}