Snap for 11486370 from a8d381dce0
to 24Q2-release
Change-Id: Iadf21010dc7eed11e29cec0a1d50a372fe46afa7
This commit is contained in:
@@ -29,6 +29,9 @@
|
|||||||
android:paddingStart="@dimen/search_bar_padding_start_two_pane"
|
android:paddingStart="@dimen/search_bar_padding_start_two_pane"
|
||||||
android:paddingEnd="@dimen/search_bar_padding_end_two_pane"
|
android:paddingEnd="@dimen/search_bar_padding_end_two_pane"
|
||||||
android:background="@drawable/search_bar_selected_background"
|
android:background="@drawable/search_bar_selected_background"
|
||||||
|
android:focusable="true"
|
||||||
|
android:focusableInTouchMode="true"
|
||||||
|
android:nextFocusForward="@+id/homepage_container"
|
||||||
android:contentInsetStartWithNavigation="@dimen/search_bar_content_inset"
|
android:contentInsetStartWithNavigation="@dimen/search_bar_content_inset"
|
||||||
android:navigationIcon="@drawable/ic_homepage_search">
|
android:navigationIcon="@drawable/ic_homepage_search">
|
||||||
<TextView
|
<TextView
|
||||||
@@ -40,4 +43,4 @@
|
|||||||
android:layout_gravity="start"
|
android:layout_gravity="start"
|
||||||
android:text="@string/search_settings"/>
|
android:text="@string/search_settings"/>
|
||||||
</Toolbar>
|
</Toolbar>
|
||||||
</com.google.android.material.card.MaterialCardView>
|
</com.google.android.material.card.MaterialCardView>
|
||||||
|
@@ -679,6 +679,13 @@
|
|||||||
<!-- The ratio to use when using the two-pane settings layout -->
|
<!-- The ratio to use when using the two-pane settings layout -->
|
||||||
<item name="config_activity_embed_split_ratio" format="float" type="dimen">0.3636</item>
|
<item name="config_activity_embed_split_ratio" format="float" type="dimen">0.3636</item>
|
||||||
|
|
||||||
|
<!-- The smallest value of the smallest-width (sw) of the window in any rotation when the split
|
||||||
|
should be used. -->
|
||||||
|
<integer name="config_activity_embed_split_min_sw_dp">600</integer>
|
||||||
|
|
||||||
|
<!-- The smallest value of current width of the window when the split should be used. -->
|
||||||
|
<integer name="config_activity_embed_split_min_cur_dp">720</integer>
|
||||||
|
|
||||||
<!-- The number of visible app icons while entering app list related pages for preloading.
|
<!-- The number of visible app icons while entering app list related pages for preloading.
|
||||||
Take the "Unrestricted data" page as the example, the visible app icons could be 15
|
Take the "Unrestricted data" page as the example, the visible app icons could be 15
|
||||||
on 6.4 inches screen size whether the font size and display size are both small. -->
|
on 6.4 inches screen size whether the font size and display size are both small. -->
|
||||||
|
@@ -132,6 +132,8 @@
|
|||||||
<string name="bluetooth_pairing_pref_title">Pair new device</string>
|
<string name="bluetooth_pairing_pref_title">Pair new device</string>
|
||||||
<!-- Keywords for bluetooth pairing item [CHAR LIMIT=30] -->
|
<!-- Keywords for bluetooth pairing item [CHAR LIMIT=30] -->
|
||||||
<string name="keywords_add_bt_device">bluetooth</string>
|
<string name="keywords_add_bt_device">bluetooth</string>
|
||||||
|
<!-- Title for bluetooth auto on toggle [CHAR LIMIT=60] -->
|
||||||
|
<string name="bluetooth_screen_auto_on_title">Automatically turn on again tomorrow</string>
|
||||||
|
|
||||||
|
|
||||||
<!-- Button to help user to pair right ear of the hearing aid device. It will show when only one of the hearing aid device set is connected. [CHAR LIMIT=20] -->
|
<!-- Button to help user to pair right ear of the hearing aid device. It will show when only one of the hearing aid device set is connected. [CHAR LIMIT=20] -->
|
||||||
@@ -1370,6 +1372,12 @@
|
|||||||
<string name="private_space_choose_your_password_header">Set a password for your private space</string>
|
<string name="private_space_choose_your_password_header">Set a password for your private space</string>
|
||||||
<!-- Header for private space choose your pattern screen [CHAR LIMIT=40] -->
|
<!-- Header for private space choose your pattern screen [CHAR LIMIT=40] -->
|
||||||
<string name="private_space_choose_your_pattern_header">Set a pattern for your private space</string>
|
<string name="private_space_choose_your_pattern_header">Set a pattern for your private space</string>
|
||||||
|
<!-- Header for private space apps and notifications section [CHAR LIMIT=40] -->
|
||||||
|
<string name="private_space_apps_and_notifications_header">Apps and notifications</string>
|
||||||
|
<!-- Title for private space sensitive notifications toggle [CHAR LIMIT=80] -->
|
||||||
|
<string name="private_space_notifications_title">Sensitive notifications on lock screen</string>
|
||||||
|
<!-- Summary description for private space sensitive notifications toggle [CHAR LIMIT=200] -->
|
||||||
|
<string name="private_space_sensitive_notifications_description">Show sensitive content when private space is unlocked</string>
|
||||||
|
|
||||||
<!-- Text shown when "Add fingerprint" button is disabled -->
|
<!-- Text shown when "Add fingerprint" button is disabled -->
|
||||||
<string name="fingerprint_add_max">You can add up to <xliff:g id="count" example="5">%d</xliff:g> fingerprints</string>
|
<string name="fingerprint_add_max">You can add up to <xliff:g id="count" example="5">%d</xliff:g> fingerprints</string>
|
||||||
@@ -1800,8 +1808,12 @@
|
|||||||
<string name="bluetooth_device_context_pair_connect">Pair & connect</string>
|
<string name="bluetooth_device_context_pair_connect">Pair & connect</string>
|
||||||
<!-- Bluetooth settings. Text displayed when Bluetooth is off and device list is empty [CHAR LIMIT=NONE]-->
|
<!-- Bluetooth settings. Text displayed when Bluetooth is off and device list is empty [CHAR LIMIT=NONE]-->
|
||||||
<string name="bluetooth_empty_list_bluetooth_off">When Bluetooth is turned on, your device can communicate with other nearby Bluetooth devices</string>
|
<string name="bluetooth_empty_list_bluetooth_off">When Bluetooth is turned on, your device can communicate with other nearby Bluetooth devices</string>
|
||||||
|
<!-- Bluetooth settings. Text displayed when Bluetooth is off and device list is empty when auto-on feature is enabled [CHAR LIMIT=NONE]-->
|
||||||
|
<string name="bluetooth_empty_list_bluetooth_off_auto_on_available">When Bluetooth is on, your device can communicate with other nearby Bluetooth devices. Features like Quick Share, Find My Device, and device location use Bluetooth.</string>
|
||||||
<!-- Bluetooth settings. Text displayed when Bluetooth is off and bluetooth scanning is turned on [CHAR LIMIT=NONE] -->
|
<!-- Bluetooth settings. Text displayed when Bluetooth is off and bluetooth scanning is turned on [CHAR LIMIT=NONE] -->
|
||||||
<string name="bluetooth_scanning_on_info_message">When Bluetooth is turned on, your device can communicate with other nearby Bluetooth devices.\n\nTo improve device experience, apps and services can still scan for nearby devices at any time, even when Bluetooth is off. This can be used, for example, to improve location-based features and services. You can change this in Bluetooth scanning settings.</string>
|
<string name="bluetooth_scanning_on_info_message">When Bluetooth is turned on, your device can communicate with other nearby Bluetooth devices.\n\nTo improve device experience, apps and services can still scan for nearby devices at any time, even when Bluetooth is off. This can be used, for example, to improve location-based features and services. You can change this in Bluetooth scanning settings.</string>
|
||||||
|
<!-- Bluetooth settings. Text displayed when Bluetooth is off and bluetooth scanning is turned on [CHAR LIMIT=NONE] -->
|
||||||
|
<string name="bluetooth_scanning_on_info_message_auto_on_available">When Bluetooth is on, your device can communicate with other nearby Bluetooth devices. Features like Quick Share, Find My Device, and device location use Bluetooth.\n\nApps and services can still scan for nearby devices at any time, even when Bluetooth is off. This can be used, for example, to improve location-based features and services. You can change this in Bluetooth scanning settings.</string>
|
||||||
<!-- Bluetooth settings. Link text to bring the user to "scanning settings" screen. [CHAR LIMIT=NONE]-->
|
<!-- Bluetooth settings. Link text to bring the user to "scanning settings" screen. [CHAR LIMIT=NONE]-->
|
||||||
<string name="bluetooth_scan_change">Change</string>
|
<string name="bluetooth_scan_change">Change</string>
|
||||||
|
|
||||||
@@ -5144,7 +5156,7 @@
|
|||||||
<!-- Title for accessibility hearing device page footer. [CHAR LIMIT=40] -->
|
<!-- Title for accessibility hearing device page footer. [CHAR LIMIT=40] -->
|
||||||
<string name="accessibility_hearing_device_about_title">About hearing devices</string>
|
<string name="accessibility_hearing_device_about_title">About hearing devices</string>
|
||||||
<!-- Description for text in accessibility hearing aids footer. [CHAR LIMIT=NONE] -->
|
<!-- Description for text in accessibility hearing aids footer. [CHAR LIMIT=NONE] -->
|
||||||
<string name="accessibility_hearing_device_footer_summary">Make sure your hearing device is turned on and ready to pair</string>
|
<string name="accessibility_hearing_device_footer_summary">Make sure your hearing device is turned on and ready to pair. Only ASHA and LE Audio hearing devices show on this page.</string>
|
||||||
<!-- Title for the pair hearing device page. [CHAR LIMIT=25] -->
|
<!-- Title for the pair hearing device page. [CHAR LIMIT=25] -->
|
||||||
<string name="accessibility_hearing_device_pairing_page_title">Pair hearing device</string>
|
<string name="accessibility_hearing_device_pairing_page_title">Pair hearing device</string>
|
||||||
<!-- Title for the preference category containing the list of the available hearing during and after bluetooth scanning devices. [CHAR LIMIT=30] -->
|
<!-- Title for the preference category containing the list of the available hearing during and after bluetooth scanning devices. [CHAR LIMIT=30] -->
|
||||||
@@ -11580,7 +11592,7 @@
|
|||||||
<string name="primary_sim_calls_title">Calls</string>
|
<string name="primary_sim_calls_title">Calls</string>
|
||||||
<!-- Title of Texts item/dialog at dual sim onboarding's primary sim page or SIMs page. [CHAR LIMIT=30] -->
|
<!-- Title of Texts item/dialog at dual sim onboarding's primary sim page or SIMs page. [CHAR LIMIT=30] -->
|
||||||
<string name="primary_sim_texts_title">Texts</string>
|
<string name="primary_sim_texts_title">Texts</string>
|
||||||
<!-- Title of automatic data switching at dual sim onboarding's primary sim page or SIMs page. [CHAR LIMIT=30] -->
|
<!-- Title of automatic data switching at dual sim onboarding's primary sim page or SIMs page. [CHAR LIMIT=60] -->
|
||||||
<string name="primary_sim_automatic_data_title">Automatic data switching</string>
|
<string name="primary_sim_automatic_data_title">Automatic data switching</string>
|
||||||
<!-- Body text of automatic data switching at dual sim onboarding's primary sim page or SIMs page. [CHAR LIMIT=NONE] -->
|
<!-- Body text of automatic data switching at dual sim onboarding's primary sim page or SIMs page. [CHAR LIMIT=NONE] -->
|
||||||
<string name="primary_sim_automatic_data_msg">Use data from either SIM depending on coverage and availability</string>
|
<string name="primary_sim_automatic_data_msg">Use data from either SIM depending on coverage and availability</string>
|
||||||
|
@@ -18,6 +18,11 @@
|
|||||||
xmlns:settings="http://schemas.android.com/apk/res-auto"
|
xmlns:settings="http://schemas.android.com/apk/res-auto"
|
||||||
android:title="@string/bluetooth_settings_title">
|
android:title="@string/bluetooth_settings_title">
|
||||||
|
|
||||||
|
<SwitchPreferenceCompat
|
||||||
|
android:key="bluetooth_auto_on_settings_toggle"
|
||||||
|
android:title="@string/bluetooth_screen_auto_on_title"
|
||||||
|
settings:controller="com.android.settings.bluetooth.BluetoothAutoOnPreferenceController"/>
|
||||||
|
|
||||||
<Preference
|
<Preference
|
||||||
android:key="bluetooth_screen_bt_pair_rename_devices"
|
android:key="bluetooth_screen_bt_pair_rename_devices"
|
||||||
android:title="@string/bluetooth_device_name"
|
android:title="@string/bluetooth_device_name"
|
||||||
|
@@ -57,7 +57,7 @@
|
|||||||
settings:controller="com.android.settings.datetime.LocationProviderStatusPreferenceController"/>
|
settings:controller="com.android.settings.datetime.LocationProviderStatusPreferenceController"/>
|
||||||
|
|
||||||
<!-- This preference gets removed if location-based time zone detection is not supported -->
|
<!-- This preference gets removed if location-based time zone detection is not supported -->
|
||||||
<SwitchPreference
|
<SwitchPreferenceCompat
|
||||||
android:key="location_time_zone_detection"
|
android:key="location_time_zone_detection"
|
||||||
android:title="@string/location_time_zone_detection_toggle_title"
|
android:title="@string/location_time_zone_detection_toggle_title"
|
||||||
settings:controller="com.android.settings.datetime.LocationTimeZoneDetectionPreferenceController"/>
|
settings:controller="com.android.settings.datetime.LocationTimeZoneDetectionPreferenceController"/>
|
||||||
@@ -77,12 +77,12 @@
|
|||||||
android:key="time_format_preference_category"
|
android:key="time_format_preference_category"
|
||||||
android:title="@string/time_format_category_title"
|
android:title="@string/time_format_category_title"
|
||||||
settings:keywords="@string/keywords_time_format">
|
settings:keywords="@string/keywords_time_format">
|
||||||
<SwitchPreference
|
<SwitchPreferenceCompat
|
||||||
android:key="auto_24hour"
|
android:key="auto_24hour"
|
||||||
android:title="@string/date_time_24hour_auto"
|
android:title="@string/date_time_24hour_auto"
|
||||||
settings:controller="com.android.settings.datetime.AutoTimeFormatPreferenceController" />
|
settings:controller="com.android.settings.datetime.AutoTimeFormatPreferenceController" />
|
||||||
|
|
||||||
<SwitchPreference
|
<SwitchPreferenceCompat
|
||||||
android:key="24 hour"
|
android:key="24 hour"
|
||||||
android:title="@string/date_time_24hour"
|
android:title="@string/date_time_24hour"
|
||||||
settings:controller="com.android.settings.datetime.TimeFormatPreferenceController" />
|
settings:controller="com.android.settings.datetime.TimeFormatPreferenceController" />
|
||||||
|
@@ -59,6 +59,17 @@
|
|||||||
|
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
|
||||||
|
<PreferenceCategory
|
||||||
|
android:title="@string/private_space_apps_and_notifications_header">
|
||||||
|
|
||||||
|
<com.android.settingslib.RestrictedSwitchPreference
|
||||||
|
android:key="private_space_sensitive_notifications"
|
||||||
|
android:title="@string/private_space_notifications_title"
|
||||||
|
android:summary="@string/private_space_sensitive_notifications_description"
|
||||||
|
settings:controller="com.android.settings.privatespace.HidePrivateSpaceSensitiveNotificationsController" />
|
||||||
|
|
||||||
|
</PreferenceCategory>
|
||||||
|
|
||||||
<PreferenceCategory
|
<PreferenceCategory
|
||||||
android:title="@string/private_space_category_system">
|
android:title="@string/private_space_category_system">
|
||||||
|
|
||||||
|
@@ -113,8 +113,9 @@ public class ActivityEmbeddingRulesController {
|
|||||||
.setFinishPrimaryWithSecondary(finishPrimaryWithSecondary)
|
.setFinishPrimaryWithSecondary(finishPrimaryWithSecondary)
|
||||||
.setFinishSecondaryWithPrimary(finishSecondaryWithPrimary)
|
.setFinishSecondaryWithPrimary(finishSecondaryWithPrimary)
|
||||||
.setClearTop(clearTop)
|
.setClearTop(clearTop)
|
||||||
.setMinWidthDp(ActivityEmbeddingUtils.getMinCurrentScreenSplitWidthDp())
|
.setMinWidthDp(ActivityEmbeddingUtils.getMinCurrentScreenSplitWidthDp(context))
|
||||||
.setMinSmallestWidthDp(ActivityEmbeddingUtils.getMinSmallestScreenSplitWidthDp())
|
.setMinSmallestWidthDp(
|
||||||
|
ActivityEmbeddingUtils.getMinSmallestScreenSplitWidthDp(context))
|
||||||
.setMaxAspectRatioInPortrait(EmbeddingAspectRatio.ALWAYS_ALLOW)
|
.setMaxAspectRatioInPortrait(EmbeddingAspectRatio.ALWAYS_ALLOW)
|
||||||
.setDefaultSplitAttributes(attributes)
|
.setDefaultSplitAttributes(attributes)
|
||||||
.build();
|
.build();
|
||||||
@@ -234,8 +235,9 @@ public class ActivityEmbeddingRulesController {
|
|||||||
.build();
|
.build();
|
||||||
final SplitPlaceholderRule placeholderRule = new SplitPlaceholderRule.Builder(
|
final SplitPlaceholderRule placeholderRule = new SplitPlaceholderRule.Builder(
|
||||||
activityFilters, intent)
|
activityFilters, intent)
|
||||||
.setMinWidthDp(ActivityEmbeddingUtils.getMinCurrentScreenSplitWidthDp())
|
.setMinWidthDp(ActivityEmbeddingUtils.getMinCurrentScreenSplitWidthDp(mContext))
|
||||||
.setMinSmallestWidthDp(ActivityEmbeddingUtils.getMinSmallestScreenSplitWidthDp())
|
.setMinSmallestWidthDp(
|
||||||
|
ActivityEmbeddingUtils.getMinSmallestScreenSplitWidthDp(mContext))
|
||||||
.setMaxAspectRatioInPortrait(EmbeddingAspectRatio.ALWAYS_ALLOW)
|
.setMaxAspectRatioInPortrait(EmbeddingAspectRatio.ALWAYS_ALLOW)
|
||||||
.setSticky(false)
|
.setSticky(false)
|
||||||
.setFinishPrimaryWithPlaceholder(SplitRule.FinishBehavior.ADJACENT)
|
.setFinishPrimaryWithPlaceholder(SplitRule.FinishBehavior.ADJACENT)
|
||||||
|
@@ -33,11 +33,6 @@ import com.google.android.setupcompat.util.WizardManagerHelper;
|
|||||||
|
|
||||||
/** An util class collecting all common methods for the embedding activity features. */
|
/** An util class collecting all common methods for the embedding activity features. */
|
||||||
public class ActivityEmbeddingUtils {
|
public class ActivityEmbeddingUtils {
|
||||||
// The smallest value of current width of the window when the split should be used.
|
|
||||||
private static final int MIN_CURRENT_SCREEN_SPLIT_WIDTH_DP = 720;
|
|
||||||
// The smallest value of the smallest-width (sw) of the window in any rotation when
|
|
||||||
// the split should be used.
|
|
||||||
private static final int MIN_SMALLEST_SCREEN_SPLIT_WIDTH_DP = 600;
|
|
||||||
// The minimum width of the activity to show the regular homepage layout.
|
// The minimum width of the activity to show the regular homepage layout.
|
||||||
private static final float MIN_REGULAR_HOMEPAGE_LAYOUT_WIDTH_DP = 380f;
|
private static final float MIN_REGULAR_HOMEPAGE_LAYOUT_WIDTH_DP = 380f;
|
||||||
|
|
||||||
@@ -58,16 +53,16 @@ public class ActivityEmbeddingUtils {
|
|||||||
private static final String TAG = "ActivityEmbeddingUtils";
|
private static final String TAG = "ActivityEmbeddingUtils";
|
||||||
|
|
||||||
/** Get the smallest width dp of the window when the split should be used. */
|
/** Get the smallest width dp of the window when the split should be used. */
|
||||||
public static int getMinCurrentScreenSplitWidthDp() {
|
public static int getMinCurrentScreenSplitWidthDp(Context context) {
|
||||||
return MIN_CURRENT_SCREEN_SPLIT_WIDTH_DP;
|
return context.getResources().getInteger(R.integer.config_activity_embed_split_min_cur_dp);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the smallest dp value of the smallest-width (sw) of the window in any rotation when
|
* Get the smallest dp value of the smallest-width (sw) of the window in any rotation when
|
||||||
* the split should be used.
|
* the split should be used.
|
||||||
*/
|
*/
|
||||||
public static int getMinSmallestScreenSplitWidthDp() {
|
public static int getMinSmallestScreenSplitWidthDp(Context context) {
|
||||||
return MIN_SMALLEST_SCREEN_SPLIT_WIDTH_DP;
|
return context.getResources().getInteger(R.integer.config_activity_embed_split_min_sw_dp);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -25,6 +25,7 @@ import android.app.admin.DevicePolicyManager;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.IntentSender;
|
import android.content.IntentSender;
|
||||||
|
import android.hardware.biometrics.BiometricManager;
|
||||||
import android.hardware.biometrics.SensorProperties;
|
import android.hardware.biometrics.SensorProperties;
|
||||||
import android.hardware.face.FaceManager;
|
import android.hardware.face.FaceManager;
|
||||||
import android.hardware.face.FaceSensorPropertiesInternal;
|
import android.hardware.face.FaceSensorPropertiesInternal;
|
||||||
@@ -65,6 +66,7 @@ import java.lang.annotation.RetentionPolicy;
|
|||||||
*/
|
*/
|
||||||
public class BiometricUtils {
|
public class BiometricUtils {
|
||||||
private static final String TAG = "BiometricUtils";
|
private static final String TAG = "BiometricUtils";
|
||||||
|
public static final String EXTRA_ENROLL_REASON = BiometricManager.EXTRA_ENROLL_REASON;
|
||||||
|
|
||||||
/** The character ' • ' to separate the setup choose options */
|
/** The character ' • ' to separate the setup choose options */
|
||||||
public static final String SEPARATOR = " \u2022 ";
|
public static final String SEPARATOR = " \u2022 ";
|
||||||
|
@@ -265,6 +265,8 @@ public class FaceEnrollEducation extends BiometricEnrollBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
intent.putExtra(EXTRA_KEY_REQUIRE_DIVERSITY, !mSwitchDiversity.isChecked());
|
intent.putExtra(EXTRA_KEY_REQUIRE_DIVERSITY, !mSwitchDiversity.isChecked());
|
||||||
|
intent.putExtra(BiometricUtils.EXTRA_ENROLL_REASON,
|
||||||
|
getIntent().getIntExtra(BiometricUtils.EXTRA_ENROLL_REASON, -1));
|
||||||
|
|
||||||
if (!mSwitchDiversity.isChecked() && mAccessibilityEnabled) {
|
if (!mSwitchDiversity.isChecked() && mAccessibilityEnabled) {
|
||||||
FaceEnrollAccessibilityDialog dialog = FaceEnrollAccessibilityDialog.newInstance();
|
FaceEnrollAccessibilityDialog dialog = FaceEnrollAccessibilityDialog.newInstance();
|
||||||
|
@@ -165,7 +165,7 @@ public class FaceEnrollEnrolling extends BiometricsEnrollEnrolling {
|
|||||||
disabledFeatures[i] = mDisabledFeatures.get(i);
|
disabledFeatures[i] = mDisabledFeatures.get(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new FaceEnrollSidecar(disabledFeatures);
|
return new FaceEnrollSidecar(disabledFeatures, getIntent());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -484,6 +484,9 @@ public class FaceEnrollIntroduction extends BiometricEnrollIntroduction {
|
|||||||
protected Intent getEnrollingIntent() {
|
protected Intent getEnrollingIntent() {
|
||||||
Intent intent = new Intent(this, FaceEnrollEducation.class);
|
Intent intent = new Intent(this, FaceEnrollEducation.class);
|
||||||
WizardManagerHelper.copyWizardManagerExtras(getIntent(), intent);
|
WizardManagerHelper.copyWizardManagerExtras(getIntent(), intent);
|
||||||
|
intent.putExtra(BiometricUtils.EXTRA_ENROLL_REASON,
|
||||||
|
getIntent().getIntExtra(BiometricUtils.EXTRA_ENROLL_REASON, -1));
|
||||||
|
|
||||||
return intent;
|
return intent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -18,6 +18,7 @@ package com.android.settings.biometrics.face;
|
|||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.settings.SettingsEnums;
|
import android.app.settings.SettingsEnums;
|
||||||
|
import android.content.Intent;
|
||||||
import android.hardware.face.FaceManager;
|
import android.hardware.face.FaceManager;
|
||||||
|
|
||||||
import com.android.settings.biometrics.BiometricEnrollSidecar;
|
import com.android.settings.biometrics.BiometricEnrollSidecar;
|
||||||
@@ -33,8 +34,11 @@ public class FaceEnrollSidecar extends BiometricEnrollSidecar {
|
|||||||
|
|
||||||
private FaceUpdater mFaceUpdater;
|
private FaceUpdater mFaceUpdater;
|
||||||
|
|
||||||
public FaceEnrollSidecar(int[] disabledFeatures) {
|
private Intent mIntent;
|
||||||
|
|
||||||
|
public FaceEnrollSidecar(int[] disabledFeatures, Intent intent) {
|
||||||
mDisabledFeatures = Arrays.copyOf(disabledFeatures, disabledFeatures.length);
|
mDisabledFeatures = Arrays.copyOf(disabledFeatures, disabledFeatures.length);
|
||||||
|
mIntent = intent;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -47,7 +51,7 @@ public class FaceEnrollSidecar extends BiometricEnrollSidecar {
|
|||||||
public void startEnrollment() {
|
public void startEnrollment() {
|
||||||
super.startEnrollment();
|
super.startEnrollment();
|
||||||
mFaceUpdater.enroll(mUserId, mToken, mEnrollmentCancel,
|
mFaceUpdater.enroll(mUserId, mToken, mEnrollmentCancel,
|
||||||
mEnrollmentCallback, mDisabledFeatures);
|
mEnrollmentCallback, mDisabledFeatures, mIntent);
|
||||||
}
|
}
|
||||||
|
|
||||||
private FaceManager.EnrollmentCallback mEnrollmentCallback
|
private FaceManager.EnrollmentCallback mEnrollmentCallback
|
||||||
|
@@ -17,8 +17,10 @@
|
|||||||
package com.android.settings.biometrics.face;
|
package com.android.settings.biometrics.face;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
import android.hardware.face.Face;
|
import android.hardware.face.Face;
|
||||||
import android.hardware.face.FaceEnrollCell;
|
import android.hardware.face.FaceEnrollCell;
|
||||||
|
import android.hardware.face.FaceEnrollOptions;
|
||||||
import android.hardware.face.FaceManager;
|
import android.hardware.face.FaceManager;
|
||||||
import android.os.CancellationSignal;
|
import android.os.CancellationSignal;
|
||||||
import android.view.Surface;
|
import android.view.Surface;
|
||||||
@@ -26,6 +28,7 @@ import android.view.Surface;
|
|||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
import com.android.settings.Utils;
|
import com.android.settings.Utils;
|
||||||
|
import com.android.settings.biometrics.BiometricUtils;
|
||||||
import com.android.settings.safetycenter.BiometricsSafetySource;
|
import com.android.settings.safetycenter.BiometricsSafetySource;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -49,19 +52,19 @@ public class FaceUpdater {
|
|||||||
|
|
||||||
/** Wrapper around the {@link FaceManager#enroll} method. */
|
/** Wrapper around the {@link FaceManager#enroll} method. */
|
||||||
public void enroll(int userId, byte[] hardwareAuthToken, CancellationSignal cancel,
|
public void enroll(int userId, byte[] hardwareAuthToken, CancellationSignal cancel,
|
||||||
FaceManager.EnrollmentCallback callback, int[] disabledFeatures) {
|
FaceManager.EnrollmentCallback callback, int[] disabledFeatures, Intent intent) {
|
||||||
this.enroll(userId, hardwareAuthToken, cancel,
|
this.enroll(userId, hardwareAuthToken, cancel,
|
||||||
new NotifyingEnrollmentCallback(mContext, callback), disabledFeatures,
|
new NotifyingEnrollmentCallback(mContext, callback), disabledFeatures,
|
||||||
null, false);
|
null, false, intent);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Wrapper around the {@link FaceManager#enroll} method. */
|
/** Wrapper around the {@link FaceManager#enroll} method. */
|
||||||
public void enroll(int userId, byte[] hardwareAuthToken, CancellationSignal cancel,
|
public void enroll(int userId, byte[] hardwareAuthToken, CancellationSignal cancel,
|
||||||
FaceManager.EnrollmentCallback callback, int[] disabledFeatures,
|
FaceManager.EnrollmentCallback callback, int[] disabledFeatures,
|
||||||
@Nullable Surface previewSurface, boolean debugConsent) {
|
@Nullable Surface previewSurface, boolean debugConsent, Intent intent) {
|
||||||
mFaceManager.enroll(userId, hardwareAuthToken, cancel,
|
mFaceManager.enroll(userId, hardwareAuthToken, cancel,
|
||||||
new NotifyingEnrollmentCallback(mContext, callback), disabledFeatures,
|
new NotifyingEnrollmentCallback(mContext, callback), disabledFeatures,
|
||||||
previewSurface, debugConsent);
|
previewSurface, debugConsent, toFaceEnrollOptions(intent));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Wrapper around the {@link FaceManager#remove} method. */
|
/** Wrapper around the {@link FaceManager#remove} method. */
|
||||||
@@ -135,4 +138,14 @@ public class FaceUpdater {
|
|||||||
BiometricsSafetySource.onBiometricsChanged(mContext); // biometrics data changed
|
BiometricsSafetySource.onBiometricsChanged(mContext); // biometrics data changed
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private FaceEnrollOptions toFaceEnrollOptions(Intent intent) {
|
||||||
|
final int reason = intent.getIntExtra(BiometricUtils.EXTRA_ENROLL_REASON, -1);
|
||||||
|
final FaceEnrollOptions.Builder builder = new FaceEnrollOptions.Builder();
|
||||||
|
builder.setEnrollReason(FaceEnrollOptions.ENROLL_REASON_UNKNOWN);
|
||||||
|
if (reason != -1) {
|
||||||
|
builder.setEnrollReason(reason);
|
||||||
|
}
|
||||||
|
return builder.build();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -352,7 +352,7 @@ public class FingerprintEnrollEnrolling extends BiometricsEnrollEnrolling {
|
|||||||
@Override
|
@Override
|
||||||
protected BiometricEnrollSidecar getSidecar() {
|
protected BiometricEnrollSidecar getSidecar() {
|
||||||
final FingerprintEnrollSidecar sidecar = new FingerprintEnrollSidecar(this,
|
final FingerprintEnrollSidecar sidecar = new FingerprintEnrollSidecar(this,
|
||||||
FingerprintManager.ENROLL_ENROLL);
|
FingerprintManager.ENROLL_ENROLL, getIntent());
|
||||||
return sidecar;
|
return sidecar;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -292,6 +292,8 @@ public class FingerprintEnrollFindSensor extends BiometricEnrollBase implements
|
|||||||
@Override
|
@Override
|
||||||
protected Intent getFingerprintEnrollingIntent() {
|
protected Intent getFingerprintEnrollingIntent() {
|
||||||
final Intent ret = super.getFingerprintEnrollingIntent();
|
final Intent ret = super.getFingerprintEnrollingIntent();
|
||||||
|
ret.putExtra(BiometricUtils.EXTRA_ENROLL_REASON,
|
||||||
|
getIntent().getIntExtra(BiometricUtils.EXTRA_ENROLL_REASON, -1));
|
||||||
if (Flags.udfpsEnrollCalibration()) {
|
if (Flags.udfpsEnrollCalibration()) {
|
||||||
if (mCalibrator != null) {
|
if (mCalibrator != null) {
|
||||||
ret.putExtras(mCalibrator.getExtrasForNextIntent(true));
|
ret.putExtras(mCalibrator.getExtrasForNextIntent(true));
|
||||||
@@ -349,7 +351,7 @@ public class FingerprintEnrollFindSensor extends BiometricEnrollBase implements
|
|||||||
FingerprintEnrollEnrolling.TAG_SIDECAR);
|
FingerprintEnrollEnrolling.TAG_SIDECAR);
|
||||||
if (mSidecar == null) {
|
if (mSidecar == null) {
|
||||||
mSidecar = new FingerprintEnrollSidecar(this,
|
mSidecar = new FingerprintEnrollSidecar(this,
|
||||||
FingerprintManager.ENROLL_FIND_SENSOR);
|
FingerprintManager.ENROLL_FIND_SENSOR, getIntent());
|
||||||
getSupportFragmentManager().beginTransaction()
|
getSupportFragmentManager().beginTransaction()
|
||||||
.add(mSidecar, FingerprintEnrollEnrolling.TAG_SIDECAR)
|
.add(mSidecar, FingerprintEnrollEnrolling.TAG_SIDECAR)
|
||||||
.commitAllowingStateLoss();
|
.commitAllowingStateLoss();
|
||||||
|
@@ -59,7 +59,6 @@ import com.google.android.setupdesign.util.DeviceHelper;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class FingerprintEnrollIntroduction extends BiometricEnrollIntroduction {
|
public class FingerprintEnrollIntroduction extends BiometricEnrollIntroduction {
|
||||||
|
|
||||||
private static final String TAG = "FingerprintIntro";
|
private static final String TAG = "FingerprintIntro";
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
@@ -388,6 +387,8 @@ public class FingerprintEnrollIntroduction extends BiometricEnrollIntroduction {
|
|||||||
intent.putExtras(mCalibrator.getExtrasForNextIntent(false));
|
intent.putExtras(mCalibrator.getExtrasForNextIntent(false));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
intent.putExtra(BiometricUtils.EXTRA_ENROLL_REASON,
|
||||||
|
getIntent().getIntExtra(BiometricUtils.EXTRA_ENROLL_REASON, -1));
|
||||||
return intent;
|
return intent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -21,6 +21,8 @@ import static android.hardware.fingerprint.FingerprintManager.ENROLL_ENROLL;
|
|||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.settings.SettingsEnums;
|
import android.app.settings.SettingsEnums;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.hardware.fingerprint.FingerprintEnrollOptions;
|
||||||
import android.hardware.fingerprint.FingerprintManager;
|
import android.hardware.fingerprint.FingerprintManager;
|
||||||
import android.os.SystemClock;
|
import android.os.SystemClock;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
@@ -28,6 +30,9 @@ import android.util.Log;
|
|||||||
import com.android.internal.annotations.VisibleForTesting;
|
import com.android.internal.annotations.VisibleForTesting;
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
import com.android.settings.biometrics.BiometricEnrollSidecar;
|
import com.android.settings.biometrics.BiometricEnrollSidecar;
|
||||||
|
import com.android.settings.biometrics.BiometricUtils;
|
||||||
|
|
||||||
|
import com.google.android.setupcompat.util.WizardManagerHelper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sidecar fragment to handle the state around fingerprint enrollment.
|
* Sidecar fragment to handle the state around fingerprint enrollment.
|
||||||
@@ -39,15 +44,18 @@ public class FingerprintEnrollSidecar extends BiometricEnrollSidecar {
|
|||||||
private @FingerprintManager.EnrollReason int mEnrollReason;
|
private @FingerprintManager.EnrollReason int mEnrollReason;
|
||||||
private final MessageDisplayController mMessageDisplayController;
|
private final MessageDisplayController mMessageDisplayController;
|
||||||
private final boolean mMessageDisplayControllerFlag;
|
private final boolean mMessageDisplayControllerFlag;
|
||||||
|
private final Intent mIntent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new FingerprintEnrollSidecar object.
|
* Create a new FingerprintEnrollSidecar object.
|
||||||
* @param context associated context
|
*
|
||||||
|
* @param context associated context
|
||||||
* @param enrollReason reason for enrollment
|
* @param enrollReason reason for enrollment
|
||||||
*/
|
*/
|
||||||
public FingerprintEnrollSidecar(Context context,
|
public FingerprintEnrollSidecar(Context context,
|
||||||
@FingerprintManager.EnrollReason int enrollReason) {
|
@FingerprintManager.EnrollReason int enrollReason, Intent intent) {
|
||||||
mEnrollReason = enrollReason;
|
mEnrollReason = enrollReason;
|
||||||
|
mIntent = intent;
|
||||||
|
|
||||||
int helpMinimumDisplayTime = context.getResources().getInteger(
|
int helpMinimumDisplayTime = context.getResources().getInteger(
|
||||||
R.integer.enrollment_help_minimum_time_display);
|
R.integer.enrollment_help_minimum_time_display);
|
||||||
@@ -85,14 +93,21 @@ public class FingerprintEnrollSidecar extends BiometricEnrollSidecar {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mIntent.getIntExtra(BiometricUtils.EXTRA_ENROLL_REASON, -1) == -1) {
|
||||||
|
final boolean isSuw = WizardManagerHelper.isAnySetupWizard(mIntent);
|
||||||
|
mIntent.putExtra(BiometricUtils.EXTRA_ENROLL_REASON,
|
||||||
|
isSuw ? FingerprintEnrollOptions.ENROLL_REASON_SUW :
|
||||||
|
FingerprintEnrollOptions.ENROLL_REASON_SETTINGS);
|
||||||
|
}
|
||||||
|
|
||||||
if (mEnrollReason == ENROLL_ENROLL && mMessageDisplayControllerFlag) {
|
if (mEnrollReason == ENROLL_ENROLL && mMessageDisplayControllerFlag) {
|
||||||
//API calls need to be processed for {@link FingerprintEnrollEnrolling}
|
//API calls need to be processed for {@link FingerprintEnrollEnrolling}
|
||||||
mFingerprintUpdater.enroll(mToken, mEnrollmentCancel, mUserId,
|
mFingerprintUpdater.enroll(mToken, mEnrollmentCancel, mUserId,
|
||||||
mMessageDisplayController, mEnrollReason);
|
mMessageDisplayController, mEnrollReason, mIntent);
|
||||||
} else {
|
} else {
|
||||||
//No processing required for {@link FingerprintEnrollFindSensor}
|
//No processing required for {@link FingerprintEnrollFindSensor}
|
||||||
mFingerprintUpdater.enroll(mToken, mEnrollmentCancel, mUserId, mEnrollmentCallback,
|
mFingerprintUpdater.enroll(mToken, mEnrollmentCancel, mUserId, mEnrollmentCallback,
|
||||||
mEnrollReason);
|
mEnrollReason, mIntent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -100,7 +115,8 @@ public class FingerprintEnrollSidecar extends BiometricEnrollSidecar {
|
|||||||
mEnrollReason = enrollReason;
|
mEnrollReason = enrollReason;
|
||||||
}
|
}
|
||||||
|
|
||||||
@VisibleForTesting FingerprintManager.EnrollmentCallback mEnrollmentCallback
|
@VisibleForTesting
|
||||||
|
FingerprintManager.EnrollmentCallback mEnrollmentCallback
|
||||||
= new FingerprintManager.EnrollmentCallback() {
|
= new FingerprintManager.EnrollmentCallback() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -17,13 +17,16 @@
|
|||||||
package com.android.settings.biometrics.fingerprint;
|
package com.android.settings.biometrics.fingerprint;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
import android.hardware.fingerprint.Fingerprint;
|
import android.hardware.fingerprint.Fingerprint;
|
||||||
|
import android.hardware.fingerprint.FingerprintEnrollOptions;
|
||||||
import android.hardware.fingerprint.FingerprintManager;
|
import android.hardware.fingerprint.FingerprintManager;
|
||||||
import android.os.CancellationSignal;
|
import android.os.CancellationSignal;
|
||||||
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
import com.android.settings.Utils;
|
import com.android.settings.Utils;
|
||||||
|
import com.android.settings.biometrics.BiometricUtils;
|
||||||
import com.android.settings.safetycenter.BiometricsSafetySource;
|
import com.android.settings.safetycenter.BiometricsSafetySource;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -48,9 +51,10 @@ public class FingerprintUpdater {
|
|||||||
/** Wrapper around the {@link FingerprintManager#enroll} method. */
|
/** Wrapper around the {@link FingerprintManager#enroll} method. */
|
||||||
public void enroll(byte [] hardwareAuthToken, CancellationSignal cancel, int userId,
|
public void enroll(byte [] hardwareAuthToken, CancellationSignal cancel, int userId,
|
||||||
FingerprintManager.EnrollmentCallback callback,
|
FingerprintManager.EnrollmentCallback callback,
|
||||||
@FingerprintManager.EnrollReason int enrollReason) {
|
@FingerprintManager.EnrollReason int enrollReason, Intent intent) {
|
||||||
mFingerprintManager.enroll(hardwareAuthToken, cancel, userId,
|
mFingerprintManager.enroll(hardwareAuthToken, cancel, userId,
|
||||||
new NotifyingEnrollmentCallback(mContext, callback), enrollReason);
|
new NotifyingEnrollmentCallback(mContext, callback), enrollReason,
|
||||||
|
toFingerprintEnrollOptions(intent));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Wrapper around the {@link FingerprintManager#remove} method. */
|
/** Wrapper around the {@link FingerprintManager#remove} method. */
|
||||||
@@ -138,4 +142,14 @@ public class FingerprintUpdater {
|
|||||||
BiometricsSafetySource.onBiometricsChanged(mContext); // biometrics data changed
|
BiometricsSafetySource.onBiometricsChanged(mContext); // biometrics data changed
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private FingerprintEnrollOptions toFingerprintEnrollOptions(Intent intent) {
|
||||||
|
final int reason = intent.getIntExtra(BiometricUtils.EXTRA_ENROLL_REASON, -1);
|
||||||
|
final FingerprintEnrollOptions.Builder builder = new FingerprintEnrollOptions.Builder();
|
||||||
|
builder.setEnrollReason(FingerprintEnrollOptions.ENROLL_REASON_UNKNOWN);
|
||||||
|
if (reason != -1) {
|
||||||
|
builder.setEnrollReason(reason);
|
||||||
|
}
|
||||||
|
return builder.build();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -33,11 +33,14 @@ import android.view.animation.AccelerateInterpolator;
|
|||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
|
import com.android.internal.annotations.VisibleForTesting;
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
|
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
|
||||||
public class SfpsEnrollmentFeatureImpl implements SfpsEnrollmentFeature {
|
public class SfpsEnrollmentFeatureImpl implements SfpsEnrollmentFeature {
|
||||||
|
@VisibleForTesting
|
||||||
|
public static final int HELP_ANIMATOR_DURATION = 550;
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
private FingerprintManager mFingerprintManager = null;
|
private FingerprintManager mFingerprintManager = null;
|
||||||
@@ -96,12 +99,11 @@ public class SfpsEnrollmentFeatureImpl implements SfpsEnrollmentFeature {
|
|||||||
@Override
|
@Override
|
||||||
public Animator getHelpAnimator(@NonNull View target) {
|
public Animator getHelpAnimator(@NonNull View target) {
|
||||||
final float translationX = 40;
|
final float translationX = 40;
|
||||||
final int duration = 550;
|
|
||||||
final ObjectAnimator help = ObjectAnimator.ofFloat(target,
|
final ObjectAnimator help = ObjectAnimator.ofFloat(target,
|
||||||
"translationX" /* propertyName */,
|
"translationX" /* propertyName */,
|
||||||
0, translationX, -1 * translationX, translationX, 0f);
|
0, translationX, -1 * translationX, translationX, 0f);
|
||||||
help.setInterpolator(new AccelerateInterpolator());
|
help.setInterpolator(new AccelerateInterpolator());
|
||||||
help.setDuration(duration);
|
help.setDuration(HELP_ANIMATOR_DURATION);
|
||||||
help.setAutoCancel(false);
|
help.setAutoCancel(false);
|
||||||
return help;
|
return help;
|
||||||
}
|
}
|
||||||
|
@@ -18,12 +18,16 @@ package com.android.settings.biometrics.fingerprint2.domain.interactor
|
|||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
|
import android.hardware.biometrics.BiometricConstants;
|
||||||
|
import android.hardware.biometrics.BiometricFingerprintConstants
|
||||||
|
import android.hardware.fingerprint.FingerprintEnrollOptions;
|
||||||
import android.hardware.fingerprint.FingerprintManager
|
import android.hardware.fingerprint.FingerprintManager
|
||||||
import android.hardware.fingerprint.FingerprintManager.GenerateChallengeCallback
|
import android.hardware.fingerprint.FingerprintManager.GenerateChallengeCallback
|
||||||
import android.hardware.fingerprint.FingerprintManager.RemovalCallback
|
import android.hardware.fingerprint.FingerprintManager.RemovalCallback
|
||||||
import android.os.CancellationSignal
|
import android.os.CancellationSignal
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import com.android.settings.biometrics.GatekeeperPasswordProvider
|
import com.android.settings.biometrics.GatekeeperPasswordProvider
|
||||||
|
import com.android.settings.biometrics.BiometricUtils
|
||||||
import com.android.settings.biometrics.fingerprint2.conversion.Util.toEnrollError
|
import com.android.settings.biometrics.fingerprint2.conversion.Util.toEnrollError
|
||||||
import com.android.settings.biometrics.fingerprint2.conversion.Util.toOriginalReason
|
import com.android.settings.biometrics.fingerprint2.conversion.Util.toOriginalReason
|
||||||
import com.android.settings.biometrics.fingerprint2.data.repository.FingerprintSensorRepository
|
import com.android.settings.biometrics.fingerprint2.data.repository.FingerprintSensorRepository
|
||||||
@@ -35,6 +39,8 @@ import com.android.settings.biometrics.fingerprint2.lib.model.FingerprintData
|
|||||||
import com.android.settings.biometrics.fingerprint2.lib.model.FingerprintFlow
|
import com.android.settings.biometrics.fingerprint2.lib.model.FingerprintFlow
|
||||||
import com.android.settings.biometrics.fingerprint2.lib.model.SetupWizard
|
import com.android.settings.biometrics.fingerprint2.lib.model.SetupWizard
|
||||||
import com.android.settings.password.ChooseLockSettingsHelper
|
import com.android.settings.password.ChooseLockSettingsHelper
|
||||||
|
import com.android.systemui.biometrics.shared.model.toFingerprintSensor
|
||||||
|
import com.google.android.setupcompat.util.WizardManagerHelper
|
||||||
import kotlin.coroutines.resume
|
import kotlin.coroutines.resume
|
||||||
import kotlin.coroutines.suspendCoroutine
|
import kotlin.coroutines.suspendCoroutine
|
||||||
import kotlinx.coroutines.CancellableContinuation
|
import kotlinx.coroutines.CancellableContinuation
|
||||||
@@ -60,6 +66,7 @@ class FingerprintManagerInteractorImpl(
|
|||||||
private val gatekeeperPasswordProvider: GatekeeperPasswordProvider,
|
private val gatekeeperPasswordProvider: GatekeeperPasswordProvider,
|
||||||
private val pressToAuthInteractor: PressToAuthInteractor,
|
private val pressToAuthInteractor: PressToAuthInteractor,
|
||||||
private val fingerprintFlow: FingerprintFlow,
|
private val fingerprintFlow: FingerprintFlow,
|
||||||
|
private val intent: Intent,
|
||||||
) : FingerprintManagerInteractor {
|
) : FingerprintManagerInteractor {
|
||||||
|
|
||||||
private val maxFingerprints =
|
private val maxFingerprints =
|
||||||
@@ -158,12 +165,21 @@ class FingerprintManagerInteractorImpl(
|
|||||||
}
|
}
|
||||||
|
|
||||||
val cancellationSignal = CancellationSignal()
|
val cancellationSignal = CancellationSignal()
|
||||||
|
|
||||||
|
if (intent.getIntExtra(BiometricUtils.EXTRA_ENROLL_REASON, -1) === -1) {
|
||||||
|
val isSuw: Boolean = WizardManagerHelper.isAnySetupWizard(intent)
|
||||||
|
intent.putExtra(BiometricUtils.EXTRA_ENROLL_REASON,
|
||||||
|
if (isSuw) FingerprintEnrollOptions.ENROLL_REASON_SUW else
|
||||||
|
FingerprintEnrollOptions.ENROLL_REASON_SETTINGS)
|
||||||
|
}
|
||||||
|
|
||||||
fingerprintManager.enroll(
|
fingerprintManager.enroll(
|
||||||
hardwareAuthToken,
|
hardwareAuthToken,
|
||||||
cancellationSignal,
|
cancellationSignal,
|
||||||
applicationContext.userId,
|
applicationContext.userId,
|
||||||
enrollmentCallback,
|
enrollmentCallback,
|
||||||
enrollReason.toOriginalReason(),
|
enrollReason.toOriginalReason(),
|
||||||
|
toFingerprintEnrollOptions(intent)
|
||||||
)
|
)
|
||||||
awaitClose {
|
awaitClose {
|
||||||
// If the stream has not been ended, and the user has stopped collecting the flow
|
// If the stream has not been ended, and the user has stopped collecting the flow
|
||||||
@@ -244,4 +260,15 @@ class FingerprintManagerInteractorImpl(
|
|||||||
applicationContext.userId,
|
applicationContext.userId,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun toFingerprintEnrollOptions(intent: Intent): FingerprintEnrollOptions {
|
||||||
|
val reason: Int =
|
||||||
|
intent.getIntExtra(BiometricUtils.EXTRA_ENROLL_REASON, -1)
|
||||||
|
val builder: FingerprintEnrollOptions.Builder = FingerprintEnrollOptions.Builder()
|
||||||
|
builder.setEnrollReason(FingerprintEnrollOptions.ENROLL_REASON_UNKNOWN)
|
||||||
|
if (reason != -1) {
|
||||||
|
builder.setEnrollReason(reason)
|
||||||
|
}
|
||||||
|
return builder.build()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -191,6 +191,7 @@ class FingerprintEnrollmentV2Activity : FragmentActivity() {
|
|||||||
GatekeeperPasswordProvider(LockPatternUtils(context)),
|
GatekeeperPasswordProvider(LockPatternUtils(context)),
|
||||||
pressToAuthInteractor,
|
pressToAuthInteractor,
|
||||||
enrollType,
|
enrollType,
|
||||||
|
getIntent(),
|
||||||
)
|
)
|
||||||
|
|
||||||
var challenge: Long? = intent.getExtra(BiometricEnrollBase.EXTRA_KEY_CHALLENGE) as Long?
|
var challenge: Long? = intent.getExtra(BiometricEnrollBase.EXTRA_KEY_CHALLENGE) as Long?
|
||||||
|
@@ -232,6 +232,7 @@ class FingerprintSettingsV2Fragment :
|
|||||||
GatekeeperPasswordProvider(LockPatternUtils(context.applicationContext)),
|
GatekeeperPasswordProvider(LockPatternUtils(context.applicationContext)),
|
||||||
pressToAuthInteractor,
|
pressToAuthInteractor,
|
||||||
Settings,
|
Settings,
|
||||||
|
getIntent()
|
||||||
)
|
)
|
||||||
|
|
||||||
val token = intent.getByteArrayExtra(ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE_TOKEN)
|
val token = intent.getByteArrayExtra(ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE_TOKEN)
|
||||||
|
@@ -23,6 +23,7 @@ import static com.android.settings.biometrics2.ui.model.EnrollmentProgress.INITI
|
|||||||
import static com.android.settings.biometrics2.ui.model.EnrollmentProgress.INITIAL_STEPS;
|
import static com.android.settings.biometrics2.ui.model.EnrollmentProgress.INITIAL_STEPS;
|
||||||
|
|
||||||
import android.app.Application;
|
import android.app.Application;
|
||||||
|
import android.content.Intent;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.hardware.fingerprint.FingerprintManager.EnrollReason;
|
import android.hardware.fingerprint.FingerprintManager.EnrollReason;
|
||||||
import android.hardware.fingerprint.FingerprintManager.EnrollmentCallback;
|
import android.hardware.fingerprint.FingerprintManager.EnrollmentCallback;
|
||||||
@@ -212,10 +213,11 @@ public class FingerprintEnrollProgressViewModel extends AndroidViewModel {
|
|||||||
res.getBoolean(R.bool.enrollment_progress_priority_over_help),
|
res.getBoolean(R.bool.enrollment_progress_priority_over_help),
|
||||||
res.getBoolean(R.bool.enrollment_prioritize_acquire_messages),
|
res.getBoolean(R.bool.enrollment_prioritize_acquire_messages),
|
||||||
res.getInteger(R.integer.enrollment_collect_time));
|
res.getInteger(R.integer.enrollment_collect_time));
|
||||||
mFingerprintUpdater.enroll(mToken, mCancellationSignal, mUserId, callback, reason);
|
mFingerprintUpdater.enroll(mToken, mCancellationSignal, mUserId, callback, reason,
|
||||||
|
new Intent());
|
||||||
} else {
|
} else {
|
||||||
mFingerprintUpdater.enroll(mToken, mCancellationSignal, mUserId, mEnrollmentCallback,
|
mFingerprintUpdater.enroll(mToken, mCancellationSignal, mUserId, mEnrollmentCallback,
|
||||||
reason);
|
reason, new Intent());
|
||||||
}
|
}
|
||||||
return mCancellationSignal;
|
return mCancellationSignal;
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,144 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2024 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.bluetooth;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.database.ContentObserver;
|
||||||
|
import android.os.Handler;
|
||||||
|
import android.os.UserHandle;
|
||||||
|
import android.provider.Settings;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.annotation.VisibleForTesting;
|
||||||
|
import androidx.preference.PreferenceScreen;
|
||||||
|
import androidx.preference.TwoStatePreference;
|
||||||
|
|
||||||
|
import com.android.settings.core.TogglePreferenceController;
|
||||||
|
import com.android.settingslib.core.lifecycle.LifecycleObserver;
|
||||||
|
import com.android.settingslib.core.lifecycle.events.OnStart;
|
||||||
|
import com.android.settingslib.core.lifecycle.events.OnStop;
|
||||||
|
import com.android.settingslib.flags.Flags;
|
||||||
|
import com.android.settingslib.utils.ThreadUtils;
|
||||||
|
|
||||||
|
public class BluetoothAutoOnPreferenceController extends TogglePreferenceController
|
||||||
|
implements LifecycleObserver, OnStart, OnStop {
|
||||||
|
private static final String TAG = "BluetoothAutoOnPreferenceController";
|
||||||
|
@VisibleForTesting static final String PREF_KEY = "bluetooth_auto_on_settings_toggle";
|
||||||
|
static final String SETTING_NAME = "bluetooth_automatic_turn_on";
|
||||||
|
static final int UNSET = -1;
|
||||||
|
@VisibleForTesting static final int ENABLED = 1;
|
||||||
|
@VisibleForTesting static final int DISABLED = 0;
|
||||||
|
private final ContentObserver mContentObserver =
|
||||||
|
new ContentObserver(new Handler(/* async= */ true)) {
|
||||||
|
@Override
|
||||||
|
public void onChange(boolean selfChange) {
|
||||||
|
var unused =
|
||||||
|
ThreadUtils.postOnBackgroundThread(
|
||||||
|
() -> {
|
||||||
|
updateValue();
|
||||||
|
mContext.getMainExecutor()
|
||||||
|
.execute(
|
||||||
|
() -> {
|
||||||
|
if (mPreference != null) {
|
||||||
|
updateState(mPreference);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
private int mAutoOnValue = UNSET;
|
||||||
|
@Nullable private TwoStatePreference mPreference;
|
||||||
|
|
||||||
|
public BluetoothAutoOnPreferenceController(
|
||||||
|
@NonNull Context context, @NonNull String preferenceKey) {
|
||||||
|
super(context, preferenceKey);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onStart() {
|
||||||
|
mContext.getContentResolver()
|
||||||
|
.registerContentObserver(
|
||||||
|
Settings.Secure.getUriFor(SETTING_NAME),
|
||||||
|
/* notifyForDescendants= */ false,
|
||||||
|
mContentObserver);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onStop() {
|
||||||
|
mContext.getContentResolver().unregisterContentObserver(mContentObserver);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getAvailabilityStatus() {
|
||||||
|
if (!Flags.bluetoothQsTileDialogAutoOnToggle()) {
|
||||||
|
return UNSUPPORTED_ON_DEVICE;
|
||||||
|
}
|
||||||
|
updateValue();
|
||||||
|
return mAutoOnValue != UNSET ? AVAILABLE : UNSUPPORTED_ON_DEVICE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void displayPreference(@NonNull PreferenceScreen screen) {
|
||||||
|
super.displayPreference(screen);
|
||||||
|
mPreference = screen.findPreference(getPreferenceKey());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getPreferenceKey() {
|
||||||
|
return PREF_KEY;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isChecked() {
|
||||||
|
return mAutoOnValue == ENABLED;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean setChecked(boolean isChecked) {
|
||||||
|
if (getAvailabilityStatus() != AVAILABLE) {
|
||||||
|
Log.w(TAG, "Trying to set toggle value while feature not available.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
var unused =
|
||||||
|
ThreadUtils.postOnBackgroundThread(
|
||||||
|
() -> {
|
||||||
|
boolean updated =
|
||||||
|
Settings.Secure.putIntForUser(
|
||||||
|
mContext.getContentResolver(),
|
||||||
|
SETTING_NAME,
|
||||||
|
isChecked ? ENABLED : DISABLED,
|
||||||
|
UserHandle.myUserId());
|
||||||
|
if (updated) {
|
||||||
|
updateValue();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getSliceHighlightMenuRes() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateValue() {
|
||||||
|
mAutoOnValue =
|
||||||
|
Settings.Secure.getIntForUser(
|
||||||
|
mContext.getContentResolver(), SETTING_NAME, UNSET, UserHandle.myUserId());
|
||||||
|
}
|
||||||
|
}
|
@@ -15,8 +15,13 @@
|
|||||||
*/
|
*/
|
||||||
package com.android.settings.bluetooth;
|
package com.android.settings.bluetooth;
|
||||||
|
|
||||||
|
import static com.android.settings.bluetooth.BluetoothAutoOnPreferenceController.SETTING_NAME;
|
||||||
|
import static com.android.settings.bluetooth.BluetoothAutoOnPreferenceController.UNSET;
|
||||||
|
|
||||||
import android.app.settings.SettingsEnums;
|
import android.app.settings.SettingsEnums;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.os.UserHandle;
|
||||||
|
import android.provider.Settings;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
||||||
import androidx.annotation.VisibleForTesting;
|
import androidx.annotation.VisibleForTesting;
|
||||||
@@ -29,6 +34,7 @@ import com.android.settings.widget.SwitchWidgetController;
|
|||||||
import com.android.settingslib.core.lifecycle.LifecycleObserver;
|
import com.android.settingslib.core.lifecycle.LifecycleObserver;
|
||||||
import com.android.settingslib.core.lifecycle.events.OnStart;
|
import com.android.settingslib.core.lifecycle.events.OnStart;
|
||||||
import com.android.settingslib.core.lifecycle.events.OnStop;
|
import com.android.settingslib.core.lifecycle.events.OnStop;
|
||||||
|
import com.android.settingslib.flags.Flags;
|
||||||
import com.android.settingslib.widget.FooterPreference;
|
import com.android.settingslib.widget.FooterPreference;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -36,8 +42,11 @@ import com.android.settingslib.widget.FooterPreference;
|
|||||||
* is delegated to the SwitchWidgetController it uses.
|
* is delegated to the SwitchWidgetController it uses.
|
||||||
*/
|
*/
|
||||||
public class BluetoothSwitchPreferenceController
|
public class BluetoothSwitchPreferenceController
|
||||||
implements LifecycleObserver, OnStart, OnStop,
|
implements LifecycleObserver,
|
||||||
SwitchWidgetController.OnSwitchChangeListener, View.OnClickListener {
|
OnStart,
|
||||||
|
OnStop,
|
||||||
|
SwitchWidgetController.OnSwitchChangeListener,
|
||||||
|
View.OnClickListener {
|
||||||
|
|
||||||
private BluetoothEnabler mBluetoothEnabler;
|
private BluetoothEnabler mBluetoothEnabler;
|
||||||
private RestrictionUtils mRestrictionUtils;
|
private RestrictionUtils mRestrictionUtils;
|
||||||
@@ -46,18 +55,21 @@ public class BluetoothSwitchPreferenceController
|
|||||||
private FooterPreference mFooterPreference;
|
private FooterPreference mFooterPreference;
|
||||||
private boolean mIsAlwaysDiscoverable;
|
private boolean mIsAlwaysDiscoverable;
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting AlwaysDiscoverable mAlwaysDiscoverable;
|
||||||
AlwaysDiscoverable mAlwaysDiscoverable;
|
|
||||||
|
|
||||||
public BluetoothSwitchPreferenceController(Context context,
|
public BluetoothSwitchPreferenceController(
|
||||||
|
Context context,
|
||||||
SwitchWidgetController switchController,
|
SwitchWidgetController switchController,
|
||||||
FooterPreference footerPreference) {
|
FooterPreference footerPreference) {
|
||||||
this(context, new RestrictionUtils(), switchController, footerPreference);
|
this(context, new RestrictionUtils(), switchController, footerPreference);
|
||||||
}
|
}
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
public BluetoothSwitchPreferenceController(Context context, RestrictionUtils restrictionUtils,
|
public BluetoothSwitchPreferenceController(
|
||||||
SwitchWidgetController switchController, FooterPreference footerPreference) {
|
Context context,
|
||||||
|
RestrictionUtils restrictionUtils,
|
||||||
|
SwitchWidgetController switchController,
|
||||||
|
FooterPreference footerPreference) {
|
||||||
mRestrictionUtils = restrictionUtils;
|
mRestrictionUtils = restrictionUtils;
|
||||||
mSwitch = switchController;
|
mSwitch = switchController;
|
||||||
mContext = context;
|
mContext = context;
|
||||||
@@ -66,11 +78,13 @@ public class BluetoothSwitchPreferenceController
|
|||||||
mSwitch.setupView();
|
mSwitch.setupView();
|
||||||
updateText(mSwitch.isChecked());
|
updateText(mSwitch.isChecked());
|
||||||
|
|
||||||
mBluetoothEnabler = new BluetoothEnabler(context,
|
mBluetoothEnabler =
|
||||||
switchController,
|
new BluetoothEnabler(
|
||||||
FeatureFactory.getFeatureFactory().getMetricsFeatureProvider(),
|
context,
|
||||||
SettingsEnums.ACTION_SETTINGS_MASTER_SWITCH_BLUETOOTH_TOGGLE,
|
switchController,
|
||||||
mRestrictionUtils);
|
FeatureFactory.getFeatureFactory().getMetricsFeatureProvider(),
|
||||||
|
SettingsEnums.ACTION_SETTINGS_MASTER_SWITCH_BLUETOOTH_TOGGLE,
|
||||||
|
mRestrictionUtils);
|
||||||
mBluetoothEnabler.setToggleCallback(this);
|
mBluetoothEnabler.setToggleCallback(this);
|
||||||
mAlwaysDiscoverable = new AlwaysDiscoverable(context);
|
mAlwaysDiscoverable = new AlwaysDiscoverable(context);
|
||||||
}
|
}
|
||||||
@@ -97,8 +111,8 @@ public class BluetoothSwitchPreferenceController
|
|||||||
/**
|
/**
|
||||||
* Set whether the device can be discovered. By default the value will be {@code false}.
|
* Set whether the device can be discovered. By default the value will be {@code false}.
|
||||||
*
|
*
|
||||||
* @param isAlwaysDiscoverable {@code true} if the device can be discovered,
|
* @param isAlwaysDiscoverable {@code true} if the device can be discovered, otherwise {@code
|
||||||
* otherwise {@code false}
|
* false}
|
||||||
*/
|
*/
|
||||||
public void setAlwaysDiscoverable(boolean isAlwaysDiscoverable) {
|
public void setAlwaysDiscoverable(boolean isAlwaysDiscoverable) {
|
||||||
mIsAlwaysDiscoverable = isAlwaysDiscoverable;
|
mIsAlwaysDiscoverable = isAlwaysDiscoverable;
|
||||||
@@ -119,15 +133,35 @@ public class BluetoothSwitchPreferenceController
|
|||||||
.launch();
|
.launch();
|
||||||
}
|
}
|
||||||
|
|
||||||
@VisibleForTesting void updateText(boolean isChecked) {
|
@VisibleForTesting
|
||||||
|
void updateText(boolean isChecked) {
|
||||||
if (!isChecked && Utils.isBluetoothScanningEnabled(mContext)) {
|
if (!isChecked && Utils.isBluetoothScanningEnabled(mContext)) {
|
||||||
mFooterPreference.setTitle(R.string.bluetooth_scanning_on_info_message);
|
if (isAutoOnFeatureAvailable()) {
|
||||||
|
mFooterPreference.setTitle(
|
||||||
|
R.string.bluetooth_scanning_on_info_message_auto_on_available);
|
||||||
|
} else {
|
||||||
|
mFooterPreference.setTitle(R.string.bluetooth_scanning_on_info_message);
|
||||||
|
}
|
||||||
mFooterPreference.setLearnMoreText(mContext.getString(R.string.bluetooth_scan_change));
|
mFooterPreference.setLearnMoreText(mContext.getString(R.string.bluetooth_scan_change));
|
||||||
mFooterPreference.setLearnMoreAction(v -> onClick(v));
|
mFooterPreference.setLearnMoreAction(v -> onClick(v));
|
||||||
} else {
|
} else {
|
||||||
mFooterPreference.setTitle(R.string.bluetooth_empty_list_bluetooth_off);
|
if (isAutoOnFeatureAvailable()) {
|
||||||
|
mFooterPreference.setTitle(
|
||||||
|
R.string.bluetooth_empty_list_bluetooth_off_auto_on_available);
|
||||||
|
} else {
|
||||||
|
mFooterPreference.setTitle(R.string.bluetooth_empty_list_bluetooth_off);
|
||||||
|
}
|
||||||
mFooterPreference.setLearnMoreText("");
|
mFooterPreference.setLearnMoreText("");
|
||||||
mFooterPreference.setLearnMoreAction(null);
|
mFooterPreference.setLearnMoreAction(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isAutoOnFeatureAvailable() {
|
||||||
|
if (!Flags.bluetoothQsTileDialogAutoOnToggle()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return Settings.Secure.getIntForUser(
|
||||||
|
mContext.getContentResolver(), SETTING_NAME, UNSET, UserHandle.myUserId())
|
||||||
|
!= UNSET;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1261,7 +1261,8 @@ public class NetworkProviderSettings extends RestrictedSettingsFragment
|
|||||||
WifiEntryConnectCallback callback =
|
WifiEntryConnectCallback callback =
|
||||||
new WifiEntryConnectCallback(wifiEntry, editIfNoConfig, fullScreenEdit);
|
new WifiEntryConnectCallback(wifiEntry, editIfNoConfig, fullScreenEdit);
|
||||||
|
|
||||||
if (Flags.wepUsage() && wifiEntry.getSecurityTypes().contains(WifiEntry.SECURITY_WEP)) {
|
if (Flags.androidVWifiApi() && wifiEntry.getSecurityTypes()
|
||||||
|
.contains(WifiEntry.SECURITY_WEP)) {
|
||||||
WepNetworkDialogActivity.checkWepAllowed(
|
WepNetworkDialogActivity.checkWepAllowed(
|
||||||
getContext(), getViewLifecycleOwner(), wifiEntry.getSsid(), () -> {
|
getContext(), getViewLifecycleOwner(), wifiEntry.getSsid(), () -> {
|
||||||
wifiEntry.connect(callback);
|
wifiEntry.connect(callback);
|
||||||
|
@@ -0,0 +1,105 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2024 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.privatespace;
|
||||||
|
|
||||||
|
import static android.provider.Settings.Secure.LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.os.UserHandle;
|
||||||
|
import android.provider.Settings;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
|
import com.android.settings.core.TogglePreferenceController;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A controller object for sensitive notifications in Private Space settings page.
|
||||||
|
*/
|
||||||
|
public class HidePrivateSpaceSensitiveNotificationsController extends TogglePreferenceController {
|
||||||
|
private final PrivateSpaceMaintainer mPrivateSpaceMaintainer;
|
||||||
|
private final UserHandle mPrivateProfileId;
|
||||||
|
public static final int ENABLED = 1;
|
||||||
|
public static final int DISABLED = 0;
|
||||||
|
private static final int DEVICE_SENSITIVE_NOTIFICATIONS_DEFAULT = ENABLED;
|
||||||
|
private static final int DEVICE_LOCK_SCREEN_NOTIFICATIONS_DEFAULT = ENABLED;
|
||||||
|
private static final int PRIVATE_SPACE_SENSITIVE_NOTIFICATIONS_DEFAULT = DISABLED;
|
||||||
|
|
||||||
|
public HidePrivateSpaceSensitiveNotificationsController(@NonNull Context context,
|
||||||
|
@NonNull String preferenceKey) {
|
||||||
|
super(context, preferenceKey);
|
||||||
|
mPrivateSpaceMaintainer = PrivateSpaceMaintainer.getInstance(context);
|
||||||
|
mPrivateProfileId = Objects.requireNonNull(
|
||||||
|
mPrivateSpaceMaintainer.getPrivateProfileHandle());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getAvailabilityStatus() {
|
||||||
|
if (!android.os.Flags.allowPrivateProfile()
|
||||||
|
|| !android.multiuser.Flags.enablePsSensitiveNotificationsToggle()
|
||||||
|
|| !mPrivateSpaceMaintainer.doesPrivateSpaceExist()) {
|
||||||
|
return UNSUPPORTED_ON_DEVICE;
|
||||||
|
}
|
||||||
|
if (!getLockscreenNotificationsEnabled(mContext)
|
||||||
|
|| !getLockscreenSensitiveNotificationsEnabledOnDevice(mContext)) {
|
||||||
|
return DISABLED_DEPENDENT_SETTING;
|
||||||
|
}
|
||||||
|
return AVAILABLE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isChecked() {
|
||||||
|
return Settings.Secure.getIntForUser(mContext.getContentResolver(),
|
||||||
|
LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS,
|
||||||
|
PRIVATE_SPACE_SENSITIVE_NOTIFICATIONS_DEFAULT, mPrivateProfileId.getIdentifier())
|
||||||
|
!= DISABLED;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean setChecked(boolean isChecked) {
|
||||||
|
Settings.Secure.putIntForUser(mContext.getContentResolver(),
|
||||||
|
Settings.Secure.LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS,
|
||||||
|
isChecked ? ENABLED : DISABLED, mPrivateProfileId.getIdentifier());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getSliceHighlightMenuRes() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If notifications are disabled on the device, the toggle for private space sensitive
|
||||||
|
* notifications should be unavailable.
|
||||||
|
*/
|
||||||
|
private static boolean getLockscreenNotificationsEnabled(Context context) {
|
||||||
|
return Settings.Secure.getInt(context.getContentResolver(),
|
||||||
|
Settings.Secure.LOCK_SCREEN_SHOW_NOTIFICATIONS,
|
||||||
|
DEVICE_LOCK_SCREEN_NOTIFICATIONS_DEFAULT) != DISABLED;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If sensitive notifications are hidden on the device, they should be hidden for private space
|
||||||
|
* also.
|
||||||
|
*/
|
||||||
|
private static boolean getLockscreenSensitiveNotificationsEnabledOnDevice(Context context) {
|
||||||
|
return Settings.Secure.getInt(context.getContentResolver(),
|
||||||
|
Settings.Secure.LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS,
|
||||||
|
DEVICE_SENSITIVE_NOTIFICATIONS_DEFAULT) != DISABLED;
|
||||||
|
}
|
||||||
|
}
|
@@ -18,6 +18,8 @@ package com.android.settings.privatespace;
|
|||||||
|
|
||||||
import static android.app.admin.DevicePolicyManager.ACTION_SET_NEW_PASSWORD;
|
import static android.app.admin.DevicePolicyManager.ACTION_SET_NEW_PASSWORD;
|
||||||
|
|
||||||
|
import static com.android.internal.app.SetScreenLockDialogActivity.LAUNCH_REASON_PRIVATE_SPACE_SETTINGS_ACCESS;
|
||||||
|
|
||||||
import android.app.ActivityOptions;
|
import android.app.ActivityOptions;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.app.KeyguardManager;
|
import android.app.KeyguardManager;
|
||||||
@@ -37,6 +39,7 @@ import androidx.annotation.Nullable;
|
|||||||
import androidx.fragment.app.FragmentActivity;
|
import androidx.fragment.app.FragmentActivity;
|
||||||
|
|
||||||
import com.android.internal.annotations.VisibleForTesting;
|
import com.android.internal.annotations.VisibleForTesting;
|
||||||
|
import com.android.internal.app.SetScreenLockDialogActivity;
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
import com.android.settings.core.SubSettingLauncher;
|
import com.android.settings.core.SubSettingLauncher;
|
||||||
import com.android.settingslib.transition.SettingsTransitionHelper;
|
import com.android.settingslib.transition.SettingsTransitionHelper;
|
||||||
@@ -112,23 +115,31 @@ public class PrivateSpaceAuthenticationActivity extends FragmentActivity {
|
|||||||
|
|
||||||
private void promptToSetDeviceLock() {
|
private void promptToSetDeviceLock() {
|
||||||
Log.d(TAG, "Show prompt to set device lock before using private space feature");
|
Log.d(TAG, "Show prompt to set device lock before using private space feature");
|
||||||
new AlertDialog.Builder(this)
|
if (android.multiuser.Flags.showSetScreenLockDialog()) {
|
||||||
.setTitle(R.string.no_device_lock_title)
|
Intent setScreenLockPromptIntent =
|
||||||
.setMessage(R.string.no_device_lock_summary)
|
SetScreenLockDialogActivity
|
||||||
.setPositiveButton(
|
.createBaseIntent(LAUNCH_REASON_PRIVATE_SPACE_SETTINGS_ACCESS);
|
||||||
R.string.no_device_lock_action_label,
|
startActivity(setScreenLockPromptIntent);
|
||||||
(DialogInterface dialog, int which) -> {
|
finish();
|
||||||
Log.d(TAG, "Start activity to set new device lock");
|
} else {
|
||||||
mSetDeviceLock.launch(new Intent(ACTION_SET_NEW_PASSWORD));
|
new AlertDialog.Builder(this)
|
||||||
})
|
.setTitle(R.string.no_device_lock_title)
|
||||||
.setNegativeButton(
|
.setMessage(R.string.no_device_lock_summary)
|
||||||
R.string.no_device_lock_cancel,
|
.setPositiveButton(
|
||||||
(DialogInterface dialog, int which) -> finish())
|
R.string.no_device_lock_action_label,
|
||||||
.setOnCancelListener(
|
(DialogInterface dialog, int which) -> {
|
||||||
(DialogInterface dialog) -> {
|
Log.d(TAG, "Start activity to set new device lock");
|
||||||
finish();
|
mSetDeviceLock.launch(new Intent(ACTION_SET_NEW_PASSWORD));
|
||||||
})
|
})
|
||||||
.show();
|
.setNegativeButton(
|
||||||
|
R.string.no_device_lock_cancel,
|
||||||
|
(DialogInterface dialog, int which) -> finish())
|
||||||
|
.setOnCancelListener(
|
||||||
|
(DialogInterface dialog) -> {
|
||||||
|
finish();
|
||||||
|
})
|
||||||
|
.show();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private KeyguardManager getKeyguardManager() {
|
private KeyguardManager getKeyguardManager() {
|
||||||
|
@@ -45,6 +45,7 @@ import com.android.internal.annotations.GuardedBy;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
// TODO(b/293569406): Update the javadoc when we have the setup flow in place to create PS
|
// TODO(b/293569406): Update the javadoc when we have the setup flow in place to create PS
|
||||||
|
|
||||||
/** A class to help with the creation / deletion of Private Space */
|
/** A class to help with the creation / deletion of Private Space */
|
||||||
public class PrivateSpaceMaintainer {
|
public class PrivateSpaceMaintainer {
|
||||||
private static final String TAG = "PrivateSpaceMaintainer";
|
private static final String TAG = "PrivateSpaceMaintainer";
|
||||||
@@ -65,9 +66,9 @@ public class PrivateSpaceMaintainer {
|
|||||||
public static final int PRIVATE_SPACE_AUTO_LOCK_DEFAULT_VAL = PRIVATE_SPACE_AUTO_LOCK_NEVER;
|
public static final int PRIVATE_SPACE_AUTO_LOCK_DEFAULT_VAL = PRIVATE_SPACE_AUTO_LOCK_NEVER;
|
||||||
|
|
||||||
public enum ErrorDeletingPrivateSpace {
|
public enum ErrorDeletingPrivateSpace {
|
||||||
DELETE_PS_ERROR_NONE,
|
DELETE_PS_ERROR_NONE,
|
||||||
DELETE_PS_ERROR_NO_PRIVATE_SPACE,
|
DELETE_PS_ERROR_NO_PRIVATE_SPACE,
|
||||||
DELETE_PS_ERROR_INTERNAL
|
DELETE_PS_ERROR_INTERNAL
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -90,7 +91,7 @@ public class PrivateSpaceMaintainer {
|
|||||||
if (mUserHandle == null) {
|
if (mUserHandle == null) {
|
||||||
try {
|
try {
|
||||||
mUserHandle = mUserManager.createProfile(
|
mUserHandle = mUserManager.createProfile(
|
||||||
userName, USER_TYPE_PROFILE_PRIVATE, new ArraySet<>());
|
userName, USER_TYPE_PROFILE_PRIVATE, new ArraySet<>());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.e(TAG, "Error creating private space", e);
|
Log.e(TAG, "Error creating private space", e);
|
||||||
return false;
|
return false;
|
||||||
@@ -117,7 +118,8 @@ public class PrivateSpaceMaintainer {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns the {@link ErrorDeletingPrivateSpace} enum representing the result of operation.
|
/**
|
||||||
|
* Returns the {@link ErrorDeletingPrivateSpace} enum representing the result of operation.
|
||||||
*
|
*
|
||||||
* <p> This method should be used ONLY by the delete-PS controller in the PS Settings page.
|
* <p> This method should be used ONLY by the delete-PS controller in the PS Settings page.
|
||||||
*/
|
*/
|
||||||
@@ -212,6 +214,7 @@ public class PrivateSpaceMaintainer {
|
|||||||
|
|
||||||
|
|
||||||
// TODO(b/307281644): Remove this method once new auth change is merged
|
// TODO(b/307281644): Remove this method once new auth change is merged
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if private space exists and a separate private profile lock is set
|
* Returns true if private space exists and a separate private profile lock is set
|
||||||
* otherwise false when the private space does not exit or exists but does not have a
|
* otherwise false when the private space does not exit or exists but does not have a
|
||||||
@@ -290,9 +293,20 @@ public class PrivateSpaceMaintainer {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GuardedBy("this")
|
||||||
private void resetPrivateSpaceSettings() {
|
private void resetPrivateSpaceSettings() {
|
||||||
setHidePrivateSpaceEntryPointSetting(HIDE_PRIVATE_SPACE_ENTRY_POINT_DISABLED_VAL);
|
setHidePrivateSpaceEntryPointSetting(HIDE_PRIVATE_SPACE_ENTRY_POINT_DISABLED_VAL);
|
||||||
setPrivateSpaceAutoLockSetting(PRIVATE_SPACE_AUTO_LOCK_DEFAULT_VAL);
|
setPrivateSpaceAutoLockSetting(PRIVATE_SPACE_AUTO_LOCK_DEFAULT_VAL);
|
||||||
|
setPrivateSpaceSensitiveNotificationsDefaultValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Sets private space sensitive notifications hidden on lockscreen by default */
|
||||||
|
@GuardedBy("this")
|
||||||
|
private void setPrivateSpaceSensitiveNotificationsDefaultValue() {
|
||||||
|
Settings.Secure.putIntForUser(mContext.getContentResolver(),
|
||||||
|
Settings.Secure.LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS,
|
||||||
|
HidePrivateSpaceSensitiveNotificationsController.DISABLED,
|
||||||
|
mUserHandle.getIdentifier());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -48,7 +48,7 @@ class WepNetworksPreferenceController(context: Context, preferenceKey: String) :
|
|||||||
preference = screen.findPreference(preferenceKey)!!
|
preference = screen.findPreference(preferenceKey)!!
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getAvailabilityStatus() = if (Flags.wepUsage()) AVAILABLE
|
override fun getAvailabilityStatus() = if (Flags.androidVWifiApi()) AVAILABLE
|
||||||
else UNSUPPORTED_ON_DEVICE
|
else UNSUPPORTED_ON_DEVICE
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
|
@@ -276,7 +276,7 @@ public class WifiConfigController implements TextWatcher,
|
|||||||
mDoNotProvideEapUserCertString =
|
mDoNotProvideEapUserCertString =
|
||||||
mContext.getString(R.string.wifi_do_not_provide_eap_user_cert);
|
mContext.getString(R.string.wifi_do_not_provide_eap_user_cert);
|
||||||
|
|
||||||
if (Flags.wepUsage() && mAccessPointSecurity == WifiEntry.SECURITY_WEP) {
|
if (Flags.androidVWifiApi() && mAccessPointSecurity == WifiEntry.SECURITY_WEP) {
|
||||||
LinearLayout wepWarningLayout =
|
LinearLayout wepWarningLayout =
|
||||||
(LinearLayout) mView.findViewById(R.id.wep_warning_layout);
|
(LinearLayout) mView.findViewById(R.id.wep_warning_layout);
|
||||||
wepWarningLayout.setVisibility(View.VISIBLE);
|
wepWarningLayout.setVisibility(View.VISIBLE);
|
||||||
|
@@ -289,7 +289,7 @@ public class WifiConfigController2 implements TextWatcher,
|
|||||||
mContext.getString(R.string.wifi_do_not_provide_eap_user_cert);
|
mContext.getString(R.string.wifi_do_not_provide_eap_user_cert);
|
||||||
mInstallCertsString = mContext.getString(R.string.wifi_install_credentials);
|
mInstallCertsString = mContext.getString(R.string.wifi_install_credentials);
|
||||||
|
|
||||||
if (Flags.wepUsage() && mWifiEntrySecurity == WifiEntry.SECURITY_WEP) {
|
if (Flags.androidVWifiApi() && mWifiEntrySecurity == WifiEntry.SECURITY_WEP) {
|
||||||
LinearLayout wepWarningLayout =
|
LinearLayout wepWarningLayout =
|
||||||
(LinearLayout) mView.findViewById(R.id.wep_warning_layout);
|
(LinearLayout) mView.findViewById(R.id.wep_warning_layout);
|
||||||
wepWarningLayout.setVisibility(View.VISIBLE);
|
wepWarningLayout.setVisibility(View.VISIBLE);
|
||||||
|
@@ -43,6 +43,7 @@ import android.content.Intent;
|
|||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.hardware.face.Face;
|
import android.hardware.face.Face;
|
||||||
|
import android.hardware.face.FaceEnrollOptions;
|
||||||
import android.hardware.face.FaceManager;
|
import android.hardware.face.FaceManager;
|
||||||
import android.hardware.face.FaceSensorProperties;
|
import android.hardware.face.FaceSensorProperties;
|
||||||
import android.hardware.face.FaceSensorPropertiesInternal;
|
import android.hardware.face.FaceSensorPropertiesInternal;
|
||||||
@@ -196,6 +197,8 @@ public class FaceEnrollIntroductionTest {
|
|||||||
final Intent testIntent = new Intent();
|
final Intent testIntent = new Intent();
|
||||||
// Set the challenge token so the confirm screen will not be shown
|
// Set the challenge token so the confirm screen will not be shown
|
||||||
testIntent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE_TOKEN, new byte[0]);
|
testIntent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE_TOKEN, new byte[0]);
|
||||||
|
testIntent.putExtra(BiometricUtils.EXTRA_ENROLL_REASON,
|
||||||
|
FaceEnrollOptions.ENROLL_REASON_SETTINGS);
|
||||||
|
|
||||||
when(mFakeFeatureFactory.mFaceFeatureProvider.getPostureGuidanceIntent(any())).thenReturn(
|
when(mFakeFeatureFactory.mFaceFeatureProvider.getPostureGuidanceIntent(any())).thenReturn(
|
||||||
null /* Simulate no posture intent */);
|
null /* Simulate no posture intent */);
|
||||||
@@ -220,6 +223,8 @@ public class FaceEnrollIntroductionTest {
|
|||||||
testIntent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE_TOKEN, new byte[0]);
|
testIntent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE_TOKEN, new byte[0]);
|
||||||
testIntent.putExtra(EXTRA_KEY_NEXT_LAUNCHED, false);
|
testIntent.putExtra(EXTRA_KEY_NEXT_LAUNCHED, false);
|
||||||
testIntent.putExtra(EXTRA_LAUNCHED_POSTURE_GUIDANCE, false);
|
testIntent.putExtra(EXTRA_LAUNCHED_POSTURE_GUIDANCE, false);
|
||||||
|
testIntent.putExtra(BiometricUtils.EXTRA_ENROLL_REASON,
|
||||||
|
FaceEnrollOptions.ENROLL_REASON_SETTINGS);
|
||||||
|
|
||||||
when(mFakeFeatureFactory.mFaceFeatureProvider.getPostureGuidanceIntent(any())).thenReturn(
|
when(mFakeFeatureFactory.mFaceFeatureProvider.getPostureGuidanceIntent(any())).thenReturn(
|
||||||
testIntent);
|
testIntent);
|
||||||
@@ -641,4 +646,14 @@ public class FaceEnrollIntroductionTest {
|
|||||||
final AlertDialog dialog = ShadowAlertDialogCompat.getLatestAlertDialog();
|
final AlertDialog dialog = ShadowAlertDialogCompat.getLatestAlertDialog();
|
||||||
assertThat(dialog).isNull();
|
assertThat(dialog).isNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testFaceEnrollIntroduction_forwardsEnrollOptions() {
|
||||||
|
setupActivity();
|
||||||
|
final Intent intent = mActivity.getEnrollingIntent();
|
||||||
|
|
||||||
|
assertThat(intent.getIntExtra(BiometricUtils.EXTRA_ENROLL_REASON, -1))
|
||||||
|
.isEqualTo(FaceEnrollOptions.ENROLL_REASON_SETTINGS);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -669,7 +669,8 @@ public class FingerprintEnrollEnrollingTest {
|
|||||||
any(CancellationSignal.class),
|
any(CancellationSignal.class),
|
||||||
anyInt(),
|
anyInt(),
|
||||||
callbackCaptor.capture(),
|
callbackCaptor.capture(),
|
||||||
eq(FingerprintManager.ENROLL_ENROLL));
|
eq(FingerprintManager.ENROLL_ENROLL),
|
||||||
|
any());
|
||||||
|
|
||||||
return callbackCaptor.getValue();
|
return callbackCaptor.getValue();
|
||||||
}
|
}
|
||||||
|
@@ -227,7 +227,8 @@ public class FingerprintEnrollFindSensorTest {
|
|||||||
any(CancellationSignal.class),
|
any(CancellationSignal.class),
|
||||||
anyInt(),
|
anyInt(),
|
||||||
callbackCaptor.capture(),
|
callbackCaptor.capture(),
|
||||||
eq(FingerprintManager.ENROLL_FIND_SENSOR));
|
eq(FingerprintManager.ENROLL_FIND_SENSOR),
|
||||||
|
any());
|
||||||
|
|
||||||
return callbackCaptor.getValue();
|
return callbackCaptor.getValue();
|
||||||
}
|
}
|
||||||
|
@@ -40,6 +40,7 @@ import android.content.res.Resources;
|
|||||||
import android.hardware.biometrics.ComponentInfoInternal;
|
import android.hardware.biometrics.ComponentInfoInternal;
|
||||||
import android.hardware.biometrics.SensorProperties;
|
import android.hardware.biometrics.SensorProperties;
|
||||||
import android.hardware.fingerprint.Fingerprint;
|
import android.hardware.fingerprint.Fingerprint;
|
||||||
|
import android.hardware.fingerprint.FingerprintEnrollOptions;
|
||||||
import android.hardware.fingerprint.FingerprintManager;
|
import android.hardware.fingerprint.FingerprintManager;
|
||||||
import android.hardware.fingerprint.FingerprintSensorProperties;
|
import android.hardware.fingerprint.FingerprintSensorProperties;
|
||||||
import android.hardware.fingerprint.FingerprintSensorPropertiesInternal;
|
import android.hardware.fingerprint.FingerprintSensorPropertiesInternal;
|
||||||
@@ -52,6 +53,7 @@ import androidx.annotation.Nullable;
|
|||||||
import com.android.internal.widget.LockPatternUtils;
|
import com.android.internal.widget.LockPatternUtils;
|
||||||
import com.android.internal.widget.VerifyCredentialResponse;
|
import com.android.internal.widget.VerifyCredentialResponse;
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
|
import com.android.settings.biometrics.BiometricUtils;
|
||||||
import com.android.settings.biometrics.GatekeeperPasswordProvider;
|
import com.android.settings.biometrics.GatekeeperPasswordProvider;
|
||||||
|
|
||||||
import com.google.android.setupcompat.util.WizardManagerHelper;
|
import com.google.android.setupcompat.util.WizardManagerHelper;
|
||||||
@@ -289,6 +291,18 @@ public class FingerprintEnrollIntroductionTest {
|
|||||||
assertThat(mFingerprintEnrollIntroduction.shouldFinishWhenBackgrounded()).isEqualTo(true);
|
assertThat(mFingerprintEnrollIntroduction.shouldFinishWhenBackgrounded()).isEqualTo(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testFingerprintEnrollIntroduction_forwardsEnrollOptions() {
|
||||||
|
final Intent intent = newTokenOnlyIntent();
|
||||||
|
intent.putExtra(BiometricUtils.EXTRA_ENROLL_REASON,
|
||||||
|
FingerprintEnrollOptions.ENROLL_REASON_SETTINGS);
|
||||||
|
setupFingerprintEnrollIntroWith(intent);
|
||||||
|
|
||||||
|
final Intent enrollingIntent = mFingerprintEnrollIntroduction.getEnrollingIntent();
|
||||||
|
assertThat(enrollingIntent.getIntExtra(BiometricUtils.EXTRA_ENROLL_REASON, -1))
|
||||||
|
.isEqualTo(FingerprintEnrollOptions.ENROLL_REASON_SETTINGS);
|
||||||
|
}
|
||||||
|
|
||||||
private Intent newTokenOnlyIntent() {
|
private Intent newTokenOnlyIntent() {
|
||||||
return new Intent()
|
return new Intent()
|
||||||
.putExtra(EXTRA_KEY_CHALLENGE_TOKEN, new byte[] { 1 });
|
.putExtra(EXTRA_KEY_CHALLENGE_TOKEN, new byte[] { 1 });
|
||||||
|
@@ -0,0 +1,97 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2024 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.bluetooth;
|
||||||
|
|
||||||
|
import static com.android.settings.bluetooth.BluetoothAutoOnPreferenceController.DISABLED;
|
||||||
|
import static com.android.settings.bluetooth.BluetoothAutoOnPreferenceController.ENABLED;
|
||||||
|
import static com.android.settings.bluetooth.BluetoothAutoOnPreferenceController.PREF_KEY;
|
||||||
|
import static com.android.settings.bluetooth.BluetoothAutoOnPreferenceController.SETTING_NAME;
|
||||||
|
import static com.android.settings.bluetooth.BluetoothAutoOnPreferenceController.UNSET;
|
||||||
|
import static com.android.settings.core.BasePreferenceController.AVAILABLE;
|
||||||
|
import static com.android.settings.core.BasePreferenceController.UNSUPPORTED_ON_DEVICE;
|
||||||
|
import static com.android.settingslib.flags.Flags.FLAG_BLUETOOTH_QS_TILE_DIALOG_AUTO_ON_TOGGLE;
|
||||||
|
|
||||||
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
|
|
||||||
|
import static org.mockito.Mockito.spy;
|
||||||
|
|
||||||
|
import android.content.ContentResolver;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.platform.test.flag.junit.SetFlagsRule;
|
||||||
|
import android.provider.Settings;
|
||||||
|
|
||||||
|
import androidx.test.core.app.ApplicationProvider;
|
||||||
|
|
||||||
|
import org.junit.Before;
|
||||||
|
import org.junit.Rule;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.robolectric.RobolectricTestRunner;
|
||||||
|
|
||||||
|
@RunWith(RobolectricTestRunner.class)
|
||||||
|
public class BluetoothAutoOnPreferenceControllerTest {
|
||||||
|
@Rule public final SetFlagsRule mSetFlagsRule = new SetFlagsRule();
|
||||||
|
private Context mContext;
|
||||||
|
private ContentResolver mContentResolver;
|
||||||
|
private BluetoothAutoOnPreferenceController mController;
|
||||||
|
|
||||||
|
@Before
|
||||||
|
public void setUp() {
|
||||||
|
mSetFlagsRule.enableFlags(FLAG_BLUETOOTH_QS_TILE_DIALOG_AUTO_ON_TOGGLE);
|
||||||
|
mContext = spy(ApplicationProvider.getApplicationContext());
|
||||||
|
mContentResolver = mContext.getContentResolver();
|
||||||
|
mController = new BluetoothAutoOnPreferenceController(mContext, PREF_KEY);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getAvailability_valueUnset_returnUnsupported() {
|
||||||
|
Settings.Secure.putInt(mContentResolver, SETTING_NAME, UNSET);
|
||||||
|
|
||||||
|
assertThat(mController.getAvailabilityStatus()).isEqualTo(UNSUPPORTED_ON_DEVICE);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getAvailability_valueSet_returnAvailable() {
|
||||||
|
Settings.Secure.putInt(mContentResolver, SETTING_NAME, DISABLED);
|
||||||
|
|
||||||
|
assertThat(mController.getAvailabilityStatus()).isEqualTo(AVAILABLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void isChecked_valueEnabled_returnTrue() {
|
||||||
|
Settings.Secure.putInt(mContentResolver, SETTING_NAME, ENABLED);
|
||||||
|
|
||||||
|
assertThat(mController.getAvailabilityStatus()).isEqualTo(AVAILABLE);
|
||||||
|
assertThat(mController.isChecked()).isEqualTo(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void setChecked_returnTrue() {
|
||||||
|
Settings.Secure.putInt(mContentResolver, SETTING_NAME, DISABLED);
|
||||||
|
|
||||||
|
mController.setChecked(true);
|
||||||
|
assertThat(mController.isChecked()).isEqualTo(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void setChecked_returnFalse() {
|
||||||
|
Settings.Secure.putInt(mContentResolver, SETTING_NAME, ENABLED);
|
||||||
|
|
||||||
|
mController.setChecked(false);
|
||||||
|
assertThat(mController.isChecked()).isEqualTo(false);
|
||||||
|
}
|
||||||
|
}
|
@@ -64,7 +64,7 @@ public class BatteryInfoTest {
|
|||||||
private static final String STATUS_CHARGING_NO_TIME = "50% - charging";
|
private static final String STATUS_CHARGING_NO_TIME = "50% - charging";
|
||||||
private static final String STATUS_CHARGING_TIME = "50% - 0 min left until full";
|
private static final String STATUS_CHARGING_TIME = "50% - 0 min left until full";
|
||||||
private static final String STATUS_NOT_CHARGING = "Not charging";
|
private static final String STATUS_NOT_CHARGING = "Not charging";
|
||||||
private static final String STATUS_CHARGING_FUTURE_BYPASS = "50% - Charging optimized";
|
private static final String STATUS_CHARGING_FUTURE_BYPASS = "50% - Charging";
|
||||||
private static final String STATUS_CHARGING_PAUSED = "50% - Charging optimized";
|
private static final String STATUS_CHARGING_PAUSED = "50% - Charging optimized";
|
||||||
private static final long REMAINING_TIME_NULL = -1;
|
private static final long REMAINING_TIME_NULL = -1;
|
||||||
private static final long REMAINING_TIME = 2;
|
private static final long REMAINING_TIME = 2;
|
||||||
|
@@ -82,7 +82,7 @@ public class BatteryDefenderTipTest {
|
|||||||
@Test
|
@Test
|
||||||
public void getIcon_showIcon() {
|
public void getIcon_showIcon() {
|
||||||
assertThat(mBatteryDefenderTip.getIconId())
|
assertThat(mBatteryDefenderTip.getIconId())
|
||||||
.isEqualTo(R.drawable.ic_battery_status_good_theme);
|
.isEqualTo(R.drawable.ic_battery_defender_tip_shield);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@@ -2,53 +2,56 @@ package com.android.settings.survey;
|
|||||||
|
|
||||||
import static org.mockito.Mockito.times;
|
import static org.mockito.Mockito.times;
|
||||||
import static org.mockito.Mockito.verify;
|
import static org.mockito.Mockito.verify;
|
||||||
import static org.mockito.Mockito.when;
|
|
||||||
|
|
||||||
import android.content.Context;
|
import androidx.fragment.app.Fragment;
|
||||||
|
import androidx.fragment.app.testing.FragmentScenario;
|
||||||
|
import androidx.test.core.app.ApplicationProvider;
|
||||||
|
|
||||||
import androidx.fragment.app.FragmentActivity;
|
|
||||||
|
|
||||||
import com.android.settings.core.InstrumentedPreferenceFragment;
|
|
||||||
import com.android.settings.overlay.SurveyFeatureProvider;
|
import com.android.settings.overlay.SurveyFeatureProvider;
|
||||||
import com.android.settings.testutils.FakeFeatureFactory;
|
import com.android.settings.testutils.FakeFeatureFactory;
|
||||||
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Ignore;
|
import org.junit.Rule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.mockito.Mock;
|
import org.mockito.junit.MockitoJUnit;
|
||||||
import org.mockito.MockitoAnnotations;
|
import org.mockito.junit.MockitoRule;
|
||||||
import org.robolectric.Robolectric;
|
|
||||||
import org.robolectric.RobolectricTestRunner;
|
import org.robolectric.RobolectricTestRunner;
|
||||||
import org.robolectric.RuntimeEnvironment;
|
|
||||||
|
|
||||||
@RunWith(RobolectricTestRunner.class)
|
@RunWith(RobolectricTestRunner.class)
|
||||||
public class SurveyMixinTest {
|
public class SurveyMixinTest {
|
||||||
|
@Rule
|
||||||
|
public final MockitoRule mMockitoRule = MockitoJUnit.rule();
|
||||||
|
|
||||||
private static final String FAKE_KEY = "fake_key";
|
private static final String FAKE_KEY = "fake_key";
|
||||||
|
|
||||||
private Context mContext;
|
|
||||||
private SurveyFeatureProvider mProvider;
|
private SurveyFeatureProvider mProvider;
|
||||||
@Mock
|
|
||||||
private InstrumentedPreferenceFragment mFragment;
|
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
// set up the fakefeature factory to mock out the survey provider
|
// set up the fakefeature factory to mock out the survey provider
|
||||||
MockitoAnnotations.initMocks(this);
|
mProvider = FakeFeatureFactory.setupForTest().getSurveyFeatureProvider(
|
||||||
mContext = RuntimeEnvironment.application;
|
ApplicationProvider.getApplicationContext());
|
||||||
mProvider = FakeFeatureFactory.setupForTest().getSurveyFeatureProvider(mContext);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Ignore("b/314929422")
|
|
||||||
@Test
|
@Test
|
||||||
public void onResume_noActionIfActivityDoesNotExist() {
|
public void onResume_noActionIfActivityDoesNotExist() {
|
||||||
// Pretend we are an activity that is starting up
|
// Initialize a fragment without associating with an activity
|
||||||
FragmentActivity temp = Robolectric.setupActivity(FragmentActivity.class);
|
Fragment fragment = new Fragment();
|
||||||
when(mFragment.getActivity()).thenReturn(null);
|
SurveyMixin mixin = new SurveyMixin(fragment, FAKE_KEY);
|
||||||
SurveyMixin mixin = new SurveyMixin(mFragment, FAKE_KEY);
|
|
||||||
mixin.onResume();
|
mixin.onResume();
|
||||||
|
|
||||||
verify(mProvider, times(0)).sendActivityIfAvailable(FAKE_KEY);
|
verify(mProvider, times(0)).sendActivityIfAvailable(FAKE_KEY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void onResume_sendActivityWhenSurveyFeatureExists() {
|
||||||
|
try (var fragmentScenario = FragmentScenario.launch(Fragment.class)) {
|
||||||
|
fragmentScenario.onFragment(fragment -> {
|
||||||
|
SurveyMixin mixin = new SurveyMixin(fragment, FAKE_KEY);
|
||||||
|
mixin.onResume();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// Verify one send activity action is attempted
|
||||||
|
verify(mProvider).sendActivityIfAvailable(FAKE_KEY);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -18,9 +18,11 @@ package com.android.settings.ui.privatespace
|
|||||||
|
|
||||||
|
|
||||||
import android.os.Flags
|
import android.os.Flags
|
||||||
|
import android.platform.test.annotations.RequiresFlagsDisabled
|
||||||
import android.platform.test.annotations.RequiresFlagsEnabled
|
import android.platform.test.annotations.RequiresFlagsEnabled
|
||||||
import android.platform.test.flag.junit.DeviceFlagsValueProvider
|
import android.platform.test.flag.junit.DeviceFlagsValueProvider
|
||||||
import android.provider.Settings
|
import android.provider.Settings
|
||||||
|
import android.util.Log
|
||||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||||
import androidx.test.platform.app.InstrumentationRegistry
|
import androidx.test.platform.app.InstrumentationRegistry
|
||||||
import androidx.test.uiautomator.By
|
import androidx.test.uiautomator.By
|
||||||
@@ -77,15 +79,18 @@ class PrivateSpaceAuthenticationActivityTest {
|
|||||||
Thread.sleep(1000)
|
Thread.sleep(1000)
|
||||||
device.assertHasTexts(listOf(SET_LOCK_BUTTON,CANCEL_TEXT))
|
device.assertHasTexts(listOf(SET_LOCK_BUTTON,CANCEL_TEXT))
|
||||||
device.clickObject(By.text(SET_LOCK_BUTTON))
|
device.clickObject(By.text(SET_LOCK_BUTTON))
|
||||||
device.assertHasTexts(listOf(LOCK_SCREEN_TITLE))
|
Thread.sleep(1000)
|
||||||
|
device.assertHasTexts(listOf(PATTERN_TEXT, PIN_TEXT, PASSWORD_TEXT))
|
||||||
}
|
}
|
||||||
|
|
||||||
private companion object {
|
private companion object {
|
||||||
// Items we really want to always show
|
// Items we really want to always show
|
||||||
val PRIVATE_SPACE_SETTING = "Private Space"
|
val PRIVATE_SPACE_SETTING = "Private space"
|
||||||
const val SET_LOCK_BUTTON = "Set screen lock"
|
const val SET_LOCK_BUTTON = "Set screen lock"
|
||||||
val CANCEL_TEXT = "Cancel"
|
val CANCEL_TEXT = "Cancel"
|
||||||
val DIALOG_TITLE = "Set a screen lock"
|
val DIALOG_TITLE = "Set a screen lock"
|
||||||
val LOCK_SCREEN_TITLE = "Choose screen lock"
|
val PATTERN_TEXT = "Pattern"
|
||||||
|
val PIN_TEXT = "PIN"
|
||||||
|
val PASSWORD_TEXT = "Password"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -25,6 +25,7 @@ import static org.mockito.Mockito.spy;
|
|||||||
import static org.mockito.Mockito.verify;
|
import static org.mockito.Mockito.verify;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
import android.hardware.face.Face;
|
import android.hardware.face.Face;
|
||||||
import android.hardware.face.FaceEnrollCell;
|
import android.hardware.face.FaceEnrollCell;
|
||||||
import android.hardware.face.FaceEnrollStages;
|
import android.hardware.face.FaceEnrollStages;
|
||||||
@@ -93,7 +94,7 @@ public class FaceUpdaterTest {
|
|||||||
ArgumentCaptor<FaceManager.EnrollmentCallback> callbackCaptor =
|
ArgumentCaptor<FaceManager.EnrollmentCallback> callbackCaptor =
|
||||||
ArgumentCaptor.forClass(FaceManager.EnrollmentCallback.class);
|
ArgumentCaptor.forClass(FaceManager.EnrollmentCallback.class);
|
||||||
mFaceUpdater.enroll(USER_ID, HARDWARE_AUTH_TOKEN, CANCELLATION_SIGNAL, mEnrollmentCallback,
|
mFaceUpdater.enroll(USER_ID, HARDWARE_AUTH_TOKEN, CANCELLATION_SIGNAL, mEnrollmentCallback,
|
||||||
DISABLED_FEATURES);
|
DISABLED_FEATURES, new Intent());
|
||||||
verify(mFaceManager).enroll(
|
verify(mFaceManager).enroll(
|
||||||
eq(USER_ID),
|
eq(USER_ID),
|
||||||
same(HARDWARE_AUTH_TOKEN),
|
same(HARDWARE_AUTH_TOKEN),
|
||||||
@@ -101,7 +102,8 @@ public class FaceUpdaterTest {
|
|||||||
callbackCaptor.capture(),
|
callbackCaptor.capture(),
|
||||||
same(DISABLED_FEATURES),
|
same(DISABLED_FEATURES),
|
||||||
same(null),
|
same(null),
|
||||||
eq(false));
|
eq(false),
|
||||||
|
any());
|
||||||
FaceManager.EnrollmentCallback callback = callbackCaptor.getValue();
|
FaceManager.EnrollmentCallback callback = callbackCaptor.getValue();
|
||||||
|
|
||||||
callback.onEnrollmentError(ERR_MSG_ID, ERR_STRING);
|
callback.onEnrollmentError(ERR_MSG_ID, ERR_STRING);
|
||||||
@@ -121,7 +123,7 @@ public class FaceUpdaterTest {
|
|||||||
ArgumentCaptor<FaceManager.EnrollmentCallback> callbackCaptor =
|
ArgumentCaptor<FaceManager.EnrollmentCallback> callbackCaptor =
|
||||||
ArgumentCaptor.forClass(FaceManager.EnrollmentCallback.class);
|
ArgumentCaptor.forClass(FaceManager.EnrollmentCallback.class);
|
||||||
mFaceUpdater.enroll(USER_ID, HARDWARE_AUTH_TOKEN, CANCELLATION_SIGNAL, mEnrollmentCallback,
|
mFaceUpdater.enroll(USER_ID, HARDWARE_AUTH_TOKEN, CANCELLATION_SIGNAL, mEnrollmentCallback,
|
||||||
DISABLED_FEATURES);
|
DISABLED_FEATURES, new Intent());
|
||||||
verify(mFaceManager).enroll(
|
verify(mFaceManager).enroll(
|
||||||
eq(USER_ID),
|
eq(USER_ID),
|
||||||
same(HARDWARE_AUTH_TOKEN),
|
same(HARDWARE_AUTH_TOKEN),
|
||||||
@@ -129,7 +131,8 @@ public class FaceUpdaterTest {
|
|||||||
callbackCaptor.capture(),
|
callbackCaptor.capture(),
|
||||||
same(DISABLED_FEATURES),
|
same(DISABLED_FEATURES),
|
||||||
same(null),
|
same(null),
|
||||||
eq(false));
|
eq(false),
|
||||||
|
any());
|
||||||
FaceManager.EnrollmentCallback callback = callbackCaptor.getValue();
|
FaceManager.EnrollmentCallback callback = callbackCaptor.getValue();
|
||||||
|
|
||||||
callback.onEnrollmentProgress(/* remaining= */ 0);
|
callback.onEnrollmentProgress(/* remaining= */ 0);
|
||||||
@@ -142,7 +145,7 @@ public class FaceUpdaterTest {
|
|||||||
ArgumentCaptor<FaceManager.EnrollmentCallback> callbackCaptor =
|
ArgumentCaptor<FaceManager.EnrollmentCallback> callbackCaptor =
|
||||||
ArgumentCaptor.forClass(FaceManager.EnrollmentCallback.class);
|
ArgumentCaptor.forClass(FaceManager.EnrollmentCallback.class);
|
||||||
mFaceUpdater.enroll(USER_ID, HARDWARE_AUTH_TOKEN, CANCELLATION_SIGNAL, mEnrollmentCallback,
|
mFaceUpdater.enroll(USER_ID, HARDWARE_AUTH_TOKEN, CANCELLATION_SIGNAL, mEnrollmentCallback,
|
||||||
DISABLED_FEATURES);
|
DISABLED_FEATURES, new Intent());
|
||||||
verify(mFaceManager).enroll(
|
verify(mFaceManager).enroll(
|
||||||
eq(USER_ID),
|
eq(USER_ID),
|
||||||
same(HARDWARE_AUTH_TOKEN),
|
same(HARDWARE_AUTH_TOKEN),
|
||||||
@@ -150,7 +153,8 @@ public class FaceUpdaterTest {
|
|||||||
callbackCaptor.capture(),
|
callbackCaptor.capture(),
|
||||||
same(DISABLED_FEATURES),
|
same(DISABLED_FEATURES),
|
||||||
same(null),
|
same(null),
|
||||||
eq(false));
|
eq(false),
|
||||||
|
any());
|
||||||
FaceManager.EnrollmentCallback callback = callbackCaptor.getValue();
|
FaceManager.EnrollmentCallback callback = callbackCaptor.getValue();
|
||||||
|
|
||||||
callback.onEnrollmentProgress(/* remaining= */ 1);
|
callback.onEnrollmentProgress(/* remaining= */ 1);
|
||||||
@@ -163,7 +167,7 @@ public class FaceUpdaterTest {
|
|||||||
ArgumentCaptor<FaceManager.EnrollmentCallback> callbackCaptor =
|
ArgumentCaptor<FaceManager.EnrollmentCallback> callbackCaptor =
|
||||||
ArgumentCaptor.forClass(FaceManager.EnrollmentCallback.class);
|
ArgumentCaptor.forClass(FaceManager.EnrollmentCallback.class);
|
||||||
mFaceUpdater.enroll(USER_ID, HARDWARE_AUTH_TOKEN, CANCELLATION_SIGNAL, mEnrollmentCallback,
|
mFaceUpdater.enroll(USER_ID, HARDWARE_AUTH_TOKEN, CANCELLATION_SIGNAL, mEnrollmentCallback,
|
||||||
DISABLED_FEATURES, PREVIEW_SURFACE, DEBUG_CONSENT);
|
DISABLED_FEATURES, PREVIEW_SURFACE, DEBUG_CONSENT, new Intent());
|
||||||
verify(mFaceManager).enroll(
|
verify(mFaceManager).enroll(
|
||||||
eq(USER_ID),
|
eq(USER_ID),
|
||||||
same(HARDWARE_AUTH_TOKEN),
|
same(HARDWARE_AUTH_TOKEN),
|
||||||
@@ -171,7 +175,8 @@ public class FaceUpdaterTest {
|
|||||||
callbackCaptor.capture(),
|
callbackCaptor.capture(),
|
||||||
same(DISABLED_FEATURES),
|
same(DISABLED_FEATURES),
|
||||||
same(PREVIEW_SURFACE),
|
same(PREVIEW_SURFACE),
|
||||||
eq(DEBUG_CONSENT));
|
eq(DEBUG_CONSENT),
|
||||||
|
any());
|
||||||
FaceManager.EnrollmentCallback callback = callbackCaptor.getValue();
|
FaceManager.EnrollmentCallback callback = callbackCaptor.getValue();
|
||||||
|
|
||||||
callback.onEnrollmentError(ERR_MSG_ID, ERR_STRING);
|
callback.onEnrollmentError(ERR_MSG_ID, ERR_STRING);
|
||||||
@@ -191,7 +196,7 @@ public class FaceUpdaterTest {
|
|||||||
ArgumentCaptor<FaceManager.EnrollmentCallback> callbackCaptor =
|
ArgumentCaptor<FaceManager.EnrollmentCallback> callbackCaptor =
|
||||||
ArgumentCaptor.forClass(FaceManager.EnrollmentCallback.class);
|
ArgumentCaptor.forClass(FaceManager.EnrollmentCallback.class);
|
||||||
mFaceUpdater.enroll(USER_ID, HARDWARE_AUTH_TOKEN, CANCELLATION_SIGNAL, mEnrollmentCallback,
|
mFaceUpdater.enroll(USER_ID, HARDWARE_AUTH_TOKEN, CANCELLATION_SIGNAL, mEnrollmentCallback,
|
||||||
DISABLED_FEATURES, PREVIEW_SURFACE, DEBUG_CONSENT);
|
DISABLED_FEATURES, PREVIEW_SURFACE, DEBUG_CONSENT, new Intent());
|
||||||
verify(mFaceManager).enroll(
|
verify(mFaceManager).enroll(
|
||||||
eq(USER_ID),
|
eq(USER_ID),
|
||||||
same(HARDWARE_AUTH_TOKEN),
|
same(HARDWARE_AUTH_TOKEN),
|
||||||
@@ -199,7 +204,8 @@ public class FaceUpdaterTest {
|
|||||||
callbackCaptor.capture(),
|
callbackCaptor.capture(),
|
||||||
same(DISABLED_FEATURES),
|
same(DISABLED_FEATURES),
|
||||||
same(PREVIEW_SURFACE),
|
same(PREVIEW_SURFACE),
|
||||||
eq(DEBUG_CONSENT));
|
eq(DEBUG_CONSENT),
|
||||||
|
any());
|
||||||
FaceManager.EnrollmentCallback callback = callbackCaptor.getValue();
|
FaceManager.EnrollmentCallback callback = callbackCaptor.getValue();
|
||||||
|
|
||||||
callback.onEnrollmentProgress(/* remaining= */ 0);
|
callback.onEnrollmentProgress(/* remaining= */ 0);
|
||||||
@@ -212,7 +218,7 @@ public class FaceUpdaterTest {
|
|||||||
ArgumentCaptor<FaceManager.EnrollmentCallback> callbackCaptor =
|
ArgumentCaptor<FaceManager.EnrollmentCallback> callbackCaptor =
|
||||||
ArgumentCaptor.forClass(FaceManager.EnrollmentCallback.class);
|
ArgumentCaptor.forClass(FaceManager.EnrollmentCallback.class);
|
||||||
mFaceUpdater.enroll(USER_ID, HARDWARE_AUTH_TOKEN, CANCELLATION_SIGNAL, mEnrollmentCallback,
|
mFaceUpdater.enroll(USER_ID, HARDWARE_AUTH_TOKEN, CANCELLATION_SIGNAL, mEnrollmentCallback,
|
||||||
DISABLED_FEATURES, PREVIEW_SURFACE, DEBUG_CONSENT);
|
DISABLED_FEATURES, PREVIEW_SURFACE, DEBUG_CONSENT, new Intent());
|
||||||
verify(mFaceManager).enroll(
|
verify(mFaceManager).enroll(
|
||||||
eq(USER_ID),
|
eq(USER_ID),
|
||||||
same(HARDWARE_AUTH_TOKEN),
|
same(HARDWARE_AUTH_TOKEN),
|
||||||
@@ -220,7 +226,8 @@ public class FaceUpdaterTest {
|
|||||||
callbackCaptor.capture(),
|
callbackCaptor.capture(),
|
||||||
same(DISABLED_FEATURES),
|
same(DISABLED_FEATURES),
|
||||||
same(PREVIEW_SURFACE),
|
same(PREVIEW_SURFACE),
|
||||||
eq(DEBUG_CONSENT));
|
eq(DEBUG_CONSENT),
|
||||||
|
any());
|
||||||
FaceManager.EnrollmentCallback callback = callbackCaptor.getValue();
|
FaceManager.EnrollmentCallback callback = callbackCaptor.getValue();
|
||||||
|
|
||||||
callback.onEnrollmentProgress(/* remaining= */ 1);
|
callback.onEnrollmentProgress(/* remaining= */ 1);
|
||||||
|
@@ -24,6 +24,7 @@ import static org.mockito.Mockito.spy;
|
|||||||
import static org.mockito.Mockito.verify;
|
import static org.mockito.Mockito.verify;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
import android.hardware.fingerprint.Fingerprint;
|
import android.hardware.fingerprint.Fingerprint;
|
||||||
import android.hardware.fingerprint.FingerprintManager;
|
import android.hardware.fingerprint.FingerprintManager;
|
||||||
import android.os.CancellationSignal;
|
import android.os.CancellationSignal;
|
||||||
@@ -78,13 +79,14 @@ public class FingerprintUpdaterTest {
|
|||||||
ArgumentCaptor<FingerprintManager.EnrollmentCallback> callbackCaptor =
|
ArgumentCaptor<FingerprintManager.EnrollmentCallback> callbackCaptor =
|
||||||
ArgumentCaptor.forClass(FingerprintManager.EnrollmentCallback.class);
|
ArgumentCaptor.forClass(FingerprintManager.EnrollmentCallback.class);
|
||||||
mFingerprintUpdater.enroll(HARDWARE_AUTH_TOKEN, CANCELLATION_SIGNAL, USER_ID,
|
mFingerprintUpdater.enroll(HARDWARE_AUTH_TOKEN, CANCELLATION_SIGNAL, USER_ID,
|
||||||
mEnrollmentCallback, ENROLL_REASON);
|
mEnrollmentCallback, ENROLL_REASON, new Intent());
|
||||||
verify(mFingerprintManager).enroll(
|
verify(mFingerprintManager).enroll(
|
||||||
same(HARDWARE_AUTH_TOKEN),
|
same(HARDWARE_AUTH_TOKEN),
|
||||||
same(CANCELLATION_SIGNAL),
|
same(CANCELLATION_SIGNAL),
|
||||||
eq(USER_ID),
|
eq(USER_ID),
|
||||||
callbackCaptor.capture(),
|
callbackCaptor.capture(),
|
||||||
eq(ENROLL_REASON));
|
eq(ENROLL_REASON),
|
||||||
|
any());
|
||||||
FingerprintManager.EnrollmentCallback callback = callbackCaptor.getValue();
|
FingerprintManager.EnrollmentCallback callback = callbackCaptor.getValue();
|
||||||
|
|
||||||
callback.onEnrollmentError(ERR_MSG_ID, ERR_STRING);
|
callback.onEnrollmentError(ERR_MSG_ID, ERR_STRING);
|
||||||
@@ -101,13 +103,14 @@ public class FingerprintUpdaterTest {
|
|||||||
ArgumentCaptor<FingerprintManager.EnrollmentCallback> callbackCaptor =
|
ArgumentCaptor<FingerprintManager.EnrollmentCallback> callbackCaptor =
|
||||||
ArgumentCaptor.forClass(FingerprintManager.EnrollmentCallback.class);
|
ArgumentCaptor.forClass(FingerprintManager.EnrollmentCallback.class);
|
||||||
mFingerprintUpdater.enroll(HARDWARE_AUTH_TOKEN, CANCELLATION_SIGNAL, USER_ID,
|
mFingerprintUpdater.enroll(HARDWARE_AUTH_TOKEN, CANCELLATION_SIGNAL, USER_ID,
|
||||||
mEnrollmentCallback, ENROLL_REASON);
|
mEnrollmentCallback, ENROLL_REASON, new Intent());
|
||||||
verify(mFingerprintManager).enroll(
|
verify(mFingerprintManager).enroll(
|
||||||
same(HARDWARE_AUTH_TOKEN),
|
same(HARDWARE_AUTH_TOKEN),
|
||||||
same(CANCELLATION_SIGNAL),
|
same(CANCELLATION_SIGNAL),
|
||||||
eq(USER_ID),
|
eq(USER_ID),
|
||||||
callbackCaptor.capture(),
|
callbackCaptor.capture(),
|
||||||
eq(ENROLL_REASON));
|
eq(ENROLL_REASON),
|
||||||
|
any());
|
||||||
FingerprintManager.EnrollmentCallback callback = callbackCaptor.getValue();
|
FingerprintManager.EnrollmentCallback callback = callbackCaptor.getValue();
|
||||||
|
|
||||||
callback.onEnrollmentProgress(/* remaining= */ 0);
|
callback.onEnrollmentProgress(/* remaining= */ 0);
|
||||||
@@ -120,13 +123,14 @@ public class FingerprintUpdaterTest {
|
|||||||
ArgumentCaptor<FingerprintManager.EnrollmentCallback> callbackCaptor =
|
ArgumentCaptor<FingerprintManager.EnrollmentCallback> callbackCaptor =
|
||||||
ArgumentCaptor.forClass(FingerprintManager.EnrollmentCallback.class);
|
ArgumentCaptor.forClass(FingerprintManager.EnrollmentCallback.class);
|
||||||
mFingerprintUpdater.enroll(HARDWARE_AUTH_TOKEN, CANCELLATION_SIGNAL, USER_ID,
|
mFingerprintUpdater.enroll(HARDWARE_AUTH_TOKEN, CANCELLATION_SIGNAL, USER_ID,
|
||||||
mEnrollmentCallback, ENROLL_REASON);
|
mEnrollmentCallback, ENROLL_REASON, new Intent());
|
||||||
verify(mFingerprintManager).enroll(
|
verify(mFingerprintManager).enroll(
|
||||||
same(HARDWARE_AUTH_TOKEN),
|
same(HARDWARE_AUTH_TOKEN),
|
||||||
same(CANCELLATION_SIGNAL),
|
same(CANCELLATION_SIGNAL),
|
||||||
eq(USER_ID),
|
eq(USER_ID),
|
||||||
callbackCaptor.capture(),
|
callbackCaptor.capture(),
|
||||||
eq(ENROLL_REASON));
|
eq(ENROLL_REASON),
|
||||||
|
any());
|
||||||
FingerprintManager.EnrollmentCallback callback = callbackCaptor.getValue();
|
FingerprintManager.EnrollmentCallback callback = callbackCaptor.getValue();
|
||||||
|
|
||||||
callback.onEnrollmentProgress(/* remaining= */ 1);
|
callback.onEnrollmentProgress(/* remaining= */ 1);
|
||||||
|
@@ -44,16 +44,24 @@ import org.mockito.Mockito.`when` as whenever
|
|||||||
|
|
||||||
@RunWith(AndroidJUnit4::class)
|
@RunWith(AndroidJUnit4::class)
|
||||||
class SfpsEnrollmentFeatureImplTest {
|
class SfpsEnrollmentFeatureImplTest {
|
||||||
|
private val STAGE_0 = 0
|
||||||
|
private val STAGE_1 = 1
|
||||||
|
private val STAGE_2 = 2
|
||||||
|
private val STAGE_3 = 3
|
||||||
|
private val STAGE_4 = 4
|
||||||
|
|
||||||
|
private val THRESHOLD_0 = 0f
|
||||||
|
private val THRESHOLD_1 = .36f
|
||||||
|
private val THRESHOLD_2 = .52f
|
||||||
|
private val THRESHOLD_3 = .76f
|
||||||
|
private val THRESHOLD_4 = 1f
|
||||||
|
|
||||||
@get:Rule
|
@get:Rule
|
||||||
val mockito: MockitoRule = MockitoJUnit.rule()
|
val mockito: MockitoRule = MockitoJUnit.rule()
|
||||||
|
|
||||||
@Spy
|
@Spy
|
||||||
private val context: Context = ApplicationProvider.getApplicationContext()
|
private val context: Context = ApplicationProvider.getApplicationContext()
|
||||||
|
|
||||||
private val settingsPackageName = "com.android.settings"
|
|
||||||
|
|
||||||
private lateinit var settingsContext: Context
|
|
||||||
|
|
||||||
@Mock
|
@Mock
|
||||||
private lateinit var mockFingerprintManager: FingerprintManager
|
private lateinit var mockFingerprintManager: FingerprintManager
|
||||||
|
|
||||||
@@ -61,31 +69,34 @@ class SfpsEnrollmentFeatureImplTest {
|
|||||||
|
|
||||||
@Before
|
@Before
|
||||||
fun setUp() {
|
fun setUp() {
|
||||||
assertThat(mSfpsEnrollmentFeatureImpl).isInstanceOf(SfpsEnrollmentFeatureImpl::class.java)
|
|
||||||
whenever(context.getSystemService(FingerprintManager::class.java))
|
whenever(context.getSystemService(FingerprintManager::class.java))
|
||||||
.thenReturn(mockFingerprintManager)
|
.thenReturn(mockFingerprintManager)
|
||||||
doReturn(0f).`when`(mockFingerprintManager).getEnrollStageThreshold(0)
|
doReturn(THRESHOLD_0).`when`(mockFingerprintManager).getEnrollStageThreshold(STAGE_0)
|
||||||
doReturn(0.36f).`when`(mockFingerprintManager).getEnrollStageThreshold(1)
|
doReturn(THRESHOLD_1).`when`(mockFingerprintManager).getEnrollStageThreshold(STAGE_1)
|
||||||
doReturn(0.52f).`when`(mockFingerprintManager).getEnrollStageThreshold(2)
|
doReturn(THRESHOLD_2).`when`(mockFingerprintManager).getEnrollStageThreshold(STAGE_2)
|
||||||
doReturn(0.76f).`when`(mockFingerprintManager).getEnrollStageThreshold(3)
|
doReturn(THRESHOLD_3).`when`(mockFingerprintManager).getEnrollStageThreshold(STAGE_3)
|
||||||
doReturn(1f).`when`(mockFingerprintManager).getEnrollStageThreshold(4)
|
doReturn(THRESHOLD_4).`when`(mockFingerprintManager).getEnrollStageThreshold(STAGE_4)
|
||||||
settingsContext = context.createPackageContext(settingsPackageName, 0)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testGetEnrollStageThreshold() {
|
fun testGetEnrollStageThreshold() {
|
||||||
assertThat(mSfpsEnrollmentFeatureImpl.getEnrollStageThreshold(context, 0)).isEqualTo(0f)
|
assertThat(mSfpsEnrollmentFeatureImpl.getEnrollStageThreshold(context, STAGE_0))
|
||||||
assertThat(mSfpsEnrollmentFeatureImpl.getEnrollStageThreshold(context, 1)).isEqualTo(0.36f)
|
.isEqualTo(THRESHOLD_0)
|
||||||
assertThat(mSfpsEnrollmentFeatureImpl.getEnrollStageThreshold(context, 2)).isEqualTo(0.52f)
|
assertThat(mSfpsEnrollmentFeatureImpl.getEnrollStageThreshold(context, STAGE_1))
|
||||||
assertThat(mSfpsEnrollmentFeatureImpl.getEnrollStageThreshold(context, 3)).isEqualTo(0.76f)
|
.isEqualTo(THRESHOLD_1)
|
||||||
assertThat(mSfpsEnrollmentFeatureImpl.getEnrollStageThreshold(context, 4)).isEqualTo(1f)
|
assertThat(mSfpsEnrollmentFeatureImpl.getEnrollStageThreshold(context, STAGE_2))
|
||||||
|
.isEqualTo(THRESHOLD_2)
|
||||||
|
assertThat(mSfpsEnrollmentFeatureImpl.getEnrollStageThreshold(context, STAGE_3))
|
||||||
|
.isEqualTo(THRESHOLD_3)
|
||||||
|
assertThat(mSfpsEnrollmentFeatureImpl.getEnrollStageThreshold(context, STAGE_4))
|
||||||
|
.isEqualTo(THRESHOLD_4)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testGetHelpAnimator() {
|
fun testGetHelpAnimator() {
|
||||||
val mockView: View = mock(View::class.java)
|
val mockView: View = mock(View::class.java)
|
||||||
val animator: Animator = mSfpsEnrollmentFeatureImpl.getHelpAnimator(mockView)
|
val animator: Animator = mSfpsEnrollmentFeatureImpl.getHelpAnimator(mockView)
|
||||||
assertThat(animator.duration).isEqualTo(550)
|
assertThat(animator.duration).isEqualTo(SfpsEnrollmentFeatureImpl.HELP_ANIMATOR_DURATION)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -115,42 +126,27 @@ class SfpsEnrollmentFeatureImplTest {
|
|||||||
assertThat(
|
assertThat(
|
||||||
mSfpsEnrollmentFeatureImpl.getFeaturedStageHeaderResource(SFPS_STAGE_NO_ANIMATION)
|
mSfpsEnrollmentFeatureImpl.getFeaturedStageHeaderResource(SFPS_STAGE_NO_ANIMATION)
|
||||||
).isEqualTo(
|
).isEqualTo(
|
||||||
settingsContext.resources.getIdentifier(
|
getSettingsResourcesId(type, "security_settings_fingerprint_enroll_repeat_title")
|
||||||
"security_settings_fingerprint_enroll_repeat_title",
|
|
||||||
type,
|
|
||||||
settingsPackageName)
|
|
||||||
)
|
)
|
||||||
assertThat(
|
assertThat(
|
||||||
mSfpsEnrollmentFeatureImpl.getFeaturedStageHeaderResource(SFPS_STAGE_CENTER)
|
mSfpsEnrollmentFeatureImpl.getFeaturedStageHeaderResource(SFPS_STAGE_CENTER)
|
||||||
).isEqualTo(
|
).isEqualTo(
|
||||||
settingsContext.resources.getIdentifier(
|
getSettingsResourcesId(type, "security_settings_sfps_enroll_finger_center_title")
|
||||||
"security_settings_sfps_enroll_finger_center_title",
|
|
||||||
type,
|
|
||||||
settingsPackageName)
|
|
||||||
)
|
)
|
||||||
assertThat(
|
assertThat(
|
||||||
mSfpsEnrollmentFeatureImpl.getFeaturedStageHeaderResource(SFPS_STAGE_FINGERTIP)
|
mSfpsEnrollmentFeatureImpl.getFeaturedStageHeaderResource(SFPS_STAGE_FINGERTIP)
|
||||||
).isEqualTo(
|
).isEqualTo(
|
||||||
settingsContext.resources.getIdentifier(
|
getSettingsResourcesId(type, "security_settings_sfps_enroll_fingertip_title")
|
||||||
"security_settings_sfps_enroll_fingertip_title",
|
|
||||||
type,
|
|
||||||
settingsPackageName)
|
|
||||||
)
|
)
|
||||||
assertThat(
|
assertThat(
|
||||||
mSfpsEnrollmentFeatureImpl.getFeaturedStageHeaderResource(SFPS_STAGE_LEFT_EDGE)
|
mSfpsEnrollmentFeatureImpl.getFeaturedStageHeaderResource(SFPS_STAGE_LEFT_EDGE)
|
||||||
).isEqualTo(
|
).isEqualTo(
|
||||||
settingsContext.resources.getIdentifier(
|
getSettingsResourcesId(type, "security_settings_sfps_enroll_left_edge_title")
|
||||||
"security_settings_sfps_enroll_left_edge_title",
|
|
||||||
type,
|
|
||||||
settingsPackageName)
|
|
||||||
)
|
)
|
||||||
assertThat(
|
assertThat(
|
||||||
mSfpsEnrollmentFeatureImpl.getFeaturedStageHeaderResource(SFPS_STAGE_RIGHT_EDGE)
|
mSfpsEnrollmentFeatureImpl.getFeaturedStageHeaderResource(SFPS_STAGE_RIGHT_EDGE)
|
||||||
).isEqualTo(
|
).isEqualTo(
|
||||||
settingsContext.resources.getIdentifier(
|
getSettingsResourcesId(type, "security_settings_sfps_enroll_right_edge_title")
|
||||||
"security_settings_sfps_enroll_right_edge_title",
|
|
||||||
type,
|
|
||||||
settingsPackageName)
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -159,43 +155,22 @@ class SfpsEnrollmentFeatureImplTest {
|
|||||||
val type = "raw"
|
val type = "raw"
|
||||||
assertThat(
|
assertThat(
|
||||||
mSfpsEnrollmentFeatureImpl.getSfpsEnrollLottiePerStage(SFPS_STAGE_NO_ANIMATION)
|
mSfpsEnrollmentFeatureImpl.getSfpsEnrollLottiePerStage(SFPS_STAGE_NO_ANIMATION)
|
||||||
).isEqualTo(
|
).isEqualTo(getSettingsResourcesId(type, "sfps_lottie_no_animation"))
|
||||||
settingsContext.resources.getIdentifier(
|
|
||||||
"sfps_lottie_no_animation",
|
|
||||||
type,
|
|
||||||
settingsPackageName)
|
|
||||||
)
|
|
||||||
assertThat(
|
assertThat(
|
||||||
mSfpsEnrollmentFeatureImpl.getSfpsEnrollLottiePerStage(SFPS_STAGE_CENTER)
|
mSfpsEnrollmentFeatureImpl.getSfpsEnrollLottiePerStage(SFPS_STAGE_CENTER)
|
||||||
).isEqualTo(
|
).isEqualTo(getSettingsResourcesId(type, "sfps_lottie_pad_center"))
|
||||||
settingsContext.resources.getIdentifier(
|
|
||||||
"sfps_lottie_pad_center",
|
|
||||||
type,
|
|
||||||
settingsPackageName)
|
|
||||||
)
|
|
||||||
assertThat(
|
assertThat(
|
||||||
mSfpsEnrollmentFeatureImpl.getSfpsEnrollLottiePerStage(SFPS_STAGE_FINGERTIP)
|
mSfpsEnrollmentFeatureImpl.getSfpsEnrollLottiePerStage(SFPS_STAGE_FINGERTIP)
|
||||||
).isEqualTo(
|
).isEqualTo(getSettingsResourcesId(type, "sfps_lottie_tip"))
|
||||||
settingsContext.resources.getIdentifier(
|
|
||||||
"sfps_lottie_tip",
|
|
||||||
type,
|
|
||||||
settingsPackageName)
|
|
||||||
)
|
|
||||||
assertThat(
|
assertThat(
|
||||||
mSfpsEnrollmentFeatureImpl.getSfpsEnrollLottiePerStage(SFPS_STAGE_LEFT_EDGE)
|
mSfpsEnrollmentFeatureImpl.getSfpsEnrollLottiePerStage(SFPS_STAGE_LEFT_EDGE)
|
||||||
).isEqualTo(
|
).isEqualTo(getSettingsResourcesId(type, "sfps_lottie_left_edge"))
|
||||||
settingsContext.resources.getIdentifier(
|
|
||||||
"sfps_lottie_left_edge",
|
|
||||||
type,
|
|
||||||
settingsPackageName)
|
|
||||||
)
|
|
||||||
assertThat(
|
assertThat(
|
||||||
mSfpsEnrollmentFeatureImpl.getSfpsEnrollLottiePerStage(SFPS_STAGE_RIGHT_EDGE)
|
mSfpsEnrollmentFeatureImpl.getSfpsEnrollLottiePerStage(SFPS_STAGE_RIGHT_EDGE)
|
||||||
).isEqualTo(
|
).isEqualTo(getSettingsResourcesId(type, "sfps_lottie_right_edge"))
|
||||||
settingsContext.resources.getIdentifier(
|
}
|
||||||
"sfps_lottie_right_edge",
|
|
||||||
type,
|
private fun getSettingsResourcesId(type: String, name: String) : Int {
|
||||||
settingsPackageName)
|
return context.resources.getIdentifier(name, type, context.packageName)
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -98,7 +98,7 @@ public class FingerprintEnrollProgressViewModelTest {
|
|||||||
mCallbackWrapper.mValue = invocation.getArgument(3);
|
mCallbackWrapper.mValue = invocation.getArgument(3);
|
||||||
return null;
|
return null;
|
||||||
}).when(mFingerprintUpdater).enroll(any(byte[].class), any(CancellationSignal.class),
|
}).when(mFingerprintUpdater).enroll(any(byte[].class), any(CancellationSignal.class),
|
||||||
eq(TEST_USER_ID), any(EnrollmentCallback.class), anyInt());
|
eq(TEST_USER_ID), any(EnrollmentCallback.class), anyInt(), any());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -112,7 +112,7 @@ public class FingerprintEnrollProgressViewModelTest {
|
|||||||
|
|
||||||
assertThat(ret).isNotNull();
|
assertThat(ret).isNotNull();
|
||||||
verify(mFingerprintUpdater, only()).enroll(eq(token), any(CancellationSignal.class),
|
verify(mFingerprintUpdater, only()).enroll(eq(token), any(CancellationSignal.class),
|
||||||
eq(TEST_USER_ID), any(EnrollmentCallback.class), eq(enrollReason));
|
eq(TEST_USER_ID), any(EnrollmentCallback.class), eq(enrollReason), any());
|
||||||
assertThat(mCallbackWrapper.mValue instanceof MessageDisplayController).isFalse();
|
assertThat(mCallbackWrapper.mValue instanceof MessageDisplayController).isFalse();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -127,7 +127,7 @@ public class FingerprintEnrollProgressViewModelTest {
|
|||||||
|
|
||||||
assertThat(ret).isNotNull();
|
assertThat(ret).isNotNull();
|
||||||
verify(mFingerprintUpdater, only()).enroll(eq(token), any(CancellationSignal.class),
|
verify(mFingerprintUpdater, only()).enroll(eq(token), any(CancellationSignal.class),
|
||||||
eq(TEST_USER_ID), any(EnrollmentCallback.class), eq(enrollReason));
|
eq(TEST_USER_ID), any(EnrollmentCallback.class), eq(enrollReason), any());
|
||||||
assertThat(mCallbackWrapper.mValue instanceof MessageDisplayController).isFalse();
|
assertThat(mCallbackWrapper.mValue instanceof MessageDisplayController).isFalse();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -146,7 +146,7 @@ public class FingerprintEnrollProgressViewModelTest {
|
|||||||
|
|
||||||
assertThat(ret).isNotNull();
|
assertThat(ret).isNotNull();
|
||||||
verify(mFingerprintUpdater, only()).enroll(eq(token), any(CancellationSignal.class),
|
verify(mFingerprintUpdater, only()).enroll(eq(token), any(CancellationSignal.class),
|
||||||
eq(TEST_USER_ID), any(MessageDisplayController.class), eq(enrollReason));
|
eq(TEST_USER_ID), any(MessageDisplayController.class), eq(enrollReason), any());
|
||||||
assertThat(mCallbackWrapper.mValue).isNotNull();
|
assertThat(mCallbackWrapper.mValue).isNotNull();
|
||||||
|
|
||||||
assertThat(mCallbackWrapper.mValue instanceof MessageDisplayController).isTrue();
|
assertThat(mCallbackWrapper.mValue instanceof MessageDisplayController).isTrue();
|
||||||
@@ -158,7 +158,7 @@ public class FingerprintEnrollProgressViewModelTest {
|
|||||||
|
|
||||||
// Shall not use the same MessageDisplayController
|
// Shall not use the same MessageDisplayController
|
||||||
verify(mFingerprintUpdater, times(2)).enroll(eq(token), any(CancellationSignal.class),
|
verify(mFingerprintUpdater, times(2)).enroll(eq(token), any(CancellationSignal.class),
|
||||||
eq(TEST_USER_ID), any(MessageDisplayController.class), eq(enrollReason));
|
eq(TEST_USER_ID), any(MessageDisplayController.class), eq(enrollReason), any());
|
||||||
assertThat(mCallbackWrapper.mValue).isNotNull();
|
assertThat(mCallbackWrapper.mValue).isNotNull();
|
||||||
assertThat(callback1).isNotEqualTo(mCallbackWrapper.mValue);
|
assertThat(callback1).isNotEqualTo(mCallbackWrapper.mValue);
|
||||||
}
|
}
|
||||||
@@ -170,7 +170,8 @@ public class FingerprintEnrollProgressViewModelTest {
|
|||||||
|
|
||||||
assertThat(ret).isNull();
|
assertThat(ret).isNull();
|
||||||
verify(mFingerprintUpdater, never()).enroll(any(byte[].class),
|
verify(mFingerprintUpdater, never()).enroll(any(byte[].class),
|
||||||
any(CancellationSignal.class), anyInt(), any(EnrollmentCallback.class), anyInt());
|
any(CancellationSignal.class), anyInt(), any(EnrollmentCallback.class), anyInt(),
|
||||||
|
any());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@@ -19,6 +19,7 @@ package com.android.settings.fingerprint2.domain.interactor
|
|||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.hardware.fingerprint.Fingerprint
|
import android.hardware.fingerprint.Fingerprint
|
||||||
|
import android.hardware.fingerprint.FingerprintEnrollOptions
|
||||||
import android.hardware.fingerprint.FingerprintManager
|
import android.hardware.fingerprint.FingerprintManager
|
||||||
import android.hardware.fingerprint.FingerprintManager.CryptoObject
|
import android.hardware.fingerprint.FingerprintManager.CryptoObject
|
||||||
import android.hardware.fingerprint.FingerprintManager.FINGERPRINT_ERROR_LOCKOUT_PERMANENT
|
import android.hardware.fingerprint.FingerprintManager.FINGERPRINT_ERROR_LOCKOUT_PERMANENT
|
||||||
@@ -99,6 +100,7 @@ class FingerprintManagerInteractorTest {
|
|||||||
gateKeeperPasswordProvider,
|
gateKeeperPasswordProvider,
|
||||||
pressToAuthInteractor,
|
pressToAuthInteractor,
|
||||||
Default,
|
Default,
|
||||||
|
Intent(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -312,7 +314,8 @@ class FingerprintManagerInteractorTest {
|
|||||||
any(CancellationSignal::class.java),
|
any(CancellationSignal::class.java),
|
||||||
anyInt(),
|
anyInt(),
|
||||||
capture(enrollCallback),
|
capture(enrollCallback),
|
||||||
eq(FingerprintManager.ENROLL_FIND_SENSOR)
|
eq(FingerprintManager.ENROLL_FIND_SENSOR),
|
||||||
|
any(FingerprintEnrollOptions::class.java),
|
||||||
)
|
)
|
||||||
enrollCallback.value.onEnrollmentProgress(1)
|
enrollCallback.value.onEnrollmentProgress(1)
|
||||||
runCurrent()
|
runCurrent()
|
||||||
@@ -336,7 +339,8 @@ class FingerprintManagerInteractorTest {
|
|||||||
any(CancellationSignal::class.java),
|
any(CancellationSignal::class.java),
|
||||||
anyInt(),
|
anyInt(),
|
||||||
capture(enrollCallback),
|
capture(enrollCallback),
|
||||||
eq(FingerprintManager.ENROLL_FIND_SENSOR)
|
eq(FingerprintManager.ENROLL_FIND_SENSOR),
|
||||||
|
any(FingerprintEnrollOptions::class.java),
|
||||||
)
|
)
|
||||||
enrollCallback.value.onEnrollmentHelp(-1, "help")
|
enrollCallback.value.onEnrollmentHelp(-1, "help")
|
||||||
runCurrent()
|
runCurrent()
|
||||||
@@ -360,7 +364,8 @@ class FingerprintManagerInteractorTest {
|
|||||||
any(CancellationSignal::class.java),
|
any(CancellationSignal::class.java),
|
||||||
anyInt(),
|
anyInt(),
|
||||||
capture(enrollCallback),
|
capture(enrollCallback),
|
||||||
eq(FingerprintManager.ENROLL_FIND_SENSOR)
|
eq(FingerprintManager.ENROLL_FIND_SENSOR),
|
||||||
|
any(FingerprintEnrollOptions::class.java),
|
||||||
)
|
)
|
||||||
enrollCallback.value.onEnrollmentError(-1, "error")
|
enrollCallback.value.onEnrollmentError(-1, "error")
|
||||||
runCurrent()
|
runCurrent()
|
||||||
|
@@ -0,0 +1,162 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2024 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.privatespace;
|
||||||
|
|
||||||
|
import static com.android.settings.core.BasePreferenceController.AVAILABLE;
|
||||||
|
import static com.android.settings.core.BasePreferenceController.DISABLED_DEPENDENT_SETTING;
|
||||||
|
import static com.android.settings.core.BasePreferenceController.UNSUPPORTED_ON_DEVICE;
|
||||||
|
|
||||||
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
|
|
||||||
|
import static org.junit.Assume.assumeTrue;
|
||||||
|
import static org.mockito.Mockito.spy;
|
||||||
|
|
||||||
|
import android.content.ContentResolver;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.platform.test.flag.junit.SetFlagsRule;
|
||||||
|
import android.provider.Settings;
|
||||||
|
|
||||||
|
import androidx.test.core.app.ApplicationProvider;
|
||||||
|
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||||
|
|
||||||
|
import org.junit.After;
|
||||||
|
import org.junit.Before;
|
||||||
|
import org.junit.Rule;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.mockito.Mock;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests for HidePrivateSpaceSensitiveNotificationsController.
|
||||||
|
* Run as {@code atest SettingsUnitTests:HidePrivateSpaceSensitiveNotificationsControllerTest}
|
||||||
|
*/
|
||||||
|
@RunWith(AndroidJUnit4.class)
|
||||||
|
public class HidePrivateSpaceSensitiveNotificationsControllerTest {
|
||||||
|
@Rule
|
||||||
|
public final SetFlagsRule mSetFlagsRule = new SetFlagsRule();
|
||||||
|
|
||||||
|
private Context mContext;
|
||||||
|
private HidePrivateSpaceSensitiveNotificationsController
|
||||||
|
mHidePrivateSpaceSensitiveNotificationsController;
|
||||||
|
@Mock
|
||||||
|
private ContentResolver mContentResolver;
|
||||||
|
private int mOriginalDeviceSensitiveNotifValue;
|
||||||
|
private int mOriginalDeviceNotifValue;
|
||||||
|
private int mOriginalPsSensitiveNotifValue;
|
||||||
|
private int mPrivateProfileId;
|
||||||
|
|
||||||
|
@Before
|
||||||
|
public void setUp() {
|
||||||
|
mContext = spy(ApplicationProvider.getApplicationContext());
|
||||||
|
mContentResolver = mContext.getContentResolver();
|
||||||
|
assumeTrue(PrivateSpaceMaintainer.getInstance(mContext).doesPrivateSpaceExist());
|
||||||
|
|
||||||
|
mSetFlagsRule.enableFlags(
|
||||||
|
android.multiuser.Flags.FLAG_ENABLE_PS_SENSITIVE_NOTIFICATIONS_TOGGLE);
|
||||||
|
mSetFlagsRule.enableFlags(android.os.Flags.FLAG_ALLOW_PRIVATE_PROFILE);
|
||||||
|
|
||||||
|
mPrivateProfileId = PrivateSpaceMaintainer.getInstance(
|
||||||
|
mContext).getPrivateProfileHandle().getIdentifier();
|
||||||
|
|
||||||
|
mOriginalDeviceSensitiveNotifValue = Settings.Secure.getInt(mContentResolver,
|
||||||
|
Settings.Secure.LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS, 1);
|
||||||
|
mOriginalDeviceNotifValue = Settings.Secure.getInt(mContentResolver,
|
||||||
|
Settings.Secure.LOCK_SCREEN_SHOW_NOTIFICATIONS, 1);
|
||||||
|
mOriginalPsSensitiveNotifValue = Settings.Secure.getIntForUser(mContentResolver,
|
||||||
|
Settings.Secure.LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS, 0, mPrivateProfileId);
|
||||||
|
|
||||||
|
final String preferenceKey = "private_space_sensitive_notifications";
|
||||||
|
mHidePrivateSpaceSensitiveNotificationsController =
|
||||||
|
new HidePrivateSpaceSensitiveNotificationsController(mContext, preferenceKey);
|
||||||
|
}
|
||||||
|
|
||||||
|
@After
|
||||||
|
public void tearDown() {
|
||||||
|
Settings.Secure.putInt(mContentResolver,
|
||||||
|
Settings.Secure.LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS,
|
||||||
|
mOriginalDeviceSensitiveNotifValue
|
||||||
|
);
|
||||||
|
Settings.Secure.putInt(mContext.getContentResolver(),
|
||||||
|
Settings.Secure.LOCK_SCREEN_SHOW_NOTIFICATIONS, mOriginalDeviceNotifValue);
|
||||||
|
Settings.Secure.putIntForUser(mContext.getContentResolver(),
|
||||||
|
Settings.Secure.LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS,
|
||||||
|
mOriginalPsSensitiveNotifValue, mPrivateProfileId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests that the controller is unavailable if lockscreen sensitive notifications are disabled
|
||||||
|
* on the device.
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void getAvailabilityStatus_lockScreenPrivateNotificationsOff() {
|
||||||
|
Settings.Secure.putInt(mContext.getContentResolver(),
|
||||||
|
Settings.Secure.LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS, 0);
|
||||||
|
assertThat(mHidePrivateSpaceSensitiveNotificationsController.getAvailabilityStatus())
|
||||||
|
.isEqualTo(DISABLED_DEPENDENT_SETTING);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests that the controller is unavailable if lockscreen notifications are disabled on the
|
||||||
|
* device.
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void getAvailabilityStatus_lockScreenNotificationsOff() {
|
||||||
|
Settings.Secure.putInt(mContext.getContentResolver(),
|
||||||
|
Settings.Secure.LOCK_SCREEN_SHOW_NOTIFICATIONS, 0);
|
||||||
|
assertThat(mHidePrivateSpaceSensitiveNotificationsController.getAvailabilityStatus())
|
||||||
|
.isEqualTo(DISABLED_DEPENDENT_SETTING);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests that the controller is available if lockscreen notifications and lockscreen private
|
||||||
|
* notifications are enabled on the device.
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void getAvailabilityStatus_returnAvailable() {
|
||||||
|
Settings.Secure.putInt(mContext.getContentResolver(),
|
||||||
|
Settings.Secure.LOCK_SCREEN_SHOW_NOTIFICATIONS, 1);
|
||||||
|
Settings.Secure.putInt(mContext.getContentResolver(),
|
||||||
|
Settings.Secure.LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS, 1);
|
||||||
|
assertThat(mHidePrivateSpaceSensitiveNotificationsController.getAvailabilityStatus())
|
||||||
|
.isEqualTo(AVAILABLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests that toggle is not available if the flag for this feature and MVP flag are disabled.
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void getAvailabilityStatus_flagDisabled() {
|
||||||
|
mSetFlagsRule.disableFlags(
|
||||||
|
android.multiuser.Flags.FLAG_ENABLE_PS_SENSITIVE_NOTIFICATIONS_TOGGLE);
|
||||||
|
mSetFlagsRule.disableFlags(android.os.Flags.FLAG_ALLOW_PRIVATE_PROFILE);
|
||||||
|
Settings.Secure.putInt(mContext.getContentResolver(),
|
||||||
|
Settings.Secure.LOCK_SCREEN_SHOW_NOTIFICATIONS, 1);
|
||||||
|
Settings.Secure.putInt(mContext.getContentResolver(),
|
||||||
|
Settings.Secure.LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS, 1);
|
||||||
|
assertThat(mHidePrivateSpaceSensitiveNotificationsController.getAvailabilityStatus())
|
||||||
|
.isEqualTo(UNSUPPORTED_ON_DEVICE);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testSetChecked() {
|
||||||
|
assertThat(mHidePrivateSpaceSensitiveNotificationsController.setChecked(true)).isTrue();
|
||||||
|
assertThat(mHidePrivateSpaceSensitiveNotificationsController.isChecked()).isEqualTo(true);
|
||||||
|
assertThat(mHidePrivateSpaceSensitiveNotificationsController.setChecked(false)).isTrue();
|
||||||
|
assertThat(mHidePrivateSpaceSensitiveNotificationsController.isChecked()).isEqualTo(false);
|
||||||
|
}
|
||||||
|
}
|
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
package com.android.settings.privatespace;
|
package com.android.settings.privatespace;
|
||||||
|
|
||||||
|
import static android.provider.Settings.Secure.LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS;
|
||||||
import static android.provider.Settings.Secure.PRIVATE_SPACE_AUTO_LOCK;
|
import static android.provider.Settings.Secure.PRIVATE_SPACE_AUTO_LOCK;
|
||||||
|
|
||||||
import static com.android.settings.privatespace.PrivateSpaceMaintainer.HIDE_PRIVATE_SPACE_ENTRY_POINT_DISABLED_VAL;
|
import static com.android.settings.privatespace.PrivateSpaceMaintainer.HIDE_PRIVATE_SPACE_ENTRY_POINT_DISABLED_VAL;
|
||||||
@@ -139,6 +140,24 @@ public class PrivateSpaceMaintainerTest {
|
|||||||
.isEqualTo(HIDE_PRIVATE_SPACE_ENTRY_POINT_DISABLED_VAL);
|
.isEqualTo(HIDE_PRIVATE_SPACE_ENTRY_POINT_DISABLED_VAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests that {@link PrivateSpaceMaintainer#createPrivateSpace()} sets the PS sensitive
|
||||||
|
* notifications to hidden by default.
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void createPrivateSpace_psDoesNotExist_setsDefaultPsSensitiveNotificationsValue() {
|
||||||
|
mSetFlagsRule.enableFlags(
|
||||||
|
Flags.FLAG_ALLOW_PRIVATE_PROFILE,
|
||||||
|
android.multiuser.Flags.FLAG_ENABLE_PS_SENSITIVE_NOTIFICATIONS_TOGGLE);
|
||||||
|
PrivateSpaceMaintainer privateSpaceMaintainer =
|
||||||
|
PrivateSpaceMaintainer.getInstance(mContext);
|
||||||
|
privateSpaceMaintainer.deletePrivateSpace();
|
||||||
|
privateSpaceMaintainer.createPrivateSpace();
|
||||||
|
assertThat(privateSpaceMaintainer.doesPrivateSpaceExist()).isTrue();
|
||||||
|
assertThat(getPsSensitiveNotificationsValue(privateSpaceMaintainer))
|
||||||
|
.isEqualTo(HidePrivateSpaceSensitiveNotificationsController.DISABLED);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests that {@link PrivateSpaceMaintainer#createPrivateSpace()} when PS exist does not reset
|
* Tests that {@link PrivateSpaceMaintainer#createPrivateSpace()} when PS exist does not reset
|
||||||
* hide PS Settings.
|
* hide PS Settings.
|
||||||
@@ -287,4 +306,11 @@ public class PrivateSpaceMaintainerTest {
|
|||||||
0,
|
0,
|
||||||
privateSpaceMaintainer.getPrivateProfileHandle().getIdentifier());
|
privateSpaceMaintainer.getPrivateProfileHandle().getIdentifier());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int getPsSensitiveNotificationsValue(PrivateSpaceMaintainer privateSpaceMaintainer) {
|
||||||
|
return Settings.Secure.getIntForUser(mContentResolver,
|
||||||
|
LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS,
|
||||||
|
HidePrivateSpaceSensitiveNotificationsController.ENABLED,
|
||||||
|
privateSpaceMaintainer.getPrivateProfileHandle().getIdentifier());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user