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.annotation.NonNull;
20 import android.annotation.Nullable;
21 import android.content.ComponentName;
22 import android.content.LocusId;
23 import android.os.Parcel;
24 import android.os.Parcelable;
25 
26 import com.android.internal.util.DataClass;
27 
28 import java.util.ArrayList;
29 import java.util.List;
30 
31 /**
32  * @hide
33  */
34 @DataClass(genParcelable = true, genToString = true)
35 public final class ShortcutQueryWrapper extends LauncherApps.ShortcutQuery implements Parcelable {
36 
ShortcutQueryWrapper(LauncherApps.ShortcutQuery query)37     public ShortcutQueryWrapper(LauncherApps.ShortcutQuery query) {
38         this();
39         mChangedSince = query.mChangedSince;
40         mPackage = query.mPackage;
41         mLocusIds = query.mLocusIds;
42         mShortcutIds = query.mShortcutIds;
43         mActivity = query.mActivity;
44         mQueryFlags = query.mQueryFlags;
45     }
46 
getChangedSince()47     public long getChangedSince() {
48         return mChangedSince;
49     }
50 
51     @Nullable
getPackage()52     public String getPackage() {
53         return mPackage;
54     }
55 
56     @Nullable
getLocusIds()57     public List<LocusId> getLocusIds() {
58         return mLocusIds;
59     }
60 
61     @Nullable
getShortcutIds()62     public List<String> getShortcutIds() {
63         return mShortcutIds;
64     }
65 
66     @Nullable
getActivity()67     public ComponentName getActivity() {
68         return mActivity;
69     }
70 
getQueryFlags()71     public int getQueryFlags() {
72         return mQueryFlags;
73     }
74 
75     // Code below generated by codegen v1.0.14.
76     //
77     // DO NOT MODIFY!
78     // CHECKSTYLE:OFF Generated code
79     //
80     // To regenerate run:
81     // $ codegen $ANDROID_BUILD_TOP/frameworks/base/core/java/android/content/pm/ShortcutQueryWrapper.java
82     //
83     // To exclude the generated code from IntelliJ auto-formatting enable (one-time):
84     //   Settings > Editor > Code Style > Formatter Control
85     //@formatter:off
86 
87 
88     @DataClass.Generated.Member
ShortcutQueryWrapper()89     public ShortcutQueryWrapper() {
90 
91         // onConstructed(); // You can define this method to get a callback
92     }
93 
94     @Override
95     @DataClass.Generated.Member
toString()96     public String toString() {
97         // You can override field toString logic by defining methods like:
98         // String fieldNameToString() { ... }
99 
100         return "ShortcutQueryWrapper { " +
101         " }";
102     }
103 
104     @Override
105     @DataClass.Generated.Member
writeToParcel(@onNull Parcel dest, int flags)106     public void writeToParcel(@NonNull Parcel dest, int flags) {
107         // You can override field parcelling by defining methods like:
108         // void parcelFieldName(Parcel dest, int flags) { ... }
109 
110         byte flg = 0;
111         if (mPackage != null) flg |= 0x2;
112         if (mShortcutIds != null) flg |= 0x4;
113         if (mLocusIds != null) flg |= 0x8;
114         if (mActivity != null) flg |= 0x10;
115         dest.writeByte(flg);
116         dest.writeLong(mChangedSince);
117         if (mPackage != null) dest.writeString(mPackage);
118         if (mShortcutIds != null) dest.writeStringList(mShortcutIds);
119         if (mLocusIds != null) dest.writeParcelableList(mLocusIds, flags);
120         if (mActivity != null) dest.writeTypedObject(mActivity, flags);
121         dest.writeInt(mQueryFlags);
122     }
123 
124     @Override
125     @DataClass.Generated.Member
describeContents()126     public int describeContents() { return 0; }
127 
128     /** @hide */
129     @SuppressWarnings({"unchecked", "RedundantCast"})
130     @DataClass.Generated.Member
ShortcutQueryWrapper(@onNull Parcel in)131     /* package-private */ ShortcutQueryWrapper(@NonNull Parcel in) {
132         // You can override field unparcelling by defining methods like:
133         // static FieldType unparcelFieldName(Parcel in) { ... }
134 
135         byte flg = in.readByte();
136         long changedSince = in.readLong();
137         String pkg = (flg & 0x2) == 0 ? null : in.readString();
138         List<String> shortcutIds = null;
139         if ((flg & 0x4) != 0) {
140             shortcutIds = new ArrayList<>();
141             in.readStringList(shortcutIds);
142         }
143         List<LocusId> locusIds = null;
144         if ((flg & 0x8) != 0) {
145             locusIds = new ArrayList<>();
146             in.readParcelableList(locusIds, LocusId.class.getClassLoader(), android.content.LocusId.class);
147         }
148         ComponentName activity = (flg & 0x10) == 0 ? null
149                 : (ComponentName) in.readTypedObject(ComponentName.CREATOR);
150         int queryFlags = in.readInt();
151 
152         this.mChangedSince = changedSince;
153         this.mPackage = pkg;
154         this.mShortcutIds = shortcutIds;
155         this.mLocusIds = locusIds;
156         this.mActivity = activity;
157         this.mQueryFlags = queryFlags;
158         com.android.internal.util.AnnotationValidations.validate(
159                 QueryFlags.class, null, mQueryFlags);
160 
161         // onConstructed(); // You can define this method to get a callback
162     }
163 
164     @DataClass.Generated.Member
165     public static final @NonNull Parcelable.Creator<ShortcutQueryWrapper> CREATOR
166             = new Parcelable.Creator<ShortcutQueryWrapper>() {
167         @Override
168         public ShortcutQueryWrapper[] newArray(int size) {
169             return new ShortcutQueryWrapper[size];
170         }
171 
172         @Override
173         public ShortcutQueryWrapper createFromParcel(@NonNull Parcel in) {
174             return new ShortcutQueryWrapper(in);
175         }
176     };
177 
178     @DataClass.Generated(
179             time = 1582049937960L,
180             codegenVersion = "1.0.14",
181             sourceFile = "frameworks/base/core/java/android/content/pm/ShortcutQueryWrapper.java",
182             inputSignatures = "public  long getChangedSince()\npublic @android.annotation.Nullable java.lang.String getPackage()\npublic @android.annotation.Nullable java.util.List<android.content.LocusId> getLocusIds()\npublic @android.annotation.Nullable java.util.List<java.lang.String> getShortcutIds()\npublic @android.annotation.Nullable android.content.ComponentName getActivity()\npublic  int getQueryFlags()\nclass ShortcutQueryWrapper extends android.content.pm.LauncherApps.ShortcutQuery implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genParcelable=true, genToString=true)")
183     @Deprecated
__metadata()184     private void __metadata() {}
185 
186 
187     //@formatter:on
188     // End of generated code
189 
190 }
191