1. Are you ready for the Galaxy S20? Here is everything we know so far!

Can I change sensor delay by changing Android OS code and recompiling

Discussion in 'Android Development' started by hyababa, Jun 19, 2020.

  1. hyababa

    hyababa Lurker
    Thread Starter

    Hi there, I have a requirement to get a faster barometer update rate on a phone (S10) or really any device with a barometer, and I'm wanting to know I can I do that by changing the Android code.

    Ive used sensorManager.registerListener() to toggle through all the preset delays (SENSOR_DELAY_NORMAL etc..) and have even tried typing in my own delay in us.

    I think the issue is that chip is limited somehow in the Android OS, as I when I get the chip data from debugger:

    {Sensor name="LPS22HH Barometer", vendor="STMicro", version=514, type=6, maxRange=1260.0, resolution=2.0E-4, power=0.275, minDelay=40000}

    I see the minDelay is 40,000us which is about the limit I currently get, around 25 Hz.

    If I look at the LPS22HH chip spec sheet I see its capable of supplying a much faster update rate.


    If I learn how to recompile the Android OS, can I configure the registers on the chip to get a faster update rate?

    - Ramp on learning how to compile the Android OS.
    - Some other aspect of the Android OS that may be limiting the update rate that I will have zippo control over OS recompile or not.

    Thanks for any response!

    1. Download the Forums for Android™ app!


  2. Hadron

    Hadron Smoke me a kipper...
    VIP Member

    Firstly, which type of S10 do you have? If it's a North American model (Snapdragon SoC) chances are the question is irrelevant: it will be locked down so hard that you won't have the option of replacing the OS.

    Secondly, sorry, I don't know. It might be something in the kernel (in principle changeable if you can get the source code - which depends on Samsung's adherence to the GPL) or it might be in the lower-level firmware (basically forget it). I'd suggest visiting the xda-developers forum section for your device and seeing what the options are for modifying the system software, remembering that they will be different for Exynos and Snapdragon versions of the phone.

    I would ask what your application is that requires > 25Hz refresh on a barometer sensor? Given the limited accuracy of these things if you were falling fast enough for that to be the limitation the landing would be a much bigger problem... ;)
    hyababa likes this.
  3. hyababa

    hyababa Lurker
    Thread Starter

    @Hadron thank you very much for the speedy response. It is a NA phone, so I should have asked for recommendations on where else to ask the question and appreciate you pointing out xda-developers. Thankfully not falling not yet. Cheers.

Share This Page