Merge "[Regional Preference] Need to remove the metrics by the metrics concil team's comment." into udc-qpr-dev
This commit is contained in:
@@ -204,8 +204,6 @@ public class LocaleDialogFragment extends InstrumentedDialogFragment {
|
||||
bundle.putInt(ARG_DIALOG_TYPE, DIALOG_CONFIRM_SYSTEM_DEFAULT);
|
||||
intent.putExtras(bundle);
|
||||
mParent.onActivityResult(DIALOG_CONFIRM_SYSTEM_DEFAULT, result, intent);
|
||||
mMetricsFeatureProvider.action(mContext, SettingsEnums.ACTION_CHANGE_LANGUAGE,
|
||||
changed);
|
||||
}
|
||||
mShouldKeepDialog = false;
|
||||
}
|
||||
|
@@ -16,7 +16,6 @@
|
||||
|
||||
package com.android.settings.localepicker;
|
||||
|
||||
import android.app.settings.SettingsEnums;
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
import android.os.Bundle;
|
||||
@@ -39,7 +38,6 @@ import androidx.recyclerview.widget.RecyclerView;
|
||||
import com.android.internal.app.LocalePicker;
|
||||
import com.android.internal.app.LocaleStore;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.overlay.FeatureFactory;
|
||||
import com.android.settings.shortcut.ShortcutsUpdateTask;
|
||||
|
||||
import java.text.NumberFormat;
|
||||
@@ -53,7 +51,6 @@ class LocaleDragAndDropAdapter
|
||||
private static final String TAG = "LocaleDragAndDropAdapter";
|
||||
private static final String CFGKEY_SELECTED_LOCALES = "selectedLocales";
|
||||
private static final String CFGKEY_DRAG_LOCALE = "dragLocales";
|
||||
private static final String CFGKEY_DRAG_LOCALES_TO_POSITION = "dragLocales_end";
|
||||
|
||||
private final Context mContext;
|
||||
private final ItemTouchHelper mItemTouchHelper;
|
||||
@@ -61,7 +58,6 @@ class LocaleDragAndDropAdapter
|
||||
private List<LocaleStore.LocaleInfo> mFeedItemList;
|
||||
private List<LocaleStore.LocaleInfo> mCacheItemList;
|
||||
private RecyclerView mParentView = null;
|
||||
private LocaleListEditor mParent;
|
||||
private boolean mRemoveMode = false;
|
||||
private boolean mDragEnabled = true;
|
||||
private NumberFormat mNumberFormatter = NumberFormat.getNumberInstance();
|
||||
@@ -94,7 +90,6 @@ class LocaleDragAndDropAdapter
|
||||
|
||||
LocaleDragAndDropAdapter(LocaleListEditor parent, List<LocaleStore.LocaleInfo> feedItemList) {
|
||||
mFeedItemList = feedItemList;
|
||||
mParent = parent;
|
||||
mCacheItemList = new ArrayList<>(feedItemList);
|
||||
mContext = parent.getContext();
|
||||
|
||||
@@ -230,12 +225,6 @@ class LocaleDragAndDropAdapter
|
||||
"Negative position in onItemMove %d -> %d", fromPosition, toPosition));
|
||||
}
|
||||
|
||||
if (fromPosition != toPosition) {
|
||||
FeatureFactory.getFactory(mContext).getMetricsFeatureProvider()
|
||||
.action(mContext, SettingsEnums.ACTION_REORDER_LANGUAGE,
|
||||
mDragLocale.getLocale().toLanguageTag() + " move to " + toPosition);
|
||||
}
|
||||
|
||||
notifyItemChanged(fromPosition); // to update the numbers
|
||||
notifyItemChanged(toPosition);
|
||||
notifyItemMoved(fromPosition, toPosition);
|
||||
@@ -274,9 +263,6 @@ class LocaleDragAndDropAdapter
|
||||
for (int i = itemCount - 1; i >= 0; i--) {
|
||||
localeInfo = mFeedItemList.get(i);
|
||||
if (localeInfo.getChecked()) {
|
||||
FeatureFactory.getFactory(mContext).getMetricsFeatureProvider()
|
||||
.action(mContext, SettingsEnums.ACTION_REMOVE_LANGUAGE,
|
||||
localeInfo.getLocale().toLanguageTag());
|
||||
mFeedItemList.remove(i);
|
||||
}
|
||||
}
|
||||
|
@@ -16,7 +16,6 @@
|
||||
|
||||
package com.android.settings.localepicker;
|
||||
|
||||
import android.app.settings.SettingsEnums;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.util.Log;
|
||||
@@ -25,10 +24,8 @@ import androidx.annotation.VisibleForTesting;
|
||||
import androidx.preference.PreferenceScreen;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.overlay.FeatureFactory;
|
||||
import com.android.settingslib.HelpUtils;
|
||||
import com.android.settingslib.core.AbstractPreferenceController;
|
||||
import com.android.settingslib.core.instrumentation.MetricsFeatureProvider;
|
||||
import com.android.settingslib.widget.FooterPreference;
|
||||
|
||||
/**
|
||||
@@ -39,11 +36,8 @@ public class LocaleHelperPreferenceController extends AbstractPreferenceControll
|
||||
|
||||
private static final String KEY_FOOTER_LANGUAGE_PICKER = "footer_languages_picker";
|
||||
|
||||
private final MetricsFeatureProvider mMetricsFeatureProvider;
|
||||
|
||||
public LocaleHelperPreferenceController(Context context) {
|
||||
super(context);
|
||||
mMetricsFeatureProvider = FeatureFactory.getFactory(context).getMetricsFeatureProvider();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -78,7 +72,6 @@ public class LocaleHelperPreferenceController extends AbstractPreferenceControll
|
||||
mContext.getString(R.string.link_locale_picker_footer_learn_more),
|
||||
mContext.getClass().getName());
|
||||
if (intent != null) {
|
||||
mMetricsFeatureProvider.action(mContext, SettingsEnums.ACTION_LANGUAGES_LEARN_MORE);
|
||||
mContext.startActivity(intent);
|
||||
} else {
|
||||
Log.w(TAG, "HelpIntent is null");
|
||||
|
@@ -202,8 +202,6 @@ public class LocaleListEditor extends RestrictedSettingsFragment implements View
|
||||
localeInfo = mayAppendUnicodeTags(localeInfo, preferencesTags);
|
||||
mAdapter.addLocale(localeInfo);
|
||||
updateVisibilityOfRemoveMenu();
|
||||
mMetricsFeatureProvider.action(getContext(), SettingsEnums.ACTION_ADD_LANGUAGE,
|
||||
localeInfo.getLocale().toLanguageTag());
|
||||
} else if (requestCode == DIALOG_CONFIRM_SYSTEM_DEFAULT) {
|
||||
localeInfo = mAdapter.getFeedItemList().get(0);
|
||||
if (resultCode == Activity.RESULT_OK) {
|
||||
|
@@ -16,7 +16,6 @@
|
||||
|
||||
package com.android.settings.regionalpreferences;
|
||||
|
||||
import android.app.settings.SettingsEnums;
|
||||
import android.content.Context;
|
||||
|
||||
import com.android.settings.R;
|
||||
@@ -58,9 +57,4 @@ public class FirstDayOfWeekItemListController extends
|
||||
protected String[] getUnitValues() {
|
||||
return mContext.getResources().getStringArray(R.array.first_day_of_week);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getMetricsActionKey() {
|
||||
return SettingsEnums.ACTION_SET_FIRST_DAY_OF_WEEK;
|
||||
}
|
||||
}
|
||||
|
@@ -152,8 +152,6 @@ public class NumberingSystemItemController extends BasePreferenceController {
|
||||
|
||||
private void handleLanguageSelect(Preference preference) {
|
||||
String selectedLanguage = preference.getKey();
|
||||
mMetricsFeatureProvider.action(mContext,
|
||||
SettingsEnums.ACTION_CHOOSE_LANGUAGE_FOR_NUMBERS_PREFERENCES, selectedLanguage);
|
||||
final Bundle extra = new Bundle();
|
||||
extra.putString(RegionalPreferencesEntriesFragment.ARG_KEY_REGIONAL_PREFERENCE,
|
||||
ARG_VALUE_NUMBERING_SYSTEM_SELECT);
|
||||
@@ -176,9 +174,6 @@ public class NumberingSystemItemController extends BasePreferenceController {
|
||||
Locale updatedLocale =
|
||||
saveNumberingSystemToLocale(Locale.forLanguageTag(mSelectedLanguage),
|
||||
numberingSystem);
|
||||
mMetricsFeatureProvider.action(mContext,
|
||||
SettingsEnums.ACTION_SET_NUMBERS_PREFERENCES,
|
||||
updatedLocale.getDisplayName() + ": " + numberingSystem);
|
||||
// After updated locale to framework, this fragment will recreate,
|
||||
// so it needs to update the argument of selected language.
|
||||
Bundle bundle = new Bundle();
|
||||
|
@@ -16,7 +16,6 @@
|
||||
|
||||
package com.android.settings.regionalpreferences;
|
||||
|
||||
import android.app.settings.SettingsEnums;
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
@@ -25,20 +24,16 @@ import androidx.preference.PreferenceCategory;
|
||||
import androidx.preference.PreferenceScreen;
|
||||
|
||||
import com.android.settings.core.BasePreferenceController;
|
||||
import com.android.settings.overlay.FeatureFactory;
|
||||
import com.android.settings.widget.TickButtonPreference;
|
||||
import com.android.settingslib.core.instrumentation.MetricsFeatureProvider;
|
||||
|
||||
/** A base controller for handling all regional preferences controllers. */
|
||||
public abstract class RegionalPreferenceListBasePreferenceController extends
|
||||
BasePreferenceController {
|
||||
|
||||
private final MetricsFeatureProvider mMetricsFeatureProvider;
|
||||
private PreferenceCategory mPreferenceCategory;
|
||||
|
||||
public RegionalPreferenceListBasePreferenceController(Context context, String preferenceKey) {
|
||||
super(context, preferenceKey);
|
||||
mMetricsFeatureProvider = FeatureFactory.getFactory(context).getMetricsFeatureProvider();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -68,8 +63,6 @@ public abstract class RegionalPreferenceListBasePreferenceController extends
|
||||
RegionalPreferencesDataUtils.savePreference(mContext, getExtensionTypes(),
|
||||
item.equals(RegionalPreferencesDataUtils.DEFAULT_VALUE)
|
||||
? null : item);
|
||||
mMetricsFeatureProvider.action(mContext, getMetricsActionKey(),
|
||||
getPreferenceTitle(value) + " > " + getPreferenceTitle(item));
|
||||
return true;
|
||||
});
|
||||
pref.setSelected(!value.isEmpty() && item.equals(value));
|
||||
@@ -99,8 +92,4 @@ public abstract class RegionalPreferenceListBasePreferenceController extends
|
||||
protected abstract String getExtensionTypes();
|
||||
|
||||
protected abstract String[] getUnitValues();
|
||||
|
||||
protected abstract int getMetricsActionKey();
|
||||
|
||||
|
||||
}
|
||||
|
@@ -16,7 +16,6 @@
|
||||
|
||||
package com.android.settings.regionalpreferences;
|
||||
|
||||
import android.app.settings.SettingsEnums;
|
||||
import android.content.Context;
|
||||
|
||||
import com.android.settings.R;
|
||||
@@ -56,9 +55,4 @@ public class TemperatureUnitListController extends RegionalPreferenceListBasePre
|
||||
protected String[] getUnitValues() {
|
||||
return mContext.getResources().getStringArray(R.array.temperature_units);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getMetricsActionKey() {
|
||||
return SettingsEnums.ACTION_SET_TEMPERATURE_UNIT;
|
||||
}
|
||||
}
|
||||
|
@@ -19,14 +19,12 @@ package com.android.settings.localepicker;
|
||||
import static org.mockito.Mockito.anyString;
|
||||
import static org.mockito.Mockito.verify;
|
||||
|
||||
import android.app.settings.SettingsEnums;
|
||||
import android.content.Context;
|
||||
import android.os.Looper;
|
||||
|
||||
import androidx.test.core.app.ApplicationProvider;
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
|
||||
import com.android.settings.testutils.FakeFeatureFactory;
|
||||
import com.android.settingslib.widget.FooterPreference;
|
||||
|
||||
import org.junit.Before;
|
||||
@@ -39,7 +37,6 @@ import org.mockito.MockitoAnnotations;
|
||||
public class LocaleHelperPreferenceControllerTest {
|
||||
private Context mContext;
|
||||
private LocaleHelperPreferenceController mLocaleHelperPreferenceController;
|
||||
private FakeFeatureFactory mFeatureFactory;
|
||||
|
||||
@Mock
|
||||
private FooterPreference mMockFooterPreference;
|
||||
@@ -52,16 +49,11 @@ public class LocaleHelperPreferenceControllerTest {
|
||||
}
|
||||
mContext = ApplicationProvider.getApplicationContext();
|
||||
mLocaleHelperPreferenceController = new LocaleHelperPreferenceController(mContext);
|
||||
mFeatureFactory = FakeFeatureFactory.setupForTest();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void updateFooterPreference_setFooterPreference_hasClickAction() {
|
||||
mLocaleHelperPreferenceController.updateFooterPreference(mMockFooterPreference);
|
||||
verify(mMockFooterPreference).setLearnMoreText(anyString());
|
||||
mMockFooterPreference.setLearnMoreAction(v -> {
|
||||
verify(mFeatureFactory.metricsFeatureProvider).action(
|
||||
mContext, SettingsEnums.ACTION_LANGUAGES_LEARN_MORE);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@@ -24,7 +24,6 @@ import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.Mockito.spy;
|
||||
import static org.mockito.Mockito.verify;
|
||||
|
||||
import android.app.settings.SettingsEnums;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.os.LocaleList;
|
||||
@@ -52,7 +51,6 @@ public class NumberingSystemItemControllerTest {
|
||||
private NumberingPreferencesFragment mFragment;
|
||||
private PreferenceScreen mPreferenceScreen;
|
||||
private LocaleList mCacheLocale;
|
||||
private FakeFeatureFactory mFeatureFactory;
|
||||
|
||||
@Before
|
||||
@UiThreadTest
|
||||
@@ -61,7 +59,6 @@ public class NumberingSystemItemControllerTest {
|
||||
Looper.prepare();
|
||||
}
|
||||
mApplicationContext = ApplicationProvider.getApplicationContext();
|
||||
mFeatureFactory = FakeFeatureFactory.setupForTest();
|
||||
mFragment = spy(new NumberingPreferencesFragment());
|
||||
PreferenceManager preferenceManager = new PreferenceManager(mApplicationContext);
|
||||
mPreferenceScreen = preferenceManager.createPreferenceScreen(mApplicationContext);
|
||||
@@ -97,10 +94,6 @@ public class NumberingSystemItemControllerTest {
|
||||
}
|
||||
|
||||
assertTrue(isCallingStartActivity);
|
||||
verify(mFeatureFactory.metricsFeatureProvider).action(
|
||||
mApplicationContext,
|
||||
SettingsEnums.ACTION_CHOOSE_LANGUAGE_FOR_NUMBERS_PREFERENCES,
|
||||
"I_am_the_key");
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -121,9 +114,6 @@ public class NumberingSystemItemControllerTest {
|
||||
mController.handlePreferenceTreeClick(preference);
|
||||
|
||||
verify(mFragment).setArguments(any());
|
||||
verify(mFeatureFactory.metricsFeatureProvider).action(
|
||||
mApplicationContext, SettingsEnums.ACTION_SET_NUMBERS_PREFERENCES,
|
||||
"test_key");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
Reference in New Issue
Block a user