Logging for the feature "Text and reading options" in Android T.
Logging for the status of five features “Font size”, “Display size”, “Bold Text”, “High contrast text”, and “Reset” in the “Display size and text” page. Bug: 222661478 Test: manual test Change-Id: I33060fca860e02ddac7716275e8682e70fbaff1f
This commit is contained in:
@@ -23,7 +23,9 @@ import androidx.preference.PreferenceScreen;
|
||||
import androidx.preference.SwitchPreference;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.accessibility.TextReadingPreferenceFragment.EntryPoint;
|
||||
import com.android.settings.core.TogglePreferenceController;
|
||||
import com.android.settings.core.instrumentation.SettingsStatsLog;
|
||||
|
||||
/**
|
||||
* PreferenceController for displaying all text in high contrast style.
|
||||
@@ -32,6 +34,9 @@ public class HighTextContrastPreferenceController extends TogglePreferenceContro
|
||||
TextReadingResetController.ResetStateListener {
|
||||
private SwitchPreference mSwitchPreference;
|
||||
|
||||
@EntryPoint
|
||||
private int mEntryPoint;
|
||||
|
||||
public HighTextContrastPreferenceController(Context context, String preferenceKey) {
|
||||
super(context, preferenceKey);
|
||||
}
|
||||
@@ -49,6 +54,12 @@ public class HighTextContrastPreferenceController extends TogglePreferenceContro
|
||||
|
||||
@Override
|
||||
public boolean setChecked(boolean isChecked) {
|
||||
SettingsStatsLog.write(
|
||||
SettingsStatsLog.ACCESSIBILITY_TEXT_READING_OPTIONS_CHANGED,
|
||||
AccessibilityStatsLogUtils.convertToItemKeyName(getPreferenceKey()),
|
||||
isChecked ? 1 : 0,
|
||||
AccessibilityStatsLogUtils.convertToEntryPoint(mEntryPoint));
|
||||
|
||||
return Settings.Secure.putInt(mContext.getContentResolver(),
|
||||
Settings.Secure.ACCESSIBILITY_HIGH_TEXT_CONTRAST_ENABLED, (isChecked ? 1 : 0));
|
||||
}
|
||||
@@ -69,4 +80,13 @@ public class HighTextContrastPreferenceController extends TogglePreferenceContro
|
||||
setChecked(false);
|
||||
updateState(mSwitchPreference);
|
||||
}
|
||||
|
||||
/**
|
||||
* The entry point is used for logging.
|
||||
*
|
||||
* @param entryPoint from which settings page
|
||||
*/
|
||||
void setEntryPoint(@EntryPoint int entryPoint) {
|
||||
mEntryPoint = entryPoint;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user