Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5b2a7697 authored by Daniel Norman's avatar Daniel Norman
Browse files

Increment TeX counters for the HCT migration notification.

See the corresponding TeX change for more details.

Bug: 369906140
Flag: com.android.graphics.hwui.flags.high_contrast_text_small_text_rect
Test: run statsd_testdrive 644 and verify the output when the
      notification appears
Test: ensure that rotating / restarting the activity does not trigger
      multiple increments to the counter
Change-Id: Iea01962611e3e327cfbde6f3451f7f1ec54b955e
parent ffb64450
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -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;
    }
+12 −0
Original line number Diff line number Diff line
@@ -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