OSDN Git Service

Hold a wakelock during backup/restore/clear operations
authorChristopher Tate <ctate@google.com>
Fri, 3 Jul 2009 00:40:45 +0000 (17:40 -0700)
committerChristopher Tate <ctate@google.com>
Mon, 6 Jul 2009 18:49:49 +0000 (11:49 -0700)
commitb6787f2ee535338bb96df0ab8ad70a9f82760a25
tree3ee86e968edcbce4bc241e19c882cc13f3e89d07
parent7e8cbfc2bc3ea2334c38db7fd2b6a1e17eefcac6
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.
services/java/com/android/server/BackupManagerService.java