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
This commit is contained in:
Fan Zhang
2016-08-24 17:03:11 -07:00
parent 9fa5947b08
commit ae2a00fc5a
2 changed files with 36 additions and 3 deletions

View File

@@ -0,0 +1,27 @@
/*
* 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()));
}
}

View File

@@ -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.
*/