Snap for 5201397 from feb271378c to qt-release

Change-Id: I83102d0dc3adc048c962a0f88901b9434c3c3841
This commit is contained in:
android-build-team Robot
2018-12-27 04:04:35 +00:00
33 changed files with 165 additions and 275 deletions

View File

@@ -78,7 +78,7 @@
android:gravity="center"
style="@style/TextAppearance.PasswordEntry"/>
<TextView style="@style/TextAppearance.ConfirmDeviceCredentialsErrorText"
<TextView style="@style/TextAppearance.ErrorText"
android:accessibilityLiveRegion="polite"
android:id="@+id/errorText"
android:layout_width="wrap_content"

View File

@@ -94,7 +94,7 @@
android:layout_gravity="center_vertical"/>
<TextView
style="@style/TextAppearance.ConfirmDeviceCredentialsErrorText"
style="@style/TextAppearance.ErrorText"
android:accessibilityLiveRegion="polite"
android:id="@+id/errorText"
android:layout_width="wrap_content"

View File

@@ -76,7 +76,7 @@
android:layout_weight="1" />
<TextView
style="@style/TextAppearance.ConfirmDeviceCredentialsErrorText"
style="@style/TextAppearance.ErrorText"
android:accessibilityLiveRegion="polite"
android:id="@+id/errorText"
android:layout_width="wrap_content"

View File

@@ -123,7 +123,7 @@
</com.google.android.setupdesign.view.FillContentLayout>
<TextView
style="@style/TextAppearance.FingerprintErrorText"
style="@style/TextAppearance.ErrorText"
android:id="@+id/error_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"

View File

@@ -79,7 +79,7 @@
style="@style/TextAppearance.PasswordEntry"/>
<TextView
style="@style/TextAppearance.ConfirmDeviceCredentialsErrorText"
style="@style/TextAppearance.ErrorText"
android:accessibilityLiveRegion="polite"
android:id="@+id/errorText"
android:layout_width="wrap_content"

View File

@@ -58,7 +58,7 @@
<TextView
android:id="@+id/errorText"
style="@style/TextAppearance.ConfirmDeviceCredentialsErrorText"
style="@style/TextAppearance.ErrorText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:accessibilityLiveRegion="polite"/>

View File

@@ -85,7 +85,7 @@
android:orientation="vertical">
<TextView
style="@style/TextAppearance.ConfirmDeviceCredentialsErrorText"
style="@style/TextAppearance.ErrorText"
android:accessibilityLiveRegion="polite"
android:id="@+id/errorText"
android:layout_width="wrap_content"

View File

@@ -80,7 +80,7 @@
</com.google.android.setupdesign.view.FillContentLayout>
<TextView
style="@style/TextAppearance.ConfirmDeviceCredentialsErrorText"
style="@style/TextAppearance.ErrorText"
android:accessibilityLiveRegion="polite"
android:id="@+id/errorText"
android:layout_width="wrap_content"

View File

@@ -20,8 +20,7 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:icon="@drawable/ic_lock"
app:sucFooter="@layout/encryption_interstitial_footer">
android:icon="@drawable/ic_lock">
<LinearLayout
style="@style/SuwContentFrame"

View File

@@ -1,43 +0,0 @@
<?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.
-->
<!-- TODO: Use aapt:attr when it is fixed (b/36809755) -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
style="@style/SuwGlifButtonBar"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<Button
android:id="@+id/encrypt_dont_require_password"
style="@style/SuwGlifButton.Secondary"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/encryption_interstitial_no" />
<Space
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1" />
<Button
android:id="@+id/encrypt_require_password"
style="@style/SuwGlifButton.Primary"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/encryption_interstitial_yes" />
</LinearLayout>

View File

@@ -57,7 +57,7 @@
</com.android.settings.biometrics.face.FaceSquareFrameLayout>
<TextView
style="@style/TextAppearance.FaceErrorText"
style="@style/TextAppearance.ErrorText"
android:id="@+id/error_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"

View File

@@ -1,28 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2015 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.
-->
<TextView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/text1"
style="?android:attr/spinnerItemStyle"
android:maxLines="1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="marquee"
android:textColor="?android:attr/colorForegroundInverse"
android:textAppearance="@style/TextAppearance.Switch"
android:textAlignment="inherit" />

View File

@@ -77,7 +77,7 @@
</com.google.android.setupdesign.view.FillContentLayout>
<TextView
style="@style/TextAppearance.FingerprintErrorText"
style="@style/TextAppearance.ErrorText"
android:id="@+id/error_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"

View File

@@ -67,7 +67,7 @@
<!-- Added to align elements with fingerprint_enroll_enrolling_base -->
<TextView
style="@style/TextAppearance.FingerprintErrorText"
style="@style/TextAppearance.ErrorText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|bottom"

View File

@@ -22,7 +22,6 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:icon="@drawable/ic_suggested_notifications"
settings:sucFooter="@layout/redaction_interstitial_footer"
settings:suwHeaderText="@string/lock_screen_notifications_interstitial_title">
<LinearLayout

View File

@@ -1,32 +0,0 @@
<?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
-->
<!-- TODO: Use aapt:attr when it is fixed (b/36809755) -->
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
style="@style/SuwGlifButtonBar"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<Button
android:id="@+id/redaction_done_button"
style="@style/SuwGlifButton.Primary"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:text="@string/app_notifications_dialog_done" />
</FrameLayout>

View File

@@ -15,7 +15,6 @@
-->
<resources>
<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_normal" type="layout">@layout/confirm_lock_pattern_normal_base</item>
<item name="confirm_lock_password" type="layout">@layout/confirm_lock_password_base</item>

View File

@@ -174,23 +174,6 @@
<item name="android:background">#ff000000</item>
</style>
<style name="SecurityPreferenceButtonContainer"
parent="@android:style/Widget.Material.Light.SegmentedButton">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:weightSum">2</item>
<item name="android:dividerPadding">8dip</item>
</style>
<style name="SecurityPreferenceButton"
parent="@android:style/Widget.Material.Light.Button.Borderless">
<item name="android:layout_width">0dip</item>
<item name="android:layout_weight">1</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:ellipsize">marquee</item>
<item name="android:singleLine">true</item>
</style>
<style name="SetupWizardButton.Negative" parent="@style/SuwGlifButton.Secondary">
<!-- Negative margin to offset for padding of the button itself. We want the label to be
aligned with the text above it -->
@@ -280,17 +263,7 @@
<item name="android:textColor">?android:attr/textColorSecondary</item>
</style>
<style name="TextAppearance.FingerprintErrorText"
parent="android:TextAppearance.Material.Body1">
<item name="android:textColor">?android:attr/colorError</item>
</style>
<style name="TextAppearance.FaceErrorText"
parent="android:TextAppearance.Material.Body1">
<item name="android:textColor">?android:attr/colorError</item>
</style>
<style name="TextAppearance.ConfirmDeviceCredentialsErrorText"
<style name="TextAppearance.ErrorText"
parent="android:TextAppearance.Material.Body1">
<item name="android:textColor">?android:attr/colorError</item>
</style>

View File

@@ -40,6 +40,8 @@ import com.android.settings.core.InstrumentedFragment;
import com.android.settings.core.instrumentation.InstrumentedDialogFragment;
import com.android.settings.password.ChooseLockSettingsHelper;
import com.google.android.setupcompat.item.FooterButton;
import com.google.android.setupcompat.template.ButtonFooterMixin;
import com.google.android.setupdesign.GlifLayout;
import java.util.List;
@@ -86,11 +88,8 @@ public class EncryptionInterstitial extends SettingsActivity {
layout.setFitsSystemWindows(false);
}
public static class EncryptionInterstitialFragment extends InstrumentedFragment
implements View.OnClickListener {
public static class EncryptionInterstitialFragment extends InstrumentedFragment {
private View mRequirePasswordToDecrypt;
private View mDontRequirePasswordToDecrypt;
private boolean mPasswordRequired;
private Intent mUnlockMethodIntent;
private int mRequestedPasswordQuality;
@@ -110,8 +109,6 @@ public class EncryptionInterstitial extends SettingsActivity {
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
mRequirePasswordToDecrypt = view.findViewById(R.id.encrypt_require_password);
mDontRequirePasswordToDecrypt = view.findViewById(R.id.encrypt_dont_require_password);
final boolean forFingerprint = getActivity().getIntent().getBooleanExtra(
ChooseLockSettingsHelper.EXTRA_KEY_FOR_FINGERPRINT, false);
final boolean forFace = getActivity().getIntent()
@@ -147,14 +144,30 @@ public class EncryptionInterstitial extends SettingsActivity {
TextView message = (TextView) getActivity().findViewById(R.id.encryption_message);
message.setText(msgId);
mRequirePasswordToDecrypt.setOnClickListener(this);
mDontRequirePasswordToDecrypt.setOnClickListener(this);
setRequirePasswordState(getActivity().getIntent().getBooleanExtra(
EXTRA_REQUIRE_PASSWORD, true));
GlifLayout layout = (GlifLayout) view;
layout.setHeaderText(getActivity().getTitle());
final ButtonFooterMixin buttonFooterMixin = layout.getMixin(ButtonFooterMixin.class);
buttonFooterMixin.setSecondaryButton(
new FooterButton.Builder(getContext())
.setText(R.string.encryption_interstitial_no)
.setListener(this::onNoButtonClicked)
.setButtonType(FooterButton.ButtonType.SKIP)
.setTheme(R.style.SuwGlifButton_Secondary)
.build()
);
buttonFooterMixin.setPrimaryButton(
new FooterButton.Builder(getContext())
.setText(R.string.encryption_interstitial_yes)
.setListener(this::onYesButtonClicked)
.setButtonType(FooterButton.ButtonType.NEXT)
.setTheme(R.style.SuwGlifButton_Primary)
.build()
);
}
protected void startLockIntent() {
@@ -176,26 +189,25 @@ public class EncryptionInterstitial extends SettingsActivity {
}
}
@Override
public void onClick(View view) {
if (view == mRequirePasswordToDecrypt) {
final boolean accEn = AccessibilityManager.getInstance(getActivity()).isEnabled();
if (accEn && !mPasswordRequired) {
setRequirePasswordState(false); // clear the UI state
AccessibilityWarningDialogFragment.newInstance(mRequestedPasswordQuality)
.show(
getChildFragmentManager(),
AccessibilityWarningDialogFragment.TAG);
} else {
setRequirePasswordState(true);
startLockIntent();
}
private void onYesButtonClicked(View view) {
final boolean accEn = AccessibilityManager.getInstance(getActivity()).isEnabled();
if (accEn && !mPasswordRequired) {
setRequirePasswordState(false); // clear the UI state
AccessibilityWarningDialogFragment.newInstance(mRequestedPasswordQuality)
.show(
getChildFragmentManager(),
AccessibilityWarningDialogFragment.TAG);
} else {
setRequirePasswordState(false);
setRequirePasswordState(true);
startLockIntent();
}
}
private void onNoButtonClicked(View view) {
setRequirePasswordState(false);
startLockIntent();
}
private void setRequirePasswordState(boolean required) {
mPasswordRequired = required;
}

View File

@@ -419,12 +419,12 @@ public class MasterClear extends InstrumentedFragment implements OnGlobalLayoutL
final TemplateLayout layout = mContentView.findViewById(R.id.setup_wizard_layout);
final ButtonFooterMixin buttonFooterMixin = layout.getMixin(ButtonFooterMixin.class);
buttonFooterMixin.setPrimaryButton(
new FooterButton(
getActivity(),
R.string.master_clear_button_text,
mInitiateListener,
ButtonType.OTHER,
R.style.SuwGlifButton_Primary)
new FooterButton.Builder(getActivity())
.setText(R.string.master_clear_button_text)
.setListener(mInitiateListener)
.setButtonType(ButtonType.OTHER)
.setTheme(R.style.SuwGlifButton_Primary)
.build()
);
mInitiateButton = buttonFooterMixin.getPrimaryButton();
}

View File

@@ -156,12 +156,12 @@ public class MasterClearConfirm extends InstrumentedFragment {
final ButtonFooterMixin buttonFooterMixin = layout.getMixin(ButtonFooterMixin.class);
buttonFooterMixin.setPrimaryButton(
new FooterButton(
getActivity(),
R.string.master_clear_button_text,
mFinalClickListener,
ButtonType.OTHER,
R.style.SuwGlifButton_Primary)
new FooterButton.Builder(getActivity())
.setText(R.string.master_clear_button_text)
.setListener(mFinalClickListener)
.setButtonType(ButtonType.OTHER)
.setTheme(R.style.SuwGlifButton_Primary)
.build()
);
}

View File

@@ -93,12 +93,12 @@ public class FaceEnrollEnrolling extends BiometricsEnrollEnrolling {
mButtonFooterMixin = getLayout().getMixin(ButtonFooterMixin.class);
mButtonFooterMixin.setSecondaryButton(
new FooterButton(
this,
R.string.security_settings_face_enroll_enrolling_skip,
this::onSkipButtonClick,
FooterButton.ButtonType.SKIP,
R.style.SuwGlifButton_Secondary)
new FooterButton.Builder(this)
.setText(R.string.security_settings_face_enroll_enrolling_skip)
.setListener(this::onSkipButtonClick)
.setButtonType(FooterButton.ButtonType.SKIP)
.setTheme(R.style.SuwGlifButton_Secondary)
.build()
);
if (!getIntent().getBooleanExtra(BiometricEnrollBase.EXTRA_KEY_REQUIRE_DIVERSITY, true)) {

View File

@@ -39,12 +39,12 @@ public class FaceEnrollFinish extends BiometricEnrollBase {
mButtonFooterMixin = getLayout().getMixin(ButtonFooterMixin.class);
mButtonFooterMixin.setPrimaryButton(
new FooterButton(
this,
R.string.security_settings_face_enroll_done,
this::onNextButtonClick,
FooterButton.ButtonType.NEXT,
R.style.SuwGlifButton_Primary)
new FooterButton.Builder(this)
.setText(R.string.security_settings_face_enroll_done)
.setListener(this::onNextButtonClick)
.setButtonType(FooterButton.ButtonType.NEXT)
.setTheme(R.style.SuwGlifButton_Primary)
.build()
);
}

View File

@@ -62,21 +62,21 @@ public class FaceEnrollIntroduction extends BiometricEnrollIntroduction {
mButtonFooterMixin = getLayout().getMixin(ButtonFooterMixin.class);
mButtonFooterMixin.setSecondaryButton(
new FooterButton(
this,
R.string.security_settings_face_enroll_introduction_cancel,
this::onCancelButtonClick,
FooterButton.ButtonType.SKIP,
R.style.SuwGlifButton_Secondary)
new FooterButton.Builder(this)
.setText(R.string.security_settings_face_enroll_introduction_cancel)
.setListener(this::onCancelButtonClick)
.setButtonType(FooterButton.ButtonType.SKIP)
.setTheme(R.style.SuwGlifButton_Secondary)
.build()
);
mButtonFooterMixin.setPrimaryButton(
new FooterButton(
this,
R.string.wizard_next,
this::onNextButtonClick,
FooterButton.ButtonType.NEXT,
R.style.SuwGlifButton_Primary)
new FooterButton.Builder(this)
.setText(R.string.wizard_next)
.setListener(this::onNextButtonClick)
.setButtonType(FooterButton.ButtonType.NEXT)
.setTheme(R.style.SuwGlifButton_Primary)
.build()
);
}

View File

@@ -139,12 +139,12 @@ public class FingerprintEnrollEnrolling extends BiometricsEnrollEnrolling {
mButtonFooterMixin = getLayout().getMixin(ButtonFooterMixin.class);
mButtonFooterMixin.setSecondaryButton(
new FooterButton(
this,
R.string.security_settings_fingerprint_enroll_enrolling_skip,
this::onSkipButtonClick,
FooterButton.ButtonType.SKIP,
R.style.SuwGlifButton_Secondary)
new FooterButton.Builder(this)
.setText(R.string.security_settings_fingerprint_enroll_enrolling_skip)
.setListener(this::onSkipButtonClick)
.setButtonType(FooterButton.ButtonType.SKIP)
.setTheme(R.style.SuwGlifButton_Secondary)
.build()
);
final LayerDrawable fingerprintDrawable = (LayerDrawable) mProgressBar.getBackground();

View File

@@ -49,12 +49,12 @@ public class FingerprintEnrollFindSensor extends BiometricEnrollBase {
setContentView(getContentView());
mButtonFooterMixin = getLayout().getMixin(ButtonFooterMixin.class);
mButtonFooterMixin.setSecondaryButton(
new FooterButton(
this,
R.string.skip_label,
this::onSkipButtonClick,
FooterButton.ButtonType.SKIP,
R.style.SuwGlifButton_Secondary)
new FooterButton.Builder(this)
.setText(R.string.skip_label)
.setListener(this::onSkipButtonClick)
.setButtonType(FooterButton.ButtonType.SKIP)
.setTheme(R.style.SuwGlifButton_Secondary)
.build()
);
setHeaderText(R.string.security_settings_fingerprint_enroll_find_sensor_title);

View File

@@ -44,21 +44,20 @@ public class FingerprintEnrollFinish extends BiometricEnrollBase {
mButtonFooterMixin = getLayout().getMixin(ButtonFooterMixin.class);
mButtonFooterMixin.setSecondaryButton(
new FooterButton(
this,
R.string.fingerprint_enroll_button_add,
null,
FooterButton.ButtonType.SKIP,
R.style.SuwGlifButton_Secondary)
new FooterButton.Builder(this)
.setText(R.string.fingerprint_enroll_button_add)
.setButtonType(FooterButton.ButtonType.SKIP)
.setTheme(R.style.SuwGlifButton_Secondary)
.build()
);
mButtonFooterMixin.setPrimaryButton(
new FooterButton(
this,
R.string.security_settings_fingerprint_enroll_done,
this::onNextButtonClick,
FooterButton.ButtonType.NEXT,
R.style.SuwGlifButton_Primary)
new FooterButton.Builder(this)
.setText(R.string.security_settings_fingerprint_enroll_done)
.setListener(this::onNextButtonClick)
.setButtonType(FooterButton.ButtonType.NEXT)
.setTheme(R.style.SuwGlifButton_Primary)
.build()
);
}

View File

@@ -49,21 +49,21 @@ public class FingerprintEnrollIntroduction extends BiometricEnrollIntroduction {
mButtonFooterMixin = getLayout().getMixin(ButtonFooterMixin.class);
mButtonFooterMixin.setSecondaryButton(
new FooterButton(
this,
R.string.security_settings_face_enroll_introduction_cancel,
this::onCancelButtonClick,
FooterButton.ButtonType.SKIP,
R.style.SuwGlifButton_Secondary)
new FooterButton.Builder(this)
.setText(R.string.security_settings_face_enroll_introduction_cancel)
.setListener(this::onCancelButtonClick)
.setButtonType(FooterButton.ButtonType.SKIP)
.setTheme(R.style.SuwGlifButton_Secondary)
.build()
);
mButtonFooterMixin.setPrimaryButton(
new FooterButton(
this,
R.string.wizard_next,
this::onNextButtonClick,
FooterButton.ButtonType.NEXT,
R.style.SuwGlifButton_Primary)
new FooterButton.Builder(this)
.setText(R.string.wizard_next)
.setListener(this::onNextButtonClick)
.setButtonType(FooterButton.ButtonType.NEXT)
.setTheme(R.style.SuwGlifButton_Primary)
.build()
);
}

View File

@@ -96,20 +96,20 @@ public abstract class StorageWizardBase extends FragmentActivity {
mButtonFooterMixin = getGlifLayout().getMixin(ButtonFooterMixin.class);
mButtonFooterMixin.setSecondaryButton(
new FooterButton(
this,
R.string.wizard_back,
this::onNavigateBack,
FooterButton.ButtonType.OTHER,
R.style.SuwGlifButton_Secondary)
new FooterButton.Builder(this)
.setText(R.string.wizard_back)
.setListener(this::onNavigateBack)
.setButtonType(FooterButton.ButtonType.OTHER)
.setTheme(R.style.SuwGlifButton_Secondary)
.build()
);
mButtonFooterMixin.setPrimaryButton(
new FooterButton(
this,
R.string.wizard_next,
this::onNavigateNext,
FooterButton.ButtonType.NEXT,
R.style.SuwGlifButton_Primary)
new FooterButton.Builder(this)
.setText(R.string.wizard_next)
.setListener(this::onNavigateNext)
.setButtonType(FooterButton.ButtonType.NEXT)
.setTheme(R.style.SuwGlifButton_Primary)
.build()
);
mBack = mButtonFooterMixin.getSecondaryButton();
mNext = mButtonFooterMixin.getPrimaryButton();

View File

@@ -53,7 +53,7 @@ public class WakeLockScreenGesturePreferenceController extends GesturePreference
@Override
public int getAvailabilityStatus() {
// No hardware support for this Gesture
if (!getAmbientConfig().wakeLockScreenGestureAvailable()) {
if (!getAmbientConfig().wakeScreenGestureAvailable()) {
return UNSUPPORTED_ON_DEVICE;
}

View File

@@ -32,7 +32,6 @@ import android.provider.Settings;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.RadioButton;
import android.widget.RadioGroup;
@@ -46,9 +45,12 @@ import com.android.settings.SettingsPreferenceFragment;
import com.android.settings.SetupRedactionInterstitial;
import com.android.settings.SetupWizardUtils;
import com.android.settings.Utils;
import com.android.settingslib.RestrictedLockUtils;
import com.android.settingslib.RestrictedLockUtilsInternal;
import com.google.android.setupcompat.item.FooterButton;
import com.google.android.setupcompat.template.ButtonFooterMixin;
import com.google.android.setupdesign.GlifLayout;
public class RedactionInterstitial extends SettingsActivity {
@Override
@@ -91,7 +93,7 @@ public class RedactionInterstitial extends SettingsActivity {
}
public static class RedactionInterstitialFragment extends SettingsPreferenceFragment
implements RadioGroup.OnCheckedChangeListener, View.OnClickListener {
implements RadioGroup.OnCheckedChangeListener {
private RadioGroup mRadioGroup;
private RestrictedRadioButton mShowAllButton;
@@ -130,19 +132,24 @@ public class RedactionInterstitial extends SettingsActivity {
((RadioButton) view.findViewById(R.id.hide_all)).setVisibility(View.GONE);
}
final Button button = (Button) view.findViewById(R.id.redaction_done_button);
button.setOnClickListener(this);
final GlifLayout layout = view.findViewById(R.id.setup_wizard_layout);
final ButtonFooterMixin buttonFooterMixin = layout.getMixin(ButtonFooterMixin.class);
buttonFooterMixin.setPrimaryButton(
new FooterButton.Builder(getContext())
.setText(R.string.app_notifications_dialog_done)
.setListener(this::onDoneButtonClicked)
.setButtonType(FooterButton.ButtonType.NEXT)
.setTheme(R.style.SuwGlifButton_Primary)
.build()
);
}
@Override
public void onClick(View v) {
if (v.getId() == R.id.redaction_done_button) {
SetupRedactionInterstitial.setEnabled(getContext(), false);
final RedactionInterstitial activity = (RedactionInterstitial) getActivity();
if (activity != null) {
activity.setResult(RESULT_OK, null);
finish();
}
private void onDoneButtonClicked(View view) {
SetupRedactionInterstitial.setEnabled(getContext(), false);
final RedactionInterstitial activity = (RedactionInterstitial) getActivity();
if (activity != null) {
activity.setResult(RESULT_OK, null);
finish();
}
}

View File

@@ -71,7 +71,7 @@ public class WakeLockScreenGesturePreferenceControllerTest {
@Test
public void getAvailabilityStatus_gestureNotSupported_UNSUPPORTED_ON_DEVICE() {
when(mAmbientDisplayConfiguration.wakeLockScreenGestureAvailable()).thenReturn(false);
when(mAmbientDisplayConfiguration.wakeScreenGestureAvailable()).thenReturn(false);
final int availabilityStatus = mController.getAvailabilityStatus();
assertThat(availabilityStatus).isEqualTo(UNSUPPORTED_ON_DEVICE);
@@ -79,7 +79,7 @@ public class WakeLockScreenGesturePreferenceControllerTest {
@Test
public void getAvailabilityStatus_gestureSupported_AVAILABLE() {
when(mAmbientDisplayConfiguration.wakeLockScreenGestureAvailable()).thenReturn(true);
when(mAmbientDisplayConfiguration.wakeScreenGestureAvailable()).thenReturn(true);
final int availabilityStatus = mController.getAvailabilityStatus();
assertThat(availabilityStatus).isEqualTo(AVAILABLE);

View File

@@ -35,6 +35,9 @@ import androidx.test.InstrumentationRegistry;
import androidx.test.filters.MediumTest;
import androidx.test.runner.AndroidJUnit4;
import com.google.android.setupcompat.PartnerCustomizationLayout;
import com.google.android.setupcompat.template.ButtonFooterMixin;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -63,10 +66,11 @@ public class EncryptionInterstitialTest {
@Test
public void clickYes_shouldRequirePassword() {
mInstrumentation.startActivitySync(
final Activity activity = mInstrumentation.startActivitySync(
new Intent(mContext, EncryptionInterstitial.class)
.putExtra("extra_unlock_method_intent", new Intent("test.unlock.intent")));
onView(withId(R.id.encrypt_require_password)).perform(click());
final PartnerCustomizationLayout layout = activity.findViewById(R.id.setup_wizard_layout);
layout.getMixin(ButtonFooterMixin.class).getPrimaryButtonView().performClick();
mActivityMonitor.waitForActivityWithTimeout(1000);
assertEquals(1, mActivityMonitor.getHits());
@@ -77,10 +81,11 @@ public class EncryptionInterstitialTest {
@Test
public void clickNo_shouldNotRequirePassword() {
mInstrumentation.startActivitySync(
final Activity activity = mInstrumentation.startActivitySync(
new Intent(mContext, EncryptionInterstitial.class)
.putExtra("extra_unlock_method_intent", new Intent("test.unlock.intent")));
onView(withId(R.id.encrypt_dont_require_password)).perform(click());
final PartnerCustomizationLayout layout = activity.findViewById(R.id.setup_wizard_layout);
layout.getMixin(ButtonFooterMixin.class).getSecondaryButtonView().performClick();
mActivityMonitor.waitForActivityWithTimeout(1000);
assertEquals(1, mActivityMonitor.getHits());