Skip to content
This repository has been archived by the owner on Sep 6, 2019. It is now read-only.

Tasker intent - specify a file name #1784

Closed
OyyoDams opened this issue Jul 4, 2014 · 32 comments
Closed

Tasker intent - specify a file name #1784

OyyoDams opened this issue Jul 4, 2014 · 32 comments

Comments

@OyyoDams
Copy link

OyyoDams commented Jul 4, 2014

Hi,

As requested in the XDA forum, could you add a way to specify the file name in intents via Tasker ?

@M66B
Copy link
Owner

M66B commented Jul 4, 2014

Test version:
https://crowd.xprivacy.eu/XPrivacy_2.1.20-1.apk

Send intent:

adb shell am start -a biz.bokhorst.xprivacy.action.EXPORT -e FileName /sdcard/test.xml

Speficying a file name will work for import and export.

M66B added a commit that referenced this issue Jul 4, 2014
@OyyoDams
Copy link
Author

OyyoDams commented Jul 4, 2014

Thanks. I can't test the adb method here, so how can I test it directly in
Tasker ?

@M66B
Copy link
Owner

M66B commented Jul 4, 2014

Just specify an extra with the name FileName and a value with the desired file name.

You can run am from the terminal too, just omit adb shell from the command.

@OyyoDams
Copy link
Author

OyyoDams commented Jul 4, 2014

With the terminal I get this error message:

Starting: Intent { act=biz.bokhorst.xprivacy.action.IMPORT
cmp=/storage/sdcard0/.xprivacy/allow_com.camsam.plus.xml (has extras) }
java.lang.SecurityException: Permission Denial: startActivity asks to run
as user -2 but is calling from user 0; this requires
android.permission.INTERACT_ACROSS_USERS_FULL
at android.os.Parcel.readException(Parcel.java:1431) at
android.os.Parcel.readException(Parcel.java:1385) at
android.app.ActivityManagerProxy.startActivityAsUser(ActivityManagerNative.java:1993)
at com.android.commands.am.Am.runStart(Am.java:617)
at com.android.commands.am.Am.onRun(Am.java:232)
at com.android.internal.os.BaseCommand.run(BaseCommand.java:47)
at com.android.commands.am.Am.main(Am.java:75)
at com.android.internal.os.RuntimeInit.nativeFinishInit(Native
Method)
at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:235)
at dalvik.system.NativeStart.main(Native Method)

@M66B
Copy link
Owner

M66B commented Jul 4, 2014

Try as superuser.

@an0n981
Copy link
Contributor

an0n981 commented Jul 4, 2014

it needs su rights

@an0n981
Copy link
Contributor

an0n981 commented Jul 4, 2014

however, at least for me, it still only export default values, ignoring the -e :(

@M66B
Copy link
Owner

M66B commented Jul 4, 2014

I have tested it and it works for me.
Did you install 2.1.20-1 ?

@an0n981
Copy link
Contributor

an0n981 commented Jul 4, 2014

Yeah, my bad, my thumbs are to thick. works perfectly

@OyyoDams
Copy link
Author

OyyoDams commented Jul 4, 2014

Ok the command works as root, so now any idea about how can I send it via tasker ? Because the intent method doesn't seem to work as root...

@M66B
Copy link
Owner

M66B commented Jul 4, 2014

The intent works for me without root.

@OyyoDams
Copy link
Author

OyyoDams commented Jul 4, 2014

Did you try with Tasker and not in the terminal ?

@M66B
Copy link
Owner

M66B commented Jul 4, 2014

It doesn't matter where the intent comes from.
It is even no possible to see in an application where an intent is coming from.
(an annoyance to some developers, but this is how Android was designed)

@OyyoDams
Copy link
Author

OyyoDams commented Jul 4, 2014

I got it to work with Secure Settings plugin in Tasker, allowing to send a shell command as root. If I disable root, it doesn't work.

M66B added a commit that referenced this issue Jul 4, 2014
Allowing a file name for the IMPORT intent is a security risk

Refs #1784
@M66B
Copy link
Owner

M66B commented Jul 4, 2014

You should not use a shell command, see FAQ5 for how to setup the Tasker intent (only the extra is not documented yet, since I don't know how this needs to be done in Tasker, which I don't use myself).

Please note that in the next release the file name extra for the IMPORT intent will be removed, since it is a security risk. An application could send an intent with to disable its restriction without user intervention else.

@M66B
Copy link
Owner

M66B commented Jul 4, 2014

Please let me know how to specify the file name extra in Tasker, so I can document it.

@an0n981
Copy link
Contributor

an0n981 commented Jul 4, 2014

I'm still trying to get the extra field to work. I will update once I have it.

@M66B
Copy link
Owner

M66B commented Jul 4, 2014

If that needs to be specified: the extra type is string.

@OyyoDams
Copy link
Author

OyyoDams commented Jul 4, 2014

Oh please don't remove the IMPORT intent! I want to create a task that enables or disables internet access for an app which doesn't have built-in feature...

@M66B
Copy link
Owner

M66B commented Jul 4, 2014

The IMPORT intent stays, but you cannot use the file name extra.
If you can enable/disable internet for the application with an intent, the application can do too.

@OyyoDams
Copy link
Author

OyyoDams commented Jul 4, 2014

No this application doesn't receive any intent, so the only way I found is blocking internet access via xprivacy.

@M66B
Copy link
Owner

M66B commented Jul 4, 2014

That is not what I meant.
If you can send an intent (with Tasker or otherwise), the application itself could send the intent as well.
This would enable any application to simply disabled XPrivacy restrictions, which is what we absolutely not want.

@OyyoDams
Copy link
Author

OyyoDams commented Jul 4, 2014

Ok so I won't have any workaround...

@an0n981
Copy link
Contributor

an0n981 commented Jul 4, 2014

From http://tasker.dinglisch.net/userguide/en/intents.html

Extras
Any additional data to send with the intent.

The extras must be in the form of a single colon-separated key and value. If the value can be parsed as an integer, long (integer ending in L), floating point number, double (float ending in D) or boolean (true/false) it will be treated as one, otherwise as a string.

Example: have_flowers:true

Example: this.is.an.integer.example:34

Looks like it will not accept "FileName /sdcard/test.xml" in the extra field

@M66B
Copy link
Owner

M66B commented Jul 4, 2014

How about:

FileName:/sdcard/test.xml

@an0n981
Copy link
Contributor

an0n981 commented Jul 4, 2014

👍

@OyyoDams
Copy link
Author

OyyoDams commented Jul 4, 2014

Thanks the FileName:/sdcard/test.xml works. Anyway, sorry to bother you, but what is the goal of the IMPORT intent if we can't specify a file ?

@M66B
Copy link
Owner

M66B commented Jul 4, 2014

You can manually select a file for the IMPORT intent.

@an0n981
Copy link
Contributor

an0n981 commented Jul 4, 2014

@OyyoDams This may be a little OT, but you use import/export to temporarily give an app Internet permission?

@OyyoDams
Copy link
Author

OyyoDams commented Jul 4, 2014

@an0n981 I have an app that permanently connects to internet, and drains battery. I'd like to automatically enable or disable its internet permission. I thought it could be possible with Tasker + XPrivacy, but it won't work if I can't specify an import file.

@M66B
Copy link
Owner

M66B commented Jul 4, 2014

@OyyoDams this is not what XPrivacy is designed for.

@OyyoDams
Copy link
Author

OyyoDams commented Jul 4, 2014

Yes M66B I've understood :(

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

No branches or pull requests

3 participants