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

Commit bd89bc1e authored by Jeremy Nei's avatar Jeremy Nei Committed by Android (Google) Code Review
Browse files

Merge "Report user selected resolution events to StatsLog"

parents 30f206d2 c98bff6d
Loading
Loading
Loading
Loading
+17 −3
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@ import android.graphics.drawable.Drawable;
import android.hardware.display.DisplayManager;
import android.provider.Settings;
import android.text.TextUtils;
import android.util.Log;
import android.view.Display;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityManager;
@@ -36,6 +37,7 @@ import androidx.annotation.VisibleForTesting;
import androidx.preference.PreferenceScreen;

import com.android.settings.R;
import com.android.settings.core.instrumentation.SettingsStatsLog;
import com.android.settings.search.BaseSearchIndexProvider;
import com.android.settings.widget.RadioButtonPickerFragment;
import com.android.settingslib.display.DisplayDensityUtils;
@@ -167,14 +169,26 @@ public class ScreenResolutionFragment extends RadioButtonPickerFragment {
        mDisplayObserver.startObserve();

        /** For store settings globally. */
        /** TODO(b/238061217): Moving to an atom with the same string */
        /** TODO(b/259797244): Remove this once the atom is fully populated. */
        Settings.System.putString(
                getContext().getContentResolver(),
                SCREEN_RESOLUTION,
                mode.getPhysicalWidth() + "x" + mode.getPhysicalHeight());

        try {
            /** Apply the resolution change. */
            mDefaultDisplay.setUserPreferredDisplayMode(mode);
        } catch (Exception e) {
            Log.e(TAG, "setUserPreferredDisplayMode() failed", e);
            return;
        }

        /** Send the atom after resolution changed successfully. */
        SettingsStatsLog.write(
                SettingsStatsLog.USER_SELECTED_RESOLUTION,
                mDefaultDisplay.getUniqueId().hashCode(),
                mode.getPhysicalWidth(),
                mode.getPhysicalHeight());
    }

    /** Get the key corresponding to the resolution. */