google-code-export / openeve

Automatically exported from code.google.com/p/openeve
0 stars 1 forks source link

Music button works even if screen is locked #22

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.Turn off the screen of your Eve
2.Press physical music botton
3.Music starts

What is the expected output? What do you see instead?
if the screen is off and the music application is closed, music couldn't start.

What version of the product are you using?
Gingerbread with last patch

Please provide any additional information below.
this is the same issue here:

http://code.google.com/p/openetna/issues/detail?id=303&can=1&q=music%20button&co
lspec=ID%20Type%20Status%20Priority%20Owner%20Summary%20Modified

Original issue reported on code.google.com by andreabe...@gmail.com on 13 Apr 2011 at 1:59

GoogleCodeExporter commented 9 years ago
in my case , this is not an Issue , it's a benefit !

Original comment by justsad.eng@gmail.com on 13 Apr 2011 at 2:01

GoogleCodeExporter commented 9 years ago
you're at the office talking to your chief, you've Eve in your pocket, 
unfortunately music button is pressed and your hard rock song starts.

It's a real benefit? :) 

Original comment by andreabe...@gmail.com on 13 Apr 2011 at 2:04

GoogleCodeExporter commented 9 years ago
sorry, i didn't read all above carefully , you are right cause (music 
application is closed)!!
sorry again man ..

Original comment by justsad.eng@gmail.com on 13 Apr 2011 at 2:07

GoogleCodeExporter commented 9 years ago
https://github.com/OpenEtna/android_frameworks_policies_base/commit/f69f61d70468
d60e8e283e5afd1fb3808f61a183

but It seems to me a little hackish.

Original comment by wkp...@gmail.com on 13 Apr 2011 at 2:36

GoogleCodeExporter commented 9 years ago
Just like last time with OpenEtna, I would ask that this be made a switchable 
option, because I like this feature.
I would rather be able to choose if I want this function to work or not, not 
have it forced disabled.

Original comment by rais...@gmail.com on 13 Apr 2011 at 6:05

GoogleCodeExporter commented 9 years ago

Original comment by wkp...@gmail.com on 15 Apr 2011 at 2:26

GoogleCodeExporter commented 9 years ago
In OpenEtna this was happening too..

Original comment by lfg.1...@gmail.com on 17 Apr 2011 at 10:44

GoogleCodeExporter commented 9 years ago
there is a workaround.

you can disable music button by editing /system/usr/eve_qwerty.kl:

 comment out the following like
 ...
 #key 202   MEDIA_PLAY_PAUSE
 ..

Original comment by wkp...@gmail.com on 30 Apr 2011 at 11:29

GoogleCodeExporter commented 9 years ago
--- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
+++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
@@ -1941,6 +1941,20 @@ public class PhoneWindowManager implements 
WindowManagerPolicy {
     }

     /**
+     * @return Whether headset or bluetooth is being used.
+     */
+    boolean isWired() {
+        final AudioManager am = 
(AudioManager)mContext.getSystemService(Context.AUDIO_SERVICE);
+        if (am == null) {
+            return false;
+        }
+        if (am.isWiredHeadsetOn() || am.isBluetoothA2dpOn()) {
+            return true;
+        }
+        return false;
+    }
+
+    /**
      * Tell the audio service to adjust the volume appropriate to the event.
      * @param keycode
      */
@@ -2058,6 +2072,10 @@ public class PhoneWindowManager implements 
WindowManagerPolicy {
                     result |= ACTION_POKE_USER_ACTIVITY;
                 }
             }
+            if (down && (policyFlags & WindowManagerPolicy.FLAG_WAKE_DROPPED) 
!= 0) {
+                // ignore
+                if (!isWired()) return result;
+            }
         }

         // Handle special keys.

Original comment by wkp...@gmail.com on 30 Apr 2011 at 2:49

GoogleCodeExporter commented 9 years ago
above patch do not work. this is fixed patch.

--- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
+++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
@@ -2017,6 +2017,20 @@ public class PhoneWindowManager implements 
WindowManagerPolicy {
     }

     /**
+     * @return Whether headset or bluetooth is being used.
+     */
+    boolean isWired() {
+        final AudioManager am = 
(AudioManager)mContext.getSystemService(Context.AUDIO_SERVICE);
+        if (am == null) {
+            return false;
+        }
+        if (am.isWiredHeadsetOn() || am.isBluetoothA2dpOn()) {
+            return true;
+        }
+        return false;
+    }
+
+    /**
      * Tell the audio service to adjust the volume appropriate to the event.
      * @param keycode
      */
@@ -2134,6 +2148,10 @@ public class PhoneWindowManager implements 
WindowManagerPolicy {
                     result |= ACTION_POKE_USER_ACTIVITY;
                 }
             }
+
+            if (down && keyCode == KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE) {
+                if (!isWired()) return result;
+            }
         }

         // Handle special keys.

Original comment by wkp...@gmail.com on 12 May 2011 at 9:57

GoogleCodeExporter commented 9 years ago

Original comment by wkp...@gmail.com on 21 May 2011 at 5:15

GoogleCodeExporter commented 9 years ago

Original comment by wkp...@gmail.com on 29 May 2011 at 12:58