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 |
| 31 | final int backupMode; // full backup / incremental / restore |
| 32 | ProcessRecord app; // where this agent is running or null |
| 33 | |
| 34 | // ----- Implementation ----- |
| 35 | |
Bookatz | fc09927 | 2018-08-15 15:13:02 -0700 | [diff] [blame] | 36 | BackupRecord(ApplicationInfo _appInfo, int _backupMode) { |
Christopher Tate | 181fafa | 2009-05-14 11:12:14 -0700 | [diff] [blame] | 37 | appInfo = _appInfo; |
| 38 | backupMode = _backupMode; |
| 39 | } |
| 40 | |
| 41 | public String toString() { |
| 42 | if (stringName != null) { |
| 43 | return stringName; |
| 44 | } |
| 45 | StringBuilder sb = new StringBuilder(128); |
| 46 | sb.append("BackupRecord{") |
| 47 | .append(Integer.toHexString(System.identityHashCode(this))) |
| 48 | .append(' ').append(appInfo.packageName) |
| 49 | .append(' ').append(appInfo.name) |
| 50 | .append(' ').append(appInfo.backupAgentName).append('}'); |
| 51 | return stringName = sb.toString(); |
| 52 | } |
Joe Onorato | 8a9b220 | 2010-02-26 18:56:32 -0800 | [diff] [blame] | 53 | } |