Merge "Fix bug #14323392 Old Settings screen is shown while choosing Settings shortcut"
diff --git a/Android.mk b/Android.mk
index 8b6532c..023e0c0 100644
--- a/Android.mk
+++ b/Android.mk
@@ -21,4 +21,6 @@
include $(BUILD_PACKAGE)
# Use the folloing include to make our test apk.
+ifeq (,$(ONE_SHOT_MAKEFILE))
include $(call all-makefiles-under,$(LOCAL_PATH))
+endif
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 07cc59b..b40cfb2 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -1665,16 +1665,6 @@
</intent-filter>
</activity>
- <activity android:name=".PairNfcDevice"
- android:taskAffinity="com.android.settings"
- android:parentActivityName="Settings$SecuritySettingsActivity"
- android:launchMode="singleTask">
- <intent-filter>
- <action android:name="android.settings.PAIR_NFC_DEVICE" />
- <category android:name="android.intent.category.DEFAULT" />
- </intent-filter>
- </activity>
-
<activity android:name="Settings$NotificationAccessSettingsActivity"
android:label="@string/manage_notification_access"
android:taskAffinity=""
diff --git a/res/drawable-hdpi/no_ring_detected.png b/res/drawable-hdpi/no_ring_detected.png
deleted file mode 100644
index 2adb7bf..0000000
--- a/res/drawable-hdpi/no_ring_detected.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/ring_detected.png b/res/drawable-hdpi/ring_detected.png
deleted file mode 100644
index 5b1836b..0000000
--- a/res/drawable-hdpi/ring_detected.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/ring_paired.png b/res/drawable-hdpi/ring_paired.png
deleted file mode 100644
index 065e752..0000000
--- a/res/drawable-hdpi/ring_paired.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/no_ring_detected.png b/res/drawable-mdpi/no_ring_detected.png
deleted file mode 100644
index 6d53477..0000000
--- a/res/drawable-mdpi/no_ring_detected.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/ring_detected.png b/res/drawable-mdpi/ring_detected.png
deleted file mode 100644
index 9dc0e9f..0000000
--- a/res/drawable-mdpi/ring_detected.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/ring_paired.png b/res/drawable-mdpi/ring_paired.png
deleted file mode 100644
index 70c8541..0000000
--- a/res/drawable-mdpi/ring_paired.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xhdpi/no_ring_detected.png b/res/drawable-xhdpi/no_ring_detected.png
deleted file mode 100644
index a657afa..0000000
--- a/res/drawable-xhdpi/no_ring_detected.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xhdpi/ring_detected.png b/res/drawable-xhdpi/ring_detected.png
deleted file mode 100644
index a6180b2..0000000
--- a/res/drawable-xhdpi/ring_detected.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xhdpi/ring_paired.png b/res/drawable-xhdpi/ring_paired.png
deleted file mode 100644
index df77918..0000000
--- a/res/drawable-xhdpi/ring_paired.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xxhdpi/no_ring_detected.png b/res/drawable-xxhdpi/no_ring_detected.png
deleted file mode 100644
index a56d6b7..0000000
--- a/res/drawable-xxhdpi/no_ring_detected.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xxhdpi/ring_detected.png b/res/drawable-xxhdpi/ring_detected.png
deleted file mode 100644
index b225740..0000000
--- a/res/drawable-xxhdpi/ring_detected.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xxhdpi/ring_paired.png b/res/drawable-xxhdpi/ring_paired.png
deleted file mode 100644
index c90233b..0000000
--- a/res/drawable-xxhdpi/ring_paired.png
+++ /dev/null
Binary files differ
diff --git a/res/layout/activity_nfc_pairing.xml b/res/layout/activity_nfc_pairing.xml
deleted file mode 100644
index c753fd0..0000000
--- a/res/layout/activity_nfc_pairing.xml
+++ /dev/null
@@ -1,44 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-
-<!-- Copyright (C) 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.
--->
-
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:tools="http://schemas.android.com/tools"
- android:orientation="vertical"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:gravity="center_vertical">
-
- <ImageView
- android:id="@+id/status_image"
- android:src="@drawable/no_ring_detected"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:gravity="bottom"
- android:scaleType="center"/>
-
- <TextView
- android:id="@+id/status_text"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:gravity="top"
- android:textSize="24sp"
- android:textAlignment="center"
- android:paddingTop="16dp"
- android:paddingLeft="20dp"
- android:paddingRight="20dp"/>
-
-</LinearLayout>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index f2c00f3..945dd3d 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -702,10 +702,6 @@
<string name="security_enable_widgets_title">Enable widgets</string>
<!-- Summary for settings checkbox to disable widgets when the setting has been disabled by an installed device admin [CHAR LIMIT=50] -->
<string name="security_enable_widgets_disabled_summary">Disabled by administrator</string>
- <!-- Text shown for title of settings to setup/change NFC unlock [CHAR LIMIT=20]-->
- <string name="nfc_unlock_title">NFC unlock</string>
-
-
<!-- Text shown for summary of owner info setting [CHAR LIMIT=40]-->
<string name="owner_info_settings_summary"></string>
<!-- Hint text shown in owner info edit text [CHAR LIMIT=50] -->
@@ -5006,22 +5002,6 @@
<!-- Text to display in regulatory info screen (from device overlay). -->
<string name="regulatory_info_text"></string>
- <!-- NFC unlock -->
- <string name="lock_settings_nfc_title">NFC Screen Lock Settings</string>
- <string name="nfc_unlock_paired_tags_title">Paired Tags</string>
- <string name="nfc_unlock_enabled">Enabled</string>
- <string name="start_nfc_pairing">Pair with a tag</string>
-
- <!-- Nfc pair activity strings -->
- <string name="title_activity_nfc_pairing">NfcPairingActivity</string>
- <string name="pairing_button_title">Pair now</string>
- <string name="status_no_ring_detected">Set the tag flat on a table and place the phone on top</string>
- <string name="status_device_paired">Tag and phone successfully paired, you are done!</string>
- <string name="status_error_invalid_device">The tag provided cannot be used to unlock your phone</string>
- <string name="status_error_pairing_failed">The pairing with your tag failed, please try again</string>
- <string name="enable_nfc">NFC is not enabled and is required for NFC Unlock. Please turn on NFC.</string>
- <string name="ok">NFC Settings</string>
-
<!--Dashboard strings-->
<!-- Text to describe the dashboard fragment title [CHAR LIMIT=16] -->
<string name="dashboard_title">Settings</string>
diff --git a/res/xml/security_settings_biometric_weak.xml b/res/xml/security_settings_biometric_weak.xml
index 7226c6c..c663492 100644
--- a/res/xml/security_settings_biometric_weak.xml
+++ b/res/xml/security_settings_biometric_weak.xml
@@ -57,11 +57,6 @@
android:title="@string/owner_info_settings_title"
android:summary="@string/owner_info_settings_summary"/>
- <PreferenceScreen
- android:key="nfc_unlock_set_or_change"
- android:title="@string/nfc_unlock_title"
- android:persistent="false"/>
-
</PreferenceCategory>
</PreferenceScreen>
diff --git a/res/xml/security_settings_chooser.xml b/res/xml/security_settings_chooser.xml
index f6e2e89..d17366e 100644
--- a/res/xml/security_settings_chooser.xml
+++ b/res/xml/security_settings_chooser.xml
@@ -32,11 +32,6 @@
android:title="@string/owner_info_settings_title"
android:summary="@string/owner_info_settings_summary"/>
- <PreferenceScreen
- android:key="nfc_unlock_set_or_change"
- android:title="@string/nfc_unlock_title"
- android:persistent="false"/>
-
</PreferenceCategory>
</PreferenceScreen>
diff --git a/res/xml/security_settings_password.xml b/res/xml/security_settings_password.xml
index 0380716..b418aa7 100644
--- a/res/xml/security_settings_password.xml
+++ b/res/xml/security_settings_password.xml
@@ -44,11 +44,6 @@
android:title="@string/owner_info_settings_title"
android:summary="@string/owner_info_settings_summary"/>
- <PreferenceScreen
- android:key="nfc_unlock_set_or_change"
- android:title="@string/nfc_unlock_title"
- android:persistent="false"/>
-
</PreferenceCategory>
</PreferenceScreen>
diff --git a/res/xml/security_settings_pattern.xml b/res/xml/security_settings_pattern.xml
index 8a8cb63..d47a99d 100644
--- a/res/xml/security_settings_pattern.xml
+++ b/res/xml/security_settings_pattern.xml
@@ -48,11 +48,6 @@
android:title="@string/owner_info_settings_title"
android:summary="@string/owner_info_settings_summary"/>
- <PreferenceScreen
- android:key="nfc_unlock_set_or_change"
- android:title="@string/nfc_unlock_title"
- android:persistent="false"/>
-
</PreferenceCategory>
</PreferenceScreen>
diff --git a/res/xml/security_settings_pin.xml b/res/xml/security_settings_pin.xml
index c114631..c1aac48 100644
--- a/res/xml/security_settings_pin.xml
+++ b/res/xml/security_settings_pin.xml
@@ -44,11 +44,6 @@
android:title="@string/owner_info_settings_title"
android:summary="@string/owner_info_settings_summary"/>
- <PreferenceScreen
- android:key="nfc_unlock_set_or_change"
- android:title="@string/nfc_unlock_title"
- android:persistent="false"/>
-
</PreferenceCategory>
</PreferenceScreen>
diff --git a/src/com/android/settings/NfcLockFragment.java b/src/com/android/settings/NfcLockFragment.java
deleted file mode 100644
index b7bf6f7..0000000
--- a/src/com/android/settings/NfcLockFragment.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-package com.android.settings;
-
-import android.app.AlertDialog;
-import android.content.DialogInterface;
-import android.nfc.NfcAdapter;
-import android.nfc.NfcUnlock;
-import android.os.Bundle;
-import android.preference.CheckBoxPreference;
-import android.preference.Preference;
-
-import android.preference.PreferenceCategory;
-import android.util.Log;
-import com.android.internal.widget.LockPatternUtils;
-
-import java.text.DateFormat;
-import java.util.Date;
-
-import static android.preference.Preference.OnPreferenceClickListener;
-
-public class NfcLockFragment extends SettingsPreferenceFragment {
-
- private static final String NFC_PAIRING = "nfc_pairing";
- private static final String NFC_UNLOCK_ENABLED = "nfc_unlock_enabled";
- private static final String TAGS_CATEGORY = "nfc_unlock_tags_category";
- private static final String TAG_FORMAT = "Tag # %d";
-
- private NfcUnlock mNfcUnlock;
- private LockPatternUtils mLockPatternUtils;
- private NfcAdapter mNfcAdapter;
-
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- mNfcUnlock = NfcUnlock.getInstance(NfcAdapter.getDefaultAdapter(getActivity()));
- mLockPatternUtils = new LockPatternUtils(getActivity());
- mNfcAdapter = NfcAdapter.getDefaultAdapter(getActivity());
- addPreferencesFromResource(R.xml.security_settings_nfc_unlock);
- }
-
- @Override
- public void onResume() {
- super.onResume();
-
- boolean prefsEnabled = (mLockPatternUtils.isLockPasswordEnabled() ||
- mLockPatternUtils.isLockPatternEnabled()) && mNfcAdapter.isEnabled();
- CheckBoxPreference unlockPref = (CheckBoxPreference) findPreference(NFC_UNLOCK_ENABLED);
- unlockPref.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
- @Override
- public boolean onPreferenceChange(Preference preference, Object newValue) {
- mNfcUnlock.setNfcUnlockEnabled((Boolean) newValue);
- return true;
- }
- });
- Preference pairingPref = findPreference(NFC_PAIRING);
- unlockPref.setEnabled(prefsEnabled);
- pairingPref.setEnabled(prefsEnabled);
-
- long[] tagRegistryTimes = mNfcUnlock.getTagRegistryTimes();
- unlockPref.setChecked(mNfcUnlock.getNfcUnlockEnabled());
-
- final PreferenceCategory pairedTags = (PreferenceCategory) findPreference(TAGS_CATEGORY);
- pairedTags.setEnabled(prefsEnabled);
-
- loadTagList(tagRegistryTimes, pairedTags);
- }
-
- private void loadTagList(long[] tagRegistryTimes, final PreferenceCategory pairedTags) {
- pairedTags.removeAll();
-
- for (int i = 0; i < tagRegistryTimes.length; i++) {
-
- final Preference thisPreference = new Preference(getActivity());
- final long timestamp = tagRegistryTimes[i];
-
- thisPreference.setTitle(String.format(TAG_FORMAT, i));
- thisPreference.setSummary(
- DateFormat.getDateTimeInstance().format(new Date(tagRegistryTimes[i])));
- thisPreference.setOnPreferenceClickListener(new OnPreferenceClickListener() {
- @Override
- public boolean onPreferenceClick(Preference preference) {
-
- AlertDialog.Builder deleteDialogBuilder = new AlertDialog.Builder(getActivity());
-
- deleteDialogBuilder.setTitle(thisPreference.getTitle());
- deleteDialogBuilder.setItems(new String[] {"Delete"},
- new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int which) {
- if (which == 0) {
- if (mNfcUnlock.deregisterTag(timestamp)) {
- loadTagList(mNfcUnlock.getTagRegistryTimes(),
- pairedTags);
- }
- }
- }
- });
-
-
- deleteDialogBuilder.show();
-
- return true;
- }
- });
-
-
- pairedTags.addPreference(thisPreference);
- }
- }
-}
diff --git a/src/com/android/settings/PairNfcDevice.java b/src/com/android/settings/PairNfcDevice.java
deleted file mode 100644
index 7c75b9f..0000000
--- a/src/com/android/settings/PairNfcDevice.java
+++ /dev/null
@@ -1,161 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-package com.android.settings;
-
-import android.app.Activity;
-import android.app.AlertDialog;
-import android.app.PendingIntent;
-import android.content.DialogInterface;
-import android.content.Intent;
-import android.nfc.NfcAdapter;
-import android.nfc.NfcUnlock;
-import android.nfc.Tag;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.PowerManager;
-import android.provider.Settings;
-import android.view.Menu;
-import android.widget.ImageView;
-import android.widget.TextView;
-
-public class PairNfcDevice extends Activity {
- private static String TAG = PairNfcDevice.class.getName();
-
- private TextView mStatusText;
- private ImageView mStatusImage;
-
- private PendingIntent mPendingIntent;
- private NfcAdapter mAdapter;
-
- private Handler mHandler = new Handler();
- private PowerManager.WakeLock mWakeLock;
-
- private NfcUnlock mNfcUnlock;
-
- // If pairing fails, we immediately get a new intent that would not leave time for the user to
- // read the error message. So we'll just drop it and the user has to try again.
- // TEST
- private boolean mWaitingForDeviceDelayed;
-
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_nfc_pairing);
-
- mStatusText = (TextView) findViewById(R.id.status_text);
- mStatusImage = (ImageView) findViewById(R.id.status_image);
-
- mAdapter = NfcAdapter.getDefaultAdapter(this);
- mPendingIntent = PendingIntent.getActivity(
- this, 0, new Intent(this, getClass()).addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP), 0);
-
- mNfcUnlock = NfcUnlock.getInstance(mAdapter);
-
- setWaitingForDeviceMode();
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- return false;
- }
-
- public void onPause() {
- super.onPause();
- mAdapter.disableForegroundDispatch(this);
- if (mWakeLock != null) {
- mWakeLock.release();
- }
- }
-
- public void onResume() {
- super.onResume();
-
- if (!mAdapter.isEnabled()) {
- // We need the user to start NFC.
- AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(this);
- dialogBuilder.setMessage(R.string.enable_nfc);
- dialogBuilder.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int id) {
- startActivity(new Intent(Settings.ACTION_NFC_SETTINGS));
- }
- });
- dialogBuilder.show();
- }
-
- mAdapter.enableForegroundDispatch(this, mPendingIntent, null, null);
-
- if (mWakeLock == null) {
- PowerManager pm = (PowerManager) getSystemService(POWER_SERVICE);
- mWakeLock = pm.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK, TAG);
- }
- mWakeLock.acquire();
- }
-
- @Override
- public void onNewIntent(Intent intent) {
- Tag tag = (Tag) intent.getParcelableExtra(NfcAdapter.EXTRA_TAG);
- if (!mWaitingForDeviceDelayed) {
- processTag(tag);
- }
- }
-
- private void processTag(Tag tag) {
- if (mNfcUnlock.registerTag(tag)) {
- setPairingSucceededMode();
- } else {
- setPairingFailedMode();
- }
- }
-
- private void setWaitingForDeviceModeDelayed(int delayInMs) {
- mWaitingForDeviceDelayed = true;
- mHandler.postDelayed(new Runnable() {
- @Override
- public void run() {
- mWaitingForDeviceDelayed = false;
- setWaitingForDeviceMode();
- }
- }, delayInMs);
- }
-
- private void setWaitingForDeviceMode() {
- mStatusImage.setImageResource(R.drawable.no_ring_detected);
- mStatusText.setText(R.string.status_no_ring_detected);
- }
-
- private void setPairingFailedMode() {
- setErrorMode(R.string.status_error_pairing_failed);
- }
-
- private void setPairingSucceededMode() {
- mStatusImage.setImageResource(R.drawable.ring_paired);
- mStatusText.setText(R.string.status_device_paired);
-
- // Automatically quit.
- mHandler.postDelayed(new Runnable() {
- @Override
- public void run() {
- finish();
- }
- }, 1000);
- }
-
- private void setErrorMode(int errorMsgResourceId) {
- mStatusText.setText(errorMsgResourceId);
- setWaitingForDeviceModeDelayed(2500);
- }
-}
diff --git a/src/com/android/settings/SecuritySettings.java b/src/com/android/settings/SecuritySettings.java
index 0ab9ea7..00d1d89 100644
--- a/src/com/android/settings/SecuritySettings.java
+++ b/src/com/android/settings/SecuritySettings.java
@@ -20,7 +20,6 @@
import static android.provider.Settings.System.SCREEN_OFF_TIMEOUT;
import android.app.Activity;
-import android.app.ActivityManager;
import android.app.AlertDialog;
import android.app.admin.DevicePolicyManager;
import android.content.Context;
@@ -30,7 +29,6 @@
import android.content.pm.ResolveInfo;
import android.content.pm.UserInfo;
import android.content.res.Resources;
-import android.nfc.NfcUnlock;
import android.os.Bundle;
import android.os.UserHandle;
import android.os.UserManager;
@@ -54,8 +52,6 @@
import java.util.ArrayList;
import java.util.List;
-import static com.android.settings.search.SearchIndexableResources.RANK_SECURITY;
-
/**
* Gesture lock pattern settings.
*/
@@ -65,7 +61,6 @@
// Lock Settings
private static final String KEY_UNLOCK_SET_OR_CHANGE = "unlock_set_or_change";
- private static final String KEY_NFC_UNLOCK_SET_OR_CHANGE = "nfc_unlock_set_or_change";
private static final String KEY_BIOMETRIC_WEAK_IMPROVE_MATCHING =
"biometric_weak_improve_matching";
private static final String KEY_BIOMETRIC_WEAK_LIVELINESS = "biometric_weak_liveliness";
@@ -238,19 +233,6 @@
}
}
- // don't display NFC unlock settings if the prop is not enabled
- if (!NfcUnlock.getPropertyEnabled()) {
- PreferenceGroup securityCategory =
- (PreferenceGroup) root.findPreference(KEY_SECURITY_CATEGORY);
-
- if (securityCategory != null) {
- Preference preference = root.findPreference(KEY_NFC_UNLOCK_SET_OR_CHANGE);
- if (preference != null) {
- securityCategory.removePreference(preference);
- }
- }
- }
-
// Append the rest of the settings
addPreferencesFromResource(R.xml.security_settings_misc);
@@ -490,9 +472,6 @@
if (KEY_UNLOCK_SET_OR_CHANGE.equals(key)) {
startFragment(this, "com.android.settings.ChooseLockGeneric$ChooseLockGenericFragment",
SET_OR_CHANGE_LOCK_METHOD_REQUEST, null);
- } else if (KEY_NFC_UNLOCK_SET_OR_CHANGE.equals(key)) {
- startFragment(this, "com.android.settings.NfcLockFragment",
- SET_OR_CHANGE_LOCK_METHOD_REQUEST, null);
} else if (KEY_BIOMETRIC_WEAK_IMPROVE_MATCHING.equals(key)) {
ChooseLockSettingsHelper helper =
new ChooseLockSettingsHelper(this.getActivity(), this);
diff --git a/src/com/android/settings/wifi/WifiConfigController.java b/src/com/android/settings/wifi/WifiConfigController.java
index a54c1c4..7ccfc6b 100644
--- a/src/com/android/settings/wifi/WifiConfigController.java
+++ b/src/com/android/settings/wifi/WifiConfigController.java
@@ -20,6 +20,9 @@
import android.content.Context;
import android.content.res.Resources;
+import android.net.IpConfiguration;
+import android.net.IpConfiguration.IpAssignment;
+import android.net.IpConfiguration.ProxySettings;
import android.net.LinkAddress;
import android.net.LinkProperties;
import android.net.NetworkInfo.DetailedState;
@@ -28,9 +31,7 @@
import android.net.RouteInfo;
import android.net.wifi.WifiConfiguration;
import android.net.wifi.WifiConfiguration.AuthAlgorithm;
-import android.net.wifi.WifiConfiguration.IpAssignment;
import android.net.wifi.WifiConfiguration.KeyMgmt;
-import android.net.wifi.WifiConfiguration.ProxySettings;
import android.net.wifi.WifiEnterpriseConfig;
import android.net.wifi.WifiEnterpriseConfig.Eap;
import android.net.wifi.WifiEnterpriseConfig.Phase2;
@@ -240,27 +241,27 @@
boolean showAdvancedFields = false;
if (mAccessPoint.networkId != INVALID_NETWORK_ID) {
WifiConfiguration config = mAccessPoint.getConfig();
- if (config.ipAssignment == IpAssignment.STATIC) {
+ if (config.getIpAssignment() == IpAssignment.STATIC) {
mIpSettingsSpinner.setSelection(STATIC_IP);
showAdvancedFields = true;
} else {
mIpSettingsSpinner.setSelection(DHCP);
}
//Display IP addresses
- for(InetAddress a : config.linkProperties.getAddresses()) {
+ for(InetAddress a : config.getLinkProperties().getAddresses()) {
addRow(group, R.string.wifi_ip_address, a.getHostAddress());
}
- if (config.proxySettings == ProxySettings.STATIC) {
+ if (config.getProxySettings() == ProxySettings.STATIC) {
mProxySettingsSpinner.setSelection(PROXY_STATIC);
showAdvancedFields = true;
- } else if (config.proxySettings == ProxySettings.PAC) {
+ } else if (config.getProxySettings() == ProxySettings.PAC) {
mProxySettingsSpinner.setVisibility(View.GONE);
TextView textView = (TextView)mView.findViewById(R.id.proxy_pac_info);
textView.setVisibility(View.VISIBLE);
textView.setText(context.getString(R.string.proxy_url) +
- config.linkProperties.getHttpProxy().getPacFileUrl());
+ config.getLinkProperties().getHttpProxy().getPacFileUrl());
showAdvancedFields = true;
} else {
mProxySettingsSpinner.setSelection(PROXY_NONE);
@@ -446,9 +447,8 @@
return null;
}
- config.proxySettings = mProxySettings;
- config.ipAssignment = mIpAssignment;
- config.linkProperties = new LinkProperties(mLinkProperties);
+ config.setIpConfiguration(
+ new IpConfiguration(mIpAssignment, mProxySettings, mLinkProperties));
return config;
}
@@ -772,7 +772,7 @@
mDns2View.addTextChangedListener(this);
}
if (config != null) {
- LinkProperties linkProperties = config.linkProperties;
+ LinkProperties linkProperties = config.getLinkProperties();
Iterator<LinkAddress> iterator = linkProperties.getLinkAddresses().iterator();
if (iterator.hasNext()) {
LinkAddress linkAddress = iterator.next();
@@ -822,7 +822,7 @@
mProxyExclusionListView.addTextChangedListener(this);
}
if (config != null) {
- ProxyInfo proxyProperties = config.linkProperties.getHttpProxy();
+ ProxyInfo proxyProperties = config.getLinkProperties().getHttpProxy();
if (proxyProperties != null) {
mProxyHostView.setText(proxyProperties.getHost());
mProxyPortView.setText(Integer.toString(proxyProperties.getPort()));