android - Touch event UP being fired when not supposed to, after using "PROXIMITY_SCREEN_OFF_WAKE_LOCK" wakelock -
I have a very strange solitary problem I (running on the device, Motorola XT910 android 4.1.2, Xamerina Android 4.16 .0)
I have an activity with a button that the user records some audio to the press. I handle touch events and listen to events in Down and UP (I start recording down here, I block it on UP). So far, so good. Now, when I keep the device in my ear, I also handle the event with sensor changes to close the screen. I received it by using a wakelock like this:
Private Zero AcquireScreenWakeLock () {if (ScreenWakeLock == zero) {PowerManager pm = (PowerManager) GetSystemService (Context.PowerService); Field = pm.Class.GetField ("PROXIMITY_SCREEN_OFF_WAKE_LOCK") GetInt (empty); Screenwalk = pm.NewWakeLock ("WakeLockFlags" field, "Screenwalk Lock"); Screenwalk Lock Assessed (); } Private Zero releaseScreenWalk lock () {if (ScreenWakeLock == empty) return; Lock screenwalk (Screenwalk Lock. ISHld) Release (); }
The problem occurs when the button is pressed to record immediately after the suppressing event, I get a UP event without lifting my finger ... Of course, other things What I do in the middle but I managed to reduce this code with this problem (if I comment it, works as expected).
I know I'm using hidden fields to wake up (in fact it seems to have been released in API 21, Docs), but I'm not a better way to do this It is a problem, and the whole screen works erroneously on the shutdown / process. I am having this problem while testing on Motorola XT 910 Android 4.1.2 running, I tested it on Moto G running on Android 4.4.4 The analysis and everything works fine (the button is not removed any state events when pressed).
I am really in a disadvantage, so that can be detected ... how can one be a cause for this behavior? Do you have any other way to effectively turn / off the screen? I have searched other posts, but no one does not help me using partial wakelock either (I have checked with this) does not work in advance thanks!
PS: I have checked and the touch event is only being registered once.
PROXIMITY_SCREEN_OFF_WAKE_LOCK
automatically turns the screen on / off according to the nearest state Even the code does not have to be handled. onSensorChanged
event may be a problem.
Comments
Post a Comment