Fine-tune the location of the logging for accessibility text and reading options.
Goals: To have the precise logs, move the previous logs to the proper location. Bug: 222661478 Test: manual test Change-Id: I74d99659d2b383222b381c430c3c373879f5cbdc
This commit is contained in:
@@ -22,9 +22,7 @@ import android.widget.SeekBar;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.preference.PreferenceScreen;
|
||||
|
||||
import com.android.settings.accessibility.TextReadingPreferenceFragment.EntryPoint;
|
||||
import com.android.settings.core.BasePreferenceController;
|
||||
import com.android.settings.core.instrumentation.SettingsStatsLog;
|
||||
import com.android.settings.widget.LabeledSeekBarPreference;
|
||||
|
||||
/**
|
||||
@@ -38,9 +36,6 @@ class PreviewSizeSeekBarController extends BasePreferenceController implements
|
||||
private ProgressInteractionListener mInteractionListener;
|
||||
private LabeledSeekBarPreference mSeekBarPreference;
|
||||
|
||||
@EntryPoint
|
||||
private int mEntryPoint;
|
||||
|
||||
private final SeekBar.OnSeekBarChangeListener mSeekBarChangeListener =
|
||||
new SeekBar.OnSeekBarChangeListener() {
|
||||
@Override
|
||||
@@ -51,11 +46,6 @@ class PreviewSizeSeekBarController extends BasePreferenceController implements
|
||||
mInteractionListener.onProgressChanged();
|
||||
}
|
||||
|
||||
SettingsStatsLog.write(
|
||||
SettingsStatsLog.ACCESSIBILITY_TEXT_READING_OPTIONS_CHANGED,
|
||||
AccessibilityStatsLogUtils.convertToItemKeyName(getPreferenceKey()),
|
||||
progress,
|
||||
AccessibilityStatsLogUtils.convertToEntryPoint(mEntryPoint));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -107,14 +97,6 @@ class PreviewSizeSeekBarController extends BasePreferenceController implements
|
||||
mSeekBarPreference.setProgress(defaultProgress);
|
||||
}
|
||||
|
||||
/**
|
||||
* The entry point is used for logging.
|
||||
*
|
||||
* @param entryPoint from which settings page
|
||||
*/
|
||||
void setEntryPoint(@EntryPoint int entryPoint) {
|
||||
mEntryPoint = entryPoint;
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface for callbacks when users interact with the seek bar.
|
||||
|
@@ -129,18 +129,17 @@ public class TextReadingPreferenceFragment extends DashboardFragment {
|
||||
|
||||
final TextReadingPreviewController previewController = new TextReadingPreviewController(
|
||||
context, PREVIEW_KEY, fontSizeData, displaySizeData);
|
||||
previewController.setEntryPoint(mEntryPoint);
|
||||
controllers.add(previewController);
|
||||
|
||||
final PreviewSizeSeekBarController fontSizeController = new PreviewSizeSeekBarController(
|
||||
context, FONT_SIZE_KEY, fontSizeData);
|
||||
fontSizeController.setInteractionListener(previewController);
|
||||
fontSizeController.setEntryPoint(mEntryPoint);
|
||||
controllers.add(fontSizeController);
|
||||
|
||||
final PreviewSizeSeekBarController displaySizeController = new PreviewSizeSeekBarController(
|
||||
context, DISPLAY_SIZE_KEY, displaySizeData);
|
||||
displaySizeController.setInteractionListener(previewController);
|
||||
displaySizeController.setEntryPoint(mEntryPoint);
|
||||
controllers.add(displaySizeController);
|
||||
|
||||
mFontWeightAdjustmentController =
|
||||
|
@@ -19,6 +19,7 @@ package com.android.settings.accessibility;
|
||||
import android.content.Context;
|
||||
import android.content.res.Configuration;
|
||||
import android.os.SystemClock;
|
||||
import android.util.Log;
|
||||
import android.view.Choreographer;
|
||||
import android.view.View;
|
||||
|
||||
@@ -26,7 +27,9 @@ import androidx.annotation.NonNull;
|
||||
import androidx.preference.PreferenceScreen;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.accessibility.TextReadingPreferenceFragment.EntryPoint;
|
||||
import com.android.settings.core.BasePreferenceController;
|
||||
import com.android.settings.core.instrumentation.SettingsStatsLog;
|
||||
import com.android.settings.display.PreviewPagerAdapter;
|
||||
import com.android.settings.widget.LabeledSeekBarPreference;
|
||||
|
||||
@@ -38,6 +41,7 @@ import java.util.Objects;
|
||||
*/
|
||||
class TextReadingPreviewController extends BasePreferenceController implements
|
||||
PreviewSizeSeekBarController.ProgressInteractionListener {
|
||||
private static final String TAG = "TextReadingPreviewCtrl";
|
||||
static final int[] PREVIEW_SAMPLE_RES_IDS = new int[]{
|
||||
R.layout.accessibility_text_reading_preview_app_grid,
|
||||
R.layout.screen_zoom_preview_1,
|
||||
@@ -58,6 +62,9 @@ class TextReadingPreviewController extends BasePreferenceController implements
|
||||
private LabeledSeekBarPreference mFontSizePreference;
|
||||
private LabeledSeekBarPreference mDisplaySizePreference;
|
||||
|
||||
@EntryPoint
|
||||
private int mEntryPoint;
|
||||
|
||||
private final Choreographer.FrameCallback mCommit = f -> {
|
||||
tryCommitFontSizeConfig();
|
||||
tryCommitDisplaySizeConfig();
|
||||
@@ -92,8 +99,8 @@ class TextReadingPreviewController extends BasePreferenceController implements
|
||||
/* message= */ "Display size preference is null, the preview controller"
|
||||
+ " couldn't get the info");
|
||||
|
||||
mLastFontProgress = mFontSizePreference.getProgress();
|
||||
mLastDisplayProgress = mDisplaySizePreference.getProgress();
|
||||
mLastFontProgress = mFontSizeData.getInitialIndex();
|
||||
mLastDisplayProgress = mDisplaySizeData.getInitialIndex();
|
||||
|
||||
final Configuration origConfig = mContext.getResources().getConfiguration();
|
||||
final boolean isLayoutRtl =
|
||||
@@ -131,6 +138,15 @@ class TextReadingPreviewController extends BasePreferenceController implements
|
||||
postCommitDelayed(CHANGE_BY_SEEKBAR_DELAY_MS);
|
||||
}
|
||||
|
||||
/**
|
||||
* The entry point is used for logging.
|
||||
*
|
||||
* @param entryPoint from which settings page
|
||||
*/
|
||||
void setEntryPoint(@EntryPoint int entryPoint) {
|
||||
mEntryPoint = entryPoint;
|
||||
}
|
||||
|
||||
/**
|
||||
* Avoids the flicker when switching to the previous or next level.
|
||||
*
|
||||
@@ -162,6 +178,16 @@ class TextReadingPreviewController extends BasePreferenceController implements
|
||||
if (fontProgress != mLastFontProgress) {
|
||||
mFontSizeData.commit(fontProgress);
|
||||
mLastFontProgress = fontProgress;
|
||||
|
||||
if (Log.isLoggable(TAG, Log.DEBUG)) {
|
||||
Log.d(TAG, "Font size: " + fontProgress);
|
||||
}
|
||||
|
||||
SettingsStatsLog.write(
|
||||
SettingsStatsLog.ACCESSIBILITY_TEXT_READING_OPTIONS_CHANGED,
|
||||
AccessibilityStatsLogUtils.convertToItemKeyName(mFontSizePreference.getKey()),
|
||||
fontProgress,
|
||||
AccessibilityStatsLogUtils.convertToEntryPoint(mEntryPoint));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -170,6 +196,17 @@ class TextReadingPreviewController extends BasePreferenceController implements
|
||||
if (displayProgress != mLastDisplayProgress) {
|
||||
mDisplaySizeData.commit(displayProgress);
|
||||
mLastDisplayProgress = displayProgress;
|
||||
|
||||
if (Log.isLoggable(TAG, Log.DEBUG)) {
|
||||
Log.d(TAG, "Display size: " + displayProgress);
|
||||
}
|
||||
|
||||
SettingsStatsLog.write(
|
||||
SettingsStatsLog.ACCESSIBILITY_TEXT_READING_OPTIONS_CHANGED,
|
||||
AccessibilityStatsLogUtils.convertToItemKeyName(
|
||||
mDisplaySizePreference.getKey()),
|
||||
displayProgress,
|
||||
AccessibilityStatsLogUtils.convertToEntryPoint(mEntryPoint));
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user