1 /*
2  * Copyright (C) 2020 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 package android.net.captiveportal;
17 
18 import androidx.annotation.NonNull;
19 import androidx.annotation.Nullable;
20 
21 import com.android.networkstack.apishim.common.CaptivePortalDataShim;
22 
23 /**
24  * Captive portal probe detection result including capport API detection result.
25  * @hide
26  */
27 public class CapportApiProbeResult extends CaptivePortalProbeResult {
28     // CaptivePortalData may be null if the capport API does not send any valid reply.
29     @Nullable
30     private final CaptivePortalDataShim mCapportData;
31 
CapportApiProbeResult(@onNull CaptivePortalProbeResult result, @Nullable CaptivePortalDataShim capportData)32     public CapportApiProbeResult(@NonNull CaptivePortalProbeResult result,
33             @Nullable CaptivePortalDataShim capportData) {
34         this(result.mHttpResponseCode, result.redirectUrl, result.detectUrl, capportData,
35                 result.probeType);
36     }
37 
CapportApiProbeResult(int httpResponseCode, @Nullable String redirectUrl, @Nullable String detectUrl, @Nullable CaptivePortalDataShim capportData, int probeType)38     public CapportApiProbeResult(int httpResponseCode, @Nullable String redirectUrl,
39             @Nullable String detectUrl, @Nullable CaptivePortalDataShim capportData,
40             int probeType) {
41         super(httpResponseCode, redirectUrl, detectUrl, probeType);
42         mCapportData = capportData;
43     }
44 
getCaptivePortalData()45     public CaptivePortalDataShim getCaptivePortalData() {
46         return mCapportData;
47     }
48 }
49