1 /*
2  * Copyright (C) 2023 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 android.app.appsearch.safeparcel;
17 
18 import android.os.Bundle;
19 import android.os.Parcel;
20 import android.util.SparseArray;
21 import android.util.SparseBooleanArray;
22 import android.util.SparseIntArray;
23 import android.util.SparseLongArray;
24 
25 @SafeParcelable.Class(creator = "TestSafeParcelableWithSparseArrayCreator")
26 public class TestSafeParcelableWithSparseArray extends AbstractSafeParcelable {
27     public static final Creator<TestSafeParcelableWithSparseArray> CREATOR =
28             new TestSafeParcelableWithSparseArrayCreator();
29 
30     @Field(id = 1)
31     final SparseBooleanArray mBooleans;
32 
33     @Field(id = 2)
34     final SparseIntArray mIntegers;
35 
36     @Field(id = 3)
37     final SparseLongArray mLongs;
38 
39     @Field(id = 4)
40     final SparseArray<Float> mFloats;
41 
42     @Field(id = 5)
43     final SparseArray<Double> mDoubles;
44 
45     @Field(id = 6)
46     final SparseArray<String> mStrings;
47 
48     @Field(id = 7)
49     final SparseArray<Bundle> mBundles;
50 
51     @Field(id = 8)
52     final SparseArray<byte[]> mBytes;
53 
54     @Constructor
TestSafeParcelableWithSparseArray( @aramid = 1) SparseBooleanArray booleans, @Param(id = 2) SparseIntArray integers, @Param(id = 3) SparseLongArray longs, @Param(id = 4) SparseArray<Float> floats, @Param(id = 5) SparseArray<Double> doubles, @Param(id = 6) SparseArray<String> strings, @Param(id = 7) SparseArray<Bundle> bundles, @Param(id = 8) SparseArray<byte[]> bytes)55     TestSafeParcelableWithSparseArray(
56             @Param(id = 1) SparseBooleanArray booleans,
57             @Param(id = 2) SparseIntArray integers,
58             @Param(id = 3) SparseLongArray longs,
59             @Param(id = 4) SparseArray<Float> floats,
60             @Param(id = 5) SparseArray<Double> doubles,
61             @Param(id = 6) SparseArray<String> strings,
62             @Param(id = 7) SparseArray<Bundle> bundles,
63             @Param(id = 8) SparseArray<byte[]> bytes) {
64         mBooleans = booleans;
65         mIntegers = integers;
66         mLongs = longs;
67         mFloats = floats;
68         mDoubles = doubles;
69         mStrings = strings;
70         mBundles = bundles;
71         mBytes = bytes;
72     }
73     ;
74 
75     @SuppressWarnings("static-access")
76     @Override
writeToParcel(Parcel out, int flags)77     public void writeToParcel(Parcel out, int flags) {
78         TestSafeParcelableWithSparseArrayCreator.writeToParcel(this, out, flags);
79     }
80 }
81