1 /* 2 * Copyright (C) 2020 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.content.pm; 18 19 import android.os.Parcel; 20 import android.os.Parcelable; 21 22 /** 23 * Info about a package's states in Parcelable format. 24 * @hide 25 */ 26 public class IncrementalStatesInfo implements Parcelable { 27 private boolean mIsLoading; 28 private float mProgress; 29 30 private long mLoadingCompletedTime; 31 IncrementalStatesInfo(boolean isLoading, float progress, long loadingCompletedTime)32 public IncrementalStatesInfo(boolean isLoading, float progress, long loadingCompletedTime) { 33 mIsLoading = isLoading; 34 mProgress = progress; 35 mLoadingCompletedTime = loadingCompletedTime; 36 } 37 IncrementalStatesInfo(Parcel source)38 private IncrementalStatesInfo(Parcel source) { 39 mIsLoading = source.readBoolean(); 40 mProgress = source.readFloat(); 41 mLoadingCompletedTime = source.readLong(); 42 } 43 isLoading()44 public boolean isLoading() { 45 return mIsLoading; 46 } 47 getProgress()48 public float getProgress() { 49 return mProgress; 50 } 51 getLoadingCompletedTime()52 public long getLoadingCompletedTime() { 53 return mLoadingCompletedTime; 54 } 55 56 @Override describeContents()57 public int describeContents() { 58 return 0; 59 } 60 61 @Override writeToParcel(Parcel dest, int flags)62 public void writeToParcel(Parcel dest, int flags) { 63 dest.writeBoolean(mIsLoading); 64 dest.writeFloat(mProgress); 65 dest.writeLong(mLoadingCompletedTime); 66 } 67 68 public static final @android.annotation.NonNull Creator<IncrementalStatesInfo> CREATOR = 69 new Creator<IncrementalStatesInfo>() { 70 public IncrementalStatesInfo createFromParcel(Parcel source) { 71 return new IncrementalStatesInfo(source); 72 } 73 public IncrementalStatesInfo[] newArray(int size) { 74 return new IncrementalStatesInfo[size]; 75 } 76 }; 77 } 78