Merge "App_process: Clean up sanitized binaries"
diff --git a/Android.mk b/Android.mk
index db5dd01..cdb3834 100644
--- a/Android.mk
+++ b/Android.mk
@@ -494,7 +494,7 @@
LOCAL_ADDITIONAL_DEPENDENCIES := $(framework_res_R_stamp)
LOCAL_NO_STANDARD_LIBRARIES := true
-LOCAL_JAVA_LIBRARIES := core-oj core-libart conscrypt okhttp core-junit bouncycastle ext
+LOCAL_JAVA_LIBRARIES := core-oj core-libart conscrypt okhttp legacy-test bouncycastle ext
LOCAL_STATIC_JAVA_LIBRARIES := framework-protos
LOCAL_MODULE := framework
diff --git a/api/current.txt b/api/current.txt
index f736bc0..d22006d3 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -36704,6 +36704,7 @@
field public static final java.lang.String KEY_MMS_UA_PROF_TAG_NAME_STRING = "uaProfTagName";
field public static final java.lang.String KEY_MMS_UA_PROF_URL_STRING = "uaProfUrl";
field public static final java.lang.String KEY_MMS_USER_AGENT_STRING = "userAgent";
+ field public static final java.lang.String KEY_ONLY_SINGLE_DC_ALLOWED_INT_ARRAY = "only_single_dc_allowed_int_array";
field public static final java.lang.String KEY_OPERATOR_SELECTION_EXPAND_BOOL = "operator_selection_expand_bool";
field public static final java.lang.String KEY_PREFER_2G_BOOL = "prefer_2g_bool";
field public static final java.lang.String KEY_REQUIRE_ENTITLEMENT_CHECKS_BOOL = "require_entitlement_checks_bool";
@@ -36856,6 +36857,7 @@
method public int getAsuLevel();
method public int getDbm();
method public int getLevel();
+ method public int getTimingAdvance();
method public int hashCode();
method public void writeToParcel(android.os.Parcel, int);
field public static final android.os.Parcelable.Creator<android.telephony.CellSignalStrengthGsm> CREATOR;
diff --git a/api/system-current.txt b/api/system-current.txt
index 6645d53..01d4f47 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -35032,6 +35032,7 @@
field public static final java.lang.String ACTION_VR_LISTENER_SETTINGS = "android.settings.VR_LISTENER_SETTINGS";
field public static final java.lang.String ACTION_WEBVIEW_SETTINGS = "android.settings.WEBVIEW_SETTINGS";
field public static final java.lang.String ACTION_WIFI_IP_SETTINGS = "android.settings.WIFI_IP_SETTINGS";
+ field public static final java.lang.String ACTION_WIFI_SAVED_NETWORK_SETTINGS = "android.settings.WIFI_SAVED_NETWORK_SETTINGS";
field public static final java.lang.String ACTION_WIFI_SETTINGS = "android.settings.WIFI_SETTINGS";
field public static final java.lang.String ACTION_WIRELESS_SETTINGS = "android.settings.WIRELESS_SETTINGS";
field public static final java.lang.String AUTHORITY = "settings";
@@ -39639,6 +39640,7 @@
field public static final java.lang.String KEY_MMS_UA_PROF_TAG_NAME_STRING = "uaProfTagName";
field public static final java.lang.String KEY_MMS_UA_PROF_URL_STRING = "uaProfUrl";
field public static final java.lang.String KEY_MMS_USER_AGENT_STRING = "userAgent";
+ field public static final java.lang.String KEY_ONLY_SINGLE_DC_ALLOWED_INT_ARRAY = "only_single_dc_allowed_int_array";
field public static final java.lang.String KEY_OPERATOR_SELECTION_EXPAND_BOOL = "operator_selection_expand_bool";
field public static final java.lang.String KEY_PREFER_2G_BOOL = "prefer_2g_bool";
field public static final java.lang.String KEY_REQUIRE_ENTITLEMENT_CHECKS_BOOL = "require_entitlement_checks_bool";
@@ -39791,6 +39793,7 @@
method public int getAsuLevel();
method public int getDbm();
method public int getLevel();
+ method public int getTimingAdvance();
method public int hashCode();
method public void writeToParcel(android.os.Parcel, int);
field public static final android.os.Parcelable.Creator<android.telephony.CellSignalStrengthGsm> CREATOR;
diff --git a/api/test-current.txt b/api/test-current.txt
index 4af0615..e21afe2 100644
--- a/api/test-current.txt
+++ b/api/test-current.txt
@@ -36781,6 +36781,7 @@
field public static final java.lang.String KEY_MMS_UA_PROF_TAG_NAME_STRING = "uaProfTagName";
field public static final java.lang.String KEY_MMS_UA_PROF_URL_STRING = "uaProfUrl";
field public static final java.lang.String KEY_MMS_USER_AGENT_STRING = "userAgent";
+ field public static final java.lang.String KEY_ONLY_SINGLE_DC_ALLOWED_INT_ARRAY = "only_single_dc_allowed_int_array";
field public static final java.lang.String KEY_OPERATOR_SELECTION_EXPAND_BOOL = "operator_selection_expand_bool";
field public static final java.lang.String KEY_PREFER_2G_BOOL = "prefer_2g_bool";
field public static final java.lang.String KEY_REQUIRE_ENTITLEMENT_CHECKS_BOOL = "require_entitlement_checks_bool";
@@ -36933,6 +36934,7 @@
method public int getAsuLevel();
method public int getDbm();
method public int getLevel();
+ method public int getTimingAdvance();
method public int hashCode();
method public void writeToParcel(android.os.Parcel, int);
field public static final android.os.Parcelable.Creator<android.telephony.CellSignalStrengthGsm> CREATOR;
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index 5e9380e..2f93afd 100755
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -370,6 +370,22 @@
"android.settings.WIFI_IP_SETTINGS";
/**
+ * Activity Action: Show settings to allow configuration of Wi-Fi saved networks.
+ * <p>
+ * In some cases, a matching Activity may not exist, so ensure you
+ * safeguard against this.
+ * <p>
+ * Input: Nothing.
+ * <p>
+ * Output: Nothing.
+ * @hide
+ */
+ @SystemApi
+ @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
+ public static final String ACTION_WIFI_SAVED_NETWORK_SETTINGS =
+ "android.settings.WIFI_SAVED_NETWORK_SETTINGS";
+
+ /**
* Activity Action: Show settings to allow configuration of Bluetooth.
* <p>
* In some cases, a matching Activity may not exist, so ensure you
diff --git a/core/res/res/values-mcc259-mnc05/config.xml b/core/res/res/values-mcc259-mnc05/config.xml
deleted file mode 100644
index 065668c..0000000
--- a/core/res/res/values-mcc259-mnc05/config.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-** Copyright 2013, 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.
-*/
--->
-
-<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <!-- The list of ril radio technologies (see ServiceState.java) which only support
- a single data connection at one time. This may change by carrier via
- overlays (some don't support multiple pdp on UMTS). All unlisted radio
- tech types support unlimited types (practically only 2-4 used). -->
- <integer-array name="config_onlySingleDcAllowed">
- <item>1</item> <!-- GPRS -->
- <item>2</item> <!-- EDGE -->
- <item>3</item> <!-- UMTS -->
- <item>9</item> <!-- HSDPA -->
- <item>10</item> <!-- HSUPA -->
- <item>11</item> <!-- HSPA -->
- <item>14</item> <!-- LTE -->
- <item>15</item> <!-- HSPAP -->
- </integer-array>
-</resources>
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
index 0309f74..4c28284 100644
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -1867,19 +1867,6 @@
where if the preferred is used we don't try the others. -->
<bool name="config_dontPreferApn">false</bool>
- <!-- The list of ril radio technologies (see ServiceState.java) which only support
- a single data connection at one time. This may change by carrier via
- overlays (some don't support multiple pdp on UMTS). All unlisted radio
- tech types support unlimited types (practically only 2-4 used). -->
- <integer-array name="config_onlySingleDcAllowed">
- <item>4</item> <!-- IS95A -->
- <item>5</item> <!-- IS95B -->
- <item>6</item> <!-- 1xRTT -->
- <item>7</item> <!-- EVDO_0 -->
- <item>8</item> <!-- EVDO_A -->
- <item>12</item> <!-- EVDO_B -->
- </integer-array>
-
<!-- Set to true if after a provisioning apn the radio should be restarted -->
<bool name="config_restartRadioAfterProvisioning">false</bool>
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index 91f0251..27ddb5a 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -1648,7 +1648,6 @@
<java-symbol type="array" name="config_testLocationProviders" />
<java-symbol type="array" name="config_defaultNotificationVibePattern" />
<java-symbol type="array" name="config_notificationFallbackVibePattern" />
- <java-symbol type="array" name="config_onlySingleDcAllowed" />
<java-symbol type="bool" name="config_useAttentionLight" />
<java-symbol type="bool" name="config_animateScreenLights" />
<java-symbol type="bool" name="config_automatic_brightness_available" />
diff --git a/core/tests/coretests/src/android/provider/SettingsProviderTest.java b/core/tests/coretests/src/android/provider/SettingsProviderTest.java
index e6d3158..0a32e43 100644
--- a/core/tests/coretests/src/android/provider/SettingsProviderTest.java
+++ b/core/tests/coretests/src/android/provider/SettingsProviderTest.java
@@ -349,6 +349,7 @@
assertCanBeHandled(new Intent(Settings.ACTION_USER_DICTIONARY_SETTINGS));
assertCanBeHandled(new Intent(Settings.ACTION_WIFI_IP_SETTINGS));
assertCanBeHandled(new Intent(Settings.ACTION_WIFI_SETTINGS));
+ assertCanBeHandled(new Intent(Settings.ACTION_WIFI_SAVED_NETWORK_SETTINGS));
assertCanBeHandled(new Intent(Settings.ACTION_WIRELESS_SETTINGS));
}
diff --git a/legacy-test/Android.mk b/legacy-test/Android.mk
new file mode 100644
index 0000000..fe5d8ca
--- /dev/null
+++ b/legacy-test/Android.mk
@@ -0,0 +1,29 @@
+#
+# 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.
+#
+
+LOCAL_PATH:= $(call my-dir)
+
+# Build the legacy-test library
+# =============================
+# This contains the junit.framework classes that were in Android API level 25.
+include $(CLEAR_VARS)
+
+LOCAL_NO_STANDARD_LIBRARIES := true
+LOCAL_STATIC_JAVA_LIBRARIES := core-junit-static
+
+LOCAL_MODULE := legacy-test
+
+include $(BUILD_JAVA_LIBRARY)
diff --git a/services/core/java/com/android/server/TelephonyRegistry.java b/services/core/java/com/android/server/TelephonyRegistry.java
index 2932a1a..62f4f19 100644
--- a/services/core/java/com/android/server/TelephonyRegistry.java
+++ b/services/core/java/com/android/server/TelephonyRegistry.java
@@ -1381,7 +1381,6 @@
}
Intent intent = new Intent(TelephonyIntents.ACTION_SIGNAL_STRENGTH_CHANGED);
- intent.addFlags(Intent.FLAG_RECEIVER_REPLACE_PENDING);
Bundle data = new Bundle();
signalStrength.fillInNotifierBundle(data);
intent.putExtras(data);
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java
index 0f54d23..d048af2 100644
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -2891,9 +2891,11 @@
@Override
public void batterySendBroadcast(Intent intent) {
- broadcastIntentLocked(null, null, intent, null, null, 0, null, null, null,
- AppOpsManager.OP_NONE, null, false, false,
- -1, Process.SYSTEM_UID, UserHandle.USER_ALL);
+ synchronized (this) {
+ broadcastIntentLocked(null, null, intent, null, null, 0, null, null, null,
+ AppOpsManager.OP_NONE, null, false, false,
+ -1, Process.SYSTEM_UID, UserHandle.USER_ALL);
+ }
}
/**
diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java
index d064cd9..a1316a9 100644
--- a/telephony/java/android/telephony/CarrierConfigManager.java
+++ b/telephony/java/android/telephony/CarrierConfigManager.java
@@ -208,6 +208,14 @@
KEY_DISABLE_CDMA_ACTIVATION_CODE_BOOL = "disable_cdma_activation_code_bool";
/**
+ * List of RIL radio technologies (See {@link ServiceState} {@code RIL_RADIO_TECHNOLOGY_*}
+ * constants) which support only a single data connection at a time. Some carriers do not
+ * support multiple pdp on UMTS.
+ */
+ public static final String
+ KEY_ONLY_SINGLE_DC_ALLOWED_INT_ARRAY = "only_single_dc_allowed_int_array";
+
+ /**
* Override the platform's notion of a network operator being considered roaming.
* Value is string array of MCCMNCs to be considered roaming for 3GPP RATs.
*/
@@ -848,6 +856,15 @@
sDefaults.putStringArray(KEY_CARRIER_METERED_ROAMING_APN_TYPES_STRINGS,
new String[]{"default", "mms", "dun", "supl"});
+ sDefaults.putIntArray(KEY_ONLY_SINGLE_DC_ALLOWED_INT_ARRAY,
+ new int[]{
+ 4, /* IS95A */
+ 5, /* IS95B */
+ 6, /* 1xRTT */
+ 7, /* EVDO_0 */
+ 8, /* EVDO_A */
+ 12 /* EVDO_B */
+ });
sDefaults.putStringArray(KEY_GSM_ROAMING_NETWORKS_STRING_ARRAY, null);
sDefaults.putStringArray(KEY_GSM_NONROAMING_NETWORKS_STRING_ARRAY, null);
sDefaults.putStringArray(KEY_CDMA_ROAMING_NETWORKS_STRING_ARRAY, null);
diff --git a/telephony/java/android/telephony/CellSignalStrengthGsm.java b/telephony/java/android/telephony/CellSignalStrengthGsm.java
index addf7ef..4137853 100644
--- a/telephony/java/android/telephony/CellSignalStrengthGsm.java
+++ b/telephony/java/android/telephony/CellSignalStrengthGsm.java
@@ -141,6 +141,16 @@
}
/**
+ * Get the GSM timing advance between 0..219 symbols (normally 0..63).
+ * Integer.MAX_VALUE is reported when there is no RR connection.
+ * Refer to 3GPP 45.010 Sec 5.8
+ * @return the current GSM timing advance, if available.
+ */
+ public int getTimingAdvance() {
+ return mTimingAdvance;
+ }
+
+ /**
* Get the signal strength as dBm
*/
@Override
diff --git a/telephony/java/android/telephony/CellSignalStrengthLte.java b/telephony/java/android/telephony/CellSignalStrengthLte.java
index 434caad..0d07a40 100644
--- a/telephony/java/android/telephony/CellSignalStrengthLte.java
+++ b/telephony/java/android/telephony/CellSignalStrengthLte.java
@@ -220,8 +220,10 @@
}
/**
- * Get the timing advance value for LTE.
- * See 3GPP xxxx
+ * Get the timing advance value for LTE, as a value between 0..63.
+ * Integer.MAX_VALUE is reported when there is no active RRC
+ * connection. Refer to 3GPP 36.213 Sec 4.2.3
+ * @return the LTE timing advance, if available.
*/
public int getTimingAdvance() {
return mTimingAdvance;
diff --git a/tools/preload2/preload-tool b/tools/preload2/preload-tool
index 36dbc1c..322b62f 100644
--- a/tools/preload2/preload-tool
+++ b/tools/preload2/preload-tool
@@ -34,4 +34,4 @@
PROG_DIR="$(cd "${PROG_NAME%/*}" ; pwd -P)"
ANDROID_ROOT=$PROG_DIR/..
-java -cp $ANDROID_ROOT/framework/preload2.jar com.android.preload.Main
+java -cp $ANDROID_ROOT/framework/preload2.jar com.android.preload.Main $@
diff --git a/tools/preload2/src/com/android/preload/Main.java b/tools/preload2/src/com/android/preload/Main.java
index cc54a8d..8e60105 100644
--- a/tools/preload2/src/com/android/preload/Main.java
+++ b/tools/preload2/src/com/android/preload/Main.java
@@ -33,10 +33,13 @@
import com.android.preload.classdataretrieval.hprof.Hprof;
import com.android.preload.classdataretrieval.jdwp.JDWPClassDataRetriever;
import com.android.preload.ui.IUI;
+import com.android.preload.ui.SequenceUI;
import com.android.preload.ui.SwingUI;
-
+import java.io.File;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collection;
+import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -90,9 +93,14 @@
* @param args
*/
public static void main(String[] args) {
- Main m = new Main(new SwingUI());
- top = m;
+ Main m;
+ if (args.length > 0 && args[0].equals("--seq")) {
+ m = createSequencedMain(args);
+ } else {
+ m = new Main(new SwingUI());
+ }
+ top = m;
m.startUp();
}
@@ -130,6 +138,27 @@
ui.prepare(clientListModel, dataTableModel, actions);
}
+ /**
+ * @param args
+ * @return
+ */
+ private static Main createSequencedMain(String[] args) {
+ SequenceUI ui = new SequenceUI();
+ Main main = new Main(ui);
+
+ Iterator<String> it = Arrays.asList(args).iterator();
+ it.next(); // --seq
+
+ ui.choice("#" + it.next()); // Device.
+ ui.confirmNo(); // Prepare: no.
+ ui.action(ScanPackageAction.class); // Take hprof dump.
+ ui.client("system_process"); // Select system server.
+ ui.action(ExportAction.class); // Export data.
+ ui.output(new File("/tmp/system_server.data")); // Write to file.
+
+ return main;
+ }
+
public static IUI getUI() {
return top.ui;
}
diff --git a/tools/preload2/src/com/android/preload/ui/SequenceUI.java b/tools/preload2/src/com/android/preload/ui/SequenceUI.java
new file mode 100644
index 0000000..dc6a4f3
--- /dev/null
+++ b/tools/preload2/src/com/android/preload/ui/SequenceUI.java
@@ -0,0 +1,222 @@
+package com.android.preload.ui;
+
+import com.android.ddmlib.Client;
+import com.android.ddmlib.ClientData;
+import java.io.File;
+import java.util.LinkedList;
+import java.util.List;
+import javax.swing.Action;
+import javax.swing.ListModel;
+import javax.swing.table.TableModel;
+
+public class SequenceUI implements IUI {
+
+ private ListModel<Client> clientListModel;
+ @SuppressWarnings("unused")
+ private TableModel dataTableModel;
+ private List<Action> actions;
+
+ private List<Object> sequence = new LinkedList<>();
+
+ public SequenceUI() {
+ }
+
+ @Override
+ public boolean isSingleThreaded() {
+ return true;
+ }
+
+ @Override
+ public void prepare(ListModel<Client> clientListModel, TableModel dataTableModel,
+ List<Action> actions) {
+ this.clientListModel = clientListModel;
+ this.dataTableModel = dataTableModel;
+ this.actions = actions;
+ }
+
+ public SequenceUI action(Action a) {
+ sequence.add(a);
+ return this;
+ }
+
+ public SequenceUI action(Class<? extends Action> actionClass) {
+ for (Action a : actions) {
+ if (actionClass.equals(a.getClass())) {
+ sequence.add(a);
+ return this;
+ }
+ }
+ throw new IllegalArgumentException("No action of class " + actionClass + " found.");
+ }
+
+ public SequenceUI confirmYes() {
+ sequence.add(Boolean.TRUE);
+ return this;
+ }
+
+ public SequenceUI confirmNo() {
+ sequence.add(Boolean.FALSE);
+ return this;
+ }
+
+ public SequenceUI input(String input) {
+ sequence.add(input);
+ return this;
+ }
+
+ public SequenceUI input(File... f) {
+ sequence.add(f);
+ return this;
+ }
+
+ public SequenceUI output(File f) {
+ sequence.add(f);
+ return this;
+ }
+
+ public SequenceUI tableRow(int i) {
+ sequence.add(i);
+ return this;
+ }
+
+ private class ClientSelector {
+ private String pkg;
+
+ public ClientSelector(String pkg) {
+ this.pkg = pkg;
+ }
+
+ public Client getClient() {
+ for (int i = 0; i < clientListModel.getSize(); i++) {
+ ClientData cd = clientListModel.getElementAt(i).getClientData();
+ if (cd != null) {
+ String s = cd.getClientDescription();
+ if (pkg.equals(s)) {
+ return clientListModel.getElementAt(i);
+ }
+ }
+ }
+ throw new RuntimeException("Didn't find client " + pkg);
+ }
+ }
+
+ public SequenceUI client(String pkg) {
+ sequence.add(new ClientSelector(pkg));
+ return this;
+ }
+
+ public SequenceUI choice(String pattern) {
+ sequence.add(pattern);
+ return this;
+ }
+
+ @Override
+ public void ready() {
+ // Run the actions.
+ // No iterator or foreach loop as the sequence will be emptied while running.
+ try {
+ while (!sequence.isEmpty()) {
+ Object next = sequence.remove(0);
+ if (next instanceof Action) {
+ ((Action)next).actionPerformed(null);
+ } else {
+ throw new IllegalStateException("Didn't expect a non-action: " + next);
+ }
+ }
+ } catch (Exception e) {
+ e.printStackTrace(System.out);
+ }
+
+ // Now shut down.
+ System.exit(0);
+ }
+
+ @Override
+ public Client getSelectedClient() {
+ Object next = sequence.remove(0);
+ if (next instanceof ClientSelector) {
+ return ((ClientSelector)next).getClient();
+ }
+ throw new IllegalStateException("Unexpected: " + next);
+ }
+
+ @Override
+ public int getSelectedDataTableRow() {
+ Object next = sequence.remove(0);
+ if (next instanceof Integer) {
+ return ((Integer)next).intValue();
+ }
+ throw new IllegalStateException("Unexpected: " + next);
+ }
+
+ @Override
+ public void showWaitDialog() {
+ }
+
+ @Override
+ public void updateWaitDialog(String s) {
+ System.out.println(s);
+ }
+
+ @Override
+ public void hideWaitDialog() {
+ }
+
+ @Override
+ public void showMessageDialog(String s) {
+ System.out.println(s);
+ }
+
+ @Override
+ public boolean showConfirmDialog(String title, String message) {
+ Object next = sequence.remove(0);
+ if (next instanceof Boolean) {
+ return ((Boolean)next).booleanValue();
+ }
+ throw new IllegalStateException("Unexpected: " + next);
+ }
+
+ @Override
+ public String showInputDialog(String message) {
+ Object next = sequence.remove(0);
+ if (next instanceof String) {
+ return (String)next;
+ }
+ throw new IllegalStateException("Unexpected: " + next);
+ }
+
+ @Override
+ public <T> T showChoiceDialog(String title, String message, T[] choices) {
+ Object next = sequence.remove(0);
+ if (next instanceof String) {
+ String s = (String)next;
+ for (T t : choices) {
+ if (t.toString().contains(s)) {
+ return t;
+ }
+ }
+ return null;
+ }
+ throw new IllegalStateException("Unexpected: " + next);
+ }
+
+ @Override
+ public File showSaveDialog() {
+ Object next = sequence.remove(0);
+ if (next instanceof File) {
+ System.out.println(next);
+ return (File)next;
+ }
+ throw new IllegalStateException("Unexpected: " + next);
+ }
+
+ @Override
+ public File[] showOpenDialog(boolean multi) {
+ Object next = sequence.remove(0);
+ if (next instanceof File[]) {
+ return (File[])next;
+ }
+ throw new IllegalStateException("Unexpected: " + next);
+ }
+
+}
diff --git a/wifi/java/android/net/wifi/aware/WifiAwareDiscoveryBaseSession.java b/wifi/java/android/net/wifi/aware/WifiAwareDiscoveryBaseSession.java
index e8335d1..01e77da 100644
--- a/wifi/java/android/net/wifi/aware/WifiAwareDiscoveryBaseSession.java
+++ b/wifi/java/android/net/wifi/aware/WifiAwareDiscoveryBaseSession.java
@@ -35,7 +35,7 @@
* <li>Sending messages: {@link #sendMessage(WifiAwareManager.PeerHandle, int, byte[])} or
* {@link #sendMessage(WifiAwareManager.PeerHandle, int, byte[], int)} methods.
* <li>Creating a network-specifier when requesting a Aware connection:
- * {@link #createNetworkSpecifier(int, WifiAwareManager.PeerHandle, byte[])}.
+ * {@link #createNetworkSpecifier(WifiAwareManager.PeerHandle, byte[])}.
* </ul>
* The {@link #destroy()} method must be called to destroy discovery sessions once they are
* no longer needed.
@@ -260,10 +260,10 @@
* OOB (out-of-band) mechanism then use the alternative
* {@link WifiAwareSession#createNetworkSpecifier(int, byte[], byte[])} method - which uses the
* peer's MAC address.
+ * <p>
+ * Note: per the Wi-Fi Aware specification the roles are fixed - a Subscriber is an INITIATOR
+ * and a Publisher is a RESPONDER.
*
- * @param role The role of this device:
- * {@link WifiAwareManager#WIFI_AWARE_DATA_PATH_ROLE_INITIATOR} or
- * {@link WifiAwareManager#WIFI_AWARE_DATA_PATH_ROLE_RESPONDER}
* @param peerHandle The peer's handle obtained through
* {@link WifiAwareDiscoverySessionCallback#onServiceDiscovered(WifiAwareManager.PeerHandle,
* byte[], byte[])} or
@@ -283,8 +283,8 @@
* android.net.ConnectivityManager.NetworkCallback)}
* [or other varieties of that API].
*/
- public String createNetworkSpecifier(@WifiAwareManager.DataPathRole int role,
- @Nullable WifiAwareManager.PeerHandle peerHandle, @Nullable byte[] token) {
+ public String createNetworkSpecifier(@Nullable WifiAwareManager.PeerHandle peerHandle,
+ @Nullable byte[] token) {
if (mTerminated) {
Log.w(TAG, "createNetworkSpecifier: called on terminated session");
return null;
@@ -295,6 +295,10 @@
return null;
}
+ int role = this instanceof WifiAwareSubscribeDiscoverySession
+ ? WifiAwareManager.WIFI_AWARE_DATA_PATH_ROLE_INITIATOR
+ : WifiAwareManager.WIFI_AWARE_DATA_PATH_ROLE_RESPONDER;
+
return mgr.createNetworkSpecifier(mClientId, role, mSessionId, peerHandle, token);
}
}
diff --git a/wifi/java/android/net/wifi/aware/WifiAwareManager.java b/wifi/java/android/net/wifi/aware/WifiAwareManager.java
index a34ef47..cc24704 100644
--- a/wifi/java/android/net/wifi/aware/WifiAwareManager.java
+++ b/wifi/java/android/net/wifi/aware/WifiAwareManager.java
@@ -63,7 +63,7 @@
* <li>Create a Aware network specifier to be used with
* {@link ConnectivityManager#requestNetwork(NetworkRequest, ConnectivityManager.NetworkCallback)}
* to set-up a Aware connection with a peer. Refer to
- * {@link WifiAwareDiscoveryBaseSession#createNetworkSpecifier(int, PeerHandle, byte[])} and
+ * {@link WifiAwareDiscoveryBaseSession#createNetworkSpecifier(PeerHandle, byte[])} and
* {@link WifiAwareSession#createNetworkSpecifier(int, byte[], byte[])}.
* </ul>
* <p>
@@ -114,7 +114,7 @@
* {@link android.net.NetworkCapabilities#TRANSPORT_WIFI_AWARE}.
* <li>{@link NetworkRequest.Builder#setNetworkSpecifier(String)} using
* {@link WifiAwareSession#createNetworkSpecifier(int, byte[], byte[])} or
- * {@link WifiAwareDiscoveryBaseSession#createNetworkSpecifier(int, PeerHandle, byte[])}.
+ * {@link WifiAwareDiscoveryBaseSession#createNetworkSpecifier(PeerHandle, byte[])}.
* </ul>
*
* @hide PROPOSED_AWARE_API
@@ -224,7 +224,7 @@
* Connection creation role is that of INITIATOR. Used to create a network specifier string
* when requesting a Aware network.
*
- * @see WifiAwareDiscoveryBaseSession#createNetworkSpecifier(int, PeerHandle, byte[])
+ * @see WifiAwareDiscoveryBaseSession#createNetworkSpecifier(PeerHandle, byte[])
* @see WifiAwareSession#createNetworkSpecifier(int, byte[], byte[])
*/
public static final int WIFI_AWARE_DATA_PATH_ROLE_INITIATOR = 0;
@@ -233,7 +233,7 @@
* Connection creation role is that of RESPONDER. Used to create a network specifier string
* when requesting a Aware network.
*
- * @see WifiAwareDiscoveryBaseSession#createNetworkSpecifier(int, PeerHandle, byte[])
+ * @see WifiAwareDiscoveryBaseSession#createNetworkSpecifier(PeerHandle, byte[])
* @see WifiAwareSession#createNetworkSpecifier(int, byte[], byte[])
*/
public static final int WIFI_AWARE_DATA_PATH_ROLE_RESPONDER = 1;
diff --git a/wifi/java/android/net/wifi/aware/WifiAwareSession.java b/wifi/java/android/net/wifi/aware/WifiAwareSession.java
index acb60a4..005895a 100644
--- a/wifi/java/android/net/wifi/aware/WifiAwareSession.java
+++ b/wifi/java/android/net/wifi/aware/WifiAwareSession.java
@@ -193,8 +193,8 @@
* This API is targeted for applications which can obtain the peer MAC address using OOB
* (out-of-band) discovery. Aware discovery does not provide the MAC address of the peer -
* when using Aware discovery use the alternative network specifier method -
- * {@link WifiAwareDiscoveryBaseSession#createNetworkSpecifier(int,
- * WifiAwareManager.PeerHandle, byte[])}.
+ * {@link WifiAwareDiscoveryBaseSession#createNetworkSpecifier(WifiAwareManager.PeerHandle,
+ * byte[])}.
*
* @param role The role of this device:
* {@link WifiAwareManager#WIFI_AWARE_DATA_PATH_ROLE_INITIATOR} or
@@ -211,7 +211,7 @@
*
* @return A string to be used to construct
* {@link android.net.NetworkRequest.Builder#setNetworkSpecifier(String)} to pass to
- * {@link android.net.ConnectivityManager#requestNetwork(NetworkRequest,
+ * {@link android.net.ConnectivityManager#requestNetwork(android.net.NetworkRequest,
* android.net.ConnectivityManager.NetworkCallback)}
* [or other varieties of that API].
*/
diff --git a/wifi/tests/src/android/net/wifi/aware/WifiAwareManagerTest.java b/wifi/tests/src/android/net/wifi/aware/WifiAwareManagerTest.java
index b30ecf7..e161310 100644
--- a/wifi/tests/src/android/net/wifi/aware/WifiAwareManagerTest.java
+++ b/wifi/tests/src/android/net/wifi/aware/WifiAwareManagerTest.java
@@ -945,7 +945,7 @@
final int clientId = 4565;
final int sessionId = 123;
final WifiAwareManager.PeerHandle peerHandle = new WifiAwareManager.PeerHandle(123412);
- final int role = WifiAwareManager.WIFI_AWARE_DATA_PATH_ROLE_INITIATOR;
+ final int role = WifiAwareManager.WIFI_AWARE_DATA_PATH_ROLE_RESPONDER;
final String token = "Some arbitrary token string - can really be anything";
final ConfigRequest configRequest = new ConfigRequest.Builder().build();
final PublishConfig publishConfig = new PublishConfig.Builder().build();
@@ -982,7 +982,7 @@
inOrder.verify(mockSessionCallback).onPublishStarted(publishSession.capture());
// (3) request a network specifier from the session
- String networkSpecifier = publishSession.getValue().createNetworkSpecifier(role, peerHandle,
+ String networkSpecifier = publishSession.getValue().createNetworkSpecifier(peerHandle,
token.getBytes());
// validate format