1 /* 2 * Copyright (C) 2016 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 android.app.backup; 18 19 import android.annotation.SystemApi; 20 import android.os.Parcel; 21 import android.os.Parcelable; 22 23 /** 24 * Information about current progress of full data backup 25 * Used in {@link BackupObserver#onUpdate(String, BackupProgress)} 26 * 27 * @hide 28 */ 29 @SystemApi 30 public class BackupProgress implements Parcelable { 31 32 /** 33 * Expected size of data in full backup. 34 */ 35 public final long bytesExpected; 36 /** 37 * Amount of backup data that is already saved in backup. 38 */ 39 public final long bytesTransferred; 40 BackupProgress(long _bytesExpected, long _bytesTransferred)41 public BackupProgress(long _bytesExpected, long _bytesTransferred) { 42 bytesExpected = _bytesExpected; 43 bytesTransferred = _bytesTransferred; 44 } 45 describeContents()46 public int describeContents() { 47 return 0; 48 } 49 writeToParcel(Parcel out, int flags)50 public void writeToParcel(Parcel out, int flags) { 51 out.writeLong(bytesExpected); 52 out.writeLong(bytesTransferred); 53 } 54 55 public static final @android.annotation.NonNull Creator<BackupProgress> CREATOR = new Creator<BackupProgress>() { 56 public BackupProgress createFromParcel(Parcel in) { 57 return new BackupProgress(in); 58 } 59 60 public BackupProgress[] newArray(int size) { 61 return new BackupProgress[size]; 62 } 63 }; 64 BackupProgress(Parcel in)65 private BackupProgress(Parcel in) { 66 bytesExpected = in.readLong(); 67 bytesTransferred = in.readLong(); 68 } 69 } 70