Merge "Migrate QS_EDIT metrics to WW" into rvc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
8014ffec99
@@ -37,8 +37,8 @@ import androidx.recyclerview.widget.DefaultItemAnimator;
|
|||||||
import androidx.recyclerview.widget.GridLayoutManager;
|
import androidx.recyclerview.widget.GridLayoutManager;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
import com.android.internal.logging.MetricsLogger;
|
import com.android.internal.logging.UiEventLogger;
|
||||||
import com.android.internal.logging.nano.MetricsProto;
|
import com.android.internal.logging.UiEventLoggerImpl;
|
||||||
import com.android.systemui.R;
|
import com.android.systemui.R;
|
||||||
import com.android.systemui.keyguard.ScreenLifecycle;
|
import com.android.systemui.keyguard.ScreenLifecycle;
|
||||||
import com.android.systemui.plugins.qs.QS;
|
import com.android.systemui.plugins.qs.QS;
|
||||||
@@ -86,6 +86,7 @@ public class QSCustomizer extends LinearLayout implements OnMenuItemClickListene
|
|||||||
private int mY;
|
private int mY;
|
||||||
private boolean mOpening;
|
private boolean mOpening;
|
||||||
private boolean mIsShowingNavBackdrop;
|
private boolean mIsShowingNavBackdrop;
|
||||||
|
private UiEventLogger mUiEventLogger = new UiEventLoggerImpl();
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public QSCustomizer(Context context, AttributeSet attrs,
|
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();
|
int containerLocation[] = findViewById(R.id.customize_container).getLocationOnScreen();
|
||||||
mX = x - containerLocation[0];
|
mX = x - containerLocation[0];
|
||||||
mY = y - containerLocation[1];
|
mY = y - containerLocation[1];
|
||||||
MetricsLogger.visible(getContext(), MetricsProto.MetricsEvent.QS_EDIT);
|
mUiEventLogger.log(QSEditEvent.QS_EDIT_OPEN);
|
||||||
isShown = true;
|
isShown = true;
|
||||||
mOpening = true;
|
mOpening = true;
|
||||||
setTileSpecs();
|
setTileSpecs();
|
||||||
@@ -224,7 +225,7 @@ public class QSCustomizer extends LinearLayout implements OnMenuItemClickListene
|
|||||||
public void hide() {
|
public void hide() {
|
||||||
final boolean animate = mScreenLifecycle.getScreenState() != ScreenLifecycle.SCREEN_OFF;
|
final boolean animate = mScreenLifecycle.getScreenState() != ScreenLifecycle.SCREEN_OFF;
|
||||||
if (isShown) {
|
if (isShown) {
|
||||||
MetricsLogger.hidden(getContext(), MetricsProto.MetricsEvent.QS_EDIT);
|
mUiEventLogger.log(QSEditEvent.QS_EDIT_CLOSED);
|
||||||
isShown = false;
|
isShown = false;
|
||||||
mToolbar.dismissPopupMenus();
|
mToolbar.dismissPopupMenus();
|
||||||
setCustomizing(false);
|
setCustomizing(false);
|
||||||
@@ -258,7 +259,7 @@ public class QSCustomizer extends LinearLayout implements OnMenuItemClickListene
|
|||||||
public boolean onMenuItemClick(MenuItem item) {
|
public boolean onMenuItemClick(MenuItem item) {
|
||||||
switch (item.getItemId()) {
|
switch (item.getItemId()) {
|
||||||
case MENU_RESET:
|
case MENU_RESET:
|
||||||
MetricsLogger.action(getContext(), MetricsProto.MetricsEvent.ACTION_QS_EDIT_RESET);
|
mUiEventLogger.log(QSEditEvent.QS_EDIT_RESET);
|
||||||
reset();
|
reset();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,38 @@
|
|||||||
|
/*
|
||||||
|
* 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
|
||||||
|
}
|
||||||
@@ -40,8 +40,8 @@ import androidx.recyclerview.widget.RecyclerView.ItemDecoration;
|
|||||||
import androidx.recyclerview.widget.RecyclerView.State;
|
import androidx.recyclerview.widget.RecyclerView.State;
|
||||||
import androidx.recyclerview.widget.RecyclerView.ViewHolder;
|
import androidx.recyclerview.widget.RecyclerView.ViewHolder;
|
||||||
|
|
||||||
import com.android.internal.logging.MetricsLogger;
|
import com.android.internal.logging.UiEventLogger;
|
||||||
import com.android.internal.logging.nano.MetricsProto;
|
import com.android.internal.logging.UiEventLoggerImpl;
|
||||||
import com.android.systemui.R;
|
import com.android.systemui.R;
|
||||||
import com.android.systemui.qs.QSTileHost;
|
import com.android.systemui.qs.QSTileHost;
|
||||||
import com.android.systemui.qs.customize.TileAdapter.Holder;
|
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 int mAccessibilityFromIndex;
|
||||||
private CharSequence mAccessibilityFromLabel;
|
private CharSequence mAccessibilityFromLabel;
|
||||||
private QSTileHost mHost;
|
private QSTileHost mHost;
|
||||||
|
private UiEventLogger mUiEventLogger = new UiEventLoggerImpl();
|
||||||
|
|
||||||
public TileAdapter(Context context) {
|
public TileAdapter(Context context) {
|
||||||
mContext = context;
|
mContext = context;
|
||||||
@@ -436,20 +437,11 @@ public class TileAdapter extends RecyclerView.Adapter<Holder> implements TileSta
|
|||||||
move(from, to, mTiles);
|
move(from, to, mTiles);
|
||||||
updateDividerLocations();
|
updateDividerLocations();
|
||||||
if (to >= mEditIndex) {
|
if (to >= mEditIndex) {
|
||||||
MetricsLogger.action(mContext, MetricsProto.MetricsEvent.ACTION_QS_EDIT_REMOVE_SPEC,
|
mUiEventLogger.log(QSEditEvent.QS_EDIT_REMOVE, 0, strip(mTiles.get(to)));
|
||||||
strip(mTiles.get(to)));
|
|
||||||
MetricsLogger.action(mContext, MetricsProto.MetricsEvent.ACTION_QS_EDIT_REMOVE,
|
|
||||||
from);
|
|
||||||
} else if (from >= mEditIndex) {
|
} else if (from >= mEditIndex) {
|
||||||
MetricsLogger.action(mContext, MetricsProto.MetricsEvent.ACTION_QS_EDIT_ADD_SPEC,
|
mUiEventLogger.log(QSEditEvent.QS_EDIT_ADD, 0, strip(mTiles.get(to)));
|
||||||
strip(mTiles.get(to)));
|
|
||||||
MetricsLogger.action(mContext, MetricsProto.MetricsEvent.ACTION_QS_EDIT_ADD,
|
|
||||||
to);
|
|
||||||
} else {
|
} else {
|
||||||
MetricsLogger.action(mContext, MetricsProto.MetricsEvent.ACTION_QS_EDIT_MOVE_SPEC,
|
mUiEventLogger.log(QSEditEvent.QS_EDIT_MOVE, 0, strip(mTiles.get(to)));
|
||||||
strip(mTiles.get(to)));
|
|
||||||
MetricsLogger.action(mContext, MetricsProto.MetricsEvent.ACTION_QS_EDIT_MOVE,
|
|
||||||
to);
|
|
||||||
}
|
}
|
||||||
saveSpecs(mHost);
|
saveSpecs(mHost);
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Reference in New Issue
Block a user