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

Commit a7a2a054 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge changes I3d638a98,I55d18254

* changes:
  [RefactoredBMS] Add tracing for UserState and a few services
  [RefactoredBMS] Call removeMessages() only for certain operations in RefactoredBackupManagerService#handleCancel()
parents 0d25e75d 3d87a5bf
Loading
Loading
Loading
Loading
+13 −2
Original line number Diff line number Diff line
@@ -77,6 +77,7 @@ import android.os.RemoteException;
import android.os.SELinux;
import android.os.ServiceManager;
import android.os.SystemClock;
import android.os.Trace;
import android.os.UserHandle;
import android.os.storage.IStorageManager;
import android.os.storage.StorageManager;
@@ -546,9 +547,12 @@ public class RefactoredBackupManagerService implements BackupManagerServiceInter
        @Override
        public void onUnlockUser(int userId) {
            if (userId == UserHandle.USER_SYSTEM) {
                Trace.traceBegin(Trace.TRACE_TAG_ACTIVITY_MANAGER, "backup init");
                sInstance.initialize(userId);
                Trace.traceEnd(Trace.TRACE_TAG_ACTIVITY_MANAGER);

                // Migrate legacy setting
                Trace.traceBegin(Trace.TRACE_TAG_ACTIVITY_MANAGER, "backup migrate");
                if (!backupSettingMigrated(userId)) {
                    if (DEBUG) {
                        Slog.i(TAG, "Backup enable apparently not migrated");
@@ -569,12 +573,15 @@ public class RefactoredBackupManagerService implements BackupManagerServiceInter
                        }
                    }
                }
                Trace.traceEnd(Trace.TRACE_TAG_ACTIVITY_MANAGER);

                Trace.traceBegin(Trace.TRACE_TAG_ACTIVITY_MANAGER, "backup enable");
                try {
                    sInstance.setBackupEnabled(readBackupEnableState(userId));
                } catch (RemoteException e) {
                    // can't happen; it's a local object
                }
                Trace.traceEnd(Trace.TRACE_TAG_ACTIVITY_MANAGER);
            }
        }
    }
@@ -1759,9 +1766,13 @@ public class RefactoredBackupManagerService implements BackupManagerServiceInter
                // Can't delete op from mCurrentOperations here. waitUntilOperationComplete may be
                // called after we receive cancel here. We need this op's state there.

                // Remove all pending timeout messages for this operation type.
                // Remove all pending timeout messages of types OP_TYPE_BACKUP_WAIT and
                // OP_TYPE_RESTORE_WAIT. On the other hand, OP_TYPE_BACKUP cannot time out and
                // doesn't require cancellation.
                if (op.type == OP_TYPE_BACKUP_WAIT || op.type == OP_TYPE_RESTORE_WAIT) {
                    mBackupHandler.removeMessages(getMessageIdForOperationType(op.type));
                }
            }
            mCurrentOpLock.notifyAll();
        }