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

Commit 3b975459 authored by Artem Iglikov's avatar Artem Iglikov Committed by android-build-team Robot
Browse files

DO NOT MERGE Revert "DO NOT MERGE Update references to backup/restore agent timeouts"

This reverts commit f77cae61.

Reason for revert: crashes SUW

Bug: 76128378
Change-Id: Ia77af64892aa5a03109cc4ef4c2c04b256000ba9
(cherry picked from commit b873780a)
parent 36f47771
Loading
Loading
Loading
Loading
+8 −10
Original line number Diff line number Diff line
@@ -215,6 +215,13 @@ public class BackupManagerService implements BackupManagerServiceInterface {
    // Timeout interval for deciding that a bind or clear-data has taken too long
    private static final long TIMEOUT_INTERVAL = 10 * 1000;

    // Timeout intervals for agent backup & restore operations
    public static final long TIMEOUT_BACKUP_INTERVAL = 30 * 1000;
    public static final long TIMEOUT_FULL_BACKUP_INTERVAL = 5 * 60 * 1000;
    public static final long TIMEOUT_SHARED_BACKUP_INTERVAL = 30 * 60 * 1000;
    public static final long TIMEOUT_RESTORE_INTERVAL = 60 * 1000;
    public static final long TIMEOUT_RESTORE_FINISHED_INTERVAL = 30 * 1000;

    // User confirmation timeout for a full backup/restore operation.  It's this long in
    // order to give them time to enter the backup password.
    private static final long TIMEOUT_FULL_CONFIRMATION = 60 * 1000;
@@ -225,7 +232,6 @@ public class BackupManagerService implements BackupManagerServiceInterface {
    private static final int BUSY_BACKOFF_FUZZ = 1000 * 60 * 60 * 2;  // two hours

    private BackupManagerConstants mConstants;
    private BackupAgentTimeoutParameters mAgentTimeoutParameters;
    private Context mContext;
    private PackageManager mPackageManager;
    private IPackageManager mPackageManagerBinder;
@@ -309,10 +315,6 @@ public class BackupManagerService implements BackupManagerServiceInterface {
        return mConstants;
    }

    public BackupAgentTimeoutParameters getAgentTimeoutParameters() {
        return mAgentTimeoutParameters;
    }

    public Context getContext() {
        return mContext;
    }
@@ -854,10 +856,6 @@ public class BackupManagerService implements BackupManagerServiceInterface {
        // require frequent starting and stopping.
        mConstants.start();

        mAgentTimeoutParameters = new
                BackupAgentTimeoutParameters(mBackupHandler, mContext.getContentResolver());
        mAgentTimeoutParameters.start();

        // Set up the various sorts of package tracking we do
        mFullBackupScheduleFile = new File(mBaseStateDir, "fb-schedule");
        initPackageTracking();
@@ -3409,7 +3407,7 @@ public class BackupManagerService implements BackupManagerServiceInterface {
            }
            mActiveRestoreSession = new ActiveRestoreSession(this, packageName, transport);
            mBackupHandler.sendEmptyMessageDelayed(MSG_RESTORE_SESSION_TIMEOUT,
                    mAgentTimeoutParameters.getRestoreAgentTimeoutMillis());
                    TIMEOUT_RESTORE_INTERVAL);
        }
        return mActiveRestoreSession;
    }
+0 −3
Original line number Diff line number Diff line
@@ -191,7 +191,4 @@ public interface BackupManagerServiceInterface {
  void dump(FileDescriptor fd, PrintWriter pw, String[] args);

  IBackupManager getBackupManagerBinder();

  // Gets access to the backup/restore agent timeout parameters.
  BackupAgentTimeoutParameters getAgentTimeoutParameters();
}
+4 −7
Original line number Diff line number Diff line
@@ -4,8 +4,8 @@ import static android.os.ParcelFileDescriptor.MODE_CREATE;
import static android.os.ParcelFileDescriptor.MODE_READ_ONLY;
import static android.os.ParcelFileDescriptor.MODE_READ_WRITE;
import static android.os.ParcelFileDescriptor.MODE_TRUNCATE;

import static com.android.server.backup.BackupManagerService.OP_TYPE_BACKUP_WAIT;
import static com.android.server.backup.BackupManagerService.TIMEOUT_BACKUP_INTERVAL;

import android.app.ApplicationThreadConstants;
import android.app.IBackupAgent;
@@ -59,7 +59,6 @@ public class KeyValueAdbBackupEngine {
    private ParcelFileDescriptor mSavedState;
    private ParcelFileDescriptor mBackupData;
    private ParcelFileDescriptor mNewState;
    private final BackupAgentTimeoutParameters mAgentTimeoutParameters;

    public KeyValueAdbBackupEngine(OutputStream output, PackageInfo packageInfo,
            BackupManagerServiceInterface backupManagerService, PackageManager packageManager,
@@ -82,7 +81,6 @@ public class KeyValueAdbBackupEngine {
                pkg + BACKUP_KEY_VALUE_NEW_STATE_FILENAME_SUFFIX);

        mManifestFile = new File(mDataDir, BackupManagerService.BACKUP_MANIFEST_FILENAME);
        mAgentTimeoutParameters = backupManagerService.getAgentTimeoutParameters();
    }

    public void backupOnePackage() throws IOException {
@@ -150,9 +148,8 @@ public class KeyValueAdbBackupEngine {
    // Return true on backup success, false otherwise
    private boolean invokeAgentForAdbBackup(String packageName, IBackupAgent agent) {
        int token = mBackupManagerService.generateRandomIntegerToken();
        long kvBackupAgentTimeoutMillis = mAgentTimeoutParameters.getKvBackupAgentTimeoutMillis();
        try {
            mBackupManagerService.prepareOperationTimeout(token, kvBackupAgentTimeoutMillis, null,
            mBackupManagerService.prepareOperationTimeout(token, TIMEOUT_BACKUP_INTERVAL, null,
                    OP_TYPE_BACKUP_WAIT);

            // Start backup and wait for BackupManagerService to get callback for success or timeout
@@ -234,14 +231,14 @@ public class KeyValueAdbBackupEngine {
    }

    private void writeBackupData() throws IOException {

        int token = mBackupManagerService.generateRandomIntegerToken();
        long kvBackupAgentTimeoutMillis = mAgentTimeoutParameters.getKvBackupAgentTimeoutMillis();

        ParcelFileDescriptor[] pipes = null;
        try {
            pipes = ParcelFileDescriptor.createPipe();

            mBackupManagerService.prepareOperationTimeout(token, kvBackupAgentTimeoutMillis, null,
            mBackupManagerService.prepareOperationTimeout(token, TIMEOUT_BACKUP_INTERVAL, null,
                    OP_TYPE_BACKUP_WAIT);

            // We will have to create a runnable that will read the manifest and backup data we
+6 −6
Original line number Diff line number Diff line
@@ -25,6 +25,9 @@ import static com.android.server.backup.BackupManagerService.MORE_DEBUG;
import static com.android.server.backup.BackupManagerService.OP_TYPE_BACKUP_WAIT;
import static com.android.server.backup.BackupManagerService.SHARED_BACKUP_AGENT_PACKAGE;
import static com.android.server.backup.BackupManagerService.TAG;
import static com.android.server.backup.BackupManagerService.TIMEOUT_FULL_BACKUP_INTERVAL;
import static com.android.server.backup.BackupManagerService
        .TIMEOUT_SHARED_BACKUP_INTERVAL;

import android.app.ApplicationThreadConstants;
import android.app.IBackupAgent;
@@ -42,9 +45,8 @@ import android.util.Slog;
import android.util.StringBuilderPrinter;

import com.android.server.AppWidgetBackupBridge;
import com.android.server.backup.BackupAgentTimeoutParameters;
import com.android.server.backup.BackupManagerService;
import com.android.server.backup.BackupRestoreTask;
import com.android.server.backup.BackupManagerService;
import com.android.server.backup.utils.FullBackupUtils;

import java.io.BufferedOutputStream;
@@ -73,7 +75,6 @@ public class FullBackupEngine {
    private final long mQuota;
    private final int mOpToken;
    private final int mTransportFlags;
    private final BackupAgentTimeoutParameters mAgentTimeoutParameters;

    class FullBackupRunner implements Runnable {

@@ -136,8 +137,8 @@ public class FullBackupEngine {
                final boolean isSharedStorage =
                        mPackage.packageName.equals(SHARED_BACKUP_AGENT_PACKAGE);
                final long timeout = isSharedStorage ?
                        mAgentTimeoutParameters.getSharedBackupAgentTimeoutMillis() :
                        mAgentTimeoutParameters.getFullBackupAgentTimeoutMillis();
                        TIMEOUT_SHARED_BACKUP_INTERVAL :
                        TIMEOUT_FULL_BACKUP_INTERVAL;

                if (DEBUG) {
                    Slog.d(TAG, "Calling doFullBackup() on " + mPackage.packageName);
@@ -179,7 +180,6 @@ public class FullBackupEngine {
        mQuota = quota;
        mOpToken = opToken;
        mTransportFlags = transportFlags;
        mAgentTimeoutParameters = backupManagerService.getAgentTimeoutParameters();
    }

    public int preflightCheck() throws RemoteException {
+2 −6
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.server.backup.fullbackup;
import static com.android.server.backup.BackupManagerService.MORE_DEBUG;
import static com.android.server.backup.BackupManagerService.OP_TYPE_BACKUP_WAIT;
import static com.android.server.backup.BackupManagerService.TAG;
import static com.android.server.backup.BackupManagerService.TIMEOUT_FULL_BACKUP_INTERVAL;

import android.app.backup.IBackupManager;
import android.content.ComponentName;
@@ -32,7 +33,6 @@ import android.os.UserHandle;
import android.util.Slog;

import com.android.internal.backup.IObbBackupService;
import com.android.server.backup.BackupAgentTimeoutParameters;
import com.android.server.backup.BackupManagerService;
import com.android.server.backup.utils.FullBackupUtils;

@@ -46,12 +46,10 @@ public class FullBackupObbConnection implements ServiceConnection {

    private BackupManagerService backupManagerService;
    volatile IObbBackupService mService;
    private final BackupAgentTimeoutParameters mAgentTimeoutParameters;

    public FullBackupObbConnection(BackupManagerService backupManagerService) {
        this.backupManagerService = backupManagerService;
        mService = null;
        mAgentTimeoutParameters = backupManagerService.getAgentTimeoutParameters();
    }

    public void establish() {
@@ -77,10 +75,8 @@ public class FullBackupObbConnection implements ServiceConnection {
        try {
            pipes = ParcelFileDescriptor.createPipe();
            int token = backupManagerService.generateRandomIntegerToken();
            long fullBackupAgentTimeoutMillis =
                    mAgentTimeoutParameters.getFullBackupAgentTimeoutMillis();
            backupManagerService.prepareOperationTimeout(
                    token, fullBackupAgentTimeoutMillis, null, OP_TYPE_BACKUP_WAIT);
                    token, TIMEOUT_FULL_BACKUP_INTERVAL, null, OP_TYPE_BACKUP_WAIT);
            mService.backupObbs(pkg.packageName, pipes[1], token,
                    backupManagerService.getBackupManagerBinder());
            FullBackupUtils.routeSocketDataToOutput(pipes[0], out);
Loading