diff options
author | Ningyuan Wang <nywang@google.com> | 2017-01-24 22:32:35 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2017-01-24 22:32:35 +0000 |
commit | 0e62cf37d128216dae128fbae0d26f98acade773 (patch) | |
tree | 0d060ac49323e8257fd87d38829cee169d463c08 /service | |
parent | 1d7663c13db1a195b29ad4d961f46a181e25140c (diff) | |
parent | 9c40d0310e6cb0890a3d20af3617a7fc302458e0 (diff) |
Merge changes from topic 'wificond_parcelables'
* changes:
Java side unit test for PnoSettings
Add java side pno scan settings parcelable classes
Diffstat (limited to 'service')
-rw-r--r-- | service/java/com/android/server/wifi/wificond/PnoNetwork.java | 67 | ||||
-rw-r--r-- | service/java/com/android/server/wifi/wificond/PnoSettings.java | 77 |
2 files changed, 144 insertions, 0 deletions
diff --git a/service/java/com/android/server/wifi/wificond/PnoNetwork.java b/service/java/com/android/server/wifi/wificond/PnoNetwork.java new file mode 100644 index 000000000..fd0d4715f --- /dev/null +++ b/service/java/com/android/server/wifi/wificond/PnoNetwork.java @@ -0,0 +1,67 @@ +/* + * Copyright (C) 2016 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.server.wifi.wificond; + +import android.os.Parcel; +import android.os.Parcelable; + +/** + * PnoNetwork for wificond + * + * @hide + */ +public class PnoNetwork implements Parcelable { + + public boolean isHidden; + public byte[] ssid; + + /** public constructor */ + public PnoNetwork() { } + + /** implement Parcelable interface */ + @Override + public int describeContents() { + return 0; + } + + /** + * implement Parcelable interface + * |flag| is ignored. + */ + @Override + public void writeToParcel(Parcel out, int flags) { + out.writeInt(isHidden ? 1 : 0); + out.writeByteArray(ssid); + } + + /** implement Parcelable interface */ + public static final Parcelable.Creator<PnoNetwork> CREATOR = + new Parcelable.Creator<PnoNetwork>() { + @Override + public PnoNetwork createFromParcel(Parcel in) { + PnoNetwork result = new PnoNetwork(); + result.isHidden = in.readInt() != 0 ? true : false; + result.ssid = in.createByteArray(); + return result; + } + + @Override + public PnoNetwork[] newArray(int size) { + return new PnoNetwork[size]; + } + }; +} diff --git a/service/java/com/android/server/wifi/wificond/PnoSettings.java b/service/java/com/android/server/wifi/wificond/PnoSettings.java new file mode 100644 index 000000000..42fae3974 --- /dev/null +++ b/service/java/com/android/server/wifi/wificond/PnoSettings.java @@ -0,0 +1,77 @@ +/* + * Copyright (C) 2016 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.server.wifi.wificond; + +import android.os.Parcel; +import android.os.Parcelable; + +import java.util.ArrayList; + +/** + * PnoSettings for wificond + * + * @hide + */ +public class PnoSettings implements Parcelable { + public int intervalMs; + public int min2gRssi; + public int min5gRssi; + public ArrayList<PnoNetwork> pnoNetworks; + + /** public constructor */ + public PnoSettings() { } + + /** implement Parcelable interface */ + @Override + public int describeContents() { + return 0; + } + + /** + * implement Parcelable interface + * |flag| is ignored. + * */ + @Override + public void writeToParcel(Parcel out, int flags) { + out.writeInt(intervalMs); + out.writeInt(min2gRssi); + out.writeInt(min5gRssi); + out.writeTypedList(pnoNetworks); + } + + /** implement Parcelable interface */ + public static final Parcelable.Creator<PnoSettings> CREATOR = + new Parcelable.Creator<PnoSettings>() { + @Override + public PnoSettings createFromParcel(Parcel in) { + PnoSettings result = new PnoSettings(); + result.intervalMs = in.readInt(); + result.min2gRssi = in.readInt(); + result.min5gRssi = in.readInt(); + + result.pnoNetworks = new ArrayList<PnoNetwork>(); + in.readTypedList(result.pnoNetworks, PnoNetwork.CREATOR); + + return result; + } + + @Override + public PnoSettings[] newArray(int size) { + return new PnoSettings[size]; + } + }; +} |