[Q] Replacing sensor values - C++ or Other Android Development Languages

Hi,
I need to somehow be able to replace the sensor values taken from the devices HW sensors, and replace them by other values ( taken from file for example .. ) . I doubt that this change can be done using the SDK and it needs lower development. any one has any idea of any possible way this can be achieved ? changing kernel / changing system files ?

If you mean to replace the real time sensor values with the values you want, it might be gonna tricky I guess. I had the same idea before but was failed. Good luck and sorry I can't help.
Everything is Permitted?

Related

[Q] Corrupted graphics in emulator when loading backed-up system.img from U20i

Hello,
I tried posting this to the development forum, however since it's my first post I ended up here, so I'm sorry if this seems a bit off topic. Anyway, hi and thanks for having me
Now, what I've been trying to do is load a (backed-up) stock Xperia X10 Mini Pro (U20i) 2.1.1.A.0.6 system.img into the Android SDK Emulator. The problem is I get a corrupted image like the one in the screen shot, here:
imageshack.us/photo/my-images/32/u20iscreen.png
I'm not sure what's causing this, I can only guess that it's a bad screen configuration parameter, so I hoped someone here might have the solution.
I know it's not the system.img, cause I've tried several of them and ended up with the same results, and it's not my OS/SDK/... setup, because without the system.img the emulator works fine.
Here's my avd config:
Code:
hw.dPad=no
hw.lcd.density=160
hw.camera.maxHorizontalPixels=2592
hw.cpu.arch=arm
sdcard.size=512M
hw.camera=yes
hw.gpu.enabled=yes
hw.touchScreen=yes
skin.path=platforms\android-7\skins\QVGA
hw.keyboard.lid=yes
hw.keyboard=yes
hw.lcd.depth=16
hw.ramSize=176
hw.sensors.magnetic_field=yes
hw.sdCard=yes
hw.mainKeys=yes
hw.accelerometer=yes
hw.lcd.height=320
skin.name=QVGA
abi.type=armeabi
hw.audioOutput=yes
hw.trackBall=no
hw.camera.maxVerticalPixels=1944
hw.battery=yes
image.sysdir.1=platforms\android-7\images\
hw.audioInput=yes
hw.sensors.orientation=yes
hw.gps=yes
hw.lcd.width=240
vm.heapSize=24
So, do you see anything wrong with this? Maybe the LCD parameters are wrong? I really don't know
Anyway, ask if you need any more info and thanks in advance
Partially solved
Well, after another hour of trial and error I managed to get it working
Setting the resolution to 320x480 fixed the graphics corruption problem and, although stretched, the emulated screen is now usable. Also, setting the LCD density to 320 really improved the image.
For my purposes (safely testing themes) this is close enough, but I would really appreciate it if someone found the right way of doing this.
Here's the working adv config in case anyone needs it. I'll keep trying, but please let me know if you find the correct screen parameters.
Code:
hw.lcd.density=320
hw.dPad=no
hw.camera.maxHorizontalPixels=2592
sdcard.size=512M
hw.cpu.arch=arm
hw.camera=yes
hw.gpu.enabled=yes
hw.touchScreen=yes
skin.path=320x480
hw.keyboard.lid=yes
hw.keyboard=yes
hw.lcd.depth=16
hw.ramSize=176
hw.sensors.magnetic_field=yes
hw.sdCard=yes
hw.mainKeys=yes
hw.accelerometer=yes
skin.name=320x480
abi.type=armeabi
hw.audioOutput=yes
hw.trackBall=no
hw.camera.maxVerticalPixels=1944
hw.battery=yes
image.sysdir.1=platforms\android-7\images\
hw.lcd.backlight=yes
hw.audioInput=yes
hw.sensors.orientation=yes
hw.gps=yes
vm.heapSize=24

Editing in software individualthings

Hi masters!
I read a lot about editing software but i've special challange so here we go...
1. We've got flashtool and soft for device on android and we want to change text under icon camera in menu from "Camre" to "Camera"(little mistake in china). I know that it's simple but i want to know how to do it in professional way.
2. When we install software on our device1 picture is project on lcd in wrong resolution. We know that correct driver for our lcd is in software for device2 so we need to take this form device2 and replace it in software for device1. I can send a good and tasty bootle of vodka for this help. I'm waiting

LK.BIN can be modified?

Stock KK rom for my phone have a big problem in LK.BIN module, LCD driver is not choice correctly.
I opened the file with a binary editor and i can see there are 3 LCD driver included the correct driver for my display, but auto detection choice the wrong one, so only random lines appear on screen.
There is a way to modify LK.BIN to remove the wrong driver and leave only the correct one?
Or there is a way to force manual detection of display driver?
ilmira said:
Stock KK rom for my phone have a big problem in LK.BIN module, LCD driver is not choice correctly.
I opened the file with a binary editor and i can see there are 3 LCD driver included the correct driver for my display, but auto detection choice the wrong one, so only random lines appear on screen.
There is a way to modify LK.BIN to remove the wrong driver and leave only the correct one?
Or there is a way to force manual detection of display driver?
Click to expand...
Click to collapse
I would recommend taking a look at this article, which also deals with modifying the little kernel binary file. If you can figure out what lines are dealing with the other display drivers and comment them out or remove them, another resource would be this online dissembler that tells you what's going on in the code. As always make a backup of the unmodified file and be very careful as you could modify the file to the point where the phone won't boot or display anything at all.
thanks a lot for your answer, but there isn't any useful info in links you gave me.
what else i can try ?
ilmira said:
thanks a lot for your answer, but there isn't any useful info in links you gave me.
what else i can try ?
Click to expand...
Click to collapse
What is the model and manufacturer of your device?
shimp208 said:
What is the model and manufacturer of your device?
Click to expand...
Click to collapse
my device is a Mediatek based phone, model Doogee DG2014
No other ideas?
ilmira said:
No other ideas?
Click to expand...
Click to collapse
Sorry for the delay in getting back to you another idea would be going into the engineering device menu from the dial pad and seeing if you change things that way sometimes you can do it that way.
Are you sure there is an option to select LCD driver inside engineer mode menu ?
ilmira said:
Are you sure there is an option to select LCD driver inside engineer mode menu ?
Click to expand...
Click to collapse
Other people have mentioned similar options before on Mediatek based devices however sometimes not all engineering mode menu items can be used.

Nexus 5 with CM 13 ultimate nightly System where the wifi keeps reconnecting?!!

After I rooted the device then I found that my phone keeps reconnecting whatever the screen is Locked or unlocked.
I found it could be something wrong with Wifi Powersave mode but i cant tell where I could find the code.
Or something related code that caused my problem
So I tried to change the values from the file
/etc/wifi/
when I change too much value that include the scanning rate(I set it as zero,never to scan automatically)
now,it is rare to see the problem happen but it sometime stills.
I need really guidence with professional knowledge of Coding on android.
Need u to tell me hope to change the Code inside the files that controls Wi-Fi.
and pls,avoid telling me that Enable the old-version DHCP in the Dev. settings.
or something seems simple method,that of all I tried and didn't work.
Come to give me the professional,thank you all,the ones who gonna help me!

Using a .so file in an android app? How can I access the hardware depth sensor on my (rooted) phone?

I'm building an application that requires the use of the depth sensor on my Samsung Galaxy A80. However it seems like it's impossible to access it through Camera2 and ARCore. I asked Samsung directly and the tech support guys best guess was that Samsung has locked it from being used by third parties.
I rooted my phone and started digging through the file system and eventually found a file called 'com.samsung.sensor.imx316.so' located in /vendor/lib/camera (imx316 is the depth sensor). There are also some similar files that ends in '.bin', but .so files seems to be runnable code if I understood the google results correctly.
That file has the same name as the sensor I can't seem to access. Can this file be used somehow? Can I run it in my own app to get access to the depth data? And if not, there should be a way of getting that data right? I mean, it obviously exists somewhere in the phone since pre-installed apps are using it, and a rooted phone has access to everything?
Did you check REQUEST_AVAILABLE_CAPABILITIES_DEPTH_OUTPUT? How do you know it's impossible?
Most likely you need to reverse engineer the Camera app from your phone.
Your app can call com.samsung.sensor.imx316.so , it's really "just" a linux elf library.
The problem you face is the exported routines from the library, you won't really know
1) the parameters to the functions inside the library
2) any specific order to call functions inside the library i.e. like an init function first , release memory last...
You need to disassemble / reverse engineer the library to make some sense of it (see ghidra / radare2/ ida pro etc ).
Use strace on the current process/app which uses the library to make some sense of the order of calls into the library.
The depth data will be coming from a kernel level driver, you can likely obtain the Samsung kernel source and the driver source should be there. Then it's up to you whether you can make user space library/code to read what the driver exposes. The kernel driver source code will have an uapi header file to investigate.
idk if it helps but i used for a Huawei P30 Pro this https://github.com/Nufflee/tof-camera

Categories

Resources