1 /* 2 * Copyright (C) 2021 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.car.telemetry; 18 19 import android.annotation.NonNull; 20 import android.os.Parcel; 21 import android.os.Parcelable; 22 23 /** 24 * A parcelable that wraps around the Manifest name and version. 25 * 26 * @hide 27 */ 28 public final class ManifestKey implements Parcelable { 29 30 @NonNull 31 private String mName; 32 private int mVersion; 33 34 @NonNull getName()35 public String getName() { 36 return mName; 37 } 38 getVersion()39 public int getVersion() { 40 return mVersion; 41 } 42 43 @Override writeToParcel(@onNull Parcel out, int flags)44 public void writeToParcel(@NonNull Parcel out, int flags) { 45 out.writeString(mName); 46 out.writeInt(mVersion); 47 } 48 ManifestKey(Parcel in)49 private ManifestKey(Parcel in) { 50 mName = in.readString(); 51 mVersion = in.readInt(); 52 } 53 ManifestKey(@onNull String name, int version)54 public ManifestKey(@NonNull String name, int version) { 55 mName = name; 56 mVersion = version; 57 } 58 59 @Override describeContents()60 public int describeContents() { 61 return 0; 62 } 63 64 public static final @NonNull Parcelable.Creator<ManifestKey> CREATOR = 65 new Parcelable.Creator<ManifestKey>() { 66 @Override 67 public ManifestKey createFromParcel(Parcel in) { 68 return new ManifestKey(in); 69 } 70 71 @Override 72 public ManifestKey[] newArray(int size) { 73 return new ManifestKey[size]; 74 } 75 }; 76 } 77