diff options
Diffstat (limited to 'media')
-rw-r--r-- | media/java/android/media/AudioManager.java | 38 |
1 files changed, 11 insertions, 27 deletions
diff --git a/media/java/android/media/AudioManager.java b/media/java/android/media/AudioManager.java index ac2588d..f55a0bb 100644 --- a/media/java/android/media/AudioManager.java +++ b/media/java/android/media/AudioManager.java @@ -36,9 +36,7 @@ import android.os.ServiceManager; import android.provider.Settings; import android.util.Log; import android.view.KeyEvent; -import android.view.Surface; import android.view.VolumePanel; -import android.view.WindowManager; import java.util.HashMap; @@ -56,7 +54,6 @@ public class AudioManager { private final boolean mUseVolumeKeySounds; private static String TAG = "AudioManager"; private final ProfileManager mProfileManager; - private final WindowManager mWindowManager; /** * Broadcast intent, a hint for applications that audio is about to become @@ -429,7 +426,6 @@ public class AudioManager { mUseVolumeKeySounds = mContext.getResources().getBoolean( com.android.internal.R.bool.config_useVolumeKeySounds); mProfileManager = (ProfileManager) context.getSystemService(Context.PROFILE_SERVICE); - mWindowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); } private static IAudioService getService() @@ -480,33 +476,21 @@ public class AudioManager { * Adjust the volume in on key down since it is more * responsive to the user. */ - int direction; - int swapKeys = Settings.System.getInt(mContext.getContentResolver(), - Settings.System.SWAP_VOLUME_KEYS_ON_ROTATION, 0); - int rotation = mWindowManager.getDefaultDisplay().getRotation(); - if (swapKeys == 1 // phone or hybrid - && (rotation == Surface.ROTATION_90 - || rotation == Surface.ROTATION_180)) { - direction = keyCode == KeyEvent.KEYCODE_VOLUME_UP - ? ADJUST_LOWER - : ADJUST_RAISE; - } else if (swapKeys == 2 // tablet - && (rotation == Surface.ROTATION_180 - || rotation == Surface.ROTATION_270)) { - direction = keyCode == KeyEvent.KEYCODE_VOLUME_UP - ? ADJUST_LOWER - : ADJUST_RAISE; - } else { - direction = keyCode == KeyEvent.KEYCODE_VOLUME_UP - ? ADJUST_RAISE - : ADJUST_LOWER; - } int flags = FLAG_SHOW_UI | FLAG_VIBRATE; if (mUseMasterVolume) { - adjustMasterVolume(direction, flags); + adjustMasterVolume( + keyCode == KeyEvent.KEYCODE_VOLUME_UP + ? ADJUST_RAISE + : ADJUST_LOWER, + flags); } else { - adjustSuggestedStreamVolume(direction, stream, flags); + adjustSuggestedStreamVolume( + keyCode == KeyEvent.KEYCODE_VOLUME_UP + ? ADJUST_RAISE + : ADJUST_LOWER, + stream, + flags); } break; case KeyEvent.KEYCODE_VOLUME_MUTE: |