1 /* 2 * Copyright (C) 2019 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.telephony.ims.cts; 18 19 import android.telephony.ims.stub.ImsConfigImplBase; 20 21 import java.util.HashMap; 22 23 public class TestImsConfig extends ImsConfigImplBase { 24 25 private HashMap<Integer, Integer> mIntHashMap = new HashMap<>(); 26 private HashMap<Integer, String> mStringHashMap = new HashMap<>(); 27 28 @Override setConfig(int item, int value)29 public int setConfig(int item, int value) { 30 mIntHashMap.put(item, value); 31 return ImsConfigImplBase.CONFIG_RESULT_SUCCESS; 32 } 33 34 @Override setConfig(int item, String value)35 public int setConfig(int item, String value) { 36 mStringHashMap.put(item, value); 37 return ImsConfigImplBase.CONFIG_RESULT_SUCCESS; 38 } 39 40 @Override getConfigInt(int item)41 public int getConfigInt(int item) { 42 Integer result = mIntHashMap.get(item); 43 return result != null ? result : ImsConfigImplBase.CONFIG_RESULT_UNKNOWN; 44 } 45 46 @Override getConfigString(int item)47 public String getConfigString(int item) { 48 return mStringHashMap.get(item); 49 } 50 51 @Override notifyRcsAutoConfigurationReceived(byte[] content, boolean isCompressed)52 public void notifyRcsAutoConfigurationReceived(byte[] content, boolean isCompressed) { 53 int item = isCompressed ? ImsUtils.ITEM_COMPRESSED : ImsUtils.ITEM_NON_COMPRESSED; 54 setConfig(item, new String(content)); 55 } 56 } 57