Home | History | Annotate | Download | only in am
      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 
     19 import com.android.internal.os.BatteryStatsImpl;
     20 
     21 import android.content.pm.ApplicationInfo;
     22 
     23 /** @hide */
     24 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 
     30     final BatteryStatsImpl.Uid.Pkg.Serv stats;
     31     String stringName;                     // cached toString() output
     32     final ApplicationInfo appInfo;         // information about BackupAgent's app
     33     final int backupMode;                  // full backup / incremental / restore
     34     ProcessRecord app;                     // where this agent is running or null
     35 
     36     // ----- Implementation -----
     37 
     38     BackupRecord(BatteryStatsImpl.Uid.Pkg.Serv _agentStats, ApplicationInfo _appInfo,
     39             int _backupMode) {
     40         stats = _agentStats;
     41         appInfo = _appInfo;
     42         backupMode = _backupMode;
     43     }
     44 
     45     public String toString() {
     46         if (stringName != null) {
     47             return stringName;
     48         }
     49         StringBuilder sb = new StringBuilder(128);
     50         sb.append("BackupRecord{")
     51             .append(Integer.toHexString(System.identityHashCode(this)))
     52             .append(' ').append(appInfo.packageName)
     53             .append(' ').append(appInfo.name)
     54             .append(' ').append(appInfo.backupAgentName).append('}');
     55         return stringName = sb.toString();
     56     }
     57 }
     58