0

I wonder whether it is possibile to pause a file operation such as read a file, for example, I have a file named A.pdf in ciphertext, there is an App--Foxit Reader, want to read the A.pdf file, I want to pause the read operation for a while, so that I have time to decrypt the A.pdf file, and then pass the plaintext to the Foxit Reader. I wonder whether there is a way to do this? That is be transparent for the Apps using cipher content. Any ideas?

I don't want to write my own App to do the read operation, I just want to detect the operation, and when an App is reading a specified file under a directory for encrypted files, I just decrypt the file and after read/write, I encrypt the file again. Certaintly, the App that can read/write my file must satisfy some certain conditions I have set, it's not a problem.

twlkyao
  • 14,302
  • 7
  • 27
  • 44

1 Answers1

0

You could create an Activity with an Intent-Filter for manage the Intent.ACTION_VIEW and recive URI file.

At this point you can decrypt the file and save the pdf.

Then start an Activity for view the new pdf file OR view the pdf inside your app with apv library.

In the first case you must create a service that clean the directory with your decrypted pdf file.

twlkyao
  • 14,302
  • 7
  • 27
  • 44
Manuel Spigolon
  • 11,003
  • 5
  • 50
  • 73
  • I add some content to my issue in the second paragraph. – twlkyao Mar 11 '14 at 14:37
  • i think you could find an input [here](http://stackoverflow.com/questions/3290936/android-detect-when-other-apps-are-launched) – Manuel Spigolon Mar 12 '14 at 08:15
  • Still not my issue, my purpose is to detect the file read/write operation, and decrypt the file, and after read/write operation, then encrypt the file. What I want is to make the series operation transparent to the App(Foxit Reader for example). – twlkyao Mar 13 '14 at 09:05
  • ok, i think this is not possible. You can listen the file access with [FileObserver](http://developer.android.com/reference/android/os/FileObserver.html) but I doubt you can modify the reading-stream of other apps because you recive the event when the file is already opened.. and you don't have the time to replace the file but give it a try ;) – Manuel Spigolon Mar 13 '14 at 09:16
  • Yeah, this is what am concerned, and I am stuck here. – twlkyao Mar 13 '14 at 10:58