Merge "Add logic to redirect default payment setting to default wallet selector." into main
diff --git a/Android.bp b/Android.bp
index 8353634..48e0d2d 100644
--- a/Android.bp
+++ b/Android.bp
@@ -120,6 +120,10 @@
"telephony-common",
"ims-common",
],
+
+ lint: {
+ extra_check_modules: ["SettingsLibLintChecker"],
+ },
}
platform_compat_config {
diff --git a/res/layout/accessibility_text_reading_preview.xml b/res/layout/accessibility_text_reading_preview.xml
index 95ea2e4..830d9e6 100644
--- a/res/layout/accessibility_text_reading_preview.xml
+++ b/res/layout/accessibility_text_reading_preview.xml
@@ -42,7 +42,8 @@
android:id="@+id/preview_pager"
android:layout_width="match_parent"
android:layout_height="217dp"
- android:contentDescription="@string/preview_pager_content_description" />
+ android:contentDescription="@string/preview_pager_content_description"
+ android:nestedScrollingEnabled="true" />
<com.android.settings.widget.DotsPageIndicator
android:id="@+id/page_indicator"
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 66e7321..402f526 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -4511,7 +4511,9 @@
<!-- Spinner label to indicate sort by app name. [CHAR LIMIT=30] -->
<string name="usage_stats_sort_by_app_name">Sort by app name</string>
<!-- label for last time used -->
- <string name="last_time_used_label">Last time used</string>
+ <string name="last_time_used_label">Last used</string>
+ <!-- label for last time used of never opened apps -->
+ <string name="last_time_used_never">never</string>
<!-- label for usage time -->
<string name="usage_time_label">Usage time</string>
@@ -5864,12 +5866,16 @@
<string name="battery_usage_timestamps_hyphen"><xliff:g id="from_timestamp">%1$s</xliff:g> - <xliff:g id="to_timestamp">%2$s</xliff:g></string>
<!-- [CHAR_LIMIT=NONE] The first slot is a week day (e.g. "Monday"); the second slot is a hourly time span (e.g. "6 AM - 8 AM"). -->
<string name="battery_usage_day_and_hour"><xliff:g id="day">%1$s</xliff:g> <xliff:g id="hour">%2$s</xliff:g></string>
+ <!-- [CHAR_LIMIT=NONE] Accessibility content description for each slot in battery chart view. -->
+ <string name="battery_usage_time_info_and_battery_level"><xliff:g id="time_info" example="Battery usage for Monday 6 AM - 8 AM">%1$s</xliff:g> <xliff:g id="battery_level" example="Battery level percentage from 83% to 59%">%2$s</xliff:g></string>
<!-- [CHAR_LIMIT=NONE] Accessibility content description for battery chart view. -->
<string name="battery_usage_chart">Battery usage chart</string>
<!-- [CHAR_LIMIT=NONE] Accessibility content description for daily battery chart view. -->
<string name="daily_battery_usage_chart">Daily battery usage chart</string>
<!-- [CHAR_LIMIT=NONE] Accessibility content description for hourly battery chart view. -->
<string name="hourly_battery_usage_chart">Hourly battery usage chart</string>
+ <!-- [CHAR_LIMIT=NONE] Accessibility content description for battery level percentage. -->
+ <string name="battery_level_percentage">Battery level percentage from <xliff:g id="start_percentage">%1$s</xliff:g> to <xliff:g id="end_percentage">%2$s</xliff:g></string>
<!-- [CHAR_LIMIT=NONE] Battery usage breakdown title since last full charge -->
<string name="battery_usage_breakdown_title_since_last_full_charge">Battery usage since last full charge</string>
<!-- [CHAR_LIMIT=NONE] Battery usage breakdown title for a selected slot -->
diff --git a/src/com/android/settings/accessibility/TextReadingPreviewPager.java b/src/com/android/settings/accessibility/TextReadingPreviewPager.java
index 5d43159..252d121 100644
--- a/src/com/android/settings/accessibility/TextReadingPreviewPager.java
+++ b/src/com/android/settings/accessibility/TextReadingPreviewPager.java
@@ -18,8 +18,7 @@
import android.content.Context;
import android.util.AttributeSet;
-import android.view.MotionEvent;
-import android.view.ViewGroup;
+import android.view.View;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
@@ -29,18 +28,31 @@
* The view pager is used for displaying screen preview with different size configuration changes.
*/
public class TextReadingPreviewPager extends ViewPager {
+
public TextReadingPreviewPager(@NonNull Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
}
@Override
- public boolean onInterceptTouchEvent(MotionEvent ev) {
- final ViewGroup parent = (ViewGroup) getParent();
- if (parent != null) {
- // Avoid conflicting with the nested scroll view.
- parent.requestDisallowInterceptTouchEvent(true);
- }
+ public boolean onStartNestedScroll(View child, View target, int nestedScrollAxes) {
+ return (nestedScrollAxes & View.SCROLL_AXIS_VERTICAL) != 0;
+ }
- return super.onInterceptTouchEvent(ev);
+ @Override
+ public void onNestedScrollAccepted(View child, View target, int axes) {
+ super.onNestedScrollAccepted(child, target, axes);
+ // Allow the nested scrollview inside of the view pager to be scrollable.
+ getParent().requestDisallowInterceptTouchEvent(true);
+ }
+
+ @Override
+ public void onNestedScroll(
+ View target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed) {
+ if (dyUnconsumed != 0) {
+ // Assume dyUnconsumed != 0 means the target has been scrolled to the end vertically.
+ // We could let the parent to consume the rest of the dyUnconsumed
+ getParent().requestDisallowInterceptTouchEvent(false);
+ }
+ super.onNestedScroll(target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed);
}
}
diff --git a/src/com/android/settings/biometrics/fingerprint/UdfpsEnrollEnrollingView.java b/src/com/android/settings/biometrics/fingerprint/UdfpsEnrollEnrollingView.java
index d17fa24..c798dff 100644
--- a/src/com/android/settings/biometrics/fingerprint/UdfpsEnrollEnrollingView.java
+++ b/src/com/android/settings/biometrics/fingerprint/UdfpsEnrollEnrollingView.java
@@ -138,7 +138,8 @@
displayInfo.getNaturalWidth(),
displayInfo.getNaturalHeight(),
scaleFactor,
- displayInfo.rotation);
+ displayInfo.rotation,
+ udfpsProps.sensorType);
mUdfpsEnrollView.setOverlayParams(params);
mUdfpsEnrollView.setEnrollHelper(udfpsEnrollHelper);
diff --git a/src/com/android/settings/biometrics/fingerprint/UdfpsEnrollView.java b/src/com/android/settings/biometrics/fingerprint/UdfpsEnrollView.java
index 2d392ff..4a2a243 100644
--- a/src/com/android/settings/biometrics/fingerprint/UdfpsEnrollView.java
+++ b/src/com/android/settings/biometrics/fingerprint/UdfpsEnrollView.java
@@ -19,6 +19,7 @@
import android.content.Context;
import android.graphics.Rect;
import android.graphics.RectF;
+import android.hardware.fingerprint.FingerprintSensorProperties;
import android.os.Handler;
import android.os.Looper;
import android.util.AttributeSet;
@@ -202,7 +203,9 @@
}
private void onFingerDown() {
- mFingerprintDrawable.setShouldSkipDraw(true);
+ if (mOverlayParams.getSensorType() == FingerprintSensorProperties.TYPE_UDFPS_OPTICAL) {
+ mFingerprintDrawable.setShouldSkipDraw(true);
+ }
mFingerprintDrawable.invalidateSelf();
}
diff --git a/src/com/android/settings/biometrics2/ui/widget/UdfpsEnrollView.java b/src/com/android/settings/biometrics2/ui/widget/UdfpsEnrollView.java
index 831e83b..c99cb2d 100644
--- a/src/com/android/settings/biometrics2/ui/widget/UdfpsEnrollView.java
+++ b/src/com/android/settings/biometrics2/ui/widget/UdfpsEnrollView.java
@@ -260,8 +260,8 @@
displayInfo.getNaturalWidth(),
displayInfo.getNaturalHeight(),
scaleFactor,
- displayInfo.rotation);
-
+ displayInfo.rotation,
+ mSensorProperties.sensorType);
post(() -> {
mProgressBarRadius =
diff --git a/src/com/android/settings/dashboard/profileselector/ProfileSelectPhysicalKeyboardFragment.java b/src/com/android/settings/dashboard/profileselector/ProfileSelectPhysicalKeyboardFragment.java
index 239d609..2caf8db 100644
--- a/src/com/android/settings/dashboard/profileselector/ProfileSelectPhysicalKeyboardFragment.java
+++ b/src/com/android/settings/dashboard/profileselector/ProfileSelectPhysicalKeyboardFragment.java
@@ -51,9 +51,11 @@
@Override
public Fragment[] getFragments() {
+ Bundle bundle = new Bundle();
+ bundle.putParcelable(Settings.EXTRA_INPUT_DEVICE_IDENTIFIER, mInputDeviceIdentifier);
return ProfileSelectFragment.getFragments(
getContext(),
- null /* bundle */,
+ bundle,
NewKeyboardLayoutEnabledLocalesFragment::new,
NewKeyboardLayoutEnabledLocalesFragment::new,
NewKeyboardLayoutEnabledLocalesFragment::new);
diff --git a/src/com/android/settings/fuelgauge/batteryusage/BatteryChartPreferenceController.java b/src/com/android/settings/fuelgauge/batteryusage/BatteryChartPreferenceController.java
index 8ae8edd..51dce26 100644
--- a/src/com/android/settings/fuelgauge/batteryusage/BatteryChartPreferenceController.java
+++ b/src/com/android/settings/fuelgauge/batteryusage/BatteryChartPreferenceController.java
@@ -35,6 +35,7 @@
import com.android.settings.R;
import com.android.settings.SettingsActivity;
+import com.android.settings.Utils;
import com.android.settings.core.PreferenceControllerMixin;
import com.android.settings.overlay.FeatureFactory;
import com.android.settingslib.core.AbstractPreferenceController;
@@ -427,13 +428,35 @@
R.string.battery_usage_day_and_hour, selectedDayText, selectedHourText);
}
+ @VisibleForTesting
+ String getBatteryLevelPercentageInfo() {
+ if (mDailyViewModel == null || mHourlyViewModels == null) {
+ // No data
+ return "";
+ }
+
+ if (mDailyChartIndex == BatteryChartViewModel.SELECTED_INDEX_ALL
+ || mHourlyChartIndex == BatteryChartViewModel.SELECTED_INDEX_ALL) {
+ return mDailyViewModel.getSlotBatteryLevelText(mDailyChartIndex);
+ }
+
+ return mHourlyViewModels.get(mDailyChartIndex).getSlotBatteryLevelText(mHourlyChartIndex);
+ }
+
private String getAccessibilityAnnounceMessage() {
final String slotInformation = getSlotInformation();
- return slotInformation == null
- ? mPrefContext.getString(
- R.string.battery_usage_breakdown_title_since_last_full_charge)
- : mPrefContext.getString(
- R.string.battery_usage_breakdown_title_for_slot, slotInformation);
+ final String slotInformationMessage =
+ slotInformation == null
+ ? mPrefContext.getString(
+ R.string.battery_usage_breakdown_title_since_last_full_charge)
+ : mPrefContext.getString(
+ R.string.battery_usage_breakdown_title_for_slot, slotInformation);
+ final String batteryLevelPercentageMessage = getBatteryLevelPercentageInfo();
+
+ return mPrefContext.getString(
+ R.string.battery_usage_time_info_and_battery_level,
+ slotInformationMessage,
+ batteryLevelPercentageMessage);
}
private void animateBatteryChartViewGroup() {
@@ -573,7 +596,29 @@
return null;
}
- private final class DailyChartLabelTextGenerator
+ private abstract class BaseLabelTextGenerator
+ implements BatteryChartViewModel.LabelTextGenerator {
+ @Override
+ public String generateSlotBatteryLevelText(List<Integer> levels, int index) {
+ final int fromBatteryLevelIndex =
+ index == BatteryChartViewModel.SELECTED_INDEX_ALL ? 0 : index;
+ final int toBatteryLevelIndex =
+ index == BatteryChartViewModel.SELECTED_INDEX_ALL
+ ? levels.size() - 1
+ : index + 1;
+ return mPrefContext.getString(
+ R.string.battery_level_percentage,
+ generateBatteryLevelText(levels.get(fromBatteryLevelIndex)),
+ generateBatteryLevelText(levels.get(toBatteryLevelIndex)));
+ }
+
+ @VisibleForTesting
+ private static String generateBatteryLevelText(Integer level) {
+ return Utils.formatPercentage(level);
+ }
+ }
+
+ private final class DailyChartLabelTextGenerator extends BaseLabelTextGenerator
implements BatteryChartViewModel.LabelTextGenerator {
@Override
public String generateText(List<Long> timestamps, int index) {
@@ -588,7 +633,7 @@
}
}
- private final class HourlyChartLabelTextGenerator
+ private final class HourlyChartLabelTextGenerator extends BaseLabelTextGenerator
implements BatteryChartViewModel.LabelTextGenerator {
private static final int FULL_CHARGE_BATTERY_LEVEL = 100;
diff --git a/src/com/android/settings/fuelgauge/batteryusage/BatteryChartView.java b/src/com/android/settings/fuelgauge/batteryusage/BatteryChartView.java
index 6ff52a2..111a5a1 100644
--- a/src/com/android/settings/fuelgauge/batteryusage/BatteryChartView.java
+++ b/src/com/android/settings/fuelgauge/batteryusage/BatteryChartView.java
@@ -784,10 +784,16 @@
}
final AccessibilityNodeInfo childInfo =
new AccessibilityNodeInfo(BatteryChartView.this, index);
+ final String slotTimeInfo = mViewModel.getFullText(index);
+ final String batteryLevelInfo = mViewModel.getSlotBatteryLevelText(index);
onInitializeAccessibilityNodeInfo(childInfo);
childInfo.setClickable(isValidToDraw(mViewModel, index));
- childInfo.setText(mViewModel.getFullText(index));
- childInfo.setContentDescription(mViewModel.getFullText(index));
+ childInfo.setText(slotTimeInfo);
+ childInfo.setContentDescription(
+ mContext.getString(
+ R.string.battery_usage_time_info_and_battery_level,
+ slotTimeInfo,
+ batteryLevelInfo));
final Rect bounds = new Rect();
getBoundsOnScreen(bounds, true);
diff --git a/src/com/android/settings/fuelgauge/batteryusage/BatteryChartViewModel.java b/src/com/android/settings/fuelgauge/batteryusage/BatteryChartViewModel.java
index 6ec01a4..86890d5 100644
--- a/src/com/android/settings/fuelgauge/batteryusage/BatteryChartViewModel.java
+++ b/src/com/android/settings/fuelgauge/batteryusage/BatteryChartViewModel.java
@@ -40,11 +40,14 @@
}
interface LabelTextGenerator {
- /** Generate the label text. The text may be abbreviated to save space. */
+ /** Generates the label text. The text may be abbreviated to save space. */
String generateText(List<Long> timestamps, int index);
- /** Generate the full text for accessibility. */
+ /** Generates the full text for accessibility. */
String generateFullText(List<Long> timestamps, int index);
+
+ /** Generates the battery level text of a slot for accessibility.*/
+ String generateSlotBatteryLevelText(List<Integer> levels, int index);
}
private final List<Integer> mLevels;
@@ -53,6 +56,7 @@
private final LabelTextGenerator mLabelTextGenerator;
private final String[] mTexts;
private final String[] mFullTexts;
+ private final String[] mBatteryLevelTexts;
private int mSelectedIndex = SELECTED_INDEX_ALL;
private int mHighlightSlotIndex = SELECTED_INDEX_INVALID;
@@ -75,6 +79,8 @@
mLabelTextGenerator = labelTextGenerator;
mTexts = new String[size()];
mFullTexts = new String[size()];
+ // Last one for SELECTED_INDEX_ALL
+ mBatteryLevelTexts = new String[size() + 1];
}
public int size() {
@@ -99,6 +105,15 @@
return mFullTexts[index];
}
+ public String getSlotBatteryLevelText(int index) {
+ final int textIndex = index != SELECTED_INDEX_ALL ? index : size();
+ if (mBatteryLevelTexts[textIndex] == null) {
+ mBatteryLevelTexts[textIndex] =
+ mLabelTextGenerator.generateSlotBatteryLevelText(mLevels, index);
+ }
+ return mBatteryLevelTexts[textIndex];
+ }
+
public AxisLabelPosition axisLabelPosition() {
return mAxisLabelPosition;
}
diff --git a/src/com/android/settings/password/ConfirmDeviceCredentialActivity.java b/src/com/android/settings/password/ConfirmDeviceCredentialActivity.java
index 2a299c5..4a760ad 100644
--- a/src/com/android/settings/password/ConfirmDeviceCredentialActivity.java
+++ b/src/com/android/settings/password/ConfirmDeviceCredentialActivity.java
@@ -417,7 +417,7 @@
// the profile user using verifyTiedProfileChallenge. Biometrics can still be used if
// the user is stopped with delayed locking (i.e., with storage unlocked), so the user
// state (whether the user is in the RUNNING_UNLOCKED state) should not be relied upon.
- return !StorageManager.isUserKeyUnlocked(userId);
+ return !StorageManager.isCeStorageUnlocked(userId);
}
return !mUserManager.isUserUnlocked(userId);
}
diff --git a/src/com/android/settings/password/ConfirmDeviceCredentialUtils.java b/src/com/android/settings/password/ConfirmDeviceCredentialUtils.java
index 4778c03..32e7489 100644
--- a/src/com/android/settings/password/ConfirmDeviceCredentialUtils.java
+++ b/src/com/android/settings/password/ConfirmDeviceCredentialUtils.java
@@ -23,6 +23,8 @@
import android.app.admin.DevicePolicyManager;
import android.content.Intent;
import android.content.IntentSender;
+import android.content.pm.UserInfo;
+import android.content.pm.UserProperties;
import android.os.RemoteException;
import android.os.UserManager;
import android.view.View;
@@ -68,17 +70,45 @@
DevicePolicyManager dpm, int userId, boolean isStrongAuth) {
if (isStrongAuth) {
utils.reportSuccessfulPasswordAttempt(userId);
+ if (isBiometricUnlockEnabledForPrivateSpace()) {
+ final UserInfo userInfo = userManager.getUserInfo(userId);
+ if (userInfo != null) {
+ if (isProfileThatAlwaysRequiresAuthToDisableQuietMode(userManager, userInfo)
+ || userInfo.isManagedProfile()) {
+ // Keyguard is responsible to disable StrongAuth for primary user. Disable
+ // StrongAuth for profile challenges only here.
+ utils.userPresent(userId);
+ }
+ }
+ }
} else {
dpm.reportSuccessfulBiometricAttempt(userId);
}
- if (userManager.isManagedProfile(userId)) {
- // Keyguard is responsible to disable StrongAuth for primary user. Disable StrongAuth
- // for work challenge only here.
- utils.userPresent(userId);
+ if (!isBiometricUnlockEnabledForPrivateSpace()) {
+ if (userManager.isManagedProfile(userId)) {
+ // Disable StrongAuth for work challenge only here.
+ utils.userPresent(userId);
+ }
}
}
/**
+ * Returns true if the userInfo passed as the parameter corresponds to a profile that always
+ * requires auth to disable quiet mode and false otherwise
+ */
+ private static boolean isProfileThatAlwaysRequiresAuthToDisableQuietMode(
+ UserManager userManager, @NonNull UserInfo userInfo) {
+ final UserProperties userProperties =
+ userManager.getUserProperties(userInfo.getUserHandle());
+ return userProperties.isAuthAlwaysRequiredToDisableQuietMode() && userInfo.isProfile();
+ }
+
+ private static boolean isBiometricUnlockEnabledForPrivateSpace() {
+ return android.os.Flags.allowPrivateProfile()
+ && android.multiuser.Flags.enableBiometricsToUnlockPrivateSpace();
+ }
+
+ /**
* Request hiding soft-keyboard before animating away credential UI, in case IME
* insets animation get delayed by dismissing animation.
* @param view used to get root {@link WindowInsets} and {@link WindowInsetsController}.
diff --git a/src/com/android/settings/spa/development/UsageStatsListModel.kt b/src/com/android/settings/spa/development/UsageStatsListModel.kt
index d27796d..bb20da6 100644
--- a/src/com/android/settings/spa/development/UsageStatsListModel.kt
+++ b/src/com/android/settings/spa/development/UsageStatsListModel.kt
@@ -29,6 +29,7 @@
import com.android.settingslib.spaprivileged.model.app.AppListModel
import com.android.settingslib.spaprivileged.model.app.AppRecord
import java.text.DateFormat
+import java.time.Duration
import java.util.concurrent.TimeUnit
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.combine
@@ -77,15 +78,25 @@
@Composable
override fun getSummary(option: Int, record: UsageStatsAppRecord): (() -> String)? {
val usageStats = record.usageStats ?: return null
- val lastTimeUsed = DateUtils.formatSameDayTime(
- usageStats.lastTimeUsed, now, DateFormat.MEDIUM, DateFormat.MEDIUM
- )
- val lastTimeUsedLine = "${context.getString(R.string.last_time_used_label)}: $lastTimeUsed"
+ val lastTimeUsedLine =
+ "${context.getString(R.string.last_time_used_label)}: ${usageStats.getLastUsedString()}"
val usageTime = DateUtils.formatElapsedTime(usageStats.totalTimeInForeground / 1000)
val usageTimeLine = "${context.getString(R.string.usage_time_label)}: $usageTime"
return { "$lastTimeUsedLine\n$usageTimeLine" }
}
+ private fun UsageStats.getLastUsedString() = when {
+ lastTimeUsed < Duration.ofDays(1)
+ .toMillis() -> context.getString(R.string.last_time_used_never)
+
+ else -> DateUtils.formatSameDayTime(
+ lastTimeUsed,
+ now,
+ DateFormat.MEDIUM,
+ DateFormat.MEDIUM
+ )
+ }
+
private fun getUsageStats(): Map<String, UsageStats> {
val startTime = now - TimeUnit.DAYS.toMillis(5)
diff --git a/tests/robotests/src/com/android/settings/bluetooth/BluetoothDetailsCompanionAppsControllerTest.java b/tests/robotests/src/com/android/settings/bluetooth/BluetoothDetailsCompanionAppsControllerTest.java
index 120274d..faea3d8 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/BluetoothDetailsCompanionAppsControllerTest.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/BluetoothDetailsCompanionAppsControllerTest.java
@@ -112,6 +112,7 @@
/* selfManaged */ false,
/* notifyOnDeviceNearby */ true,
/* revoked */ false,
+ /* pending */ false,
/* timeApprovedMs */ System.currentTimeMillis(),
/* lastTimeConnected */ Long.MAX_VALUE,
/* systemDataSyncFlags */ -1);
diff --git a/tests/robotests/src/com/android/settings/fuelgauge/batteryusage/BatteryChartPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/fuelgauge/batteryusage/BatteryChartPreferenceControllerTest.java
index bbb022e..6fb021c 100644
--- a/tests/robotests/src/com/android/settings/fuelgauge/batteryusage/BatteryChartPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/fuelgauge/batteryusage/BatteryChartPreferenceControllerTest.java
@@ -384,6 +384,8 @@
mBatteryChartPreferenceController.mHourlyChartIndex = SELECTED_INDEX_ALL;
assertThat(mBatteryChartPreferenceController.getSlotInformation()).isEqualTo(null);
+ assertThat(mBatteryChartPreferenceController.getBatteryLevelPercentageInfo())
+ .isEqualTo("Battery level percentage from 100% to 66%");
}
@Test
@@ -393,6 +395,8 @@
mBatteryChartPreferenceController.mHourlyChartIndex = SELECTED_INDEX_ALL;
assertThat(mBatteryChartPreferenceController.getSlotInformation()).isEqualTo(null);
+ assertThat(mBatteryChartPreferenceController.getBatteryLevelPercentageInfo())
+ .isEqualTo("Battery level percentage from 100% to 66%");
}
@Test
@@ -402,6 +406,8 @@
mBatteryChartPreferenceController.mHourlyChartIndex = SELECTED_INDEX_ALL;
assertThat(mBatteryChartPreferenceController.getSlotInformation()).isEqualTo("Sunday");
+ assertThat(mBatteryChartPreferenceController.getBatteryLevelPercentageInfo())
+ .isEqualTo("Battery level percentage from 83% to 59%");
}
@Test
@@ -412,6 +418,8 @@
assertThat(mBatteryChartPreferenceController.getSlotInformation())
.isEqualTo("10 AM - 12 PM");
+ assertThat(mBatteryChartPreferenceController.getBatteryLevelPercentageInfo())
+ .isEqualTo("Battery level percentage from 97% to 95%");
}
@Test
@@ -422,6 +430,8 @@
assertThat(mBatteryChartPreferenceController.getSlotInformation())
.isEqualTo("Sunday 4 PM - 6 PM");
+ assertThat(mBatteryChartPreferenceController.getBatteryLevelPercentageInfo())
+ .isEqualTo("Battery level percentage from 67% to 65%");
}
@Test
@@ -432,6 +442,8 @@
assertThat(mBatteryChartPreferenceController.getSlotInformation())
.isEqualTo("7:01 AM - 8 AM");
+ assertThat(mBatteryChartPreferenceController.getBatteryLevelPercentageInfo())
+ .isEqualTo("Battery level percentage from 100% to 99%");
}
@Test
@@ -441,6 +453,8 @@
mBatteryChartPreferenceController.mHourlyChartIndex = 3;
assertThat(mBatteryChartPreferenceController.getSlotInformation()).isEqualTo("12 PM - now");
+ assertThat(mBatteryChartPreferenceController.getBatteryLevelPercentageInfo())
+ .isEqualTo("Battery level percentage from 95% to 66%");
}
@Test
@@ -451,6 +465,8 @@
assertThat(mBatteryChartPreferenceController.getSlotInformation())
.isEqualTo("7:01 AM - now");
+ assertThat(mBatteryChartPreferenceController.getBatteryLevelPercentageInfo())
+ .isEqualTo("Battery level percentage from 100% to 66%");
}
@Test