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

Commit 1dee6daf authored by Sarp Misoglu's avatar Sarp Misoglu Committed by Android (Google) Code Review
Browse files

Merge "Retrieve a monitor for backup Tasks when it's missing"

parents f6c42f6f 1c781baf
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -376,6 +376,16 @@ public class PerformFullTransportBackupTask extends FullBackupTask implements Ba
                return;
            }

            // In some cases there may not be a monitor passed in when creating this task. So, if we
            // don't have one already we ask the transport for a monitor.
            if (mMonitor == null) {
                try {
                    mMonitor = transport.getBackupManagerMonitor();
                } catch (RemoteException e) {
                    Slog.i(TAG, "Failed to retrieve monitor from transport");
                }
            }

            // Set up to send data to the transport
            final int N = mPackages.size();
            final byte[] buffer = new byte[8192];
+10 −1
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import static com.android.server.backup.BackupManagerService.MORE_DEBUG;
import static com.android.server.backup.BackupManagerService.TAG;

import android.app.backup.BackupManager.OperationType;
import android.app.backup.IBackupManagerMonitor;
import android.app.backup.RestoreSet;
import android.os.Handler;
import android.os.HandlerThread;
@@ -203,6 +204,14 @@ public class BackupHandler extends Handler {
                    }
                }

                // Ask the transport for a monitor that will be used to relay log events back to it.
                IBackupManagerMonitor monitor = null;
                try {
                    monitor = transport.getBackupManagerMonitor();
                } catch (RemoteException e) {
                    Slog.i(TAG, "Failed to retrieve monitor from transport");
                }

                // At this point, we have started a new journal file, and the old
                // file identity is being passed to the backup processing task.
                // When it completes successfully, that old journal file will be
@@ -225,7 +234,7 @@ public class BackupHandler extends Handler {
                                queue,
                                oldJournal,
                                /* observer */ null,
                                /* monitor */ null,
                                monitor,
                                listener,
                                Collections.emptyList(),
                                /* userInitiated */ false,
+11 −0
Original line number Diff line number Diff line
@@ -18,10 +18,12 @@ package com.android.server.backup.transport;

import android.annotation.Nullable;
import android.app.backup.BackupTransport;
import android.app.backup.IBackupManagerMonitor;
import android.app.backup.RestoreDescription;
import android.app.backup.RestoreSet;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.os.IBinder;
import android.os.ParcelFileDescriptor;
import android.os.RemoteException;
import android.util.Slog;
@@ -362,6 +364,15 @@ public class BackupTransportClient {
        return result == null ? BackupTransport.TRANSPORT_ERROR : result;
    }

    /**
     * See {@link IBackupTransport#getBackupManagerMonitor()}
     */
    public IBackupManagerMonitor getBackupManagerMonitor() throws RemoteException {
        AndroidFuture<IBackupManagerMonitor> resultFuture = mTransportFutures.newFuture();
        mTransportBinder.getBackupManagerMonitor(resultFuture);
        return IBackupManagerMonitor.Stub.asInterface((IBinder) getFutureResult(resultFuture));
    }

    /**
     * Allows the {@link TransportConnection} to notify this client
     * if the underlying transport has become unusable.  If that happens