1 /* 2 * Copyright (C) 2017 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.net.wifi.hotspot2; 18 19 import android.annotation.SystemApi; 20 import android.net.wifi.WifiManager; 21 import android.os.Handler; 22 23 /** 24 * Base class for provisioning callbacks. Should be extended by applications and set when calling 25 * {@link WifiManager#startSubscriptionProvisioning(OsuProvider, ProvisioningCallback, Handler)}. 26 * 27 * @hide 28 */ 29 @SystemApi 30 public abstract class ProvisioningCallback { 31 32 /** 33 * The reason code for Provisioning Failure due to connection failure to OSU AP. 34 */ 35 public static final int OSU_FAILURE_AP_CONNECTION = 1; 36 37 /** 38 * The reason code for invalid server URL address. 39 */ 40 public static final int OSU_FAILURE_SERVER_URL_INVALID = 2; 41 42 /** 43 * The reason code for provisioning failure due to connection failure to the server. 44 */ 45 public static final int OSU_FAILURE_SERVER_CONNECTION = 3; 46 47 /** 48 * The reason code for provisioning failure due to invalid server certificate. 49 */ 50 public static final int OSU_FAILURE_SERVER_VALIDATION = 4; 51 52 /** 53 * The reason code for provisioning failure due to invalid service provider. 54 */ 55 public static final int OSU_FAILURE_SERVICE_PROVIDER_VERIFICATION = 5; 56 57 /** 58 * The reason code for provisioning failure when a provisioning flow is aborted. 59 */ 60 public static final int OSU_FAILURE_PROVISIONING_ABORTED = 6; 61 62 /** 63 * The reason code for provisioning failure when a provisioning flow is not possible. 64 */ 65 public static final int OSU_FAILURE_PROVISIONING_NOT_AVAILABLE = 7; 66 67 /** 68 * The reason code for provisioning failure due to invalid web url format for an OSU web page. 69 */ 70 public static final int OSU_FAILURE_INVALID_URL_FORMAT_FOR_OSU = 8; 71 72 /** 73 * The reason code for provisioning failure when a command received is not the expected command 74 * type. 75 */ 76 public static final int OSU_FAILURE_UNEXPECTED_COMMAND_TYPE = 9; 77 78 /** 79 * The reason code for provisioning failure when a SOAP message is not the expected message 80 * type. 81 */ 82 public static final int OSU_FAILURE_UNEXPECTED_SOAP_MESSAGE_TYPE = 10; 83 84 /** 85 * The reason code for provisioning failure when a SOAP message exchange fails. 86 */ 87 public static final int OSU_FAILURE_SOAP_MESSAGE_EXCHANGE = 11; 88 89 /** 90 * The reason code for provisioning failure when a redirect listener fails to start. 91 */ 92 public static final int OSU_FAILURE_START_REDIRECT_LISTENER = 12; 93 94 /** 95 * The reason code for provisioning failure when a redirect listener timed out to receive a HTTP 96 * redirect response. 97 */ 98 public static final int OSU_FAILURE_TIMED_OUT_REDIRECT_LISTENER = 13; 99 100 /** 101 * The reason code for provisioning failure when there is no OSU activity to listen to 102 * {@link WifiManager#ACTION_PASSPOINT_LAUNCH_OSU_VIEW} intent. 103 */ 104 public static final int OSU_FAILURE_NO_OSU_ACTIVITY_FOUND = 14; 105 106 /** 107 * The reason code for provisioning failure when the status of a SOAP message is not the 108 * expected message status. 109 */ 110 public static final int OSU_FAILURE_UNEXPECTED_SOAP_MESSAGE_STATUS = 15; 111 112 /** 113 * The reason code for provisioning failure when there is no PPS MO. 114 * MO. 115 */ 116 public static final int OSU_FAILURE_NO_PPS_MO = 16; 117 118 /** 119 * The reason code for provisioning failure when there is no AAAServerTrustRoot node in a PPS 120 * MO. 121 */ 122 public static final int OSU_FAILURE_NO_AAA_SERVER_TRUST_ROOT_NODE = 17; 123 124 /** 125 * The reason code for provisioning failure when there is no TrustRoot node for remediation 126 * server in a PPS MO. 127 */ 128 public static final int OSU_FAILURE_NO_REMEDIATION_SERVER_TRUST_ROOT_NODE = 18; 129 130 /** 131 * The reason code for provisioning failure when there is no TrustRoot node for policy server in 132 * a PPS MO. 133 */ 134 public static final int OSU_FAILURE_NO_POLICY_SERVER_TRUST_ROOT_NODE = 19; 135 136 /** 137 * The reason code for provisioning failure when failing to retrieve trust root certificates 138 * used for validating server certificate for AAA, Remediation and Policy server. 139 */ 140 public static final int OSU_FAILURE_RETRIEVE_TRUST_ROOT_CERTIFICATES = 20; 141 142 /** 143 * The reason code for provisioning failure when there is no trust root certificate for AAA 144 * server. 145 */ 146 public static final int OSU_FAILURE_NO_AAA_TRUST_ROOT_CERTIFICATE = 21; 147 148 /** 149 * The reason code for provisioning failure when a {@link PasspointConfiguration} is failed to 150 * install. 151 */ 152 public static final int OSU_FAILURE_ADD_PASSPOINT_CONFIGURATION = 22; 153 154 /** 155 * The reason code for provisioning failure when an {@link OsuProvider} is not found for 156 * provisioning. 157 */ 158 public static final int OSU_FAILURE_OSU_PROVIDER_NOT_FOUND = 23; 159 160 /** 161 * The status code for provisioning flow to indicate connecting to OSU AP 162 */ 163 public static final int OSU_STATUS_AP_CONNECTING = 1; 164 165 /** 166 * The status code for provisioning flow to indicate the OSU AP is connected. 167 */ 168 public static final int OSU_STATUS_AP_CONNECTED = 2; 169 170 /** 171 * The status code for provisioning flow to indicate connecting to the server. 172 */ 173 public static final int OSU_STATUS_SERVER_CONNECTING = 3; 174 175 /** 176 * The status code for provisioning flow to indicate the server certificate is validated. 177 */ 178 public static final int OSU_STATUS_SERVER_VALIDATED = 4; 179 180 /** 181 * The status code for provisioning flow to indicate the server is connected 182 */ 183 public static final int OSU_STATUS_SERVER_CONNECTED = 5; 184 185 /** 186 * The status code for provisioning flow to indicate starting the first SOAP exchange. 187 */ 188 public static final int OSU_STATUS_INIT_SOAP_EXCHANGE = 6; 189 190 /** 191 * The status code for provisioning flow to indicate waiting for a HTTP redirect response. 192 */ 193 public static final int OSU_STATUS_WAITING_FOR_REDIRECT_RESPONSE = 7; 194 195 /** 196 * The status code for provisioning flow to indicate a HTTP redirect response is received. 197 */ 198 public static final int OSU_STATUS_REDIRECT_RESPONSE_RECEIVED = 8; 199 200 /** 201 * The status code for provisioning flow to indicate starting the second SOAP exchange. 202 */ 203 public static final int OSU_STATUS_SECOND_SOAP_EXCHANGE = 9; 204 205 /** 206 * The status code for provisioning flow to indicate starting the third SOAP exchange. 207 */ 208 public static final int OSU_STATUS_THIRD_SOAP_EXCHANGE = 10; 209 210 /** 211 * The status code for provisioning flow to indicate starting a step retrieving trust root 212 * certs. 213 */ 214 public static final int OSU_STATUS_RETRIEVING_TRUST_ROOT_CERTS = 11; 215 216 /** 217 * Provisioning status for OSU failure 218 * 219 * @param status indicates error condition 220 */ onProvisioningFailure(int status)221 public abstract void onProvisioningFailure(int status); 222 223 /** 224 * Provisioning status when OSU is in progress 225 * 226 * @param status indicates status of OSU flow 227 */ onProvisioningStatus(int status)228 public abstract void onProvisioningStatus(int status); 229 230 /** 231 * Provisioning complete when provisioning/remediation flow completes 232 */ onProvisioningComplete()233 public abstract void onProvisioningComplete(); 234 } 235 236