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

Commit bb43993f authored by Automerger Merge Worker's avatar Automerger Merge Worker
Browse files

Merge "Migrate QS_EDIT metrics to WW" into rvc-dev am: 8014ffec

Change-Id: I55c7876483f3ab6c57287ffd1dee9248adf49a39
parents 84006164 8014ffec
Loading
Loading
Loading
Loading
+6 −5
Original line number Diff line number Diff line
@@ -37,8 +37,8 @@ import androidx.recyclerview.widget.DefaultItemAnimator;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.android.internal.logging.MetricsLogger;
import com.android.internal.logging.nano.MetricsProto;
import com.android.internal.logging.UiEventLogger;
import com.android.internal.logging.UiEventLoggerImpl;
import com.android.systemui.R;
import com.android.systemui.keyguard.ScreenLifecycle;
import com.android.systemui.plugins.qs.QS;
@@ -86,6 +86,7 @@ public class QSCustomizer extends LinearLayout implements OnMenuItemClickListene
    private int mY;
    private boolean mOpening;
    private boolean mIsShowingNavBackdrop;
    private UiEventLogger mUiEventLogger = new UiEventLoggerImpl();

    @Inject
    public QSCustomizer(Context context, AttributeSet attrs,
@@ -187,7 +188,7 @@ public class QSCustomizer extends LinearLayout implements OnMenuItemClickListene
            int containerLocation[] = findViewById(R.id.customize_container).getLocationOnScreen();
            mX = x - containerLocation[0];
            mY = y - containerLocation[1];
            MetricsLogger.visible(getContext(), MetricsProto.MetricsEvent.QS_EDIT);
            mUiEventLogger.log(QSEditEvent.QS_EDIT_OPEN);
            isShown = true;
            mOpening = true;
            setTileSpecs();
@@ -224,7 +225,7 @@ public class QSCustomizer extends LinearLayout implements OnMenuItemClickListene
    public void hide() {
        final boolean animate = mScreenLifecycle.getScreenState() != ScreenLifecycle.SCREEN_OFF;
        if (isShown) {
            MetricsLogger.hidden(getContext(), MetricsProto.MetricsEvent.QS_EDIT);
            mUiEventLogger.log(QSEditEvent.QS_EDIT_CLOSED);
            isShown = false;
            mToolbar.dismissPopupMenus();
            setCustomizing(false);
@@ -258,7 +259,7 @@ public class QSCustomizer extends LinearLayout implements OnMenuItemClickListene
    public boolean onMenuItemClick(MenuItem item) {
        switch (item.getItemId()) {
            case MENU_RESET:
                MetricsLogger.action(getContext(), MetricsProto.MetricsEvent.ACTION_QS_EDIT_RESET);
                mUiEventLogger.log(QSEditEvent.QS_EDIT_RESET);
                reset();
                break;
        }
+38 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2020 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.systemui.qs.customize

import com.android.internal.logging.UiEvent
import com.android.internal.logging.UiEventLogger

enum class QSEditEvent(private val _id: Int) : UiEventLogger.UiEventEnum {

    @UiEvent(doc = "Tile removed from current tiles")
    QS_EDIT_REMOVE(210),
    @UiEvent(doc = "Tile added to current tiles")
    QS_EDIT_ADD(211),
    @UiEvent(doc = "Tile moved")
    QS_EDIT_MOVE(212),
    @UiEvent(doc = "QS customizer open")
    QS_EDIT_OPEN(213),
    @UiEvent(doc = "QS customizer closed")
    QS_EDIT_CLOSED(214),
    @UiEvent(doc = "QS tiles reset")
    QS_EDIT_RESET(215);

    override fun getId() = _id
}
 No newline at end of file
+6 −14
Original line number Diff line number Diff line
@@ -40,8 +40,8 @@ import androidx.recyclerview.widget.RecyclerView.ItemDecoration;
import androidx.recyclerview.widget.RecyclerView.State;
import androidx.recyclerview.widget.RecyclerView.ViewHolder;

import com.android.internal.logging.MetricsLogger;
import com.android.internal.logging.nano.MetricsProto;
import com.android.internal.logging.UiEventLogger;
import com.android.internal.logging.UiEventLoggerImpl;
import com.android.systemui.R;
import com.android.systemui.qs.QSTileHost;
import com.android.systemui.qs.customize.TileAdapter.Holder;
@@ -92,6 +92,7 @@ public class TileAdapter extends RecyclerView.Adapter<Holder> implements TileSta
    private int mAccessibilityFromIndex;
    private CharSequence mAccessibilityFromLabel;
    private QSTileHost mHost;
    private UiEventLogger mUiEventLogger = new UiEventLoggerImpl();

    public TileAdapter(Context context) {
        mContext = context;
@@ -436,20 +437,11 @@ public class TileAdapter extends RecyclerView.Adapter<Holder> implements TileSta
        move(from, to, mTiles);
        updateDividerLocations();
        if (to >= mEditIndex) {
            MetricsLogger.action(mContext, MetricsProto.MetricsEvent.ACTION_QS_EDIT_REMOVE_SPEC,
                    strip(mTiles.get(to)));
            MetricsLogger.action(mContext, MetricsProto.MetricsEvent.ACTION_QS_EDIT_REMOVE,
                    from);
            mUiEventLogger.log(QSEditEvent.QS_EDIT_REMOVE, 0, strip(mTiles.get(to)));
        } else if (from >= mEditIndex) {
            MetricsLogger.action(mContext, MetricsProto.MetricsEvent.ACTION_QS_EDIT_ADD_SPEC,
                    strip(mTiles.get(to)));
            MetricsLogger.action(mContext, MetricsProto.MetricsEvent.ACTION_QS_EDIT_ADD,
                    to);
            mUiEventLogger.log(QSEditEvent.QS_EDIT_ADD, 0, strip(mTiles.get(to)));
        } else {
            MetricsLogger.action(mContext, MetricsProto.MetricsEvent.ACTION_QS_EDIT_MOVE_SPEC,
                    strip(mTiles.get(to)));
            MetricsLogger.action(mContext, MetricsProto.MetricsEvent.ACTION_QS_EDIT_MOVE,
                    to);
            mUiEventLogger.log(QSEditEvent.QS_EDIT_MOVE, 0, strip(mTiles.get(to)));
        }
        saveSpecs(mHost);
        return true;