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: I382e4ecd3c335d7b046f157cedc093fc40c3a77a
This commit is contained in:
Candice Lo
2023-03-07 15:42:29 +00:00
parent 39129e09d3
commit dbaea0f1c2
2 changed files with 27 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);
}
}