Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f251e350 authored by Artem Iglikov's avatar Artem Iglikov
Browse files

Move inner classes of RefactoredBackupManagerService to their own files.

The move was done automatically separately for each class. For the
classes that are not static, instance of RBMS is passed in the
constructor.

To make this compilable all methods and fields of RBMS that are accessed
from the separated classes were made public. In later commits this will
be addressed.

Test: built, flashed, verified that bmgr backupnow works with RBMS
enabled.

Bug: 36850431

Change-Id: I2d9be8bb045d5c4d8106bc59630d3a278138b54f
parent 134a7e22
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -19,7 +19,7 @@ package com.android.server.backup;
/**
 * Interface and methods used by the asynchronous-with-timeout backup/restore operations.
 */
interface BackupRestoreTask {
public interface BackupRestoreTask {

    // Execute one tick of whatever state machine the task implements
    void execute();
+9 −9
Original line number Diff line number Diff line
@@ -19,15 +19,15 @@ package com.android.server.backup;
/**
 * Description of a file in the restore datastream.
 */
class FileMetadata {
    String packageName;             // name of the owning app
    String installerPackageName;    // name of the market-type app that installed the owner
    int type;                       // e.g. BackupAgent.TYPE_DIRECTORY
    String domain;                  // e.g. FullBackup.DATABASE_TREE_TOKEN
    String path;                    // subpath within the semantic domain
    long mode;                      // e.g. 0666 (actually int)
    long mtime;                     // last mod time, UTC time_t (actually int)
    long size;                      // bytes of content
public class FileMetadata {
    public String packageName;             // name of the owning app
    public String installerPackageName;    // name of the market-type app that installed the owner
    public int type;                       // e.g. BackupAgent.TYPE_DIRECTORY
    public String domain;                  // e.g. FullBackup.DATABASE_TREE_TOKEN
    public String path;                    // subpath within the semantic domain
    public long mode;                      // e.g. 0666 (actually int)
    public long mtime;                     // last mod time, UTC time_t (actually int)
    public long size;                      // bytes of content

    @Override
    public String toString() {
+4 −4
Original line number Diff line number Diff line
@@ -35,7 +35,7 @@ import java.io.OutputStream;
 * TODO: We should create unified backup/restore engines that can be used for both transport and
 * adb backup/restore, and for fullbackup and key-value backup.
 */
class KeyValueAdbBackupEngine {
public class KeyValueAdbBackupEngine {
    private static final String TAG = "KeyValueAdbBackupEngine";
    private static final boolean DEBUG = false;

@@ -58,7 +58,7 @@ class KeyValueAdbBackupEngine {
    private ParcelFileDescriptor mBackupData;
    private ParcelFileDescriptor mNewState;

    KeyValueAdbBackupEngine(OutputStream output, PackageInfo packageInfo,
    public KeyValueAdbBackupEngine(OutputStream output, PackageInfo packageInfo,
            BackupManagerServiceInterface backupManagerService, PackageManager packageManager,
            File baseStateDir, File dataDir) {
        mOutput = output;
@@ -81,7 +81,7 @@ class KeyValueAdbBackupEngine {
        mManifestFile = new File(mDataDir, BackupManagerService.BACKUP_MANIFEST_FILENAME);
    }

    void backupOnePackage() throws IOException {
    public void backupOnePackage() throws IOException {
        ApplicationInfo targetApp = mCurrentPackage.applicationInfo;

        try {
+4 −3
Original line number Diff line number Diff line
@@ -33,7 +33,7 @@ import java.util.Map;
 * TODO: We should create unified backup/restore engines that can be used for both transport and
 * adb backup/restore, and for fullbackup and key-value backup.
 */
class KeyValueAdbRestoreEngine implements Runnable {
public class KeyValueAdbRestoreEngine implements Runnable {
    private static final String TAG = "KeyValueAdbRestoreEngine";
    private static final boolean DEBUG = false;

@@ -46,8 +46,9 @@ class KeyValueAdbRestoreEngine implements Runnable {
    IBackupAgent mAgent;
    int mToken;

    KeyValueAdbRestoreEngine(BackupManagerServiceInterface backupManagerService, File dataDir,
            FileMetadata info, ParcelFileDescriptor inFD, IBackupAgent agent, int token) {
    public KeyValueAdbRestoreEngine(BackupManagerServiceInterface backupManagerService,
            File dataDir, FileMetadata info, ParcelFileDescriptor inFD, IBackupAgent agent,
            int token) {
        mBackupManagerService = backupManagerService;
        mDataDir = dataDir;
        mInfo = info;
+2 −2
Original line number Diff line number Diff line
@@ -108,11 +108,11 @@ public class PackageManagerBackupAgent extends BackupAgent {

    // We're constructed with the set of applications that are participating
    // in backup.  This set changes as apps are installed & removed.
    PackageManagerBackupAgent(PackageManager packageMgr, List<PackageInfo> packages) {
    public PackageManagerBackupAgent(PackageManager packageMgr, List<PackageInfo> packages) {
        init(packageMgr, packages);
    }

    PackageManagerBackupAgent(PackageManager packageMgr) {
    public PackageManagerBackupAgent(PackageManager packageMgr) {
        init(packageMgr, null);

        evaluateStorablePackages();
Loading