Merge "Use GLIF theme for screen lock confirmation"
This commit is contained in:
committed by
Android (Google) Code Review
commit
3fd95ef469
@@ -1572,11 +1572,11 @@
|
|||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<activity android:name="ConfirmLockPattern"
|
<activity android:name="ConfirmLockPattern"
|
||||||
android:theme="@style/Theme.ConfirmDeviceCredentials"/>
|
android:theme="@style/SetupWizardTheme.Light"/>
|
||||||
|
|
||||||
<activity android:name="ConfirmLockPassword"
|
<activity android:name="ConfirmLockPassword"
|
||||||
android:windowSoftInputMode="stateHidden|adjustResize"
|
android:windowSoftInputMode="stateHidden|adjustResize"
|
||||||
android:theme="@style/Theme.ConfirmDeviceCredentials"/>
|
android:theme="@style/SetupWizardTheme.Light"/>
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".Settings$FingerprintSuggestionActivity"
|
android:name=".Settings$FingerprintSuggestionActivity"
|
||||||
@@ -1618,13 +1618,13 @@
|
|||||||
<!-- Note this must not be exported since it returns the password in the intent -->
|
<!-- Note this must not be exported since it returns the password in the intent -->
|
||||||
<activity android:name="ConfirmLockPattern$InternalActivity"
|
<activity android:name="ConfirmLockPattern$InternalActivity"
|
||||||
android:exported="false"
|
android:exported="false"
|
||||||
android:theme="@style/Theme.ConfirmDeviceCredentials"/>
|
android:theme="@style/SetupWizardTheme.Light"/>
|
||||||
|
|
||||||
<!-- Note this must not be exported since it returns the password in the intent -->
|
<!-- Note this must not be exported since it returns the password in the intent -->
|
||||||
<activity android:name="ConfirmLockPassword$InternalActivity"
|
<activity android:name="ConfirmLockPassword$InternalActivity"
|
||||||
android:exported="false"
|
android:exported="false"
|
||||||
android:windowSoftInputMode="adjustResize"
|
android:windowSoftInputMode="adjustResize"
|
||||||
android:theme="@style/Theme.ConfirmDeviceCredentials"/>
|
android:theme="@style/SetupWizardTheme.Light"/>
|
||||||
|
|
||||||
<activity android:name="SetupChooseLockGeneric"
|
<activity android:name="SetupChooseLockGeneric"
|
||||||
android:taskAffinity="com.android.wizard"
|
android:taskAffinity="com.android.wizard"
|
||||||
|
113
res/layout-land/confirm_lock_pattern_internal.xml
Normal file
113
res/layout-land/confirm_lock_pattern_internal.xml
Normal file
@@ -0,0 +1,113 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- Copyright (C) 2017 The Android Open Source Project
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
-->
|
||||||
|
<com.android.setupwizardlib.GlifLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:id="@+id/setup_wizard_layout"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:icon="@drawable/ic_lock"
|
||||||
|
android:layout="@layout/suw_glif_blank_template">
|
||||||
|
|
||||||
|
<com.android.internal.widget.LinearLayoutWithDefaultTouchRecepient
|
||||||
|
android:id="@+id/topLayout"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<ScrollView
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:fillViewport="true">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:paddingBottom="24dp">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/suw_layout_icon"
|
||||||
|
style="@style/SuwGlifIcon"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:src="@drawable/ic_lock" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/headerText"
|
||||||
|
style="@style/SuwGlifHeaderTitle"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
style="@style/SuwDescription.Glif"
|
||||||
|
android:id="@+id/detailsText"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="?attr/suwMarginSides"
|
||||||
|
android:layout_marginEnd="?attr/suwMarginSides" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/cancelButton"
|
||||||
|
style="@style/SetupWizardButton.Negative"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="?attr/suwMarginSides"
|
||||||
|
android:layout_marginEnd="?attr/suwMarginSides"
|
||||||
|
android:text="@string/cancel" />
|
||||||
|
|
||||||
|
<Space
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_weight="1" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
style="@style/TextAppearance.ConfirmDeviceCredentialsErrorText"
|
||||||
|
android:accessibilityLiveRegion="polite"
|
||||||
|
android:id="@+id/errorText"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="?attr/suwMarginSides"
|
||||||
|
android:layout_marginEnd="?attr/suwMarginSides"
|
||||||
|
android:layout_marginBottom="24dp"
|
||||||
|
android:gravity="center_vertical"/>
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/fingerprintIcon"
|
||||||
|
android:layout_gravity="center_horizontal"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:contentDescription="@string/confirm_fingerprint_icon_content_description"
|
||||||
|
android:visibility="gone"/>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</ScrollView>
|
||||||
|
|
||||||
|
<FrameLayout
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_weight="1">
|
||||||
|
|
||||||
|
<com.android.internal.widget.LockPatternView android:id="@+id/lockPattern"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:background="@color/lock_pattern_background" />
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
|
|
||||||
|
</com.android.internal.widget.LinearLayoutWithDefaultTouchRecepient>
|
||||||
|
</com.android.setupwizardlib.GlifLayout>
|
98
res/layout/confirm_lock_password_internal.xml
Normal file
98
res/layout/confirm_lock_password_internal.xml
Normal file
@@ -0,0 +1,98 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- Copyright (C) 2017 The Android Open Source Project
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
-->
|
||||||
|
<com.android.setupwizardlib.GlifLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:id="@+id/setup_wizard_layout"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:icon="@drawable/ic_lock"
|
||||||
|
android:layout="@layout/suw_glif_blank_template">
|
||||||
|
|
||||||
|
<com.android.internal.widget.LinearLayoutWithDefaultTouchRecepient
|
||||||
|
android:id="@+id/topLayout"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/suw_layout_icon"
|
||||||
|
style="@style/SuwGlifIcon"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:src="@drawable/ic_lock" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/headerText"
|
||||||
|
style="@style/SuwGlifHeaderTitle"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/detailsText"
|
||||||
|
style="@style/SuwDescription.Glif"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="?attr/suwMarginSides"
|
||||||
|
android:layout_marginEnd="?attr/suwMarginSides" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
style="@style/SetupWizardButton.Negative"
|
||||||
|
android:id="@+id/cancelButton"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/cancel" />
|
||||||
|
|
||||||
|
<Space
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_weight="1" />
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/password_entry"
|
||||||
|
android:layout_width="208dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_horizontal"
|
||||||
|
android:layout_marginTop="-40dp"
|
||||||
|
android:inputType="textPassword"
|
||||||
|
android:imeOptions="actionNext|flagNoFullscreen"
|
||||||
|
android:gravity="center"
|
||||||
|
android:textSize="16sp"
|
||||||
|
style="@style/TextAppearance.PasswordEntry"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
style="@style/TextAppearance.ConfirmDeviceCredentialsErrorText"
|
||||||
|
android:accessibilityLiveRegion="polite"
|
||||||
|
android:id="@+id/errorText"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:layout_gravity="center_horizontal"
|
||||||
|
android:layout_marginStart="12dp"
|
||||||
|
android:layout_marginEnd="12dp"
|
||||||
|
android:gravity="center_vertical"/>
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/fingerprintIcon"
|
||||||
|
android:layout_gravity="center_horizontal"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentBottom="true"
|
||||||
|
android:layout_marginBottom="24dp"
|
||||||
|
android:contentDescription="@string/confirm_fingerprint_icon_content_description"
|
||||||
|
android:visibility="gone"/>
|
||||||
|
|
||||||
|
</com.android.internal.widget.LinearLayoutWithDefaultTouchRecepient>
|
||||||
|
</com.android.setupwizardlib.GlifLayout>
|
112
res/layout/confirm_lock_pattern_internal_base.xml
Normal file
112
res/layout/confirm_lock_pattern_internal_base.xml
Normal file
@@ -0,0 +1,112 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- Copyright (C) 2017 The Android Open Source Project
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
-->
|
||||||
|
<com.android.setupwizardlib.GlifLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:id="@+id/setup_wizard_layout"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:icon="@drawable/ic_lock"
|
||||||
|
android:layout="@layout/suw_glif_blank_template">
|
||||||
|
|
||||||
|
<com.android.internal.widget.LinearLayoutWithDefaultTouchRecepient
|
||||||
|
android:id="@+id/topLayout"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<ScrollView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_weight="2">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/suw_layout_icon"
|
||||||
|
style="@style/SuwGlifIcon"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:src="@drawable/ic_lock" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/headerText"
|
||||||
|
style="@style/SuwGlifHeaderTitle"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
style="@style/SuwDescription.Glif"
|
||||||
|
android:id="@+id/detailsText"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="?attr/suwMarginSides"
|
||||||
|
android:layout_marginEnd="?attr/suwMarginSides" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/cancelButton"
|
||||||
|
style="@style/SetupWizardButton.Negative"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="?attr/suwMarginSides"
|
||||||
|
android:layout_marginEnd="?attr/suwMarginSides"
|
||||||
|
android:text="@string/cancel" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</ScrollView>
|
||||||
|
|
||||||
|
<com.android.internal.widget.LockPatternView
|
||||||
|
android:id="@+id/lockPattern"
|
||||||
|
android:layout_width="312dp"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_weight="3"
|
||||||
|
android:layout_gravity="center_horizontal"/>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
style="@style/TextAppearance.ConfirmDeviceCredentialsErrorText"
|
||||||
|
android:accessibilityLiveRegion="polite"
|
||||||
|
android:id="@+id/errorText"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:layout_gravity="center_horizontal"
|
||||||
|
android:layout_marginTop="12dp"
|
||||||
|
android:layout_marginStart="12dp"
|
||||||
|
android:layout_marginEnd="12dp"
|
||||||
|
android:gravity="center_vertical"/>
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/fingerprintIcon"
|
||||||
|
android:layout_gravity="center_horizontal"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentBottom="true"
|
||||||
|
android:layout_marginBottom="24dp"
|
||||||
|
android:contentDescription="@string/confirm_fingerprint_icon_content_description"
|
||||||
|
android:visibility="gone"/>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</com.android.internal.widget.LinearLayoutWithDefaultTouchRecepient>
|
||||||
|
</com.android.setupwizardlib.GlifLayout>
|
@@ -20,5 +20,6 @@
|
|||||||
<item name="fingerprint_enroll_enrolling" type="layout">@layout/fingerprint_enroll_enrolling_base</item>
|
<item name="fingerprint_enroll_enrolling" type="layout">@layout/fingerprint_enroll_enrolling_base</item>
|
||||||
<item name="fingerprint_enroll_finish" type="layout">@layout/fingerprint_enroll_finish_base</item>
|
<item name="fingerprint_enroll_finish" type="layout">@layout/fingerprint_enroll_finish_base</item>
|
||||||
<item name="choose_lock_pattern" type="layout">@layout/choose_lock_pattern_common</item>
|
<item name="choose_lock_pattern" type="layout">@layout/choose_lock_pattern_common</item>
|
||||||
|
<item name="confirm_lock_pattern_internal" type="layout">@layout/confirm_lock_pattern_internal_base</item>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
||||||
|
@@ -17,6 +17,7 @@
|
|||||||
<resources>
|
<resources>
|
||||||
<item name="notification_app_section" type="layout">@*android:layout/preference_category_material</item>
|
<item name="notification_app_section" type="layout">@*android:layout/preference_category_material</item>
|
||||||
<item name="confirm_lock_pattern" type="layout">@layout/confirm_lock_pattern_base</item>
|
<item name="confirm_lock_pattern" type="layout">@layout/confirm_lock_pattern_base</item>
|
||||||
|
<item name="confirm_lock_pattern_internal" type="layout">@layout/confirm_lock_pattern_internal_base</item>
|
||||||
<item name="confirm_lock_password" type="layout">@layout/confirm_lock_password_base</item>
|
<item name="confirm_lock_password" type="layout">@layout/confirm_lock_password_base</item>
|
||||||
<item name="fingerprint_enroll_find_sensor" type="layout">@layout/fingerprint_enroll_find_sensor_base</item>
|
<item name="fingerprint_enroll_find_sensor" type="layout">@layout/fingerprint_enroll_find_sensor_base</item>
|
||||||
<item name="fingerprint_enroll_enrolling" type="layout">@layout/fingerprint_enroll_enrolling_base</item>
|
<item name="fingerprint_enroll_enrolling" type="layout">@layout/fingerprint_enroll_enrolling_base</item>
|
||||||
|
@@ -22,16 +22,23 @@ import android.os.Bundle;
|
|||||||
import android.os.UserManager;
|
import android.os.UserManager;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
|
|
||||||
public abstract class ConfirmDeviceCredentialBaseActivity extends SettingsActivity {
|
public abstract class ConfirmDeviceCredentialBaseActivity extends SettingsActivity {
|
||||||
|
|
||||||
private static final String STATE_IS_KEYGUARD_LOCKED = "STATE_IS_KEYGUARD_LOCKED";
|
private static final String STATE_IS_KEYGUARD_LOCKED = "STATE_IS_KEYGUARD_LOCKED";
|
||||||
|
|
||||||
|
enum ConfirmCredentialTheme {
|
||||||
|
INTERNAL,
|
||||||
|
DARK,
|
||||||
|
WORK
|
||||||
|
}
|
||||||
|
|
||||||
private boolean mRestoring;
|
private boolean mRestoring;
|
||||||
private boolean mDark;
|
|
||||||
private boolean mEnterAnimationPending;
|
private boolean mEnterAnimationPending;
|
||||||
private boolean mFirstTimeVisible = true;
|
private boolean mFirstTimeVisible = true;
|
||||||
private boolean mIsKeyguardLocked = false;
|
private boolean mIsKeyguardLocked = false;
|
||||||
|
private ConfirmCredentialTheme mConfirmCredentialTheme;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedState) {
|
protected void onCreate(Bundle savedState) {
|
||||||
@@ -39,12 +46,24 @@ public abstract class ConfirmDeviceCredentialBaseActivity extends SettingsActivi
|
|||||||
Utils.getUserIdFromBundle(this, getIntent().getExtras()));
|
Utils.getUserIdFromBundle(this, getIntent().getExtras()));
|
||||||
if (UserManager.get(this).isManagedProfile(credentialOwnerUserId)) {
|
if (UserManager.get(this).isManagedProfile(credentialOwnerUserId)) {
|
||||||
setTheme(R.style.Theme_ConfirmDeviceCredentialsWork);
|
setTheme(R.style.Theme_ConfirmDeviceCredentialsWork);
|
||||||
|
mConfirmCredentialTheme = ConfirmCredentialTheme.WORK;
|
||||||
} else if (getIntent().getBooleanExtra(
|
} else if (getIntent().getBooleanExtra(
|
||||||
ConfirmDeviceCredentialBaseFragment.DARK_THEME, false)) {
|
ConfirmDeviceCredentialBaseFragment.DARK_THEME, false)) {
|
||||||
setTheme(R.style.Theme_ConfirmDeviceCredentialsDark);
|
setTheme(R.style.Theme_ConfirmDeviceCredentialsDark);
|
||||||
mDark = true;
|
mConfirmCredentialTheme = ConfirmCredentialTheme.DARK;
|
||||||
|
} else {
|
||||||
|
setTheme(R.style.SetupWizardTheme_Light);
|
||||||
|
mConfirmCredentialTheme = ConfirmCredentialTheme.INTERNAL;
|
||||||
}
|
}
|
||||||
super.onCreate(savedState);
|
super.onCreate(savedState);
|
||||||
|
|
||||||
|
if (mConfirmCredentialTheme == ConfirmCredentialTheme.INTERNAL) {
|
||||||
|
// Prevent the content parent from consuming the window insets because GlifLayout uses
|
||||||
|
// it to show the status bar background.
|
||||||
|
LinearLayout layout = (LinearLayout) findViewById(R.id.content_parent);
|
||||||
|
layout.setFitsSystemWindows(false);
|
||||||
|
}
|
||||||
|
|
||||||
mIsKeyguardLocked = savedState == null
|
mIsKeyguardLocked = savedState == null
|
||||||
? getSystemService(KeyguardManager.class).isKeyguardLocked()
|
? getSystemService(KeyguardManager.class).isKeyguardLocked()
|
||||||
: savedState.getBoolean(STATE_IS_KEYGUARD_LOCKED, false);
|
: savedState.getBoolean(STATE_IS_KEYGUARD_LOCKED, false);
|
||||||
@@ -85,7 +104,8 @@ public abstract class ConfirmDeviceCredentialBaseActivity extends SettingsActivi
|
|||||||
@Override
|
@Override
|
||||||
public void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
if (!isChangingConfigurations() && !mRestoring && mDark && mFirstTimeVisible) {
|
if (!isChangingConfigurations() && !mRestoring
|
||||||
|
&& mConfirmCredentialTheme == ConfirmCredentialTheme.DARK && mFirstTimeVisible) {
|
||||||
mFirstTimeVisible = false;
|
mFirstTimeVisible = false;
|
||||||
prepareEnterAnimation();
|
prepareEnterAnimation();
|
||||||
mEnterAnimationPending = true;
|
mEnterAnimationPending = true;
|
||||||
@@ -116,4 +136,8 @@ public abstract class ConfirmDeviceCredentialBaseActivity extends SettingsActivi
|
|||||||
public void startEnterAnimation() {
|
public void startEnterAnimation() {
|
||||||
getFragment().startEnterAnimation();
|
getFragment().startEnterAnimation();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ConfirmCredentialTheme getConfirmCredentialTheme() {
|
||||||
|
return mConfirmCredentialTheme;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -122,7 +122,14 @@ public class ConfirmLockPassword extends ConfirmDeviceCredentialBaseActivity {
|
|||||||
Bundle savedInstanceState) {
|
Bundle savedInstanceState) {
|
||||||
final int storedQuality = mLockPatternUtils.getKeyguardStoredPasswordQuality(
|
final int storedQuality = mLockPatternUtils.getKeyguardStoredPasswordQuality(
|
||||||
mEffectiveUserId);
|
mEffectiveUserId);
|
||||||
View view = inflater.inflate(R.layout.confirm_lock_password, null);
|
|
||||||
|
ConfirmLockPassword activity = (ConfirmLockPassword) getActivity();
|
||||||
|
View view = inflater.inflate(
|
||||||
|
activity.getConfirmCredentialTheme() == ConfirmCredentialTheme.INTERNAL
|
||||||
|
? R.layout.confirm_lock_password_internal
|
||||||
|
: R.layout.confirm_lock_password,
|
||||||
|
container,
|
||||||
|
false);
|
||||||
|
|
||||||
mPasswordEntry = (TextView) view.findViewById(R.id.password_entry);
|
mPasswordEntry = (TextView) view.findViewById(R.id.password_entry);
|
||||||
mPasswordEntry.setOnEditorActionListener(this);
|
mPasswordEntry.setOnEditorActionListener(this);
|
||||||
@@ -406,25 +413,22 @@ public class ConfirmLockPassword extends ConfirmDeviceCredentialBaseActivity {
|
|||||||
}
|
}
|
||||||
mDisappearing = true;
|
mDisappearing = true;
|
||||||
|
|
||||||
if (getActivity().getThemeResId() == R.style.Theme_ConfirmDeviceCredentialsDark) {
|
final ConfirmLockPassword activity = (ConfirmLockPassword) getActivity();
|
||||||
mDisappearAnimationUtils.startAnimation(getActiveViews(), new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
// Bail if there is no active activity.
|
// Bail if there is no active activity.
|
||||||
if (getActivity() == null || getActivity().isFinishing()) {
|
if (activity == null || activity.isFinishing()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (activity.getConfirmCredentialTheme() == ConfirmCredentialTheme.DARK) {
|
||||||
getActivity().setResult(RESULT_OK, intent);
|
mDisappearAnimationUtils.startAnimation(getActiveViews(), () -> {
|
||||||
getActivity().finish();
|
activity.setResult(RESULT_OK, intent);
|
||||||
getActivity().overridePendingTransition(
|
activity.finish();
|
||||||
|
activity.overridePendingTransition(
|
||||||
R.anim.confirm_credential_close_enter,
|
R.anim.confirm_credential_close_enter,
|
||||||
R.anim.confirm_credential_close_exit);
|
R.anim.confirm_credential_close_exit);
|
||||||
}
|
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
getActivity().setResult(RESULT_OK, intent);
|
activity.setResult(RESULT_OK, intent);
|
||||||
getActivity().finish();
|
activity.finish();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -114,7 +114,13 @@ public class ConfirmLockPattern extends ConfirmDeviceCredentialBaseActivity {
|
|||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
Bundle savedInstanceState) {
|
Bundle savedInstanceState) {
|
||||||
View view = inflater.inflate(R.layout.confirm_lock_pattern, null);
|
ConfirmLockPattern activity = (ConfirmLockPattern) getActivity();
|
||||||
|
View view = inflater.inflate(
|
||||||
|
activity.getConfirmCredentialTheme() == ConfirmCredentialTheme.INTERNAL
|
||||||
|
? R.layout.confirm_lock_pattern_internal
|
||||||
|
: R.layout.confirm_lock_pattern,
|
||||||
|
container,
|
||||||
|
false);
|
||||||
mHeaderTextView = (TextView) view.findViewById(R.id.headerText);
|
mHeaderTextView = (TextView) view.findViewById(R.id.headerText);
|
||||||
mLockPatternView = (LockPatternView) view.findViewById(R.id.lockPattern);
|
mLockPatternView = (LockPatternView) view.findViewById(R.id.lockPattern);
|
||||||
mDetailsTextView = (TextView) view.findViewById(R.id.detailsText);
|
mDetailsTextView = (TextView) view.findViewById(R.id.detailsText);
|
||||||
@@ -343,27 +349,24 @@ public class ConfirmLockPattern extends ConfirmDeviceCredentialBaseActivity {
|
|||||||
}
|
}
|
||||||
mDisappearing = true;
|
mDisappearing = true;
|
||||||
|
|
||||||
if (getActivity().getThemeResId() == R.style.Theme_ConfirmDeviceCredentialsDark) {
|
final ConfirmLockPattern activity = (ConfirmLockPattern) getActivity();
|
||||||
mLockPatternView.clearPattern();
|
|
||||||
mDisappearAnimationUtils.startAnimation2d(getActiveViews(),
|
|
||||||
new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
// Bail if there is no active activity.
|
// Bail if there is no active activity.
|
||||||
if (getActivity() == null || getActivity().isFinishing()) {
|
if (activity == null || activity.isFinishing()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (activity.getConfirmCredentialTheme() == ConfirmCredentialTheme.DARK) {
|
||||||
getActivity().setResult(RESULT_OK, intent);
|
mLockPatternView.clearPattern();
|
||||||
getActivity().finish();
|
mDisappearAnimationUtils.startAnimation2d(getActiveViews(),
|
||||||
getActivity().overridePendingTransition(
|
() -> {
|
||||||
|
activity.setResult(RESULT_OK, intent);
|
||||||
|
activity.finish();
|
||||||
|
activity.overridePendingTransition(
|
||||||
R.anim.confirm_credential_close_enter,
|
R.anim.confirm_credential_close_enter,
|
||||||
R.anim.confirm_credential_close_exit);
|
R.anim.confirm_credential_close_exit);
|
||||||
}
|
|
||||||
}, this);
|
}, this);
|
||||||
} else {
|
} else {
|
||||||
getActivity().setResult(RESULT_OK, intent);
|
activity.setResult(RESULT_OK, intent);
|
||||||
getActivity().finish();
|
activity.finish();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -0,0 +1,67 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2017 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.android.settings;
|
||||||
|
|
||||||
|
import static android.support.test.espresso.Espresso.onView;
|
||||||
|
import static android.support.test.espresso.action.ViewActions.pressKey;
|
||||||
|
import static android.support.test.espresso.action.ViewActions.typeText;
|
||||||
|
import static android.support.test.espresso.assertion.ViewAssertions.matches;
|
||||||
|
import static android.support.test.espresso.matcher.ViewMatchers.withId;
|
||||||
|
import static android.support.test.espresso.matcher.ViewMatchers.withText;
|
||||||
|
|
||||||
|
import android.app.Instrumentation;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.support.test.InstrumentationRegistry;
|
||||||
|
import android.support.test.runner.AndroidJUnit4;
|
||||||
|
import android.view.KeyEvent;
|
||||||
|
|
||||||
|
import org.junit.Before;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
|
||||||
|
@RunWith(AndroidJUnit4.class)
|
||||||
|
public class ConfirmLockPasswordTest {
|
||||||
|
|
||||||
|
private Instrumentation mInstrumentation;
|
||||||
|
private Context mContext;
|
||||||
|
|
||||||
|
@Before
|
||||||
|
public void setUp() {
|
||||||
|
mInstrumentation = InstrumentationRegistry.getInstrumentation();
|
||||||
|
mContext = mInstrumentation.getTargetContext();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void enterWrongPin_shouldShowErrorMessage() {
|
||||||
|
mInstrumentation.startActivitySync(
|
||||||
|
new Intent(mContext, ConfirmLockPassword.class));
|
||||||
|
onView(withId(R.id.password_entry)).perform(typeText("1234"))
|
||||||
|
.perform(pressKey(KeyEvent.KEYCODE_ENTER));
|
||||||
|
onView(withId(R.id.errorText)).check(matches(withText(R.string.lockpassword_invalid_pin)));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void enterWrongPin_darkTheme_shouldShowErrorMessage() {
|
||||||
|
mInstrumentation.startActivitySync(
|
||||||
|
new Intent(mContext, ConfirmLockPassword.class)
|
||||||
|
.putExtra(ConfirmDeviceCredentialBaseFragment.DARK_THEME, true));
|
||||||
|
onView(withId(R.id.password_entry)).perform(typeText("1234"))
|
||||||
|
.perform(pressKey(KeyEvent.KEYCODE_ENTER));
|
||||||
|
onView(withId(R.id.errorText)).check(matches(withText(R.string.lockpassword_invalid_pin)));
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user