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

Commit 66fa3fb2 authored by Al Sutton's avatar Al Sutton
Browse files

[Cleanup] Rename variable to match standards

Change-Id: I8098f338602f90f9597f8cc7f703fb0b9459680f
Test: m -j (Build will fail if there are references to the old name)
parent fb3edce8
Loading
Loading
Loading
Loading
+48 −36
Original line number Diff line number Diff line
@@ -128,7 +128,7 @@ public class PerformFullTransportBackupTask extends FullBackupTask implements Ba

    private static final String TAG = "PFTBT";

    private UserBackupManagerService backupManagerService;
    private UserBackupManagerService mUserBackupManagerService;
    private final Object mCancelLock = new Object();

    ArrayList<PackageInfo> mPackages;
@@ -159,7 +159,7 @@ public class PerformFullTransportBackupTask extends FullBackupTask implements Ba
            @Nullable IBackupManagerMonitor monitor, @Nullable OnTaskFinishedListener listener,
            boolean userInitiated) {
        super(observer);
        this.backupManagerService = backupManagerService;
        this.mUserBackupManagerService = backupManagerService;
        mTransportClient = transportClient;
        mUpdateSchedule = updateSchedule;
        mLatch = latch;
@@ -252,16 +252,16 @@ public class PerformFullTransportBackupTask extends FullBackupTask implements Ba
    }

    private void registerTask() {
        synchronized (backupManagerService.getCurrentOpLock()) {
        synchronized (mUserBackupManagerService.getCurrentOpLock()) {
            Slog.d(TAG, "backupmanager pftbt token=" + Integer.toHexString(mCurrentOpToken));
            backupManagerService.getCurrentOperations().put(
            mUserBackupManagerService.getCurrentOperations().put(
                    mCurrentOpToken,
                    new Operation(OP_PENDING, this, OP_TYPE_BACKUP));
        }
    }

    public void unregisterTask() {
        backupManagerService.removeOperation(mCurrentOpToken);
        mUserBackupManagerService.removeOperation(mCurrentOpToken);
    }

    @Override
@@ -288,7 +288,7 @@ public class PerformFullTransportBackupTask extends FullBackupTask implements Ba

            mCancelAll = true;
            if (mIsDoingBackup) {
                backupManagerService.handleCancel(mBackupRunnerOpToken, cancelAll);
                mUserBackupManagerService.handleCancel(mBackupRunnerOpToken, cancelAll);
                try {
                    // If we're running a backup we should be connected to a transport
                    IBackupTransport transport =
@@ -320,16 +320,17 @@ public class PerformFullTransportBackupTask extends FullBackupTask implements Ba
        int backupRunStatus = BackupManager.SUCCESS;

        try {
            if (!backupManagerService.isEnabled() || !backupManagerService.isSetupComplete()) {
            if (!mUserBackupManagerService.isEnabled()
                    || !mUserBackupManagerService.isSetupComplete()) {
                // Backups are globally disabled, so don't proceed.
                if (DEBUG) {
                    Slog.i(TAG, "full backup requested but enabled=" + backupManagerService
                    Slog.i(TAG, "full backup requested but enabled=" + mUserBackupManagerService
                            .isEnabled()
                            + " setupComplete=" + backupManagerService.isSetupComplete()
                            + " setupComplete=" + mUserBackupManagerService.isSetupComplete()
                            + "; ignoring");
                }
                int monitoringEvent;
                if (backupManagerService.isSetupComplete()) {
                if (mUserBackupManagerService.isSetupComplete()) {
                    monitoringEvent = BackupManagerMonitor.LOG_EVENT_ID_BACKUP_DISABLED;
                } else {
                    monitoringEvent = BackupManagerMonitor.LOG_EVENT_ID_DEVICE_NOT_PROVISIONED;
@@ -532,7 +533,8 @@ public class PerformFullTransportBackupTask extends FullBackupTask implements Ba
                // Roll this package to the end of the backup queue if we're
                // in a queue-driven mode (regardless of success/failure)
                if (mUpdateSchedule) {
                    backupManagerService.enqueueFullBackup(packageName, System.currentTimeMillis());
                    mUserBackupManagerService.enqueueFullBackup(
                            packageName, System.currentTimeMillis());
                }

                if (backupPackageStatus == BackupTransport.TRANSPORT_PACKAGE_REJECTED) {
@@ -549,7 +551,8 @@ public class PerformFullTransportBackupTask extends FullBackupTask implements Ba
                    // from the preflight pass.  If we got as far as preflight, we now need
                    // to tear down the target process.
                    if (mBackupRunner != null) {
                        backupManagerService.tearDownAgentAndKill(currentPackage.applicationInfo);
                        mUserBackupManagerService.tearDownAgentAndKill(
                                currentPackage.applicationInfo);
                    }
                    // ... and continue looping.
                } else if (backupPackageStatus == BackupTransport.TRANSPORT_QUOTA_EXCEEDED) {
@@ -561,7 +564,7 @@ public class PerformFullTransportBackupTask extends FullBackupTask implements Ba
                        EventLog.writeEvent(EventLogTags.FULL_BACKUP_QUOTA_EXCEEDED,
                                packageName);
                    }
                    backupManagerService.tearDownAgentAndKill(currentPackage.applicationInfo);
                    mUserBackupManagerService.tearDownAgentAndKill(currentPackage.applicationInfo);
                    // Do nothing, clean up, and continue looping.
                } else if (backupPackageStatus == BackupTransport.AGENT_ERROR) {
                    BackupObserverUtils
@@ -569,7 +572,7 @@ public class PerformFullTransportBackupTask extends FullBackupTask implements Ba
                                    BackupManager.ERROR_AGENT_FAILURE);
                    Slog.w(TAG, "Application failure for package: " + packageName);
                    EventLog.writeEvent(EventLogTags.BACKUP_AGENT_FAILURE, packageName);
                    backupManagerService.tearDownAgentAndKill(currentPackage.applicationInfo);
                    mUserBackupManagerService.tearDownAgentAndKill(currentPackage.applicationInfo);
                    // Do nothing, clean up, and continue looping.
                } else if (backupPackageStatus == BackupManager.ERROR_BACKUP_CANCELLED) {
                    BackupObserverUtils
@@ -578,7 +581,7 @@ public class PerformFullTransportBackupTask extends FullBackupTask implements Ba
                    Slog.w(TAG, "Backup cancelled. package=" + packageName +
                            ", cancelAll=" + mCancelAll);
                    EventLog.writeEvent(EventLogTags.FULL_BACKUP_CANCELLED, packageName);
                    backupManagerService.tearDownAgentAndKill(currentPackage.applicationInfo);
                    mUserBackupManagerService.tearDownAgentAndKill(currentPackage.applicationInfo);
                    // Do nothing, clean up, and continue looping.
                } else if (backupPackageStatus != BackupTransport.TRANSPORT_OK) {
                    BackupObserverUtils
@@ -588,7 +591,7 @@ public class PerformFullTransportBackupTask extends FullBackupTask implements Ba
                    EventLog.writeEvent(EventLogTags.FULL_BACKUP_TRANSPORT_FAILURE);
                    // Abort entire backup pass.
                    backupRunStatus = BackupManager.ERROR_TRANSPORT_ABORTED;
                    backupManagerService.tearDownAgentAndKill(currentPackage.applicationInfo);
                    mUserBackupManagerService.tearDownAgentAndKill(currentPackage.applicationInfo);
                    return;
                } else {
                    // Success!
@@ -596,14 +599,14 @@ public class PerformFullTransportBackupTask extends FullBackupTask implements Ba
                            .sendBackupOnPackageResult(mBackupObserver, packageName,
                                    BackupManager.SUCCESS);
                    EventLog.writeEvent(EventLogTags.FULL_BACKUP_SUCCESS, packageName);
                    backupManagerService.logBackupComplete(packageName);
                    mUserBackupManagerService.logBackupComplete(packageName);
                }
                cleanUpPipes(transportPipes);
                cleanUpPipes(enginePipes);
                if (currentPackage.applicationInfo != null) {
                    Slog.i(TAG, "Unbinding agent in " + packageName);
                    try {
                        backupManagerService.getActivityManager().unbindBackupAgent(
                        mUserBackupManagerService.getActivityManager().unbindBackupAgent(
                                currentPackage.applicationInfo);
                    } catch (RemoteException e) { /* can't happen; activity manager is local */ }
                }
@@ -639,8 +642,8 @@ public class PerformFullTransportBackupTask extends FullBackupTask implements Ba
                mJob.finishBackupPass(mUserId);
            }

            synchronized (backupManagerService.getQueueLock()) {
                backupManagerService.setRunningFullBackupTask(null);
            synchronized (mUserBackupManagerService.getQueueLock()) {
                mUserBackupManagerService.setRunningFullBackupTask(null);
            }

            mListener.onFinished("PFTBT.run()");
@@ -650,11 +653,11 @@ public class PerformFullTransportBackupTask extends FullBackupTask implements Ba
            // Now that we're actually done with schedule-driven work, reschedule
            // the next pass based on the new queue state.
            if (mUpdateSchedule) {
                backupManagerService.scheduleNextFullBackupJob(backoff);
                mUserBackupManagerService.scheduleNextFullBackupJob(backoff);
            }

            Slog.i(TAG, "Full data backup pass finished.");
            backupManagerService.getWakelock().release();
            mUserBackupManagerService.getWakelock().release();
        }
    }

@@ -709,13 +712,13 @@ public class PerformFullTransportBackupTask extends FullBackupTask implements Ba
            long fullBackupAgentTimeoutMillis =
                    mAgentTimeoutParameters.getFullBackupAgentTimeoutMillis();
            try {
                backupManagerService.prepareOperationTimeout(
                mUserBackupManagerService.prepareOperationTimeout(
                        mCurrentOpToken, fullBackupAgentTimeoutMillis, this, OP_TYPE_BACKUP_WAIT);
                if (MORE_DEBUG) {
                    Slog.d(TAG, "Preflighting full payload of " + pkg.packageName);
                }
                agent.doMeasureFullBackup(mQuota, mCurrentOpToken,
                        backupManagerService.getBackupManagerBinder(), mTransportFlags);
                        mUserBackupManagerService.getBackupManagerBinder(), mTransportFlags);

                // Now wait to get our result back.  If this backstop timeout is reached without
                // the latch being thrown, flow will continue as though a result or "normal"
@@ -765,7 +768,7 @@ public class PerformFullTransportBackupTask extends FullBackupTask implements Ba
            }
            mResult.set(result);
            mLatch.countDown();
            backupManagerService.removeOperation(mCurrentOpToken);
            mUserBackupManagerService.removeOperation(mCurrentOpToken);
        }

        @Override
@@ -775,7 +778,7 @@ public class PerformFullTransportBackupTask extends FullBackupTask implements Ba
            }
            mResult.set(BackupTransport.AGENT_ERROR);
            mLatch.countDown();
            backupManagerService.removeOperation(mCurrentOpToken);
            mUserBackupManagerService.removeOperation(mCurrentOpToken);
        }

        @Override
@@ -812,7 +815,7 @@ public class PerformFullTransportBackupTask extends FullBackupTask implements Ba
            mOutput = ParcelFileDescriptor.dup(output.getFileDescriptor());
            mTarget = target;
            mCurrentOpToken = currentOpToken;
            mEphemeralToken = backupManagerService.generateRandomIntegerToken();
            mEphemeralToken = mUserBackupManagerService.generateRandomIntegerToken();
            mPreflight = new SinglePackageBackupPreflight(
                    transportClient, quota, mEphemeralToken, transportFlags);
            mPreflightLatch = new CountDownLatch(1);
@@ -825,23 +828,32 @@ public class PerformFullTransportBackupTask extends FullBackupTask implements Ba
        }

        void registerTask() {
            synchronized (backupManagerService.getCurrentOpLock()) {
                backupManagerService.getCurrentOperations().put(
            synchronized (mUserBackupManagerService.getCurrentOpLock()) {
                mUserBackupManagerService.getCurrentOperations().put(
                        mCurrentOpToken, new Operation(OP_PENDING, this, OP_TYPE_BACKUP_WAIT));
            }
        }

        void unregisterTask() {
            synchronized (backupManagerService.getCurrentOpLock()) {
                backupManagerService.getCurrentOperations().remove(mCurrentOpToken);
            synchronized (mUserBackupManagerService.getCurrentOpLock()) {
                mUserBackupManagerService.getCurrentOperations().remove(mCurrentOpToken);
            }
        }

        @Override
        public void run() {
            FileOutputStream out = new FileOutputStream(mOutput.getFileDescriptor());
            mEngine = new FullBackupEngine(backupManagerService, out, mPreflight, mTarget, false,
                    this, mQuota, mCurrentOpToken, mTransportFlags);
            mEngine =
                    new FullBackupEngine(
                            mUserBackupManagerService,
                            out,
                            mPreflight,
                            mTarget,
                            false,
                            this,
                            mQuota,
                            mCurrentOpToken,
                            mTransportFlags);
            try {
                try {
                    if (!mIsCancelled) {
@@ -928,13 +940,13 @@ public class PerformFullTransportBackupTask extends FullBackupTask implements Ba
                    mCurrentPackage, BackupManagerMonitor.LOG_EVENT_CATEGORY_AGENT, null);
            mIsCancelled = true;
            // Cancel tasks spun off by this task.
            backupManagerService.handleCancel(mEphemeralToken, cancelAll);
            backupManagerService.tearDownAgentAndKill(mTarget.applicationInfo);
            mUserBackupManagerService.handleCancel(mEphemeralToken, cancelAll);
            mUserBackupManagerService.tearDownAgentAndKill(mTarget.applicationInfo);
            // Free up everyone waiting on this task and its children.
            mPreflightLatch.countDown();
            mBackupLatch.countDown();
            // We are done with this operation.
            backupManagerService.removeOperation(mCurrentOpToken);
            mUserBackupManagerService.removeOperation(mCurrentOpToken);
        }
    }
}