diff options
Diffstat (limited to 'services')
-rw-r--r-- | services/java/com/android/server/HeadsetObserver.java | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/services/java/com/android/server/HeadsetObserver.java b/services/java/com/android/server/HeadsetObserver.java index 9b0a2d4..0742cae 100644 --- a/services/java/com/android/server/HeadsetObserver.java +++ b/services/java/com/android/server/HeadsetObserver.java @@ -97,7 +97,7 @@ class HeadsetObserver extends UEventObserver { private synchronized final void update(String newName, int newState) { if (newName != mHeadsetName || newState != mHeadsetState) { - boolean isUnplug = (newState == 0 && mHeadsetState == 1); + boolean isUnplug = (newState == 0 && mHeadsetState > 0); mHeadsetName = newName; mHeadsetState = newState; mAudioRouteNeedsUpdate = true; @@ -123,7 +123,7 @@ class HeadsetObserver extends UEventObserver { Intent intent = new Intent(Intent.ACTION_HEADSET_PLUG); intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY); - intent.putExtra("state", mHeadsetState); + intent.putExtra("state", isUnplug ? 0 : 1); intent.putExtra("name", mHeadsetName); // TODO: Should we require a permission? @@ -137,7 +137,7 @@ class HeadsetObserver extends UEventObserver { private synchronized final void updateAudioRoute() { if (mAudioRouteNeedsUpdate) { - mAudioManager.setWiredHeadsetOn(mHeadsetState == 1); + mAudioManager.setWiredHeadsetOn(mHeadsetState > 0); mAudioRouteNeedsUpdate = false; } } |