OSDN Git Service

Merge "Add accessibility actions to the drag-and-drop locale list" into nyc-dev
authorMihai Niță <mnita@google.com>
Fri, 22 Apr 2016 14:40:44 +0000 (14:40 +0000)
committerAndroid (Google) Code Review <android-gerrit@google.com>
Fri, 22 Apr 2016 14:40:44 +0000 (14:40 +0000)
res/layout/confirm_lock_password_base.xml
res/layout/confirm_lock_pattern_base.xml
res/values/strings.xml
res/values/styles.xml
src/com/android/settings/ConfirmDeviceCredentialBaseFragment.java
src/com/android/settings/ConfirmLockPassword.java
src/com/android/settings/ConfirmLockPattern.java
src/com/android/settings/TrustedCredentialsDialogBuilder.java
src/com/android/settings/fingerprint/SetupFingerprintEnrollIntroduction.java
src/com/android/settings/vpn2/AppManagementFragment.java

index 536617d..8e9a87b 100644 (file)
             android:layout_marginEnd="16dp"
             android:layout_marginTop="16dp"/>
 
-        <TextView
-            android:id="@+id/strongAuthRequiredText"
-            style="@style/TextAppearance.ConfirmDeviceCredentialsStrongAuthRequiredText"
-            android:layout_width="match_parent"
-            android:layout_height="0dp"
-            android:layout_weight="1"
-            android:singleLine="true"
-            android:ellipsize="marquee"
-            android:gravity="center"/>
+        <View android:layout_width="match_parent"
+              android:layout_height="0dp"
+              android:layout_weight="1"/>
 
         <EditText
             android:id="@+id/password_entry"
index 117c499..7c960a2 100644 (file)
             android:layout_marginEnd="16dp"
             android:layout_marginTop="16dp"/>
 
-        <TextView
-            android:id="@+id/strongAuthRequiredText"
-            style="@style/TextAppearance.ConfirmDeviceCredentialsStrongAuthRequiredText"
-            android:layout_width="match_parent"
-            android:layout_height="0dp"
-            android:layout_weight="0.5"
-            android:singleLine="true"
-            android:ellipsize="marquee"
-            android:gravity="center"/>
+        <View android:layout_width="match_parent"
+              android:layout_height="0dp"
+              android:layout_weight="0.5"/>
 
         <com.android.internal.widget.LockPatternView
             android:id="@+id/lockPattern"
index 535c48a..8d0a75a 100644 (file)
     <string name="security_settings_fingerprint_enroll_introduction_cancel">Cancel</string>
     <!-- Button text to continue to the next screen from the introduction [CHAR LIMIT=22] -->
     <string name="security_settings_fingerprint_enroll_introduction_continue">Continue</string>
+    <!-- Button text to cancel enrollment from the introduction (this string variant is used while in setup wizard) [CHAR LIMIT=22] -->
+    <string name="security_settings_fingerprint_enroll_introduction_cancel_setup">Skip</string>
+    <!-- Button text to continue to the next screen from the introduction (this string variant is used while in setup wizard) [CHAR LIMIT=22] -->
+    <string name="security_settings_fingerprint_enroll_introduction_continue_setup">Add fingerprint</string>
     <!-- Dialog text shown when the user tries to skip setting up a screen lock, warning them of potential consequences of not doing so, including loss of factory reset protection. (tablet) [CHAR LIMIT=NONE] -->
     <string name="lock_screen_intro_skip_dialog_text_frp" product="tablet">Device protection features will not be activated. You won\u2019t be able to prevent others from using this tablet if it\u2019s lost, stolen or wiped.</string>
     <!-- Dialog text shown when the user tries to skip setting up a screen lock, warning them of potential consequences of not doing so, including loss of factory reset protection. (device) [CHAR LIMIT=NONE] -->
     <!-- Message to be used to explain the user that he needs to enter his work password to continue a
          particular operation. [CHAR LIMIT=70]-->
     <string name="lockpassword_confirm_your_password_generic_profile">Enter your work password to continue</string>
+
     <!-- An explanation text that the pattern needs to be solved since the device has just been restarted. [CHAR LIMIT=80] -->
-    <string name="lockpassword_strong_auth_required_reason_restart_pattern">Pattern required after device restarts</string>
+    <string name="lockpassword_strong_auth_required_reason_restart_device_pattern">Use your device pattern to continue. It\'s required after the device restarts.</string>
     <!-- An explanation text that the pin needs to be entered since the device has just been restarted. [CHAR LIMIT=80] -->
-    <string name="lockpassword_strong_auth_required_reason_restart_pin">PIN required after device restarts</string>
+    <string name="lockpassword_strong_auth_required_reason_restart_device_pin">Enter your device PIN to continue. It\'s required after the device restarts.</string>
+    <!-- An explanation text that the password needs to be entered since the device has just been restarted. [CHAR LIMIT=80] -->
+    <string name="lockpassword_strong_auth_required_reason_restart_device_password">Enter your device password to continue. It\'s required after the device restarts.</string>
 
+    <!-- An explanation text that the pattern needs to be solved since the device has just been restarted. [CHAR LIMIT=80] -->
+    <string name="lockpassword_strong_auth_required_reason_restart_work_pattern">Use your work pattern to continue. It\'s required after the device restarts.</string>
+    <!-- An explanation text that the pin needs to be entered since the device has just been restarted. [CHAR LIMIT=80] -->
+    <string name="lockpassword_strong_auth_required_reason_restart_work_pin">Enter your work PIN to continue. It\'s required after the device restarts.</string>
     <!-- An explanation text that the password needs to be entered since the device has just been restarted. [CHAR LIMIT=80] -->
-    <string name="lockpassword_strong_auth_required_reason_restart_password">Password required after device restarts</string>
+    <string name="lockpassword_strong_auth_required_reason_restart_work_password">Enter your work password to continue. It\'s required after the device restarts.</string>
 
     <!-- Security & location settings screen, change security method screen instruction if user
          enters incorrect PIN [CHAR LIMIT=30] -->
     <string name="vpn_save">Save</string>
     <!-- Button label to connect to a VPN profile. [CHAR LIMIT=40] -->
     <string name="vpn_connect">Connect</string>
-    <!-- Button label to continue changing a VPN profile. [CHAR LIMIT=40] -->
-    <string name="vpn_continue">Continue</string>
+    <!-- Button label to connect a VPN profile, replacing the current one. [CHAR LIMIT=40] -->
+    <string name="vpn_replace">Replace</string>
     <!-- Dialog title to edit a VPN profile. [CHAR LIMIT=40] -->
     <string name="vpn_edit">Edit VPN profile</string>
     <!-- Button label to forget a VPN profile. [CHAR LIMIT=40] -->
     <!-- Dialog message title to set another VPN app to be always-on [CHAR LIMIT=40] -->
     <string name="vpn_replace_always_on_vpn_title">Replace existing VPN?</string>
     <!-- Dialog message body to set another VPN app to be always-on [CHAR LIMIT=NONE] -->
-    <string name="vpn_replace_always_on_vpn_message">You already have a VPN connected to this profile. If you connected to one, your existing VPN will be replaced.</string>
+    <string name="vpn_replace_always_on_vpn_message">You\'re already connected to a VPN. If you connect to a different one, your existing VPN will be replaced.</string>
     <!-- Notification title when the user can't connect an always-on vpn [CHAR LIMIT=NONE] -->
     <string name="vpn_cant_connect_notification_title"><xliff:g id="vpn_name" example="OpenVPN">%1$s</xliff:g> can\'t connect</string>
     <!-- Notification subtitle when the user can't connect an always-on vpn [CHAR LIMIT=NONE] -->
index 0eb566c..45d2c11 100644 (file)
         <item name="android:textColor">@color/warning</item>
     </style>
 
-    <style name="TextAppearance.ConfirmDeviceCredentialsStrongAuthRequiredText"
-        parent="android:TextAppearance.Material.Body1">
-        <item name="android:textColor">?android:attr/textColorSecondary</item>
-    </style>
-
     <style name="TextAppearance.Small.SwitchBar">
         <item name="android:textColor">?android:attr/textColorPrimary</item>
         <item name="android:textStyle">normal</item>
index 0572bcf..ae321e8 100644 (file)
@@ -66,7 +66,7 @@ public abstract class ConfirmDeviceCredentialBaseFragment extends OptionsMenuFra
             PACKAGE + ".ConfirmCredentials.showWhenLocked";
 
     private FingerprintUiHelper mFingerprintHelper;
-    private boolean mIsStrongAuthRequired;
+    protected boolean mIsStrongAuthRequired;
     private boolean mAllowFpAuthentication;
     protected Button mCancelButton;
     protected ImageView mFingerprintIcon;
@@ -74,7 +74,6 @@ public abstract class ConfirmDeviceCredentialBaseFragment extends OptionsMenuFra
     protected int mUserId;
     protected LockPatternUtils mLockPatternUtils;
     protected TextView mErrorTextView;
-    protected TextView mStrongAuthRequiredTextView;
     protected final Handler mHandler = new Handler();
 
     @Override
@@ -97,11 +96,6 @@ public abstract class ConfirmDeviceCredentialBaseFragment extends OptionsMenuFra
     public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
         super.onViewCreated(view, savedInstanceState);
         mCancelButton = (Button) view.findViewById(R.id.cancelButton);
-        if (mStrongAuthRequiredTextView != null) {
-            // INIVISIBLE instead of GONE because it also acts as a weighted spacer
-            mStrongAuthRequiredTextView.setVisibility(
-                    mIsStrongAuthRequired ? View.VISIBLE : View.INVISIBLE);
-        }
         mFingerprintIcon = (ImageView) view.findViewById(R.id.fingerprintIcon);
         mFingerprintHelper = new FingerprintUiHelper(
                 mFingerprintIcon,
index a1bc3dd..61cf2ae 100644 (file)
@@ -50,6 +50,18 @@ import java.util.ArrayList;
 
 public class ConfirmLockPassword extends ConfirmDeviceCredentialBaseActivity {
 
+    // The index of the array is isStrongAuth << 2 + isProfile << 1 + isAlpha.
+    private static final int[] DETAIL_TEXTS = new int[] {
+        R.string.lockpassword_confirm_your_pin_generic,
+        R.string.lockpassword_confirm_your_password_generic,
+        R.string.lockpassword_confirm_your_pin_generic_profile,
+        R.string.lockpassword_confirm_your_password_generic_profile,
+        R.string.lockpassword_strong_auth_required_reason_restart_device_pin,
+        R.string.lockpassword_strong_auth_required_reason_restart_device_password,
+        R.string.lockpassword_strong_auth_required_reason_restart_work_pin,
+        R.string.lockpassword_strong_auth_required_reason_restart_work_password,
+    };
+
     public static class InternalActivity extends ConfirmLockPassword {
     }
 
@@ -124,18 +136,6 @@ public class ConfirmLockPassword extends ConfirmDeviceCredentialBaseActivity {
                     || DevicePolicyManager.PASSWORD_QUALITY_COMPLEX == storedQuality
                     || DevicePolicyManager.PASSWORD_QUALITY_MANAGED == storedQuality;
 
-            // Strong auth is required when the user is locked.
-            // Currently a user does not get locked again until the device restarts. Show the
-            // hint text as "device has just been restarted".
-            mStrongAuthRequiredTextView = (TextView) view.findViewById(R.id.strongAuthRequiredText);
-            if (mIsAlpha) {
-                mStrongAuthRequiredTextView.setText(
-                        R.string.lockpassword_strong_auth_required_reason_restart_password);
-            } else {
-                mStrongAuthRequiredTextView.setText(
-                        R.string.lockpassword_strong_auth_required_reason_restart_pin);
-            }
-
             mImm = (InputMethodManager) getActivity().getSystemService(
                     Context.INPUT_METHOD_SERVICE);
 
@@ -186,13 +186,10 @@ public class ConfirmLockPassword extends ConfirmDeviceCredentialBaseActivity {
         private int getDefaultDetails() {
             boolean isProfile = Utils.isManagedProfile(
                     UserManager.get(getActivity()), mEffectiveUserId);
-            if (mIsAlpha) {
-                return isProfile ? R.string.lockpassword_confirm_your_password_generic_profile
-                        : R.string.lockpassword_confirm_your_password_generic;
-            } else {
-                return isProfile ? R.string.lockpassword_confirm_your_pin_generic_profile
-                        : R.string.lockpassword_confirm_your_pin_generic;
-            }
+            // Map boolean flags to an index by isStrongAuth << 2 + isProfile << 1 + isAlpha.
+            int index = ((mIsStrongAuthRequired ? 1 : 0) << 2) + ((isProfile ? 1 : 0 ) << 1)
+                    + (mIsAlpha ? 1 : 0);
+            return DETAIL_TEXTS[index];
         }
 
         private int getErrorMessage() {
index 875fcb7..262cdc8 100644 (file)
@@ -118,7 +118,6 @@ public class ConfirmLockPattern extends ConfirmDeviceCredentialBaseActivity {
             mHeaderTextView = (TextView) view.findViewById(R.id.headerText);
             mLockPatternView = (LockPatternView) view.findViewById(R.id.lockPattern);
             mDetailsTextView = (TextView) view.findViewById(R.id.detailsText);
-            mStrongAuthRequiredTextView = (TextView) view.findViewById(R.id.strongAuthRequiredText);
             mErrorTextView = (TextView) view.findViewById(R.id.errorText);
             mLeftSpacerLandscape = view.findViewById(R.id.leftSpacer);
             mRightSpacerLandscape = view.findViewById(R.id.rightSpacer);
@@ -176,13 +175,6 @@ public class ConfirmLockPattern extends ConfirmDeviceCredentialBaseActivity {
                 getFragmentManager().beginTransaction().add(mCredentialCheckResultTracker,
                         FRAGMENT_TAG_CHECK_LOCK_RESULT).commit();
             }
-
-            // Strong auth is required when the user is locked.
-            // Currently a user does not get locked again until the device restarts. Show the
-            // hint text as "device has just been restarted".
-            mStrongAuthRequiredTextView.setText(
-                    R.string.lockpassword_strong_auth_required_reason_restart_pattern);
-
             return view;
         }
 
@@ -237,6 +229,20 @@ public class ConfirmLockPattern extends ConfirmDeviceCredentialBaseActivity {
             mFingerprintIcon.setAlpha(0f);
         }
 
+        private int getDefaultDetails() {
+            boolean isProfile = Utils.isManagedProfile(
+                    UserManager.get(getActivity()), mEffectiveUserId);
+            if (isProfile) {
+                return mIsStrongAuthRequired
+                        ? R.string.lockpassword_strong_auth_required_reason_restart_work_pattern
+                        : R.string.lockpassword_confirm_your_pattern_generic_profile;
+            } else {
+                return mIsStrongAuthRequired
+                        ? R.string.lockpassword_strong_auth_required_reason_restart_device_pattern
+                        : R.string.lockpassword_confirm_your_pattern_generic;
+            }
+        }
+
         private Object[][] getActiveViews() {
             ArrayList<ArrayList<Object>> result = new ArrayList<>();
             result.add(new ArrayList<Object>(Collections.singletonList(mHeaderTextView)));
@@ -282,13 +288,8 @@ public class ConfirmLockPattern extends ConfirmDeviceCredentialBaseActivity {
                     }
                     if (mDetailsText != null) {
                         mDetailsTextView.setText(mDetailsText);
-                    } else if (!Utils.isManagedProfile(
-                            UserManager.get(getActivity()), mEffectiveUserId)) {
-                        mDetailsTextView.setText(
-                                R.string.lockpassword_confirm_your_pattern_generic);
                     } else {
-                        mDetailsTextView.setText(
-                                R.string.lockpassword_confirm_your_pattern_generic_profile);
+                        mDetailsTextView.setText(getDefaultDetails());
                     }
                     mErrorTextView.setText("");
                     if (isProfileChallenge()) {
index 22dc936..ed2ab09 100644 (file)
@@ -20,6 +20,7 @@ import android.app.Activity;
 import android.app.AlertDialog;
 import android.app.admin.DevicePolicyManager;
 import android.content.DialogInterface;
+import android.content.pm.UserInfo;
 import android.net.http.SslCertificate;
 import android.os.UserHandle;
 import android.os.UserManager;
@@ -31,6 +32,7 @@ import android.widget.Button;
 import android.widget.LinearLayout;
 import android.widget.Spinner;
 
+import com.android.internal.widget.LockPatternUtils;
 import com.android.settings.TrustedCredentialsSettings.CertHolder;
 
 import java.security.cert.X509Certificate;
@@ -184,10 +186,26 @@ class TrustedCredentialsDialogBuilder extends AlertDialog.Builder {
             updateNegativeButton();
         }
 
+        /**
+         * @return true if current user or parent user is guarded by screenlock
+         */
+        private boolean isUserSecure(int userId) {
+            final LockPatternUtils lockPatternUtils = new LockPatternUtils(mActivity);
+            if (lockPatternUtils.isSecure(userId)) {
+                return true;
+            }
+            UserInfo parentUser = mUserManager.getProfileParent(userId);
+            if (parentUser == null) {
+                return false;
+            }
+            return lockPatternUtils.isSecure(parentUser.id);
+        }
+
         private void updatePositiveButton() {
             final CertHolder certHolder = getCurrentCertInfo();
-            mNeedsApproval = !certHolder.isSystemCert() &&
-                    !mDpm.isCaCertApproved(certHolder.getAlias(), certHolder.getUserId());
+            mNeedsApproval = !certHolder.isSystemCert()
+                    && isUserSecure(certHolder.getUserId())
+                    && !mDpm.isCaCertApproved(certHolder.getAlias(), certHolder.getUserId());
 
             // The ok button is optional. User can still dismiss the dialog by other means.
             // Display it only when trust button is not displayed, because we want users to
index aa1a068..f816682 100644 (file)
@@ -19,8 +19,6 @@ package com.android.settings.fingerprint;
 import android.content.Intent;
 import android.content.res.Resources;
 import android.os.UserHandle;
-import android.support.v14.preference.PreferenceFragment;
-import android.view.View;
 import android.widget.Button;
 
 import com.android.internal.logging.MetricsProto.MetricsEvent;
@@ -29,6 +27,8 @@ import com.android.settings.R;
 import com.android.settings.SetupChooseLockGeneric;
 import com.android.settings.SetupWizardUtils;
 import com.android.setupwizardlib.SetupWizardRecyclerLayout;
+import com.android.setupwizardlib.items.Item;
+import com.android.setupwizardlib.items.RecyclerItemAdapter;
 import com.android.setupwizardlib.view.NavigationBar;
 
 public class SetupFingerprintEnrollIntroduction extends FingerprintEnrollIntroduction
@@ -56,12 +56,22 @@ public class SetupFingerprintEnrollIntroduction extends FingerprintEnrollIntrodu
 
     @Override
     protected void initViews() {
+        final SetupWizardRecyclerLayout layout =
+                (SetupWizardRecyclerLayout) findViewById(R.id.setup_wizard_layout);
+        final RecyclerItemAdapter adapter = (RecyclerItemAdapter) layout.getAdapter();
+        final Item nextItem = (Item) adapter.findItemById(R.id.next_button);
+        nextItem.setTitle(
+                getText(R.string.security_settings_fingerprint_enroll_introduction_continue_setup));
+
+        final Item cancelItem = (Item) adapter.findItemById(R.id.cancel_button);
+        cancelItem.setTitle(
+                getText(R.string.security_settings_fingerprint_enroll_introduction_cancel_setup));
+
         SetupWizardUtils.setImmersiveMode(this);
         getNavigationBar().setNavigationBarListener(this);
         Button nextButton = getNavigationBar().getNextButton();
         nextButton.setText(null);
         nextButton.setEnabled(false);
-        SetupWizardRecyclerLayout layout = (SetupWizardRecyclerLayout) getSetupWizardLayout();
         layout.setDividerInset(getResources().getDimensionPixelSize(
                 R.dimen.suw_items_icon_divider_inset));
     }
index 1a48954..2a12ade 100644 (file)
@@ -300,7 +300,7 @@ public class AppManagementFragment extends SettingsPreferenceFragment
                     .setTitle(R.string.vpn_replace_always_on_vpn_title)
                     .setMessage(getActivity().getString(R.string.vpn_replace_always_on_vpn_message))
                     .setNegativeButton(getActivity().getString(R.string.vpn_cancel), null)
-                    .setPositiveButton(getActivity().getString(R.string.vpn_continue), this)
+                    .setPositiveButton(getActivity().getString(R.string.vpn_replace), this)
                     .create();
         }