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"
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"
<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] -->
<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>
PACKAGE + ".ConfirmCredentials.showWhenLocked";
private FingerprintUiHelper mFingerprintHelper;
- private boolean mIsStrongAuthRequired;
+ protected boolean mIsStrongAuthRequired;
private boolean mAllowFpAuthentication;
protected Button mCancelButton;
protected ImageView mFingerprintIcon;
protected int mUserId;
protected LockPatternUtils mLockPatternUtils;
protected TextView mErrorTextView;
- protected TextView mStrongAuthRequiredTextView;
protected final Handler mHandler = new Handler();
@Override
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,
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 {
}
|| 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);
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() {
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);
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;
}
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)));
}
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()) {
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;
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;
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
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;
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
@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));
}
.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();
}