Reading from Serial port in Android - Android Q&A, Help & Troubleshooting

Hi, I was following this tutorial to read from Serial ports in Android which is based on this google api. I don't want to read from USB because it was having some issues.
But it seems from android latest versions (after 4.4 and onwards) you can't have access to serial ports without rooting :
Code:
2021-07-15 10:37:47.975 7507-7507/com.example.serialjni D/serial_port: init native Opening device!
2021-07-15 10:37:47.975 7507-7507/com.example.serialjni D/serial_port: Opening serial port /dev/ttyMT1
2021-07-15 10:37:47.972 7507-7507/com.example.serialjni I/ample.serialjni: type=1400 audit(0.0:645): avc: denied { read write } for name="ttyMT1" dev="tmpfs" ino=7393 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:ttyMT_device:s0 tclass=chr_file permissive=1
2021-07-15 10:37:47.972 7507-7507/com.example.serialjni I/ample.serialjni: type=1400 audit(0.0:646): avc: denied { open } for path="/dev/ttyMT1" dev="tmpfs" ino=7393 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:ttyMT_device:s0 tclass=chr_file permissive=1
In other questions I have found that enabling SELinux mode might work. But the app I tried with SELinuxModeChanger doesn't work (it shows both button as grayed out). My understanding is that the android device needs to be rooted. But it's a chinese car autoradio and it might become unusable as there are many custom things. Is there any other way to read serial without going root ?
Thanks for your help in advance.

Related

[Solved] Google Maps Navigation can't fix position and poor GPS reception

Hello everyone. I've got a problem with Google Maps Navigation. I think it's an app bug because its' very strange.
GPS Data, Here Maps and Google Maps can fix position.
But when I switch to Navigation mode in Google Map, the app loose satellites and can not fix.
As soon as I exit Navigation mode to come back to Maps mode, the fixed satellites increase.
Please does someone have the same bug?
I've cleaned every caches, restored ROM backup and now I'm on a clean installation of CM 12.1 (2016-02-03) and the position bug is still there.
I think I will go crazy. I've installed Waze and it works! Reception is not very good but he can guide me. Only Google Navigation does not work anymore. :crying:
So, that seems to be a hardware problem. And Google Navigation is the app that has most trouble with it ...
hey, i also got the same problem on cm13, but can't believe its a hardware-bug.
did you already find a solution/workaround?
for me i got good signals in AutoMate (there is a map integrated) and GPS-Test, but i always get a on-off signal in GoogleMaps and(!) Waze.
Did you already tried stock-rom? i wonder if it is the same there, but im afraid of the difficult flash process to go back to stock.
Which radio/baseband do you have?
Typhoon_Master said:
hey, i also got the same problem on cm13, but can't believe its a hardware-bug.
did you already find a solution/workaround?
for me i got good signals in AutoMate (there is a map integrated) and GPS-Test, but i always get a on-off signal in GoogleMaps and(!) Waze.
Did you already tried stock-rom? i wonder if it is the same there, but im afraid of the difficult flash process to go back to stock.
Which radio/baseband do you have?
Click to expand...
Click to collapse
My baseband : XXLS8
Yes I flashed Stock 4.1 Rom yesterday and I have seen the same behavior: poor GPS fix.
Now I come back to CM12.1 but it's getting worse! My phone can not find his position, even with applications that worked before.
For me it's a Google Services or a hardware problem.
Note: I've got a Samsung Tab A with Android 6.0 and Google Services (9.2.56) and GPS works good ...
So I made the ultimate test. I restored a backup I've made early May 2016. At android start I activate Plane mode in order to prevent Google play services to auto update. I checked the version, it's 8.7.03, excellent.
I start GPS Data to test position and the bug is still there. My phone can't fix 0 on 4~5 satellites.
So my GPS is dying
For the last test I made a dangerous action. I rewrite nv_data files from a EFS backup i've made two year ago. (It was Epic, I lost my IMEI, then I get it back, Phew!)
Unfortunately it didn't fix my poor GPS reception.
Here's what I have:
- GPS Data : 5-6 satellites fixed and no drop
- Waze : 3-4 satellites fixed and many drops
- Google Maps : 3-4 satellites fixed and many drops
- Google Navigation : 0 satellite fixed
Whereas few months ago I could get up to 11 satellites!
I tried everything, I have no idea ...
Some news. I've seen that sometimes phone thinks that Position is disabled !?!
In GPS Data app sometimes it display "OFF" instead of "Wait" in the top bar. But the compass screen display 0/8 satellites fixed!
So he sees satellites but thinks GPS is disabled.
I have to disable and enable Position in order to hook satellites.
Maybe this is why I get 0 satellites in Google Navigation. Is it a RIL bug ???
I looked at log files in order to find error. There are many denials but there are these related to GPS:
modem.log
07-26 13:42:35.227 E/use-Rlog/RLOG-RIL(20022): requestOEMHookRaw
07-26 13:42:35.227 E/use-Rlog/RLOG-RIL(20022): Logging Oem Func ID : 14
07-26 13:42:35.227 E/use-Rlog/RLOG-RIL(20022): Logging Oem Sub Func ID : 55
07-26 13:42:35.227 E/use-Rlog/RLOG-RIL(20022): requestOemGps: gps_status 0 sub_id 0x37 len 1
07-26 13:42:35.227 E/use-Rlog/RLOG-RIL(20022): requestFrequencyAiding: state 1
07-26 13:42:35.227 E/use-Rlog/RLOG-RIL(20022): GR err: 0x8000
07-26 13:42:35.227 E/use-Rlog/RLOG-RIL(20022): GPS_onRequestComplete: sub_id 55 error 13 param 0xb657ccf4 plen 1
07-26 13:42:35.227 E/use-Rlog/RLOG-RIL(20022): RIL_onRequestComplete: tok(0xb8790120)
logcal.log
07-26 12:08:21.046 D/WifiService( 4559): acquireWifiLockLocked: WifiLock{NlpWifiLock type=2 [email protected]}
07-26 12:08:21.163 I/GoogleLocationS(16130): type=1400 audit(0.0:1886): avc: denied { setattr } for name="nlp_devices" dev="mmcblk0p10" ino=124272 scontext=u:r:untrusted_app:s0 tcontext=ubject_r:unlabeled:s0 tclass=file permissive=1
07-26 12:08:21.183 D/WifiService( 4559): releaseWifiLockLocked: WifiLock{NlpWifiLock type=2 [email protected]}
07-26 13:35:30.707 I/WAZE [ ConnEventReceiver ](28264): Received event: android.net.conn.CONNECTIVITY_CHANGE. Connectivity: true. Type: WIFI ( 1 ). State: CONNECTED. Connected: true
07-26 13:35:30.707 I/WAZE (28264): getConfig - callback
07-26 13:35:30.707 D/WAZE (28264): Got ShareConfig values: FB: true
07-26 13:35:30.720 D/WAZE (28264): onStatusChanged
07-26 13:35:30.734 D/WAZE (28264): getFacebookSettings - event
07-26 13:35:30.770 E/NowAuthenticator(28264): Token recevied
07-26 13:35:30.788 E/GpsLocationProvider( 4559): native_start failed in startNavigating()
07-26 13:35:30.878 D/WAZE (28264): SpeedometerView: Not shown. (speed == -1 && !mSpeedometerShownOnce=false ) || !mSpeedometerEnabled=true
event.log
07-26 11:01:37.074 I/auditd (16130): type=1400 audit(0.0:1761): avc: denied { getattr } for comm="GoogleLocationS" path="/data/data/com.google.android.gms/files/nlp_clts" dev="mmcblk0p10" ino=124822 scontext=u:r:untrusted_app:s0 tcontext=ubject_r:unlabeled:s0 tclass=file permissive=1
07-26 11:01:37.078 I/auditd (16130): type=1400 audit(0.0:1762): avc: denied { setattr } for comm="GoogleLocationS" name="nlp_clts" dev="mmcblk0p10" ino=124822 scontext=u:r:untrusted_app:s0 tcontext=ubject_r:unlabeled:s0 tclass=file permissive=1
07-26 11:01:37.081 I/auditd (16130): type=1400 audit(0.0:1763): avc: denied { write } for comm="GoogleLocationS" name="nlp_clts" dev="mmcblk0p10" ino=124822 scontext=u:r:untrusted_app:s0 tcontext=ubject_r:unlabeled:s0 tclass=file permissive=1
07-26 11:01:37.081 I/auditd (16130): type=1400 audit(0.0:1764): avc: denied { open } for comm="GoogleLocationS" path="/data/data/com.google.android.gms/files/nlp_clts" dev="mmcblk0p10" ino=124822 scontext=u:r:untrusted_app:s0 tcontext=ubject_r:unlabeled:s0 tclass=file permissive=1
07-26 12:08:21.163 I/auditd (16130): type=1400 audit(0.0:1886): avc: denied { setattr } for comm="GoogleLocationS" name="nlp_devices" dev="mmcblk0p10" ino=124272 scontext=u:r:untrusted_app:s0 tcontext=ubject_r:unlabeled:s0 tclass=file permissive=1
07-26 13:36:23.505 I/auditd (32613): type=1400 audit(0.0:1993): avc: denied { execute } for comm="rtcross.gpstest" path="/data/data/com.google.android.gms/app_chimera/m/00000006/arm/DynamiteModulesA_GmsCore_prodlmp_hdpi_release.odex" dev="mmcblk0p10" ino=123381 scontext=u:r:untrusted_app:s0 tcontext=ubject_r:unlabeled:s0 tclass=file permissive=1
Click to expand...
Click to collapse
Some news:
- First I found why sometimes all apps can't fix any satellites. The problem is the app I use to test gps! I've installed GPS Data on another phone (Wiko Cink Five) in order to compare gps signal strength. And then position has been broken! So do not use GPS Data app. I think it's a A-GPS database update bug. I've installed GPS Test which works much better.
- As I noted that I have better reception in GPS test app and not in Navigation apps, I tried an app that force GPS activation. I found GPS Connected. I launch it at the same time I start navigation. It's better. Now Google Navigation can see satellites. but signal strength is still poor and can not guide me because of GPS drop and bad accuracy.
I can't believe it! I've resolved my GPS problem. It was a hardware problem. My antenna started poorly receive the satellite signal, for an unknown reason.
I found by chance a discussion in a French forum about enhance antenna signal helped by an aluminum sheet. I've have done the trick and it worked!
Now my S2 can fix satellites during navigation. It works nearly good as before. I have no more signal drop and Google Navigation and Waze can guide me.
I change this discussion to Resolved.
Hello there! Wow, 6 months passed.
I come back to tell you that my GPS still working good. This aluminum trick saved my phone.

Debugging SystemUI raises ANR because of BroadcastQueue timeout

I'm on my way on modifying some custom ROM (DUI)'s System UI custom features that currently are yielding some minor errors on my devices.
So, I build the ROM from source in eng variant, I can attach to the systemui process and start debugging. It works pretty well, but only for a little while. After this, the device's screen turns black and SystemUI restarts; the debugging session is lost.
On logcat there's this message of interest:
Code:
02-14 11:53:10.005: W/BroadcastQueue(5796): Timeout of broadcast BroadcastRecord{9b4c2d1 u-1 android.intent.action.TIME_TICK} - [email protected], started 10001ms ago
02-14 11:53:10.006: W/BroadcastQueue(5796): Receiver during timeout: BroadcastFilter{bf8a6f7 u0 ReceiverList{15542f6 6006 com.android.systemui/10035/u0 remote:f58e391}}
02-14 11:53:10.005: W/ActivityManager(5817): type=1400 audit(0.0:17499): avc: denied { ptrace } for scontext=u:r:system_server:s0 tcontext=u:r:init:s0 tclass=process permissive=0
(...)
02-14 11:53:10.090: I/Process(5796): Sending signal. PID: 6006 SIG: 3
02-14 11:53:10.090: I/art(6006): Thread[3,tid=6024,WaitingInMainSignalCatcherLoop,Thread*=0x40484e00,peer=0x12c00670,"Signal Catcher"]: reacting to signal 3
02-14 11:53:10.543: I/art(6006): Wrote stack traces to '/data/anr/traces.txt'
02-14 11:53:10.558: E/ActivityManager(5796): ANR in com.android.systemui
I'm sorry because I'm quite new in Android Framework programming, so maybe this is quite obvious. But the problem is that there's a 10 secs timeout from android.os.BinderProxy and when it expires the ANR is raised. Am I right? Is it possible to avoid/extend this timeout to debug SystemUI?
I tried in Developers Options to set SystemUI as the debugged application, with no success.

updating partitions from recovery

Hi,
I am writing an application which will mount pendrive and update partitions like system, vendor, boot and recovery with the contents available in pendrive. I am trying to define sepolicy for this application.
For testing purpose, i have written one basic .te file with the below content.
type test_updater, domain;
type test_updater_exec, exec_type, file_type;
init_daemon_domain(test_updater)
I am getting the below build error while compiling,
neverallow check failed at out/target/product/mt2712/obj/ETC/nonplat_sepolicy.cil_intermediates/nonplat_sepolicy.cil:3126
(neverallow base_typeattr_56_27_0 base_typeattr_57_27_0 (file (execute execute_no_trans entrypoint)))
<root>
allow at out/target/product/mt2712/obj/ETC/nonplat_sepolicy.cil_intermediates/nonplat_sepolicy.cil:6758
(allow failsafe_updater failsafe_updater_exec (file (read getattr map execute entrypoint open)))
neverallow check failed at out/target/product/mt2712/obj/ETC/plat_sepolicy.cil_intermediates/plat_sepolicy.cil:4641 from system/sepolicy/public/domain.te:668
(neverallow base_typeattr_56 base_typeattr_57 (file (execute execute_no_trans entrypoint)))
<root>
allow at out/target/product/mt2712/obj/ETC/nonplat_sepolicy.cil_intermediates/nonplat_sepolicy.cil:6758
(allow failsafe_updater failsafe_updater_exec (file (read getattr map execute entrypoint open)))
Failed to generate binary
Failed to build policydb
Can someone kindly help me to resolve this issue?
android: 8.1
Regards,
Abdul
I am also facing the same scenario, appreciating any suggestions in advance .
I'm facing the same problem, any update?

AVC open denied

I have 2 devices, a LGG4 and a Xiaomi Mi 8, both rooted.
I'm modifying a .db of an App and everything works fine on the LGG4.
But on the Xiaomi, when I launch the App after changes, I get this error:
Code:
avc: denied { open } for path="/data/data/com.app.app/databases/database.db" dev="sda21" ino=2761689 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:app_data_file:s0 tclass=file permissive=0
(I'm correctly setting permissions)
I already tried to search similar questions here and on google, but I can't find a valid solution.
Thanks!

Unable to give permission

java.lang.SecurityException:
Permission Denial: starting Intent {dat-package:com.jami.tool.hiddensetting cmp=com.android.settings/.Settings $AodRealmeSettingsActivity (has
extras) mCallingUid=10243 ) from ProcessRecord(7b8b86b 22058:com.jami. tool.hiddensetting:shy.luo.process.sub/ u0a243} (pid-22058, uid-10243) requires oppo.permission.settings.LAUNCH FOR_EXPORT
my pc is showing this error while giving permission

Categories

Resources