[Settings] UI part: Add metrics for language
Bug: 279915462 Test: atest Change-Id: Ie13c57b2b398beb48dfe0ac289ec336483575445
This commit is contained in:
@@ -37,6 +37,8 @@ import com.android.internal.app.LocaleStore;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.RestrictedSettingsFragment;
|
||||
import com.android.settings.core.instrumentation.InstrumentedDialogFragment;
|
||||
import com.android.settings.overlay.FeatureFactory;
|
||||
import com.android.settingslib.core.instrumentation.MetricsFeatureProvider;
|
||||
|
||||
/**
|
||||
* Create a dialog for system locale events.
|
||||
@@ -143,6 +145,7 @@ public class LocaleDialogFragment extends InstrumentedDialogFragment {
|
||||
private final int mDialogType;
|
||||
private final LocaleStore.LocaleInfo mLocaleInfo;
|
||||
private final ResultReceiver mResultReceiver;
|
||||
private final MetricsFeatureProvider mMetricsFeatureProvider;
|
||||
|
||||
LocaleDialogController(
|
||||
@NonNull Context context, @NonNull LocaleDialogFragment dialogFragment) {
|
||||
@@ -152,6 +155,8 @@ public class LocaleDialogFragment extends InstrumentedDialogFragment {
|
||||
mLocaleInfo = (LocaleStore.LocaleInfo) arguments.getSerializable(
|
||||
ARG_TARGET_LOCALE);
|
||||
mResultReceiver = (ResultReceiver) arguments.getParcelable(ARG_RESULT_RECEIVER);
|
||||
mMetricsFeatureProvider = FeatureFactory.getFactory(
|
||||
mContext).getMetricsFeatureProvider();
|
||||
}
|
||||
|
||||
LocaleDialogController(@NonNull LocaleDialogFragment dialogFragment) {
|
||||
@@ -163,11 +168,15 @@ public class LocaleDialogFragment extends InstrumentedDialogFragment {
|
||||
if (mResultReceiver != null && mDialogType == DIALOG_CONFIRM_SYSTEM_DEFAULT) {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putInt(ARG_DIALOG_TYPE, DIALOG_CONFIRM_SYSTEM_DEFAULT);
|
||||
boolean changed = false;
|
||||
if (which == DialogInterface.BUTTON_POSITIVE) {
|
||||
changed = true;
|
||||
mResultReceiver.send(Activity.RESULT_OK, bundle);
|
||||
} else if (which == DialogInterface.BUTTON_NEGATIVE) {
|
||||
mResultReceiver.send(Activity.RESULT_CANCELED, bundle);
|
||||
}
|
||||
mMetricsFeatureProvider.action(mContext,
|
||||
SettingsEnums.ACTION_CHANGE_LANGUAGE, changed);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user