Is it currently possible for an application to "bootstrap" itself by
downloading a small application from the marketplace that then downloads
additional bytecode to the SD card and executes it?
If that is not possible, is it possible for an application to download
all of the actual code to internal memory from the marketplace but then
download additional media (for instance, graphics and a text script
for a game) to the SD card and access it seamlessly from the
application?
Obviously either of these options would require the application itself
to address the questions being discussed here, like what to do if the
card is removed.
When you plug the phone into a desktop machine the desktop sees the
phone as essentially a card reader and gets direct access to the
memory card itself instead of to the file system, so the desktop needs
to have drivers to support the file system on the card. FAT is the
only file system that is common to Windows, Mac OS, and Linux, as well
as various consumer electronics like TVs and NAS units that you can
plug the phone into to copy or view photos.
-Jeff
I don't believe that it's acceptable for a plaftorm designed for
consumer devices to be designed around the notion that certain
operations will crash the phone. To me that'd be a major design flaw.
I'm not convinced that unmounting would make a difference in first
approximation: once the card is unmounted, the files aren't any more
accessible than if the card had been pulled. Granted, the act of
unmounting could give the system more opportunities to get ready and
for the apps to save their state, but ultimately the system still has
to be protected against the files disappearing with no notice (because
some users will pull their cards anyway).
Using the internal storage to cache apps is an interesting idea, but
it doesn't come for free: it limits the size of any individual app to
the size of the internal storage, it causes some severely user-visible
delays (copying 10+ MB takes time), and it still requires some serious
system-level logic (albeit a different kind of logic) to manage that
space. Worse, since some apps will still be using internal storage for
their data, you could end up with situations where some apps installed
on the SD card can't be launched any more if there's not enough space
to cache the relevant data. Finally, keeping apps "running" without
letting them access their data is unlikely to make them more useful
than just killing them, and creates some additional complexity if you
leave apps installed on the SD card "running" while the card is gone
if you insert a different SD card while they're still running.
Finally, an aspect that you haven't mentioned is the notion of an
"installed" app, and how that notion gets muddied when installing apps
on removable storage: to take a simple example, if you have 2 apps on
2 different SD cards that each publish the same content provider, how
do apps that are not installed on the SD card distinguish between the
two? One way to resolve that might be to not allow apps to be
installed on the internal storage at all (in which case the problem
mostly goes away on its own), but it still seems to me that the are
some legitimate use cases for apps on internal storage (e.g. to manage
a music library that spans multiple SD cards).
JBQ
I think probably the best way to handle the unexpected removal of an
SD card that hosts a running application is to have a standard feature
of the OS that pauses the application with a (possibly catchable?)
UNIX signal, similar to if you send ctrl-Z to a running process on the
command line, and then displays, "please re-insert SD card". Users
can then choose to switch away from the application with the back
button, which means they will be able to pause the application until
their business with the card is done, and then reinsert it and
continue. They can choose to close the application. Or, they can
choose to reinsert the card and resume the application. Linux
programs are already expected to be able to handle pauses like this,
right?
The problem is of course that if the user does choose to close the
application, there should be some way to handle that in an orderly
fashion. But given all of the other ways that programs can be
terminated rudely on a phone, such as the device having its battery
removed, it's arguable applications should be able to handle this
regardless.
tomgibara wrote:
> 1) APKs are signed and therefore tamper-proofed, so if you want to
> store apps on the SD card, you could do worse than simply store the
> APKs
That works for free apps. Paid-for apps, though, are a problem -- now,
the APK can be removed from the card and distributed to hither and yon,
which may not be what the app author intended.
It may be that the off-loaded APK on the SD card isn't the virgin APK,
but one that has been lightly encrypted or something, to prevent casual
copying. That might not stop a serious pirate, since the
encryption/decryption logic would be open source.
> 1) it works mostly by the install/uninstall mechanism which already
> works nicely
Maybe the answer is that, rather than making this seamless, we add a
seam, tied in with install/uninstall.
Perhaps the solution is for users to be able to mark apps as "parked" or
something -- they bought it, they want to be able to use it sometime,
but right now they could use the room. Through the Manage Applications
screen, they'd "park" their app, which does what you describe -- leave
the data directory behind but remove the APK. The APK could go to the SD
card or could go to the cloud (e.g., back to App Market or other market
supporting the necessary hooks).
The app would then only be available via the launcher icon(s), which
would lead to a "you parked this app -- do you want it back now?"
screen. Or, you could see it in Manage Applications and restore it from
there.
Apps could be flagged as "parkable locally" (meaning they can be parked
to the SD card) or "only parkable remotely" (meaning they'd have to be
re-downloaded but not re-purchased). That way, developers who don't want
to run the risk of their APKs getting out can bypass the SD card parking
lot. And, some apps that are too dependent on background processing or
other OS hooks are flagged as "not parkable", meaning parking won't be
presented as an available option.
--
Mark Murphy (a Commons Guy)
http://commonsware.com
Android Training on the Ranch! -- Mar 16-20, 2009
http://www.bignerdranch.com/schedule.shtml
Within this design, I have a few questions around the notion of
"unavailable" apps:
-what if an app is installed on the SD card, the SD card is removed
and lost, and the user wants to install the same card on internal
storage?
-will it be possible to migrate apps from internal storage to the SD
card (and vice versa) (this would be another way to achieve Tom's
goals, if I've read correctly).
-what will happen if a user wants to install an app on multiple SD cards?
-how will this scale if Android evolves to systems that support
multiple external storage devices?
Thanks,
JBQ
This is something that could be fixed within the Linux file system
implementation, but it would be a lot of work.
Mike
--
Mike Lockwood
Google android team
Let me take an example: suppose that the download manager downloads
data into another app's content provider (that's currently the
long-term design to make the download manager download files into
other apps' private storage locations). Suppose that such a target app
gets paused. The download manager now gets paused. This can in turn
cause the browser, market, gmail, and even system updates to get
paused (if they happen to start a download). Things might ripple much
further. I'd prefer that the download manager get a clear message that
the app is gone and handle that situation in the most appropriate way
(probably mark the download as paused for now, waiting for the app to
resume it when it returns, and flushing it away after a while if it
doesn't hear back from the app).
JBQ
The way I look at it... The SD card should not be removed the way a CD is in a computer. You should get the biggest card you can get and leave it alone.
On Nov 17, 2008 9:56 AM, "Tom Gibara" <m...@tomgibara.com> wrote:
This is clearly a more complete solution than my ad-hoc suggestion.Does (2) extend to the SD card being mounted on a host computer via USB?What isn't clear to me is how (or even whether) users will be involved in deciding where an application is installed. A user will probably regard some applications as critical, (eg. a replacement home application or replacement dialer) and will want these to operate with or without an SD card. But involving the user in these decisions might be troublesome (should users be expected to understand the technical implications of installing an application to the SD card?). Conversely, it doesn't seem natural for an application developer to control where the application may be deployed.I suppose the advice to users could be as straightforward as "If you want the app available at all times, install it to the phone, otherwise you can install it to the SD card)." However, users could still be surprised that an application installed on the phone fails on removal of the SD card, because they are unaware that it depends on an application that resides on the card.I can't immediately see a practical solution to this other than leaving it to the application developer to educate the user about how their app (and its dependencies) need to be installed.
Tom.2008/11/17 hackbod <hac...@gmail.com>> > > I should say, we definitely -do- want to allow users to store > applications on an SD card, b...
Well put.
On Nov 17, 2008 1:19 PM, "Andrew Gorcester" <andrew.g...@gmail.com> wrote:
Certainly, many users will not see it that way. Also, currently the
SD card is unmounted when the device is hooked up to a computer via
the USB cable and the card is mounted on the computer. That would
have the same effect on running applications as removing the card.
On Mon, Nov 17, 2008 at 1:36 PM, Dave Johnson <davefilms.us@gmail.com> wrote: > The way I look at i...
Comparing the idea of filesystem-in-a-partition and
filesystem-in-a-file, I can think of the following differences:
-filesystem in a partition makes the process of preparing an SD card
appropriately a bit more awkward (e.g. what if the SD card didn't have
a partition table to start with?), makes it a bit harder to
dynamically resize the android-specific filesystem, and makes it quite
hard to restore the SD card to a "normal" state by using only a
computer. It might also cause various operating systems to complain
that the SD card isn't properly initialize and cause users to
mistakenly re-initialize the second partition with another filesystem
and lose their android apps.
-on the other hand, filesystem in a partition allows to trivially
UMS-mount the "regular" partition on a computer while leaving the
"android" partition mounted on the phone.
JBQ
Even if you did that, that wouldn't really solve the problem, because
the computer could be using a cache and could have started to write a
new state from its cache when it hits a "restricted" block, and then
leave the filesystem in a dirty state.
To make things worse, you couldn't protect the FATs themselves on a
block-by-block basis, but you'd have to do it on an entry-by-entry
basis.
Once you dig a bit deeper in that direction, the complexity of the
task becomes so high that other options become more practical.
JBQ
Will the single file have a random unique name so that one SD card can
be used to host applications of several devices? (although each device
can only access "their" file on the SD card). Or it is actually enough
if they are numbered sequentially: android1.fs, android2.fs, etc. and
each device looks for the file they can read.
But this would immediately bring Jean-Baptiste's question up again:
What if the user lost their SD card - can they install the application
again on internal memory?
If yes, what happens if they found their SD card again? (Hm, probably
in that case simply the SD card version would be locked and cannot be
accessed anymore...?)
I guess the whole point of having an encrypted file on the SD card is
that it can hold the apk file as well as the private data files
(databases, files, shared preferences), so that one can make most use
of the space on the SD card. (there is no point in outsourcing only
the apk files, if the databases fill up all internal memory...)
There is a limited amount of space in internal storage, and there is a
limited amount of space on any given encrypted filesystem on the SD
card. But one limitation is potentially controllable to some degree
and one isn't. Applications will have to deal with running out of
space either way, but if their options include "allocate more space
from the beginning as instructed by the developer" and "take some time
to recreate the filesystem" it should be easier to handle.
Other options include making a single filesystem for all apps and data
stored on a card, with the size determined by the user. This
filesystem could be a file or it could be a partition as previously
suggested, although I think the partition idea (while clever!) is
likely to cause a lot of trouble for other devices.
The impossibly cramped internal storage on the G1 in particular makes
the issue more serious than it would be otherwise. I actually wonder
if Android itself won't grow too large to fit on the G1 in the future.
How set in stone is that decision? I'm not certain the alternative,
where the tiny available portion of internal storage on the G1 (which
will get tinier as features are added to Android) becomes completely
filled with data and applications cease to function, is preferable.
There is a limited amount of space in internal storage, and there is a
limited amount of space on any given encrypted filesystem on the SD
card. But one limitation is potentially controllable to some degree
and one isn't. Applications will have to deal with running out of
space either way, but if their options include "allocate more space
from the beginning as instructed by the developer" and "take some time
to recreate the filesystem" it should be easier to handle.
Other options include making a single filesystem for all apps and data
stored on a card, with the size determined by the user. This
filesystem could be a file or it could be a partition as previously
suggested, although I think the partition idea (while clever!) is
likely to cause a lot of trouble for other devices.
JBQ
Regarding the first point, the system would just have to store the
signature of the apk in an internal database to notice a change.
Regarding the second point, nobody prevents me even now to use adb in
developer mode to copy apk files from /data/app to my computer and
install them on some other phone or publish them on the web..
A year from now, when there are plenty of other devices running
Android on the market and all of those devices have more internal
flash than the G1, developers may feel little obligation to put
relatively small (1-10 megabyte) amounts of user data explicitly on
the SD card. If there is no general solution for moving that user
data off of internal memory, the G1 could become very difficult to
use.
What about giving users the ability to create another filesystem
exclusively for user data, shared across applications installed on
that SD card? Users would have to choose how much space to allocate,
which is not an optimal solution. But given that only a few tens of
megabytes are available on the G1 - and that amount will shrink as
features are added to Android - I think it would be much better for
users than the alternative.
If validating a signature can take so long, are apk file signatures
actually validated when they are downloaded?
(I ask because "adb install" complains quite quickly if signatures
differ - or maybe my apk files are not big enough :-) )
I think I understand some of the technical reasons why data can't be
stored in the same filesystem as the application, but I still think
there needs to be some kind of solution for this issue.
PPS: If Google doesn't have the resources right now, is there a way to
split the problem into things Google has to do (the most critical
internal things), and things maybe "the community" can supply? (like
changes to the UI of the application manager...). Is there a way this
can be approached in small steps? (i.e. maybe first a version that is
not very user friendly, but that works?)
Nothing that Google has to do? Open source project?
I am probably in the wrong place then because as far as I am aware,
nobody other than Google (and perhaps HTC or T-mobile) can actualy
change the code on the only existing device currently implementing
this platform. In fact, I was surprise to discover that even what we
thought to be a simple task, such as adding Hebrew fonts so that the
G1 will be able to read Hebrew is not possible without root access.
The fact that it is not on your roadmap for Q1 2009 is frustrating, as
I don't see how users like me can actualy enjoy the benefit of the App
Market with the limited internal storage capcity most of us already
almost exhusted. Without the app market, Android is no better than a
regular cell phone with a nice touch screen.
Secondly when you mentioned Q1 of 2009, that would mean like the march/
april time frame correct?
BR,
Phil.
"Dianne Hackborn"
<hackbod@android.
com> To
Sent by: android-...@googlegroups.com
android-platform@ cc
googlegroups.com
Subject
Re: Apps on SD
20/11/2008 21:30
Please respond to
android-platform@
googlegroups.com
--
Dianne Hackborn
hac...@android.com
ForwardSourceID:NT0000356E