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:
@@ -21,7 +21,9 @@ import android.graphics.fonts.FontStyle;
|
||||
import android.provider.Settings;
|
||||
|
||||
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 bold. */
|
||||
public class FontWeightAdjustmentPreferenceController extends TogglePreferenceController implements
|
||||
@@ -29,6 +31,9 @@ public class FontWeightAdjustmentPreferenceController extends TogglePreferenceCo
|
||||
static final int BOLD_TEXT_ADJUSTMENT =
|
||||
FontStyle.FONT_WEIGHT_BOLD - FontStyle.FONT_WEIGHT_NORMAL;
|
||||
|
||||
@EntryPoint
|
||||
private int mEntryPoint;
|
||||
|
||||
public FontWeightAdjustmentPreferenceController(Context context, String preferenceKey) {
|
||||
super(context, preferenceKey);
|
||||
}
|
||||
@@ -46,6 +51,12 @@ public class FontWeightAdjustmentPreferenceController extends TogglePreferenceCo
|
||||
|
||||
@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.FONT_WEIGHT_ADJUSTMENT, (isChecked ? BOLD_TEXT_ADJUSTMENT : 0));
|
||||
}
|
||||
@@ -59,4 +70,13 @@ public class FontWeightAdjustmentPreferenceController extends TogglePreferenceCo
|
||||
public void resetState() {
|
||||
setChecked(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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