diff --git a/res/values/strings.xml b/res/values/strings.xml index c711eafc9f2..bf064a53312 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -765,8 +765,12 @@ Unlock with fingerprint + + Use your fingerprint Just touch the fingerprint sensor to unlock your phone, authorize purchases, or sign in to apps. Be careful whose fingerprints you add. Even one added print can do any of these things.\n\nNote: Your fingerprint may be less secure than a strong pattern or PIN. + + Just touch the fingerprint sensor to authorize purchases, or sign in to apps. Be careful whose fingerprints you add. Even one added print can do any of these things.\n\nNote: You can\u2019t use your fingerprint to unlock this device. For more information, contact your organization\u2019s admin. Just touch the fingerprint sensor to unlock your phone, authorize purchases, or sign in to apps. Be careful whose fingerprints you add. Even one added print can do any of these things.\n\nNote: Your fingerprint may be less secure than a strong pattern or PIN. diff --git a/res/xml/billing_cycle.xml b/res/xml/billing_cycle.xml index 9beebce6872..8c77ad624ee 100644 --- a/res/xml/billing_cycle.xml +++ b/res/xml/billing_cycle.xml @@ -21,6 +21,10 @@ android:key="billing_cycle" android:title="@string/billing_cycle" /> + + diff --git a/src/com/android/settings/SummaryPreference.java b/src/com/android/settings/SummaryPreference.java index 38449b1e03f..d129661c02c 100644 --- a/src/com/android/settings/SummaryPreference.java +++ b/src/com/android/settings/SummaryPreference.java @@ -34,6 +34,7 @@ public class SummaryPreference extends Preference { private int mLeft, mMiddle, mRight; private boolean mColorsSet = false; + private boolean mChartEnabled = true; private float mLeftRatio, mMiddleRatio, mRightRatio; private String mStartLabel; private String mEndLabel; @@ -43,6 +44,13 @@ public class SummaryPreference extends Preference { setLayoutResource(R.layout.settings_summary_preference); } + public void setChartEnabled(boolean enabled) { + if (mChartEnabled != enabled) { + mChartEnabled = enabled; + notifyChanged(); + } + } + public void setAmount(String amount) { mAmount = amount; if (mAmount != null && mUnits != null) { @@ -85,12 +93,18 @@ public class SummaryPreference extends Preference { super.onBindViewHolder(holder); LinearColorBar colorBar = (LinearColorBar) holder.itemView.findViewById(R.id.color_bar); - colorBar.setRatios(mLeftRatio, mMiddleRatio, mRightRatio); - if (mColorsSet) { - colorBar.setColors(mLeft, mMiddle, mRight); + + if (mChartEnabled) { + colorBar.setVisibility(View.VISIBLE); + colorBar.setRatios(mLeftRatio, mMiddleRatio, mRightRatio); + if (mColorsSet) { + colorBar.setColors(mLeft, mMiddle, mRight); + } + } else { + colorBar.setVisibility(View.GONE); } - if (!TextUtils.isEmpty(mStartLabel) || !TextUtils.isEmpty(mEndLabel)) { + if (mChartEnabled && (!TextUtils.isEmpty(mStartLabel) || !TextUtils.isEmpty(mEndLabel))) { holder.findViewById(R.id.label_bar).setVisibility(View.VISIBLE); ((TextView) holder.findViewById(android.R.id.text1)).setText(mStartLabel); ((TextView) holder.findViewById(android.R.id.text2)).setText(mEndLabel); diff --git a/src/com/android/settings/datausage/BillingCycleSettings.java b/src/com/android/settings/datausage/BillingCycleSettings.java index c26efee2d19..7665bf44b87 100644 --- a/src/com/android/settings/datausage/BillingCycleSettings.java +++ b/src/com/android/settings/datausage/BillingCycleSettings.java @@ -34,6 +34,7 @@ import android.view.View; import android.widget.EditText; import android.widget.NumberPicker; import android.widget.Spinner; + import com.android.internal.logging.MetricsProto.MetricsEvent; import com.android.settings.R; import com.android.settingslib.NetworkPolicyEditor; @@ -56,6 +57,7 @@ public class BillingCycleSettings extends DataUsageBase implements private static final String TAG_WARNING_EDITOR = "warningEditor"; private static final String KEY_BILLING_CYCLE = "billing_cycle"; + private static final String KEY_SET_DATA_WARNING = "set_data_warning"; private static final String KEY_DATA_WARNING = "data_warning"; private static final String KEY_SET_DATA_LIMIT = "set_data_limit"; private static final String KEY_DATA_LIMIT = "data_limit"; @@ -63,6 +65,7 @@ public class BillingCycleSettings extends DataUsageBase implements private NetworkTemplate mNetworkTemplate; private Preference mBillingCycle; private Preference mDataWarning; + private SwitchPreference mEnableDataWarning; private SwitchPreference mEnableDataLimit; private Preference mDataLimit; private DataUsageController mDataUsageController; @@ -78,6 +81,8 @@ public class BillingCycleSettings extends DataUsageBase implements addPreferencesFromResource(R.xml.billing_cycle); mBillingCycle = findPreference(KEY_BILLING_CYCLE); + mEnableDataWarning = (SwitchPreference) findPreference(KEY_SET_DATA_WARNING); + mEnableDataWarning.setOnPreferenceChangeListener(this); mDataWarning = findPreference(KEY_DATA_WARNING); mEnableDataLimit = (SwitchPreference) findPreference(KEY_SET_DATA_LIMIT); mEnableDataLimit.setOnPreferenceChangeListener(this); @@ -94,10 +99,15 @@ public class BillingCycleSettings extends DataUsageBase implements NetworkPolicy policy = services.mPolicyEditor.getPolicy(mNetworkTemplate); mBillingCycle.setSummary(getString(R.string.billing_cycle_summary, policy != null ? policy.cycleDay : 1)); - mDataWarning.setSummary(Formatter.formatFileSize(getContext(), - policy != null - ? policy.warningBytes - : mDataUsageController.getDefaultWarningLevel())); + if (policy != null && policy.warningBytes != WARNING_DISABLED) { + mDataWarning.setSummary(Formatter.formatFileSize(getContext(), policy.warningBytes)); + mDataWarning.setEnabled(true); + mEnableDataWarning.setChecked(true); + } else { + mDataWarning.setSummary(null); + mDataWarning.setEnabled(false); + mEnableDataWarning.setChecked(false); + } if (policy != null && policy.limitBytes != LIMIT_DISABLED) { mDataLimit.setSummary(Formatter.formatFileSize(getContext(), policy.limitBytes)); mDataLimit.setEnabled(true); @@ -134,6 +144,14 @@ public class BillingCycleSettings extends DataUsageBase implements setPolicyLimitBytes(LIMIT_DISABLED); } return true; + } else if (mEnableDataWarning == preference) { + boolean enabled = (Boolean) newValue; + if (enabled) { + setPolicyWarningBytes(mDataUsageController.getDefaultWarningLevel()); + } else { + setPolicyWarningBytes(WARNING_DISABLED); + } + return true; } return false; } @@ -149,6 +167,12 @@ public class BillingCycleSettings extends DataUsageBase implements updatePrefs(); } + private void setPolicyWarningBytes(long warningBytes) { + if (LOGD) Log.d(TAG, "setPolicyWarningBytes()"); + services.mPolicyEditor.setPolicyWarningBytes(mNetworkTemplate, warningBytes); + updatePrefs(); + } + @Override public NetworkPolicyEditor getNetworkPolicyEditor() { return services.mPolicyEditor; diff --git a/src/com/android/settings/datausage/DataUsageSummary.java b/src/com/android/settings/datausage/DataUsageSummary.java index 864ae95ffca..e284bed351e 100644 --- a/src/com/android/settings/datausage/DataUsageSummary.java +++ b/src/com/android/settings/datausage/DataUsageSummary.java @@ -234,16 +234,24 @@ public class DataUsageSummary extends DataUsageBase implements Indexable, DataUs formatTitle(context, getString(mDataUsageTemplate), info.usageLevel)); long limit = mDataInfoController.getSummaryLimit(info); mSummaryPreference.setSummary(info.period); - mSummaryPreference.setLabels(Formatter.formatFileSize(context, 0), - Formatter.formatFileSize(context, limit)); - mSummaryPreference.setRatios(info.usageLevel / (float) limit, 0, - (limit - info.usageLevel) / (float) limit); + + if (limit <= 0) { + mSummaryPreference.setChartEnabled(false); + } else { + mSummaryPreference.setChartEnabled(true); + mSummaryPreference.setLabels(Formatter.formatFileSize(context, 0), + Formatter.formatFileSize(context, limit)); + mSummaryPreference.setRatios(info.usageLevel / (float) limit, 0, + (limit - info.usageLevel) / (float) limit); + } } - if (mLimitPreference != null) { + if (mLimitPreference != null && (info.warningLevel > 0 || info.limitLevel > 0)) { String warning = Formatter.formatFileSize(context, info.warningLevel); String limit = Formatter.formatFileSize(context, info.limitLevel); mLimitPreference.setSummary(getString(info.limitLevel <= 0 ? R.string.cell_warning_only : R.string.cell_warning_and_limit, warning, limit)); + } else if (mLimitPreference != null) { + mLimitPreference.setSummary(null); } PreferenceScreen screen = getPreferenceScreen(); diff --git a/src/com/android/settings/fingerprint/FingerprintEnrollIntroduction.java b/src/com/android/settings/fingerprint/FingerprintEnrollIntroduction.java index 40b4b87fa0b..b5be4b61788 100644 --- a/src/com/android/settings/fingerprint/FingerprintEnrollIntroduction.java +++ b/src/com/android/settings/fingerprint/FingerprintEnrollIntroduction.java @@ -26,12 +26,14 @@ import android.os.UserManager; import android.util.Log; import android.view.View; import android.widget.Button; +import android.widget.TextView; import com.android.internal.logging.MetricsProto.MetricsEvent; import com.android.settings.ChooseLockGeneric; import com.android.settings.ChooseLockSettingsHelper; import com.android.settings.R; import com.android.settingslib.HelpUtils; +import com.android.settingslib.RestrictedLockUtils; import com.android.setupwizardlib.span.LinkSpan; /** @@ -48,12 +50,21 @@ public class FingerprintEnrollIntroduction extends FingerprintEnrollBase private UserManager mUserManager; private boolean mHasPassword; + private boolean mFingerprintUnlockDisabledByAdmin; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + mFingerprintUnlockDisabledByAdmin = RestrictedLockUtils.checkIfKeyguardFeaturesDisabled( + this, DevicePolicyManager.KEYGUARD_DISABLE_FINGERPRINT, mUserId) != null; + setContentView(R.layout.fingerprint_enroll_introduction); - setHeaderText(R.string.security_settings_fingerprint_enroll_introduction_title); + if (mFingerprintUnlockDisabledByAdmin) { + setHeaderText(R.string + .security_settings_fingerprint_enroll_introduction_title_unlock_disabled); + } else { + setHeaderText(R.string.security_settings_fingerprint_enroll_introduction_title); + } final Button cancelButton = (Button) findViewById(R.id.fingerprint_cancel_button); cancelButton.setOnClickListener(this); @@ -160,6 +171,17 @@ public class FingerprintEnrollIntroduction extends FingerprintEnrollBase finish(); } + @Override + protected void initViews() { + super.initViews(); + + TextView description = (TextView) findViewById(R.id.description_text); + if (mFingerprintUnlockDisabledByAdmin) { + description.setText(R.string + .security_settings_fingerprint_enroll_introduction_message_unlock_disabled); + } + } + @Override public void onClick(LinkSpan span) { if ("url".equals(span.getId())) {