275 Commits

Author SHA1 Message Date
Christopher Tate
34ebd0e1bb Fix up permissions for 'dumpsys backup' 2009-07-06 15:44:54 -07:00
Android (Google) Code Review
0d725f7d5a Merge change 6162 into donut
* changes:
  Hold a wakelock during backup/restore/clear operations
2009-07-06 11:54:34 -07:00
Christopher Tate
b6787f2ee5 Hold a wakelock during backup/restore/clear operations
We need to make sure we stay alive for the duration of a backup or (especially)
restore operation.  The existing Handler-based timing system was simply not
properly functional, so it's been retooled to use a repeating alarm delivering a
broastcast PendingIntent to our registered receiver.

We acquire a partial wake lock in the broadcast receiver [i.e. while the Alarm
Manager is holding one for the duration of broadcast delivery] and pass the
wakelock object to the backup thread, which eventually releases it when it's
finsihed operations.  A similar pattern is used for the threads handling restore
and clear.
2009-07-06 11:49:49 -07:00
Chung-yih Wang
699ca3f251 Add password field for WiFi configuration.
1. the certtool.h is modified for avoiding the side effect,
   for saving the configuration with wpa_supplicant.
2. put the loadLibrary back in CertTool.java
3. Fix incorrect JNI declarations.
2009-07-05 11:06:01 +08:00
Android (Google) Code Review
7e8cbfc2bc Merge change 6143 into donut
* changes:
  Fix the simulator.
2009-07-02 15:24:43 -07:00
Marco Nelissen
d595c79cdd Fix the simulator. 2009-07-02 15:23:26 -07:00
Android (Google) Code Review
e15df4017c Merge change 6132 into donut
* changes:
  If we can't get the restore set's metadata, don't continue
2009-07-02 14:30:56 -07:00
Christopher Tate
8c0324752a If we can't get the restore set's metadata, don't continue
Without the metadata we can't verify the version number or the signatures of the
apps whose data we'd be trying to restore against the apps present on device.
This is not acceptable; we need to refuse to give data to an unauthenticated
app.
2009-07-02 14:28:47 -07:00
Android (Google) Code Review
0d81f63687 Merge change 6102 into donut
* changes:
  Backup Wifi supplicant data.
2009-07-02 13:19:55 -07:00
Android (Google) Code Review
9701b3d594 Merge change 5979 into donut
* changes:
  Remove the constraint to assign new uid when code path changes for system packages
2009-07-02 12:20:29 -07:00
Christopher Tate
4e3e50cfa7 Clean up the last two literal permission string usages 2009-07-02 12:14:05 -07:00
Amith Yamasani
16d79e56ca Backup Wifi supplicant data.
WifiService requests a backup when it writes wifi configuration to disk.
Backup the wifi supplicant file when settings provider runs backup.
2009-07-02 12:05:32 -07:00
Christopher Tate
ee0e78af5a Add a "clear backed-up data" method to the backup mechanism
It's now possible to ask that the backup manager wipe the saved data for a given
application from the backing store.  LocalTransport implements this now but the
Google backend does not yet.  When the data is wiped, the on-device backup state
is also wiped to ensure that the next backup pushes all necessary data.

Bmgr has not yet been modified to actually call into this method, but it will
be soon.
2009-07-02 11:30:29 -07:00
Dianne Hackborn
d7cd29da91 Add facility to run setup wizard after an update.
The system now keeps a tag of the last version (just an arbitrary string)
that the setup wizard was run for.  If this is different than the current
one in the setup wizard, then setup is launched at boot.

This introduces a new intent action for the part of the setup wizard that
gets run for an ungrade, which the system uses to find its current version
tag for comparing against what was last stored.  It is up to the launched
setup activity update the stored setting to reflect its current value,
once it is happy.
2009-07-01 20:20:47 -07:00
Dianne Hackborn
cf098294da Move backup state to settings, change permission checks to use symbol.
This changes the backup service to use the settings provider instead
of system properties, correspondingly making it off by default and
allowing specific devices to define the transport.  Also tweaks
the permission checks to use the permission symbol instead of raw
strings.

This requires some corresponding changes in the vendor projects.
2009-07-01 20:12:36 -07:00
Android (Google) Code Review
2bbb80e183 Merge change 5994 into donut
* changes:
  Less logging in some places.  More in others.
2009-07-01 18:04:40 -07:00
Joe Onorato
9a5e3e115f Less logging in some places. More in others. 2009-07-01 21:04:03 -04:00
Romain Guy
a54755962c Cleanup a bunch of warnings in app widgets code. 2009-07-01 17:21:12 -07:00
Suchi Amalapurapu
b24a96701a Remove the constraint to assign new uid when code path changes for system packages 2009-07-01 16:16:56 -07:00
Android (Google) Code Review
d18dc8c641 Merge change 5906 into donut
* changes:
  resolve complex value in application context instead of system context.
2009-07-01 12:53:04 -07:00
Android (Google) Code Review
54af78a3f7 Merge change 5950 into donut
* changes:
  Fix memory leaks in system_server unlink DeathRecipients in a whole bunch of places to avoid memory leaks
2009-07-01 12:52:39 -07:00
Suchi Amalapurapu
fff2fda019 Fix memory leaks in system_server
unlink DeathRecipients in a whole bunch of places to avoid memory leaks
2009-07-01 12:55:30 -07:00
Christopher Tate
49401ddb9a Revamp backup scheduling policy
We now schedule a periodic check of pending backups; if any apps have requested
a backup since the last check, we perform all of the pending backups.  The
periodic backup scheduling matches the enable/disable state of the backup
manager; while backups are disabled entirely there are no periodic wakeups.

The period is set here to one hour.  If an external caller (transport, the
'bmgr' command line tool, etc) requests an immediate backup pass, that is
performed and then the periodic backup check is rescheduled using that pass as
the starting point of a new interval.
2009-07-01 12:38:06 -07:00
Christopher Tate
ce0bf069fe Use secure settings for backup enable / transport selection 2009-07-01 11:45:57 -07:00
Mitsuru Oshima
8f25c426b1 resolve complex value in application context instead of system context. 2009-07-01 00:10:43 -07:00
Christopher Tate
7958834e0e Run backups at background priority 2009-06-30 16:11:49 -07:00
Android (Google) Code Review
6e1647a212 Merge change 5829 into donut
* changes:
  Fix issue #1673793: Theme styles don't apply.
2009-06-30 14:04:55 -07:00
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
Dianne Hackborn
de7faf658c Fix issue #1673793: Theme styles don't apply.
It turns out this was not a problem in the resource code at all.  Rather,
the system process has a cache of pre-loaded attributes it uses to avoid
continually reloading things as it needs them.  Well it turns out this
cache wasn't flushed after a package was uninstalled or a configuration
changed, so you could re-install an app where you change its style resources
so its theme now points to one that is inconsistent in the cache.

This is mostly a problem for developers, where they continually install
new versions of an app where resources have changed.  This could possibly
show up when updating an app on a normal phone, although the problem would
eventually correct itself since this cache uses weak references.

Anyway, the cache is now reworked to be flushed appropriately.

This change also includes an update to aapt to be able to dump the
contents of bags in resources.
2009-06-30 13:27:30 -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