Merge "Add power consumption footer in screen timeout page." into main

This commit is contained in:
Treehugger Robot
2023-11-24 09:59:58 +00:00
committed by Android (Google) Code Review
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