My application uses proximity sensor with following code:
public class WakeLockHelper {
static final String WAKE_LOCK_STR = "My.WakeLockHelper";
static final int PROXIMITY_SCREEN_OFF_WAKE_LOCK = 32;
private static WakeLock mScreenLock = null;
private static WakeLock doWakeLock( final WakeLock inputWl, int flags, boolean lock ) {
try {
WakeLock wl = inputWl;
if ( lock ) {
if ( wl == null ) {
PowerManager pm = (PowerManager) SJPhone.getContext().getSystemService( Context.POWER_SERVICE );
wl = pm.newWakeLock( flags, WAKE_LOCK_STR );
wl.setReferenceCounted( false );
wl.acquire();
}
}
else {
if ( wl != null ) {
wl.release();
if ( !wl.isHeld() ) {
wl = null;
}
}
}
return wl;
}
catch ( Exception e ) {
Log.e( e );
}
return null;
}
public static synchronized void screenLock( boolean lock ) {
mScreenLock = doWakeLock( mScreenLock, PROXIMITY_SCREEN_OFF_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP, lock );
}
}
Everything works fine, but only on one device, Lenovo Tablet K1 I receive a lot of errors in logcat like this:
04-17 15:11:34.450 E/Sensors ( 162): proximity file handle not opened
04-17 15:11:34.450 E/Sensors ( 162): proximity file handle not opened
Does anyone know what is this and how can it be avoided?