Merge "Remove custom updateState() if it's just setting summary"
This commit is contained in:
committed by
Android (Google) Code Review
commit
f5b8aedcf5
@@ -86,25 +86,25 @@ public class NotificationVibrationIntensityPreferenceControllerTest {
|
||||
public void updateState_shouldRefreshSummary() {
|
||||
Settings.System.putInt(mContext.getContentResolver(),
|
||||
NOTIFICATION_VIBRATION_INTENSITY, Vibrator.VIBRATION_INTENSITY_LOW);
|
||||
mController.updateState(null);
|
||||
mController.updateState(mPreference);
|
||||
assertThat(mPreference.getSummary())
|
||||
.isEqualTo(mContext.getString(R.string.accessibility_vibration_intensity_low));
|
||||
|
||||
Settings.System.putInt(mContext.getContentResolver(),
|
||||
NOTIFICATION_VIBRATION_INTENSITY, Vibrator.VIBRATION_INTENSITY_HIGH);
|
||||
mController.updateState(null);
|
||||
mController.updateState(mPreference);
|
||||
assertThat(mPreference.getSummary())
|
||||
.isEqualTo(mContext.getString(R.string.accessibility_vibration_intensity_high));
|
||||
|
||||
Settings.System.putInt(mContext.getContentResolver(),
|
||||
NOTIFICATION_VIBRATION_INTENSITY, Vibrator.VIBRATION_INTENSITY_MEDIUM);
|
||||
mController.updateState(null);
|
||||
mController.updateState(mPreference);
|
||||
assertThat(mPreference.getSummary())
|
||||
.isEqualTo(mContext.getString(R.string.accessibility_vibration_intensity_medium));
|
||||
|
||||
Settings.System.putInt(mContext.getContentResolver(),
|
||||
NOTIFICATION_VIBRATION_INTENSITY, Vibrator.VIBRATION_INTENSITY_OFF);
|
||||
mController.updateState(null);
|
||||
mController.updateState(mPreference);
|
||||
assertThat(mPreference.getSummary())
|
||||
.isEqualTo(mContext.getString(R.string.accessibility_vibration_intensity_off));
|
||||
}
|
||||
|
@@ -19,6 +19,8 @@ package com.android.settings.dashboard;
|
||||
import android.app.Fragment;
|
||||
import android.content.Context;
|
||||
|
||||
import com.android.settings.core.BasePreferenceController;
|
||||
import com.android.settings.core.PreferenceControllerListHelper;
|
||||
import com.android.settings.search.DatabaseIndexingUtils;
|
||||
import com.android.settings.search.Indexable;
|
||||
import com.android.settingslib.core.AbstractPreferenceController;
|
||||
@@ -58,6 +60,14 @@ public class DashboardFragmentSearchIndexProviderInspector {
|
||||
try {
|
||||
controllersFromFragment =
|
||||
((DashboardFragment) fragment).createPreferenceControllers(context);
|
||||
List<BasePreferenceController> controllersFromXml = PreferenceControllerListHelper
|
||||
.getPreferenceControllersFromXml(context,
|
||||
((DashboardFragment) fragment).getPreferenceScreenResId());
|
||||
final List<BasePreferenceController> uniqueControllerFromXml =
|
||||
PreferenceControllerListHelper.filterControllers(
|
||||
controllersFromXml, controllersFromFragment);
|
||||
controllersFromFragment.addAll(uniqueControllerFromXml);
|
||||
|
||||
} catch (Throwable e) {
|
||||
// Can't do much with exception, assume the test passed.
|
||||
return true;
|
||||
|
Reference in New Issue
Block a user