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.RcsClientConfiguration; 20 import android.telephony.ims.stub.ImsConfigImplBase; 21 22 import java.util.HashMap; 23 24 public class TestImsConfig extends ImsConfigImplBase { 25 26 private HashMap<Integer, Integer> mIntHashMap = new HashMap<>(); 27 private HashMap<Integer, String> mStringHashMap = new HashMap<>(); 28 TestImsConfig()29 TestImsConfig() { 30 TestAcsClient.getInstance().setImsConfigImpl(this); 31 } 32 33 @Override setConfig(int item, int value)34 public int setConfig(int item, int value) { 35 mIntHashMap.put(item, value); 36 return ImsConfigImplBase.CONFIG_RESULT_SUCCESS; 37 } 38 39 @Override setConfig(int item, String value)40 public int setConfig(int item, String value) { 41 mStringHashMap.put(item, value); 42 return ImsConfigImplBase.CONFIG_RESULT_SUCCESS; 43 } 44 45 @Override getConfigInt(int item)46 public int getConfigInt(int item) { 47 Integer result = mIntHashMap.get(item); 48 return result != null ? result : ImsConfigImplBase.CONFIG_RESULT_UNKNOWN; 49 } 50 51 @Override getConfigString(int item)52 public String getConfigString(int item) { 53 return mStringHashMap.get(item); 54 } 55 56 @Override notifyRcsAutoConfigurationReceived(byte[] content, boolean isCompressed)57 public void notifyRcsAutoConfigurationReceived(byte[] content, boolean isCompressed) { 58 TestAcsClient.getInstance().onConfigChanged(content, isCompressed); 59 } 60 61 @Override notifyRcsAutoConfigurationRemoved()62 public void notifyRcsAutoConfigurationRemoved() { 63 super.notifyRcsAutoConfigurationRemoved(); 64 TestAcsClient.getInstance().onConfigRemoved(); 65 } 66 67 @Override setRcsClientConfiguration(RcsClientConfiguration rcc)68 public void setRcsClientConfiguration(RcsClientConfiguration rcc) { 69 super.setRcsClientConfiguration(rcc); 70 TestAcsClient.getInstance().onSetRcsClientConfiguration(rcc); 71 } 72 73 @Override triggerAutoConfiguration()74 public void triggerAutoConfiguration() { 75 super.triggerAutoConfiguration(); 76 TestAcsClient.getInstance().onTriggerAutoConfiguration(); 77 } 78 } 79