Retrieve a monitor for backup Tasks when it's missing

Currently the monitor is already passed in via the
BackupManager#requestBackup API. This CL covers all the other entry
points to backups (that are still maintained).

Full backups:

1. FullBackupJob -- scheduled by the framework
2. The "bmgr fullbackup" adb command

Key-Value backups:

1. KeyValueBackupJob -- scheduled by the framework
2. BackupManager#backupNow API
3. "bmgr run" adb command

Requesting the monitor in PFTBT.java covers the full backup cases.
Unfortunately we can't request the monitor any earlier since PFTBT
only has access to a transport connection at this point. This means
sometimes (when KVBackupTask starts PFTBT when requestBackup() is
called) we won't need to request the monitor-- hence the null check.

Requesting it in BackupHandler when handling the MSG_RUN_BACKUP
covers the KV backups.

Bug: 252763821
Test: atest CtsBackupHostTestCases
Also manually by running the following commands and verifying the
correct methods are called with logcat logs.
  adb shell cmd jobscheduler run -f android {FullBackupJob id}
  adb shell bmgr fullbackup --all
  adb shell cmd jobscheduler run -f android {KeyValueBackupJob id}
  adb shell bmgr run --all

Change-Id: I1c49c30e5fa8d174f0974aef8384d1a113fa6c88
3 files changed