Merge "Add a null check before accessing int[] parameter in ModemActivityInfo" into mm-wireless-dev
diff --git a/Android.mk b/Android.mk
index 3bc33bf..9192e96 100644
--- a/Android.mk
+++ b/Android.mk
@@ -406,6 +406,7 @@
telephony/java/com/android/internal/telephony/ISub.aidl \
telephony/java/com/android/internal/telephony/ITelephony.aidl \
telephony/java/com/android/internal/telephony/ITelephonyDebug.aidl \
+ telephony/java/com/android/internal/telephony/ITelephonyDebugSubscriber.aidl \
telephony/java/com/android/internal/telephony/ITelephonyRegistry.aidl \
telephony/java/com/android/internal/telephony/IWapPushManager.aidl \
wifi/java/android/net/wifi/IWifiManager.aidl \
diff --git a/api/current.txt b/api/current.txt
index e29d5ec..3691270 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -30003,6 +30003,7 @@
method public static boolean hasProperty(int, int);
method public boolean hasProperty(int);
method public static java.lang.String propertiesToString(int);
+ field public static final int CAPABILITY_CANNOT_DOWNGRADE_VIDEO_TO_AUDIO = 4194304; // 0x400000
field public static final int CAPABILITY_CAN_PAUSE_VIDEO = 1048576; // 0x100000
field public static final int CAPABILITY_DISCONNECT_FROM_CONFERENCE = 8192; // 0x2000
field public static final int CAPABILITY_HOLD = 1; // 0x1
@@ -30142,6 +30143,7 @@
method public final void setVideoProvider(android.telecom.Connection.VideoProvider);
method public final void setVideoState(int);
method public static java.lang.String stateToString(int);
+ field public static final int CAPABILITY_CANNOT_DOWNGRADE_VIDEO_TO_AUDIO = 8388608; // 0x800000
field public static final int CAPABILITY_CAN_PAUSE_VIDEO = 1048576; // 0x100000
field public static final int CAPABILITY_CAN_UPGRADE_TO_VIDEO = 524288; // 0x80000
field public static final int CAPABILITY_DISCONNECT_FROM_CONFERENCE = 8192; // 0x2000
diff --git a/api/system-current.txt b/api/system-current.txt
index 47aeee3..b09a4a2 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -32179,6 +32179,7 @@
method public static boolean hasProperty(int, int);
method public boolean hasProperty(int);
method public static java.lang.String propertiesToString(int);
+ field public static final int CAPABILITY_CANNOT_DOWNGRADE_VIDEO_TO_AUDIO = 4194304; // 0x400000
field public static final int CAPABILITY_CAN_PAUSE_VIDEO = 1048576; // 0x100000
field public static final int CAPABILITY_DISCONNECT_FROM_CONFERENCE = 8192; // 0x2000
field public static final int CAPABILITY_HOLD = 1; // 0x1
@@ -32329,6 +32330,7 @@
method public final void setVideoProvider(android.telecom.Connection.VideoProvider);
method public final void setVideoState(int);
method public static java.lang.String stateToString(int);
+ field public static final int CAPABILITY_CANNOT_DOWNGRADE_VIDEO_TO_AUDIO = 8388608; // 0x800000
field public static final int CAPABILITY_CAN_PAUSE_VIDEO = 1048576; // 0x100000
field public static final int CAPABILITY_CAN_UPGRADE_TO_VIDEO = 524288; // 0x80000
field public static final int CAPABILITY_DISCONNECT_FROM_CONFERENCE = 8192; // 0x2000
diff --git a/core/java/android/net/NetworkCapabilities.java b/core/java/android/net/NetworkCapabilities.java
index 3bd12c0..e27c0fb 100644
--- a/core/java/android/net/NetworkCapabilities.java
+++ b/core/java/android/net/NetworkCapabilities.java
@@ -197,6 +197,19 @@
(1 << NET_CAPABILITY_CAPTIVE_PORTAL);
/**
+ * Network specifier for factories which want to match any network specifier
+ * (NS) in a request. Behavior:
+ * <li>Empty NS in request matches any network factory NS</li>
+ * <li>Empty NS in the network factory NS only matches a request with an
+ * empty NS</li>
+ * <li>"*" (this constant) NS in the network factory matches requests with
+ * any NS</li>
+ *
+ * @hide
+ */
+ public static final String MATCH_ALL_REQUESTS_NETWORK_SPECIFIER = "*";
+
+ /**
* Network capabilities that are not allowed in NetworkRequests. This exists because the
* NetworkFactory / NetworkAgent model does not deal well with the situation where a
* capability's presence cannot be known in advance. If such a capability is requested, then we
@@ -596,7 +609,8 @@
}
private boolean satisfiedBySpecifier(NetworkCapabilities nc) {
return (TextUtils.isEmpty(mNetworkSpecifier) ||
- mNetworkSpecifier.equals(nc.mNetworkSpecifier));
+ mNetworkSpecifier.equals(nc.mNetworkSpecifier) ||
+ MATCH_ALL_REQUESTS_NETWORK_SPECIFIER.equals(nc.mNetworkSpecifier));
}
private boolean equalsSpecifier(NetworkCapabilities nc) {
if (TextUtils.isEmpty(mNetworkSpecifier)) {
diff --git a/core/java/android/net/NetworkRequest.java b/core/java/android/net/NetworkRequest.java
index 7da4818..f1edcbe 100644
--- a/core/java/android/net/NetworkRequest.java
+++ b/core/java/android/net/NetworkRequest.java
@@ -188,6 +188,10 @@
* networks.
*/
public Builder setNetworkSpecifier(String networkSpecifier) {
+ if (NetworkCapabilities.MATCH_ALL_REQUESTS_NETWORK_SPECIFIER.equals(networkSpecifier)) {
+ throw new IllegalArgumentException("Invalid network specifier - must not be '"
+ + NetworkCapabilities.MATCH_ALL_REQUESTS_NETWORK_SPECIFIER + "'");
+ }
mNetworkCapabilities.setNetworkSpecifier(networkSpecifier);
return this;
}
diff --git a/services/core/java/com/android/server/ConnectivityService.java b/services/core/java/com/android/server/ConnectivityService.java
index 327fb8a..9c09f24 100644
--- a/services/core/java/com/android/server/ConnectivityService.java
+++ b/services/core/java/com/android/server/ConnectivityService.java
@@ -3678,6 +3678,12 @@
throw new IllegalArgumentException("Bad timeout specified");
}
+ if (NetworkCapabilities.MATCH_ALL_REQUESTS_NETWORK_SPECIFIER
+ .equals(networkCapabilities.getNetworkSpecifier())) {
+ throw new IllegalArgumentException("Invalid network specifier - must not be '"
+ + NetworkCapabilities.MATCH_ALL_REQUESTS_NETWORK_SPECIFIER + "'");
+ }
+
NetworkRequest networkRequest = new NetworkRequest(networkCapabilities, legacyType,
nextNetworkRequestId());
NetworkRequestInfo nri = new NetworkRequestInfo(messenger, networkRequest, binder,
diff --git a/services/tests/servicestests/src/com/android/server/ConnectivityServiceTest.java b/services/tests/servicestests/src/com/android/server/ConnectivityServiceTest.java
index 97e16da..d096c28 100644
--- a/services/tests/servicestests/src/com/android/server/ConnectivityServiceTest.java
+++ b/services/tests/servicestests/src/com/android/server/ConnectivityServiceTest.java
@@ -52,13 +52,16 @@
import android.os.ConditionVariable;
import android.os.Handler;
import android.os.HandlerThread;
+import android.os.IBinder;
import android.os.INetworkManagementService;
import android.os.Looper;
import android.os.Message;
import android.os.MessageQueue;
+import android.os.Messenger;
import android.os.MessageQueue.IdleHandler;
import android.test.AndroidTestCase;
import android.test.suitebuilder.annotation.LargeTest;
+import android.test.suitebuilder.annotation.SmallTest;
import android.util.Log;
import android.util.LogPrinter;
@@ -1291,6 +1294,36 @@
validatedCallback.expectCallback(CallbackState.LOST);
}
+ @SmallTest
+ public void testInvalidNetworkSpecifier() {
+ boolean execptionCalled = true;
+
+ try {
+ NetworkRequest.Builder builder = new NetworkRequest.Builder();
+ builder.setNetworkSpecifier(MATCH_ALL_REQUESTS_NETWORK_SPECIFIER);
+ execptionCalled = false;
+ } catch (IllegalArgumentException e) {
+ // do nothing - should get here
+ }
+
+ assertTrue("NetworkReqeuest builder with MATCH_ALL_REQUESTS_NETWORK_SPECIFIER",
+ execptionCalled);
+
+ try {
+ NetworkCapabilities networkCapabilities = new NetworkCapabilities();
+ networkCapabilities.addTransportType(TRANSPORT_WIFI)
+ .setNetworkSpecifier(NetworkCapabilities.MATCH_ALL_REQUESTS_NETWORK_SPECIFIER);
+ mService.requestNetwork(networkCapabilities, null, 0, null,
+ ConnectivityManager.TYPE_WIFI);
+ execptionCalled = false;
+ } catch (IllegalArgumentException e) {
+ // do nothing - should get here
+ }
+
+ assertTrue("ConnectivityService requestNetwork with MATCH_ALL_REQUESTS_NETWORK_SPECIFIER",
+ execptionCalled);
+ }
+
private static class TestKeepaliveCallback extends PacketKeepaliveCallback {
public static enum CallbackType { ON_STARTED, ON_STOPPED, ON_ERROR };
diff --git a/telecomm/java/android/telecom/Call.java b/telecomm/java/android/telecom/Call.java
index 6511705..270c8ce 100644
--- a/telecomm/java/android/telecom/Call.java
+++ b/telecomm/java/android/telecom/Call.java
@@ -24,7 +24,6 @@
import java.lang.String;
import java.util.ArrayList;
import java.util.Collections;
-import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
@@ -210,7 +209,22 @@
* Call sends responses through connection.
* @hide
*/
- public static final int CAPABILITY_CAN_SEND_RESPONSE_VIA_CONNECTION = 0x00400000;
+ public static final int CAPABILITY_CAN_SEND_RESPONSE_VIA_CONNECTION = 0x00200000;
+
+ /**
+ * When set, prevents a video {@code Call} from being downgraded to an audio-only call.
+ * <p>
+ * Should be set when the VideoState has the {@link VideoProfile#STATE_TX_ENABLED} or
+ * {@link VideoProfile#STATE_RX_ENABLED} bits set to indicate that the connection cannot be
+ * downgraded from a video call back to a VideoState of
+ * {@link VideoProfile#STATE_AUDIO_ONLY}.
+ * <p>
+ * Intuitively, a call which can be downgraded to audio should also have local and remote
+ * video
+ * capabilities (see {@link #CAPABILITY_SUPPORTS_VT_LOCAL_BIDIRECTIONAL} and
+ * {@link #CAPABILITY_SUPPORTS_VT_REMOTE_BIDIRECTIONAL}).
+ */
+ public static final int CAPABILITY_CANNOT_DOWNGRADE_VIDEO_TO_AUDIO = 0x00400000;
//******************************************************************************************
// Next CAPABILITY value: 0x00800000
@@ -327,6 +341,9 @@
if (can(capabilities, CAPABILITY_SUPPORTS_VT_REMOTE_TX)) {
builder.append(" CAPABILITY_SUPPORTS_VT_REMOTE_TX");
}
+ if (can(capabilities, CAPABILITY_CANNOT_DOWNGRADE_VIDEO_TO_AUDIO)) {
+ builder.append(" CAPABILITY_CANNOT_DOWNGRADE_VIDEO_TO_AUDIO");
+ }
if (can(capabilities, CAPABILITY_SUPPORTS_VT_REMOTE_BIDIRECTIONAL)) {
builder.append(" CAPABILITY_SUPPORTS_VT_REMOTE_BIDIRECTIONAL");
}
diff --git a/telecomm/java/android/telecom/Connection.java b/telecomm/java/android/telecom/Connection.java
index 4115756..c9fc51e 100644
--- a/telecomm/java/android/telecom/Connection.java
+++ b/telecomm/java/android/telecom/Connection.java
@@ -255,8 +255,23 @@
*/
public static final int CAPABILITY_CAN_SEND_RESPONSE_VIA_CONNECTION = 0x00400000;
+ /**
+ * When set, prevents a video call from being downgraded to an audio-only call.
+ * <p>
+ * Should be set when the VideoState has the {@link VideoProfile#STATE_TX_ENABLED} or
+ * {@link VideoProfile#STATE_RX_ENABLED} bits set to indicate that the connection cannot be
+ * downgraded from a video call back to a VideoState of
+ * {@link VideoProfile#STATE_AUDIO_ONLY}.
+ * <p>
+ * Intuitively, a call which can be downgraded to audio should also have local and remote
+ * video
+ * capabilities (see {@link #CAPABILITY_SUPPORTS_VT_LOCAL_BIDIRECTIONAL} and
+ * {@link #CAPABILITY_SUPPORTS_VT_REMOTE_BIDIRECTIONAL}).
+ */
+ public static final int CAPABILITY_CANNOT_DOWNGRADE_VIDEO_TO_AUDIO = 0x00800000;
+
//**********************************************************************************************
- // Next CAPABILITY value: 0x00800000
+ // Next CAPABILITY value: 0x01000000
//**********************************************************************************************
/**
@@ -371,6 +386,9 @@
if (can(capabilities, CAPABILITY_SUPPORTS_VT_REMOTE_BIDIRECTIONAL)) {
builder.append(" CAPABILITY_SUPPORTS_VT_REMOTE_BIDIRECTIONAL");
}
+ if (can(capabilities, CAPABILITY_CANNOT_DOWNGRADE_VIDEO_TO_AUDIO)) {
+ builder.append(" CAPABILITY_CANNOT_DOWNGRADE_VIDEO_TO_AUDIO");
+ }
if (can(capabilities, CAPABILITY_HIGH_DEF_AUDIO)) {
builder.append(" CAPABILITY_HIGH_DEF_AUDIO");
}
diff --git a/telephony/java/com/android/internal/telephony/ITelephonyDebug.aidl b/telephony/java/com/android/internal/telephony/ITelephonyDebug.aidl
index 5dffa28..069fcbf 100644
--- a/telephony/java/com/android/internal/telephony/ITelephonyDebug.aidl
+++ b/telephony/java/com/android/internal/telephony/ITelephonyDebug.aidl
@@ -16,8 +16,9 @@
package com.android.internal.telephony;
-import android.os.Bundle;
+import com.android.internal.telephony.ITelephonyDebugSubscriber;
+import android.os.Bundle;
/**
* Interface used to interact with the Telephony debug service.
@@ -36,4 +37,7 @@
* @param data optional
*/
void writeEvent(long timestamp, int phoneId, int tag, int param1, int param2, in Bundle data);
+
+ void subscribe(in ITelephonyDebugSubscriber subscriber);
+ void unsubscribe(in ITelephonyDebugSubscriber subscriber);
}
diff --git a/telephony/java/com/android/internal/telephony/ITelephonyDebugSubscriber.aidl b/telephony/java/com/android/internal/telephony/ITelephonyDebugSubscriber.aidl
new file mode 100644
index 0000000..64eb0f1
--- /dev/null
+++ b/telephony/java/com/android/internal/telephony/ITelephonyDebugSubscriber.aidl
@@ -0,0 +1,34 @@
+/*
+ * 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.internal.telephony;
+
+import com.android.internal.telephony.TelephonyEvent;
+
+import android.os.Bundle;
+
+/**
+ * Interface used to subscribe for events from Telephony debug service.
+ *
+ * {@hide}
+ */
+oneway interface ITelephonyDebugSubscriber {
+
+ /**
+ * Called when Telephony debug service has events.
+ */
+ void onEvents(in TelephonyEvent[] events);
+}
diff --git a/telephony/java/com/android/internal/telephony/TelephonyEvent.aidl b/telephony/java/com/android/internal/telephony/TelephonyEvent.aidl
new file mode 100644
index 0000000..1e74b31
--- /dev/null
+++ b/telephony/java/com/android/internal/telephony/TelephonyEvent.aidl
@@ -0,0 +1,19 @@
+/*
+ * 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.internal.telephony;
+
+parcelable TelephonyEvent;
diff --git a/telephony/java/com/android/internal/telephony/TelephonyEvent.java b/telephony/java/com/android/internal/telephony/TelephonyEvent.java
new file mode 100644
index 0000000..26d466d
--- /dev/null
+++ b/telephony/java/com/android/internal/telephony/TelephonyEvent.java
@@ -0,0 +1,84 @@
+/*
+ * 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.internal.telephony;
+
+import android.os.Bundle;
+import android.os.Parcel;
+import android.os.Parcelable;
+
+/**
+ * A parcelable used in ITelephonyDebugSubscriber.aidl
+ */
+public class TelephonyEvent implements Parcelable {
+
+ final public long timestamp;
+ final public int phoneId;
+ final public int tag;
+ final public int param1;
+ final public int param2;
+ final public Bundle data;
+
+ public TelephonyEvent(long timestamp, int phoneId, int tag,
+ int param1, int param2, Bundle data) {
+ this.timestamp = timestamp;
+ this.phoneId = phoneId;
+ this.tag = tag;
+ this.param1 = param1;
+ this.param2 = param2;
+ this.data = data;
+ }
+
+ /** Implement the Parcelable interface */
+ public static final Parcelable.Creator<TelephonyEvent> CREATOR
+ = new Parcelable.Creator<TelephonyEvent> (){
+ public TelephonyEvent createFromParcel(Parcel source) {
+ final long timestamp = source.readLong();
+ final int phoneId = source.readInt();
+ final int tag = source.readInt();
+ final int param1 = source.readInt();
+ final int param2 = source.readInt();
+ final Bundle data = source.readBundle();
+ return new TelephonyEvent(timestamp, phoneId, tag, param1, param2, data);
+ }
+
+ public TelephonyEvent[] newArray(int size) {
+ return new TelephonyEvent[size];
+ }
+ };
+
+ /** Implement the Parcelable interface */
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+
+ /** Implement the Parcelable interface */
+ @Override
+ public void writeToParcel(Parcel dest, int flags) {
+ dest.writeLong(timestamp);
+ dest.writeInt(phoneId);
+ dest.writeInt(tag);
+ dest.writeInt(param1);
+ dest.writeInt(param2);
+ dest.writeBundle(data);
+ }
+
+ public String toString() {
+ return String.format("%d,%d,%d,%d,%d,%s",
+ timestamp, phoneId, tag, param1, param2, data);
+ }
+}
diff --git a/wifi/java/android/net/wifi/WifiConfiguration.java b/wifi/java/android/net/wifi/WifiConfiguration.java
index 8838f3f..c6354bd 100644
--- a/wifi/java/android/net/wifi/WifiConfiguration.java
+++ b/wifi/java/android/net/wifi/WifiConfiguration.java
@@ -703,24 +703,6 @@
*/
public int numUserTriggeredJoinAttempts;
- /**
- * @hide
- * Connect choices
- *
- * remember the keys identifying the known WifiConfiguration over which this configuration
- * was preferred by user or a "WiFi Network Management app", that is,
- * a WifiManager.CONNECT_NETWORK or SELECT_NETWORK was received while this configuration
- * was visible to the user:
- * configKey is : "SSID"-WEP-WPA_PSK-WPA_EAP
- *
- * The integer represents the configuration's RSSI at that time (useful?)
- *
- * The overall auto-join algorithm make use of past connect choice so as to sort configuration,
- * the exact algorithm still fluctuating as of 5/7/2014
- *
- */
- public HashMap<String, Integer> connectChoices;
-
/** @hide
* Boost given to RSSI on a home network for the purpose of calculating the score
* This adds stickiness to home networks, as defined by:
@@ -830,6 +812,16 @@
*/
public static final long INVALID_NETWORK_SELECTION_DISABLE_TIMESTAMP = -1L;
+ /**
+ * This constant indicates the current configuration has connect choice set
+ */
+ private static final int CONNECT_CHOICE_EXISTS = 1;
+
+ /**
+ * This constant indicates the current configuration does not have connect choice set
+ */
+ private static final int CONNECT_CHOICE_NOT_EXISTS = -1;
+
// fields for QualityNetwork Selection
/**
* Network selection status, should be in one of three status: enable, temporaily disabled
@@ -853,7 +845,128 @@
private int[] mNetworkSeclectionDisableCounter = new int[NETWORK_SELECTION_DISABLED_MAX];
/**
- * return current Quality network selection status in String (for debug purpose)
+ * Connect Choice over this configuration
+ *
+ * When current wifi configuration is visible to the user but user explicitly choose to
+ * connect to another network X, the another networks X's configure key will be stored here.
+ * We will consider user has a preference of X over this network. And in the future,
+ * network selection will always give X a higher preference over this configuration.
+ * configKey is : "SSID"-WEP-WPA_PSK-WPA_EAP
+ */
+ private String mConnectChoice;
+
+ /**
+ * The system timestamp when we records the connectChoice. This value is obtained from
+ * System.currentTimeMillis
+ */
+ private long mConnectChoiceTimestamp = INVALID_NETWORK_SELECTION_DISABLE_TIMESTAMP;
+
+ /**
+ * Used to cache the temporary candidate during the network selection procedure. It will be
+ * kept updating once a new scan result has a higher score than current one
+ */
+ private ScanResult mCandidate;
+
+ /**
+ * Used to cache the score of the current temporary candidate during the network
+ * selection procedure.
+ */
+ private int mCandidateScore;
+
+ /**
+ * Indicate whether this network is visible in latest Qualified Network Selection. This
+ * means there is scan result found related to this Configuration and meet the minimum
+ * requirement. The saved network need not join latest Qualified Network Selection. For
+ * example, it is disabled. True means network is visible in latest Qualified Network
+ * Selection and false means network is invisible
+ */
+ private boolean mSeenInLastQualifiedNetworkSelection;
+
+ /**
+ * set whether this network is visible in latest Qualified Network Selection
+ * @param seen value set to candidate
+ */
+ public void setSeenInLastQualifiedNetworkSelection(boolean seen) {
+ mSeenInLastQualifiedNetworkSelection = seen;
+ }
+
+ /**
+ * get whether this network is visible in latest Qualified Network Selection
+ * @return returns true -- network is visible in latest Qualified Network Selection
+ * false -- network is invisible in latest Qualified Network Selection
+ */
+ public boolean getSeenInLastQualifiedNetworkSelection() {
+ return mSeenInLastQualifiedNetworkSelection;
+ }
+ /**
+ * set the temporary candidate of current network selection procedure
+ * @param scanCandidate {@link ScanResult} the candidate set to mCandidate
+ */
+ public void setCandidate(ScanResult scanCandidate) {
+ mCandidate = scanCandidate;
+ }
+
+ /**
+ * get the temporary candidate of current network selection procedure
+ * @return returns {@link ScanResult} temporary candidate of current network selection
+ * procedure
+ */
+ public ScanResult getCandidate() {
+ return mCandidate;
+ }
+
+ /**
+ * set the score of the temporary candidate of current network selection procedure
+ * @param score value set to mCandidateScore
+ */
+ public void setCandidateScore(int score) {
+ mCandidateScore = score;
+ }
+
+ /**
+ * get the score of the temporary candidate of current network selection procedure
+ * @return returns score of the temporary candidate of current network selection procedure
+ */
+ public int getCandidateScore() {
+ return mCandidateScore;
+ }
+
+ /**
+ * get user preferred choice over this configuration
+ *@return returns configKey of user preferred choice over this configuration
+ */
+ public String getConnectChoice() {
+ return mConnectChoice;
+ }
+
+ /**
+ * set user preferred choice over this configuration
+ * @param newConnectChoice, the configKey of user preferred choice over this configuration
+ */
+ public void setConnectChoice(String newConnectChoice) {
+ mConnectChoice = newConnectChoice;
+ }
+
+ /**
+ * get the timeStamp when user select a choice over this configuration
+ * @return returns when current connectChoice is set (time from System.currentTimeMillis)
+ */
+ public long getConnectChoiceTimestamp() {
+ return mConnectChoiceTimestamp;
+ }
+
+ /**
+ * set the timeStamp when user select a choice over this configuration
+ * @param timeStamp, the timestamp set to connectChoiceTimestamp, expected timestamp should
+ * be obtained from System.currentTimeMillis
+ */
+ public void setConnectChoiceTimestamp(long timeStamp) {
+ mConnectChoiceTimestamp = timeStamp;
+ }
+
+ /**
+ * get current Quality network selection status
+ * @return returns current Quality network selection status in String (for debug purpose)
*/
public String getNetworkStatusString() {
return QUALITY_NETWORK_SELECTION_STATUS[mStatus];
@@ -873,6 +986,7 @@
}
}
/**
+ * get current network disable reason
* @return current network disable reason in String (for debug purpose)
*/
public String getNetworkDisableReasonString() {
@@ -881,6 +995,7 @@
/**
* get current network network selection status
+ * @return return current network network selection status
*/
public int getNetworkSelectionStatus() {
return mStatus;
@@ -900,12 +1015,14 @@
}
/**
- * return whether current network is permanently disabled
+ * @return returns whether current network is permanently disabled
*/
public boolean isNetworkPermanentlyDisabled() {
return mStatus == NETWORK_SELECTION_PERMANENTLY_DISABLED;
}
+
/**
+ * set current networ work selection status
* @param status network selection status to set
*/
public void setNetworkSelectionStatus(int status) {
@@ -913,14 +1030,16 @@
mStatus = status;
}
}
+
/**
- * @return current network's disable reason
+ * @return returns current network's disable reason
*/
public int getNetworkSelectionDisableReason() {
return mNetworkSelectionDisableReason;
}
/**
+ * set Network disable reason
* @param reason Network disable reason
*/
public void setNetworkSelectionDisableReason(int reason) {
@@ -930,12 +1049,17 @@
throw new IllegalArgumentException("Illegal reason value: " + reason);
}
}
+
/**
- * @param reason whether current network is disabled by this reason
+ * check whether network is disabled by this reason
+ * @param reason a specific disable reason
+ * @return true -- network is disabled for this reason
+ * false -- network is not disabled for this reason
*/
public boolean isDisabledByReason(int reason) {
return mNetworkSelectionDisableReason == reason;
}
+
/**
* @param timeStamp Set when current network is disabled in millisecond since January 1,
* 1970 00:00:00.0 UTC
@@ -945,7 +1069,7 @@
}
/**
- * @return Get when current network is disabled in millisecond since January 1,
+ * @return returns when current network is disabled in millisecond since January 1,
* 1970 00:00:00.0 UTC
*/
public long getDisableTime() {
@@ -953,6 +1077,7 @@
}
/**
+ * get the disable counter of a specific reason
* @param reason specific failure reason
* @exception throw IllegalArgumentException for illegal input
* @return counter number for specific error reason.
@@ -991,6 +1116,7 @@
throw new IllegalArgumentException("Illegal reason value: " + reason);
}
}
+
/**
* clear the counter of a specific failure reason
* @hide
@@ -1004,6 +1130,7 @@
throw new IllegalArgumentException("Illegal reason value: " + reason);
}
}
+
/**
* clear all the failure reason counters
*/
@@ -1042,6 +1169,8 @@
}
mTemporarilyDisabledTimestamp = source.mTemporarilyDisabledTimestamp;
mNetworkSelectionBSSID = source.mNetworkSelectionBSSID;
+ setConnectChoice(source.getConnectChoice());
+ setConnectChoiceTimestamp(source.getConnectChoiceTimestamp());
}
public void writeToParcel(Parcel dest) {
@@ -1053,6 +1182,13 @@
}
dest.writeLong(getDisableTime());
dest.writeString(getNetworkSelectionBSSID());
+ if (getConnectChoice() != null) {
+ dest.writeInt(CONNECT_CHOICE_EXISTS);
+ dest.writeString(getConnectChoice());
+ dest.writeLong(getConnectChoiceTimestamp());
+ } else {
+ dest.writeInt(CONNECT_CHOICE_NOT_EXISTS);
+ }
}
public void readFromParcel(Parcel in) {
@@ -1064,6 +1200,13 @@
}
setDisableTime(in.readLong());
setNetworkSelectionBSSID(in.readString());
+ if (in.readInt() == CONNECT_CHOICE_EXISTS) {
+ setConnectChoice(in.readString());
+ setConnectChoiceTimestamp(in.readLong());
+ } else {
+ setConnectChoice(null);
+ setConnectChoiceTimestamp(INVALID_NETWORK_SELECTION_DISABLE_TIMESTAMP);
+ }
}
}
@@ -1183,7 +1326,11 @@
}
}
}
-
+ if (mNetworkSelectionStatus.getConnectChoice() != null) {
+ sbuf.append(" connect choice: ").append(mNetworkSelectionStatus.getConnectChoice());
+ sbuf.append(" connect choice set time: ").append(mNetworkSelectionStatus
+ .getConnectChoiceTimestamp());
+ }
if (this.numAssociation > 0) {
sbuf.append(" numAssociation ").append(this.numAssociation).append("\n");
@@ -1335,16 +1482,7 @@
sbuf.append('\n');
}
}
- if (this.connectChoices != null) {
- for(String key : this.connectChoices.keySet()) {
- Integer choice = this.connectChoices.get(key);
- if (choice != null) {
- sbuf.append(" choice: ").append(key);
- sbuf.append(" = ").append(choice);
- sbuf.append('\n');
- }
- }
- }
+
sbuf.append("triggeredLow: ").append(this.numUserTriggeredWifiDisableLowRSSI);
sbuf.append(" triggeredBad: ").append(this.numUserTriggeredWifiDisableBadRSSI);
sbuf.append(" triggeredNotHigh: ").append(this.numUserTriggeredWifiDisableNotHighRSSI);
@@ -1631,11 +1769,6 @@
mIpConfiguration = new IpConfiguration(source.mIpConfiguration);
- if ((source.connectChoices != null) && (source.connectChoices.size() > 0)) {
- connectChoices = new HashMap<String, Integer>();
- connectChoices.putAll(source.connectChoices);
- }
-
if ((source.linkedConfigurations != null)
&& (source.linkedConfigurations.size() > 0)) {
linkedConfigurations = new HashMap<String, Integer>();
diff --git a/wifi/java/android/net/wifi/nan/IWifiNanManager.aidl b/wifi/java/android/net/wifi/nan/IWifiNanManager.aidl
index ff3d29f..ec9e462 100644
--- a/wifi/java/android/net/wifi/nan/IWifiNanManager.aidl
+++ b/wifi/java/android/net/wifi/nan/IWifiNanManager.aidl
@@ -43,7 +43,8 @@
void publish(int sessionId, in PublishData publishData, in PublishSettings publishSettings);
void subscribe(int sessionId, in SubscribeData subscribeData,
in SubscribeSettings subscribeSettings);
- void sendMessage(int sessionId, int peerId, in byte[] message, int messageLength);
+ void sendMessage(int sessionId, int peerId, in byte[] message, int messageLength,
+ int messageId);
void stopSession(int sessionId);
void destroySession(int sessionId);
}
diff --git a/wifi/java/android/net/wifi/nan/IWifiNanSessionListener.aidl b/wifi/java/android/net/wifi/nan/IWifiNanSessionListener.aidl
index 773f83b..50c34d9 100644
--- a/wifi/java/android/net/wifi/nan/IWifiNanSessionListener.aidl
+++ b/wifi/java/android/net/wifi/nan/IWifiNanSessionListener.aidl
@@ -32,7 +32,7 @@
void onMatch(int peerId, in byte[] serviceSpecificInfo,
int serviceSpecificInfoLength, in byte[] matchFilter, int matchFilterLength);
- void onMessageSendSuccess();
- void onMessageSendFail(int reason);
+ void onMessageSendSuccess(int messageId);
+ void onMessageSendFail(int messageId, int reason);
void onMessageReceived(int peerId, in byte[] message, int messageLength);
}
diff --git a/wifi/java/android/net/wifi/nan/WifiNanManager.java b/wifi/java/android/net/wifi/nan/WifiNanManager.java
index 877f993..cb82268 100644
--- a/wifi/java/android/net/wifi/nan/WifiNanManager.java
+++ b/wifi/java/android/net/wifi/nan/WifiNanManager.java
@@ -319,13 +319,14 @@
/**
* {@hide}
*/
- public void sendMessage(int sessionId, int peerId, byte[] message, int messageLength) {
+ public void sendMessage(int sessionId, int peerId, byte[] message, int messageLength,
+ int messageId) {
try {
if (VDBG) {
Log.v(TAG, "sendMessage(): sessionId=" + sessionId + ", peerId=" + peerId
- + ", messageLength=" + messageLength);
+ + ", messageLength=" + messageLength + ", messageId=" + messageId);
}
- mService.sendMessage(sessionId, peerId, message, messageLength);
+ mService.sendMessage(sessionId, peerId, message, messageLength, messageId);
} catch (RemoteException e) {
Log.w(TAG, "subscribe RemoteException (FYI - ignoring): " + e);
}
diff --git a/wifi/java/android/net/wifi/nan/WifiNanSession.java b/wifi/java/android/net/wifi/nan/WifiNanSession.java
index c6b384e..d0a9410 100644
--- a/wifi/java/android/net/wifi/nan/WifiNanSession.java
+++ b/wifi/java/android/net/wifi/nan/WifiNanSession.java
@@ -103,8 +103,11 @@
* @param message The message to be transmitted.
* @param messageLength The number of bytes from the {@code message} to be
* transmitted.
+ * @param messageId An arbitrary integer used by the caller to identify the
+ * message. The same integer ID will be returned in the callbacks
+ * indicated message send success or failure.
*/
- public void sendMessage(int peerId, byte[] message, int messageLength) {
- mManager.sendMessage(mSessionId, peerId, message, messageLength);
+ public void sendMessage(int peerId, byte[] message, int messageLength, int messageId) {
+ mManager.sendMessage(mSessionId, peerId, message, messageLength, messageId);
}
}
diff --git a/wifi/java/android/net/wifi/nan/WifiNanSessionListener.java b/wifi/java/android/net/wifi/nan/WifiNanSessionListener.java
index c9d08c7..d5e59f0 100644
--- a/wifi/java/android/net/wifi/nan/WifiNanSessionListener.java
+++ b/wifi/java/android/net/wifi/nan/WifiNanSessionListener.java
@@ -210,10 +210,10 @@
msg.getData().getByteArray(MESSAGE_BUNDLE_KEY_MESSAGE2), msg.arg2);
break;
case LISTEN_MESSAGE_SEND_SUCCESS:
- WifiNanSessionListener.this.onMessageSendSuccess();
+ WifiNanSessionListener.this.onMessageSendSuccess(msg.arg1);
break;
case LISTEN_MESSAGE_SEND_FAIL:
- WifiNanSessionListener.this.onMessageSendFail(msg.arg1);
+ WifiNanSessionListener.this.onMessageSendFail(msg.arg1, msg.arg2);
break;
case LISTEN_MESSAGE_RECEIVED:
WifiNanSessionListener.this.onMessageReceived(msg.arg2,
@@ -306,7 +306,7 @@
* {@link WifiNanSessionListener#onMessageSendFail(int)} will be received -
* never both.
*/
- public void onMessageSendSuccess() {
+ public void onMessageSendSuccess(int messageId) {
if (VDBG) Log.v(TAG, "onMessageSendSuccess: called in stub - override if interested");
}
@@ -325,7 +325,7 @@
* @param reason The failure reason using {@code NanSessionListener.FAIL_*}
* codes.
*/
- public void onMessageSendFail(int reason) {
+ public void onMessageSendFail(int messageId, int reason) {
if (VDBG) Log.v(TAG, "onMessageSendFail: called in stub - override if interested");
}
@@ -401,19 +401,21 @@
}
@Override
- public void onMessageSendSuccess() {
+ public void onMessageSendSuccess(int messageId) {
if (VDBG) Log.v(TAG, "onMessageSendSuccess");
Message msg = mHandler.obtainMessage(LISTEN_MESSAGE_SEND_SUCCESS);
+ msg.arg1 = messageId;
mHandler.sendMessage(msg);
}
@Override
- public void onMessageSendFail(int reason) {
+ public void onMessageSendFail(int messageId, int reason) {
if (VDBG) Log.v(TAG, "onMessageSendFail: reason=" + reason);
Message msg = mHandler.obtainMessage(LISTEN_MESSAGE_SEND_FAIL);
- msg.arg1 = reason;
+ msg.arg1 = messageId;
+ msg.arg2 = reason;
mHandler.sendMessage(msg);
}