Allow user to specify whether a new network is shared or private
* Add a check box to the WiFi configuration dialog that lets the user choose whether a newly created configuration is shared with other users (defaults to true) * Disable the check box when modifying an existing network BUG=25600871 Change-Id: Ifc6713602ee61b0407e55f45097c1b311fa19cb4
This commit is contained in:
@@ -502,6 +502,24 @@
|
|||||||
android:inputType="textNoSuggestions" />
|
android:inputType="textNoSuggestions" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
style="@style/wifi_section">
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
style="@style/wifi_item" >
|
||||||
|
<CheckBox android:id="@+id/shared"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
style="@style/wifi_item_content"
|
||||||
|
android:textSize="14sp"
|
||||||
|
android:text="@string/wifi_shared"
|
||||||
|
android:checked="true" />
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
|
@@ -1624,6 +1624,8 @@
|
|||||||
<string name="wifi_ap_choose_5G">5 GHz Band</string>
|
<string name="wifi_ap_choose_5G">5 GHz Band</string>
|
||||||
<!-- Label for the spinner to show ip settings [CHAR LIMIT=25] -->
|
<!-- Label for the spinner to show ip settings [CHAR LIMIT=25] -->
|
||||||
<string name="wifi_ip_settings">IP settings</string>
|
<string name="wifi_ip_settings">IP settings</string>
|
||||||
|
<!-- Label for the check box to share a network with other users on the same device -->
|
||||||
|
<string name="wifi_shared">Share with other device users</string>
|
||||||
<!-- Hint for unchanged fields -->
|
<!-- Hint for unchanged fields -->
|
||||||
<string name="wifi_unchanged">(unchanged)</string>
|
<string name="wifi_unchanged">(unchanged)</string>
|
||||||
<!-- Hint for unspecified fields -->
|
<!-- Hint for unspecified fields -->
|
||||||
|
@@ -35,6 +35,7 @@ import android.net.wifi.WifiEnterpriseConfig.Eap;
|
|||||||
import android.net.wifi.WifiEnterpriseConfig.Phase2;
|
import android.net.wifi.WifiEnterpriseConfig.Phase2;
|
||||||
import android.net.wifi.WifiInfo;
|
import android.net.wifi.WifiInfo;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
|
import android.os.UserManager;
|
||||||
import android.security.Credentials;
|
import android.security.Credentials;
|
||||||
import android.security.KeyStore;
|
import android.security.KeyStore;
|
||||||
import android.text.Editable;
|
import android.text.Editable;
|
||||||
@@ -138,6 +139,8 @@ public class WifiConfigController implements TextWatcher,
|
|||||||
private TextView mProxyExclusionListView;
|
private TextView mProxyExclusionListView;
|
||||||
private TextView mProxyPacView;
|
private TextView mProxyPacView;
|
||||||
|
|
||||||
|
private CheckBox mSharedCheckBox;
|
||||||
|
|
||||||
private IpAssignment mIpAssignment = IpAssignment.UNASSIGNED;
|
private IpAssignment mIpAssignment = IpAssignment.UNASSIGNED;
|
||||||
private ProxySettings mProxySettings = ProxySettings.UNASSIGNED;
|
private ProxySettings mProxySettings = ProxySettings.UNASSIGNED;
|
||||||
private ProxyInfo mHttpProxy = null;
|
private ProxyInfo mHttpProxy = null;
|
||||||
@@ -179,6 +182,7 @@ public class WifiConfigController implements TextWatcher,
|
|||||||
mIpSettingsSpinner.setOnItemSelectedListener(this);
|
mIpSettingsSpinner.setOnItemSelectedListener(this);
|
||||||
mProxySettingsSpinner = (Spinner) mView.findViewById(R.id.proxy_settings);
|
mProxySettingsSpinner = (Spinner) mView.findViewById(R.id.proxy_settings);
|
||||||
mProxySettingsSpinner.setOnItemSelectedListener(this);
|
mProxySettingsSpinner.setOnItemSelectedListener(this);
|
||||||
|
mSharedCheckBox = (CheckBox) mView.findViewById(R.id.shared);
|
||||||
|
|
||||||
if (mAccessPoint == null) { // new network
|
if (mAccessPoint == null) { // new network
|
||||||
mConfigUi.setTitle(R.string.wifi_add_network);
|
mConfigUi.setTitle(R.string.wifi_add_network);
|
||||||
@@ -218,6 +222,10 @@ public class WifiConfigController implements TextWatcher,
|
|||||||
mIpSettingsSpinner.setSelection(DHCP);
|
mIpSettingsSpinner.setSelection(DHCP);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mSharedCheckBox.setEnabled(config.shared);
|
||||||
|
if (!config.shared) {
|
||||||
|
showAdvancedFields = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (config.getProxySettings() == ProxySettings.STATIC) {
|
if (config.getProxySettings() == ProxySettings.STATIC) {
|
||||||
mProxySettingsSpinner.setSelection(PROXY_STATIC);
|
mProxySettingsSpinner.setSelection(PROXY_STATIC);
|
||||||
@@ -308,6 +316,12 @@ public class WifiConfigController implements TextWatcher,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final UserManager userManager =
|
||||||
|
(UserManager) mContext.getSystemService(Context.USER_SERVICE);
|
||||||
|
if (!userManager.isSplitSystemUser()) {
|
||||||
|
mSharedCheckBox.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
|
||||||
mConfigUi.setCancelButton(res.getString(R.string.wifi_cancel));
|
mConfigUi.setCancelButton(res.getString(R.string.wifi_cancel));
|
||||||
if (mConfigUi.getSubmitButton() != null) {
|
if (mConfigUi.getSubmitButton() != null) {
|
||||||
enableSubmitIfAppropriate();
|
enableSubmitIfAppropriate();
|
||||||
@@ -393,6 +407,8 @@ public class WifiConfigController implements TextWatcher,
|
|||||||
config.networkId = mAccessPoint.getConfig().networkId;
|
config.networkId = mAccessPoint.getConfig().networkId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
config.shared = mSharedCheckBox.isChecked();
|
||||||
|
|
||||||
switch (mAccessPointSecurity) {
|
switch (mAccessPointSecurity) {
|
||||||
case AccessPoint.SECURITY_NONE:
|
case AccessPoint.SECURITY_NONE:
|
||||||
config.allowedKeyManagement.set(KeyMgmt.NONE);
|
config.allowedKeyManagement.set(KeyMgmt.NONE);
|
||||||
|
Reference in New Issue
Block a user