Add power consumption footer in screen timeout page.

- show this footer when there's no footer about work profile
Screenshots:
[without work profile]: https://screenshot.googleplex.com/5pAD2xBvP6QSBvY
[with work profile]:  https://screenshot.googleplex.com/7BRd6ToAjFN9QZx

Bug: 300245790
Test: manual
Test: make RunSettingsRoboTests ROBOTEST_FILTER="com.android.settings.display.ScreenTimeoutSettingsTest"
Change-Id: I6df018d7758fbec3277179358b17eb11fa1aee34
This commit is contained in:
mxyyiyi
2023-11-24 15:08:43 +08:00
parent 6ab64aa71f
commit 027db802fe
3 changed files with 41 additions and 1 deletions

View File

@@ -92,6 +92,9 @@ public class ScreenTimeoutSettings extends RadioButtonPickerFragment implements
@VisibleForTesting
FooterPreference mDisableOptionsPreference;
@VisibleForTesting
FooterPreference mPowerConsumptionPreference;
@VisibleForTesting
AdaptiveSleepPermissionPreferenceController mAdaptiveSleepPermissionController;
@@ -216,6 +219,9 @@ public class ScreenTimeoutSettings extends RadioButtonPickerFragment implements
if (mAdmin != null) {
setupDisabledFooterPreference();
screen.addPreference(mDisableOptionsPreference);
} else {
setupPowerConsumptionFooterPreference();
screen.addPreference(mPowerConsumptionPreference);
}
}
@@ -236,8 +242,20 @@ public class ScreenTimeoutSettings extends RadioButtonPickerFragment implements
mDisableOptionsPreference.setIcon(R.drawable.ic_info_outline_24dp);
// The 'disabled by admin' preference should always be at the end of the setting page.
mDisableOptionsPreference.setOrder(DEFAULT_ORDER_OF_LOWEST_PREFERENCE);
mPrivacyPreference.setOrder(DEFAULT_ORDER_OF_LOWEST_PREFERENCE - 1);
mDisableOptionsPreference.setOrder(DEFAULT_ORDER_OF_LOWEST_PREFERENCE);
}
@VisibleForTesting
void setupPowerConsumptionFooterPreference() {
mPowerConsumptionPreference = new FooterPreference(getContext());
mPowerConsumptionPreference.setTitle(R.string.power_consumption_footer_summary);
mPowerConsumptionPreference.setSelectable(false);
mPowerConsumptionPreference.setIcon(R.drawable.ic_info_outline_24dp);
// The 'Longer screen timeout' preference should always be at the end of the setting page.
mPrivacyPreference.setOrder(DEFAULT_ORDER_OF_LOWEST_PREFERENCE - 1);
mPowerConsumptionPreference.setOrder(DEFAULT_ORDER_OF_LOWEST_PREFERENCE);
}
@Override