Set display size to all displays

Bug: 197730930

Test: Open Settings, go to Display -> Display size and text -> Display size, change the value, fold/unfold the device, see that the value persists.
Test: DisplaySizeDataTest
Test: atest ScreenResolutionFragmentTest
Test: ScreenZoomSettingsTest
Change-Id: I3d6858a9b20798c2ad3b12a66db3484491682691
This commit is contained in:
Piotr Wilczyński
2022-12-07 14:01:50 +00:00
parent 1e7401401d
commit 93ac8a9ccd
4 changed files with 25 additions and 23 deletions

View File

@@ -36,13 +36,13 @@ public class ScreenZoomPreference extends Preference {
android.R.attr.preferenceStyle));
final DisplayDensityUtils density = new DisplayDensityUtils(context);
final int defaultIndex = density.getCurrentIndex();
final int defaultIndex = density.getCurrentIndexForDefaultDisplay();
if (defaultIndex < 0) {
setVisible(false);
setEnabled(false);
} else if (TextUtils.isEmpty(getSummary())) {
final String[] entries = density.getEntries();
final int currentIndex = density.getCurrentIndex();
final String[] entries = density.getDefaultDisplayDensityEntries();
final int currentIndex = density.getCurrentIndexForDefaultDisplay();
setSummary(entries[currentIndex]);
}
}