I have made python scripts to search for text into SMS and Calendar databases.
To display the contacts names in the SMS search results, I also need to access the Contacts DB.
But I noticed the DBs are not readable as normal user:
I am sorry not being sure to understand what you refer to.
I flashed 4.4 and just copied my DBs from 4.3.0.58. Did the db structure/rights change between 4.3 and 4.4?
Also, I can access Contacts form Android. Is that also abnormal?
I donât know if it solves your problem, but the user must be in the âprivilegedâ group to read the âprivilegedâ directory. Thatâs what happens when you do âdevel-su -pâ.
As normal defaultuser, id: uid=100000(defaultuser) gid=100000(defaultuser)
After âdevel-su -pâ: id: uid=100000(defaultuser) gid=996(privileged)
Maybe there is a solution with something like âchmod g+sâ on your script but Iâm not expert enough to know the details to achieve that.
Oh! I didnât know the difference between devel-su -p and devel-su. Thanks @phklrz
Changing the rights on the script will not change the userâs right to access the DB, unfortunately.
Running the script as privileged could be a way.
But this increases the number of manipulations (password for devel-su -p) before using the script.
What I donât understand is:
When I open, e.g., the People app, I can access the contacts DB without password.
How could I imitate this behaviour for a script?
To avoid âbrickingâ issues I experienced several times when SFOS3.4 suddenly became unstable, including when trying to upgrade, I had to do this:
factory reset
flash device with 3.2.0.14 Torronsuo (no device encryption to avoid the fingerprint problem, zero app, zero patch)
multiple system upgrades (OTA method) through all stop releases until 4.4.0.58
trying to restore data from previous backup (made while OS was still 3.4.0.24)
This is where problems appeared: data restoration failed, contacts and other data became unavailable for most apps, apparently due to undocumented changes in Contacts structure and/or permission management, and/or Sailjail that was not implemented yet in SFOS3.4. Of course I have no clear explanation. Still investigating with my very little knowledge and competence in system behavior. My device is just much less efficient than before, many apps are no longer usable, my contacts are lost,
etc. Sad story.
One way would be to wrap your script in a qml app that has the Calendar permission. The same thing should be able to be accomplished running your script from a desktop file with same perms.
@poetaster many warm thanks for having taken time to explore and explain, and even code something.
I am really grateful.
That would be one of my biggest wishes!
But for now, bash and python scripts (and some arduino C) are on the top of my capacities.
I opened the sdk, compiled the example âhello sailorsâ app but didnât even find a way to add a text entry dialog.
No idea what qml is, alas, big alas. BTW, Iâd give a lot if someone would give me a quick introduction step by step to it: sleep at my home, visit my city, cofees and beers or even pay what I could pay.
Because alone by myself, it is too long, too wide, dunno what rope I should pull!
Back to subject. Great, very great, even with sources! Will try right now!
SâŚt! I am on armv7 (XA2). 'll try to recompile itâŚ
Edit some hours later: Miracle, I compiled it for arm7, installed, launched.
Thinking: maybe you meant it as an example / starting point, or?
Because, in actual state, I found the results rather obscure:
-When finding the contact number, it doesnât display the name and vice versa.
-When finding an event, it doesnât display the date of it.
-I didnât achieve to find the text into the messages.
So yes, it finds, but more like âyes man, I found it. Byeâ
Instead, with the scripts, the result is more --human-readable, contextualized.
But again, maybe you thought it as starting point. And I feel having to start writing a poem in martianâŚ
Damn. Had I known you had armv7 Iâd have posted an rpm. Ok, but youâve got this far. I didnât look at the display attributes, but know itâs focused on text, so it doesnât really âknowâ about the structure of calendar entries. That could be extended.
Still, since youâve gotten this far, it makes more sense to wrap your script. A relatively simple example instructional apps:
The SearchPage.qml of SearchNemo shows how one can get input and pass it to a function. The QML In short:
Just occured to me. I wouldnât bother with any of this unless I wanted to share. Iâd just use root. As long as your script is just reading, itâs not such a big deal
Thanks, yeah, @pherjung gave me the link to this python example already.
But when I saw smoke out of my brain, I stopped trying.
Now I domesticated the sdk a bit, Iâll try again.
Thanks for pointing the way to get an input. This helps too.
Hm, yes/no.
Well, things are linged together.
Iâd prefer being able to access the DB as user because
Iâd really like to share my âworkâ. To bring a brick to the whole thing and to give back, as I benefit from otherâs work. (ego also maybe involved :â)
I use my XA2 as secondary user (vs Device Owner/defaultuser) 95% of the time. When I very barely need Android, I switch to Device Owner. This way, I am sure Android donât put its nose in my stuff. (I have no data there). Secondary user has no way to get root access (or I didnât find the way).
But I donât understand where the entered text goes, in what variable and how to use what the user entered.
And also how it could be articulated with my python code and where I should put my python code.
Well, lots of very devel-noob questions, I am afraid.