1/* 2 * Copyright (C) 2006 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 17package com.android.internal.telephony.mocks; 18 19import android.net.LinkProperties; 20import android.net.NetworkCapabilities; 21import android.net.NetworkRequest; 22import android.os.Handler; 23import android.os.Message; 24import android.util.LocalLog; 25 26import com.android.internal.annotations.VisibleForTesting; 27import com.android.internal.telephony.DctConstants; 28import com.android.internal.telephony.dataconnection.DcTracker; 29 30import java.util.ArrayList; 31 32public class DcTrackerMock extends DcTracker { 33 public DcTrackerMock() { 34 } 35 @Override 36 public void registerServiceStateTrackerEvents() { 37 throw new RuntimeException("registerServiceStateTrackerEvents not implemented"); 38 } 39 @Override 40 public void unregisterServiceStateTrackerEvents() { 41 throw new RuntimeException("Not Implemented"); 42 } 43 @Override 44 public void setUserDataEnabled(boolean enable) { 45 throw new RuntimeException("Not Implemented"); 46 } 47 @Override 48 public long getSubId() { 49 throw new RuntimeException("Not Implemented"); 50 } 51 @Override 52 public DctConstants.Activity getActivity() { 53 throw new RuntimeException("Not Implemented"); 54 } 55 @Override 56 public boolean isApnSupported(String name) { 57 throw new RuntimeException("Not Implemented"); 58 } 59 @Override 60 public int getApnPriority(String name) { 61 throw new RuntimeException("Not Implemented"); 62 } 63 @Override 64 public LinkProperties getLinkProperties(String apnType) { 65 throw new RuntimeException("Not Implemented"); 66 } 67 @Override 68 public NetworkCapabilities getNetworkCapabilities(String apnType) { 69 throw new RuntimeException("Not Implemented"); 70 } 71 @Override 72 public String[] getActiveApnTypes() { 73 throw new RuntimeException("Not Implemented"); 74 } 75 @Override 76 public String getActiveApnString(String apnType) { 77 throw new RuntimeException("Not Implemented"); 78 } 79 @Override 80 public DctConstants.State getState(String apnType) { 81 throw new RuntimeException("Not Implemented"); 82 } 83 @Override 84 public DctConstants.State getOverallState() { 85 throw new RuntimeException("Not Implemented"); 86 } 87 @Override 88 public boolean hasMatchedTetherApnSetting() { 89 throw new RuntimeException("Not Implemented"); 90 } 91 @Override 92 public boolean getAutoAttachOnCreation() { 93 throw new RuntimeException("Not Implemented"); 94 } 95 @Override 96 public boolean isUserDataEnabled() { 97 throw new RuntimeException("Not Implemented"); 98 } 99 @Override 100 public boolean isDataEnabled() { 101 throw new RuntimeException("Not Implemented"); 102 } 103 @Override 104 public void setDataRoamingEnabledByUser(boolean enabled) { 105 throw new RuntimeException("Not Implemented"); 106 } 107 @Override 108 public boolean getDataRoamingEnabled() { 109 throw new RuntimeException("Not Implemented"); 110 } 111 @Override 112 public boolean isDisconnected() { 113 throw new RuntimeException("Not Implemented"); 114 } 115 @Override 116 public void update() { 117 throw new RuntimeException("Not Implemented"); 118 } 119 @Override 120 public void cleanUpAllConnections(String cause) { 121 throw new RuntimeException("Not Implemented"); 122 } 123 @Override 124 public void updateRecords() { 125 throw new RuntimeException("Not Implemented"); 126 } 127 @Override 128 public void cleanUpAllConnections(String cause, Message disconnectAllCompleteMsg) { 129 throw new RuntimeException("Not Implemented"); 130 } 131 @Override 132 public void registerForAllDataDisconnected(Handler h, int what, Object obj) { 133 throw new RuntimeException("Not Implemented"); 134 } 135 @Override 136 public void unregisterForAllDataDisconnected(Handler h) { 137 throw new RuntimeException("Not Implemented"); 138 } 139 @Override 140 public boolean setInternalDataEnabled(boolean enable) { 141 throw new RuntimeException("Not Implemented"); 142 } 143 @Override 144 public String[] getPcscfAddress(String apnType) { 145 throw new RuntimeException("Not Implemented"); 146 } 147 @Override 148 public void sendStartNetStatPoll(DctConstants.Activity activity) { 149 throw new RuntimeException("Not Implemented"); 150 } 151 @Override 152 public void sendStopNetStatPoll(DctConstants.Activity activity) { 153 throw new RuntimeException("Not Implemented"); 154 } 155 156 private final ArrayList<NetworkRequest> mRequestedNetworks = new ArrayList<NetworkRequest>(); 157 158 @Override 159 public void requestNetwork(NetworkRequest networkRequest, LocalLog log) { 160 synchronized (mRequestedNetworks) { 161 mRequestedNetworks.add(networkRequest); 162 } 163 } 164 165 @Override 166 public void releaseNetwork(NetworkRequest networkRequest, LocalLog log) { 167 synchronized (mRequestedNetworks) { 168 mRequestedNetworks.remove(networkRequest); 169 } 170 } 171 172 @VisibleForTesting 173 public int getNumberOfLiveRequests() { 174 synchronized (mRequestedNetworks) { 175 return mRequestedNetworks.size(); 176 } 177 } 178} 179