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 android.content.pm.ApplicationInfo;
     20 
     21 /** @hide */
     22 final class BackupRecord {
     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;
     27     public static final int RESTORE_FULL = 3;
     28 
     29     String stringName;                     // cached toString() output
     30     final ApplicationInfo appInfo;         // information about BackupAgent's app
     31     final int userId;                      // user for which backup is performed
     32     final int backupMode;                  // full backup / incremental / restore
     33     ProcessRecord app;                     // where this agent is running or null
     34 
     35     // ----- Implementation -----
     36 
     37     BackupRecord(ApplicationInfo _appInfo, int _backupMode, int _userId) {
     38         appInfo = _appInfo;
     39         backupMode = _backupMode;
     40         userId = _userId;
     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     }
     55 }
     56