Christopher Tate | 181fafa | 2009-05-14 11:12:14 -0700 | [diff] [blame] | 1 | /* |
| 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 | |
| 17 | package com.android.server.am; |
| 18 | |
Christopher Tate | 181fafa | 2009-05-14 11:12:14 -0700 | [diff] [blame] | 19 | import android.content.pm.ApplicationInfo; |
| 20 | |
| 21 | /** @hide */ |
Dianne Hackborn | be4e6aa | 2013-06-07 13:25:29 -0700 | [diff] [blame] | 22 | final class BackupRecord { |
Christopher Tate | 181fafa | 2009-05-14 11:12:14 -0700 | [diff] [blame] | 23 | // 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 Tate | 75a9970 | 2011-05-18 16:28:19 -0700 | [diff] [blame] | 27 | public static final int RESTORE_FULL = 3; |
Christopher Tate | 181fafa | 2009-05-14 11:12:14 -0700 | [diff] [blame] | 28 | |
Christopher Tate | 181fafa | 2009-05-14 11:12:14 -0700 | [diff] [blame] | 29 | String stringName; // cached toString() output |
| 30 | final ApplicationInfo appInfo; // information about BackupAgent's app |
Ruslan Tkhakokhov | 063180f | 2019-01-28 20:29:46 +0000 | [diff] [blame] | 31 | final int userId; // user for which backup is performed |
Christopher Tate | 181fafa | 2009-05-14 11:12:14 -0700 | [diff] [blame] | 32 | final int backupMode; // full backup / incremental / restore |
| 33 | ProcessRecord app; // where this agent is running or null |
| 34 | |
| 35 | // ----- Implementation ----- |
| 36 | |
Ruslan Tkhakokhov | 063180f | 2019-01-28 20:29:46 +0000 | [diff] [blame] | 37 | BackupRecord(ApplicationInfo _appInfo, int _backupMode, int _userId) { |
Christopher Tate | 181fafa | 2009-05-14 11:12:14 -0700 | [diff] [blame] | 38 | appInfo = _appInfo; |
| 39 | backupMode = _backupMode; |
Ruslan Tkhakokhov | 063180f | 2019-01-28 20:29:46 +0000 | [diff] [blame] | 40 | userId = _userId; |
Christopher Tate | 181fafa | 2009-05-14 11:12:14 -0700 | [diff] [blame] | 41 | } |
| 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 Onorato | 8a9b220 | 2010-02-26 18:56:32 -0800 | [diff] [blame] | 55 | } |