1f19bc1a0e5f7907587a51bacea25af6546831d02yinxu/*
2f19bc1a0e5f7907587a51bacea25af6546831d02yinxu * Copyright (C) 2017 The Android Open Source Project
3f19bc1a0e5f7907587a51bacea25af6546831d02yinxu *
4f19bc1a0e5f7907587a51bacea25af6546831d02yinxu * Licensed under the Apache License, Version 2.0 (the "License");
5f19bc1a0e5f7907587a51bacea25af6546831d02yinxu * you may not use this file except in compliance with the License.
6f19bc1a0e5f7907587a51bacea25af6546831d02yinxu * You may obtain a copy of the License at
7f19bc1a0e5f7907587a51bacea25af6546831d02yinxu *
8f19bc1a0e5f7907587a51bacea25af6546831d02yinxu *      http://www.apache.org/licenses/LICENSE-2.0
9f19bc1a0e5f7907587a51bacea25af6546831d02yinxu *
10f19bc1a0e5f7907587a51bacea25af6546831d02yinxu * Unless required by applicable law or agreed to in writing, software
11f19bc1a0e5f7907587a51bacea25af6546831d02yinxu * distributed under the License is distributed on an "AS IS" BASIS,
12f19bc1a0e5f7907587a51bacea25af6546831d02yinxu * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13f19bc1a0e5f7907587a51bacea25af6546831d02yinxu * See the License for the specific language governing permissions and
14f19bc1a0e5f7907587a51bacea25af6546831d02yinxu * limitations under the License.
15f19bc1a0e5f7907587a51bacea25af6546831d02yinxu */
16f19bc1a0e5f7907587a51bacea25af6546831d02yinxu
17f19bc1a0e5f7907587a51bacea25af6546831d02yinxupackage android.telephony;
18f19bc1a0e5f7907587a51bacea25af6546831d02yinxu
19bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxuimport android.annotation.IntDef;
20f19bc1a0e5f7907587a51bacea25af6546831d02yinxuimport android.os.Parcel;
21f19bc1a0e5f7907587a51bacea25af6546831d02yinxuimport android.os.Parcelable;
22f19bc1a0e5f7907587a51bacea25af6546831d02yinxu
236e2226d0fb13495b66c0c73310c53d86f78bc963Sooraj Sasindranimport java.util.ArrayList;
24f19bc1a0e5f7907587a51bacea25af6546831d02yinxuimport java.util.Arrays;
25bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxuimport java.lang.annotation.Retention;
26bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxuimport java.lang.annotation.RetentionPolicy;
27f19bc1a0e5f7907587a51bacea25af6546831d02yinxu
28f19bc1a0e5f7907587a51bacea25af6546831d02yinxu/**
29f19bc1a0e5f7907587a51bacea25af6546831d02yinxu * Defines a request to peform a network scan.
30f19bc1a0e5f7907587a51bacea25af6546831d02yinxu *
31f19bc1a0e5f7907587a51bacea25af6546831d02yinxu * This class defines whether the network scan will be performed only once or periodically until
32f19bc1a0e5f7907587a51bacea25af6546831d02yinxu * cancelled, when the scan is performed periodically, the time interval is not controlled by the
33f19bc1a0e5f7907587a51bacea25af6546831d02yinxu * user but defined by the modem vendor.
34f19bc1a0e5f7907587a51bacea25af6546831d02yinxu */
35f19bc1a0e5f7907587a51bacea25af6546831d02yinxupublic final class NetworkScanRequest implements Parcelable {
36f19bc1a0e5f7907587a51bacea25af6546831d02yinxu
37a88d1990b7482d94f20f2ba3d04a8eea8543e22dyinxu    // Below size limits for RAN/Band/Channel are for pre-treble modems and will be removed later.
38a88d1990b7482d94f20f2ba3d04a8eea8543e22dyinxu    /** @hide */
39a88d1990b7482d94f20f2ba3d04a8eea8543e22dyinxu    public static final int MAX_RADIO_ACCESS_NETWORKS = 8;
40a88d1990b7482d94f20f2ba3d04a8eea8543e22dyinxu    /** @hide */
41a88d1990b7482d94f20f2ba3d04a8eea8543e22dyinxu    public static final int MAX_BANDS = 8;
42a88d1990b7482d94f20f2ba3d04a8eea8543e22dyinxu    /** @hide */
43a88d1990b7482d94f20f2ba3d04a8eea8543e22dyinxu    public static final int MAX_CHANNELS = 32;
446e2226d0fb13495b66c0c73310c53d86f78bc963Sooraj Sasindran    /** @hide */
456e2226d0fb13495b66c0c73310c53d86f78bc963Sooraj Sasindran    public static final int MAX_MCC_MNC_LIST_SIZE = 20;
466e2226d0fb13495b66c0c73310c53d86f78bc963Sooraj Sasindran    /** @hide */
476e2226d0fb13495b66c0c73310c53d86f78bc963Sooraj Sasindran    public static final int MIN_SEARCH_PERIODICITY_SEC = 5;
486e2226d0fb13495b66c0c73310c53d86f78bc963Sooraj Sasindran    /** @hide */
496e2226d0fb13495b66c0c73310c53d86f78bc963Sooraj Sasindran    public static final int MAX_SEARCH_PERIODICITY_SEC = 300;
506e2226d0fb13495b66c0c73310c53d86f78bc963Sooraj Sasindran    /** @hide */
516e2226d0fb13495b66c0c73310c53d86f78bc963Sooraj Sasindran    public static final int MIN_SEARCH_MAX_SEC = 60;
526e2226d0fb13495b66c0c73310c53d86f78bc963Sooraj Sasindran    /** @hide */
536e2226d0fb13495b66c0c73310c53d86f78bc963Sooraj Sasindran    public static final int MAX_SEARCH_MAX_SEC = 3600;
546e2226d0fb13495b66c0c73310c53d86f78bc963Sooraj Sasindran    /** @hide */
556e2226d0fb13495b66c0c73310c53d86f78bc963Sooraj Sasindran    public static final int MIN_INCREMENTAL_PERIODICITY_SEC = 1;
566e2226d0fb13495b66c0c73310c53d86f78bc963Sooraj Sasindran    /** @hide */
576e2226d0fb13495b66c0c73310c53d86f78bc963Sooraj Sasindran    public static final int MAX_INCREMENTAL_PERIODICITY_SEC = 10;
58a88d1990b7482d94f20f2ba3d04a8eea8543e22dyinxu
59bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxu    /** @hide */
60bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxu    @Retention(RetentionPolicy.SOURCE)
61bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxu    @IntDef({
62bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxu        SCAN_TYPE_ONE_SHOT,
63bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxu        SCAN_TYPE_PERIODIC,
64bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxu    })
65bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxu    public @interface ScanType {}
66bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxu
67f19bc1a0e5f7907587a51bacea25af6546831d02yinxu    /** Performs the scan only once */
68f19bc1a0e5f7907587a51bacea25af6546831d02yinxu    public static final int SCAN_TYPE_ONE_SHOT = 0;
69f19bc1a0e5f7907587a51bacea25af6546831d02yinxu    /**
70f19bc1a0e5f7907587a51bacea25af6546831d02yinxu     * Performs the scan periodically until cancelled
71f19bc1a0e5f7907587a51bacea25af6546831d02yinxu     *
72f19bc1a0e5f7907587a51bacea25af6546831d02yinxu     * The modem will start new scans periodically, and the interval between two scans is usually
73f19bc1a0e5f7907587a51bacea25af6546831d02yinxu     * multiple minutes.
746e2226d0fb13495b66c0c73310c53d86f78bc963Sooraj Sasindran     */
75f19bc1a0e5f7907587a51bacea25af6546831d02yinxu    public static final int SCAN_TYPE_PERIODIC = 1;
76f19bc1a0e5f7907587a51bacea25af6546831d02yinxu
77f19bc1a0e5f7907587a51bacea25af6546831d02yinxu    /** Defines the type of the scan. */
78bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxu    private int mScanType;
79f19bc1a0e5f7907587a51bacea25af6546831d02yinxu
806e2226d0fb13495b66c0c73310c53d86f78bc963Sooraj Sasindran    /**
816e2226d0fb13495b66c0c73310c53d86f78bc963Sooraj Sasindran     * Search periodicity (in seconds).
826e2226d0fb13495b66c0c73310c53d86f78bc963Sooraj Sasindran     * Expected range for the input is [5s - 300s]
83bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxu     * This value must be less than or equal to mMaxSearchTime
846e2226d0fb13495b66c0c73310c53d86f78bc963Sooraj Sasindran     */
85bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxu    private int mSearchPeriodicity;
866e2226d0fb13495b66c0c73310c53d86f78bc963Sooraj Sasindran
876e2226d0fb13495b66c0c73310c53d86f78bc963Sooraj Sasindran    /**
886e2226d0fb13495b66c0c73310c53d86f78bc963Sooraj Sasindran     * Maximum duration of the periodic search (in seconds).
896e2226d0fb13495b66c0c73310c53d86f78bc963Sooraj Sasindran     * Expected range for the input is [60s - 3600s]
906e2226d0fb13495b66c0c73310c53d86f78bc963Sooraj Sasindran     * If the search lasts this long, it will be terminated.
916e2226d0fb13495b66c0c73310c53d86f78bc963Sooraj Sasindran     */
92bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxu    private int mMaxSearchTime;
936e2226d0fb13495b66c0c73310c53d86f78bc963Sooraj Sasindran
946e2226d0fb13495b66c0c73310c53d86f78bc963Sooraj Sasindran    /**
956e2226d0fb13495b66c0c73310c53d86f78bc963Sooraj Sasindran     * Indicates whether the modem should report incremental
966e2226d0fb13495b66c0c73310c53d86f78bc963Sooraj Sasindran     * results of the network scan to the client.
976e2226d0fb13495b66c0c73310c53d86f78bc963Sooraj Sasindran     * FALSE – Incremental results are not reported.
986e2226d0fb13495b66c0c73310c53d86f78bc963Sooraj Sasindran     * TRUE (default) – Incremental results are reported
996e2226d0fb13495b66c0c73310c53d86f78bc963Sooraj Sasindran     */
100bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxu    private boolean mIncrementalResults;
1016e2226d0fb13495b66c0c73310c53d86f78bc963Sooraj Sasindran
1026e2226d0fb13495b66c0c73310c53d86f78bc963Sooraj Sasindran    /**
1036e2226d0fb13495b66c0c73310c53d86f78bc963Sooraj Sasindran     * Indicates the periodicity with which the modem should
1046e2226d0fb13495b66c0c73310c53d86f78bc963Sooraj Sasindran     * report incremental results to the client (in seconds).
1056e2226d0fb13495b66c0c73310c53d86f78bc963Sooraj Sasindran     * Expected range for the input is [1s - 10s]
106bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxu     * This value must be less than or equal to mMaxSearchTime
1076e2226d0fb13495b66c0c73310c53d86f78bc963Sooraj Sasindran     */
108bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxu    private int mIncrementalResultsPeriodicity;
1096e2226d0fb13495b66c0c73310c53d86f78bc963Sooraj Sasindran
110f19bc1a0e5f7907587a51bacea25af6546831d02yinxu    /** Describes the radio access technologies with bands or channels that need to be scanned. */
111bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxu    private RadioAccessSpecifier[] mSpecifiers;
112f19bc1a0e5f7907587a51bacea25af6546831d02yinxu
113f19bc1a0e5f7907587a51bacea25af6546831d02yinxu    /**
1146e2226d0fb13495b66c0c73310c53d86f78bc963Sooraj Sasindran     * Describes the List of PLMN ids (MCC-MNC)
1156e2226d0fb13495b66c0c73310c53d86f78bc963Sooraj Sasindran     * If any PLMN of this list is found, search should end at that point and
1166e2226d0fb13495b66c0c73310c53d86f78bc963Sooraj Sasindran     * results with all PLMN found till that point should be sent as response.
1176e2226d0fb13495b66c0c73310c53d86f78bc963Sooraj Sasindran     * If list not sent, search to be completed till end and all PLMNs found to be reported.
1186e2226d0fb13495b66c0c73310c53d86f78bc963Sooraj Sasindran     * Max size of array is MAX_MCC_MNC_LIST_SIZE
1196e2226d0fb13495b66c0c73310c53d86f78bc963Sooraj Sasindran     */
120bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxu    private ArrayList<String> mMccMncs;
1216e2226d0fb13495b66c0c73310c53d86f78bc963Sooraj Sasindran
1226e2226d0fb13495b66c0c73310c53d86f78bc963Sooraj Sasindran    /**
123bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxu     * Creates a new NetworkScanRequest with mScanType and network mSpecifiers
124f19bc1a0e5f7907587a51bacea25af6546831d02yinxu     *
125bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxu     * @param scanType The type of the scan, can be either one shot or periodic
126f19bc1a0e5f7907587a51bacea25af6546831d02yinxu     * @param specifiers the radio network with bands / channels to be scanned
127bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxu     * @param searchPeriodicity The modem will restart the scan every searchPeriodicity seconds if
128bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxu     *                          no network has been found, until it reaches the maxSearchTime. Only
129bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxu     *                          valid when scan type is periodic scan.
130bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxu     * @param maxSearchTime Maximum duration of the search (in seconds)
1316e2226d0fb13495b66c0c73310c53d86f78bc963Sooraj Sasindran     * @param incrementalResults Indicates whether the modem should report incremental
1326e2226d0fb13495b66c0c73310c53d86f78bc963Sooraj Sasindran     *                           results of the network scan to the client
1336e2226d0fb13495b66c0c73310c53d86f78bc963Sooraj Sasindran     * @param incrementalResultsPeriodicity Indicates the periodicity with which the modem should
134bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxu     *                                      report incremental results to the client (in seconds),
135bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxu     *                                      only valid when incrementalResults is true
136bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxu     * @param mccMncs Describes the list of PLMN ids (MCC-MNC), once any network in the list has
137bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxu     *                been found, the scan will be terminated by the modem.
138f19bc1a0e5f7907587a51bacea25af6546831d02yinxu     */
1396e2226d0fb13495b66c0c73310c53d86f78bc963Sooraj Sasindran    public NetworkScanRequest(int scanType, RadioAccessSpecifier[] specifiers,
1406e2226d0fb13495b66c0c73310c53d86f78bc963Sooraj Sasindran                    int searchPeriodicity,
1416e2226d0fb13495b66c0c73310c53d86f78bc963Sooraj Sasindran                    int maxSearchTime,
1426e2226d0fb13495b66c0c73310c53d86f78bc963Sooraj Sasindran                    boolean incrementalResults,
1436e2226d0fb13495b66c0c73310c53d86f78bc963Sooraj Sasindran                    int incrementalResultsPeriodicity,
1446e2226d0fb13495b66c0c73310c53d86f78bc963Sooraj Sasindran                    ArrayList<String> mccMncs) {
145bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxu        this.mScanType = scanType;
146f45c9464213be26f93bc99625e0f6c18e7332a76yinxu        if (specifiers != null) {
147f45c9464213be26f93bc99625e0f6c18e7332a76yinxu            this.mSpecifiers = specifiers.clone();
148f45c9464213be26f93bc99625e0f6c18e7332a76yinxu        } else {
149f45c9464213be26f93bc99625e0f6c18e7332a76yinxu            this.mSpecifiers = null;
150f45c9464213be26f93bc99625e0f6c18e7332a76yinxu        }
151bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxu        this.mSearchPeriodicity = searchPeriodicity;
152bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxu        this.mMaxSearchTime = maxSearchTime;
153bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxu        this.mIncrementalResults = incrementalResults;
154bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxu        this.mIncrementalResultsPeriodicity = incrementalResultsPeriodicity;
1555f460b6837e7f8def753cef37af700d60acc8d6eCassie        if (mccMncs != null) {
156bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxu            this.mMccMncs = (ArrayList<String>) mccMncs.clone();
1576e2226d0fb13495b66c0c73310c53d86f78bc963Sooraj Sasindran        } else {
158bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxu            this.mMccMncs = new ArrayList<>();
1596e2226d0fb13495b66c0c73310c53d86f78bc963Sooraj Sasindran        }
160f19bc1a0e5f7907587a51bacea25af6546831d02yinxu    }
161f19bc1a0e5f7907587a51bacea25af6546831d02yinxu
162bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxu    /** Returns the type of the scan. */
163bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxu    @ScanType
164bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxu    public int getScanType() {
165bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxu        return mScanType;
166bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxu    }
167bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxu
168bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxu    /** Returns the search periodicity in seconds. */
169bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxu    public int getSearchPeriodicity() {
170bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxu        return mSearchPeriodicity;
171bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxu    }
172bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxu
173bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxu    /** Returns maximum duration of the periodic search in seconds. */
174bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxu    public int getMaxSearchTime() {
175bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxu        return mMaxSearchTime;
176bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxu    }
177bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxu
178bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxu    /**
179bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxu     * Returns whether incremental result is enabled.
180bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxu     * FALSE – Incremental results is not enabled.
181bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxu     * TRUE – Incremental results is reported.
182bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxu     */
183bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxu    public boolean getIncrementalResults() {
184bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxu        return mIncrementalResults;
185bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxu    }
186bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxu
187bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxu    /** Returns the periodicity in seconds of incremental results. */
188bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxu    public int getIncrementalResultsPeriodicity() {
189bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxu        return mIncrementalResultsPeriodicity;
190bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxu    }
191bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxu
192bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxu    /** Returns the radio access technologies with bands or channels that need to be scanned. */
193bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxu    public RadioAccessSpecifier[] getSpecifiers() {
194f45c9464213be26f93bc99625e0f6c18e7332a76yinxu        return mSpecifiers == null ? null : mSpecifiers.clone();
195bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxu    }
196bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxu
197bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxu    /**
198bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxu     * Returns the List of PLMN ids (MCC-MNC) for early termination of scan.
199bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxu     * If any PLMN of this list is found, search should end at that point and
200bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxu     * results with all PLMN found till that point should be sent as response.
201bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxu     */
202bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxu    public ArrayList<String> getPlmns() {
203bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxu        return (ArrayList<String>) mMccMncs.clone();
204bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxu    }
205bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxu
206f19bc1a0e5f7907587a51bacea25af6546831d02yinxu    @Override
207f19bc1a0e5f7907587a51bacea25af6546831d02yinxu    public int describeContents() {
208f19bc1a0e5f7907587a51bacea25af6546831d02yinxu        return 0;
209f19bc1a0e5f7907587a51bacea25af6546831d02yinxu    }
210f19bc1a0e5f7907587a51bacea25af6546831d02yinxu
211f19bc1a0e5f7907587a51bacea25af6546831d02yinxu    @Override
212f19bc1a0e5f7907587a51bacea25af6546831d02yinxu    public void writeToParcel(Parcel dest, int flags) {
213bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxu        dest.writeInt(mScanType);
214bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxu        dest.writeParcelableArray(mSpecifiers, flags);
215bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxu        dest.writeInt(mSearchPeriodicity);
216bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxu        dest.writeInt(mMaxSearchTime);
217bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxu        dest.writeBoolean(mIncrementalResults);
218bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxu        dest.writeInt(mIncrementalResultsPeriodicity);
219bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxu        dest.writeStringList(mMccMncs);
220f19bc1a0e5f7907587a51bacea25af6546831d02yinxu    }
221f19bc1a0e5f7907587a51bacea25af6546831d02yinxu
222f19bc1a0e5f7907587a51bacea25af6546831d02yinxu    private NetworkScanRequest(Parcel in) {
223bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxu        mScanType = in.readInt();
224bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxu        mSpecifiers = (RadioAccessSpecifier[]) in.readParcelableArray(
225f19bc1a0e5f7907587a51bacea25af6546831d02yinxu                Object.class.getClassLoader(),
226f19bc1a0e5f7907587a51bacea25af6546831d02yinxu                RadioAccessSpecifier.class);
227bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxu        mSearchPeriodicity = in.readInt();
228bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxu        mMaxSearchTime = in.readInt();
229bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxu        mIncrementalResults = in.readBoolean();
230bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxu        mIncrementalResultsPeriodicity = in.readInt();
231bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxu        mMccMncs = new ArrayList<>();
232bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxu        in.readStringList(mMccMncs);
233f19bc1a0e5f7907587a51bacea25af6546831d02yinxu    }
234f19bc1a0e5f7907587a51bacea25af6546831d02yinxu
235f19bc1a0e5f7907587a51bacea25af6546831d02yinxu    @Override
236f19bc1a0e5f7907587a51bacea25af6546831d02yinxu    public boolean equals (Object o) {
237f19bc1a0e5f7907587a51bacea25af6546831d02yinxu        NetworkScanRequest nsr;
238f19bc1a0e5f7907587a51bacea25af6546831d02yinxu
239f19bc1a0e5f7907587a51bacea25af6546831d02yinxu        try {
240f19bc1a0e5f7907587a51bacea25af6546831d02yinxu            nsr = (NetworkScanRequest) o;
241f19bc1a0e5f7907587a51bacea25af6546831d02yinxu        } catch (ClassCastException ex) {
242f19bc1a0e5f7907587a51bacea25af6546831d02yinxu            return false;
243f19bc1a0e5f7907587a51bacea25af6546831d02yinxu        }
244f19bc1a0e5f7907587a51bacea25af6546831d02yinxu
245f19bc1a0e5f7907587a51bacea25af6546831d02yinxu        if (o == null) {
246f19bc1a0e5f7907587a51bacea25af6546831d02yinxu            return false;
247f19bc1a0e5f7907587a51bacea25af6546831d02yinxu        }
248f19bc1a0e5f7907587a51bacea25af6546831d02yinxu
249bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxu        return (mScanType == nsr.mScanType
250bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxu                && Arrays.equals(mSpecifiers, nsr.mSpecifiers)
251bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxu                && mSearchPeriodicity == nsr.mSearchPeriodicity
252bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxu                && mMaxSearchTime == nsr.mMaxSearchTime
253bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxu                && mIncrementalResults == nsr.mIncrementalResults
254bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxu                && mIncrementalResultsPeriodicity == nsr.mIncrementalResultsPeriodicity
255bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxu                && (((mMccMncs != null)
256bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxu                && mMccMncs.equals(nsr.mMccMncs))));
257f19bc1a0e5f7907587a51bacea25af6546831d02yinxu    }
258f19bc1a0e5f7907587a51bacea25af6546831d02yinxu
259f19bc1a0e5f7907587a51bacea25af6546831d02yinxu    @Override
260f19bc1a0e5f7907587a51bacea25af6546831d02yinxu    public int hashCode () {
261bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxu        return ((mScanType * 31)
262bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxu                + (Arrays.hashCode(mSpecifiers)) * 37
263bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxu                + (mSearchPeriodicity * 41)
264bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxu                + (mMaxSearchTime * 43)
265bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxu                + ((mIncrementalResults == true? 1 : 0) * 47)
266bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxu                + (mIncrementalResultsPeriodicity * 53)
267bbc3d3678246f42f7d36e1765f1ae132de1493cbyinxu                + (mMccMncs.hashCode() * 59));
268f19bc1a0e5f7907587a51bacea25af6546831d02yinxu    }
269f19bc1a0e5f7907587a51bacea25af6546831d02yinxu
270f19bc1a0e5f7907587a51bacea25af6546831d02yinxu    public static final Creator<NetworkScanRequest> CREATOR =
271f19bc1a0e5f7907587a51bacea25af6546831d02yinxu            new Creator<NetworkScanRequest>() {
272f19bc1a0e5f7907587a51bacea25af6546831d02yinxu                @Override
273f19bc1a0e5f7907587a51bacea25af6546831d02yinxu                public NetworkScanRequest createFromParcel(Parcel in) {
274f19bc1a0e5f7907587a51bacea25af6546831d02yinxu                    return new NetworkScanRequest(in);
275f19bc1a0e5f7907587a51bacea25af6546831d02yinxu                }
276f19bc1a0e5f7907587a51bacea25af6546831d02yinxu
277f19bc1a0e5f7907587a51bacea25af6546831d02yinxu                @Override
278f19bc1a0e5f7907587a51bacea25af6546831d02yinxu                public NetworkScanRequest[] newArray(int size) {
279f19bc1a0e5f7907587a51bacea25af6546831d02yinxu                    return new NetworkScanRequest[size];
280f19bc1a0e5f7907587a51bacea25af6546831d02yinxu                }
281f19bc1a0e5f7907587a51bacea25af6546831d02yinxu            };
282f19bc1a0e5f7907587a51bacea25af6546831d02yinxu}
283