diff --git a/res/values/strings.xml b/res/values/strings.xml index 89c05ad81ba..95041aadc44 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -812,7 +812,7 @@ In addition to unlocking your phone, you can also use your fingerprint to authorize purchases and app access. Learn more - Screen lock option disabled. You can still use your fingerprint to authorize purchases and app access. Learn more + Screen lock option disabled. Contact your organization\'s administrator to learn more. More details\n\nYou can still use your fingerprint to authorize purchases and app access. Learn more Lift finger, then touch sensor again diff --git a/src/com/android/settings/SettingsPreferenceFragment.java b/src/com/android/settings/SettingsPreferenceFragment.java index cb3c151c351..d2ce2851180 100644 --- a/src/com/android/settings/SettingsPreferenceFragment.java +++ b/src/com/android/settings/SettingsPreferenceFragment.java @@ -62,6 +62,9 @@ public abstract class SettingsPreferenceFragment extends InstrumentedPreferenceF private String mHelpUri; + private static final int ORDER_FIRST = -1; + private static final int ORDER_LAST = Integer.MAX_VALUE -1; + // Cache the content resolver for async callbacks private ContentResolver mContentResolver; @@ -228,7 +231,7 @@ public abstract class SettingsPreferenceFragment extends InstrumentedPreferenceF protected void setHeaderView(int resource) { mHeader = new LayoutPreference(getPrefContext(), resource); - mHeader.setOrder(-1); + mHeader.setOrder(ORDER_FIRST); if (getPreferenceScreen() != null) { getPreferenceScreen().addPreference(mHeader); } @@ -248,7 +251,7 @@ public abstract class SettingsPreferenceFragment extends InstrumentedPreferenceF } if (footer != null) { mFooter = footer; - mFooter.setOrder(Integer.MAX_VALUE); + mFooter.setOrder(ORDER_LAST); if (getPreferenceScreen() != null) { getPreferenceScreen().addPreference(mFooter); } diff --git a/src/com/android/settings/applications/LayoutPreference.java b/src/com/android/settings/applications/LayoutPreference.java index ac1bd3ef072..1b5a8b58c21 100644 --- a/src/com/android/settings/applications/LayoutPreference.java +++ b/src/com/android/settings/applications/LayoutPreference.java @@ -72,6 +72,10 @@ public class LayoutPreference extends Preference { public void onBindViewHolder(PreferenceViewHolder view) { FrameLayout layout = (FrameLayout) view.itemView; layout.removeAllViews(); + ViewGroup parent = (ViewGroup) mRootView.getParent(); + if (parent != null) { + parent.removeView(mRootView); + } layout.addView(mRootView); } diff --git a/src/com/android/settings/fingerprint/FingerprintSettings.java b/src/com/android/settings/fingerprint/FingerprintSettings.java index 56e9b12bd35..6d3cebb2153 100644 --- a/src/com/android/settings/fingerprint/FingerprintSettings.java +++ b/src/com/android/settings/fingerprint/FingerprintSettings.java @@ -64,9 +64,12 @@ import com.android.settings.HelpUtils; import com.android.settings.R; import com.android.settings.SettingsPreferenceFragment; import com.android.settings.SubSettings; +import com.android.settingslib.RestrictedLockUtils; import java.util.List; +import static com.android.settingslib.RestrictedLockUtils.EnforcedAdmin; + /** * Settings screen for fingerprints */ @@ -295,21 +298,16 @@ public class FingerprintSettings extends SubSettings { super.onViewCreated(view, savedInstanceState); TextView v = (TextView) LayoutInflater.from(view.getContext()).inflate( R.layout.fingerprint_settings_footer, null); - v.setText(LearnMoreSpan.linkify(getText(isFingerprintDisabled() + EnforcedAdmin admin = RestrictedLockUtils.checkIfKeyguardFeaturesDisabled( + getActivity(), DevicePolicyManager.KEYGUARD_DISABLE_FINGERPRINT); + v.setText(LearnMoreSpan.linkify(getText(admin != null ? R.string.security_settings_fingerprint_enroll_disclaimer_lockscreen_disabled : R.string.security_settings_fingerprint_enroll_disclaimer), - getString(getHelpResource()))); + getString(getHelpResource()), admin)); v.setMovementMethod(new LinkMovementMethod()); setFooterView(v); } - private boolean isFingerprintDisabled() { - final DevicePolicyManager dpm = - (DevicePolicyManager) getSystemService(Context.DEVICE_POLICY_SERVICE); - return dpm != null && (dpm.getKeyguardDisabledFeatures(null) - & DevicePolicyManager.KEYGUARD_DISABLE_FINGERPRINT) != 0; - } - protected void removeFingerprintPreference(int fingerprintId) { String name = genKey(fingerprintId); Preference prefToRemove = findPreference(name); @@ -336,6 +334,7 @@ public class FingerprintSettings extends SubSettings { addPreferencesFromResource(R.xml.security_settings_fingerprint); root = getPreferenceScreen(); addFingerprintItemPreferences(root); + setPreferenceScreen(root); return root; } @@ -733,19 +732,33 @@ public class FingerprintSettings extends SubSettings { private static final Typeface TYPEFACE_MEDIUM = Typeface.create("sans-serif-medium", Typeface.NORMAL); + private static final String ANNOTATION_URL = "url"; + private static final String ANNOTATION_ADMIN_DETAILS = "admin_details"; + + private EnforcedAdmin mEnforcedAdmin = null; + private LearnMoreSpan(String url) { super(url); } + private LearnMoreSpan(EnforcedAdmin admin) { + super((String) null); + mEnforcedAdmin = admin; + } + @Override public void onClick(View widget) { Context ctx = widget.getContext(); - Intent intent = HelpUtils.getHelpIntent(ctx, getURL(), ctx.getClass().getName()); - try { - ((Activity) ctx).startActivityForResult(intent, 0); - } catch (ActivityNotFoundException e) { - Log.w(FingerprintSettingsFragment.TAG, - "Actvity was not found for intent, " + intent.toString()); + if (mEnforcedAdmin != null) { + RestrictedLockUtils.sendShowAdminSupportDetailsIntent(ctx, mEnforcedAdmin); + } else { + Intent intent = HelpUtils.getHelpIntent(ctx, getURL(), ctx.getClass().getName()); + try { + widget.startActivityForResult(intent, 0); + } catch (ActivityNotFoundException e) { + Log.w(FingerprintSettingsFragment.TAG, + "Actvity was not found for intent, " + intent.toString()); + } } } @@ -756,15 +769,23 @@ public class FingerprintSettings extends SubSettings { ds.setTypeface(TYPEFACE_MEDIUM); } - public static CharSequence linkify(CharSequence rawText, String uri) { + public static CharSequence linkify(CharSequence rawText, String uri, EnforcedAdmin admin) { SpannableString msg = new SpannableString(rawText); Annotation[] spans = msg.getSpans(0, msg.length(), Annotation.class); SpannableStringBuilder builder = new SpannableStringBuilder(msg); for (Annotation annotation : spans) { + final String key = annotation.getValue(); int start = msg.getSpanStart(annotation); int end = msg.getSpanEnd(annotation); - LearnMoreSpan link = new LearnMoreSpan(uri); - builder.setSpan(link, start, end, msg.getSpanFlags(link)); + LearnMoreSpan link = null; + if (ANNOTATION_URL.equals(key)) { + link = new LearnMoreSpan(uri); + } else if (ANNOTATION_ADMIN_DETAILS.equals(key)) { + link = new LearnMoreSpan(admin); + } + if (link != null) { + builder.setSpan(link, start, end, msg.getSpanFlags(link)); + } } return builder; } diff --git a/src/com/android/settings/notification/ConfigureNotificationSettings.java b/src/com/android/settings/notification/ConfigureNotificationSettings.java index 3c49d8218ee..a81bb13c2a7 100644 --- a/src/com/android/settings/notification/ConfigureNotificationSettings.java +++ b/src/com/android/settings/notification/ConfigureNotificationSettings.java @@ -191,7 +191,7 @@ public class ConfigureNotificationSettings extends SettingsPreferenceFragment { private void setRestrictedIfNotificationFeaturesDisabled(CharSequence entry, CharSequence entryValue, int keyguardNotificationFeatures) { - EnforcedAdmin admin = RestrictedLockUtils.checkIfKeyguardNotificationFeaturesDisabled( + EnforcedAdmin admin = RestrictedLockUtils.checkIfKeyguardFeaturesDisabled( mContext, keyguardNotificationFeatures); if (admin != null) { RestrictedItem item = new RestrictedItem(entry, entryValue, admin); diff --git a/src/com/android/settings/notification/RedactionInterstitial.java b/src/com/android/settings/notification/RedactionInterstitial.java index a00f2fa046f..1541dfe9f86 100644 --- a/src/com/android/settings/notification/RedactionInterstitial.java +++ b/src/com/android/settings/notification/RedactionInterstitial.java @@ -110,7 +110,7 @@ public class RedactionInterstitial extends SettingsActivity { private void checkNotificationFeaturesAndSetDisabled(RestrictedRadioButton button, int keyguardNotifications) { - EnforcedAdmin admin = RestrictedLockUtils.checkIfKeyguardNotificationFeaturesDisabled( + EnforcedAdmin admin = RestrictedLockUtils.checkIfKeyguardFeaturesDisabled( getActivity(), keyguardNotifications); button.setDisabledByAdmin(admin); }