OSDN Git Service

Show approprate text when enrolling fingerprint
authorRubin Xu <rubinxu@google.com>
Thu, 1 Sep 2016 14:03:51 +0000 (15:03 +0100)
committerRubin Xu <rubinxu@google.com>
Wed, 14 Sep 2016 12:53:03 +0000 (13:53 +0100)
Inform the user that unlocking device by fingerprint is disabled if the
device admin has disallowed it.

Bug: 27201226
Change-Id: Id1694f07a9421ebfe3c777f2a6b624a836bff2d5

res/values/strings.xml
src/com/android/settings/fingerprint/FingerprintEnrollIntroduction.java

index 61f370b..633c111 100644 (file)
     <string name="security_settings_fingerprint_preference_summary_none"></string>
     <!-- Introduction title shown in fingerprint enrollment to introduce the fingerprint feature[CHAR LIMIT=29] -->
     <string name="security_settings_fingerprint_enroll_introduction_title">Unlock with fingerprint</string>
+    <!-- Introduction title shown in fingerprint enrollment to introduce the fingerprint feature, when fingerprint unlock is disabed by device admin [CHAR LIMIT=29] -->
+    <string name="security_settings_fingerprint_enroll_introduction_title_unlock_disabled">Use your fingerprint</string>
     <!-- Introduction detail message shown in fingerprint enrollment dialog [CHAR LIMIT=NONE]-->
     <string name="security_settings_fingerprint_enroll_introduction_message">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.</string>
+    <!-- Introduction detail message shown in fingerprint enrollment dialog, when fingerprint unlock is disabled by device admin [CHAR LIMIT=NONE]-->
+    <string name="security_settings_fingerprint_enroll_introduction_message_unlock_disabled">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.</string>
     <!-- Introduction detail message shown in fingerprint enrollment screen in setup wizard. [CHAR LIMIT=NONE]-->
     <string name="security_settings_fingerprint_enroll_introduction_message_setup">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.</string>
     <!-- Button text to cancel enrollment from the introduction [CHAR LIMIT=22] -->
index 23755fd..627cb78 100644 (file)
@@ -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);
@@ -161,6 +172,17 @@ public class FingerprintEnrollIntroduction extends FingerprintEnrollBase
     }
 
     @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())) {
             String url = getString(R.string.help_url_fingerprint);