Merge "Fix a crash when resuming sound setting with AfW on Ryu"
This commit is contained in:
@@ -134,7 +134,6 @@ public class WorkSoundPreferenceControllerTest {
|
||||
mController.displayPreference(mScreen);
|
||||
verify(mWorkCategory).setVisible(false);
|
||||
|
||||
|
||||
// However, when a managed profile is added later, the category should appear.
|
||||
mController.onResume();
|
||||
when(mAudioHelper.getManagedProfileId(any(UserManager.class)))
|
||||
@@ -203,6 +202,27 @@ public class WorkSoundPreferenceControllerTest {
|
||||
verify(preference).setSummary(anyString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onResume_noVoiceCapability_shouldHidePhoneRingtone() {
|
||||
when(mTelephonyManager.isVoiceCapable()).thenReturn(false);
|
||||
mController = new WorkSoundPreferenceController(mContext, mFragment, null, mAudioHelper);
|
||||
|
||||
when(mAudioHelper.getManagedProfileId(any(UserManager.class)))
|
||||
.thenReturn(UserHandle.myUserId());
|
||||
when(mAudioHelper.isUserUnlocked(any(UserManager.class), anyInt())).thenReturn(true);
|
||||
when(mAudioHelper.isSingleVolume()).thenReturn(false);
|
||||
when(mFragment.getPreferenceScreen()).thenReturn(mScreen);
|
||||
when(mAudioHelper.createPackageContextAsUser(anyInt())).thenReturn(mContext);
|
||||
|
||||
// Precondition: work profile is available.
|
||||
assertThat(mController.isAvailable()).isTrue();
|
||||
|
||||
mController.displayPreference(mScreen);
|
||||
mController.onResume();
|
||||
|
||||
verify(mWorkCategory.findPreference(KEY_WORK_PHONE_RINGTONE)).setVisible(false);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onResume_availableButLocked_shouldRedactPreferences() {
|
||||
final String notAvailable = "(not available)";
|
||||
|
@@ -56,7 +56,7 @@ public class XmlParserUtilTest {
|
||||
|
||||
@Test
|
||||
public void testDataTitleValid_ReturnsPreferenceTitle() {
|
||||
XmlResourceParser parser = getChildByType(R.xml.ia_display_settings,
|
||||
XmlResourceParser parser = getChildByType(R.xml.display_settings,
|
||||
"com.android.settings.TimeoutListPreference");
|
||||
final AttributeSet attrs = Xml.asAttributeSet(parser);
|
||||
String title = XmlParserUtils.getDataTitle(mContext, attrs);
|
||||
@@ -66,7 +66,7 @@ public class XmlParserUtilTest {
|
||||
|
||||
@Test
|
||||
public void testDataKeywordsValid_ReturnsPreferenceKeywords() {
|
||||
XmlResourceParser parser = getParentPrimedParser(R.xml.ia_display_settings);
|
||||
XmlResourceParser parser = getParentPrimedParser(R.xml.display_settings);
|
||||
final AttributeSet attrs = Xml.asAttributeSet(parser);
|
||||
String keywords = XmlParserUtils.getDataKeywords(mContext, attrs);
|
||||
String expKeywords = mContext.getString(R.string.keywords_display);
|
||||
@@ -75,7 +75,7 @@ public class XmlParserUtilTest {
|
||||
|
||||
@Test
|
||||
public void testDataKeyValid_ReturnsPreferenceKey() {
|
||||
XmlResourceParser parser = getChildByType(R.xml.ia_display_settings,
|
||||
XmlResourceParser parser = getChildByType(R.xml.display_settings,
|
||||
"com.android.settings.TimeoutListPreference");
|
||||
final AttributeSet attrs = Xml.asAttributeSet(parser);
|
||||
String key = XmlParserUtils.getDataKey(mContext, attrs);
|
||||
@@ -85,7 +85,7 @@ public class XmlParserUtilTest {
|
||||
|
||||
@Test
|
||||
public void testDataSummaryValid_ReturnsPreferenceSummary() {
|
||||
XmlResourceParser parser = getChildByType(R.xml.ia_display_settings,
|
||||
XmlResourceParser parser = getChildByType(R.xml.display_settings,
|
||||
"com.android.settings.TimeoutListPreference");
|
||||
final AttributeSet attrs = Xml.asAttributeSet(parser);
|
||||
String summary = XmlParserUtils.getDataSummary(mContext, attrs);
|
||||
@@ -128,7 +128,7 @@ public class XmlParserUtilTest {
|
||||
|
||||
@Test
|
||||
public void testDataKeyInvalid_ReturnsNull() {
|
||||
XmlResourceParser parser = getParentPrimedParser(R.xml.ia_display_settings);
|
||||
XmlResourceParser parser = getParentPrimedParser(R.xml.display_settings);
|
||||
final AttributeSet attrs = Xml.asAttributeSet(parser);
|
||||
String key = XmlParserUtils.getDataKey(mContext, attrs);
|
||||
assertThat(key).isNull();
|
||||
@@ -136,7 +136,7 @@ public class XmlParserUtilTest {
|
||||
|
||||
@Test
|
||||
public void testDataSummaryInvalid_ReturnsNull() {
|
||||
XmlResourceParser parser = getParentPrimedParser(R.xml.ia_display_settings);
|
||||
XmlResourceParser parser = getParentPrimedParser(R.xml.display_settings);
|
||||
final AttributeSet attrs = Xml.asAttributeSet(parser);
|
||||
String summary = XmlParserUtils.getDataSummary(mContext, attrs);
|
||||
assertThat(summary).isNull();
|
||||
@@ -144,7 +144,7 @@ public class XmlParserUtilTest {
|
||||
|
||||
@Test
|
||||
public void testDataSummaryOffInvalid_ReturnsNull() {
|
||||
XmlResourceParser parser = getParentPrimedParser(R.xml.ia_display_settings);
|
||||
XmlResourceParser parser = getParentPrimedParser(R.xml.display_settings);
|
||||
final AttributeSet attrs = Xml.asAttributeSet(parser);
|
||||
String summaryOff = XmlParserUtils.getDataSummaryOff(mContext, attrs);
|
||||
assertThat(summaryOff).isNull();
|
||||
@@ -152,7 +152,7 @@ public class XmlParserUtilTest {
|
||||
|
||||
@Test
|
||||
public void testDataEntriesInvalid_ReturnsNull() {
|
||||
XmlResourceParser parser = getParentPrimedParser(R.xml.ia_display_settings);
|
||||
XmlResourceParser parser = getParentPrimedParser(R.xml.display_settings);
|
||||
final AttributeSet attrs = Xml.asAttributeSet(parser);
|
||||
String entries = XmlParserUtils.getDataEntries(mContext, attrs);
|
||||
assertThat(entries).isNull();
|
||||
|
@@ -49,7 +49,6 @@ import org.mockito.Mock;
|
||||
import org.mockito.MockitoAnnotations;
|
||||
import org.robolectric.RuntimeEnvironment;
|
||||
import org.robolectric.annotation.Config;
|
||||
import org.robolectric.shadows.ShadowApplication;
|
||||
import org.robolectric.shadows.ShadowContentResolver;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -248,7 +247,7 @@ public class DatabaseIndexingManagerTest {
|
||||
|
||||
@Test
|
||||
public void testAddResource_RowsInserted() {
|
||||
SearchIndexableResource resource = getFakeResource(R.xml.ia_display_settings);
|
||||
SearchIndexableResource resource = getFakeResource(R.xml.display_settings);
|
||||
mManager.indexOneSearchIndexableData(mDb, localeStr, resource, new HashMap<>());
|
||||
Cursor cursor = mDb.rawQuery("SELECT * FROM prefs_index", null);
|
||||
assertThat(cursor.getCount()).isEqualTo(16);
|
||||
@@ -256,7 +255,7 @@ public class DatabaseIndexingManagerTest {
|
||||
|
||||
@Test
|
||||
public void testAddResource_withNIKs_rowsInsertedDisabled() {
|
||||
SearchIndexableResource resource = getFakeResource(R.xml.ia_display_settings);
|
||||
SearchIndexableResource resource = getFakeResource(R.xml.display_settings);
|
||||
// Only add 2 of 16 items to be disabled.
|
||||
String[] keys = {"brightness", "wallpaper"};
|
||||
Map<String, Set<String>> niks = getNonIndexableKeys(keys);
|
||||
|
Reference in New Issue
Block a user