1cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak/* 2cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak * Copyright (c) 2016 The Android Open Source Project 3cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak * 4cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak * Licensed under the Apache License, Version 2.0 (the "License"); 5cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak * you may not use this file except in compliance with the License. 6cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak * You may obtain a copy of the License at 7cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak * 8cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak * http://www.apache.org/licenses/LICENSE-2.0 9cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak * 10cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak * Unless required by applicable law or agreed to in writing, software 11cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak * distributed under the License is distributed on an "AS IS" BASIS, 12cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak * See the License for the specific language governing permissions and 14cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak * limitations under the License. 15cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak */ 16cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak 17cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiakpackage com.android.ims.internal.uce.presence; 18cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak 19cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiakimport android.os.Parcel; 20cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiakimport android.os.Parcelable; 21cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiakimport java.util.Arrays; 22cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak 23cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak/** @hide */ 24cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiakpublic class PresResInstanceInfo implements Parcelable{ 25cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak 26cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak /** 27cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak * UCE resource instance state definitions. 28cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak * @hide 29cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak */ 30cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak 31cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak /** Active state. */ 32cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak public static final int UCE_PRES_RES_INSTANCE_STATE_ACTIVE = 0; 33cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak /** Pending state. */ 34cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak public static final int UCE_PRES_RES_INSTANCE_STATE_PENDING = 1; 35cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak /** Terminated state. */ 36cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak public static final int UCE_PRES_RES_INSTANCE_STATE_TERMINATED = 2; 37cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak /** Unknown state. */ 38cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak public static final int UCE_PRES_RES_INSTANCE_STATE_UNKNOWN = 3; 39cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak /** Unknown instance. */ 40cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak public static final int UCE_PRES_RES_INSTANCE_UNKNOWN = 4; 41cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak 42cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak 43cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak private int mResInstanceState; 44cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak private String mId = ""; 45cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak private String mReason = ""; 46cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak private String mPresentityUri = ""; 47cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak private PresTupleInfo mTupleInfoArray[]; 48cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak 49cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak 50cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak /** 51cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak * Gets the resource instance state. 52cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak * @hide 53cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak */ 54cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak public int getResInstanceState() { 55cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak return mResInstanceState; 56cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak } 57cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak 58cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak /** 59cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak * Sets the resource instance state. 60cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak * @hide 61cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak */ 62cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak public void setResInstanceState(int nResInstanceState) { 63cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak this.mResInstanceState = nResInstanceState; 64cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak } 65cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak 66cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak /** 67cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak * Gets the resource ID. 68cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak * @hide 69cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak */ 70cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak public String getResId() { 71cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak return mId; 72cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak } 73cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak 74cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak /** 75cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak * Sets the resource ID. 76cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak * @hide 77cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak */ 78cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak public void setResId(String resourceId) { 79cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak this.mId = resourceId; 80cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak } 81cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak 82cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak /** 83cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak * Gets the reason phrase associated with the SIP response 84cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak * code. 85cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak * @hide 86cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak */ 87cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak public String getReason() { 88cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak return mReason; 89cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak } 90cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak 91cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak /** 92cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak * Sets the reason phrase associated with the SIP response 93cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak * code. 94cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak * @hide 95cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak */ 96cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak public void setReason(String reason) { 97cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak this.mReason = reason; 98cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak } 99cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak 100cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak /** 101cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak * Gets the entity URI. 102cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak * @hide 103cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak */ 104cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak public String getPresentityUri() { 105cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak return mPresentityUri; 106cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak } 107cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak 108cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak /** 109cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak * Sets the entity URI. 110cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak * @hide 111cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak */ 112cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak public void setPresentityUri(String presentityUri) { 113cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak this.mPresentityUri = presentityUri; 114cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak } 115cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak 116cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak /** 117cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak * Gets the tuple information. 118cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak * @hide 119cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak */ 120cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak public PresTupleInfo[] getTupleInfo() { 121cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak return mTupleInfoArray; 122cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak } 123cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak 124cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak /** 125cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak * Sets the tuple information. 126cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak * @hide 127cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak */ 128cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak public void setTupleInfo(PresTupleInfo[] tupleInfo) { 129cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak this.mTupleInfoArray = new PresTupleInfo[tupleInfo.length]; 130cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak this.mTupleInfoArray = tupleInfo; 131cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak } 132cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak 133cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak 134cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak /** 135cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak * Constructor for the PresResInstanceInfo class. 136cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak * @hide 137cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak */ 138cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak public PresResInstanceInfo(){ 139cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak 140cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak }; 141cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak 142cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak /** @hide */ 143cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak public int describeContents() { 144cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak 145cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak return 0; 146cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak } 147cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak 148cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak /** @hide */ 149cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak public void writeToParcel(Parcel dest, int flags) { 150cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak dest.writeString(mId); 151cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak dest.writeString(mReason); 152cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak dest.writeInt(mResInstanceState); 153cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak dest.writeString(mPresentityUri); 154cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak dest.writeParcelableArray(mTupleInfoArray, flags); 155cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak } 156cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak 157cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak /** @hide */ 158cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak public static final Parcelable.Creator<PresResInstanceInfo> CREATOR = 159cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak new Parcelable.Creator<PresResInstanceInfo>() { 160cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak 161cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak public PresResInstanceInfo createFromParcel(Parcel source) { 162cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak 163cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak return new PresResInstanceInfo(source); 164cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak } 165cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak 166cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak public PresResInstanceInfo[] newArray(int size) { 167cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak 168cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak return new PresResInstanceInfo[size]; 169cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak } 170cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak }; 171cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak 172cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak /** @hide */ 173cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak private PresResInstanceInfo(Parcel source) { 174cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak readFromParcel(source); 175cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak } 176cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak 177cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak /** @hide */ 178cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak public void readFromParcel(Parcel source) { 179cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak mId = source.readString(); 180cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak mReason = source.readString(); 181cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak mResInstanceState = source.readInt(); 182cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak mPresentityUri = source.readString(); 183cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak Parcelable[] tempParcelableArray = source.readParcelableArray( 184cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak PresTupleInfo.class.getClassLoader()); 185cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak mTupleInfoArray = new PresTupleInfo[] {}; 186cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak if(tempParcelableArray != null) { 187cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak mTupleInfoArray = Arrays.copyOf(tempParcelableArray, tempParcelableArray.length, 188cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak PresTupleInfo[].class); 189cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak } 190cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak 191cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak } 192cfedd20d54687449bb6a6982085003cbf9a22bcbPavel Zhamaitsiak}