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

File manager not detected #327

Closed
daibaron opened this issue Jul 23, 2013 · 23 comments
Closed

File manager not detected #327

daibaron opened this issue Jul 23, 2013 · 23 comments
Labels

Comments

@daibaron
Copy link
Contributor

  • can you name the created file with a HH-DD/MM/YY name
  • can you not overwrite the previously exported files config ? so we can have an exported files history.
  • can we choose the file we would like to import
@M66B
Copy link
Owner

M66B commented Jul 25, 2013

Could you please test if this is okay for you: http://d-h.st/Eyb
I tested with OI File Manager: https://play.google.com/store/apps/details?id=org.openintents.filemanager
Not all file manager let XPrivacy specify the folder and file type.

@M66B M66B mentioned this issue Jul 25, 2013
@daibaron
Copy link
Contributor Author

I just used Export, now the file name is YY-MM-DD-HH

EZ file Explorer didn't show straight the .Xprivacy folder
AndroXplorer didn't show straight the .Xprivacy folder
Total commander didn't show straight the .Xprivacy folder
The stock browser seems to be not an option
Have no problem to browse backup

@M66B
Copy link
Owner

M66B commented Jul 25, 2013

Try OI File Manager

@M66B M66B closed this as completed Jul 25, 2013
@amishmm
Copy link
Contributor

amishmm commented Aug 25, 2013

I just got PRO version from you.

But this feature is not working. I am using latest nightly of LegacyXperia CM10.2 Android 4.3.

When I click export, it directly writes in /sdcard/.xprivacy/XPrivacy.xml

It overwrites it everytime without asking for confirmation.(If you accidentally happen to touch "Export" the old exported setting is overwritten)

I installed OI File manager but it seems its not calling OI File manager. (However it shows popup to save to google drive or so)

If you import, again it automatically imports without asking for filename/directory. (I hope clicking on import twice will not cause duplicate entries or something internally)

Also a suggestion, filename should not be hour dependent. It should be XPrivacy-YYYYMMDDHHMMss.xml

This way I can test things easily making sure I have backup of latest "stable" settings. Or I can revert back easily one by one in reverse order.

@M66B
Copy link
Owner

M66B commented Aug 25, 2013

In the next release seconds will be added to the file name, so there will be no more overwrites.

If there is no suitable file manager, the file name will be /sdcard/.xprivacy/XPrivacy.xml
If there is a suitable file manager, the file name will be /sdcard/.xprivacy/XPrivacy_yyyyMMdd_HHmmss.xml
OI File manager is a suitable file manager.

@amishmm
Copy link
Contributor

amishmm commented Aug 25, 2013

But I have installed OI File Manager. I even rebooted after installing OI File Manager.

Still its not asking me for file name.

Do I have to do some settings? I searched in XPrivacy as well as OI File manager but could not find anything.

@amishmm
Copy link
Contributor

amishmm commented Aug 25, 2013

Oh wait sorry. The files are there!!!

I was under impression that it will ask me for filename. But I didnt realize that it will NOT ask for name but its still storing as per above naming convention.

Sorry for causing confusion. Its working as expected.

@amishmm
Copy link
Contributor

amishmm commented Aug 31, 2013

Ok I was going through code (I have not fully understood it) but I failed to understand why do u need OI File Manager for exporting?

But I think you can eliminate requiring OI File Manager.

In line 74 of src/biz/bokhorst/xprivacy/ActivityShare.java
exportTask.executeOnExecutor(mExecutor, new File(fileName));

If you change it to,
exportTask.executeOnExecutor(mExecutor, new File(getFileName(true)));

It should eliminate need for OI File Manager for exporting.

Line 63:
String fileName = (extras.containsKey(cFileName) ? extras.getString(cFileName) : getFileName(false));

can be moved inside //Import if() statement.

Again I have not fully understood the code but to me it appears right way which will not require OI File Manager for exporting.

For importing, I think android File Manager works.

If you want I can create pull request.

@M66B
Copy link
Owner

M66B commented Aug 31, 2013

Support for (OI) File managers was explicitly request, so this will not be removed, sorry.

@amishmm
Copy link
Contributor

amishmm commented Aug 31, 2013

No no I am not asking you to remove support for OI File manager. OI File manager comes in to picture only for importing.

What I am saying is that, if you dont have OI File Manager, and then u try to export, then File name does not have XPrivacy_yyyyMMdd_HHmmss.xml format.

If you change the code as I mentioned above (assuming I understood it right) then filename will be exported in XPrivacy_yyyyMMdd_HHmmss.xml format even if OI FIle Manager is not installed which I think is right way,

@M66B
Copy link
Owner

M66B commented Aug 31, 2013

The idea is that if there is no suitable file manager installed the file name for importing/exporting is the same (without time component in the file name). If the exported file name is XPrivacy_yyyyMMdd_HHmmss.xml when there is no suitable file manager installed, importing would be hard.

What is exactly your problem?
Do you have a suitable file manager installed?
Is is correctly detected by XPrivacy?
Does the file manager pop up when importing/exporting?

@amishmm
Copy link
Contributor

amishmm commented Aug 31, 2013

Ok this is lengthy but let me explain.

First of all forget my above code changes which I suggested. I realized that related code is in ActivityMain.java and not ActivityShare.java

This is original request (from 1st post of this ticket).

  1. can you name the created file with a HH-DD/MM/YY name (- you solved this)
  2. can you not overwrite the previously exported files config ? so we can have an exported files history. (1 automatically solves this as well)
  3. can we choose the file we would like to import (this needs file manager, CM File Manager, OI File manager, Google Drive, File Manager by rhmsoft etc. work)

Nowhere he has asked for OI File manager.

I have Google drive, CM File manager and File manager by rhmsoft. Assume that currently I have not installed OI File manager.

The problem is here: line 811 file ActivityMain.java (function optionsExport())
boolean multiple = Util.isIntentAvailable(ActivityMain.this, Intent.ACTION_GET_CONTENT);

Now even if CM File Manager, Google Drive, File Manager by rhmsoft support "choosing a file" for import, somehow above line returns false. So your code stores exports in file Xprivacy.xml.

Now I install OI File manager

OI File manager turns that line to true and code exports file as XPrivacy_yyyyMMdd_HHmmss.xml

Now I want to import the file.

Now lets see line 818 in function optionImport()
if (Util.isIntentAvailable(ActivityMain.this, Intent.ACTION_GET_CONTENT)) {
Intent chooseFile = new Intent(Intent.ACTION_GET_CONTENT);

Since this function is true due to existence of OI File Manager, you will realize that the "popup" shows you not just OI File manager, but also CM file manager, Google drive, and rhmsoft file manager.

See images, all three are allowing me to "pick / choose a file". (that is when I click Import)

screenshot_2013-08-31-16-45-48
screenshot_2013-08-31-16-46-23
screenshot_2013-08-31-16-46-55
screenshot_2013-08-31-16-47-17

1st pic: XPrivacy first asks me which importer to choose (Drive, CM File manager, etc.)

2nd pic: CM File manager asking me to pick a file for importing

3rd pic: Google drive asking me to pick a file for importing

4th pic: Rhmsoft file manager asking me to pick a file for importing

Clearly those file managers also allow you to choose file for importing. But isIntentAvailable() returns false somehow.

Also it is safe to assume that person who installs Xposed framework / Xprivacy definitely has good file manager installed.

So I think its safe to assume that File can always be exported safely in XPrivacy_yyyyMMdd_HHmmss.xml without checking for isIntenetAvailable().

It will be very rare that person installing Xposed framework and Xprivacy does not have above or equivalent file manager which does not allowing choosing a file.

@M66B
Copy link
Owner

M66B commented Aug 31, 2013

"Clearly those file managers also allow you to choose file for importing. But isIntentAvailable() returns false somehow." So, this is the real problem.

"Also it is safe to assume that person who installs Xposed framework / Xprivacy definitely has good file manager installed." No, we cannot assume that, there are also a lot of novice users that care about privacy.

Can you try to figure out why isIntentAvailable returns false?
Is the function erroneous or is being checked for the wrong intent?

@M66B M66B reopened this Aug 31, 2013
M66B pushed a commit that referenced this issue Aug 31, 2013
@M66B
Copy link
Owner

M66B commented Aug 31, 2013

Can you check if the above commit fixes your problem?

@amishmm
Copy link
Contributor

amishmm commented Aug 31, 2013

I am sorry to tell you that I have not setup anything on my PC related to android development. So I can not check if it has fixed it because I can not generate APK.

I read the code on github and try to debug by imagination! :)

If you can generate APK and give me link then i would gladly test it.

@M66B
Copy link
Owner

M66B commented Aug 31, 2013

Test version 1.9.10: http://d-h.st/bqy

@amishmm
Copy link
Contributor

amishmm commented Aug 31, 2013

Nope. Not working with 1.9.10 its saving file as XPrivacy.xml i.e. date strings.

Still needs OI File manager.

@amishmm
Copy link
Contributor

amishmm commented Aug 31, 2013

In your latest FIX you may have to use GET_INTENT_FILTERS instead of flag 0
http://developer.android.com/reference/android/content/pm/PackageManager.html#GET_INTENT_FILTERS

OR

See this it suggests use of PackageManager.GET_ACTIVITIES whereas in your earlier code you had used PackageManager.MATCH_DEFAULT_ONLY.

http://stackoverflow.com/questions/11679996/pick-a-file-using-intent-action-get-content

@M66B
Copy link
Owner

M66B commented Aug 31, 2013

This is a version with the original code restored, but using PackageManager.GET_ACTIVITIES: http://d-h.st/I6u

@amishmm
Copy link
Contributor

amishmm commented Aug 31, 2013

Nope not working as well.

You have not used one line from that example.
intent.setType("file/*");

Dont know if its really needed.

M66B pushed a commit that referenced this issue Aug 31, 2013
@M66B
Copy link
Owner

M66B commented Aug 31, 2013

Test version: http://d-h.st/w5l

@amishmm
Copy link
Contributor

amishmm commented Aug 31, 2013

Finally it worked!!

Great work. No more dependent only on OI File manager.

It appears that setType was the one missing.

And whatever is default for setType (when not used) was defined by OI File manager as available intenet and hence it was working not the rest.

But now with file/* all of them work!

Thanks.

@M66B
Copy link
Owner

M66B commented Aug 31, 2013

Thanks for testing!

@M66B M66B closed this as completed Aug 31, 2013
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants