Snap for 8340624 from 240e85be9f to tm-release

Change-Id: I51c2e7293ba25e40be498a3ff068ae463824631a
This commit is contained in:
Android Build Coastguard Worker
2022-03-23 01:08:47 +00:00
37 changed files with 436 additions and 149 deletions

View File

@@ -205,7 +205,9 @@
</receiver> </receiver>
<activity android:name=".SubSettings" <activity android:name=".SubSettings"
android:theme="@style/Theme.SubSettings" /> android:exported="false"
android:theme="@style/Theme.SubSettings"
android:taskAffinity="com.android.settings.root" />
<activity android:name=".Settings$CreateShortcutActivity" <activity android:name=".Settings$CreateShortcutActivity"
android:exported="true" android:exported="true"
@@ -620,6 +622,17 @@
android:value="@string/menu_key_security"/> android:value="@string/menu_key_security"/>
</activity> </activity>
<activity android:name="Settings$FaceSettingsInternalActivity"
android:label="@string/security_settings_face_preference_title"
android:exported="false"
android:icon="@drawable/ic_face_header"
android:taskAffinity="com.android.settings.root">
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
android:value="com.android.settings.biometrics.face.FaceSettings" />
<meta-data android:name="com.android.settings.HIGHLIGHT_MENU_KEY"
android:value="@string/menu_key_security"/>
</activity>
<activity android:name="Settings$FingerprintSettingsActivity" <activity android:name="Settings$FingerprintSettingsActivity"
android:label="@string/security_settings_fingerprint_preference_title" android:label="@string/security_settings_fingerprint_preference_title"
android:exported="true" android:exported="true"
@@ -636,7 +649,8 @@
<activity android:name="Settings$CombinedBiometricSettingsActivity" <activity android:name="Settings$CombinedBiometricSettingsActivity"
android:label="@string/security_settings_biometric_preference_title" android:label="@string/security_settings_biometric_preference_title"
android:exported="false"> android:exported="false"
android:taskAffinity="com.android.settings.root">
<meta-data android:name="com.android.settings.FRAGMENT_CLASS" <meta-data android:name="com.android.settings.FRAGMENT_CLASS"
android:value="com.android.settings.biometrics.combination.CombinedBiometricSettings" /> android:value="com.android.settings.biometrics.combination.CombinedBiometricSettings" />
<meta-data android:name="com.android.settings.HIGHLIGHT_MENU_KEY" <meta-data android:name="com.android.settings.HIGHLIGHT_MENU_KEY"
@@ -721,7 +735,7 @@
android:name="Settings$WifiTetherSettingsActivity" android:name="Settings$WifiTetherSettingsActivity"
android:label="@string/wifi_hotspot_checkbox_text" android:label="@string/wifi_hotspot_checkbox_text"
android:exported="true" android:exported="true"
android:icon="@drawable/ic_wifi_tethering"> android:icon="@drawable/ic_homepage_wifi_tethering">
<intent-filter> <intent-filter>
<action android:name="com.android.settings.WIFI_TETHER_SETTINGS" /> <action android:name="com.android.settings.WIFI_TETHER_SETTINGS" />
<category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DEFAULT" />
@@ -766,7 +780,7 @@
android:name="Settings$VpnSettingsActivity" android:name="Settings$VpnSettingsActivity"
android:label="@string/vpn_settings_title" android:label="@string/vpn_settings_title"
android:exported="true" android:exported="true"
android:icon="@drawable/ic_settings_wireless"> android:icon="@drawable/ic_homepage_vpn">
<intent-filter android:priority="1"> <intent-filter android:priority="1">
<action android:name="android.settings.VPN_SETTINGS" /> <action android:name="android.settings.VPN_SETTINGS" />
<action android:name="android.net.vpn.SETTINGS" /> <action android:name="android.net.vpn.SETTINGS" />
@@ -2180,14 +2194,19 @@
android:screenOrientation="portrait"/> android:screenOrientation="portrait"/>
<activity android:name=".biometrics.face.FaceEnrollIntroduction" <activity android:name=".biometrics.face.FaceEnrollIntroduction"
android:exported="true" android:exported="true"
android:screenOrientation="portrait"> android:screenOrientation="portrait">
<intent-filter> <intent-filter>
<action android:name="android.settings.FACE_ENROLL"/> <action android:name="android.settings.FACE_ENROLL"/>
<category android:name="android.intent.category.DEFAULT"/> <category android:name="android.intent.category.DEFAULT"/>
</intent-filter> </intent-filter>
</activity> </activity>
<activity android:name=".biometrics.face.FaceEnrollIntroductionInternal"
android:exported="false"
android:screenOrientation="portrait"
android:taskAffinity="com.android.settings.root" />
<activity android:name=".biometrics.face.FaceEnrollEducation" <activity android:name=".biometrics.face.FaceEnrollEducation"
android:exported="false" android:exported="false"
android:screenOrientation="portrait"/> android:screenOrientation="portrait"/>
@@ -2217,7 +2236,9 @@
</intent-filter> </intent-filter>
</activity> </activity>
<activity android:name=".biometrics.fingerprint.FingerprintSettings" android:exported="false"/> <activity android:name=".biometrics.fingerprint.FingerprintSettings"
android:exported="false"
android:taskAffinity="com.android.settings.root" />
<activity android:name=".biometrics.fingerprint.FingerprintEnrollFindSensor" android:exported="false"/> <activity android:name=".biometrics.fingerprint.FingerprintEnrollFindSensor" android:exported="false"/>
<activity android:name=".biometrics.fingerprint.FingerprintEnrollEnrolling" android:exported="false"/> <activity android:name=".biometrics.fingerprint.FingerprintEnrollEnrolling" android:exported="false"/>
<activity android:name=".biometrics.fingerprint.FingerprintEnrollFinish" android:exported="false"/> <activity android:name=".biometrics.fingerprint.FingerprintEnrollFinish" android:exported="false"/>
@@ -2231,6 +2252,11 @@
</intent-filter> </intent-filter>
</activity> </activity>
<activity android:name=".biometrics.fingerprint.FingerprintEnrollIntroductionInternal"
android:exported="false"
android:theme="@style/GlifTheme.Light"
android:taskAffinity="com.android.settings.root" />
<activity android:name=".biometrics.fingerprint.SetupFingerprintEnrollFindSensor" android:exported="false"/> <activity android:name=".biometrics.fingerprint.SetupFingerprintEnrollFindSensor" android:exported="false"/>
<activity android:name=".biometrics.fingerprint.SetupFingerprintEnrollEnrolling" android:exported="false"/> <activity android:name=".biometrics.fingerprint.SetupFingerprintEnrollEnrolling" android:exported="false"/>
<activity android:name=".biometrics.fingerprint.SetupFingerprintEnrollFinish" android:exported="false"/> <activity android:name=".biometrics.fingerprint.SetupFingerprintEnrollFinish" android:exported="false"/>
@@ -2910,7 +2936,7 @@
android:name="Settings$DataUsageSummaryActivity" android:name="Settings$DataUsageSummaryActivity"
android:label="@string/data_usage_summary_title" android:label="@string/data_usage_summary_title"
android:exported="true" android:exported="true"
android:icon="@drawable/ic_settings_data_usage"> android:icon="@drawable/ic_homepage_data_usage">
<intent-filter android:priority="1"> <intent-filter android:priority="1">
<action android:name="android.settings.DATA_USAGE_SETTINGS" /> <action android:name="android.settings.DATA_USAGE_SETTINGS" />
<category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DEFAULT" />
@@ -4294,6 +4320,7 @@
android:name=".sim.ChooseSimActivity" android:name=".sim.ChooseSimActivity"
android:theme="@style/GlifV3Theme.DayNight.NoActionBar" android:theme="@style/GlifV3Theme.DayNight.NoActionBar"
android:launchMode="singleInstance" android:launchMode="singleInstance"
android:excludeFromRecents="true"
android:exported="false"/> android:exported="false"/>
<activity <activity

View File

@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2022 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.
-->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<com.android.settingslib.widget.AdaptiveIconShapeDrawable
android:width="@dimen/dashboard_tile_image_size"
android:height="@dimen/dashboard_tile_image_size"
android:color="@color/homepage_network_background" />
</item>
<item
android:width="@dimen/dashboard_tile_foreground_image_size"
android:height="@dimen/dashboard_tile_foreground_image_size"
android:start="@dimen/dashboard_tile_foreground_image_inset"
android:top="@dimen/dashboard_tile_foreground_image_inset"
android:drawable="@drawable/ic_settings_data_usage" />
</layer-list>

View File

@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2022 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.
-->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<com.android.settingslib.widget.AdaptiveIconShapeDrawable
android:width="@dimen/dashboard_tile_image_size"
android:height="@dimen/dashboard_tile_image_size"
android:color="@color/homepage_network_background" />
</item>
<item
android:width="@dimen/dashboard_tile_foreground_image_size"
android:height="@dimen/dashboard_tile_foreground_image_size"
android:start="@dimen/dashboard_tile_foreground_image_inset"
android:top="@dimen/dashboard_tile_foreground_image_inset"
android:drawable="@drawable/ic_settings_wireless" />
</layer-list>

View File

@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2022 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.
-->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<com.android.settingslib.widget.AdaptiveIconShapeDrawable
android:width="@dimen/dashboard_tile_image_size"
android:height="@dimen/dashboard_tile_image_size"
android:color="@color/homepage_network_background" />
</item>
<item
android:width="@dimen/dashboard_tile_foreground_image_size"
android:height="@dimen/dashboard_tile_foreground_image_size"
android:start="@dimen/dashboard_tile_foreground_image_inset"
android:top="@dimen/dashboard_tile_foreground_image_inset"
android:drawable="@drawable/ic_wifi_tethering" />
</layer-list>

View File

@@ -21,17 +21,15 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:minHeight="?android:attr/listPreferredItemHeightSmall" android:minHeight="?android:attr/listPreferredItemHeightSmall"
android:gravity="center_vertical" android:gravity="center_vertical"
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
android:clipToPadding="false"> android:clipToPadding="false">
<LinearLayout <LinearLayout
android:id="@+id/main_frame" android:id="@+id/main_frame"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
android:layout_weight="1" android:layout_weight="1"
android:gravity="start|center_vertical" android:gravity="start|center_vertical">
>
<FrameLayout <FrameLayout
android:id="@+id/icon_frame" android:id="@+id/icon_frame"
@@ -91,6 +89,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="match_parent"
android:gravity="end|center_vertical" android:gravity="end|center_vertical"
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
android:minWidth="58dp" android:minWidth="58dp"
android:orientation="vertical" /> android:orientation="vertical" />

View File

@@ -16,8 +16,10 @@
android:theme="@style/Widget.PopupWindow.Settings" /> android:theme="@style/Widget.PopupWindow.Settings" />
<FrameLayout <FrameLayout
android:id="@+id/frame_layout" android:id="@+id/frame_layout"
android:layout_width="match_parent" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
app:layout_constrainedWidth="true"
app:layout_constrainedHeight="true"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"

View File

@@ -5293,7 +5293,7 @@
<!-- Message for the mail content of the accessibility text reading preview. [CHAR LIMIT=NONE] --> <!-- Message for the mail content of the accessibility text reading preview. [CHAR LIMIT=NONE] -->
<string name="accessibility_text_reading_preview_mail_from">From: Bill</string> <string name="accessibility_text_reading_preview_mail_from">From: Bill</string>
<!-- Content for the mail content of the accessibility text reading preview. [CHAR LIMIT=NONE] --> <!-- Content for the mail content of the accessibility text reading preview. [CHAR LIMIT=NONE] -->
<string name="accessibility_text_reading_preview_mail_content">Good morning! Following up on our last conversation, I\u2019d like to check in on the progress of your time machine development plan. Will you be able to have a prototype ready to demo at E3 this year?</string> <string name="accessibility_text_reading_preview_mail_content">Good morning!\n\nI just wanted to check how the designs are coming. Will they be ready before we start building the new balloons?</string>
<!-- Title for the reset button of the accessibility text reading page to reset all preferences state. [CHAR LIMIT=25] --> <!-- Title for the reset button of the accessibility text reading page to reset all preferences state. [CHAR LIMIT=25] -->
<string name="accessibility_text_reading_reset_button_title">Reset settings</string> <string name="accessibility_text_reading_reset_button_title">Reset settings</string>
<!-- Title for the confirm dialog of reset settings. [CHAR LIMIT=NONE] --> <!-- Title for the confirm dialog of reset settings. [CHAR LIMIT=NONE] -->
@@ -13887,9 +13887,15 @@
<string name="tare_actions_ctp">Actions (Cost to Produce)</string> <string name="tare_actions_ctp">Actions (Cost to Produce)</string>
<!-- Title for the various TARE policy's actions' starting prices [CHAR LIMIT=40]--> <!-- Title for the various TARE policy's actions' starting prices [CHAR LIMIT=40]-->
<string name="tare_actions_base_price">Actions (Base Price)</string> <string name="tare_actions_base_price">Actions (Base Price)</string>
<!-- Title for the instant, ongoing, and max rewards apps can obtain for different actions that <!-- Title for the rewards apps can obtain for each instance of an event that implies the user
benefit the user. [CHAR LIMIT=40]--> finds the app behavior useful. [CHAR LIMIT=40]-->
<string name="tare_rewards">Rewards</string> <string name="tare_rewards_instantaneous">Rewards per single event</string>
<!-- Title for the rewards apps can obtain for the total duration (in seconds) of an event that
implies the user finds the app behavior useful. [CHAR LIMIT=40]-->
<string name="tare_rewards_ongoing">Rewards for total event duration</string>
<!-- Title for the max rewards apps can obtain within a 24 hour period for different actions
that benefit the user. [CHAR LIMIT=40]-->
<string name="tare_rewards_max">Maximum Rewards Per Day</string>
<!-- Title for the Allow While Idle Exact Wakeup Alarm set via <!-- Title for the Allow While Idle Exact Wakeup Alarm set via
AlarmManager.setExactAndAllowWhileIdle() [CHAR LIMIT=50]--> AlarmManager.setExactAndAllowWhileIdle() [CHAR LIMIT=50]-->
<string name="tare_wakeup_exact_idle" translatable="false"> <string name="tare_wakeup_exact_idle" translatable="false">
@@ -14025,7 +14031,7 @@
<string-array name="tare_rewards_subfactors" translatable="false"> <string-array name="tare_rewards_subfactors" translatable="false">
<item>@string/tare_top_activity</item> <item>@string/tare_top_activity</item>
<item>@string/tare_notification_seen</item> <item>@string/tare_notification_seen</item>
<item>@string/tare_notification_seen_15_min</item> <!-- TODO: add back once supported <item>@string/tare_notification_seen_15_min</item> -->
<item>@string/tare_notification_interaction</item> <item>@string/tare_notification_interaction</item>
<item>@string/tare_widget_interaction</item> <item>@string/tare_widget_interaction</item>
<item>@string/tare_other_interaction</item> <item>@string/tare_other_interaction</item>
@@ -14090,11 +14096,11 @@
<!-- The title of the spatial audio [CHAR LIMIT=none] --> <!-- The title of the spatial audio [CHAR LIMIT=none] -->
<string name="bluetooth_details_spatial_audio_title">Spatial audio</string> <string name="bluetooth_details_spatial_audio_title">Spatial audio</string>
<!-- The summary of the spatial audio [CHAR LIMIT=none] --> <!-- The summary of the spatial audio [CHAR LIMIT=none] -->
<string name="bluetooth_details_spatial_audio_summary">Immersive audio seems like it\u0027s coming from all around you. Only works with some media.</string> <string name="bluetooth_details_spatial_audio_summary">Audio from compatible media becomes more immersive</string>
<!-- The title of the head tracking [CHAR LIMIT=none] --> <!-- The title of the head tracking [CHAR LIMIT=none] -->
<string name="bluetooth_details_head_tracking_title">Make audio more realistic</string> <string name="bluetooth_details_head_tracking_title">Head tracking</string>
<!-- The summary of the head tracking [CHAR LIMIT=none] --> <!-- The summary of the head tracking [CHAR LIMIT=none] -->
<string name="bluetooth_details_head_tracking_summary">Shift positioning of audio so it sounds more natural.</string> <string name="bluetooth_details_head_tracking_summary">Audio changes as you move your head to sound more natural</string>
<!-- Developer Settings: Title for network bandwidth ingress rate limit [CHAR LIMIT=none] --> <!-- Developer Settings: Title for network bandwidth ingress rate limit [CHAR LIMIT=none] -->
<string name="ingress_rate_limit_title">Network download rate limit</string> <string name="ingress_rate_limit_title">Network download rate limit</string>

View File

@@ -28,6 +28,7 @@ import android.util.FeatureFlagUtils;
import android.util.Log; import android.util.Log;
import com.android.internal.annotations.VisibleForTesting; import com.android.internal.annotations.VisibleForTesting;
import com.android.settings.biometrics.face.FaceSettings;
import com.android.settings.core.FeatureFlags; import com.android.settings.core.FeatureFlags;
import com.android.settings.enterprise.EnterprisePrivacySettings; import com.android.settings.enterprise.EnterprisePrivacySettings;
import com.android.settings.network.SubscriptionUtil; import com.android.settings.network.SubscriptionUtil;
@@ -50,6 +51,8 @@ public class Settings extends SettingsActivity {
public static class BluetoothSettingsActivity extends SettingsActivity { /* empty */ } public static class BluetoothSettingsActivity extends SettingsActivity { /* empty */ }
public static class CreateShortcutActivity extends SettingsActivity { /* empty */ } public static class CreateShortcutActivity extends SettingsActivity { /* empty */ }
public static class FaceSettingsActivity extends SettingsActivity { /* empty */ } public static class FaceSettingsActivity extends SettingsActivity { /* empty */ }
/** Container for {@link FaceSettings} to use with a pre-defined task affinity. */
public static class FaceSettingsInternalActivity extends SettingsActivity { /* empty */ }
public static class FingerprintSettingsActivity extends SettingsActivity { /* empty */ } public static class FingerprintSettingsActivity extends SettingsActivity { /* empty */ }
public static class CombinedBiometricSettingsActivity extends SettingsActivity { /* empty */ } public static class CombinedBiometricSettingsActivity extends SettingsActivity { /* empty */ }
public static class CombinedBiometricProfileSettingsActivity extends SettingsActivity { /* empty */ } public static class CombinedBiometricProfileSettingsActivity extends SettingsActivity { /* empty */ }

View File

@@ -27,6 +27,7 @@ import android.content.ComponentName;
import android.content.ContentResolver; import android.content.ContentResolver;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.pm.PackageManager;
import android.icu.text.CaseMap; import android.icu.text.CaseMap;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
@@ -162,9 +163,14 @@ public class ToggleScreenMagnificationPreferenceFragment extends
@Override @Override
protected void initSettingsPreference() { protected void initSettingsPreference() {
// If the device doesn't support magnification area, it should hide the settings preference. // If the device doesn't support window magnification feature, it should hide the
if (!getContext().getResources().getBoolean( // settings preference.
com.android.internal.R.bool.config_magnification_area)) { final boolean supportWindowMagnification =
getContext().getResources().getBoolean(
com.android.internal.R.bool.config_magnification_area)
&& getContext().getPackageManager().hasSystemFeature(
PackageManager.FEATURE_WINDOW_MAGNIFICATION);
if (!supportWindowMagnification) {
return; return;
} }
mSettingsPreference = new Preference(getPrefContext()); mSettingsPreference = new Preference(getPrefContext());

View File

@@ -73,11 +73,11 @@ public abstract class VibrationIntensityPreferenceController extends SliderPrefe
mSettingsContentObserver.onDisplayPreference(this, preference); mSettingsContentObserver.onDisplayPreference(this, preference);
preference.setEnabled(mPreferenceConfig.isPreferenceEnabled()); preference.setEnabled(mPreferenceConfig.isPreferenceEnabled());
preference.setSummaryProvider(unused -> mPreferenceConfig.getSummary()); preference.setSummaryProvider(unused -> mPreferenceConfig.getSummary());
// TODO: remove setContinuousUpdates and replace with a different way to play the haptic
// preview without relying on the setting being propagated to the service.
preference.setContinuousUpdates(true);
preference.setMin(getMin()); preference.setMin(getMin());
preference.setMax(getMax()); preference.setMax(getMax());
// Haptics previews played by the Settings app don't bypass user settings to be played.
// The sliders continuously updates the intensity value so the previews can apply them.
preference.setContinuousUpdates(true);
} }
@Override @Override

View File

@@ -23,6 +23,8 @@ import android.content.Context;
import android.database.ContentObserver; import android.database.ContentObserver;
import android.net.Uri; import android.net.Uri;
import android.os.Handler; import android.os.Handler;
import android.os.VibrationAttributes;
import android.os.Vibrator;
import android.provider.Settings; import android.provider.Settings;
import com.android.settings.R; import com.android.settings.R;
@@ -42,9 +44,11 @@ public class VibrationMainSwitchPreferenceController extends SettingsMainSwitchP
implements LifecycleObserver, OnStart, OnStop { implements LifecycleObserver, OnStart, OnStop {
private final ContentObserver mSettingObserver; private final ContentObserver mSettingObserver;
private final Vibrator mVibrator;
public VibrationMainSwitchPreferenceController(Context context, String preferenceKey) { public VibrationMainSwitchPreferenceController(Context context, String preferenceKey) {
super(context, preferenceKey); super(context, preferenceKey);
mVibrator = context.getSystemService(Vibrator.class);
mSettingObserver = new ContentObserver(new Handler(/* async= */ true)) { mSettingObserver = new ContentObserver(new Handler(/* async= */ true)) {
@Override @Override
public void onChange(boolean selfChange, Uri uri) { public void onChange(boolean selfChange, Uri uri) {
@@ -79,9 +83,17 @@ public class VibrationMainSwitchPreferenceController extends SettingsMainSwitchP
@Override @Override
public boolean setChecked(boolean isChecked) { public boolean setChecked(boolean isChecked) {
return Settings.System.putInt(mContext.getContentResolver(), boolean success = Settings.System.putInt(mContext.getContentResolver(),
VibrationPreferenceConfig.MAIN_SWITCH_SETTING_KEY, VibrationPreferenceConfig.MAIN_SWITCH_SETTING_KEY,
isChecked ? ON : OFF); isChecked ? ON : OFF);
if (success && isChecked) {
// Play a haptic as preview for the main toggle only when touch feedback is enabled.
VibrationPreferenceConfig.playVibrationPreview(
mVibrator, VibrationAttributes.USAGE_TOUCH);
}
return success;
} }
@Override @Override

View File

@@ -49,6 +49,8 @@ public abstract class VibrationPreferenceConfig {
* all device vibrations. * all device vibrations.
*/ */
public static final String MAIN_SWITCH_SETTING_KEY = Settings.System.VIBRATE_ON; public static final String MAIN_SWITCH_SETTING_KEY = Settings.System.VIBRATE_ON;
private static final VibrationEffect PREVIEW_VIBRATION_EFFECT =
VibrationEffect.createPredefined(VibrationEffect.EFFECT_CLICK);
protected final ContentResolver mContentResolver; protected final ContentResolver mContentResolver;
private final AudioManager mAudioManager; private final AudioManager mAudioManager;
@@ -56,14 +58,22 @@ public abstract class VibrationPreferenceConfig {
private final String mSettingKey; private final String mSettingKey;
private final String mRingerModeSilentSummary; private final String mRingerModeSilentSummary;
private final int mDefaultIntensity; private final int mDefaultIntensity;
private final VibrationAttributes mVibrationAttributes; private final VibrationAttributes mPreviewVibrationAttributes;
/** Returns true if the user setting for enabling device vibrations is enabled. */ /** Returns true if the user setting for enabling device vibrations is enabled. */
public static boolean isMainVibrationSwitchEnabled(ContentResolver contentResolver) { public static boolean isMainVibrationSwitchEnabled(ContentResolver contentResolver) {
return Settings.System.getInt(contentResolver, MAIN_SWITCH_SETTING_KEY, ON) == ON; return Settings.System.getInt(contentResolver, MAIN_SWITCH_SETTING_KEY, ON) == ON;
} }
public VibrationPreferenceConfig(Context context, String settingKey, int vibrationUsage) { /** Play a vibration effect with intensity just selected by the user. */
public static void playVibrationPreview(Vibrator vibrator,
@VibrationAttributes.Usage int vibrationUsage) {
vibrator.vibrate(PREVIEW_VIBRATION_EFFECT,
createPreviewVibrationAttributes(vibrationUsage));
}
public VibrationPreferenceConfig(Context context, String settingKey,
@VibrationAttributes.Usage int vibrationUsage) {
mContentResolver = context.getContentResolver(); mContentResolver = context.getContentResolver();
mVibrator = context.getSystemService(Vibrator.class); mVibrator = context.getSystemService(Vibrator.class);
mAudioManager = context.getSystemService(AudioManager.class); mAudioManager = context.getSystemService(AudioManager.class);
@@ -71,9 +81,7 @@ public abstract class VibrationPreferenceConfig {
R.string.accessibility_vibration_setting_disabled_for_silent_mode_summary); R.string.accessibility_vibration_setting_disabled_for_silent_mode_summary);
mSettingKey = settingKey; mSettingKey = settingKey;
mDefaultIntensity = mVibrator.getDefaultVibrationIntensity(vibrationUsage); mDefaultIntensity = mVibrator.getDefaultVibrationIntensity(vibrationUsage);
mVibrationAttributes = new VibrationAttributes.Builder() mPreviewVibrationAttributes = createPreviewVibrationAttributes(vibrationUsage);
.setUsage(vibrationUsage)
.build();
} }
/** Returns the setting key for this setting preference. */ /** Returns the setting key for this setting preference. */
@@ -118,8 +126,7 @@ public abstract class VibrationPreferenceConfig {
/** Play a vibration effect with intensity just selected by the user. */ /** Play a vibration effect with intensity just selected by the user. */
public void playVibrationPreview() { public void playVibrationPreview() {
mVibrator.vibrate(VibrationEffect.createPredefined(VibrationEffect.EFFECT_CLICK), mVibrator.vibrate(PREVIEW_VIBRATION_EFFECT, mPreviewVibrationAttributes);
mVibrationAttributes);
} }
private boolean isRingerModeSilent() { private boolean isRingerModeSilent() {
@@ -128,6 +135,16 @@ public abstract class VibrationPreferenceConfig {
return mAudioManager.getRingerModeInternal() == AudioManager.RINGER_MODE_SILENT; return mAudioManager.getRingerModeInternal() == AudioManager.RINGER_MODE_SILENT;
} }
private static VibrationAttributes createPreviewVibrationAttributes(
@VibrationAttributes.Usage int vibrationUsage) {
return new VibrationAttributes.Builder()
.setUsage(vibrationUsage)
// Enforce fresh settings to be applied for the preview vibration, as they
// are played immediately after the new user values are set.
.setFlags(VibrationAttributes.FLAG_INVALIDATE_SETTINGS_CACHE)
.build();
}
/** {@link ContentObserver} for a setting described by a {@link VibrationPreferenceConfig}. */ /** {@link ContentObserver} for a setting described by a {@link VibrationPreferenceConfig}. */
public static final class SettingObserver extends ContentObserver { public static final class SettingObserver extends ContentObserver {
private static final Uri MAIN_SWITCH_SETTING_URI = private static final Uri MAIN_SWITCH_SETTING_URI =

View File

@@ -124,6 +124,12 @@ public class VibrationRampingRingerTogglePreferenceController
if (isRingVibrationEnabled()) { if (isRingVibrationEnabled()) {
// Don't update ramping ringer setting value if ring vibration is disabled. // Don't update ramping ringer setting value if ring vibration is disabled.
mAudioManager.setRampingRingerEnabled(isChecked); mAudioManager.setRampingRingerEnabled(isChecked);
if (isChecked) {
// Vibrate when toggle is enabled for consistency with all the other toggle/slides
// in the same screen.
mRingVibrationPreferenceConfig.playVibrationPreview();
}
} }
return true; return true;
} }

View File

@@ -38,6 +38,7 @@ import com.android.settings.SettingsActivity;
import com.android.settings.SubSettings; import com.android.settings.SubSettings;
import com.android.settings.biometrics.fingerprint.FingerprintEnrollEnrolling; import com.android.settings.biometrics.fingerprint.FingerprintEnrollEnrolling;
import com.android.settings.biometrics.fingerprint.FingerprintEnrollIntroduction; import com.android.settings.biometrics.fingerprint.FingerprintEnrollIntroduction;
import com.android.settings.biometrics.fingerprint.FingerprintEnrollIntroductionInternal;
import com.android.settings.core.FeatureFlags; import com.android.settings.core.FeatureFlags;
import com.android.settings.homepage.DeepLinkHomepageActivity; import com.android.settings.homepage.DeepLinkHomepageActivity;
import com.android.settings.homepage.SettingsHomepageActivity; import com.android.settings.homepage.SettingsHomepageActivity;
@@ -52,6 +53,8 @@ import java.util.Set;
public class ActivityEmbeddingRulesController { public class ActivityEmbeddingRulesController {
private static final String TAG = "ActivityEmbeddingCtrl"; private static final String TAG = "ActivityEmbeddingCtrl";
private static final ComponentName COMPONENT_NAME_WILDCARD = new ComponentName(
"*" /* pkg */, "*" /* cls */);
private final Context mContext; private final Context mContext;
private final SplitController mSplitController; private final SplitController mSplitController;
@@ -187,6 +190,13 @@ public class ActivityEmbeddingRulesController {
new ComponentName(context, SubSettings.class), new ComponentName(context, SubSettings.class),
null /* secondaryIntentAction */, null /* secondaryIntentAction */,
clearTop); clearTop);
registerTwoPanePairRuleForSettingsHome(
context,
COMPONENT_NAME_WILDCARD,
Intent.ACTION_SAFETY_CENTER,
clearTop
);
} }
private void registerHomepagePlaceholderRule() { private void registerHomepagePlaceholderRule() {
@@ -220,14 +230,14 @@ public class ActivityEmbeddingRulesController {
addActivityFilter(activityFilters, searchIntent); addActivityFilter(activityFilters, searchIntent);
} }
addActivityFilter(activityFilters, FingerprintEnrollIntroduction.class); addActivityFilter(activityFilters, FingerprintEnrollIntroduction.class);
addActivityFilter(activityFilters, FingerprintEnrollIntroductionInternal.class);
addActivityFilter(activityFilters, FingerprintEnrollEnrolling.class); addActivityFilter(activityFilters, FingerprintEnrollEnrolling.class);
addActivityFilter(activityFilters, AvatarPickerActivity.class); addActivityFilter(activityFilters, AvatarPickerActivity.class);
mSplitController.registerRule(new ActivityRule(activityFilters, true /* alwaysExpand */)); mSplitController.registerRule(new ActivityRule(activityFilters, true /* alwaysExpand */));
} }
private static void addActivityFilter(Set<ActivityFilter> activityFilters, Intent intent) { private static void addActivityFilter(Set<ActivityFilter> activityFilters, Intent intent) {
activityFilters.add(new ActivityFilter(new ComponentName("*" /* pkg */, "*" /* cls */), activityFilters.add(new ActivityFilter(COMPONENT_NAME_WILDCARD, intent.getAction()));
intent.getAction()));
} }
private void addActivityFilter(Set<ActivityFilter> activityFilters, private void addActivityFilter(Set<ActivityFilter> activityFilters,

View File

@@ -0,0 +1,23 @@
/*
* Copyright (C) 2022 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.biometrics.face;
/**
* Wrapper of {@link FaceEnrollIntroduction} to use with a pre-defined task affinity.
*/
public class FaceEnrollIntroductionInternal extends FaceEnrollIntroduction {
}

View File

@@ -71,8 +71,8 @@ public class FaceStatusUtils {
* Returns the class name of the Settings page corresponding to face settings. * Returns the class name of the Settings page corresponding to face settings.
*/ */
public String getSettingsClassName() { public String getSettingsClassName() {
return hasEnrolled() ? Settings.FaceSettingsActivity.class.getName() return hasEnrolled() ? Settings.FaceSettingsInternalActivity.class.getName()
: FaceEnrollIntroduction.class.getName(); : FaceEnrollIntroductionInternal.class.getName();
} }
/** /**

View File

@@ -0,0 +1,23 @@
/*
* Copyright (C) 2022 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.biometrics.fingerprint;
/**
* Wrapper of {@link FingerprintEnrollIntroduction} to use with a pre-defined task affinity.
*/
public class FingerprintEnrollIntroductionInternal extends FingerprintEnrollIntroduction {
}

View File

@@ -79,7 +79,7 @@ public class FingerprintStatusUtils {
*/ */
public String getSettingsClassName() { public String getSettingsClassName() {
return hasEnrolled() ? FingerprintSettings.class.getName() return hasEnrolled() ? FingerprintSettings.class.getName()
: FingerprintEnrollIntroduction.class.getName(); : FingerprintEnrollIntroductionInternal.class.getName();
} }
/** /**

View File

@@ -97,7 +97,8 @@ public class AlarmManagerFragment extends Fragment implements
// resources.getString(R.string.tare_modifiers), // resources.getString(R.string.tare_modifiers),
resources.getString(R.string.tare_actions_ctp), resources.getString(R.string.tare_actions_ctp),
resources.getString(R.string.tare_actions_base_price), resources.getString(R.string.tare_actions_base_price),
// resources.getString(R.string.tare_rewards) resources.getString(R.string.tare_rewards_instantaneous),
resources.getString(R.string.tare_rewards_max)
}; };
mChildren = new String[][]{ mChildren = new String[][]{
@@ -107,7 +108,8 @@ public class AlarmManagerFragment extends Fragment implements
// resources.getStringArray(R.array.tare_modifiers_subfactors), // resources.getStringArray(R.array.tare_modifiers_subfactors),
resources.getStringArray(R.array.tare_alarm_manager_actions), resources.getStringArray(R.array.tare_alarm_manager_actions),
resources.getStringArray(R.array.tare_alarm_manager_actions), resources.getStringArray(R.array.tare_alarm_manager_actions),
// resources.getStringArray(R.array.tare_rewards_subfactors) resources.getStringArray(R.array.tare_rewards_subfactors),
resources.getStringArray(R.array.tare_rewards_subfactors)
}; };
mKeys = new String[][]{ mKeys = new String[][]{
@@ -147,7 +149,20 @@ public class AlarmManagerFragment extends Fragment implements
EconomyManager.KEY_AM_ACTION_ALARM_INEXACT_NONWAKEUP_BASE_PRICE, EconomyManager.KEY_AM_ACTION_ALARM_INEXACT_NONWAKEUP_BASE_PRICE,
EconomyManager.KEY_AM_ACTION_ALARM_ALARMCLOCK_BASE_PRICE EconomyManager.KEY_AM_ACTION_ALARM_ALARMCLOCK_BASE_PRICE
}, },
// {}, {
EconomyManager.KEY_AM_REWARD_TOP_ACTIVITY_MAX,
EconomyManager.KEY_AM_REWARD_NOTIFICATION_SEEN_MAX,
EconomyManager.KEY_AM_REWARD_NOTIFICATION_INTERACTION_MAX,
EconomyManager.KEY_AM_REWARD_WIDGET_INTERACTION_MAX,
EconomyManager.KEY_AM_REWARD_OTHER_USER_INTERACTION_MAX,
},
{
EconomyManager.KEY_AM_REWARD_TOP_ACTIVITY_MAX,
EconomyManager.KEY_AM_REWARD_NOTIFICATION_SEEN_MAX,
EconomyManager.KEY_AM_REWARD_NOTIFICATION_INTERACTION_MAX,
EconomyManager.KEY_AM_REWARD_WIDGET_INTERACTION_MAX,
EconomyManager.KEY_AM_REWARD_OTHER_USER_INTERACTION_MAX,
}
}; };
} }
} }

View File

@@ -98,7 +98,9 @@ public class JobSchedulerFragment extends Fragment implements
// mResources.getString(R.string.tare_modifiers), // mResources.getString(R.string.tare_modifiers),
resources.getString(R.string.tare_actions_ctp), resources.getString(R.string.tare_actions_ctp),
resources.getString(R.string.tare_actions_base_price), resources.getString(R.string.tare_actions_base_price),
// mResources.getString(R.string.tare_rewards) resources.getString(R.string.tare_rewards_instantaneous),
// resources.getString(R.string.tare_rewards_ongoing),
resources.getString(R.string.tare_rewards_max)
}; };
mChildren = new String[][]{ mChildren = new String[][]{
@@ -108,7 +110,9 @@ public class JobSchedulerFragment extends Fragment implements
// mResources.getStringArray(R.array.tare_modifiers_subfactors), // mResources.getStringArray(R.array.tare_modifiers_subfactors),
resources.getStringArray(R.array.tare_job_scheduler_actions), resources.getStringArray(R.array.tare_job_scheduler_actions),
resources.getStringArray(R.array.tare_job_scheduler_actions), resources.getStringArray(R.array.tare_job_scheduler_actions),
// mResources.getStringArray(R.array.tare_rewards_subfactors) resources.getStringArray(R.array.tare_rewards_subfactors),
// {resources.getString(R.string.tare_top_activity)},
resources.getStringArray(R.array.tare_rewards_subfactors)
}; };
mKeys = new String[][]{ mKeys = new String[][]{
@@ -149,7 +153,21 @@ public class JobSchedulerFragment extends Fragment implements
EconomyManager.KEY_JS_ACTION_JOB_MIN_RUNNING_BASE_PRICE, EconomyManager.KEY_JS_ACTION_JOB_MIN_RUNNING_BASE_PRICE,
EconomyManager.KEY_JS_ACTION_JOB_TIMEOUT_PENALTY_BASE_PRICE EconomyManager.KEY_JS_ACTION_JOB_TIMEOUT_PENALTY_BASE_PRICE
}, },
// {}, {
EconomyManager.KEY_JS_REWARD_TOP_ACTIVITY_MAX,
EconomyManager.KEY_JS_REWARD_NOTIFICATION_SEEN_MAX,
EconomyManager.KEY_JS_REWARD_NOTIFICATION_INTERACTION_MAX,
EconomyManager.KEY_JS_REWARD_WIDGET_INTERACTION_MAX,
EconomyManager.KEY_JS_REWARD_OTHER_USER_INTERACTION_MAX,
},
// {EconomyManager.KEY_JS_REWARD_TOP_ACTIVITY_ONGOING},
{
EconomyManager.KEY_JS_REWARD_TOP_ACTIVITY_MAX,
EconomyManager.KEY_JS_REWARD_NOTIFICATION_SEEN_MAX,
EconomyManager.KEY_JS_REWARD_NOTIFICATION_INTERACTION_MAX,
EconomyManager.KEY_JS_REWARD_WIDGET_INTERACTION_MAX,
EconomyManager.KEY_JS_REWARD_OTHER_USER_INTERACTION_MAX,
}
}; };
} }
} }

View File

@@ -530,7 +530,7 @@ public class TareFactorController {
} else if (mJobSchedulerMap.containsKey(key)) { } else if (mJobSchedulerMap.containsKey(key)) {
currentMap = mJobSchedulerMap; currentMap = mJobSchedulerMap;
} else { } else {
throw new IllegalArgumentException("Couldn't link key to policy map"); throw new IllegalArgumentException("Couldn't link key '" + key + "' to a policy");
} }
return currentMap.get(key).factorPolicy; return currentMap.get(key).factorPolicy;
} }

View File

@@ -111,9 +111,8 @@ public class BatterySaverButtonPreferenceController extends
@Override @Override
public boolean setChecked(boolean stateOn) { public boolean setChecked(boolean stateOn) {
// This screen already shows a warning, so we don't need another warning.
return BatterySaverUtils.setPowerSaveMode(mContext, stateOn, return BatterySaverUtils.setPowerSaveMode(mContext, stateOn,
false /* needFirstTimeWarning */); true /* needFirstTimeWarning */);
} }
@Override @Override

View File

@@ -40,7 +40,7 @@ public class BatterySaverScheduleRadioButtonsController {
public static final String KEY_NO_SCHEDULE = "key_battery_saver_no_schedule"; public static final String KEY_NO_SCHEDULE = "key_battery_saver_no_schedule";
public static final String KEY_ROUTINE = "key_battery_saver_routine"; public static final String KEY_ROUTINE = "key_battery_saver_routine";
public static final String KEY_PERCENTAGE = "key_battery_saver_percentage"; public static final String KEY_PERCENTAGE = "key_battery_saver_percentage";
public static final int TRIGGER_LEVEL_MIN = 5; public static final int TRIGGER_LEVEL_MIN = 10;
private Context mContext; private Context mContext;
private BatterySaverScheduleSeekBarController mSeekBarController; private BatterySaverScheduleSeekBarController mSeekBarController;

View File

@@ -45,7 +45,7 @@ public class BatterySaverScheduleSeekBarController implements
OnPreferenceChangeListener { OnPreferenceChangeListener {
public static final int MAX_SEEKBAR_VALUE = 15; public static final int MAX_SEEKBAR_VALUE = 15;
public static final int MIN_SEEKBAR_VALUE = 1; public static final int MIN_SEEKBAR_VALUE = 2;
public static final String KEY_BATTERY_SAVER_SEEK_BAR = "battery_saver_seek_bar"; public static final String KEY_BATTERY_SAVER_SEEK_BAR = "battery_saver_seek_bar";
@VisibleForTesting @VisibleForTesting

View File

@@ -149,6 +149,7 @@ public class ApnEditor extends SettingsPreferenceFragment
private String[] mReadOnlyApnFields; private String[] mReadOnlyApnFields;
private boolean mReadOnlyApn; private boolean mReadOnlyApn;
private Uri mCarrierUri; private Uri mCarrierUri;
private boolean mIsCarrierIdApn;
/** /**
* APN types for data connections. These are usage categories for an APN * APN types for data connections. These are usage categories for an APN
@@ -227,7 +228,8 @@ public class ApnEditor extends SettingsPreferenceFragment
Telephony.Carriers.MVNO_TYPE, // 21 Telephony.Carriers.MVNO_TYPE, // 21
Telephony.Carriers.MVNO_MATCH_DATA, // 22 Telephony.Carriers.MVNO_MATCH_DATA, // 22
Telephony.Carriers.EDITED_STATUS, // 23 Telephony.Carriers.EDITED_STATUS, // 23
Telephony.Carriers.USER_EDITABLE //24 Telephony.Carriers.USER_EDITABLE, // 24
Telephony.Carriers.CARRIER_ID // 25
}; };
private static final int ID_INDEX = 0; private static final int ID_INDEX = 0;
@@ -262,6 +264,7 @@ public class ApnEditor extends SettingsPreferenceFragment
private static final int MVNO_MATCH_DATA_INDEX = 22; private static final int MVNO_MATCH_DATA_INDEX = 22;
private static final int EDITED_INDEX = 23; private static final int EDITED_INDEX = 23;
private static final int USER_EDITABLE_INDEX = 24; private static final int USER_EDITABLE_INDEX = 24;
private static final int CARRIER_ID_INDEX = 25;
@Override @Override
public void onCreate(Bundle icicle) { public void onCreate(Bundle icicle) {
@@ -312,6 +315,9 @@ public class ApnEditor extends SettingsPreferenceFragment
} else { } else {
mApnData = new ApnData(sProjection.length); mApnData = new ApnData(sProjection.length);
} }
final int carrierId = mApnData.getInteger(CARRIER_ID_INDEX,
TelephonyManager.UNKNOWN_CARRIER_ID);
mIsCarrierIdApn = (carrierId > TelephonyManager.UNKNOWN_CARRIER_ID);
final boolean isUserEdited = mApnData.getInteger(EDITED_INDEX, final boolean isUserEdited = mApnData.getInteger(EDITED_INDEX,
Telephony.Carriers.USER_EDITED) == Telephony.Carriers.USER_EDITED; Telephony.Carriers.USER_EDITED) == Telephony.Carriers.USER_EDITED;
@@ -326,6 +332,10 @@ public class ApnEditor extends SettingsPreferenceFragment
} else if (!ArrayUtils.isEmpty(mReadOnlyApnFields)) { } else if (!ArrayUtils.isEmpty(mReadOnlyApnFields)) {
disableFields(mReadOnlyApnFields); disableFields(mReadOnlyApnFields);
} }
// Make sure that a user cannot break carrier id APN matching
if (mIsCarrierIdApn) {
disableFieldsForCarrieridApn();
}
for (int i = 0; i < getPreferenceScreen().getPreferenceCount(); i++) { for (int i = 0; i < getPreferenceScreen().getPreferenceCount(); i++) {
getPreferenceScreen().getPreference(i).setOnPreferenceChangeListener(this); getPreferenceScreen().getPreference(i).setOnPreferenceChangeListener(this);
@@ -517,6 +527,16 @@ public class ApnEditor extends SettingsPreferenceFragment
mMvnoMatchData.setEnabled(false); mMvnoMatchData.setEnabled(false);
} }
/**
* Disables fields for a carrier id APN to avoid breaking the match criteria
*/
private void disableFieldsForCarrieridApn() {
mMcc.setEnabled(false);
mMnc.setEnabled(false);
mMvnoType.setEnabled(false);
mMvnoMatchData.setEnabled(false);
}
@Override @Override
public int getMetricsCategory() { public int getMetricsCategory() {
return SettingsEnums.APN_EDITOR; return SettingsEnums.APN_EDITOR;
@@ -1150,11 +1170,15 @@ public class ApnEditor extends SettingsPreferenceFragment
final String apn = checkNotSet(mApn.getText()); final String apn = checkNotSet(mApn.getText());
final String mcc = checkNotSet(mMcc.getText()); final String mcc = checkNotSet(mMcc.getText());
final String mnc = checkNotSet(mMnc.getText()); final String mnc = checkNotSet(mMnc.getText());
boolean doNotCheckMccMnc = mIsCarrierIdApn && TextUtils.isEmpty(mcc)
&& TextUtils.isEmpty(mnc);
if (TextUtils.isEmpty(name)) { if (TextUtils.isEmpty(name)) {
errorMsg = getResources().getString(R.string.error_name_empty); errorMsg = getResources().getString(R.string.error_name_empty);
} else if (TextUtils.isEmpty(apn)) { } else if (TextUtils.isEmpty(apn)) {
errorMsg = getResources().getString(R.string.error_apn_empty); errorMsg = getResources().getString(R.string.error_apn_empty);
} else if (doNotCheckMccMnc) {
Log.d(TAG, "validateApnData: carrier id APN does not have mcc/mnc defined");
// no op, skip mcc mnc null check
} else if (mcc == null || mcc.length() != 3) { } else if (mcc == null || mcc.length() != 3) {
errorMsg = getResources().getString(R.string.error_mcc_not3); errorMsg = getResources().getString(R.string.error_mcc_not3);
} else if ((mnc == null || (mnc.length() & 0xFFFE) != 2)) { } else if ((mnc == null || (mnc.length() & 0xFFFE) != 2)) {

View File

@@ -44,7 +44,6 @@ public final class ChooseLockSettingsHelper {
private static final String TAG = "ChooseLockSettingsHelper"; private static final String TAG = "ChooseLockSettingsHelper";
public static final String EXTRA_KEY_TYPE = "type";
public static final String EXTRA_KEY_PASSWORD = "password"; public static final String EXTRA_KEY_PASSWORD = "password";
public static final String EXTRA_KEY_RETURN_CREDENTIALS = "return_credentials"; public static final String EXTRA_KEY_RETURN_CREDENTIALS = "return_credentials";
// Force the verifyCredential path instead of checkCredential path. This will be removed // Force the verifyCredential path instead of checkCredential path. This will be removed
@@ -191,7 +190,7 @@ public final class ChooseLockSettingsHelper {
/** /**
* @param returnCredentials if true, puts the following credentials into intent for * @param returnCredentials if true, puts the following credentials into intent for
* onActivityResult with the following keys: * onActivityResult with the following keys:
* {@link #EXTRA_KEY_TYPE}, {@link #EXTRA_KEY_PASSWORD}, * {@link #EXTRA_KEY_PASSWORD},
* {@link #EXTRA_KEY_CHALLENGE_TOKEN}, * {@link #EXTRA_KEY_CHALLENGE_TOKEN},
* {@link #EXTRA_KEY_GK_PW_HANDLE} * {@link #EXTRA_KEY_GK_PW_HANDLE}
* Note that if this is true, this can only be called internally. * Note that if this is true, this can only be called internally.

View File

@@ -39,7 +39,6 @@ import android.os.Handler;
import android.os.Looper; import android.os.Looper;
import android.os.SystemClock; import android.os.SystemClock;
import android.os.UserManager; import android.os.UserManager;
import android.os.storage.StorageManager;
import android.text.Editable; import android.text.Editable;
import android.text.InputType; import android.text.InputType;
import android.text.TextUtils; import android.text.TextUtils;
@@ -484,11 +483,6 @@ public class ConfirmLockPassword extends ConfirmDeviceCredentialBaseActivity {
public void onChecked(boolean matched, int timeoutMs) { public void onChecked(boolean matched, int timeoutMs) {
mPendingLockCheck = null; mPendingLockCheck = null;
if (matched && isInternalActivity() && mReturnCredentials) { if (matched && isInternalActivity() && mReturnCredentials) {
// TODO: get rid of EXTRA_KEY_TYPE, since EXTRA_KEY_PASSWORD already
// distinguishes beteween PIN and password.
intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_TYPE,
mIsAlpha ? StorageManager.CRYPT_TYPE_PASSWORD
: StorageManager.CRYPT_TYPE_PIN);
intent.putExtra( intent.putExtra(
ChooseLockSettingsHelper.EXTRA_KEY_PASSWORD, credential); ChooseLockSettingsHelper.EXTRA_KEY_PASSWORD, credential);
} }

View File

@@ -32,7 +32,6 @@ import android.os.Bundle;
import android.os.CountDownTimer; import android.os.CountDownTimer;
import android.os.SystemClock; import android.os.SystemClock;
import android.os.UserManager; import android.os.UserManager;
import android.os.storage.StorageManager;
import android.text.TextUtils; import android.text.TextUtils;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.MotionEvent; import android.view.MotionEvent;
@@ -523,8 +522,6 @@ public class ConfirmLockPattern extends ConfirmDeviceCredentialBaseActivity {
public void onChecked(boolean matched, int timeoutMs) { public void onChecked(boolean matched, int timeoutMs) {
mPendingLockCheck = null; mPendingLockCheck = null;
if (matched && isInternalActivity() && mReturnCredentials) { if (matched && isInternalActivity() && mReturnCredentials) {
intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_TYPE,
StorageManager.CRYPT_TYPE_PATTERN);
intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_PASSWORD, intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_PASSWORD,
pattern); pattern);
} }

View File

@@ -36,6 +36,7 @@ import android.content.ComponentName;
import android.content.ContentResolver; import android.content.ContentResolver;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.pm.PackageManager;
import android.content.res.Resources; import android.content.res.Resources;
import android.os.Bundle; import android.os.Bundle;
import android.provider.Settings; import android.provider.Settings;
@@ -101,6 +102,8 @@ public class ToggleScreenMagnificationPreferenceFragmentTest {
private FragmentActivity mActivity; private FragmentActivity mActivity;
@Mock @Mock
private ContentResolver mContentResolver; private ContentResolver mContentResolver;
@Mock
private PackageManager mPackageManager;
@Before @Before
public void setUpTestFragment() { public void setUpTestFragment() {
@@ -110,6 +113,7 @@ public class ToggleScreenMagnificationPreferenceFragmentTest {
mFragment = spy(new TestToggleScreenMagnificationPreferenceFragment(mContext)); mFragment = spy(new TestToggleScreenMagnificationPreferenceFragment(mContext));
mResources = spy(mContext.getResources()); mResources = spy(mContext.getResources());
when(mContext.getResources()).thenReturn(mResources); when(mContext.getResources()).thenReturn(mResources);
when(mContext.getPackageManager()).thenReturn(mPackageManager);
when(mFragment.getContext().getResources()).thenReturn(mResources); when(mFragment.getContext().getResources()).thenReturn(mResources);
when(mFragment.getActivity()).thenReturn(mActivity); when(mFragment.getActivity()).thenReturn(mActivity);
when(mActivity.getContentResolver()).thenReturn(mContentResolver); when(mActivity.getContentResolver()).thenReturn(mContentResolver);
@@ -334,10 +338,26 @@ public class ToggleScreenMagnificationPreferenceFragmentTest {
@Ignore("Ignore it since a NPE is happened in ShadowWindowManagerGlobal. (Ref. b/214161063)") @Ignore("Ignore it since a NPE is happened in ShadowWindowManagerGlobal. (Ref. b/214161063)")
@Test @Test
public void onCreateView_notSupportsMagnificationArea_settingsPreferenceIsNull() { public void onCreateView_magnificationAreaNotSupported_settingsPreferenceIsNull() {
when(mResources.getBoolean( when(mResources.getBoolean(
com.android.internal.R.bool.config_magnification_area)) com.android.internal.R.bool.config_magnification_area))
.thenReturn(false); .thenReturn(false);
when(mPackageManager.hasSystemFeature(PackageManager.FEATURE_WINDOW_MAGNIFICATION))
.thenReturn(true);
mFragment.onCreateView(LayoutInflater.from(mContext), mock(ViewGroup.class), Bundle.EMPTY);
assertThat(mFragment.mSettingsPreference).isNull();
}
@Ignore("Ignore it since a NPE is happened in ShadowWindowManagerGlobal. (Ref. b/214161063)")
@Test
public void onCreateView_windowMagnificationNotSupported_settingsPreferenceIsNull() {
when(mResources.getBoolean(
com.android.internal.R.bool.config_magnification_area))
.thenReturn(true);
when(mPackageManager.hasSystemFeature(PackageManager.FEATURE_WINDOW_MAGNIFICATION))
.thenReturn(false);
mFragment.onCreateView(LayoutInflater.from(mContext), mock(ViewGroup.class), Bundle.EMPTY); mFragment.onCreateView(LayoutInflater.from(mContext), mock(ViewGroup.class), Bundle.EMPTY);

View File

@@ -18,13 +18,17 @@ package com.android.settings.fuelgauge.batterysaver;
import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertThat;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.spy; import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when; import static org.mockito.Mockito.when;
import android.content.Context; import android.content.Context;
import android.content.Intent;
import android.os.PowerManager; import android.os.PowerManager;
import android.provider.SettingsSlicesContract; import android.provider.SettingsSlicesContract;
@@ -90,10 +94,11 @@ public class BatterySaverButtonPreferenceControllerTest {
} }
@Test @Test
public void setChecked_on_setPowerSaveMode() { public void setChecked_on_showWarningMessage() {
mController.setChecked(true); mController.setChecked(true);
verify(mPowerManager).setPowerSaveModeEnabled(true); verify(mContext).sendBroadcast(any(Intent.class));
verify(mPowerManager, never()).setPowerSaveModeEnabled(anyBoolean());
} }
@Test @Test

View File

@@ -3,8 +3,8 @@ package com.android.settings.fuelgauge.batterysaver;
import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertThat;
import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.never; import static org.mockito.Mockito.never;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verify;
import android.content.ContentResolver; import android.content.ContentResolver;
@@ -64,10 +64,10 @@ public class BatterySaverScheduleSeekBarControllerTest {
@Test @Test
public void updateSeekBar_percentageMode_hasCorrectProperties() { public void updateSeekBar_percentageMode_hasCorrectProperties() {
final CharSequence expectedTitle = "5%"; final CharSequence expectedTitle = "10%";
Settings.Global.putInt(mResolver, Global.AUTOMATIC_POWER_SAVE_MODE, Settings.Global.putInt(mResolver, Global.AUTOMATIC_POWER_SAVE_MODE,
PowerManager.POWER_SAVE_MODE_TRIGGER_PERCENTAGE); PowerManager.POWER_SAVE_MODE_TRIGGER_PERCENTAGE);
Settings.Global.putInt(mResolver, Global.LOW_POWER_MODE_TRIGGER_LEVEL, 5); Settings.Global.putInt(mResolver, Global.LOW_POWER_MODE_TRIGGER_LEVEL, 10);
mController.updateSeekBar(); mController.updateSeekBar();
assertThat(mController.mSeekBarPreference.isVisible()).isTrue(); assertThat(mController.mSeekBarPreference.isVisible()).isTrue();

View File

@@ -1,7 +1,5 @@
package com.android.settings.fuelgauge.batterysaver; package com.android.settings.fuelgauge.batterysaver;
import static com.google.common.truth.Truth.assertThat;
import static org.mockito.Mockito.spy; import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoMoreInteractions; import static org.mockito.Mockito.verifyNoMoreInteractions;
@@ -10,7 +8,6 @@ import android.app.settings.SettingsEnums;
import android.content.Context; import android.content.Context;
import android.os.PowerManager; import android.os.PowerManager;
import android.provider.Settings; import android.provider.Settings;
import android.util.Pair;
import com.android.settings.testutils.FakeFeatureFactory; import com.android.settings.testutils.FakeFeatureFactory;
import com.android.settingslib.core.instrumentation.MetricsFeatureProvider; import com.android.settingslib.core.instrumentation.MetricsFeatureProvider;

View File

@@ -18,24 +18,24 @@ package com.android.settings.password;
import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertThat;
import androidx.appcompat.app.AlertDialog;
import androidx.fragment.app.FragmentActivity; import androidx.fragment.app.FragmentActivity;
import androidx.test.core.app.ApplicationProvider;
import com.android.settings.R; import com.android.settings.R;
import com.android.settings.testutils.shadow.ShadowAlertDialogCompat;
import com.android.settings.testutils.shadow.ShadowUtils; import com.android.settings.testutils.shadow.ShadowUtils;
import org.junit.Before; import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.robolectric.Robolectric; import org.robolectric.Robolectric;
import org.robolectric.RobolectricTestRunner; import org.robolectric.RobolectricTestRunner;
import org.robolectric.annotation.Config; import org.robolectric.annotation.Config;
import org.robolectric.shadow.api.Shadow;
import org.robolectric.shadows.ShadowAlertDialog;
import org.robolectric.shadows.ShadowApplication;
@RunWith(RobolectricTestRunner.class) @RunWith(RobolectricTestRunner.class)
@Config(shadows = {ShadowUtils.class, ShadowAlertDialogCompat.class}) @Config(shadows = {ShadowUtils.class, ShadowAlertDialog.class})
@Ignore
public class SetupSkipDialogTest { public class SetupSkipDialogTest {
private FragmentActivity mActivity; private FragmentActivity mActivity;
@@ -45,19 +45,25 @@ public class SetupSkipDialogTest {
mActivity = Robolectric.setupActivity(FragmentActivity.class); mActivity = Robolectric.setupActivity(FragmentActivity.class);
} }
private ShadowAlertDialog getShadowAlertDialog() {
ShadowApplication shadowApplication = Shadow.extract(
ApplicationProvider.getApplicationContext());
ShadowAlertDialog shadowAlertDialog = shadowApplication.getLatestAlertDialog();
assertThat(shadowAlertDialog).isNotNull();
return shadowAlertDialog;
}
@Test @Test
public void frpMessages_areShownCorrectly_whenNotSupported() { public void frpMessages_areShownCorrectly_whenNotSupported() {
SetupSkipDialog setupSkipDialog = SetupSkipDialog setupSkipDialog =
SetupSkipDialog.newInstance(false, false, false, false, false, false); SetupSkipDialog.newInstance(false, false, false, false, false, false);
setupSkipDialog.show(mActivity.getSupportFragmentManager()); setupSkipDialog.show(mActivity.getSupportFragmentManager());
AlertDialog alertDialog = ShadowAlertDialogCompat.getLatestAlertDialog(); ShadowAlertDialog shadowAlertDialog = getShadowAlertDialog();
assertThat(alertDialog).isNotNull(); assertThat(shadowAlertDialog.getTitle().toString()).isEqualTo(
ShadowAlertDialogCompat shadowAlertDialog = ShadowAlertDialogCompat.shadowOf(alertDialog); mActivity.getString(R.string.lock_screen_intro_skip_title));
assertThat(mActivity.getString(R.string.lock_screen_intro_skip_title)).isEqualTo( assertThat(shadowAlertDialog.getMessage().toString()).isEqualTo(
shadowAlertDialog.getTitle()); mActivity.getString(R.string.lock_screen_intro_skip_dialog_text));
assertThat(mActivity.getString(R.string.lock_screen_intro_skip_dialog_text)).isEqualTo(
shadowAlertDialog.getMessage());
} }
@Test @Test
@@ -66,29 +72,24 @@ public class SetupSkipDialogTest {
SetupSkipDialog.newInstance(true, false, false, false, false, false); SetupSkipDialog.newInstance(true, false, false, false, false, false);
setupSkipDialog.show(mActivity.getSupportFragmentManager()); setupSkipDialog.show(mActivity.getSupportFragmentManager());
AlertDialog alertDialog = ShadowAlertDialogCompat.getLatestAlertDialog(); ShadowAlertDialog shadowAlertDialog = getShadowAlertDialog();
assertThat(alertDialog).isNotNull(); assertThat(shadowAlertDialog.getTitle().toString()).isEqualTo(
ShadowAlertDialogCompat shadowAlertDialog = ShadowAlertDialogCompat.shadowOf(alertDialog); mActivity.getString(R.string.lock_screen_intro_skip_title));
assertThat(mActivity.getString(R.string.lock_screen_intro_skip_title)).isEqualTo( assertThat(shadowAlertDialog.getMessage().toString()).isEqualTo(
shadowAlertDialog.getTitle()); mActivity.getString(R.string.lock_screen_intro_skip_dialog_text_frp));
assertThat(mActivity.getString(R.string.lock_screen_intro_skip_dialog_text_frp)).isEqualTo(
shadowAlertDialog.getMessage());
} }
@Test @Test
@Ignore
public void dialogMessage_whenSkipPinSetupForFace_shouldShownCorrectly() { public void dialogMessage_whenSkipPinSetupForFace_shouldShownCorrectly() {
SetupSkipDialog setupSkipDialog = SetupSkipDialog setupSkipDialog =
SetupSkipDialog.newInstance(true, false, false, false, true, false); SetupSkipDialog.newInstance(true, false, false, false, true, false);
setupSkipDialog.show(mActivity.getSupportFragmentManager()); setupSkipDialog.show(mActivity.getSupportFragmentManager());
AlertDialog alertDialog = ShadowAlertDialogCompat.getLatestAlertDialog(); ShadowAlertDialog shadowAlertDialog = getShadowAlertDialog();
assertThat(alertDialog).isNotNull(); assertThat(shadowAlertDialog.getTitle().toString()).isEqualTo(
ShadowAlertDialogCompat shadowAlertDialog = ShadowAlertDialogCompat.shadowOf(alertDialog); mActivity.getString(R.string.lock_screen_pin_skip_face_title));
assertThat(shadowAlertDialog.getTitle()).isEqualTo( assertThat(shadowAlertDialog.getMessage().toString()).isEqualTo(
mActivity.getString(R.string.lock_screen_pin_skip_biometrics_title)); mActivity.getString(R.string.lock_screen_pin_skip_face_message));
assertThat(shadowAlertDialog.getMessage()).isEqualTo(
mActivity.getString(R.string.lock_screen_pin_skip_biometrics_message));
} }
@Test @Test
@@ -97,12 +98,10 @@ public class SetupSkipDialogTest {
SetupSkipDialog.newInstance(true, false, true, false, true, false); SetupSkipDialog.newInstance(true, false, true, false, true, false);
setupSkipDialog.show(mActivity.getSupportFragmentManager()); setupSkipDialog.show(mActivity.getSupportFragmentManager());
AlertDialog alertDialog = ShadowAlertDialogCompat.getLatestAlertDialog(); ShadowAlertDialog shadowAlertDialog = getShadowAlertDialog();
assertThat(alertDialog).isNotNull(); assertThat(shadowAlertDialog.getTitle().toString()).isEqualTo(
ShadowAlertDialogCompat shadowAlertDialog = ShadowAlertDialogCompat.shadowOf(alertDialog);
assertThat(shadowAlertDialog.getTitle()).isEqualTo(
mActivity.getString(R.string.lock_screen_password_skip_face_title)); mActivity.getString(R.string.lock_screen_password_skip_face_title));
assertThat(shadowAlertDialog.getMessage()).isEqualTo( assertThat(shadowAlertDialog.getMessage().toString()).isEqualTo(
mActivity.getString(R.string.lock_screen_password_skip_face_message)); mActivity.getString(R.string.lock_screen_password_skip_face_message));
} }
@@ -112,12 +111,10 @@ public class SetupSkipDialogTest {
SetupSkipDialog.newInstance(true, true, false, false, true, false); SetupSkipDialog.newInstance(true, true, false, false, true, false);
setupSkipDialog.show(mActivity.getSupportFragmentManager()); setupSkipDialog.show(mActivity.getSupportFragmentManager());
AlertDialog alertDialog = ShadowAlertDialogCompat.getLatestAlertDialog(); ShadowAlertDialog shadowAlertDialog = getShadowAlertDialog();
assertThat(alertDialog).isNotNull(); assertThat(shadowAlertDialog.getTitle().toString()).isEqualTo(
ShadowAlertDialogCompat shadowAlertDialog = ShadowAlertDialogCompat.shadowOf(alertDialog);
assertThat(shadowAlertDialog.getTitle()).isEqualTo(
mActivity.getString(R.string.lock_screen_pattern_skip_face_title)); mActivity.getString(R.string.lock_screen_pattern_skip_face_title));
assertThat(shadowAlertDialog.getMessage()).isEqualTo( assertThat(shadowAlertDialog.getMessage().toString()).isEqualTo(
mActivity.getString(R.string.lock_screen_pattern_skip_face_message)); mActivity.getString(R.string.lock_screen_pattern_skip_face_message));
} }
@@ -127,12 +124,10 @@ public class SetupSkipDialogTest {
SetupSkipDialog.newInstance(true, false, false, true, false, false); SetupSkipDialog.newInstance(true, false, false, true, false, false);
setupSkipDialog.show(mActivity.getSupportFragmentManager()); setupSkipDialog.show(mActivity.getSupportFragmentManager());
AlertDialog alertDialog = ShadowAlertDialogCompat.getLatestAlertDialog(); ShadowAlertDialog shadowAlertDialog = getShadowAlertDialog();
assertThat(alertDialog).isNotNull(); assertThat(shadowAlertDialog.getTitle().toString()).isEqualTo(
ShadowAlertDialogCompat shadowAlertDialog = ShadowAlertDialogCompat.shadowOf(alertDialog);
assertThat(shadowAlertDialog.getTitle()).isEqualTo(
mActivity.getString(R.string.lock_screen_pin_skip_fingerprint_title)); mActivity.getString(R.string.lock_screen_pin_skip_fingerprint_title));
assertThat(shadowAlertDialog.getMessage()).isEqualTo( assertThat(shadowAlertDialog.getMessage().toString()).isEqualTo(
mActivity.getString(R.string.lock_screen_pin_skip_fingerprint_message)); mActivity.getString(R.string.lock_screen_pin_skip_fingerprint_message));
} }
@@ -142,12 +137,10 @@ public class SetupSkipDialogTest {
SetupSkipDialog.newInstance(true, false, true, true, false, false); SetupSkipDialog.newInstance(true, false, true, true, false, false);
setupSkipDialog.show(mActivity.getSupportFragmentManager()); setupSkipDialog.show(mActivity.getSupportFragmentManager());
AlertDialog alertDialog = ShadowAlertDialogCompat.getLatestAlertDialog(); ShadowAlertDialog shadowAlertDialog = getShadowAlertDialog();
assertThat(alertDialog).isNotNull(); assertThat(shadowAlertDialog.getTitle().toString()).isEqualTo(
ShadowAlertDialogCompat shadowAlertDialog = ShadowAlertDialogCompat.shadowOf(alertDialog);
assertThat(shadowAlertDialog.getTitle()).isEqualTo(
mActivity.getString(R.string.lock_screen_password_skip_fingerprint_title)); mActivity.getString(R.string.lock_screen_password_skip_fingerprint_title));
assertThat(shadowAlertDialog.getMessage()).isEqualTo( assertThat(shadowAlertDialog.getMessage().toString()).isEqualTo(
mActivity.getString(R.string.lock_screen_password_skip_fingerprint_message)); mActivity.getString(R.string.lock_screen_password_skip_fingerprint_message));
} }
@@ -157,28 +150,23 @@ public class SetupSkipDialogTest {
SetupSkipDialog.newInstance(true, true, false, true, false, false); SetupSkipDialog.newInstance(true, true, false, true, false, false);
setupSkipDialog.show(mActivity.getSupportFragmentManager()); setupSkipDialog.show(mActivity.getSupportFragmentManager());
AlertDialog alertDialog = ShadowAlertDialogCompat.getLatestAlertDialog(); ShadowAlertDialog shadowAlertDialog = getShadowAlertDialog();
assertThat(alertDialog).isNotNull(); assertThat(shadowAlertDialog.getTitle().toString()).isEqualTo(
ShadowAlertDialogCompat shadowAlertDialog = ShadowAlertDialogCompat.shadowOf(alertDialog);
assertThat(shadowAlertDialog.getTitle()).isEqualTo(
mActivity.getString(R.string.lock_screen_pattern_skip_fingerprint_title)); mActivity.getString(R.string.lock_screen_pattern_skip_fingerprint_title));
assertThat(shadowAlertDialog.getMessage()).isEqualTo( assertThat(shadowAlertDialog.getMessage().toString()).isEqualTo(
mActivity.getString(R.string.lock_screen_pattern_skip_fingerprint_message)); mActivity.getString(R.string.lock_screen_pattern_skip_fingerprint_message));
} }
@Test @Test
public void dialogMessage_whenSkipPinSetupForBiometrics_shouldShownCorrectly() { public void dialogMessage_whenSkipPinSetupForBiometrics_shouldShownCorrectly() {
SetupSkipDialog setupSkipDialog = SetupSkipDialog setupSkipDialog =
SetupSkipDialog.newInstance(true, false, false, false, false, true); SetupSkipDialog.newInstance(true, false, false, false, false, true);
setupSkipDialog.show(mActivity.getSupportFragmentManager()); setupSkipDialog.show(mActivity.getSupportFragmentManager());
AlertDialog alertDialog = ShadowAlertDialogCompat.getLatestAlertDialog(); ShadowAlertDialog shadowAlertDialog = getShadowAlertDialog();
assertThat(alertDialog).isNotNull(); assertThat(shadowAlertDialog.getTitle().toString()).isEqualTo(
ShadowAlertDialogCompat shadowAlertDialog = ShadowAlertDialogCompat.shadowOf(alertDialog);
assertThat(shadowAlertDialog.getTitle()).isEqualTo(
mActivity.getString(R.string.lock_screen_pin_skip_biometrics_title)); mActivity.getString(R.string.lock_screen_pin_skip_biometrics_title));
assertThat(shadowAlertDialog.getMessage()).isEqualTo( assertThat(shadowAlertDialog.getMessage().toString()).isEqualTo(
mActivity.getString(R.string.lock_screen_pin_skip_biometrics_message)); mActivity.getString(R.string.lock_screen_pin_skip_biometrics_message));
} }
@@ -188,12 +176,10 @@ public class SetupSkipDialogTest {
SetupSkipDialog.newInstance(true, false, true, false, false, true); SetupSkipDialog.newInstance(true, false, true, false, false, true);
setupSkipDialog.show(mActivity.getSupportFragmentManager()); setupSkipDialog.show(mActivity.getSupportFragmentManager());
AlertDialog alertDialog = ShadowAlertDialogCompat.getLatestAlertDialog(); ShadowAlertDialog shadowAlertDialog = getShadowAlertDialog();
assertThat(alertDialog).isNotNull(); assertThat(shadowAlertDialog.getTitle().toString()).isEqualTo(
ShadowAlertDialogCompat shadowAlertDialog = ShadowAlertDialogCompat.shadowOf(alertDialog);
assertThat(shadowAlertDialog.getTitle()).isEqualTo(
mActivity.getString(R.string.lock_screen_password_skip_biometrics_title)); mActivity.getString(R.string.lock_screen_password_skip_biometrics_title));
assertThat(shadowAlertDialog.getMessage()).isEqualTo( assertThat(shadowAlertDialog.getMessage().toString()).isEqualTo(
mActivity.getString(R.string.lock_screen_password_skip_biometrics_message)); mActivity.getString(R.string.lock_screen_password_skip_biometrics_message));
} }
@@ -203,12 +189,10 @@ public class SetupSkipDialogTest {
SetupSkipDialog.newInstance(true, true, false, false, false, true); SetupSkipDialog.newInstance(true, true, false, false, false, true);
setupSkipDialog.show(mActivity.getSupportFragmentManager()); setupSkipDialog.show(mActivity.getSupportFragmentManager());
AlertDialog alertDialog = ShadowAlertDialogCompat.getLatestAlertDialog(); ShadowAlertDialog shadowAlertDialog = getShadowAlertDialog();
assertThat(alertDialog).isNotNull(); assertThat(shadowAlertDialog.getTitle().toString()).isEqualTo(
ShadowAlertDialogCompat shadowAlertDialog = ShadowAlertDialogCompat.shadowOf(alertDialog);
assertThat(shadowAlertDialog.getTitle()).isEqualTo(
mActivity.getString(R.string.lock_screen_pattern_skip_biometrics_title)); mActivity.getString(R.string.lock_screen_pattern_skip_biometrics_title));
assertThat(shadowAlertDialog.getMessage()).isEqualTo( assertThat(shadowAlertDialog.getMessage().toString()).isEqualTo(
mActivity.getString(R.string.lock_screen_pattern_skip_biometrics_message)); mActivity.getString(R.string.lock_screen_pattern_skip_biometrics_message));
} }
} }

View File

@@ -171,7 +171,7 @@ public class FaceStatusUtilsTest {
when(mFaceManager.hasEnrolledTemplates(anyInt())).thenReturn(false); when(mFaceManager.hasEnrolledTemplates(anyInt())).thenReturn(false);
assertThat(mFaceStatusUtils.getSettingsClassName()) assertThat(mFaceStatusUtils.getSettingsClassName())
.isEqualTo(FaceEnrollIntroduction.class.getName()); .isEqualTo(FaceEnrollIntroductionInternal.class.getName());
} }
@Test @Test
@@ -179,6 +179,6 @@ public class FaceStatusUtilsTest {
when(mFaceManager.hasEnrolledTemplates(anyInt())).thenReturn(true); when(mFaceManager.hasEnrolledTemplates(anyInt())).thenReturn(true);
assertThat(mFaceStatusUtils.getSettingsClassName()) assertThat(mFaceStatusUtils.getSettingsClassName())
.isEqualTo(Settings.FaceSettingsActivity.class.getName()); .isEqualTo(Settings.FaceSettingsInternalActivity.class.getName());
} }
} }

View File

@@ -183,7 +183,7 @@ public class FingerprintStatusUtilsTest {
when(mFingerprintManager.hasEnrolledFingerprints(anyInt())).thenReturn(false); when(mFingerprintManager.hasEnrolledFingerprints(anyInt())).thenReturn(false);
assertThat(mFingerprintStatusUtils.getSettingsClassName()) assertThat(mFingerprintStatusUtils.getSettingsClassName())
.isEqualTo(FingerprintEnrollIntroduction.class.getName()); .isEqualTo(FingerprintEnrollIntroductionInternal.class.getName());
} }
@Test @Test

View File

@@ -28,6 +28,7 @@ import androidx.test.runner.AndroidJUnit4;
import com.android.settings.Settings; import com.android.settings.Settings;
import org.junit.Ignore;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
@@ -40,6 +41,7 @@ public class PrivateVolumeForgetTest {
new ActivityTestRule<>(Settings.PrivateVolumeForgetActivity.class, true, true); new ActivityTestRule<>(Settings.PrivateVolumeForgetActivity.class, true, true);
@Test @Test
@Ignore
public void test_invalidSetupDoesNotCrashSettings() { public void test_invalidSetupDoesNotCrashSettings() {
Context targetContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); Context targetContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
Intent intent = new Intent(targetContext, Settings.PrivateVolumeForgetActivity.class); Intent intent = new Intent(targetContext, Settings.PrivateVolumeForgetActivity.class);

View File

@@ -47,8 +47,8 @@ import androidx.test.core.app.ApplicationProvider;
import androidx.test.ext.junit.runners.AndroidJUnit4; import androidx.test.ext.junit.runners.AndroidJUnit4;
import com.android.settings.Settings; import com.android.settings.Settings;
import com.android.settings.biometrics.face.FaceEnrollIntroduction; import com.android.settings.biometrics.face.FaceEnrollIntroductionInternal;
import com.android.settings.biometrics.fingerprint.FingerprintEnrollIntroduction; import com.android.settings.biometrics.fingerprint.FingerprintEnrollIntroductionInternal;
import com.android.settings.biometrics.fingerprint.FingerprintSettings; import com.android.settings.biometrics.fingerprint.FingerprintSettings;
import com.android.settings.testutils.ResourcesUtils; import com.android.settings.testutils.ResourcesUtils;
@@ -187,7 +187,7 @@ public class BiometricsSafetySourceTest {
assertSafetySourceEnabledDataSetWithSingularSummary( assertSafetySourceEnabledDataSetWithSingularSummary(
"security_settings_fingerprint_preference_title", "security_settings_fingerprint_preference_title",
"security_settings_fingerprint_preference_summary_none", "security_settings_fingerprint_preference_summary_none",
FingerprintEnrollIntroduction.class.getName()); FingerprintEnrollIntroductionInternal.class.getName());
} }
@Test @Test
@@ -258,7 +258,7 @@ public class BiometricsSafetySourceTest {
assertSafetySourceEnabledDataSetWithSingularSummary( assertSafetySourceEnabledDataSetWithSingularSummary(
"security_settings_face_preference_title", "security_settings_face_preference_title",
"security_settings_face_preference_summary_none", "security_settings_face_preference_summary_none",
FaceEnrollIntroduction.class.getName()); FaceEnrollIntroductionInternal.class.getName());
} }
@Test @Test
@@ -290,7 +290,7 @@ public class BiometricsSafetySourceTest {
assertSafetySourceEnabledDataSetWithSingularSummary( assertSafetySourceEnabledDataSetWithSingularSummary(
"security_settings_face_preference_title", "security_settings_face_preference_title",
"security_settings_face_preference_summary", "security_settings_face_preference_summary",
Settings.FaceSettingsActivity.class.getName()); Settings.FaceSettingsInternalActivity.class.getName());
} }
@Test @Test