blob: 977f645db199cb71a0c2aad022158d14a91cd471 [file] [log] [blame]
Ashutosh Joshi1d1ac542016-01-18 17:19:27 -08001/*
2 * Copyright (C) 2016 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
17package android.hardware.location;
18
19
20import android.annotation.SystemApi;
21import android.os.Parcel;
22import android.os.Parcelable;
23
24/**
25 * @hide
26 */
27@SystemApi
28public class NanoAppInstanceInfo {
29 private String mPublisher;
30 private String mName;
31
Ashutosh Joshib741e3b2016-03-29 09:19:56 -070032 private long mAppId;
Ashutosh Joshi1d1ac542016-01-18 17:19:27 -080033 private int mAppVersion;
34
35 private int mNeededReadMemBytes;
36 private int mNeededWriteMemBytes;
37 private int mNeededExecMemBytes;
38
39 private int[] mNeededSensors;
40 private int[] mOutputEvents;
41
42 private int mContexthubId;
43 private int mHandle;
44
45 public NanoAppInstanceInfo() {
46 }
47
48 /**
49 * get the publisher of this app
50 *
51 * @return String - name of the publisher
52 */
53 public String getPublisher() {
54 return mPublisher;
55 }
56
57
58 /**
59 * set the publisher name for the app
60 *
61 * @param publisher - name of the publisher
Ashutosh Joshib741e3b2016-03-29 09:19:56 -070062 *
63 * @hide
Ashutosh Joshi1d1ac542016-01-18 17:19:27 -080064 */
65 public void setPublisher(String publisher) {
66 mPublisher = publisher;
67 }
68
69 /**
70 * get the name of the app
71 *
72 * @return String - name of the app
73 */
74 public String getName() {
75 return mName;
76 }
77
78 /**
79 * set the name of the app
80 *
81 * @param name - name of the app
Ashutosh Joshib741e3b2016-03-29 09:19:56 -070082 *
83 * @hide
Ashutosh Joshi1d1ac542016-01-18 17:19:27 -080084 */
85 public void setName(String name) {
86 mName = name;
87 }
88
89 /**
90 * Get the application identifier
91 *
92 * @return int - application identifier
93 */
Ashutosh Joshib741e3b2016-03-29 09:19:56 -070094 public long getAppId() {
Ashutosh Joshi1d1ac542016-01-18 17:19:27 -080095 return mAppId;
96 }
97
98 /**
99 * Set the application identifier
100 *
101 * @param appId - application identifier
Ashutosh Joshib741e3b2016-03-29 09:19:56 -0700102 *
103 * @hide
Ashutosh Joshi1d1ac542016-01-18 17:19:27 -0800104 */
Ashutosh Joshib741e3b2016-03-29 09:19:56 -0700105 public void setAppId(long appId) {
Ashutosh Joshi1d1ac542016-01-18 17:19:27 -0800106 mAppId = appId;
107 }
108
109 /**
110 * Set the application version
111 *
112 * @return int - version of the app
113 */
114 public int getAppVersion() {
115 return mAppVersion;
116 }
117
118 /**
119 * Set the application version
120 *
121 * @param appVersion - version of the app
Ashutosh Joshib741e3b2016-03-29 09:19:56 -0700122 *
123 * @hide
Ashutosh Joshi1d1ac542016-01-18 17:19:27 -0800124 */
125 public void setAppVersion(int appVersion) {
126 mAppVersion = appVersion;
127 }
128
129 /**
130 * Get the read memory needed by the app
131 *
132 * @return int - readable memory needed in bytes
133 */
134 public int getNeededReadMemBytes() {
135 return mNeededReadMemBytes;
136 }
137
138 /**
139 * Set the read memory needed by the app
140 *
141 * @param neededReadMemBytes - readable Memory needed in bytes
Ashutosh Joshib741e3b2016-03-29 09:19:56 -0700142 *
143 * @hide
Ashutosh Joshi1d1ac542016-01-18 17:19:27 -0800144 */
145 public void setNeededReadMemBytes(int neededReadMemBytes) {
146 mNeededReadMemBytes = neededReadMemBytes;
147 }
148
149 /**
150 * get writable memory needed by the app
151 *
152 * @return int - writable memory needed by the app
153 */
154 public int getNeededWriteMemBytes() {
155 return mNeededWriteMemBytes;
156 }
157
158 /**
159 * set writable memory needed by the app
160 *
161 * @param neededWriteMemBytes - writable memory needed by the
162 * app
Ashutosh Joshib741e3b2016-03-29 09:19:56 -0700163 *
164 * @hide
Ashutosh Joshi1d1ac542016-01-18 17:19:27 -0800165 */
166 public void setNeededWriteMemBytes(int neededWriteMemBytes) {
167 mNeededWriteMemBytes = neededWriteMemBytes;
168 }
169
170 /**
171 * get executable memory needed by the app
172 *
173 * @return int - executable memory needed by the app
174 */
175 public int getNeededExecMemBytes() {
176 return mNeededExecMemBytes;
177 }
178
179 /**
180 * set executable memory needed by the app
181 *
182 * @param neededExecMemBytes - executable memory needed by the
183 * app
Ashutosh Joshib741e3b2016-03-29 09:19:56 -0700184 *
185 * @hide
Ashutosh Joshi1d1ac542016-01-18 17:19:27 -0800186 */
187 public void setNeededExecMemBytes(int neededExecMemBytes) {
188 mNeededExecMemBytes = neededExecMemBytes;
189 }
190
191 /**
192 * Get the sensors needed by this app
193 *
194 * @return int[] all the required sensors needed by this app
195 */
196 public int[] getNeededSensors() {
197 return mNeededSensors;
198 }
199
200 /**
201 * set the sensors needed by this app
202 *
203 * @param neededSensors - all the sensors needed by this app
Ashutosh Joshib741e3b2016-03-29 09:19:56 -0700204 *
205 * @hide
Ashutosh Joshi1d1ac542016-01-18 17:19:27 -0800206 */
207 public void setNeededSensors(int[] neededSensors) {
208 mNeededSensors = neededSensors;
209 }
210
211 /**
212 * get the events generated by this app
213 *
214 * @return all the events that can be generated by this app
215 */
216 public int[] getOutputEvents() {
217 return mOutputEvents;
218 }
219
220 /**
221 * set the output events that can be generated by this app
222 *
223 * @param outputEvents - the events that may be generated by
224 * this app
Ashutosh Joshib741e3b2016-03-29 09:19:56 -0700225 *
226 * @hide
Ashutosh Joshi1d1ac542016-01-18 17:19:27 -0800227 */
228 public void setOutputEvents(int[] outputEvents) {
229 mOutputEvents = outputEvents;
230 }
231
232 /**
233 * get the context hub identifier
234 *
235 * @return int - system unique hub identifier
236 */
237 public int getContexthubId() {
238 return mContexthubId;
239 }
240
241 /**
242 * set the context hub identifier
243 *
244 * @param contexthubId - system wide unique identifier
Ashutosh Joshib741e3b2016-03-29 09:19:56 -0700245 *
246 * @hide
Ashutosh Joshi1d1ac542016-01-18 17:19:27 -0800247 */
248 public void setContexthubId(int contexthubId) {
249 mContexthubId = contexthubId;
250 }
251
252 /**
253 * get a handle to the nano app instance
254 *
255 * @return int - handle to this instance
256 */
257 public int getHandle() {
258 return mHandle;
259 }
260
261 /**
262 * set the handle for an app instance
263 *
264 * @param handle - handle to this instance
Ashutosh Joshib741e3b2016-03-29 09:19:56 -0700265 *
266 * @hide
Ashutosh Joshi1d1ac542016-01-18 17:19:27 -0800267 */
268 public void setHandle(int handle) {
269 mHandle = handle;
270 }
271
272
273 private NanoAppInstanceInfo(Parcel in) {
274 mPublisher = in.readString();
275 mName = in.readString();
276
Ashutosh Joshib741e3b2016-03-29 09:19:56 -0700277 mAppId = in.readLong();
Ashutosh Joshi1d1ac542016-01-18 17:19:27 -0800278 mAppVersion = in.readInt();
279 mNeededReadMemBytes = in.readInt();
280 mNeededWriteMemBytes = in.readInt();
281 mNeededExecMemBytes = in.readInt();
282
283 int mNeededSensorsLength = in.readInt();
284 mNeededSensors = new int[mNeededSensorsLength];
285 in.readIntArray(mNeededSensors);
286
287 int mOutputEventsLength = in.readInt();
288 mOutputEvents = new int[mOutputEventsLength];
289 in.readIntArray(mOutputEvents);
290 }
291
292 public int describeContents() {
293 return 0;
294 }
295
296 public void writeToParcel(Parcel out, int flags) {
297 out.writeString(mPublisher);
298 out.writeString(mName);
Ashutosh Joshib741e3b2016-03-29 09:19:56 -0700299 out.writeLong(mAppId);
Ashutosh Joshi1d1ac542016-01-18 17:19:27 -0800300 out.writeInt(mAppVersion);
301 out.writeInt(mContexthubId);
302 out.writeInt(mNeededReadMemBytes);
303 out.writeInt(mNeededWriteMemBytes);
304 out.writeInt(mNeededExecMemBytes);
305
306 out.writeInt(mNeededSensors.length);
307 out.writeIntArray(mNeededSensors);
308
309 out.writeInt(mOutputEvents.length);
310 out.writeIntArray(mOutputEvents);
Ashutosh Joshi1d1ac542016-01-18 17:19:27 -0800311 }
312
313 public static final Parcelable.Creator<NanoAppInstanceInfo> CREATOR
314 = new Parcelable.Creator<NanoAppInstanceInfo>() {
315 public NanoAppInstanceInfo createFromParcel(Parcel in) {
316 return new NanoAppInstanceInfo(in);
317 }
318
319 public NanoAppInstanceInfo[] newArray(int size) {
320 return new NanoAppInstanceInfo[size];
321 }
322 };
323}