Merge "Move ApplicationsState to SettingsLib" into mnc-dev
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 4978d57..51f0fa1 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -1353,7 +1353,7 @@
<string name="link_speed">%1$d Mbps</string>
<!-- Wifi Alert message when tapping on a preference for a config locked down by device owner. [CHAR LIMIT=200] -->
- <string name="wifi_alert_lockdown_by_device_owner"><xliff:g id="app_name">%1$s</xliff:g> manages your device and has disabled modifying and deleting this Wi-Fi network. For more information, contact your administrator.</string>
+ <string name="wifi_alert_lockdown_by_device_owner"><xliff:g id="app_name">%1$s</xliff:g> manages your device and doesn\'t allow modifying or deleting this Wi-Fi network. For more information, contact your administrator.</string>
<!-- NFC settings -->
<!-- Used in the 1st-level settings screen to turn on NFC -->
@@ -6059,19 +6059,18 @@
</plurals>
<!-- String to show in the list of notification listeners, when none is installed -->
- <string name="no_notification_listeners">No notification listeners are installed.</string>
+ <string name="no_notification_listeners">No installed apps have requested notification access.</string>
<!-- Title for a warning message about security implications of enabling a notification
listener, displayed as a dialog message. [CHAR LIMIT=NONE] -->
- <string name="notification_listener_security_warning_title">Enable
+ <string name="notification_listener_security_warning_title">Allow notification access for
<xliff:g id="service" example="NotificationReader">%1$s</xliff:g>?</string>
<!-- Summary for a warning message about security implications of enabling a notification
listener, displayed as a dialog message. [CHAR LIMIT=NONE] -->
<string name="notification_listener_security_warning_summary">
- <xliff:g id="notification_listener_name">%1$s</xliff:g> will be able to
- read all notifications posted by the system or any installed app, which may include personal
- information such as contact names and the text of messages sent to you. It will also be able
- to dismiss these notifications or touch action buttons within them.
+ <xliff:g id="notification_listener_name">%1$s</xliff:g> will be able to read all notifications,
+ including personal information such as contact names and the text of messages you receive.
+ It will also be able to dismiss notifications or trigger action buttons they contain.
</string>
<!-- Sound & notification > Advanced section: Title for managing Do Not Disturb access option. [CHAR LIMIT=40] -->
@@ -6330,7 +6329,7 @@
<!-- Title for a work profile. [CHAR LIMIT=25] -->
<string name="managed_user_title">Work profile</string>
<!-- Opening string on the dialog that prompts the user to confirm that they really want to delete their existing work profile. The administration app icon and name appear after the final colon. [CHAR LIMIT=NONE] -->
- <string name="opening_paragraph_delete_profile_unknown_company">This profile is managed by:</string>
+ <string name="opening_paragraph_delete_profile_unknown_company">This work profile is managed by:</string>
<!-- Summary for work profile accounts group. [CHAR LIMIT=25] -->
<string name="managing_admin">Managed by <xliff:g id="admin_app_label">%s</xliff:g></string>
diff --git a/src/com/android/settings/DisplaySettings.java b/src/com/android/settings/DisplaySettings.java
index e0a3489..b67375b 100644
--- a/src/com/android/settings/DisplaySettings.java
+++ b/src/com/android/settings/DisplaySettings.java
@@ -176,7 +176,10 @@
rotatePreference.setCallback(new Callback() {
@Override
public boolean onItemSelected(int pos, Object value) {
- RotationPolicy.setRotationLock(activity, (Boolean) value);
+ final boolean locked = (Boolean) value;
+ MetricsLogger.action(getActivity(), InstrumentedFragment.ACTION_ROTATION_LOCK,
+ locked);
+ RotationPolicy.setRotationLock(activity, locked);
return true;
}
});
diff --git a/src/com/android/settings/DropDownPreference.java b/src/com/android/settings/DropDownPreference.java
index 89e67a5..ce4bb2f 100644
--- a/src/com/android/settings/DropDownPreference.java
+++ b/src/com/android/settings/DropDownPreference.java
@@ -36,6 +36,7 @@
private final ArrayList<Object> mValues = new ArrayList<Object>();
private Callback mCallback;
+ private int mSelectedPosition = -1;
public DropDownPreference(Context context) {
this(context, null);
@@ -54,7 +55,7 @@
mSpinner.setOnItemSelectedListener(new OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View v, int position, long id) {
- setSelectedItem(position);
+ setSelectedItem(position, true);
}
@Override
@@ -91,11 +92,19 @@
}
public void setSelectedItem(int position) {
+ setSelectedItem(position, false);
+ }
+
+ public void setSelectedItem(int position, boolean fromSpinner) {
+ if (fromSpinner && position == mSelectedPosition) {
+ return;
+ }
final Object value = mValues.get(position);
if (mCallback != null && !mCallback.onItemSelected(position, value)) {
return;
}
mSpinner.setSelection(position);
+ mSelectedPosition = mSpinner.getSelectedItemPosition();
setSummary(mAdapter.getItem(position));
final boolean disableDependents = value == null;
notifyDependencyChange(disableDependents);
diff --git a/src/com/android/settings/InstrumentedFragment.java b/src/com/android/settings/InstrumentedFragment.java
index 2fe631d..b6f0e44 100644
--- a/src/com/android/settings/InstrumentedFragment.java
+++ b/src/com/android/settings/InstrumentedFragment.java
@@ -28,6 +28,7 @@
public static final int APPLICATIONS_MANAGE_ASSIST = UNDECLARED + 1;
public static final int PROCESS_STATS_SUMMARY = UNDECLARED + 2;
+ public static final int ACTION_ROTATION_LOCK = UNDECLARED + 3;
/**
* Declare the view of this category.
diff --git a/src/com/android/settings/fingerprint/FingerprintEnrollSidecar.java b/src/com/android/settings/fingerprint/FingerprintEnrollSidecar.java
index 2daffde..fa65afe 100644
--- a/src/com/android/settings/fingerprint/FingerprintEnrollSidecar.java
+++ b/src/com/android/settings/fingerprint/FingerprintEnrollSidecar.java
@@ -78,7 +78,7 @@
mEnrollmentSteps = -1;
mEnrollmentCancel = new CancellationSignal();
getActivity().getSystemService(FingerprintManager.class).enroll(mToken, mEnrollmentCancel,
- mEnrollmentCallback, 0);
+ 0 /* flags */, mEnrollmentCallback);
mEnrolling = true;
}
diff --git a/src/com/android/settings/fingerprint/FingerprintSettings.java b/src/com/android/settings/fingerprint/FingerprintSettings.java
index a0ccb24..5cbab66 100644
--- a/src/com/android/settings/fingerprint/FingerprintSettings.java
+++ b/src/com/android/settings/fingerprint/FingerprintSettings.java
@@ -117,6 +117,8 @@
private static final int MSG_REFRESH_FINGERPRINT_TEMPLATES = 1000;
private static final int MSG_FINGER_AUTH_SUCCESS = 1001;
private static final int MSG_FINGER_AUTH_FAIL = 1002;
+ private static final int MSG_FINGER_AUTH_ERROR = 1003;
+ private static final int MSG_FINGER_AUTH_HELP = 1004;
private static final int CONFIRM_REQUEST = 101;
private static final int CHOOSE_LOCK_GENERIC_REQUEST = 102;
@@ -146,22 +148,14 @@
@Override
public void onAuthenticationError(int errMsgId, CharSequence errString) {
- // get activity will be null on a screen rotation
- final Activity activity = getActivity();
- if (activity != null) {
- Toast.makeText(activity, errString, Toast.LENGTH_SHORT);
- }
- if (errMsgId != FingerprintManager.FINGERPRINT_ERROR_CANCELED) {
- retryFingerprint(false);
- }
+ mHandler.obtainMessage(MSG_FINGER_AUTH_ERROR, errMsgId, 0, errString)
+ .sendToTarget();
}
@Override
public void onAuthenticationHelp(int helpMsgId, CharSequence helpString) {
- final Activity activity = getActivity();
- if (activity != null) {
- Toast.makeText(activity, helpString, Toast.LENGTH_SHORT);
- }
+ mHandler.obtainMessage(MSG_FINGER_AUTH_HELP, helpMsgId, 0, helpString)
+ .sendToTarget();
}
};
private RemovalCallback mRemoveCallback = new RemovalCallback() {
@@ -187,12 +181,36 @@
removeFingerprintPreference(msg.arg1);
break;
case MSG_FINGER_AUTH_SUCCESS:
+ mFingerprintCancel = null;
highlightFingerprintItem(msg.arg1);
retryFingerprint(true);
break;
case MSG_FINGER_AUTH_FAIL:
+ mFingerprintCancel = null;
retryFingerprint(true);
break;
+ case MSG_FINGER_AUTH_ERROR: {
+ mFingerprintCancel = null;
+ // get activity will be null on a screen rotation
+ final Activity activity = getActivity();
+ if (activity != null) {
+ CharSequence errString = (CharSequence) msg.obj;
+ Toast.makeText(activity, errString , Toast.LENGTH_SHORT);
+ }
+ final int errMsgId = msg.arg1;
+ if (errMsgId != FingerprintManager.FINGERPRINT_ERROR_CANCELED) {
+ retryFingerprint(false);
+ }
+ }
+ break;
+ case MSG_FINGER_AUTH_HELP: {
+ final Activity activity = getActivity();
+ if (activity != null) {
+ CharSequence helpString = (CharSequence) msg.obj;
+ Toast.makeText(activity, helpString , Toast.LENGTH_SHORT);
+ }
+ }
+ break;
}
};
};
@@ -208,9 +226,10 @@
if (resetAttempts) {
mMaxFingerprintAttempts = 0;
}
- if (mMaxFingerprintAttempts < MAX_RETRY_ATTEMPTS) {
+ if (mMaxFingerprintAttempts < MAX_RETRY_ATTEMPTS && mFingerprintCancel == null) {
mFingerprintCancel = new CancellationSignal();
- mFingerprintManager.authenticate(null, mFingerprintCancel, mAuthCallback, 0);
+ mFingerprintManager.authenticate(null, mFingerprintCancel, 0 /* flags */,
+ mAuthCallback, null);
}
mMaxFingerprintAttempts++;
}
@@ -351,7 +370,6 @@
intent.setClassName("com.android.settings",
FingerprintEnrollEnrolling.class.getName());
intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE_TOKEN, mToken);
- stopFingerprint();
startActivityForResult(intent, ADD_FINGERPRINT_REQUEST);
} else if (pref instanceof FingerprintPreference) {
FingerprintPreference fpref = (FingerprintPreference) pref;
diff --git a/src/com/android/settings/fingerprint/FingerprintUiHelper.java b/src/com/android/settings/fingerprint/FingerprintUiHelper.java
index 6ae76aa..10c0fe6 100644
--- a/src/com/android/settings/fingerprint/FingerprintUiHelper.java
+++ b/src/com/android/settings/fingerprint/FingerprintUiHelper.java
@@ -51,7 +51,7 @@
public void startListening() {
if (mFingerprintManager.getEnrolledFingerprints().size() > 0) {
mCancellationSignal = new CancellationSignal();
- mFingerprintManager.authenticate(null, mCancellationSignal, this, 0 /* flags */);
+ mFingerprintManager.authenticate(null, mCancellationSignal, 0 /* flags */, this, null);
setFingerprintIconVisibility(true);
mIcon.setImageResource(R.drawable.ic_fingerprint);
}
diff --git a/src/com/android/settings/notification/ManagedServiceSettings.java b/src/com/android/settings/notification/ManagedServiceSettings.java
index 660ea5a..e9ff428 100644
--- a/src/com/android/settings/notification/ManagedServiceSettings.java
+++ b/src/com/android/settings/notification/ManagedServiceSettings.java
@@ -160,13 +160,13 @@
.setMessage(summary)
.setTitle(title)
.setCancelable(true)
- .setPositiveButton(android.R.string.ok,
+ .setPositiveButton(R.string.allow,
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
mServiceListing.setEnabled(cn, true);
}
})
- .setNegativeButton(android.R.string.cancel,
+ .setNegativeButton(R.string.deny,
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
// pass