11d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi/*
21d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi * Copyright (C) 2016 The Android Open Source Project
31d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi *
41d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi * Licensed under the Apache License, Version 2.0 (the "License");
51d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi * you may not use this file except in compliance with the License.
61d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi * You may obtain a copy of the License at
71d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi *
81d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi *      http://www.apache.org/licenses/LICENSE-2.0
91d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi *
101d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi * Unless required by applicable law or agreed to in writing, software
111d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi * distributed under the License is distributed on an "AS IS" BASIS,
121d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
131d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi * See the License for the specific language governing permissions and
141d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi * limitations under the License.
151d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi */
161d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi
171d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshipackage android.hardware.location;
181d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi
191d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi
2078cebca7204f85ebb7c583bab2fc9891367cd403destradaaimport android.annotation.NonNull;
2178cebca7204f85ebb7c583bab2fc9891367cd403destradaaimport android.annotation.Nullable;
221d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshiimport android.annotation.SystemApi;
231d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshiimport android.os.Parcel;
241d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshiimport android.os.Parcelable;
251d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi
2678cebca7204f85ebb7c583bab2fc9891367cd403destradaaimport libcore.util.EmptyArray;
2778cebca7204f85ebb7c583bab2fc9891367cd403destradaa
281d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi/**
291d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi * @hide
301d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi */
311d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi@SystemApi
321d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshipublic class NanoAppInstanceInfo {
331d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi    private String mPublisher;
341d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi    private String mName;
351d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi
36b741e3b374e7eebf96e2104dec5caccf723b2a39Ashutosh Joshi    private long mAppId;
371d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi    private int mAppVersion;
381d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi
391d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi    private int mNeededReadMemBytes;
401d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi    private int mNeededWriteMemBytes;
411d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi    private int mNeededExecMemBytes;
421d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi
431d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi    private int[] mNeededSensors;
441d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi    private int[] mOutputEvents;
451d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi
461d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi    private int mContexthubId;
471d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi    private int mHandle;
481d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi
491d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi    public NanoAppInstanceInfo() {
5078cebca7204f85ebb7c583bab2fc9891367cd403destradaa        mNeededSensors = EmptyArray.INT;
5178cebca7204f85ebb7c583bab2fc9891367cd403destradaa        mOutputEvents = EmptyArray.INT;
521d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi    }
531d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi
541d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi    /**
551d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi     * get the publisher of this app
561d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi     *
571d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi     * @return String - name of the publisher
581d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi     */
591d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi    public String getPublisher() {
601d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi        return mPublisher;
611d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi    }
621d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi
631d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi
641d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi    /**
651d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi     * set the publisher name for the app
661d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi     *
671d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi     * @param publisher - name of the publisher
68b741e3b374e7eebf96e2104dec5caccf723b2a39Ashutosh Joshi     *
69b741e3b374e7eebf96e2104dec5caccf723b2a39Ashutosh Joshi     * @hide
701d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi     */
711d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi    public void setPublisher(String publisher) {
721d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi        mPublisher = publisher;
731d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi    }
741d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi
751d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi    /**
761d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi     * get the name of the app
771d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi     *
781d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi     * @return String - name of the app
791d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi     */
801d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi    public String getName() {
811d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi        return mName;
821d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi    }
831d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi
841d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi    /**
851d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi     * set the name of the app
861d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi     *
871d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi     * @param name - name of the app
88b741e3b374e7eebf96e2104dec5caccf723b2a39Ashutosh Joshi     *
89b741e3b374e7eebf96e2104dec5caccf723b2a39Ashutosh Joshi     * @hide
901d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi     */
911d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi    public void setName(String name) {
921d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi        mName = name;
931d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi    }
941d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi
951d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi    /**
961d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi     * Get the application identifier
971d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi     *
981d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi     * @return int - application identifier
991d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi     */
100b741e3b374e7eebf96e2104dec5caccf723b2a39Ashutosh Joshi    public long getAppId() {
1011d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi        return mAppId;
1021d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi    }
1031d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi
1041d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi    /**
1051d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi     * Set the application identifier
1061d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi     *
1071d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi     * @param appId - application identifier
108b741e3b374e7eebf96e2104dec5caccf723b2a39Ashutosh Joshi     *
109b741e3b374e7eebf96e2104dec5caccf723b2a39Ashutosh Joshi     * @hide
1101d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi     */
111b741e3b374e7eebf96e2104dec5caccf723b2a39Ashutosh Joshi    public void setAppId(long appId) {
1121d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi        mAppId = appId;
1131d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi    }
1141d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi
1151d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi    /**
116fe6d4f518a34aa620eda9fe36365c2f750e6c67fGreg Kaiser     * Get the application version
117fe6d4f518a34aa620eda9fe36365c2f750e6c67fGreg Kaiser     *
118fe6d4f518a34aa620eda9fe36365c2f750e6c67fGreg Kaiser     * NOTE: There is a race condition where shortly after loading, this
119fe6d4f518a34aa620eda9fe36365c2f750e6c67fGreg Kaiser     * may return -1 instead of the correct version.
120fe6d4f518a34aa620eda9fe36365c2f750e6c67fGreg Kaiser     *
121fe6d4f518a34aa620eda9fe36365c2f750e6c67fGreg Kaiser     * TODO(b/30970527): Fix this race condition.
1221d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi     *
1231d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi     * @return int - version of the app
1241d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi     */
1251d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi    public int getAppVersion() {
1261d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi        return mAppVersion;
1271d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi    }
1281d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi
1291d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi    /**
1301d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi     * Set the application version
1311d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi     *
1321d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi     * @param appVersion - version of the app
133b741e3b374e7eebf96e2104dec5caccf723b2a39Ashutosh Joshi     *
134b741e3b374e7eebf96e2104dec5caccf723b2a39Ashutosh Joshi     * @hide
1351d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi     */
1361d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi    public void setAppVersion(int appVersion) {
1371d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi        mAppVersion = appVersion;
1381d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi    }
1391d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi
1401d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi    /**
1411d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi     * Get the read memory needed by the app
1421d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi     *
1431d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi     * @return int - readable memory needed in bytes
1441d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi     */
1451d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi    public int getNeededReadMemBytes() {
1461d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi        return mNeededReadMemBytes;
1471d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi    }
1481d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi
1491d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi    /**
1501d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi     * Set the read memory needed by the app
1511d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi     *
1521d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi     * @param neededReadMemBytes - readable Memory needed in bytes
153b741e3b374e7eebf96e2104dec5caccf723b2a39Ashutosh Joshi     *
154b741e3b374e7eebf96e2104dec5caccf723b2a39Ashutosh Joshi     * @hide
1551d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi     */
1561d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi    public void setNeededReadMemBytes(int neededReadMemBytes) {
1571d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi        mNeededReadMemBytes = neededReadMemBytes;
1581d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi    }
1591d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi
1601d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi    /**
1611d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi     *  get writable memory needed by the app
1621d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi     *
1631d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi     * @return int - writable memory needed by the app
1641d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi     */
1651d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi    public int getNeededWriteMemBytes() {
1661d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi        return mNeededWriteMemBytes;
1671d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi    }
1681d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi
1691d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi    /**
1701d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi     * set writable memory needed by the app
1711d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi     *
1721d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi     * @param neededWriteMemBytes - writable memory needed by the
1731d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi     *                            app
174b741e3b374e7eebf96e2104dec5caccf723b2a39Ashutosh Joshi     *
175b741e3b374e7eebf96e2104dec5caccf723b2a39Ashutosh Joshi     * @hide
1761d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi     */
1771d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi    public void setNeededWriteMemBytes(int neededWriteMemBytes) {
1781d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi        mNeededWriteMemBytes = neededWriteMemBytes;
1791d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi    }
1801d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi
1811d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi    /**
1821d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi     * get executable memory needed by the app
1831d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi     *
1841d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi     * @return int - executable memory needed by the app
1851d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi     */
1861d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi    public int getNeededExecMemBytes() {
1871d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi        return mNeededExecMemBytes;
1881d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi    }
1891d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi
1901d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi    /**
1911d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi     * set executable memory needed by the app
1921d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi     *
1931d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi     * @param neededExecMemBytes - executable memory needed by the
1941d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi     *                           app
195b741e3b374e7eebf96e2104dec5caccf723b2a39Ashutosh Joshi     *
196b741e3b374e7eebf96e2104dec5caccf723b2a39Ashutosh Joshi     * @hide
1971d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi     */
1981d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi    public void setNeededExecMemBytes(int neededExecMemBytes) {
1991d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi        mNeededExecMemBytes = neededExecMemBytes;
2001d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi    }
2011d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi
2021d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi    /**
2031d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi     * Get the sensors needed by this app
2041d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi     *
2051d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi     * @return int[] all the required sensors needed by this app
2061d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi     */
20778cebca7204f85ebb7c583bab2fc9891367cd403destradaa    @NonNull
2081d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi    public int[] getNeededSensors() {
2091d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi        return mNeededSensors;
2101d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi    }
2111d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi
2121d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi    /**
2131d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi     * set the sensors needed by this app
2141d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi     *
2151d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi     * @param neededSensors - all the sensors needed by this app
216b741e3b374e7eebf96e2104dec5caccf723b2a39Ashutosh Joshi     *
217b741e3b374e7eebf96e2104dec5caccf723b2a39Ashutosh Joshi     * @hide
2181d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi     */
21978cebca7204f85ebb7c583bab2fc9891367cd403destradaa    public void setNeededSensors(@Nullable int[] neededSensors) {
22078cebca7204f85ebb7c583bab2fc9891367cd403destradaa        mNeededSensors = neededSensors != null ? neededSensors : EmptyArray.INT;
2211d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi    }
2221d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi
2231d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi    /**
2241d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi     * get the events generated by this app
2251d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi     *
2261d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi     * @return all the events that can be generated by this app
2271d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi     */
22878cebca7204f85ebb7c583bab2fc9891367cd403destradaa    @NonNull
2291d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi    public int[] getOutputEvents() {
2301d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi        return mOutputEvents;
2311d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi    }
2321d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi
2331d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi    /**
2341d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi     * set the output events that can be generated by this app
2351d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi     *
2361d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi     * @param outputEvents - the events that may be generated by
2371d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi     *                     this app
238b741e3b374e7eebf96e2104dec5caccf723b2a39Ashutosh Joshi     *
239b741e3b374e7eebf96e2104dec5caccf723b2a39Ashutosh Joshi     * @hide
2401d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi     */
24178cebca7204f85ebb7c583bab2fc9891367cd403destradaa    public void setOutputEvents(@Nullable int[] outputEvents) {
24278cebca7204f85ebb7c583bab2fc9891367cd403destradaa        mOutputEvents = outputEvents != null ? outputEvents : EmptyArray.INT;
2431d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi    }
2441d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi
2451d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi    /**
2461d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi     * get the context hub identifier
2471d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi     *
2481d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi     * @return int - system unique hub identifier
2491d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi     */
2501d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi    public int getContexthubId() {
2511d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi        return mContexthubId;
2521d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi    }
2531d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi
2541d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi    /**
2551d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi     * set the context hub identifier
2561d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi     *
2571d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi     * @param contexthubId - system wide unique identifier
258b741e3b374e7eebf96e2104dec5caccf723b2a39Ashutosh Joshi     *
259b741e3b374e7eebf96e2104dec5caccf723b2a39Ashutosh Joshi     * @hide
2601d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi     */
2611d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi    public void setContexthubId(int contexthubId) {
2621d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi        mContexthubId = contexthubId;
2631d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi    }
2641d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi
2651d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi    /**
2661d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi     * get a handle to the nano app instance
2671d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi     *
2681d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi     * @return int - handle to this instance
2691d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi     */
2701d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi    public int getHandle() {
2711d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi        return mHandle;
2721d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi    }
2731d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi
2741d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi    /**
2751d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi     * set the handle for an app instance
2761d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi     *
2771d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi     * @param handle - handle to this instance
278b741e3b374e7eebf96e2104dec5caccf723b2a39Ashutosh Joshi     *
279b741e3b374e7eebf96e2104dec5caccf723b2a39Ashutosh Joshi     * @hide
2801d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi     */
2811d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi    public void setHandle(int handle) {
2821d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi        mHandle = handle;
2831d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi    }
2841d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi
2851d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi
2861d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi    private NanoAppInstanceInfo(Parcel in) {
2871d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi        mPublisher = in.readString();
2881d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi        mName = in.readString();
2891d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi
290b741e3b374e7eebf96e2104dec5caccf723b2a39Ashutosh Joshi        mAppId = in.readLong();
2911d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi        mAppVersion = in.readInt();
2921d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi        mNeededReadMemBytes = in.readInt();
2931d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi        mNeededWriteMemBytes = in.readInt();
2941d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi        mNeededExecMemBytes = in.readInt();
2951d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi
29678cebca7204f85ebb7c583bab2fc9891367cd403destradaa        int neededSensorsLength = in.readInt();
29778cebca7204f85ebb7c583bab2fc9891367cd403destradaa        mNeededSensors = new int[neededSensorsLength];
2981d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi        in.readIntArray(mNeededSensors);
2991d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi
30078cebca7204f85ebb7c583bab2fc9891367cd403destradaa        int outputEventsLength = in.readInt();
30178cebca7204f85ebb7c583bab2fc9891367cd403destradaa        mOutputEvents = new int[outputEventsLength];
3021d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi        in.readIntArray(mOutputEvents);
3031d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi    }
3041d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi
3051d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi    public int describeContents() {
3061d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi        return 0;
3071d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi    }
3081d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi
3091d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi    public void writeToParcel(Parcel out, int flags) {
3101d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi        out.writeString(mPublisher);
3111d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi        out.writeString(mName);
312b741e3b374e7eebf96e2104dec5caccf723b2a39Ashutosh Joshi        out.writeLong(mAppId);
3131d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi        out.writeInt(mAppVersion);
3141d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi        out.writeInt(mContexthubId);
3151d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi        out.writeInt(mNeededReadMemBytes);
3161d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi        out.writeInt(mNeededWriteMemBytes);
3171d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi        out.writeInt(mNeededExecMemBytes);
3181d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi
31978cebca7204f85ebb7c583bab2fc9891367cd403destradaa        // arrays are never null
3201d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi        out.writeInt(mNeededSensors.length);
3211d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi        out.writeIntArray(mNeededSensors);
3221d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi        out.writeInt(mOutputEvents.length);
3231d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi        out.writeIntArray(mOutputEvents);
3241d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi    }
3251d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi
3261d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi    public static final Parcelable.Creator<NanoAppInstanceInfo> CREATOR
3271d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi            = new Parcelable.Creator<NanoAppInstanceInfo>() {
3281d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi        public NanoAppInstanceInfo createFromParcel(Parcel in) {
3291d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi            return new NanoAppInstanceInfo(in);
3301d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi        }
3311d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi
3321d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi        public NanoAppInstanceInfo[] newArray(int size) {
3331d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi            return new NanoAppInstanceInfo[size];
3341d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi        }
3351d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi    };
3366239cc6fe1d18ce4365c56346a09c7963dfa8f10Ashutosh Joshi
3376239cc6fe1d18ce4365c56346a09c7963dfa8f10Ashutosh Joshi    @Override
3386239cc6fe1d18ce4365c56346a09c7963dfa8f10Ashutosh Joshi    public String toString() {
3396239cc6fe1d18ce4365c56346a09c7963dfa8f10Ashutosh Joshi        String retVal = "handle : " + mHandle;
3406239cc6fe1d18ce4365c56346a09c7963dfa8f10Ashutosh Joshi        retVal += ", Id : 0x" + Long.toHexString(mAppId);
3416239cc6fe1d18ce4365c56346a09c7963dfa8f10Ashutosh Joshi        retVal += ", Version : " + mAppVersion;
3426239cc6fe1d18ce4365c56346a09c7963dfa8f10Ashutosh Joshi        retVal += ", Name : " + mName;
3436239cc6fe1d18ce4365c56346a09c7963dfa8f10Ashutosh Joshi        retVal += ", Publisher : " + mPublisher;
3446239cc6fe1d18ce4365c56346a09c7963dfa8f10Ashutosh Joshi
3456239cc6fe1d18ce4365c56346a09c7963dfa8f10Ashutosh Joshi        return retVal;
3466239cc6fe1d18ce4365c56346a09c7963dfa8f10Ashutosh Joshi    }
3471d1ac5409597ef668e52c6f27293eaf9af575e33Ashutosh Joshi}
348