summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorRicardo Cerqueira <cyanogenmod@cerqueira.org>2013-09-21 01:47:20 +0000
committerGerrit Code Review <gerrit@cyanogenmod.org>2013-09-21 01:47:20 +0000
commiteccf4c58216db212787545f95e56d0082a52b34a (patch)
treec8d01b3130518fbb04cc105d50d194d46f4621a3 /media
parent1311a90e4adf82702e3eef17f20a487e1f14deb6 (diff)
parent22a4d65f66a6155a60d77a22922c195fb22a1bd6 (diff)
downloadframeworks_base-eccf4c58216db212787545f95e56d0082a52b34a.zip
frameworks_base-eccf4c58216db212787545f95e56d0082a52b34a.tar.gz
frameworks_base-eccf4c58216db212787545f95e56d0082a52b34a.tar.bz2
Merge "Re-implement orientation aware volume buttons at lower level" into cm-10.1
Diffstat (limited to 'media')
-rw-r--r--media/java/android/media/AudioManager.java38
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: