summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author govenliu <govenliu@google.com> 2019-11-04 16:34:07 +0800
committer govenliu <govenliu@google.com> 2019-11-09 00:39:19 +0800
commit4ab3e4e09d19c8e07116ec8a0e44dc662681efad (patch)
tree0d0cf5720a900c056af715c0e34d96da66c1516f
parent8f17256df34515c80085715e704546b77431b36f (diff)
[Wi-Fi] Add intent action & extra keys & result codes for add networks.
For supporting the mechanism for apps to add saved networks to the device, need to: 1. Add one new intent action. 2. Define two extra keys for passing data to Settings APP and get result back. 3. Define 3 result codes. Bug: 136472483 Test: just add action, test case will be in Settings App side. Change-Id: I7391a6b8d89bd4621aab833b2da2a981f7b8163b
-rw-r--r--api/current.txt6
-rw-r--r--core/java/android/provider/Settings.java71
2 files changed, 77 insertions, 0 deletions
diff --git a/api/current.txt b/api/current.txt
index 59c3f6828154..821860152208 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -38962,10 +38962,14 @@ package android.provider {
field public static final String ACTION_VPN_SETTINGS = "android.settings.VPN_SETTINGS";
field public static final String ACTION_VR_LISTENER_SETTINGS = "android.settings.VR_LISTENER_SETTINGS";
field public static final String ACTION_WEBVIEW_SETTINGS = "android.settings.WEBVIEW_SETTINGS";
+ field public static final String ACTION_WIFI_ADD_NETWORKS = "android.settings.WIFI_ADD_NETWORKS";
field public static final String ACTION_WIFI_IP_SETTINGS = "android.settings.WIFI_IP_SETTINGS";
field public static final String ACTION_WIFI_SETTINGS = "android.settings.WIFI_SETTINGS";
field public static final String ACTION_WIRELESS_SETTINGS = "android.settings.WIRELESS_SETTINGS";
field public static final String ACTION_ZEN_MODE_PRIORITY_SETTINGS = "android.settings.ZEN_MODE_PRIORITY_SETTINGS";
+ field public static final int ADD_WIFI_RESULT_ADD_OR_UPDATE_FAILED = 1; // 0x1
+ field public static final int ADD_WIFI_RESULT_ALREADY_EXISTS = 2; // 0x2
+ field public static final int ADD_WIFI_RESULT_SUCCESS = 0; // 0x0
field public static final String AUTHORITY = "settings";
field public static final String EXTRA_ACCOUNT_TYPES = "account_types";
field public static final String EXTRA_AIRPLANE_MODE_ENABLED = "airplane_mode_enabled";
@@ -38977,6 +38981,8 @@ package android.provider {
field public static final String EXTRA_DO_NOT_DISTURB_MODE_MINUTES = "android.settings.extra.do_not_disturb_mode_minutes";
field public static final String EXTRA_INPUT_METHOD_ID = "input_method_id";
field public static final String EXTRA_SUB_ID = "android.provider.extra.SUB_ID";
+ field public static final String EXTRA_WIFI_CONFIGURATION_LIST = "android.provider.extra.WIFI_CONFIGURATION_LIST";
+ field public static final String EXTRA_WIFI_CONFIGURATION_RESULT_LIST = "android.provider.extra.WIFI_CONFIGURATION_RESULT_LIST";
field public static final String INTENT_CATEGORY_USAGE_ACCESS_CONFIG = "android.intent.category.USAGE_ACCESS_CONFIG";
field public static final String METADATA_USAGE_ACCESS_REASON = "android.settings.metadata.USAGE_ACCESS_REASON";
}
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index 381d4921932f..c377fdc40e45 100644
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -14052,6 +14052,77 @@ public final class Settings {
"android.settings.panel.action.VOLUME";
}
+ /**
+ * Activity Action: Show setting page to process the addition of Wi-Fi networks to the user's
+ * saved network list. The app should send a new intent with an extra that holds a maximum of
+ * five {@link android.net.wifi.WifiConfiguration} that specify credentials for the networks to
+ * be added to the user's database. The Intent should be sent via the {@link
+ * android.app.Activity#startActivityForResult(Intent, int)} API.
+ * <p>
+ * Note: The app sending the Intent to add the credentials doesn't get any ownership over the
+ * newly added network(s). For the Wi-Fi stack, these networks will look like the user
+ * manually added them from the Settings UI.
+ * <p>
+ * Input: The app should put parcelable array list to
+ * {@link android.net.wifi.WifiConfiguration} into the
+ * {@link #EXTRA_WIFI_CONFIGURATION_LIST} extra.
+ * <p>
+ * Output: After {@link android.app.Activity#startActivityForResult(Intent, int)}, the
+ * callback {@link android.app.Activity#onActivityResult(int, int, Intent)} will have a
+ * result code {@link android.app.Activity#RESULT_OK} to indicate user pressed the save
+ * button to save the networks or {@link android.app.Activity#RESULT_CANCELED} to indicate
+ * that the user rejected the request. Additionally, an integer array list, stored in
+ * {@link #EXTRA_WIFI_CONFIGURATION_RESULT_LIST}, will indicate the process result of
+ * each network.
+ */
+ @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
+ public static final String ACTION_WIFI_ADD_NETWORKS =
+ "android.settings.WIFI_ADD_NETWORKS";
+
+ /**
+ * A bundle extra of {@link #ACTION_WIFI_ADD_NETWORKS} intent action that indicates all the
+ * {@link android.net.wifi.WifiConfiguration} that would be saved.
+ */
+ public static final String EXTRA_WIFI_CONFIGURATION_LIST =
+ "android.provider.extra.WIFI_CONFIGURATION_LIST";
+
+ /**
+ * A bundle extra of the result of {@link #ACTION_WIFI_ADD_NETWORKS} intent action that
+ * indicates the action result of the saved {@link android.net.wifi.WifiConfiguration}. It's
+ * value of AddWifiResult interface, and will be 1:1 mapping to the element in {@link
+ * #EXTRA_WIFI_CONFIGURATION_LIST}.
+ */
+ public static final String EXTRA_WIFI_CONFIGURATION_RESULT_LIST =
+ "android.provider.extra.WIFI_CONFIGURATION_RESULT_LIST";
+
+ /** @hide */
+ @Retention(RetentionPolicy.SOURCE)
+ @IntDef(prefix = {"ADD_WIFI_RESULT_"}, value = {
+ ADD_WIFI_RESULT_SUCCESS,
+ ADD_WIFI_RESULT_ADD_OR_UPDATE_FAILED,
+ ADD_WIFI_RESULT_ALREADY_EXISTS
+ })
+ public @interface AddWifiResult {
+ }
+
+ /**
+ * A result of {@link #ACTION_WIFI_ADD_NETWORKS} intent action that saving or updating the
+ * corresponding Wi-Fi network was successful.
+ */
+ public static final int ADD_WIFI_RESULT_SUCCESS = 0;
+
+ /**
+ * A result of {@link #ACTION_WIFI_ADD_NETWORKS} intent action that saving the corresponding
+ * Wi-Fi network failed.
+ */
+ public static final int ADD_WIFI_RESULT_ADD_OR_UPDATE_FAILED = 1;
+
+ /**
+ * A result of {@link #ACTION_WIFI_ADD_NETWORKS} intent action that indicates the Wi-Fi network
+ * already exists.
+ */
+ public static final int ADD_WIFI_RESULT_ALREADY_EXISTS = 2;
+
private static final String[] PM_WRITE_SETTINGS = {
android.Manifest.permission.WRITE_SETTINGS
};