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

Commit 292fba02 authored by John Pan's avatar John Pan
Browse files

Add logging for color variants

Bug: 223304277
Test: Manual
Change-Id: I65e9b4368538b3447e199e834c0d424d797d9667
parent 7b55f1f3
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -346,7 +346,7 @@ public class ColorSectionController implements CustomizationSectionController<Co
            public void onSuccess() {
                mColorSectionView.announceForAccessibility(
                        mColorSectionView.getContext().getString(R.string.color_changed));
                mEventLogger.logColorApplied(getColorAction(colorOption), colorOption.getIndex());
                mEventLogger.logColorApplied(getColorAction(colorOption), colorOption);
            }

            @Override
+22 −20
Original line number Diff line number Diff line
@@ -46,6 +46,7 @@ import android.text.TextUtils;
import androidx.annotation.Nullable;

import com.android.customization.model.clock.Clockface;
import com.android.customization.model.color.ColorOption;
import com.android.customization.model.grid.GridOption;
import com.android.customization.model.theme.ThemeBundle;
import com.android.systemui.shared.system.SysUiStatsLog;
@@ -79,31 +80,31 @@ public class StatsLogUserEventLogger extends NoOpUserEventLogger implements Them
    public void logAppLaunched(Intent launchSource) {
        SysUiStatsLog.write(STYLE_UI_CHANGED, STYLE_UICHANGED__ACTION__APP_LAUNCHED,
                0, 0, 0, 0, 0, 0, 0, 0, 0, 0, getAppLaunchSource(launchSource), 0, 0,
                0, 0, 0, 0, 0);
                0, 0, 0, 0, 0, 0);
    }

    @Override
    public void logResumed(boolean provisioned, boolean wallpaper) {
        SysUiStatsLog.write(STYLE_UI_CHANGED, StyleEnums.ONRESUME,
                0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
                0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
    }

    @Override
    public void logStopped() {
        SysUiStatsLog.write(STYLE_UI_CHANGED, StyleEnums.ONSTOP,
                0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
                0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
    }

    @Override
    public void logActionClicked(String collectionId, int actionLabelResId) {
        SysUiStatsLog.write(STYLE_UI_CHANGED, StyleEnums.WALLPAPER_EXPLORE, 0, 0, 0, 0, 0,
                getIdHashCode(collectionId), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
                getIdHashCode(collectionId), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
    }

    @Override
    public void logIndividualWallpaperSelected(String collectionId) {
        SysUiStatsLog.write(STYLE_UI_CHANGED, StyleEnums.WALLPAPER_SELECT, 0, 0, 0, 0, 0,
                getIdHashCode(collectionId), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
                getIdHashCode(collectionId), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
    }

    @Override
@@ -111,7 +112,7 @@ public class StatsLogUserEventLogger extends NoOpUserEventLogger implements Them
        SysUiStatsLog.write(STYLE_UI_CHANGED, StyleEnums.WALLPAPER_OPEN_CATEGORY,
                0, 0, 0, 0, 0,
                getIdHashCode(collectionId),
                0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
                0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
    }

    @Override
@@ -120,7 +121,7 @@ public class StatsLogUserEventLogger extends NoOpUserEventLogger implements Them
                0, 0, 0, 0, 0,
                getIdHashCode(collectionId),
                getIdHashCode(wallpaperId),
                0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
                0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
    }

    @Override
@@ -130,7 +131,7 @@ public class StatsLogUserEventLogger extends NoOpUserEventLogger implements Them
                0, 0, 0, 0, 0,
                getIdHashCode(collectionId),
                getIdHashCode(wallpaperId),
                0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
                0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
    }

    @Override
@@ -154,7 +155,8 @@ public class StatsLogUserEventLogger extends NoOpUserEventLogger implements Them
                getIdHashCode(lockWallpaperId),
                mPreferences.getFirstLaunchDateSinceSetup(),
                mPreferences.getFirstWallpaperApplyDateSinceSetup(),
                mPreferences.getAppLaunchCount());
                mPreferences.getAppLaunchCount(),
                0);
    }

    @Override
@@ -165,14 +167,14 @@ public class StatsLogUserEventLogger extends NoOpUserEventLogger implements Them
                getIdHashCode(collectionId),
                getIdHashCode(wallpaperId),
                0, 0, 0, 0, 0, effects != null ? effects.hashCode() : 0,
                0, 0, 0, 0, 0);
                0, 0, 0, 0, 0, 0);
    }

    @Override
    public void logEffectApply(String effect, @EffectStatus int status) {
        SysUiStatsLog.write(STYLE_UI_CHANGED, StyleEnums.WALLPAPER_EFFECT_APPLIED,
                0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, status, effect != null ? effect.hashCode() : 0,
                0, 0, 0, 0, 0);
                0, 0, 0, 0, 0, 0);
    }

    @Nullable
@@ -187,7 +189,7 @@ public class StatsLogUserEventLogger extends NoOpUserEventLogger implements Them
                Objects.hashCode(getThemePackage(theme, OVERLAY_CATEGORY_COLOR)),
                Objects.hashCode(getThemePackage(theme,OVERLAY_CATEGORY_FONT)),
                Objects.hashCode(getThemePackage(theme, OVERLAY_CATEGORY_SHAPE)),
                0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
                0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
    }

    @Override
@@ -196,15 +198,15 @@ public class StatsLogUserEventLogger extends NoOpUserEventLogger implements Them
                Objects.hashCode(getThemePackage(theme, OVERLAY_CATEGORY_COLOR)),
                Objects.hashCode(getThemePackage(theme,OVERLAY_CATEGORY_FONT)),
                Objects.hashCode(getThemePackage(theme, OVERLAY_CATEGORY_SHAPE)),
                0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
                0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
    }

    @Override
    public void logColorApplied(int action, int colorIndex) {
    public void logColorApplied(int action, ColorOption colorOption) {
        SysUiStatsLog.write(STYLE_UI_CHANGED, action,
                0, 0, 0, 0, 0, 0, 0,
                colorIndex,
                0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
                colorOption.getIndex(),
                0, 0, 0, 0, 0, 0, 0, 0, 0, 0, colorOption.getStyle().ordinal() + 1);
    }

    @Override
@@ -212,7 +214,7 @@ public class StatsLogUserEventLogger extends NoOpUserEventLogger implements Them
        SysUiStatsLog.write(STYLE_UI_CHANGED, StyleEnums.PICKER_SELECT,
                0, 0, 0,
                Objects.hashCode(clock.getId()),
                0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
                0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
    }

    @Override
@@ -220,7 +222,7 @@ public class StatsLogUserEventLogger extends NoOpUserEventLogger implements Them
        SysUiStatsLog.write(STYLE_UI_CHANGED, StyleEnums.PICKER_APPLIED,
                0, 0, 0,
                Objects.hashCode(clock.getId()),
                0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
                0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
    }

    @Override
@@ -228,7 +230,7 @@ public class StatsLogUserEventLogger extends NoOpUserEventLogger implements Them
        SysUiStatsLog.write(STYLE_UI_CHANGED, StyleEnums.PICKER_SELECT,
                0, 0, 0, 0,
                grid.cols,
                0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
                0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
    }

    @Override
@@ -236,7 +238,7 @@ public class StatsLogUserEventLogger extends NoOpUserEventLogger implements Them
        SysUiStatsLog.write(STYLE_UI_CHANGED, StyleEnums.PICKER_APPLIED,
                0, 0, 0, 0,
                grid.cols,
                0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
                0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
    }

    private int getAppLaunchSource(Intent launchSource) {
+3 −2
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@
package com.android.customization.module;

import com.android.customization.model.clock.Clockface;
import com.android.customization.model.color.ColorOption;
import com.android.customization.model.grid.GridOption;
import com.android.customization.model.theme.ThemeBundle;
import com.android.wallpaper.module.UserEventLogger;
@@ -33,9 +34,9 @@ public interface ThemesUserEventLogger extends UserEventLogger {
     * Logs the color usage while color is applied.
     *
     * @param action color applied action.
     * @param colorIndex color applied index.
     * @param colorOption applied color option.
     */
    void logColorApplied(int action, int colorIndex);
    void logColorApplied(int action, ColorOption colorOption);

    void logClockSelected(Clockface clock);

+2 −1
Original line number Diff line number Diff line
package com.android.customization.testing;

import com.android.customization.model.clock.Clockface;
import com.android.customization.model.color.ColorOption;
import com.android.customization.model.grid.GridOption;
import com.android.customization.model.theme.ThemeBundle;
import com.android.customization.module.ThemesUserEventLogger;
@@ -22,7 +23,7 @@ public class TestThemesUserEventLogger extends TestUserEventLogger
    }

    @Override
    public void logColorApplied(int action, int colorIndex) {
    public void logColorApplied(int action, ColorOption colorOption) {
        // Do nothing.
    }