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

Commit ae2a00fc authored by Fan Zhang's avatar Fan Zhang
Browse files

Log support disclaimer dialog visibility change.

Bug: 30681529
Test: RunSettingsRoboTests

Added InstrumentedDialogFragment, and use it to observe visiblity
changes in support disclaimer fragment.

Change-Id: I9f851c4769f8d59e791986fffc145d014ffde3a3
parent 9fa5947b
Loading
Loading
Loading
Loading
+27 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2016 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.settings.core.instrumentation;

import com.android.settings.core.lifecycle.ObservableDialogFragment;

public abstract class InstrumentedDialogFragment extends ObservableDialogFragment
        implements Instrumentable {

    public InstrumentedDialogFragment() {
        mLifecycle.addObserver(new VisibilityLoggerMixin(getMetricsCategory()));
    }

}
+9 −3
Original line number Diff line number Diff line
@@ -35,14 +35,15 @@ import android.widget.TextView;
import com.android.internal.logging.MetricsLogger;
import com.android.internal.logging.MetricsProto;
import com.android.settings.R;
import com.android.settings.core.instrumentation.InstrumentedDialogFragment;
import com.android.settings.overlay.FeatureFactory;
import com.android.settings.overlay.SupportFeatureProvider;

/**
 * {@link DialogFragment} for support disclaimer.
 */
public final class SupportDisclaimerDialogFragment extends DialogFragment implements
        DialogInterface.OnClickListener {
public final class SupportDisclaimerDialogFragment extends InstrumentedDialogFragment
        implements DialogInterface.OnClickListener {

    public static final String TAG = "SupportDisclaimerDialog";
    private static final String EXTRA_TYPE = "extra_type";
@@ -90,7 +91,7 @@ public final class SupportDisclaimerDialogFragment extends DialogFragment implem
        final Bundle bundle = getArguments();
        MetricsLogger.action(activity, MetricsProto.MetricsEvent.ACTION_SUPPORT_DISCLAIMER_OK);
        supportFeatureProvider.startSupport(getActivity(),
                (Account) bundle.getParcelable(EXTRA_ACCOUNT), bundle.getInt(EXTRA_TYPE));
                bundle.getParcelable(EXTRA_ACCOUNT), bundle.getInt(EXTRA_TYPE));
    }

    @Override
@@ -115,6 +116,11 @@ public final class SupportDisclaimerDialogFragment extends DialogFragment implem
        }
    }

    @Override
    public int getMetricsCategory() {
        return MetricsProto.MetricsEvent.DIALOG_SUPPORT_DISCLAIMER;
    }

    /**
     * A {@link URLSpan} that doesn't decorate the link with underline.
     */