Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add permission WRITE_SECURE_SETTINGS and READ_LOGS #211

Closed
oza6ut0ne opened this issue Aug 12, 2018 · 11 comments
Closed

Add permission WRITE_SECURE_SETTINGS and READ_LOGS #211

oza6ut0ne opened this issue Aug 12, 2018 · 11 comments

Comments

@oza6ut0ne
Copy link

oza6ut0ne commented Aug 12, 2018

They are needed to use settings command and logcat command in Termux, respectively.
With settings command, we can change many settings without root.

For example, turn on location service by
settings put secure location_providers_allowed +network,gps
and turn it off by
settings put secure location_providers_allowed -network,gps

And it would be nice if we can read logcat in Termux.

Note that these permissions doesn't work by just adding to AndroidManifest.xml.
We also need to grant them using adb only once.

adb shell pm grant com.termux.api android.permission.WRITE_SECURE_SETTINGS
adb shell pm grant com.termux.api android.permission.READ_LOGS

Then we will be able to use settings and logcat in Termux.

@Grimler91
Copy link
Member

Closing since adding additional permissions that requires running adb won't really benefit the average user.

The users that want the extra permissions can build the app themselves 👍

@jidanni
Copy link

jidanni commented Oct 25, 2018

Yes but it wouldn't hurt anybody. Zero. Nobody.
And people wouldn't have to build a whole app just to add one line.

@ghost
Copy link

ghost commented Oct 25, 2018

Bloated code is not accepted here. Termux is standalone application shouldn't rely on adb.

@jidanni
Copy link

jidanni commented Oct 25, 2018 via email

@jidanni
Copy link

jidanni commented Oct 26, 2018

Take matlog for instance.

  • It has that permission listed in its manifest.

It can only read its own logcat entries.

  • Not very exciting.
  • The permission sitting there in its manifest doesn't do anything...

...Until the user uses pm grant once.

  • From that day on, it now can read the complete logcat.

loial added a commit to loial/termux-api that referenced this issue Feb 1, 2019
From oza6ut0ne:
"Note that these permissions doesn't work by just adding to AndroidManifest.xml.
We also need to grant them using adb only once.

adb shell pm grant com.termux.api android.permission.WRITE_SECURE_SETTINGS
adb shell pm grant com.termux.api android.permission.READ_LOGS
"
ghost pushed a commit to termux/termux-app that referenced this issue Nov 17, 2020
@crisalis2
Copy link

So this was added recently. I'm using Termux 0.103 and Termux:API 0.46 from F-Droid, granted the appropriate permissions through ADB and tried settings put secure icon_blacklist volume,alarm_clock,rotate,headset, but I get cmd: Failure calling service settings: Failed transaction. What am I missing?

@ghost
Copy link

ghost commented Dec 22, 2020

What am I missing?

You are missing the fact that settings command is restricted since Android 8. Permission is not enough here.

@crisalis2
Copy link

Makes sense, I'm on Android 10. But I just used an app (https://github.com/zacharee/Tweaker) that could change those same settings just by granting the WRITE_SECURE_SETTINGS permission through ADB.

@ghost
Copy link

ghost commented Dec 22, 2020

@crisalis2 Because it uses Android API for changing settings. Not the utility /system/bin/settings which is a restricted system component.

@crisalis2
Copy link

I see, thanks for explaining.

AdamMickiewich pushed a commit to VolyaTeam/dzida-app that referenced this issue Aug 8, 2022
shrihankp pushed a commit to reisxd/termux-app that referenced this issue Oct 20, 2022
@Rudxain
Copy link

Rudxain commented Sep 25, 2023

@crisalis2 termux/termux-packages#8292 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants