Launch Settings activities for lockscreen and biometrics setup
Issue: calyxos#1420 Change-Id: If6145a7f5a8bd0acc648a3b3ce4aa0d59a5157e0
This commit is contained in:
committed by
Michael Bestas
parent
11e55ab3b2
commit
86ed621eff
@@ -1,89 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2015 The CyanogenMod Project
|
||||
Copyright (C) 2017-2021 The LineageOS 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.google.android.setupdesign.GlifLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/setup_wizard_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
style="@style/SudContentFrame">
|
||||
|
||||
<FrameLayout android:id="@+id/page"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1">
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fillViewport="true">
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/setup_biometric_summary"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/SudItemContainer.Verbose"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="24dp"
|
||||
android:paddingLeft="@dimen/content_margin_left"
|
||||
android:paddingRight="@dimen/location_text_margin_right"
|
||||
android:drawableStart="@drawable/ic_check_mark"
|
||||
android:drawablePadding="24dp"
|
||||
android:gravity="center_vertical"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold"
|
||||
android:text="@string/biometric_setup_backup_lock_method"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/setup_add_biometric"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="24dp"
|
||||
android:paddingLeft="@dimen/content_margin_left"
|
||||
android:paddingRight="@dimen/location_text_margin_right"
|
||||
android:drawableStart="@drawable/ic_check_mark"
|
||||
android:drawablePadding="24dp"
|
||||
android:gravity="center_vertical"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold"/>
|
||||
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
</FrameLayout>
|
||||
|
||||
<org.lineageos.setupwizard.NavigationLayout
|
||||
android:id="@+id/navigation_bar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:showSkipButton="true" />
|
||||
|
||||
</LinearLayout>
|
||||
</com.google.android.setupdesign.GlifLayout>
|
@@ -1,43 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2015 The CyanogenMod Project
|
||||
2017-2022 The LineageOS 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.google.android.setupdesign.GlifLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/setup_wizard_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
style="@style/SudContentFrame">
|
||||
|
||||
<View android:id="@+id/page"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"/>
|
||||
|
||||
<org.lineageos.setupwizard.NavigationLayout
|
||||
android:id="@+id/navigation_bar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:showSkipButton="true" />
|
||||
|
||||
</LinearLayout>
|
||||
</com.google.android.setupdesign.GlifLayout>
|
@@ -75,28 +75,9 @@
|
||||
<string name="services_os_nav_keys_label"><b>Use on screen navigation keys</b> instead of hardware keys.</string>
|
||||
<string name="services_full_description"><xliff:g id="pp_explanation">%1$s</xliff:g>\n<xliff:g id="pp_find">%2$s</xliff:g></string>
|
||||
|
||||
<!-- Biometric setup -->
|
||||
<string name="settings_biometric_setup_title">Select backup screen lock type</string>
|
||||
<string name="settings_biometric_setup_details">How would you like to lock your screen?</string>
|
||||
<string name="fingerprint_setup_title">Fingerprint setup</string>
|
||||
<string name="fingerprint_setup_summary">To use your fingerprint sensor to unlock your screen, you\'ll need to:</string>
|
||||
<string name="fingerprint_setup_add_fingerprint">Add your fingerprint</string>
|
||||
<string name="face_setup_title">Face setup</string>
|
||||
<string name="face_setup_summary">To use your face to unlock your screen, you\'ll need to:</string>
|
||||
<string name="face_setup_add_face">Add your face</string>
|
||||
<string name="biometric_setup_backup_lock_method">Setup a secondary unlock method</string>
|
||||
<string name="biometric_setup_screen_lock_setup">Setup screen lock</string>
|
||||
<!-- Locale setup -->
|
||||
<string name="sim_locale_changed">%1$s SIM detected</string>
|
||||
|
||||
<!-- Secure lock screen -->
|
||||
<string name="settings_lockscreen_setup_title">Select screen lock type</string>
|
||||
<string name="settings_lockscreen_setup_details">How would you like to lock your screen?</string>
|
||||
<string name="lockscreen_setup_title" product="default">Protect your phone</string>
|
||||
<string name="lockscreen_setup_title" product="device">Protect your device</string>
|
||||
<string name="lockscreen_setup_title" product="tablet">Protect your tablet</string>
|
||||
<string name="lockscreen_setup_summary"><b>Protect this device</b> and require a PIN, pattern, or password to unlock the screen</string>
|
||||
<string name="lockscreen_setup_screen_lock_setup">Set up</string>
|
||||
|
||||
<!-- Backup Restore -->
|
||||
<string name="intro_restore_title">Restore apps and data</string>
|
||||
<string name="intro_restore_subtitle">If you have a backup from your last <xliff:g id="name" example="LineageOS">%s</xliff:g> device, you can restore it here.</string>
|
||||
|
@@ -18,64 +18,17 @@
|
||||
package org.lineageos.setupwizard;
|
||||
|
||||
import static org.lineageos.setupwizard.SetupWizardApp.ACTION_SETUP_LOCKSCREEN;
|
||||
import static org.lineageos.setupwizard.SetupWizardApp.EXTRA_DETAILS;
|
||||
import static org.lineageos.setupwizard.SetupWizardApp.EXTRA_TITLE;
|
||||
import static org.lineageos.setupwizard.SetupWizardApp.REQUEST_CODE_SETUP_LOCKSCREEN;
|
||||
|
||||
import android.app.KeyguardManager;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
|
||||
import org.lineageos.setupwizard.util.SetupWizardUtils;
|
||||
|
||||
public class ScreenLockActivity extends SubBaseActivity {
|
||||
public class ScreenLockActivity extends WrapperSubBaseActivity {
|
||||
|
||||
public static final String TAG = ScreenLockActivity.class.getSimpleName();
|
||||
|
||||
@Override
|
||||
protected void onNextPressed() {
|
||||
launchLockscreenSetup();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStartSubactivity() {
|
||||
if (isKeyguardSecure()) {
|
||||
Log.v(TAG, "Screen lock already set up; skipping ScreenLockActivity");
|
||||
nextAction(RESULT_OK);
|
||||
SetupWizardUtils.disableComponent(this, ScreenLockActivity.class);
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
getGlifLayout().setDescriptionText(getString(R.string.lockscreen_setup_summary));
|
||||
setNextAllowed(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getLayoutResId() {
|
||||
return R.layout.setup_lockscreen;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getTitleResId() {
|
||||
return R.string.lockscreen_setup_title;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getIconResId() {
|
||||
return R.drawable.ic_lock_screen;
|
||||
}
|
||||
|
||||
private void launchLockscreenSetup() {
|
||||
Intent intent = new Intent(ACTION_SETUP_LOCKSCREEN);
|
||||
intent.putExtra(EXTRA_TITLE,
|
||||
getString(R.string.settings_lockscreen_setup_title));
|
||||
intent.putExtra(EXTRA_DETAILS,
|
||||
getString(R.string.settings_lockscreen_setup_details));
|
||||
startSubactivity(intent, REQUEST_CODE_SETUP_LOCKSCREEN);
|
||||
}
|
||||
|
||||
private boolean isKeyguardSecure() {
|
||||
return getSystemService(KeyguardManager.class).isKeyguardSecure();
|
||||
}
|
||||
}
|
||||
|
@@ -56,6 +56,7 @@ import org.lineageos.internal.util.PackageManagerUtils;
|
||||
import org.lineageos.setupwizard.BiometricActivity;
|
||||
import org.lineageos.setupwizard.BluetoothSetupActivity;
|
||||
import org.lineageos.setupwizard.NetworkSetupActivity;
|
||||
import org.lineageos.setupwizard.ScreenLockActivity;
|
||||
import org.lineageos.setupwizard.SetupWizardApp;
|
||||
import org.lineageos.setupwizard.SimMissingActivity;
|
||||
import org.lineageos.setupwizard.wizardmanager.WizardManager;
|
||||
@@ -277,6 +278,8 @@ public class SetupWizardUtils {
|
||||
}
|
||||
if (!hasBiometric(context)) {
|
||||
disableComponent(context, BiometricActivity.class);
|
||||
} else {
|
||||
disableComponent(context, ScreenLockActivity.class);
|
||||
}
|
||||
if (!hasTelephony(context) || !simMissing()) {
|
||||
disableComponent(context, SimMissingActivity.class);
|
||||
|
Reference in New Issue
Block a user