PageRenderTime 14ms CodeModel.GetById 10ms app.highlight 2ms RepoModel.GetById 2ms app.codeStats 0ms

/services/java/com/android/server/am/BackupRecord.java

https://github.com/aizuzi/platform_frameworks_base
Java | 58 lines | 32 code | 8 blank | 18 comment | 2 complexity | 84a28d078c9d14bd6fc5de7c11fdb678 MD5 | raw file
 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
17package com.android.server.am;
18
19import com.android.internal.os.BatteryStatsImpl;
20
21import android.content.pm.ApplicationInfo;
22
23/** @hide */
24final class BackupRecord {
25    // backup/restore modes
26    public static final int BACKUP_NORMAL = 0;
27    public static final int BACKUP_FULL = 1;
28    public static final int RESTORE = 2;
29    public static final int RESTORE_FULL = 3;
30    
31    final BatteryStatsImpl.Uid.Pkg.Serv stats;
32    String stringName;                     // cached toString() output
33    final ApplicationInfo appInfo;         // information about BackupAgent's app
34    final int backupMode;                  // full backup / incremental / restore
35    ProcessRecord app;                     // where this agent is running or null
36
37    // ----- Implementation -----
38
39    BackupRecord(BatteryStatsImpl.Uid.Pkg.Serv _agentStats, ApplicationInfo _appInfo,
40            int _backupMode) {
41        stats = _agentStats;
42        appInfo = _appInfo;
43        backupMode = _backupMode;
44    }
45
46    public String toString() {
47        if (stringName != null) {
48            return stringName;
49        }
50        StringBuilder sb = new StringBuilder(128);
51        sb.append("BackupRecord{")
52            .append(Integer.toHexString(System.identityHashCode(this)))
53            .append(' ').append(appInfo.packageName)
54            .append(' ').append(appInfo.name)
55            .append(' ').append(appInfo.backupAgentName).append('}');
56        return stringName = sb.toString();
57    }
58}