247 Commits

Author SHA1 Message Date
Dianne Hackborn
1dac277f93 Implement issue #1943927 (need notification in status bar when adb is active)
This is a little hacky -- we just assume that if adb is enabled and power
is connected through usb, then it is active.

The icons and text are temporary until final design is provided.
2009-06-30 13:40:51 -07:00
Christopher Tate
72d19aa51e Tighten up the metadata backup logic
We now store the app version codes and and global OS incremental version name in
the PM backup state and the actual backup record.  We then use that information
to trigger a re-backup of the metadata if the OS revision changes in any way, or
to back up single apps' metadata if we notice that they've been upgraded.
2009-06-30 12:52:54 -07:00
Christopher Tate
6f317426e4 Don't issue a deletion for the global metadata backup
We were accidentally submitting a deletion for the global metadata key in the
PM backup handling (it was falling into the usual "here's a package that we said
we'd backed up last time, but now it's no longer on device" code).  Don't do
that any more, i.e. actually keep the global metadata key in the backup set.
Oops.
2009-06-29 18:52:55 -07:00
Christopher Tate
6ef58a1509 Implement persistent enable/disable of the backup manager
Backup & restore is still enabled by default, but with the expectation that it
will be enabled during the course of the Setup Wizard or some other privileged
entity that has notified the user about the ramifications.  While disabled,
data-changed notices will still be collected, but no backup pass will be
scheduled.  When the backup manager is later enabled, any pending data-changed
notices will then be processed and the apps invoked for backup.
2009-06-29 15:33:27 -07:00
Android (Google) Code Review
66c2942a11 Merge change 5605 into donut
* changes:
  Fix issue #1943706 (Applying the monkey to GoogleVoice causes SecurityException)
2009-06-29 11:57:33 -07:00
Christopher Tate
9171749700 Use system properties to track the current transport
This change retools the transport selection mechanism a fair bit.  Transports
are now specified by name rather than by numeric ID, and the name of the
currently selected transport is stored in a persistent system property under the
name "persist.service.bkup.trans".

The name -> IBackupTransport translation is now handled by maintaining a map
from the names to the live IBackupTransport objects that correspond.  The Google
transport service observer now registers and unregisters the transport as the
service goes up and down.

The bmgr command has been expanded to include real transport interrogation and
selection by name, and some documentation has been written for it.
2009-06-26 21:14:41 -07:00
Dianne Hackborn
2bd33d74ae Fix issue #1943706 (Applying the monkey to GoogleVoice causes SecurityException)
Fiddle around with event dispatching to remove calling permissions when we
enter event injection, and prevent callers from going to the PhoneWindowManager's
event processing code unless they are allowed at that point.
2009-06-26 18:59:01 -07:00
Christopher Tate
f7c886b4fe Respect android:allowClearUserData=false during restore
Ordinarily we wipe the data of apps we are restoring.  This is problematic for
packages that expect that their data can never be wiped back to nothing,
especially system packages, so we now respect the android:allowClearUserData
manifest attribute.
2009-06-26 15:34:09 -07:00
Christopher Tate
466ef345d1 Trim some superfluous imports. 2009-06-26 14:41:57 -07:00
Android (Google) Code Review
72eb0acad5 Merge change 5483 into donut
* changes:
  Expand support for different screen sizes.
2009-06-26 13:46:07 -07:00
Dianne Hackborn
723738cfae Expand support for different screen sizes.
Applications can now declare that they support small, normal, or
large screens.  Resource selection can also be done based on these
sizes.  By default, pre-Donut apps are false for small and large,
and Donut or later apps are assumed to support all sizes.  In either
case they can use <supports-screens> in their manifest to declare
what they actually support.
2009-06-26 13:37:05 -07:00
Dan Egnor
156411df46 Use a long for restore token 2009-06-26 13:25:27 -07:00
Christopher Tate
8a27f923eb Don't crash in various ways when using backup services too early
BackupManager now no longer tries to use a null service binder if it's used
early during the boot process.  ActivityManagerService no longer tries to
dereference null pointers if bind/unbind semantics get out of step due to things
being run too early.
2009-06-26 12:20:10 -07:00
Christopher Tate
7d562ec393 Add a new IRestoreObserver callback class to the restore process
The observer is told when restore begins how many packages are being restored.
It then gets an onUpdate() call telling it that the Nth package is now
undergoing restore.  Ultimately, its restoreFinished() callback is invoked,
passing a simple success/fail error code, to let it know that the restore
operation has concluded.
2009-06-25 18:09:28 -07:00
Christopher Tate
5cb400bd72 Keep track of backup state independently for each transport
Backup transports now provide the Backup Manager with a suggested name with
which it can disambiguate any transport-specific bookkeeping that it needs to
maintain.  The Manager keeps separate application backup 'state blobs' for each
transport now, preventing things from getting out of step if the device is
switched among multiple transports.

Also, the metadata backup agent is always invoked now on each backup pass.  This
is cheap when there is nothing to do, but also strongly ensures that we never
wind up in a situation where a given transport destination has not been given
all of the metadata necessary for the backup set.
2009-06-25 16:09:03 -07:00
Dan Egnor
6f21128d1f Switch the default transport to GOOGLE. 2009-06-25 12:07:58 -07:00
Amith Yamasani
819f928f6a Add a method to Process to get uid for a pid.
Use the uids to track native processes. Cache the uids to avoid
checking /proc every time.
2009-06-24 23:26:29 -07:00
Android (Google) Code Review
5416d7c905 Merge change 5317 into donut
* changes:
  Start backing up wallpaper
2009-06-24 18:46:59 -07:00
Christopher Tate
111bd4acdb Start backing up wallpaper
This CL does the following:
   + adds an AbsoluteFileBackupHelper class for managing backup of files
     known by absolute path, not based off of the app's getFilesDir() root
   + bumps up the collection interval from its testing-only default of 1 second
     to 3 minutes
   + adds a SystemBackupAgent class to the main system package and names it as
     the android:backupAgent for the main OS package.  Right now this agent
     only backs up & restores the wallpaper file.
   + amend the Wallpaper Service to inform the Backup Manager when the wallpaper
     changes.

On the subject of the 3-minute collection interval before the backup actually
occurs:  this can be short-circuited from an adb shell.  Running the command
'bmgr run' will cause the Backup Manager to kick off any pending backup
operations immediately.
2009-06-24 18:45:56 -07:00
Android (Google) Code Review
7941e903c9 Merge change 5091 into donut
* changes:
  * new screen resolution support impl.   * use full window for activities, and shift & clip the content   * refactored the compatibility code, and introdcued Translator class to handle cooridnate translations.   * removed a workaround to handle an activity with configChagne=rotation in old implementation.   * I'll fix background issue on rotation in next CL.
2009-06-24 17:53:57 -07:00
Android (Google) Code Review
67669c9c17 Merge change 5196 into donut
* changes:
  Modify the IBackupTransport API to support bulk restore operations. Change the BackupManagerService and LocalTransport to support the new API.
2009-06-24 16:52:16 -07:00
Dan Egnor
efe52647f6 Modify the IBackupTransport API to support bulk restore operations.
Change the BackupManagerService and LocalTransport to support the new API.
2009-06-24 16:49:44 -07:00
Dianne Hackborn
9c8dd55a9d Fix bug 1829561 ("am profile" with bad filename kills process).
The am command is now the one that takes care of opening the target file,
handling the opened file descriptor to the process that will be profiled.
This allows you to send profile data to anywhere the shell can access, and
avoids any problems coming up from the target process trying to open the
file.
2009-06-24 16:23:14 -07:00
Amith Yamasani
32dbefda71 Track native processes and airplane mode.
Turn signal strengths on/off when toggling airplane mode.
2009-06-24 11:17:36 -07:00
Mitsuru Oshima
64f59342d4 * new screen resolution support impl.
* use full window for activities, and shift & clip the content
  * refactored the compatibility code, and introdcued Translator class to handle cooridnate translations.
  * removed a workaround to handle an activity with configChagne=rotation in old implementation.
  * I'll fix background issue on rotation in next CL.

  * removed unnecessary scaling code in SurfaceView, which I forgot to remove when I changed SurfaceView
    not to scale the content.
2009-06-23 23:11:55 -07:00
Android (Google) Code Review
722baf5ec4 Merge change 5014 into donut
* changes:
  Fix issue #1933587.  Perform dexopt of instrumentation .apks.
2009-06-22 18:30:05 -07:00
Dianne Hackborn
d7f6daa5d1 Fix issue #1933587. Perform dexopt of instrumentation .apks. 2009-06-22 17:06:35 -07:00
Christopher Tate
5cbbf5652a Pass the originating app's versionCode along with a restore set
This change amends the doRestore() / onRestore() interface to backup agents to
provide the integer android:versionCode of the app that stored the backup set.
This should help agents figure out how to handle whatever historical data set
they're handed at restore time.
2009-06-22 16:44:51 -07:00
Christopher Tate
3a31a93b8a Add some global metadata to the restore set
In addition to the signatures of each participating application, we now also
store the versionCode of each backed-up package, plus the OS version running on
the device that contributed the backup set.  We also refuse to process a backup
from a later OS revision to an earlier one, or from a later app version to an
earlier.

LocalTransport has been modified as well to be more resilient to changes in the
system's use of metadata pseudopackages.
2009-06-22 15:14:04 -07:00
Android (Google) Code Review
856dd8a60a Merge change 4952 into donut
* changes:
  Helper API cleanup.  Allows multiple helpers to function, because they'll always go in the same order, and this lets us not have to write headers to keep them paired.
2009-06-22 13:18:09 -07:00
Joe Onorato
06290a4bb9 Helper API cleanup. Allows multiple helpers to function,
because they'll always go in the same order, and this lets
us not have to write headers to keep them paired.
2009-06-22 13:02:24 -07:00
Android (Google) Code Review
07a5f126df Merge change 4754 into donut
* changes:
  At boot time, add additional per-device information to the kernel randomness pool.  This helps increase the quality / uniqueness of the random numbers, and is especially important during the device's first boot, when insufficient randomness is available.
2009-06-22 10:55:25 -07:00
Android (Google) Code Review
6bf1208c58 Merge change 4827 into donut
* changes:
  Fix issue with shared user permissions. just look in the requested permissions of packages within shared user setting rather than the granted permissions
2009-06-22 10:39:15 -07:00
Nick Kralevich
b8cba95ffd At boot time, add additional per-device information to the
kernel randomness pool.  This helps increase the
quality / uniqueness of the random numbers, and is especially
important during the device's first boot, when insufficient
randomness is available.
2009-06-22 10:37:50 -07:00
Suchi Amalapurapu
b97b8f8806 Fix issue with shared user permissions.
just look in the requested permissions of packages within shared user setting rather than the granted permissions
2009-06-19 16:02:27 -07:00
Christopher Tate
6aa41f4c57 Add app version to the backup metadata
We now record the version number of the app (drawn from its manifest versionCode
attribute) along with its signatures.  At restore time, we compare the version
associated with the restore set with the version present on the device.  If the
restore set is from a newer version of the app than is present on device, we do
not perform the restore operation.

Also fix the pending-backup iteration in 'dumpsys backup'.
2009-06-19 15:24:51 -07:00
Dianne Hackborn
3d74bb4ab2 Add "why?" button to low battery dialog.
This takes the user to the power usage activity.
2009-06-19 11:46:58 -07:00
Suchi Amalapurapu
bc806f65ed Remove deprecated api. Aptly rename freeStorageWithIntent to freeStorage. 2009-06-19 10:25:37 -07:00
Christopher Tate
20efdf6b56 Make signature checks on restore work with unsigned apps 2009-06-18 19:42:24 -07:00
Android (Google) Code Review
63e7155c7d Merge change 4696 into donut
* changes:
  Fix targetSdkVersion, make resize mode a flag, delayed dexopt, easy ApplicationInfo.
2009-06-18 19:33:33 -07:00
Joe Onorato
5d605dc56b backup stuff 2009-06-18 18:41:11 -07:00
Christopher Tate
abce4e8714 Use signatures on restore
On restore now, the backup manager gets the signature blocks corresponding to
the restore set from the transport.  It then validates those signatures against
the on-device app signatures, and refuses to restore data to an app whose
on-device sig block does not match the backup image's.

Also actually implement 'bmgr transport N' so that we can select the local
transport easily during runtime.
2009-06-18 18:38:02 -07:00
Dianne Hackborn
5c1e00b14d Fix targetSdkVersion, make resize mode a flag, delayed dexopt, easy ApplicationInfo.
- Fix a bug where targetSdkVersion could not be set if minSdkVersion.  Stupid, stupid.
  Also make sure to fail if minSdkVersion is for a code name.  Really stupid.

- Change the API for resize compatibility mode to be a bit in the flags field, instead
  of a separate boolean.

- Implement delayed dexopting, to avoid the looong full dexopt during boot.  This is
  only enabled for "eng" builds.  When in this mode, the activity manager will make
  sure that a dexopt has been done before loading an .apk into a process, and will
  try to avoid displaying ANRs if they are due to the dexopt causing some operation
  to take longer than it normally would (though I make no guarantees about this
  totally working).

- Add API to Context to get the ApplicationInfo for its package, for easy access to
  things like targetSdkVersion.
2009-06-18 17:10:57 -07:00
Android (Google) Code Review
167dbe0bf1 Merge change 4670 into donut
* changes:
  Update RandomBlock to use RandomAccessFile.  This helps prevent certain unusual conditions from corrupting the entropy file.  (for example, if Android should happen to crash while a write is in progress)
2009-06-18 17:05:19 -07:00
Android (Google) Code Review
07eac01644 Merge change 4682 into donut
* changes:
  Store the app signatures as part of the backup set
2009-06-18 16:15:47 -07:00
Christopher Tate
6785dd8420 Store the app signatures as part of the backup set
Under a pseudo-app for the Package Manager, we store the app signatures for all
participating applications installed on the device.  At restore time we will
restore this first, then ensure that the current on-device signature chain is
compatible with the one in the backup set.  If there's a mismatch, this may be a
spoof attempt and we will refuse to restore that app's data.

The restore side of this is not implemented, but the Package Manager agent is
here as well as the backup side theoretically pushing the data now.
2009-06-18 15:58:25 -07:00
Nick Kralevich
2854254c2f Update RandomBlock to use RandomAccessFile. This helps
prevent certain unusual conditions from corrupting the
entropy file.  (for example, if Android should happen to
crash while a write is in progress)
2009-06-18 15:23:17 -07:00
Android (Google) Code Review
5ad76ef5ee Merge change 4521 into donut
* changes:
  load entropy data at boot.  Periodically write entropy data to disk.
2009-06-18 11:58:54 -07:00
Nick Kralevich
4fb256117c load entropy data at boot. Periodically write entropy data to disk. 2009-06-18 11:00:19 -07:00
Dianne Hackborn
c14b9ccdf1 Extend Intent/Uri conversion for use by Browser
This introduces a new Uri form of Intent with an "intent:" scheme, and a
corresponding update to the parser to handle these, so that the browser
can use this generic facility for starting activities based on the links
that are clicked and allow for web pages to link to arbitrary intents.

There is also a new "package" field on Intent which allows you to limit
the components it finds to a given package.  This replaces the new method
that was added to PackageManger for doing this when resolving activities,
and implements it for all Intent queries against the package manager.
2009-06-17 21:48:14 -07:00