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