Extract class AppsBackedUpOnThisDeviceJournal from BackupManagerService

Puts all the logic for remembering what apps have been backed up on
the current device into own class. Also fixes bug where if an app was
uninstalled, it was removed from the journal. As the journal is used
to decide what restore set to use after a fresh install of an app (as
at this point we do try to restore previous state if it's available)
it doesn't make sense to forget apps that were uninstalled.

Bug: 36850431
Test: adb shell am instrument -w -e package com.android.server.backup com.android.frameworks.servicestests/android.support.test.runner.AndroidJUnitRunner
Change-Id: I9300883e139ee0773acbf4a09b08c7f5955c66e5
3 files changed