blob: 37b4be4ea0ec929acc301a6f72b78a40074e3960 [file] [log] [blame]
Christopher Tate181fafa2009-05-14 11:12:14 -07001/*
2 * Copyright (C) 2009 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package com.android.server.am;
18
Christopher Tate181fafa2009-05-14 11:12:14 -070019import android.content.pm.ApplicationInfo;
20
21/** @hide */
Dianne Hackbornbe4e6aa2013-06-07 13:25:29 -070022final class BackupRecord {
Christopher Tate181fafa2009-05-14 11:12:14 -070023 // backup/restore modes
24 public static final int BACKUP_NORMAL = 0;
25 public static final int BACKUP_FULL = 1;
26 public static final int RESTORE = 2;
Christopher Tate75a99702011-05-18 16:28:19 -070027 public static final int RESTORE_FULL = 3;
Christopher Tate181fafa2009-05-14 11:12:14 -070028
Christopher Tate181fafa2009-05-14 11:12:14 -070029 String stringName; // cached toString() output
30 final ApplicationInfo appInfo; // information about BackupAgent's app
Ruslan Tkhakokhov063180f2019-01-28 20:29:46 +000031 final int userId; // user for which backup is performed
Christopher Tate181fafa2009-05-14 11:12:14 -070032 final int backupMode; // full backup / incremental / restore
33 ProcessRecord app; // where this agent is running or null
34
35 // ----- Implementation -----
36
Ruslan Tkhakokhov063180f2019-01-28 20:29:46 +000037 BackupRecord(ApplicationInfo _appInfo, int _backupMode, int _userId) {
Christopher Tate181fafa2009-05-14 11:12:14 -070038 appInfo = _appInfo;
39 backupMode = _backupMode;
Ruslan Tkhakokhov063180f2019-01-28 20:29:46 +000040 userId = _userId;
Christopher Tate181fafa2009-05-14 11:12:14 -070041 }
42
43 public String toString() {
44 if (stringName != null) {
45 return stringName;
46 }
47 StringBuilder sb = new StringBuilder(128);
48 sb.append("BackupRecord{")
49 .append(Integer.toHexString(System.identityHashCode(this)))
50 .append(' ').append(appInfo.packageName)
51 .append(' ').append(appInfo.name)
52 .append(' ').append(appInfo.backupAgentName).append('}');
53 return stringName = sb.toString();
54 }
Joe Onorato8a9b2202010-02-26 18:56:32 -080055}