summaryrefslogtreecommitdiffstats
path: root/src/com/android/settings
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/settings')
-rw-r--r--src/com/android/settings/ApnEditor.java2
-rw-r--r--src/com/android/settings/ChooseLockGeneric.java40
-rw-r--r--src/com/android/settings/ChooseLockSettingsHelper.java1
-rw-r--r--src/com/android/settings/ConfirmDeviceCredentialActivity.java15
-rw-r--r--src/com/android/settings/DevelopmentSettings.java26
-rw-r--r--src/com/android/settings/EncryptionInterstitial.java23
-rw-r--r--src/com/android/settings/SecuritySettings.java10
-rw-r--r--src/com/android/settings/SetupEncryptionInterstitial.java37
-rw-r--r--src/com/android/settings/WirelessSettings.java11
-rw-r--r--src/com/android/settings/applications/AppStateWriteSettingsBridge.java13
-rw-r--r--src/com/android/settings/applications/AppStorageSettings.java3
-rw-r--r--src/com/android/settings/applications/ManageApplications.java9
-rw-r--r--src/com/android/settings/applications/ResetAppsHelper.java2
-rw-r--r--src/com/android/settings/applications/WriteSettingsDetails.java40
-rw-r--r--src/com/android/settings/deviceinfo/PublicVolumeSettings.java4
-rw-r--r--src/com/android/settings/deviceinfo/StorageWizardInit.java4
-rw-r--r--src/com/android/settings/fingerprint/FingerprintEnrollBase.java6
-rw-r--r--src/com/android/settings/fingerprint/FingerprintEnrollEnrolling.java2
-rw-r--r--src/com/android/settings/fingerprint/FingerprintEnrollFindSensor.java12
-rw-r--r--src/com/android/settings/fingerprint/FingerprintEnrollFinish.java6
-rw-r--r--src/com/android/settings/fingerprint/FingerprintEnrollOnboard.java1
-rw-r--r--src/com/android/settings/fingerprint/FingerprintSettings.java2
-rw-r--r--src/com/android/settings/fingerprint/SetupFingerprintEnrollEnrolling.java6
-rw-r--r--src/com/android/settings/fuelgauge/HighPowerDetail.java8
-rw-r--r--src/com/android/settings/fuelgauge/PowerUsageDetail.java8
-rw-r--r--src/com/android/settings/fuelgauge/PowerUsageSummary.java5
-rw-r--r--src/com/android/settings/notification/RedactionInterstitial.java4
-rw-r--r--src/com/android/settings/wifi/SavedAccessPointsWifiSettings.java2
-rw-r--r--src/com/android/settings/wifi/WifiConfigController.java20
-rw-r--r--src/com/android/settings/wifi/WifiDialog.java12
-rw-r--r--src/com/android/settings/wifi/WifiSettings.java27
31 files changed, 208 insertions, 153 deletions
diff --git a/src/com/android/settings/ApnEditor.java b/src/com/android/settings/ApnEditor.java
index 7142fb6..8299c67 100644
--- a/src/com/android/settings/ApnEditor.java
+++ b/src/com/android/settings/ApnEditor.java
@@ -758,7 +758,7 @@ public class ApnEditor extends InstrumentedPreferenceActivity
if (pref != null) {
if (pref.equals(mPassword)){
pref.setSummary(starify(sharedPreferences.getString(key, "")));
- } else if (pref.equals(mCarrierEnabled)) {
+ } else if (pref.equals(mCarrierEnabled) || pref.equals(mBearerMulti)) {
// do nothing
} else {
pref.setSummary(checkNull(sharedPreferences.getString(key, "")));
diff --git a/src/com/android/settings/ChooseLockGeneric.java b/src/com/android/settings/ChooseLockGeneric.java
index 317d372..70ef4d9 100644
--- a/src/com/android/settings/ChooseLockGeneric.java
+++ b/src/com/android/settings/ChooseLockGeneric.java
@@ -97,6 +97,7 @@ public class ChooseLockGeneric extends SettingsActivity {
private int mEncryptionRequestQuality;
private boolean mEncryptionRequestDisabled;
private boolean mRequirePassword;
+ private boolean mForFingerprint = false;
private String mUserPassword;
private LockPatternUtils mLockPatternUtils;
private FingerprintManager mFingerprintManager;
@@ -140,6 +141,8 @@ public class ChooseLockGeneric extends SettingsActivity {
ChooseLockSettingsHelper.EXTRA_KEY_HAS_CHALLENGE, false);
mChallenge = getActivity().getIntent().getLongExtra(
ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE, 0);
+ mForFingerprint = getActivity().getIntent().getBooleanExtra(
+ ChooseLockSettingsHelper.EXTRA_KEY_FOR_FINGERPRINT, false);
if (savedInstanceState != null) {
mPasswordConfirmed = savedInstanceState.getBoolean(PASSWORD_CONFIRMED);
@@ -201,6 +204,8 @@ public class ChooseLockGeneric extends SettingsActivity {
final boolean accEn = AccessibilityManager.getInstance(context).isEnabled();
final boolean required = mLockPatternUtils.isCredentialRequiredToDecrypt(!accEn);
Intent intent = getEncryptionInterstitialIntent(context, quality, required);
+ intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_FOR_FINGERPRINT,
+ mForFingerprint);
startActivityForResult(intent, ENABLE_ENCRYPTION_REQUEST);
} else {
mRequirePassword = false; // device encryption not enabled or not device owner.
@@ -495,19 +500,28 @@ public class ChooseLockGeneric extends SettingsActivity {
return R.string.help_url_choose_lockscreen;
}
- private int getResIdForFactoryResetProtectionWarningTitle() {
+ private int getResIdForFactoryResetProtectionWarningMessage() {
+ boolean hasFingerprints = mFingerprintManager.hasEnrolledFingerprints();
switch (mLockPatternUtils.getKeyguardStoredPasswordQuality(UserHandle.myUserId())) {
case DevicePolicyManager.PASSWORD_QUALITY_SOMETHING:
- return R.string.unlock_disable_lock_pattern_summary;
+ return hasFingerprints
+ ? R.string.unlock_disable_frp_warning_content_pattern_fingerprint
+ : R.string.unlock_disable_frp_warning_content_pattern;
case DevicePolicyManager.PASSWORD_QUALITY_NUMERIC:
case DevicePolicyManager.PASSWORD_QUALITY_NUMERIC_COMPLEX:
- return R.string.unlock_disable_lock_pin_summary;
+ return hasFingerprints
+ ? R.string.unlock_disable_frp_warning_content_pin_fingerprint
+ : R.string.unlock_disable_frp_warning_content_pin;
case DevicePolicyManager.PASSWORD_QUALITY_ALPHABETIC:
case DevicePolicyManager.PASSWORD_QUALITY_ALPHANUMERIC:
case DevicePolicyManager.PASSWORD_QUALITY_COMPLEX:
- return R.string.unlock_disable_lock_password_summary;
+ return hasFingerprints
+ ? R.string.unlock_disable_frp_warning_content_password_fingerprint
+ : R.string.unlock_disable_frp_warning_content_password;
default:
- return R.string.unlock_disable_lock_unknown_summary;
+ return hasFingerprints
+ ? R.string.unlock_disable_frp_warning_content_unknown_fingerprint
+ : R.string.unlock_disable_frp_warning_content_unknown;
}
}
@@ -542,23 +556,23 @@ public class ChooseLockGeneric extends SettingsActivity {
}
private void showFactoryResetProtectionWarningDialog(String unlockMethodToSet) {
- int title = getResIdForFactoryResetProtectionWarningTitle();
+ int message = getResIdForFactoryResetProtectionWarningMessage();
FactoryResetProtectionWarningDialog dialog =
- FactoryResetProtectionWarningDialog.newInstance(title, unlockMethodToSet);
+ FactoryResetProtectionWarningDialog.newInstance(message, unlockMethodToSet);
dialog.show(getChildFragmentManager(), TAG_FRP_WARNING_DIALOG);
}
public static class FactoryResetProtectionWarningDialog extends DialogFragment {
- private static final String ARG_TITLE_RES = "titleRes";
+ private static final String ARG_MESSAGE_RES = "messageRes";
private static final String ARG_UNLOCK_METHOD_TO_SET = "unlockMethodToSet";
- public static FactoryResetProtectionWarningDialog newInstance(int title,
+ public static FactoryResetProtectionWarningDialog newInstance(int messageRes,
String unlockMethodToSet) {
FactoryResetProtectionWarningDialog frag =
new FactoryResetProtectionWarningDialog();
Bundle args = new Bundle();
- args.putInt(ARG_TITLE_RES, title);
+ args.putInt(ARG_MESSAGE_RES, messageRes);
args.putString(ARG_UNLOCK_METHOD_TO_SET, unlockMethodToSet);
frag.setArguments(args);
return frag;
@@ -577,9 +591,9 @@ public class ChooseLockGeneric extends SettingsActivity {
final Bundle args = getArguments();
return new AlertDialog.Builder(getActivity())
- .setTitle(args.getInt(ARG_TITLE_RES))
- .setMessage(R.string.unlock_disable_frp_warning_content)
- .setPositiveButton(R.string.okay,
+ .setTitle(R.string.unlock_disable_frp_warning_title)
+ .setMessage(args.getInt(ARG_MESSAGE_RES))
+ .setPositiveButton(R.string.unlock_disable_frp_warning_ok,
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int whichButton) {
diff --git a/src/com/android/settings/ChooseLockSettingsHelper.java b/src/com/android/settings/ChooseLockSettingsHelper.java
index 8b8d976..c07186f 100644
--- a/src/com/android/settings/ChooseLockSettingsHelper.java
+++ b/src/com/android/settings/ChooseLockSettingsHelper.java
@@ -32,6 +32,7 @@ public final class ChooseLockSettingsHelper {
public static final String EXTRA_KEY_HAS_CHALLENGE = "has_challenge";
public static final String EXTRA_KEY_CHALLENGE = "challenge";
public static final String EXTRA_KEY_CHALLENGE_TOKEN = "hw_auth_token";
+ public static final String EXTRA_KEY_FOR_FINGERPRINT = "for_fingerprint";
private LockPatternUtils mLockPatternUtils;
diff --git a/src/com/android/settings/ConfirmDeviceCredentialActivity.java b/src/com/android/settings/ConfirmDeviceCredentialActivity.java
index 7653603..da39a0f 100644
--- a/src/com/android/settings/ConfirmDeviceCredentialActivity.java
+++ b/src/com/android/settings/ConfirmDeviceCredentialActivity.java
@@ -58,12 +58,15 @@ public class ConfirmDeviceCredentialActivity extends Activity {
String title = intent.getStringExtra(KeyguardManager.EXTRA_TITLE);
String details = intent.getStringExtra(KeyguardManager.EXTRA_DESCRIPTION);
- ChooseLockSettingsHelper helper = new ChooseLockSettingsHelper(this);
- if (!helper.launchConfirmationActivity(0 /* request code */, null /* title */, title,
- details, false /* returnCredentials */, true /* isExternal */)) {
- Log.d(TAG, "No pattern, password or PIN set.");
- setResult(Activity.RESULT_OK);
- finish();
+ // Ignore rotates and ensure we only launch this once
+ if (savedInstanceState == null) {
+ ChooseLockSettingsHelper helper = new ChooseLockSettingsHelper(this);
+ if (!helper.launchConfirmationActivity(0 /* request code */, null /* title */, title,
+ details, false /* returnCredentials */, true /* isExternal */)) {
+ Log.d(TAG, "No pattern, password or PIN set.");
+ setResult(Activity.RESULT_OK);
+ finish();
+ }
}
}
diff --git a/src/com/android/settings/DevelopmentSettings.java b/src/com/android/settings/DevelopmentSettings.java
index f20728a..4a4c51d 100644
--- a/src/com/android/settings/DevelopmentSettings.java
+++ b/src/com/android/settings/DevelopmentSettings.java
@@ -101,9 +101,6 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
*/
public static final String PREF_SHOW = "show";
- private static final ComponentName SYSUI_TUNER = new ComponentName("com.android.systemui",
- "com.android.systemui.tuner.TunerActivity");
-
private static final String ENABLE_ADB = "enable_adb";
private static final String CLEAR_ADB_KEYS = "clear_adb_keys";
private static final String ENABLE_TERMINAL = "enable_terminal";
@@ -270,8 +267,6 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
private Dialog mAdbKeysDialog;
private boolean mUnavailable;
- private SwitchPreference mTunerUiPref;
-
@Override
protected int getMetricsCategory() {
return MetricsLogger.DEVELOPMENT;
@@ -407,8 +402,6 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
mAllPrefs.add(mShowAllANRs);
mResetSwitchPrefs.add(mShowAllANRs);
- mTunerUiPref = findAndInitSwitchPref(TUNER_UI_KEY);
-
Preference hdcpChecking = findPreference(HDCP_CHECKING_KEY);
if (hdcpChecking != null) {
mAllPrefs.add(hdcpChecking);
@@ -608,7 +601,6 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
updateMobileDataAlwaysOnOptions();
updateSimulateColorSpace();
updateUSBAudioOptions();
- updateTweakUi();
}
private void resetDangerousOptions() {
@@ -1153,21 +1145,6 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
}
}
- private void updateTweakUi() {
- updateSwitchPreference(mTunerUiPref, getActivity().getPackageManager()
- .getComponentEnabledSetting(SYSUI_TUNER)
- == PackageManager.COMPONENT_ENABLED_STATE_ENABLED);
- mTunerUiPref.setOnPreferenceChangeListener(this);
- }
-
- private void writeTweakUi(Object newValue) {
- Boolean enabled = (Boolean) newValue;
- getActivity().getPackageManager().setComponentEnabledSetting(SYSUI_TUNER,
- enabled ? PackageManager.COMPONENT_ENABLED_STATE_ENABLED
- : PackageManager.COMPONENT_ENABLED_STATE_DISABLED,
- PackageManager.DONT_KILL_APP);
- }
-
private void updateUSBAudioOptions() {
updateSwitchPreference(mUSBAudio, Settings.Secure.getInt(getContentResolver(),
Settings.Secure.USB_AUDIO_AUTOMATIC_ROUTING_DISABLED, 0) != 0);
@@ -1766,9 +1743,6 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
} else if (preference == mSimulateColorSpace) {
writeSimulateColorSpace(newValue);
return true;
- } else if (preference == mTunerUiPref) {
- writeTweakUi(newValue);
- return true;
}
return false;
}
diff --git a/src/com/android/settings/EncryptionInterstitial.java b/src/com/android/settings/EncryptionInterstitial.java
index 794005b..1bef99a 100644
--- a/src/com/android/settings/EncryptionInterstitial.java
+++ b/src/com/android/settings/EncryptionInterstitial.java
@@ -87,32 +87,44 @@ public class EncryptionInterstitial extends SettingsActivity {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
- final int layoutId = R.layout.encryption_interstitial;
- View view = inflater.inflate(layoutId, container, false);
+ return inflater.inflate(R.layout.encryption_interstitial, container, false);
+ }
+
+ @Override
+ public void onViewCreated(View view, Bundle savedInstanceState) {
+ super.onViewCreated(view, savedInstanceState);
mRequirePasswordToDecryptButton =
(RadioButton) view.findViewById(R.id.encrypt_require_password);
mDontRequirePasswordToDecryptButton =
(RadioButton) view.findViewById(R.id.encrypt_dont_require_password);
mEncryptionMessage =
(TextView) view.findViewById(R.id.encryption_message);
+ boolean forFingerprint = getActivity().getIntent().getBooleanExtra(
+ ChooseLockSettingsHelper.EXTRA_KEY_FOR_FINGERPRINT, false);
int quality = getActivity().getIntent().getIntExtra(EXTRA_PASSWORD_QUALITY, 0);
final int msgId;
final int enableId;
final int disableId;
switch (quality) {
case DevicePolicyManager.PASSWORD_QUALITY_SOMETHING:
- msgId = R.string.encryption_interstitial_message_pattern;
+ msgId = forFingerprint ?
+ R.string.encryption_interstitial_message_pattern_for_fingerprint :
+ R.string.encryption_interstitial_message_pattern;
enableId = R.string.encrypt_require_pattern;
disableId = R.string.encrypt_dont_require_pattern;
break;
case DevicePolicyManager.PASSWORD_QUALITY_NUMERIC:
case DevicePolicyManager.PASSWORD_QUALITY_NUMERIC_COMPLEX:
- msgId = R.string.encryption_interstitial_message_pin;
+ msgId = forFingerprint ?
+ R.string.encryption_interstitial_message_pin_for_fingerprint :
+ R.string.encryption_interstitial_message_pin;
enableId = R.string.encrypt_require_pin;
disableId = R.string.encrypt_dont_require_pin;
break;
default:
- msgId = R.string.encryption_interstitial_message_password;
+ msgId = forFingerprint ?
+ R.string.encryption_interstitial_message_password_for_fingerprint :
+ R.string.encryption_interstitial_message_password;
enableId = R.string.encrypt_require_password;
disableId = R.string.encrypt_dont_require_password;
break;
@@ -127,7 +139,6 @@ public class EncryptionInterstitial extends SettingsActivity {
setRequirePasswordState(getActivity().getIntent().getBooleanExtra(
EXTRA_REQUIRE_PASSWORD, true));
- return view;
}
@Override
diff --git a/src/com/android/settings/SecuritySettings.java b/src/com/android/settings/SecuritySettings.java
index bf091f6..6e679b6 100644
--- a/src/com/android/settings/SecuritySettings.java
+++ b/src/com/android/settings/SecuritySettings.java
@@ -791,6 +791,16 @@ public class SecuritySettings extends SettingsPreferenceFragment
result.add(data);
}
+ // Fingerprint
+ FingerprintManager fpm =
+ (FingerprintManager) context.getSystemService(Context.FINGERPRINT_SERVICE);
+ if (fpm.isHardwareDetected()) {
+ data = new SearchIndexableRaw(context);
+ data.title = res.getString(R.string.security_settings_fingerprint_preference_title);
+ data.screenTitle = screenTitle;
+ result.add(data);
+ }
+
// Credential storage
final UserManager um = (UserManager) context.getSystemService(Context.USER_SERVICE);
diff --git a/src/com/android/settings/SetupEncryptionInterstitial.java b/src/com/android/settings/SetupEncryptionInterstitial.java
index 61ff81c..27d7e0c 100644
--- a/src/com/android/settings/SetupEncryptionInterstitial.java
+++ b/src/com/android/settings/SetupEncryptionInterstitial.java
@@ -20,7 +20,6 @@ import com.android.setupwizardlib.SetupWizardLayout;
import com.android.setupwizardlib.view.NavigationBar;
import android.app.Activity;
-import android.app.admin.DevicePolicyManager;
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
@@ -73,36 +72,24 @@ public class SetupEncryptionInterstitial extends EncryptionInterstitial {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
- final SetupWizardLayout layout = new SetupWizardLayout(inflater.getContext());
- layout.setIllustration(R.drawable.setup_illustration_lock_screen,
- R.drawable.setup_illustration_horizontal_tile);
- layout.setBackgroundTile(R.drawable.setup_illustration_tile);
- final int headerTextResource = getHeaderTextResource();
- layout.setHeaderText(headerTextResource);
+ return inflater.inflate(R.layout.setup_encryption_interstitial, container, false);
+ }
+
+ @Override
+ public void onViewCreated(View view, Bundle savedInstanceState) {
+ super.onViewCreated(view, savedInstanceState);
+
+ final SetupWizardLayout layout =
+ (SetupWizardLayout) view.findViewById(R.id.setup_wizard_layout);
- View content = super.onCreateView(inflater, layout, savedInstanceState);
- layout.addView(content);
- layout.getNavigationBar().setNavigationBarListener(this);
+ final NavigationBar navigationBar = layout.getNavigationBar();
+ navigationBar.setNavigationBarListener(this);
Activity activity = getActivity();
if (activity != null) {
- activity.setTitle(headerTextResource);
+ activity.setTitle(R.string.encryption_interstitial_header);
SetupWizardUtils.setImmersiveMode(activity);
}
- return layout;
- }
-
- private int getHeaderTextResource() {
- final int quality = getActivity().getIntent().getIntExtra(EXTRA_PASSWORD_QUALITY, 0);
- switch (quality) {
- case DevicePolicyManager.PASSWORD_QUALITY_SOMETHING:
- return R.string.unlock_set_unlock_pattern_title;
- case DevicePolicyManager.PASSWORD_QUALITY_NUMERIC:
- case DevicePolicyManager.PASSWORD_QUALITY_NUMERIC_COMPLEX:
- return R.string.unlock_set_unlock_pin_title;
- default:
- return R.string.unlock_set_unlock_password_title;
- }
}
@Override
diff --git a/src/com/android/settings/WirelessSettings.java b/src/com/android/settings/WirelessSettings.java
index 32d50bf..8cc98cc 100644
--- a/src/com/android/settings/WirelessSettings.java
+++ b/src/com/android/settings/WirelessSettings.java
@@ -237,11 +237,7 @@ public class WirelessSettings extends SettingsPreferenceFragment implements Inde
mAirplaneModeEnabler = new AirplaneModeEnabler(activity, mAirplaneModePreference);
mNfcEnabler = new NfcEnabler(activity, nfc, androidBeam);
- if (ImsManager.isWfcEnabledByPlatform(activity)) {
- mButtonWfc = (PreferenceScreen) findPreference(KEY_WFC_SETTINGS);
- } else {
- removePreference(KEY_WFC_SETTINGS);
- }
+ mButtonWfc = (PreferenceScreen) findPreference(KEY_WFC_SETTINGS);
// Remove NSD checkbox by default
getPreferenceScreen().removePreference(nsd);
@@ -373,10 +369,15 @@ public class WirelessSettings extends SettingsPreferenceFragment implements Inde
mNsdEnabler.resume();
}
+ // update WFC setting
final Context context = getActivity();
if (ImsManager.isWfcEnabledByPlatform(context)) {
+ getPreferenceScreen().addPreference(mButtonWfc);
+
mButtonWfc.setSummary(WifiCallingSettings.getWfcModeSummary(
context, ImsManager.getWfcMode(context)));
+ } else {
+ removePreference(KEY_WFC_SETTINGS);
}
}
diff --git a/src/com/android/settings/applications/AppStateWriteSettingsBridge.java b/src/com/android/settings/applications/AppStateWriteSettingsBridge.java
index 4ab737f..e43b5f5 100644
--- a/src/com/android/settings/applications/AppStateWriteSettingsBridge.java
+++ b/src/com/android/settings/applications/AppStateWriteSettingsBridge.java
@@ -60,15 +60,12 @@ public class AppStateWriteSettingsBridge extends AppStateAppOpsBridge {
return super.getNumPackagesAllowedByAppOps();
}
- public static class WriteSettingsState {
- PermissionState mPermissionState;
-
+ public static class WriteSettingsState extends AppStateAppOpsBridge.PermissionState {
public WriteSettingsState(PermissionState permissionState) {
- mPermissionState = permissionState;
- }
-
- public boolean canWrite() {
- return mPermissionState.isPermissible();
+ super(permissionState.packageName, permissionState.userHandle);
+ this.packageInfo = permissionState.packageInfo;
+ this.appOpMode = permissionState.appOpMode;
+ this.permissionDeclared = permissionState.permissionDeclared;
}
}
diff --git a/src/com/android/settings/applications/AppStorageSettings.java b/src/com/android/settings/applications/AppStorageSettings.java
index b10669c..a524c7d 100644
--- a/src/com/android/settings/applications/AppStorageSettings.java
+++ b/src/com/android/settings/applications/AppStorageSettings.java
@@ -282,6 +282,9 @@ public class AppStorageSettings extends AppInfoWithHeader
@Override
protected boolean refreshUi() {
retrieveAppEntry();
+ if (mAppEntry == null) {
+ return false;
+ }
refreshSizeInfo();
final VolumeInfo currentVol = getActivity().getPackageManager()
diff --git a/src/com/android/settings/applications/ManageApplications.java b/src/com/android/settings/applications/ManageApplications.java
index 3820123..ce2dbe0 100644
--- a/src/com/android/settings/applications/ManageApplications.java
+++ b/src/com/android/settings/applications/ManageApplications.java
@@ -152,8 +152,10 @@ public class ManageApplications extends InstrumentedFragment
// This is the actual mapping to filters from FILTER_ constants above, the order must
// be kept in sync.
public static final AppFilter[] FILTERS = new AppFilter[] {
- AppStatePowerBridge.FILTER_POWER_WHITELISTED, // High power whitelist, on
- ApplicationsState.FILTER_PERSONAL, // All apps label, but personal filter
+ new CompoundFilter(AppStatePowerBridge.FILTER_POWER_WHITELISTED,
+ ApplicationsState.FILTER_ALL_ENABLED), // High power whitelist, on
+ new CompoundFilter(ApplicationsState.FILTER_PERSONAL,
+ ApplicationsState.FILTER_ALL_ENABLED), // All apps label, but personal filter
ApplicationsState.FILTER_EVERYTHING, // All apps
ApplicationsState.FILTER_ALL_ENABLED, // Enabled
ApplicationsState.FILTER_DISABLED, // Disabled
@@ -617,6 +619,9 @@ public class ManageApplications extends InstrumentedFragment
}
public void setHasDisabled(boolean hasDisabledApps) {
+ if (mListType == LIST_TYPE_HIGH_POWER) {
+ return;
+ }
mFilterAdapter.setFilterEnabled(FILTER_APPS_ENABLED, hasDisabledApps);
mFilterAdapter.setFilterEnabled(FILTER_APPS_DISABLED, hasDisabledApps);
}
diff --git a/src/com/android/settings/applications/ResetAppsHelper.java b/src/com/android/settings/applications/ResetAppsHelper.java
index cc83157..ad2ea02 100644
--- a/src/com/android/settings/applications/ResetAppsHelper.java
+++ b/src/com/android/settings/applications/ResetAppsHelper.java
@@ -126,7 +126,7 @@ public class ResetAppsHelper implements DialogInterface.OnClickListener,
}
}
try {
- mIPm.resetPreferredActivities(UserHandle.myUserId());
+ mIPm.resetApplicationPreferences(UserHandle.myUserId());
} catch (RemoteException e) {
}
mAom.resetAllModes();
diff --git a/src/com/android/settings/applications/WriteSettingsDetails.java b/src/com/android/settings/applications/WriteSettingsDetails.java
index eeee90c..30533c6 100644
--- a/src/com/android/settings/applications/WriteSettingsDetails.java
+++ b/src/com/android/settings/applications/WriteSettingsDetails.java
@@ -23,7 +23,6 @@ import android.content.Context;
import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
-import android.content.pm.ResolveInfo;
import android.os.Bundle;
import android.os.UserHandle;
import android.preference.Preference;
@@ -36,6 +35,7 @@ import android.util.Log;
import com.android.internal.logging.MetricsLogger;
import com.android.settings.InstrumentedFragment;
import com.android.settings.R;
+import com.android.settings.applications.AppStateAppOpsBridge.PermissionState;
import com.android.settings.applications.AppStateWriteSettingsBridge.WriteSettingsState;
import com.android.settingslib.applications.ApplicationsState;
import com.android.settingslib.applications.ApplicationsState.AppEntry;
@@ -98,7 +98,7 @@ public class WriteSettingsDetails extends AppInfoWithHeader implements OnPrefere
try {
getActivity().startActivityAsUser(mSettingsIntent, new UserHandle(mUserId));
} catch (ActivityNotFoundException e) {
- Log.w(TAG, "Unable to launch write system settings " + mSettingsIntent, e);
+ Log.w(LOG_TAG, "Unable to launch write system settings " + mSettingsIntent, e);
}
}
return true;
@@ -109,8 +109,9 @@ public class WriteSettingsDetails extends AppInfoWithHeader implements OnPrefere
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
if (preference == mSwitchPref) {
- if (mWriteSettingsState != null && (Boolean) newValue != mWriteSettingsState.canWrite()) {
- setCanWriteSettings(!mWriteSettingsState.canWrite());
+ if (mWriteSettingsState != null && (Boolean) newValue != mWriteSettingsState
+ .isPermissible()) {
+ setCanWriteSettings(!mWriteSettingsState.isPermissible());
refreshUi();
}
return true;
@@ -122,7 +123,6 @@ public class WriteSettingsDetails extends AppInfoWithHeader implements OnPrefere
mAppOpsManager.setMode(AppOpsManager.OP_WRITE_SETTINGS,
mPackageInfo.applicationInfo.uid, mPackageName, newState
? AppOpsManager.MODE_ALLOWED : AppOpsManager.MODE_ERRORED);
- canWriteSettings(mPackageName);
}
private boolean canWriteSettings(String pkgName) {
@@ -140,17 +140,10 @@ public class WriteSettingsDetails extends AppInfoWithHeader implements OnPrefere
mWriteSettingsState = mAppBridge.getWriteSettingsInfo(mPackageName,
mPackageInfo.applicationInfo.uid);
- boolean canWrite = mWriteSettingsState.canWrite();
+ boolean canWrite = mWriteSettingsState.isPermissible();
mSwitchPref.setChecked(canWrite);
mWriteSettingsPrefs.setEnabled(canWrite);
-
- ResolveInfo resolveInfo = mPm.resolveActivityAsUser(mSettingsIntent,
- PackageManager.GET_META_DATA, mUserId);
- if (resolveInfo == null) {
- if (findPreference(KEY_APP_OPS_SETTINGS_PREFS) != null) {
- getPreferenceScreen().removePreference(mWriteSettingsPrefs);
- }
- }
+ getPreferenceScreen().removePreference(mWriteSettingsPrefs);
return true;
}
@@ -166,9 +159,20 @@ public class WriteSettingsDetails extends AppInfoWithHeader implements OnPrefere
}
public static CharSequence getSummary(Context context, AppEntry entry) {
+ if (entry.extraInfo != null) {
+ return getSummary(context, new WriteSettingsState((PermissionState)entry
+ .extraInfo));
+ }
+
+ // fallback if entry.extrainfo is null - although this should not happen
return getSummary(context, entry.info.packageName);
}
+ public static CharSequence getSummary(Context context, WriteSettingsState writeSettingsState) {
+ return context.getString(writeSettingsState.isPermissible() ? R.string.write_settings_on :
+ R.string.write_settings_off);
+ }
+
public static CharSequence getSummary(Context context, String pkg) {
// first check if pkg is a system pkg
boolean isSystem = false;
@@ -180,8 +184,8 @@ public class WriteSettingsDetails extends AppInfoWithHeader implements OnPrefere
}
} catch (PackageManager.NameNotFoundException e) {
// pkg doesn't even exist?
- Log.w(TAG, "Package " + pkg + " not found", e);
- return context.getString(R.string.system_alert_window_off);
+ Log.w(LOG_TAG, "Package " + pkg + " not found", e);
+ return context.getString(R.string.write_settings_off);
}
AppOpsManager appOpsManager = (AppOpsManager) context.getSystemService(Context
@@ -189,7 +193,7 @@ public class WriteSettingsDetails extends AppInfoWithHeader implements OnPrefere
List<AppOpsManager.PackageOps> packageOps = appOpsManager.getPackagesForOps(
APP_OPS_OP_CODE);
if (packageOps == null) {
- return context.getString(R.string.system_alert_window_off);
+ return context.getString(R.string.write_settings_off);
}
int uid = isSystem ? 0 : -1;
@@ -201,7 +205,7 @@ public class WriteSettingsDetails extends AppInfoWithHeader implements OnPrefere
}
if (uid == -1) {
- return context.getString(R.string.system_alert_window_off);
+ return context.getString(R.string.write_settings_off);
}
int mode = appOpsManager.noteOpNoThrow(AppOpsManager.OP_WRITE_SETTINGS, uid, pkg);
diff --git a/src/com/android/settings/deviceinfo/PublicVolumeSettings.java b/src/com/android/settings/deviceinfo/PublicVolumeSettings.java
index 4c77d21..c9b4beb 100644
--- a/src/com/android/settings/deviceinfo/PublicVolumeSettings.java
+++ b/src/com/android/settings/deviceinfo/PublicVolumeSettings.java
@@ -16,6 +16,7 @@
package com.android.settings.deviceinfo;
+import android.app.ActivityManager;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
@@ -81,7 +82,8 @@ public class PublicVolumeSettings extends SettingsPreferenceFragment {
final Context context = getActivity();
- mIsPermittedToAdopt = UserManager.get(context).isAdminUser();
+ mIsPermittedToAdopt = UserManager.get(context).isAdminUser()
+ && !ActivityManager.isUserAMonkey();
mStorageManager = context.getSystemService(StorageManager.class);
diff --git a/src/com/android/settings/deviceinfo/StorageWizardInit.java b/src/com/android/settings/deviceinfo/StorageWizardInit.java
index 284e67d..c3c2430 100644
--- a/src/com/android/settings/deviceinfo/StorageWizardInit.java
+++ b/src/com/android/settings/deviceinfo/StorageWizardInit.java
@@ -16,6 +16,7 @@
package com.android.settings.deviceinfo;
+import android.app.ActivityManager;
import android.content.Intent;
import android.os.Bundle;
import android.os.UserManager;
@@ -42,7 +43,8 @@ public class StorageWizardInit extends StorageWizardBase {
}
setContentView(R.layout.storage_wizard_init);
- mIsPermittedToAdopt = UserManager.get(this).isAdminUser();
+ mIsPermittedToAdopt = UserManager.get(this).isAdminUser()
+ && !ActivityManager.isUserAMonkey();
setIllustrationInternal(true);
setHeaderText(R.string.storage_wizard_init_title, mDisk.getDescription());
diff --git a/src/com/android/settings/fingerprint/FingerprintEnrollBase.java b/src/com/android/settings/fingerprint/FingerprintEnrollBase.java
index 233f774..430f220 100644
--- a/src/com/android/settings/fingerprint/FingerprintEnrollBase.java
+++ b/src/com/android/settings/fingerprint/FingerprintEnrollBase.java
@@ -48,6 +48,12 @@ public class FingerprintEnrollBase extends Activity implements View.OnClickListe
*/
protected static final int RESULT_FINISHED = RESULT_FIRST_USER;
+ /**
+ * Used by the enrolling screen during setup wizard to skip over setting up fingerprint, which
+ * will be useful if the user accidentally entered this flow.
+ */
+ protected static final int RESULT_SKIP = RESULT_FIRST_USER + 1;
+
protected byte[] mToken;
@Override
diff --git a/src/com/android/settings/fingerprint/FingerprintEnrollEnrolling.java b/src/com/android/settings/fingerprint/FingerprintEnrollEnrolling.java
index b8ac040..5d4edbd 100644
--- a/src/com/android/settings/fingerprint/FingerprintEnrollEnrolling.java
+++ b/src/com/android/settings/fingerprint/FingerprintEnrollEnrolling.java
@@ -214,9 +214,9 @@ public class FingerprintEnrollEnrolling extends FingerprintEnrollBase
private void launchFinish(byte[] token) {
Intent intent = getFinishIntent();
+ intent.addFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT);
intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE_TOKEN, token);
startActivity(intent);
- setResult(RESULT_FINISHED);
finish();
}
diff --git a/src/com/android/settings/fingerprint/FingerprintEnrollFindSensor.java b/src/com/android/settings/fingerprint/FingerprintEnrollFindSensor.java
index 552ed71..bbed42c 100644
--- a/src/com/android/settings/fingerprint/FingerprintEnrollFindSensor.java
+++ b/src/com/android/settings/fingerprint/FingerprintEnrollFindSensor.java
@@ -16,6 +16,7 @@
package com.android.settings.fingerprint;
+import android.content.Context;
import android.content.Intent;
import android.hardware.fingerprint.FingerprintManager;
import android.os.Bundle;
@@ -75,6 +76,17 @@ public class FingerprintEnrollFindSensor extends FingerprintEnrollBase {
if (resultCode == RESULT_FINISHED) {
setResult(RESULT_FINISHED);
finish();
+ } else if (resultCode == RESULT_SKIP) {
+ setResult(RESULT_SKIP);
+ finish();
+ } else {
+ FingerprintManager fpm = getSystemService(FingerprintManager.class);
+ int enrolled = fpm.getEnrolledFingerprints().size();
+ int max = getResources().getInteger(
+ com.android.internal.R.integer.config_fingerprintMaxTemplatesPerUser);
+ if (enrolled >= max) {
+ finish();
+ }
}
} else {
super.onActivityResult(requestCode, resultCode, data);
diff --git a/src/com/android/settings/fingerprint/FingerprintEnrollFinish.java b/src/com/android/settings/fingerprint/FingerprintEnrollFinish.java
index 7e4d656..29f14d7 100644
--- a/src/com/android/settings/fingerprint/FingerprintEnrollFinish.java
+++ b/src/com/android/settings/fingerprint/FingerprintEnrollFinish.java
@@ -17,6 +17,7 @@
package com.android.settings.fingerprint;
import android.content.Context;
+import android.content.Intent;
import android.hardware.fingerprint.Fingerprint;
import android.hardware.fingerprint.FingerprintManager;
import android.os.Bundle;
@@ -55,13 +56,16 @@ public class FingerprintEnrollFinish extends FingerprintEnrollBase {
@Override
protected void onNextButtonClick() {
+ setResult(RESULT_FINISHED);
finish();
}
@Override
public void onClick(View v) {
if (v.getId() == R.id.add_another_button) {
- startActivity(getEnrollingIntent());
+ final Intent intent = getEnrollingIntent();
+ intent.addFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT);
+ startActivity(intent);
finish();
}
super.onClick(v);
diff --git a/src/com/android/settings/fingerprint/FingerprintEnrollOnboard.java b/src/com/android/settings/fingerprint/FingerprintEnrollOnboard.java
index db1a20b..e81b0ff 100644
--- a/src/com/android/settings/fingerprint/FingerprintEnrollOnboard.java
+++ b/src/com/android/settings/fingerprint/FingerprintEnrollOnboard.java
@@ -64,6 +64,7 @@ public class FingerprintEnrollOnboard extends FingerprintEnrollBase {
intent.putExtra(ChooseLockGeneric.ChooseLockGenericFragment.HIDE_DISABLED_PREFS, true);
intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_HAS_CHALLENGE, true);
intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE, challenge);
+ intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_FOR_FINGERPRINT, true);
startActivityForResult(intent, CHOOSE_LOCK_GENERIC_REQUEST);
}
diff --git a/src/com/android/settings/fingerprint/FingerprintSettings.java b/src/com/android/settings/fingerprint/FingerprintSettings.java
index 89c6e1b..f065bff 100644
--- a/src/com/android/settings/fingerprint/FingerprintSettings.java
+++ b/src/com/android/settings/fingerprint/FingerprintSettings.java
@@ -104,7 +104,7 @@ public class FingerprintSettings extends SubSettings {
}
public static class FingerprintSettingsFragment extends SettingsPreferenceFragment
- implements OnPreferenceChangeListener, Indexable {
+ implements OnPreferenceChangeListener {
private static final int MAX_RETRY_ATTEMPTS = 20;
private static final int RESET_HIGHLIGHT_DELAY_MS = 500;
diff --git a/src/com/android/settings/fingerprint/SetupFingerprintEnrollEnrolling.java b/src/com/android/settings/fingerprint/SetupFingerprintEnrollEnrolling.java
index 37c13e8..0de1718 100644
--- a/src/com/android/settings/fingerprint/SetupFingerprintEnrollEnrolling.java
+++ b/src/com/android/settings/fingerprint/SetupFingerprintEnrollEnrolling.java
@@ -52,8 +52,7 @@ public class SetupFingerprintEnrollEnrolling extends FingerprintEnrollEnrolling
final NavigationBar navigationBar = getNavigationBar();
navigationBar.setNavigationBarListener(this);
- // Enrolling screen auto-advances once the fingerprint is added
- navigationBar.getNextButton().setEnabled(false);
+ navigationBar.getNextButton().setText(R.string.skip_label);
}
@Override
@@ -68,6 +67,7 @@ public class SetupFingerprintEnrollEnrolling extends FingerprintEnrollEnrolling
@Override
public void onNavigateNext() {
- onNextButtonClick();
+ setResult(RESULT_SKIP);
+ finish();
}
}
diff --git a/src/com/android/settings/fuelgauge/HighPowerDetail.java b/src/com/android/settings/fuelgauge/HighPowerDetail.java
index 859b5b8..6946f62 100644
--- a/src/com/android/settings/fuelgauge/HighPowerDetail.java
+++ b/src/com/android/settings/fuelgauge/HighPowerDetail.java
@@ -79,7 +79,7 @@ public class HighPowerDetail extends DialogFragment implements OnClickListener,
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
AlertDialog.Builder b = new AlertDialog.Builder(getContext())
- .setTitle(getString(R.string.ignore_optimizations_title, mLabel))
+ .setTitle(mLabel)
.setNegativeButton(R.string.cancel, null)
.setView(R.layout.ignore_optimizations_content);
if (!mBackend.isSysWhitelisted(mPackageName)) {
@@ -141,8 +141,10 @@ public class HighPowerDetail extends DialogFragment implements OnClickListener,
}
public static CharSequence getSummary(Context context, String pkg) {
- return context.getString(PowerWhitelistBackend.getInstance().isWhitelisted(pkg)
- ? R.string.high_power_on : R.string.high_power_off);
+ PowerWhitelistBackend powerWhitelist = PowerWhitelistBackend.getInstance();
+ return context.getString(powerWhitelist.isSysWhitelisted(pkg) ? R.string.high_power_system
+ : powerWhitelist.isWhitelisted(pkg) ? R.string.high_power_on
+ : R.string.high_power_off);
}
public static void show(Fragment caller, String packageName, int requestCode,
diff --git a/src/com/android/settings/fuelgauge/PowerUsageDetail.java b/src/com/android/settings/fuelgauge/PowerUsageDetail.java
index 9e7fa48..6d4e398 100644
--- a/src/com/android/settings/fuelgauge/PowerUsageDetail.java
+++ b/src/com/android/settings/fuelgauge/PowerUsageDetail.java
@@ -163,7 +163,9 @@ public class PowerUsageDetail extends PowerUsageBase implements Button.OnClickLi
printWriter.flush();
args.putString(PowerUsageDetail.EXTRA_REPORT_CHECKIN_DETAILS,
result.toString());
- userId = UserHandle.getUserId(uid.getUid());
+ if (uid.getUid() != 0) {
+ userId = UserHandle.getUserId(uid.getUid());
+ }
}
}
break;
@@ -438,11 +440,11 @@ public class PowerUsageDetail extends PowerUsageBase implements Button.OnClickLi
}
});
} else {
- removePreference(KEY_HIGH_POWER);
+ mControlsParent.removePreference(findPreference(KEY_HIGH_POWER));
}
} else {
removePreference(KEY_TWO_BUTTONS);
- removePreference(KEY_HIGH_POWER);
+ mControlsParent.removePreference(findPreference(KEY_HIGH_POWER));
}
refreshStats();
diff --git a/src/com/android/settings/fuelgauge/PowerUsageSummary.java b/src/com/android/settings/fuelgauge/PowerUsageSummary.java
index 1475034..a1fcb52 100644
--- a/src/com/android/settings/fuelgauge/PowerUsageSummary.java
+++ b/src/com/android/settings/fuelgauge/PowerUsageSummary.java
@@ -317,7 +317,8 @@ public class PowerUsageSummary extends PowerUsageBase {
if (sipper.uidObj != null) {
pref.setKey(Integer.toString(sipper.uidObj.getUid()));
}
- if (sipper.drainType != DrainType.APP && sipper.drainType != DrainType.USER) {
+ if ((sipper.drainType != DrainType.APP || sipper.uidObj.getUid() == 0)
+ && sipper.drainType != DrainType.USER) {
pref.setTint(colorControl);
}
addedSome = true;
@@ -346,6 +347,8 @@ public class PowerUsageSummary extends PowerUsageBase {
}
stats.add(new BatterySipper(DrainType.APP,
new FakeUid(Process.FIRST_APPLICATION_UID), use));
+ stats.add(new BatterySipper(DrainType.APP,
+ new FakeUid(0), use));
// Simulate dex2oat process.
BatterySipper sipper = new BatterySipper(DrainType.APP,
diff --git a/src/com/android/settings/notification/RedactionInterstitial.java b/src/com/android/settings/notification/RedactionInterstitial.java
index a0d1219..a47b703 100644
--- a/src/com/android/settings/notification/RedactionInterstitial.java
+++ b/src/com/android/settings/notification/RedactionInterstitial.java
@@ -60,7 +60,9 @@ public class RedactionInterstitial extends SettingsActivity {
.putExtra(EXTRA_PREFS_SHOW_BUTTON_BAR, true)
.putExtra(EXTRA_PREFS_SET_BACK_TEXT, (String) null)
.putExtra(EXTRA_PREFS_SET_NEXT_TEXT, ctx.getString(
- R.string.app_notifications_dialog_done));
+ R.string.app_notifications_dialog_done))
+ .putExtra(EXTRA_SHOW_FRAGMENT_TITLE_RESID,
+ R.string.lock_screen_notifications_interstitial_title);
}
}
diff --git a/src/com/android/settings/wifi/SavedAccessPointsWifiSettings.java b/src/com/android/settings/wifi/SavedAccessPointsWifiSettings.java
index 72abe1e..45aafdf 100644
--- a/src/com/android/settings/wifi/SavedAccessPointsWifiSettings.java
+++ b/src/com/android/settings/wifi/SavedAccessPointsWifiSettings.java
@@ -147,7 +147,7 @@ public class SavedAccessPointsWifiSettings extends SettingsPreferenceFragment
final boolean hideForgetButton = WifiSettings.isEditabilityLockedDown(getActivity(),
mDlgAccessPoint.getConfig());
mDialog = new WifiDialog(getActivity(), this, mDlgAccessPoint,
- false /* not editting */, true /* hide the submit button */,
+ false /* not editting */, false, true /* hide the submit button */,
hideForgetButton);
return mDialog;
diff --git a/src/com/android/settings/wifi/WifiConfigController.java b/src/com/android/settings/wifi/WifiConfigController.java
index f3f0ccb..1a4b1dd 100644
--- a/src/com/android/settings/wifi/WifiConfigController.java
+++ b/src/com/android/settings/wifi/WifiConfigController.java
@@ -142,12 +142,14 @@ public class WifiConfigController implements TextWatcher,
private String[] mLevels;
private boolean mEdit;
+ private boolean mModify;
private TextView mSsidView;
private Context mContext;
public WifiConfigController(
- WifiConfigUiBase parent, View view, AccessPoint accessPoint, boolean edit) {
+ WifiConfigUiBase parent, View view, AccessPoint accessPoint, boolean edit,
+ boolean modify) {
mConfigUi = parent;
mView = view;
@@ -155,6 +157,7 @@ public class WifiConfigController implements TextWatcher,
mAccessPointSecurity = (accessPoint == null) ? AccessPoint.SECURITY_NONE :
accessPoint.getSecurity();
mEdit = edit;
+ mModify = modify;
mTextViewChangedHandler = new Handler();
mContext = mConfigUi.getContext();
@@ -245,7 +248,7 @@ public class WifiConfigController implements TextWatcher,
}
}
- if (mEdit) {
+ if (mModify) {
mConfigUi.setSubmitButton(res.getString(R.string.wifi_save));
} else {
final DetailedState state = mAccessPoint.getDetailedState();
@@ -303,12 +306,7 @@ public class WifiConfigController implements TextWatcher,
}
}
- if ((mEdit) || (mAccessPoint != null
- && mAccessPoint.getDetailedState() == null && mAccessPoint.getLevel() != -1)){
- mConfigUi.setCancelButton(res.getString(R.string.wifi_cancel));
- }else{
- mConfigUi.setCancelButton(res.getString(R.string.wifi_display_options_done));
- }
+ mConfigUi.setCancelButton(res.getString(R.string.wifi_cancel));
if (mConfigUi.getSubmitButton() != null) {
enableSubmitIfAppropriate();
}
@@ -370,7 +368,7 @@ public class WifiConfigController implements TextWatcher,
}
/* package */ WifiConfiguration getConfig() {
- if (mAccessPoint != null && mAccessPoint.isSaved() && !mEdit) {
+ if (!mEdit) {
return null;
}
@@ -953,6 +951,10 @@ public class WifiConfigController implements TextWatcher,
return mEdit;
}
+ public boolean isModify() {
+ return mModify;
+ }
+
@Override
public void afterTextChanged(Editable s) {
mTextViewChangedHandler.post(new Runnable() {
diff --git a/src/com/android/settings/wifi/WifiDialog.java b/src/com/android/settings/wifi/WifiDialog.java
index c18baf5..d052c95 100644
--- a/src/com/android/settings/wifi/WifiDialog.java
+++ b/src/com/android/settings/wifi/WifiDialog.java
@@ -31,6 +31,7 @@ class WifiDialog extends AlertDialog implements WifiConfigUiBase {
static final int BUTTON_FORGET = DialogInterface.BUTTON_NEUTRAL;
private final boolean mEdit;
+ private final boolean mModify;
private final DialogInterface.OnClickListener mListener;
private final AccessPoint mAccessPoint;
@@ -40,17 +41,18 @@ class WifiDialog extends AlertDialog implements WifiConfigUiBase {
private boolean mHideForgetButton;
public WifiDialog(Context context, DialogInterface.OnClickListener listener,
- AccessPoint accessPoint, boolean edit, boolean hideSubmitButton,
- boolean hideForgetButton) {
- this(context, listener, accessPoint, edit);
+ AccessPoint accessPoint, boolean edit, boolean modify,
+ boolean hideSubmitButton, boolean hideForgetButton) {
+ this(context, listener, accessPoint, edit, modify);
mHideSubmitButton = hideSubmitButton;
mHideForgetButton = hideForgetButton;
}
public WifiDialog(Context context, DialogInterface.OnClickListener listener,
- AccessPoint accessPoint, boolean edit) {
+ AccessPoint accessPoint, boolean edit, boolean modify) {
super(context);
mEdit = edit;
+ mModify = modify;
mListener = listener;
mAccessPoint = accessPoint;
mHideSubmitButton = false;
@@ -67,7 +69,7 @@ class WifiDialog extends AlertDialog implements WifiConfigUiBase {
mView = getLayoutInflater().inflate(R.layout.wifi_dialog, null);
setView(mView);
setInverseBackgroundForced(true);
- mController = new WifiConfigController(this, mView, mAccessPoint, mEdit);
+ mController = new WifiConfigController(this, mView, mAccessPoint, mEdit, mModify);
super.onCreate(savedInstanceState);
if (mHideSubmitButton) {
diff --git a/src/com/android/settings/wifi/WifiSettings.java b/src/com/android/settings/wifi/WifiSettings.java
index 7ce5dd0..341650c 100644
--- a/src/com/android/settings/wifi/WifiSettings.java
+++ b/src/com/android/settings/wifi/WifiSettings.java
@@ -119,6 +119,7 @@ public class WifiSettings extends RestrictedSettingsFragment
// Instance state keys
private static final String SAVE_DIALOG_EDIT_MODE = "edit_mode";
+ private static final String SAVE_DIALOG_MODIFY_MODE = "modify_mode";
private static final String SAVE_DIALOG_ACCESS_POINT_STATE = "wifi_ap_state";
private static final String SAVED_WIFI_NFC_DIALOG_STATE = "wifi_nfc_dlg_state";
@@ -150,6 +151,7 @@ public class WifiSettings extends RestrictedSettingsFragment
private boolean mEnableNextOnConnection;
// Save the dialog details
+ private boolean mDlgModify;
private boolean mDlgEdit;
private AccessPoint mDlgAccessPoint;
private Bundle mAccessPointSavedState;
@@ -248,6 +250,7 @@ public class WifiSettings extends RestrictedSettingsFragment
if (savedInstanceState != null) {
mDlgEdit = savedInstanceState.getBoolean(SAVE_DIALOG_EDIT_MODE);
+ mDlgModify = savedInstanceState.getBoolean(SAVE_DIALOG_MODIFY_MODE);
if (savedInstanceState.containsKey(SAVE_DIALOG_ACCESS_POINT_STATE)) {
mAccessPointSavedState =
savedInstanceState.getBundle(SAVE_DIALOG_ACCESS_POINT_STATE);
@@ -379,6 +382,7 @@ public class WifiSettings extends RestrictedSettingsFragment
// If the dialog is showing, save its state.
if (mDialog != null && mDialog.isShowing()) {
outState.putBoolean(SAVE_DIALOG_EDIT_MODE, mDlgEdit);
+ outState.putBoolean(SAVE_DIALOG_MODIFY_MODE, mDlgModify);
if (mDlgAccessPoint != null) {
mAccessPointSavedState = new Bundle();
mDlgAccessPoint.saveWifiState(mAccessPointSavedState);
@@ -506,6 +510,7 @@ public class WifiSettings extends RestrictedSettingsFragment
mSelectedAccessPoint.generateOpenNetworkConfig();
connect(mSelectedAccessPoint.getConfig());
} else {
+ mDlgModify = false;
showDialog(mSelectedAccessPoint, true);
}
return true;
@@ -515,6 +520,7 @@ public class WifiSettings extends RestrictedSettingsFragment
return true;
}
case MENU_ID_MODIFY: {
+ mDlgModify = true;
showDialog(mSelectedAccessPoint, true);
return true;
}
@@ -539,8 +545,12 @@ public class WifiSettings extends RestrictedSettingsFragment
getActivity().invalidateOptionsMenu();
}
connect(mSelectedAccessPoint.getConfig());
- } else {
+ } else if (mSelectedAccessPoint.isSaved()){
+ mDlgModify = false;
showDialog(mSelectedAccessPoint, false);
+ } else {
+ mDlgModify = false;
+ showDialog(mSelectedAccessPoint, true);
}
} else {
return super.onPreferenceTreeClick(screen, preference);
@@ -607,7 +617,7 @@ public class WifiSettings extends RestrictedSettingsFragment
final boolean hideForget = (ap == null || isEditabilityLockedDown(getActivity(),
ap.getConfig()));
mDialog = new WifiDialog(getActivity(), this, ap, mDlgEdit,
- /* no hide submit/connect */ false,
+ mDlgModify, /* no hide submit/connect */ false,
/* hide forget if config locked down */ hideForget);
return mDialog;
case WPS_PBC_DIALOG_ID:
@@ -825,16 +835,11 @@ public class WifiSettings extends RestrictedSettingsFragment
&& mSelectedAccessPoint.isSaved()) {
connect(mSelectedAccessPoint.getConfig());
}
- } else if (config.networkId != INVALID_NETWORK_ID) {
- if (mSelectedAccessPoint != null) {
- mWifiManager.save(config, mSaveListener);
- }
+ } else if (configController.isModify()) {
+ mWifiManager.save(config, mSaveListener);
} else {
- if (configController.isEdit()) {
- mWifiManager.save(config, mSaveListener);
- } else {
- connect(config);
- }
+ mWifiManager.save(config, mSaveListener);
+ connect(config);
}
mWifiTracker.resumeScanning();