@SuppressWarnings("deprecation") private void handleScreenOff(){
  mSpeechController.setScreenIsOn(false);
  mMenuManager.dismissAll();
  final SpannableStringBuilder builder=new SpannableStringBuilder(mContext.getString(R.string.value_screen_off));
  if (isIdle()) {
    appendRingerStateAnnouncement(builder);
  }
  mShakeDetector.pausePolling();
  if (mRingerMode == AudioManager.RINGER_MODE_NORMAL) {
    final int soundId;
    final float volume;
    final float musicVolume=getStreamVolume(AudioManager.STREAM_MUSIC);
    if ((musicVolume > 0) && (mAudioManager.isWiredHeadsetOn() || mAudioManager.isBluetoothA2dpOn())) {
      final float ringVolume=getStreamVolume(AudioManager.STREAM_RING);
      soundId=R.raw.volume_beep;
      volume=Math.min(1.0f,(ringVolume / musicVolume));
    }
 else {
      soundId=R.raw.volume_beep;
      volume=1.0f;
    }
    mFeedbackController.playAuditory(soundId,1.0f,volume);
  }
  mSpeechController.speak(builder,SpeechController.QUEUE_MODE_INTERRUPT,FeedbackItem.FLAG_NO_HISTORY,null);
}

@ SuppressWarnings ( "deprecation" ) private void handleScreenOff ( ) { mSpeechController . setScreenIsOn ( false ) ; mMenuManager . dismissAll ( ) ; final SpannableStringBuilder builder = new SpannableStringBuilder ( mContext . getString ( R . string . value_screen_off ) ) ; if ( isIdle ( ) ) { appendRingerStateAnnouncement ( builder ) ; } mShakeDetector . pausePolling ( ) ; if ( mRingerMode == AudioManager . RINGER_MODE_NORMAL ) { final int soundId ; final float volume ; final float musicVolume = getStreamVolume ( AudioManager . STREAM_MUSIC ) ; if ( ( musicVolume > 0 ) && ( mAudioManager . isWiredHeadsetOn ( ) || mAudioManager . isBluetoothA2dpOn ( ) ) ) { final float ringVolume = getStreamVolume ( AudioManager . STREAM_RING ) ; soundId = R . raw . volume_beep ; volume = Math . min ( 1.0f , ( ringVolume / musicVolume ) ) ; } else { soundId = R . raw . volume_beep ; volume = 1.0f ; } mFeedbackController . playAuditory ( soundId , 1.0f , volume ) ; } mSpeechController . speak ( builder , SpeechController . QUEUE_MODE_INTERRUPT , FeedbackItem . FLAG_NO_HISTORY , null ) ; }
handles when the screen is turned off . announces " screen off " and suspends the proximity sensor .
