Merge "PrintDocumentAdapter contract not followed on print." into klp-dev
diff --git a/core/java/android/os/WorkSource.java b/core/java/android/os/WorkSource.java
index 30d535b..e66df04 100644
--- a/core/java/android/os/WorkSource.java
+++ b/core/java/android/os/WorkSource.java
@@ -103,7 +103,21 @@
* @hide
*/
public void clearNames() {
- mNames = null;
+ if (mNames != null) {
+ mNames = null;
+ // Clear out any duplicate uids now that we don't have names to disambiguate them.
+ int destIndex = 1;
+ int newNum = mNum;
+ for (int sourceIndex = 1; sourceIndex < mNum; sourceIndex++) {
+ if (mUids[sourceIndex] == mUids[sourceIndex - 1]) {
+ newNum--;
+ } else {
+ mUids[destIndex] = mUids[sourceIndex];
+ destIndex++;
+ }
+ }
+ mNum = newNum;
+ }
}
/**
diff --git a/wifi/java/android/net/wifi/WifiConfiguration.java b/wifi/java/android/net/wifi/WifiConfiguration.java
index 2b3c9e2..4c84f17 100644
--- a/wifi/java/android/net/wifi/WifiConfiguration.java
+++ b/wifi/java/android/net/wifi/WifiConfiguration.java
@@ -554,8 +554,8 @@
/** @hide */
public int getAuthType() {
- if (allowedKeyManagement.cardinality() > 1) {
- throw new IllegalStateException("More than one auth type set");
+ if (isValid() == false) {
+ throw new IllegalStateException("Invalid configuration");
}
if (allowedKeyManagement.get(KeyMgmt.WPA_PSK)) {
return KeyMgmt.WPA_PSK;
diff --git a/wifi/java/android/net/wifi/WifiManager.java b/wifi/java/android/net/wifi/WifiManager.java
index 95ee85b..b7594ee1 100644
--- a/wifi/java/android/net/wifi/WifiManager.java
+++ b/wifi/java/android/net/wifi/WifiManager.java
@@ -1867,13 +1867,16 @@
boolean changed = true;
if (ws == null) {
mWorkSource = null;
- } else if (mWorkSource == null) {
- changed = mWorkSource != null;
- mWorkSource = new WorkSource(ws);
} else {
- changed = mWorkSource.diff(ws);
- if (changed) {
- mWorkSource.set(ws);
+ ws.clearNames();
+ if (mWorkSource == null) {
+ changed = mWorkSource != null;
+ mWorkSource = new WorkSource(ws);
+ } else {
+ changed = mWorkSource.diff(ws);
+ if (changed) {
+ mWorkSource.set(ws);
+ }
}
}
if (changed && mHeld) {