FORUMS
Remove All Ads from XDA

[ROOT ONLY][TASK] Grant/Revoke Tasker all Permissions (inc 'advanced' permissions)

697 posts
Thanks Meter: 322
 
By gps3dx, Senior Member on 9th November 2019, 04:46 PM
Post Reply Email Thread
Hi all,

Just wanted to share two tasks that grant/revoke TASKER (i.e packagename 'net.dinglisch.android.taskerm' ) ALL permissions, including 'advanced' permissions like 'Display over other apps' & 'Modify system settings'.

The only 'advanced' perm that the tasks don't include is the 'Install unknown apps' perm.
Not that technically it can't be included, I chose not to, because of Andr Q: apps that are being allowed to use this permission behave weird sometimes ( storage access is changed & limit somehow ) - due to some integral protection included in Andr Q OS.
Also, the tasks DO NOT deal with "Special" permissions like 'device admin' / 'notification access' etc since it either hard or IMPOSSIBLE to do with root only permission w/o 3rd party tools, like in the case of 'device admin'.

IMPORTANT NOTE: YOU MUST HAVE ROOT & MUST ALLOW TASKER ROOT ACCESS !
THE TASKS DON'T WORK OTHERWISE

  • Tasker_perm_Grant
    Code:
    <TaskerData sr="" dvi="1" tv="5.9.beta.4">
    	<Task sr="task143">
    		<cdate>1573298679964</cdate>
    		<edate>1573312849484</edate>
    		<id>143</id>
    		<nme>Tasker_perm_Grant</nme>
    		<pri>100</pri>
    		<Action sr="act0" ve="7">
    			<code>123</code>
    			<se>false</se>
    			<Str sr="arg0" ve="3">appops set net.dinglisch.android.taskerm LEGACY_STORAGE allow
    appops set net.dinglisch.android.taskerm COARSE_LOCATION allow
    appops set net.dinglisch.android.taskerm VIBRATE allow
    appops set net.dinglisch.android.taskerm READ_CONTACTS allow
    appops set net.dinglisch.android.taskerm WRITE_CONTACTS allow
    appops set net.dinglisch.android.taskerm READ_CALL_LOG allow
    appops set net.dinglisch.android.taskerm WRITE_CALL_LOG allow
    appops set net.dinglisch.android.taskerm READ_CALENDAR allow
    appops set net.dinglisch.android.taskerm WRITE_CALENDAR allow
    appops set net.dinglisch.android.taskerm CALL_PHONE allow
    appops set net.dinglisch.android.taskerm READ_SMS allow
    appops set net.dinglisch.android.taskerm RECEIVE_SMS allow
    appops set net.dinglisch.android.taskerm SEND_SMS allow
    appops set net.dinglisch.android.taskerm WRITE_SETTINGS allow
    appops set net.dinglisch.android.taskerm SYSTEM_ALERT_WINDOW allow
    appops set net.dinglisch.android.taskerm CAMERA allow
    appops set net.dinglisch.android.taskerm RECORD_AUDIO allow
    appops set net.dinglisch.android.taskerm READ_CLIPBOARD allow
    appops set net.dinglisch.android.taskerm WRITE_CLIPBOARD allow
    appops set net.dinglisch.android.taskerm WAKE_LOCK allow
    appops set net.dinglisch.android.taskerm GET_USAGE_STATS allow
    appops set net.dinglisch.android.taskerm TOAST_WINDOW allow
    appops set net.dinglisch.android.taskerm READ_PHONE_STATE allow
    appops set net.dinglisch.android.taskerm PROCESS_OUTGOING_CALLS allow
    appops set net.dinglisch.android.taskerm BODY_SENSORS allow
    appops set net.dinglisch.android.taskerm READ_EXTERNAL_STORAGE allow
    appops set net.dinglisch.android.taskerm WRITE_EXTERNAL_STORAGE allow
    appops set net.dinglisch.android.taskerm RUN_IN_BACKGROUND allow
    appops set net.dinglisch.android.taskerm ANSWER_PHONE_CALLS allow
    appops set net.dinglisch.android.taskerm BIND_ACCESSIBILITY_SERVICE allow
    appops set net.dinglisch.android.taskerm START_FOREGROUND allow
    appops set net.dinglisch.android.taskerm READ_MEDIA_IMAGES allow
    appops set net.dinglisch.android.taskerm ACCESS_ACCESSIBILITY allow
    appops set net.dinglisch.android.taskerm READ_DEVICE_IDENTIFIERS allow</Str>
    			<Int sr="arg1" val="0"/>
    			<Int sr="arg2" val="1"/>
    			<Str sr="arg3" ve="3">%out</Str>
    			<Str sr="arg4" ve="3">%err</Str>
    			<Str sr="arg5" ve="3"/>
    		</Action>
    		<Action sr="act1" ve="7">
    			<code>123</code>
    			<se>false</se>
    			<Str sr="arg0" ve="3">pm grant net.dinglisch.android.taskerm android.permission.READ_SMS
    pm grant net.dinglisch.android.taskerm android.permission.READ_CALENDAR
    pm grant net.dinglisch.android.taskerm android.permission.READ_CALL_LOG
    pm grant net.dinglisch.android.taskerm android.permission.ACCESS_FINE_LOCATION
    pm grant net.dinglisch.android.taskerm android.permission.ANSWER_PHONE_CALLS
    pm grant net.dinglisch.android.taskerm android.permission.BODY_SENSORS
    pm grant net.dinglisch.android.taskerm android.permission.RECEIVE_SMS
    pm grant net.dinglisch.android.taskerm android.permission.READ_EXTERNAL_STORAGE
    pm grant net.dinglisch.android.taskerm android.permission.ACCESS_COARSE_LOCATION
    pm grant net.dinglisch.android.taskerm android.permission.READ_PHONE_STATE
    pm grant net.dinglisch.android.taskerm android.permission.SEND_SMS
    pm grant net.dinglisch.android.taskerm android.permission.CALL_PHONE
    pm grant net.dinglisch.android.taskerm android.permission.WRITE_CONTACTS
    pm grant net.dinglisch.android.taskerm android.permission.CAMERA
    pm grant net.dinglisch.android.taskerm android.permission.WRITE_CALENDAR
    pm grant net.dinglisch.android.taskerm android.permission.WRITE_CALL_LOG
    pm grant net.dinglisch.android.taskerm android.permission.PROCESS_OUTGOING_CALLS
    pm grant net.dinglisch.android.taskerm android.permission.WRITE_EXTERNAL_STORAGE
    pm grant net.dinglisch.android.taskerm android.permission.RECORD_AUDIO
    pm grant net.dinglisch.android.taskerm android.permission.READ_CONTACTS
    pm grant net.dinglisch.android.taskerm android.permission.ACCESS_BACKGROUND_LOCATION</Str>
    			<Int sr="arg1" val="0"/>
    			<Int sr="arg2" val="1"/>
    			<Str sr="arg3" ve="3">%out</Str>
    			<Str sr="arg4" ve="3">%err</Str>
    			<Str sr="arg5" ve="3"/>
    		</Action>
    		<Action sr="act2" ve="7">
    			<code>123</code>
    			<Str sr="arg0" ve="3">pm grant net.dinglisch.android.taskerm android.permission.SYSTEM_ALERT_WINDOW
    pm grant net.dinglisch.android.taskerm android.permission.WRITE_SECURE_SETTINGS</Str>
    			<Int sr="arg1" val="0"/>
    			<Int sr="arg2" val="1"/>
    			<Str sr="arg3" ve="3">%out</Str>
    			<Str sr="arg4" ve="3">%err</Str>
    			<Str sr="arg5" ve="3"/>
    		</Action>
    	</Task>
    </TaskerData>
  • Tasker_perm_Revoke
    Code:
    <TaskerData sr="" dvi="1" tv="5.9.beta.4">
    	<Task sr="task142">
    		<cdate>1573298679964</cdate>
    		<edate>1573312802971</edate>
    		<id>142</id>
    		<nme>Tasker_perm_Revoke</nme>
    		<pri>100</pri>
    		<Action sr="act0" ve="7">
    			<code>123</code>
    			<Str sr="arg0" ve="3">appops reset net.dinglisch.android.taskerm</Str>
    			<Int sr="arg1" val="0"/>
    			<Int sr="arg2" val="1"/>
    			<Str sr="arg3" ve="3">%out</Str>
    			<Str sr="arg4" ve="3">%err</Str>
    			<Str sr="arg5" ve="3"/>
    		</Action>
    		<Action sr="act1" ve="7">
    			<code>123</code>
    			<Str sr="arg0" ve="3">pm revoke net.dinglisch.android.taskerm android.permission.READ_SMS
    pm revoke net.dinglisch.android.taskerm android.permission.READ_CALENDAR
    pm revoke net.dinglisch.android.taskerm android.permission.READ_CALL_LOG
    pm revoke net.dinglisch.android.taskerm android.permission.ACCESS_FINE_LOCATION
    pm revoke net.dinglisch.android.taskerm android.permission.ANSWER_PHONE_CALLS
    pm revoke net.dinglisch.android.taskerm android.permission.BODY_SENSORS
    pm revoke net.dinglisch.android.taskerm android.permission.RECEIVE_SMS
    pm revoke net.dinglisch.android.taskerm android.permission.READ_EXTERNAL_STORAGE
    pm revoke net.dinglisch.android.taskerm android.permission.ACCESS_COARSE_LOCATION
    pm revoke net.dinglisch.android.taskerm android.permission.READ_PHONE_STATE
    pm revoke net.dinglisch.android.taskerm android.permission.SEND_SMS
    pm revoke net.dinglisch.android.taskerm android.permission.CALL_PHONE
    pm revoke net.dinglisch.android.taskerm android.permission.WRITE_CONTACTS
    pm revoke net.dinglisch.android.taskerm android.permission.CAMERA
    pm revoke net.dinglisch.android.taskerm android.permission.WRITE_CALENDAR
    pm revoke net.dinglisch.android.taskerm android.permission.WRITE_CALL_LOG
    pm revoke net.dinglisch.android.taskerm android.permission.PROCESS_OUTGOING_CALLS
    pm revoke net.dinglisch.android.taskerm android.permission.WRITE_EXTERNAL_STORAGE
    pm revoke net.dinglisch.android.taskerm android.permission.RECORD_AUDIO
    pm revoke net.dinglisch.android.taskerm android.permission.READ_CONTACTS
    pm revoke net.dinglisch.android.taskerm android.permission.ACCESS_BACKGROUND_LOCATION</Str>
    			<Int sr="arg1" val="0"/>
    			<Int sr="arg2" val="1"/>
    			<Str sr="arg3" ve="3">%out</Str>
    			<Str sr="arg4" ve="3">%err</Str>
    			<Str sr="arg5" ve="3"/>
    		</Action>
    		<Action sr="act2" ve="7">
    			<code>123</code>
    			<Str sr="arg0" ve="3">pm revoke net.dinglisch.android.taskerm android.permission.SYSTEM_ALERT_WINDOW
    pm revoke net.dinglisch.android.taskerm android.permission.WRITE_SECURE_SETTINGS</Str>
    			<Int sr="arg1" val="0"/>
    			<Int sr="arg2" val="1"/>
    			<Str sr="arg3" ve="3">%out</Str>
    			<Str sr="arg4" ve="3">%err</Str>
    			<Str sr="arg5" ve="3"/>
    		</Action>
    	</Task>
    </TaskerData>

TO CHECK the status of permissions - beside opening the app's UI of 'app info' & 'app info'->permission screens, you can run the following shell commands:
Code:
dumpsys package net.dinglisch.android.taskerm  | grep -i permission
 appops get net.dinglisch.android.taskerm
* small note on why 'pm grant' is NOT enough to allow certain permissions & why I also use 'appops' command
on Andr Q ( might also be true to previous Andr versions ) I noticed that in *some instances* the OS don't let me apply the app permissions ( by running the 'pm' commands ) in such a way that are also being reflected in an app's 'app info'->'permissions' screen.
i.e I run 'pm grant...' command, then run 'dumpsys' and can see that the permissions are being allowed, BUT when I check the app's UI 'app info' screen & 'app info'->'permission' screen - the permissions statuses ARE NOT being updated/changed.
I figured that these *some instances* are due to 'appops' denied permission/s.
So the RIGHT WAY to give an app a permission is to first give it 'allowed' access in 'appops', thus lifting the limitation I mentioned above... then run the 'pm' command, which then causes the apps permissions to not only being seen by 'dumpsys' but also reflect the current status in the app's UI ( i.e the app's 'app info' screen and 'app info'->'permission' screen ).
Attached Files
File Type: xml Tasker_perm_Grant.tsk.xml - [Click for QR Code] (4.7 KB, 30 views)
File Type: xml Tasker_perm_Revoke.tsk.xml - [Click for QR Code] (2.7 KB, 24 views)
The Following User Says Thank You to gps3dx For This Useful Post: [ View ] Gift gps3dx Ad-Free
9th November 2019, 05:07 PM |#2  
OP Senior Member
Thanks Meter: 322
 
Donate to Me
More
*RESERVED*
Post Reply Subscribe to Thread

Tags
perm, permission, permissions, root, tasker

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes