Richard Uhler | b29f145 | 2018-09-12 16:38:15 +0100 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (C) 2018 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.rollback; |
| 18 | |
| 19 | import android.annotation.TestApi; |
| 20 | import android.os.Parcel; |
| 21 | import android.os.Parcelable; |
| 22 | |
| 23 | /** |
| 24 | * Information about a set of packages that can be, or already have been |
| 25 | * rolled back together. |
| 26 | * |
| 27 | * @hide TODO: hidden, @TestApi until we decide on public vs. @SystemApi. |
| 28 | */ |
| 29 | @TestApi |
| 30 | public final class RollbackInfo implements Parcelable { |
| 31 | |
| 32 | /** |
| 33 | * The package that needs to be rolled back. |
| 34 | */ |
| 35 | public final PackageRollbackInfo targetPackage; |
| 36 | |
| 37 | // TODO: Add a list of additional packages rolled back due to atomic |
| 38 | // install dependencies when rollback of atomic installs is supported. |
| 39 | // TODO: Add a flag to indicate if reboot is required, when rollback of |
| 40 | // staged installs is supported. |
| 41 | |
| 42 | public RollbackInfo(PackageRollbackInfo targetPackage) { |
| 43 | this.targetPackage = targetPackage; |
| 44 | } |
| 45 | |
| 46 | private RollbackInfo(Parcel in) { |
| 47 | this.targetPackage = PackageRollbackInfo.CREATOR.createFromParcel(in); |
| 48 | } |
| 49 | |
| 50 | @Override |
| 51 | public int describeContents() { |
| 52 | return 0; |
| 53 | } |
| 54 | |
| 55 | @Override |
| 56 | public void writeToParcel(Parcel out, int flags) { |
| 57 | targetPackage.writeToParcel(out, flags); |
| 58 | } |
| 59 | |
| 60 | public static final Parcelable.Creator<RollbackInfo> CREATOR = |
| 61 | new Parcelable.Creator<RollbackInfo>() { |
| 62 | public RollbackInfo createFromParcel(Parcel in) { |
| 63 | return new RollbackInfo(in); |
| 64 | } |
| 65 | |
| 66 | public RollbackInfo[] newArray(int size) { |
| 67 | return new RollbackInfo[size]; |
| 68 | } |
| 69 | }; |
| 70 | } |