1 /* 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 17 package com.android.dialer.enrichedcall; 18 19 import android.support.annotation.NonNull; 20 import android.support.annotation.Nullable; 21 import com.android.dialer.enrichedcall.EnrichedCallManager.State; 22 import com.android.dialer.multimedia.MultimediaData; 23 24 /** Holds state information and data about enriched calling sessions. */ 25 public interface Session { 26 27 /** Id used for sessions that fail to start. */ 28 long NO_SESSION_ID = -1; 29 30 /** 31 * An id for the specific case when sending a message fails so early that a message id isn't 32 * created. 33 */ 34 String MESSAGE_ID_COULD_NOT_CREATE_ID = "messageIdCouldNotCreateId"; 35 36 /** 37 * Returns the id associated with this session, or {@link #NO_SESSION_ID} if this represents a 38 * session that failed to start. 39 */ 40 long getSessionId(); 41 42 /** Returns the id of the dialer call associated with this session, or null if there isn't one. */ 43 @Nullable 44 String getUniqueDialerCallId(); 45 46 void setUniqueDialerCallId(@NonNull String id); 47 48 /** Returns the number associated with the remote end of this session. */ 49 @NonNull 50 String getRemoteNumber(); 51 52 /** Returns the {@link State} for this session. */ 53 @State 54 int getState(); 55 56 /** Returns the {@link MultimediaData} associated with this session. */ 57 @NonNull 58 MultimediaData getMultimediaData(); 59 60 /** Returns type of this session, based on some arbitrarily defined type. */ 61 int getType(); 62 63 /** 64 * Sets the {@link MultimediaData} for this session. 65 * 66 * 67 * @throws IllegalArgumentException if the type is invalid 68 */ 69 void setSessionData(@NonNull MultimediaData multimediaData, int type); 70 } 71