2 * Copyright (C) 2011 The Android Open Source Project
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
19 import android.os.Parcel;
20 import android.os.Parcelable;
23 * Snapshot of network state.
27 public class NetworkState implements Parcelable {
29 public final NetworkInfo networkInfo;
30 public final LinkProperties linkProperties;
31 public final NetworkCapabilities networkCapabilities;
32 public final Network network;
33 public final String subscriberId;
34 public final String networkId;
36 public NetworkState(NetworkInfo networkInfo, LinkProperties linkProperties,
37 NetworkCapabilities networkCapabilities, Network network, String subscriberId,
39 this.networkInfo = networkInfo;
40 this.linkProperties = linkProperties;
41 this.networkCapabilities = networkCapabilities;
42 this.network = network;
43 this.subscriberId = subscriberId;
44 this.networkId = networkId;
47 public NetworkState(Parcel in) {
48 networkInfo = in.readParcelable(null);
49 linkProperties = in.readParcelable(null);
50 networkCapabilities = in.readParcelable(null);
51 network = in.readParcelable(null);
52 subscriberId = in.readString();
53 networkId = in.readString();
57 public int describeContents() {
62 public void writeToParcel(Parcel out, int flags) {
63 out.writeParcelable(networkInfo, flags);
64 out.writeParcelable(linkProperties, flags);
65 out.writeParcelable(networkCapabilities, flags);
66 out.writeParcelable(network, flags);
67 out.writeString(subscriberId);
68 out.writeString(networkId);
71 public static final Creator<NetworkState> CREATOR = new Creator<NetworkState>() {
73 public NetworkState createFromParcel(Parcel in) {
74 return new NetworkState(in);
78 public NetworkState[] newArray(int size) {
79 return new NetworkState[size];