Set the settings key when the font size is changed

The key ACCESSIBILITY_FONT_SCALING_HAS_BEEN_CHANGED will be always ON
after users modify the font size for the first time.

Bug: 269679768
Test: make RunSettingsRoboTests ROBOTEST_FILTER=FontSizeDataTest
Change-Id: I5967227ce05d5b8bf37dfec9aafa015c5cacbd30
Merged-In: I382e4ecd3c335d7b046f157cedc093fc40c3a77a
This commit is contained in:
Candice Lo
2023-03-06 05:38:24 +00:00
parent 1fc651aee7
commit f19f710b01
2 changed files with 26 additions and 0 deletions

View File

@@ -16,6 +16,9 @@
package com.android.settings.accessibility;
import static com.android.settings.accessibility.AccessibilityUtil.State.OFF;
import static com.android.settings.accessibility.AccessibilityUtil.State.ON;
import static com.google.common.truth.Truth.assertThat;
import android.content.Context;
@@ -52,4 +55,19 @@ public class FontSizeDataTest {
assertThat(currentScale).isEqualTo(mFontSizeData.getValues().get(progress));
}
@Test
public void commit_fontScalingHasBeenChangedIsOn() {
final int progress = 3;
Settings.Secure.putInt(mContext.getContentResolver(),
Settings.Secure.ACCESSIBILITY_FONT_SCALING_HAS_BEEN_CHANGED, OFF);
mFontSizeData.commit(progress);
final int currentSettings = Settings.Secure.getInt(
mContext.getContentResolver(),
Settings.Secure.ACCESSIBILITY_FONT_SCALING_HAS_BEEN_CHANGED,
/* def= */ OFF);
assertThat(currentSettings).isEqualTo(ON);
}
}