Fwiw, the limitation is not an issue of running in Dalvik vs. native code,
but the permissions / uid an application is running as.  Third party apps
can not run with permissions to be able to do this kind of stuff.

On Fri, Jan 14, 2011 at 9:07 AM, Hari Edo <hari....@gmail.com> wrote:

>
>
> On Jan 14, 1:32 am, Saj TK <saj.dr...@gmail.com> wrote:
> > Well, what i really wanted to do is delete the Media file from the memory
> > location and write some encrypted data to the same location. I have to
> make
> > sure that i m writing to the same location, not anywhere else in the
> card.
>
> To do this task on the removable SD card memory, you would need to
> unmount
> the filesystem, read some sectors of the filesystem directly to
> determine where
> the files are located, and write new data to the same sectors
> directly.
>
> I am pretty sure that none of this is do-able within Java/Android code
> on the
> dalvik VM.  It would be fairly straightforward as a native Linux
> process, but you
> generally need the root of the device to create such processes,
> especially
> if other programs have access to the SD flash memory you are trying to
> unmount.
>
> It would be even harder to do this on the internal (system) memory,
> because
> it is where the system itself is stored, so unmounting it would
> basically
> require a specialized kernel or kernel module that could stay in RAM
> during
> the operation.
>
> This sounds like a security type of application.  You mention
> encryption, as
> though you're replacing a file with its own encrypted contents.  Of
> course, a
> bunch of random bytes in the same sectors would work as a secure
> shredder.
>
> However, SD flash memory is not all built alike, and even direct
> sector access
> is not enough to guarantee you have made the files unrecoverable.
>
> Media security is a devilishly complicated topic, and many people
> convince
> themselves they can do it effectively while many others find glaring
> loopholes
> that bypass the implementation easily.
>
> Good luck on your endeavor.  I think you have a steep uphill
> challenge.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com<android-developers%2bunsubscr...@googlegroups.com>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>



-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to