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

Commit 4d1735f7 authored by Michael W's avatar Michael W
Browse files

LocationTile: Replace deprecated MetricsLogger calls

* The action(Context, int, boolean) call is deprecated and
  links to the non-static method action(int, boolean)
* To use that, we need an instance variable of MetricsLogger
* There are other tiles using the deprecated calls as well but
  those are maintained by aosp so hopfully updated by them at
  next source drop

Change-Id: I25358a9cf70c7a721c66ffe90d315a2ffcd2abcc
parent 36ac9b3a
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -60,12 +60,14 @@ public class LocationTile extends QSTileImpl<BooleanState> {
    private final KeyguardMonitor mKeyguard;
    private final Callback mCallback = new Callback();
    private int mLastState;
    private MetricsLogger mMetricsLogger;

    public LocationTile(QSHost host) {
        super(host);
        mController = Dependency.get(LocationController.class);
        mKeyguard = Dependency.get(KeyguardMonitor.class);
        mDetailAdapter = (LocationDetailAdapter) createDetailAdapter();
        mMetricsLogger = new MetricsLogger();
    }

    @Override
@@ -103,7 +105,7 @@ public class LocationTile extends QSTileImpl<BooleanState> {
    @Override
    protected void handleClick() {
        final boolean wasEnabled = mState.value;
        MetricsLogger.action(mContext, getMetricsCategory(), !wasEnabled);
        mMetricsLogger.action(getMetricsCategory(), !wasEnabled);
        mController.setLocationEnabled(!wasEnabled);
    }

@@ -250,7 +252,7 @@ public class LocationTile extends QSTileImpl<BooleanState> {

        @Override
        public void setToggleState(boolean state) {
            MetricsLogger.action(mContext, MetricsEvent.QS_DND_TOGGLE, state);
            mMetricsLogger.action(MetricsEvent.QS_DND_TOGGLE, state);
            if (!state) {
                mController.setLocationEnabled(state);
                showDetail(false);
@@ -316,7 +318,7 @@ public class LocationTile extends QSTileImpl<BooleanState> {
                if (value != null && mButtons.isShown()) {
                    mLastState = (Integer) value;
                    if (fromClick) {
                        MetricsLogger.action(mContext, MetricsEvent.QS_LOCATION, mLastState);
                        mMetricsLogger.action(MetricsEvent.QS_LOCATION, mLastState);
                        mController.setLocationMode(mLastState);
                        refresh(mLastState);
                    }