diff options
author | RoboErik <epastern@google.com> | 2014-06-16 14:00:48 -0700 |
---|---|---|
committer | RoboErik <epastern@google.com> | 2014-06-19 10:37:00 -0700 |
commit | d3c8642dae9a1f6db60e2f8e5c7b32cd1b3169df (patch) | |
tree | 8bad91681f0c47e401482db95f630ed6edf4d139 /packages/Keyguard | |
parent | 150bfcd73d53cd824b4ab20161a3d87710ce259b (diff) | |
download | frameworks_base-d3c8642dae9a1f6db60e2f8e5c7b32cd1b3169df.zip frameworks_base-d3c8642dae9a1f6db60e2f8e5c7b32cd1b3169df.tar.gz frameworks_base-d3c8642dae9a1f6db60e2f8e5c7b32cd1b3169df.tar.bz2 |
Remove some more old code and fix Media command
Removes some more hidden apis from AudioService/Manager. This also
fixes up Media.java to support commands for the new service to help
with debugging. Also fixes a couple bugs that were found while fixing
up Media.
Change-Id: I68e4aa80a4de430b98236aafc883664b9432c62b
Diffstat (limited to 'packages/Keyguard')
-rw-r--r-- | packages/Keyguard/src/com/android/keyguard/KeyguardViewBase.java | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardViewBase.java b/packages/Keyguard/src/com/android/keyguard/KeyguardViewBase.java index 3e444fa..8945b15 100644 --- a/packages/Keyguard/src/com/android/keyguard/KeyguardViewBase.java +++ b/packages/Keyguard/src/com/android/keyguard/KeyguardViewBase.java @@ -341,11 +341,11 @@ public abstract class KeyguardViewBase extends FrameLayout implements SecurityCa } // Volume buttons should only function for music (local or remote). // TODO: Actually handle MUTE. - mAudioManager.adjustLocalOrRemoteStreamVolume( - AudioManager.STREAM_MUSIC, + mAudioManager.adjustSuggestedStreamVolume( keyCode == KeyEvent.KEYCODE_VOLUME_UP ? AudioManager.ADJUST_RAISE - : AudioManager.ADJUST_LOWER); + : AudioManager.ADJUST_LOWER /* direction */, + AudioManager.STREAM_MUSIC /* stream */, 0 /* flags */); // Don't execute default volume behavior return true; } else { @@ -376,17 +376,13 @@ public abstract class KeyguardViewBase extends FrameLayout implements SecurityCa } private void handleMediaKeyEvent(KeyEvent keyEvent) { - IAudioService audioService = IAudioService.Stub.asInterface( - ServiceManager.checkService(Context.AUDIO_SERVICE)); - if (audioService != null) { - try { - audioService.dispatchMediaKeyEvent(keyEvent); - } catch (RemoteException e) { - Log.e("KeyguardViewBase", "dispatchMediaKeyEvent threw exception " + e); + synchronized (this) { + if (mAudioManager == null) { + mAudioManager = (AudioManager) getContext().getSystemService( + Context.AUDIO_SERVICE); } - } else { - Slog.w("KeyguardViewBase", "Unable to find IAudioService for media key event"); } + mAudioManager.dispatchMediaKeyEvent(keyEvent); } @Override |