2

Recently, my attention was drawn by some of the Recycle Bin applications on the play store, and I thought it would be nice to put some of those methods into practice to make other useful applications for people out there, but it seems not quite simple.

According to this Stackoverflow post, it is impossible!

But if you look closely, applications like GT Trash and Dumpster are working like a charm without any root permissions!

What we exactly want to achieve is overriding the android system File.delete() so the deleted file is moved to our desire location before the user permanently delete it. We tried the Andrey Petrov post witch shows a solution for a similar situation but it is not providing enough details.

We appreciate any help from those who where successful finding out the magic behind these apps.

Community
  • 1
  • 1
  • did you check this http://developer.android.com/reference/android/os/FileObserver.html? – Proxytype Jul 05 '15 at 19:43
  • 1
    Since they are licensed applications, and reverse engineering is prohibited in their licenses, then I hope no-one has violated their rights, and if they have, would not publish it here. – Simon Jul 05 '15 at 19:48
  • Thanks for your comment Proxytype, but this method only gets called after a file has been deleted. Not suitable in my case. – Evexcusbably1959 Jul 05 '15 at 19:49
  • it's sound you need a kernel module to hooking filesystem events, i dont know how to do it without root permissions... – Proxytype Jul 05 '15 at 19:49
  • 2
    First, the blog post you cited is for modifying your own process. You cannot use that approach to attack other processes. Beyond that, you spend a lot of time in this question being chatty, as opposed to explaining, **in detail**, what functionality you are seeking and what you have tried in terms of implementation (beyond possibly violating laws in your jurisdiction by attempting to reverse-engineer some apps). You have **one job** in a Stack Overflow question: give those who might be able to help you enough information to do so with the least amount of effort. – CommonsWare Jul 05 '15 at 19:50
  • Maybe Simon is right, but in our opinion knowledge is for all humankind; Especially when related to the Android Open Source project. – Evexcusbably1959 Jul 05 '15 at 19:50
  • 1
    you are totally right.. opensource to openhumens! it's sound very dirty what they are doing (Dumpster and GT), – Proxytype Jul 05 '15 at 19:51
  • I will update my question shortly. Thanks for participating CommonsWare. – Evexcusbably1959 Jul 05 '15 at 19:59
  • maybe they are making copies of the files in the device? – Proxytype Jul 05 '15 at 20:03
  • So no-one should be allowed to work hard, discover knowledge, and profit from it? Sounds like a sucky situation to me. I assume that since you believe it's ok, that all of your applications will be open sourced? – Simon Jul 05 '15 at 20:07
  • yes this is android, there nothing special today with applications the knowledge is for everyone and this is the base of Linux... make the profit other way... dont sale applications, sale the service... – Proxytype Jul 05 '15 at 20:11
  • Simon, you are totally right, one will profit from his knowledge once he discover it sooner. But being too conservative will close the doors of possible improvements to one's own product. – Evexcusbably1959 Jul 05 '15 at 20:11
  • Proxytype, the problem is that with common methods we will only be able to get informed after the file is gone! So backing up is impossible. – Evexcusbably1959 Jul 05 '15 at 20:13
  • i know this is not good enough, maybe they duplicate the data?or they are doing some forensic methods but i dont believe you can do it without root... – Proxytype Jul 05 '15 at 20:14
  • No, I tried both of them. Nothing is getting duplicated. Surprisingly it is working at the correct moment, before the file get's deleted. They are free on the play store. Go try them yourself. – Evexcusbably1959 Jul 05 '15 at 20:17
  • what file you try to delete? media? – Proxytype Jul 05 '15 at 20:18
  • It doesn't depend. With the GT Trash app anything you delete from anywhere, is going to the trash can. – Evexcusbably1959 Jul 05 '15 at 20:22
  • i'm checking the dumper, maybe they using media scanner? – Proxytype Jul 05 '15 at 20:23
  • And then back up those media? This service was also introduced in API 14 – Evexcusbably1959 Jul 05 '15 at 20:31
  • or maybe they using symbolic link... they change all the files to symbolic links and you delete only the link, it's common in linux, never try this on android... what else... – Proxytype Jul 05 '15 at 20:40
  • Sounds interesting! But the user may not be happy of us modifying his files! – Evexcusbably1959 Jul 05 '15 at 21:08
  • going deeper with adb to see what the application doing... – Proxytype Jul 05 '15 at 21:11
  • discussing how to violate other people's intellectual property. – ZhongYu Jul 05 '15 at 21:17
  • there is no secrets in applications... – Proxytype Jul 05 '15 at 21:22
  • bayou.io, we're actually discussing how those apps (GT Trash & Dumpster) are violating people's property. On the other hand, Users will need to trust developers to get useful services. – Evexcusbably1959 Jul 05 '15 at 21:31
  • when you delete file, first the file atterbiute is change, maybe try to lock the file, more info you can find here: http://www.ibm.com/developerworks/library/l-inotify/ and https://github.com/mkttanabe/inotifywait-for-Android/tree/master/jni – Proxytype Jul 05 '15 at 22:25
  • Those classes looks too frightening! How are we exactly supposed to make use of it? They're not even written in Java. – Evexcusbably1959 Jul 05 '15 at 22:37
  • NDK.... i found open source project of file recovering... support linux, you can port it with NDK, http://www.cgsecurity.org/wiki/PhotoRec#Operating_systems – Proxytype Jul 05 '15 at 22:39
  • Is it 100 percent guaranteed to recover the file without loosing a single byte? Those Trash Bin apps seems not to do a recovery after the delete. – Evexcusbably1959 Jul 05 '15 at 22:45
  • Surprisingly I found some .so files in they're assets folder just like the one you can find in the Andrey Petrov post. I think I need to take a more close look at that post. – Evexcusbably1959 Jul 05 '15 at 22:48
  • it's depend, when you delete file, you just delete pointer in FilesSystem table, the sectors of the files not deleted unless the operation system need the place, there is 2 ways to handle it, first is interrupt the delete function (kernel hooking), the second is restore the pointer of the files (this what forensic do...) – Proxytype Jul 05 '15 at 22:48
  • *.so created with ndk.. – Proxytype Jul 05 '15 at 22:51
  • dont forget to answer your self in this question :) – Proxytype Jul 05 '15 at 22:52
  • Yeah, that is a common method in C#. But as a 3 years Java developer, I wasn't able to do such a thing in android. – Evexcusbably1959 Jul 05 '15 at 22:52
  • be aware what andrey doing is hacking, he overwrite systemcall (hooking) not in the tradition way... future fix can disable it... – Proxytype Jul 05 '15 at 22:59

0 Answers0