Merge "Increment TeX counters for the HCT migration notification." into main

This commit is contained in:
Daniel Norman
2025-01-22 15:55:12 -08:00
committed by Android (Google) Code Review
2 changed files with 16 additions and 0 deletions

View File

@@ -36,6 +36,7 @@ import android.util.Log;
import androidx.annotation.NonNull;
import com.android.graphics.hwui.flags.Flags;
import com.android.modules.expresslog.Counter;
import com.android.settings.R;
import com.google.common.annotations.VisibleForTesting;
@@ -166,6 +167,7 @@ public class HighContrastTextMigrationReceiver extends BroadcastReceiver {
NotificationManager.IMPORTANCE_LOW);
notificationManager.createNotificationChannel(notificationChannel);
notificationManager.notify(NOTIFICATION_ID, notificationBuilder.build());
Counter.logIncrement("accessibility.value_hct_notification_posted");
}
private Intent createHighContrastTextSettingsIntent(Context context) {
@@ -174,6 +176,8 @@ public class HighContrastTextMigrationReceiver extends BroadcastReceiver {
Bundle fragmentArgs = new Bundle();
fragmentArgs.putString(EXTRA_FRAGMENT_ARG_KEY,
TextReadingPreferenceFragment.HIGH_TEXT_CONTRAST_KEY);
fragmentArgs.putInt(TextReadingPreferenceFragment.EXTRA_LAUNCHED_FROM,
TextReadingPreferenceFragment.EntryPoint.HIGH_CONTRAST_TEXT_NOTIFICATION);
settingsIntent.putExtra(EXTRA_SHOW_FRAGMENT_ARGUMENTS, fragmentArgs);
return settingsIntent;
}

View File

@@ -34,6 +34,8 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;
import com.android.graphics.hwui.flags.Flags;
import com.android.modules.expresslog.Counter;
import com.android.settings.R;
import com.android.settings.accessibility.AccessibilityDialogUtils.DialogEnums;
import com.android.settings.dashboard.DashboardFragment;
@@ -84,6 +86,7 @@ public class TextReadingPreferenceFragment extends DashboardFragment {
EntryPoint.SUW_ANYTHING_ELSE,
EntryPoint.DISPLAY_SETTINGS,
EntryPoint.ACCESSIBILITY_SETTINGS,
EntryPoint.HIGH_CONTRAST_TEXT_NOTIFICATION,
})
@interface EntryPoint {
int UNKNOWN_ENTRY = 0;
@@ -91,6 +94,7 @@ public class TextReadingPreferenceFragment extends DashboardFragment {
int SUW_ANYTHING_ELSE = 2;
int DISPLAY_SETTINGS = 3;
int ACCESSIBILITY_SETTINGS = 4;
int HIGH_CONTRAST_TEXT_NOTIFICATION = 5;
}
@VisibleForTesting
@@ -121,6 +125,14 @@ public class TextReadingPreferenceFragment extends DashboardFragment {
rootView.setAccessibilityPaneTitle(getString(
R.string.accessibility_text_reading_options_title));
}
if (Flags.highContrastTextSmallTextRect()) {
updateEntryPoint();
if (mEntryPoint == EntryPoint.HIGH_CONTRAST_TEXT_NOTIFICATION
// Only log this counter during the first launch, not during activity refresh
&& savedInstanceState == null) {
Counter.logIncrement("accessibility.value_hct_notification_opened_settings");
}
}
}
@Override