Move xmlParserUtils to core
This class is currently used by both search and slice, in the future will be used by DashboardFragment to build controller list. So the scope of this class is beyond search now. Test: rerun robotests Change-Id: If43ebca065aac31ad24f95a94bfe5be784109605
This commit is contained in:
@@ -12,10 +12,9 @@
|
|||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.android.settings.search;
|
package com.android.settings.core;
|
||||||
|
|
||||||
import android.annotation.Nullable;
|
import android.annotation.Nullable;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@@ -27,7 +26,7 @@ import com.android.settings.R;
|
|||||||
/**
|
/**
|
||||||
* Utility class to parse elements of XML preferences
|
* Utility class to parse elements of XML preferences
|
||||||
*/
|
*/
|
||||||
public class XmlParserUtils {
|
public class PreferenceXmlParserUtils {
|
||||||
|
|
||||||
private static final String ENTRIES_SEPARATOR = "|";
|
private static final String ENTRIES_SEPARATOR = "|";
|
||||||
|
|
@@ -29,6 +29,7 @@ import android.util.Xml;
|
|||||||
|
|
||||||
import com.android.settings.core.BasePreferenceController;
|
import com.android.settings.core.BasePreferenceController;
|
||||||
import com.android.settings.core.PreferenceControllerMixin;
|
import com.android.settings.core.PreferenceControllerMixin;
|
||||||
|
import com.android.settings.core.PreferenceXmlParserUtils;
|
||||||
import com.android.settingslib.core.AbstractPreferenceController;
|
import com.android.settingslib.core.AbstractPreferenceController;
|
||||||
|
|
||||||
import org.xmlpull.v1.XmlPullParser;
|
import org.xmlpull.v1.XmlPullParser;
|
||||||
@@ -119,7 +120,7 @@ public class BaseSearchIndexProvider implements Indexable.SearchIndexProvider {
|
|||||||
final AttributeSet attrs = Xml.asAttributeSet(parser);
|
final AttributeSet attrs = Xml.asAttributeSet(parser);
|
||||||
try {
|
try {
|
||||||
while (parser.next() != XmlPullParser.END_DOCUMENT) {
|
while (parser.next() != XmlPullParser.END_DOCUMENT) {
|
||||||
final String key = XmlParserUtils.getDataKey(context, attrs);
|
final String key = PreferenceXmlParserUtils.getDataKey(context, attrs);
|
||||||
if (!TextUtils.isEmpty(key)) {
|
if (!TextUtils.isEmpty(key)) {
|
||||||
nonIndexableKeys.add(key);
|
nonIndexableKeys.add(key);
|
||||||
}
|
}
|
||||||
|
@@ -29,11 +29,10 @@ import android.util.AttributeSet;
|
|||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.util.Xml;
|
import android.util.Xml;
|
||||||
|
|
||||||
import com.android.settings.core.PreferenceControllerMixin;
|
|
||||||
import com.android.settings.search.DatabaseIndexingUtils;
|
import com.android.settings.search.DatabaseIndexingUtils;
|
||||||
|
import com.android.settings.core.PreferenceXmlParserUtils;
|
||||||
import com.android.settings.search.ResultPayload;
|
import com.android.settings.search.ResultPayload;
|
||||||
import com.android.settings.search.SearchIndexableRaw;
|
import com.android.settings.search.SearchIndexableRaw;
|
||||||
import com.android.settings.search.XmlParserUtils;
|
|
||||||
|
|
||||||
import org.xmlpull.v1.XmlPullParser;
|
import org.xmlpull.v1.XmlPullParser;
|
||||||
import org.xmlpull.v1.XmlPullParserException;
|
import org.xmlpull.v1.XmlPullParserException;
|
||||||
@@ -161,8 +160,8 @@ public class IndexDataConverter {
|
|||||||
final int outerDepth = parser.getDepth();
|
final int outerDepth = parser.getDepth();
|
||||||
final AttributeSet attrs = Xml.asAttributeSet(parser);
|
final AttributeSet attrs = Xml.asAttributeSet(parser);
|
||||||
|
|
||||||
final String screenTitle = XmlParserUtils.getDataTitle(context, attrs);
|
final String screenTitle = PreferenceXmlParserUtils.getDataTitle(context, attrs);
|
||||||
String key = XmlParserUtils.getDataKey(context, attrs);
|
String key = PreferenceXmlParserUtils.getDataKey(context, attrs);
|
||||||
|
|
||||||
String title;
|
String title;
|
||||||
String headerTitle;
|
String headerTitle;
|
||||||
@@ -186,9 +185,9 @@ public class IndexDataConverter {
|
|||||||
.getPayloadKeyMap(fragmentName, context);
|
.getPayloadKeyMap(fragmentName, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
headerTitle = XmlParserUtils.getDataTitle(context, attrs);
|
headerTitle = PreferenceXmlParserUtils.getDataTitle(context, attrs);
|
||||||
headerSummary = XmlParserUtils.getDataSummary(context, attrs);
|
headerSummary = PreferenceXmlParserUtils.getDataSummary(context, attrs);
|
||||||
headerKeywords = XmlParserUtils.getDataKeywords(context, attrs);
|
headerKeywords = PreferenceXmlParserUtils.getDataKeywords(context, attrs);
|
||||||
enabled = !nonIndexableKeys.contains(key);
|
enabled = !nonIndexableKeys.contains(key);
|
||||||
|
|
||||||
// TODO: Set payload type for header results
|
// TODO: Set payload type for header results
|
||||||
@@ -217,11 +216,11 @@ public class IndexDataConverter {
|
|||||||
|
|
||||||
nodeName = parser.getName();
|
nodeName = parser.getName();
|
||||||
|
|
||||||
title = XmlParserUtils.getDataTitle(context, attrs);
|
title = PreferenceXmlParserUtils.getDataTitle(context, attrs);
|
||||||
key = XmlParserUtils.getDataKey(context, attrs);
|
key = PreferenceXmlParserUtils.getDataKey(context, attrs);
|
||||||
enabled = !nonIndexableKeys.contains(key);
|
enabled = !nonIndexableKeys.contains(key);
|
||||||
keywords = XmlParserUtils.getDataKeywords(context, attrs);
|
keywords = PreferenceXmlParserUtils.getDataKeywords(context, attrs);
|
||||||
iconResId = XmlParserUtils.getDataIcon(context, attrs);
|
iconResId = PreferenceXmlParserUtils.getDataIcon(context, attrs);
|
||||||
|
|
||||||
if (isHeaderUnique && TextUtils.equals(headerTitle, title)) {
|
if (isHeaderUnique && TextUtils.equals(headerTitle, title)) {
|
||||||
isHeaderUnique = false;
|
isHeaderUnique = false;
|
||||||
@@ -241,17 +240,17 @@ public class IndexDataConverter {
|
|||||||
.setUserId(-1 /* default user id */);
|
.setUserId(-1 /* default user id */);
|
||||||
|
|
||||||
if (!nodeName.equals(NODE_NAME_CHECK_BOX_PREFERENCE)) {
|
if (!nodeName.equals(NODE_NAME_CHECK_BOX_PREFERENCE)) {
|
||||||
summary = XmlParserUtils.getDataSummary(context, attrs);
|
summary = PreferenceXmlParserUtils.getDataSummary(context, attrs);
|
||||||
|
|
||||||
String entries = null;
|
String entries = null;
|
||||||
|
|
||||||
if (nodeName.endsWith(NODE_NAME_LIST_PREFERENCE)) {
|
if (nodeName.endsWith(NODE_NAME_LIST_PREFERENCE)) {
|
||||||
entries = XmlParserUtils.getDataEntries(context, attrs);
|
entries = PreferenceXmlParserUtils.getDataEntries(context, attrs);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO (b/62254931) index primitives instead of payload
|
// TODO (b/62254931) index primitives instead of payload
|
||||||
payload = controllerUriMap.get(key);
|
payload = controllerUriMap.get(key);
|
||||||
childFragment = XmlParserUtils.getDataChildFragment(context, attrs);
|
childFragment = PreferenceXmlParserUtils.getDataChildFragment(context, attrs);
|
||||||
|
|
||||||
builder.setSummaryOn(summary)
|
builder.setSummaryOn(summary)
|
||||||
.setEntries(entries)
|
.setEntries(entries)
|
||||||
@@ -263,11 +262,11 @@ public class IndexDataConverter {
|
|||||||
// TODO (b/33577327) We removed summary off here. We should check if we can
|
// TODO (b/33577327) We removed summary off here. We should check if we can
|
||||||
// merge this 'else' section with the one above. Put a break point to
|
// merge this 'else' section with the one above. Put a break point to
|
||||||
// investigate.
|
// investigate.
|
||||||
String summaryOn = XmlParserUtils.getDataSummaryOn(context, attrs);
|
String summaryOn = PreferenceXmlParserUtils.getDataSummaryOn(context, attrs);
|
||||||
String summaryOff = XmlParserUtils.getDataSummaryOff(context, attrs);
|
String summaryOff = PreferenceXmlParserUtils.getDataSummaryOff(context, attrs);
|
||||||
|
|
||||||
if (TextUtils.isEmpty(summaryOn) && TextUtils.isEmpty(summaryOff)) {
|
if (TextUtils.isEmpty(summaryOn) && TextUtils.isEmpty(summaryOff)) {
|
||||||
summaryOn = XmlParserUtils.getDataSummary(context, attrs);
|
summaryOn = PreferenceXmlParserUtils.getDataSummary(context, attrs);
|
||||||
}
|
}
|
||||||
|
|
||||||
builder.setSummaryOn(summaryOn);
|
builder.setSummaryOn(summaryOn);
|
||||||
|
@@ -30,7 +30,7 @@ import com.android.settings.dashboard.DashboardFragment;
|
|||||||
import com.android.settings.overlay.FeatureFactory;
|
import com.android.settings.overlay.FeatureFactory;
|
||||||
import com.android.settings.search.DatabaseIndexingUtils;
|
import com.android.settings.search.DatabaseIndexingUtils;
|
||||||
import com.android.settings.search.Indexable.SearchIndexProvider;
|
import com.android.settings.search.Indexable.SearchIndexProvider;
|
||||||
import com.android.settings.search.XmlParserUtils;
|
import com.android.settings.core.PreferenceXmlParserUtils;
|
||||||
|
|
||||||
import org.xmlpull.v1.XmlPullParser;
|
import org.xmlpull.v1.XmlPullParser;
|
||||||
import org.xmlpull.v1.XmlPullParserException;
|
import org.xmlpull.v1.XmlPullParserException;
|
||||||
@@ -151,7 +151,7 @@ class SliceDataConverter {
|
|||||||
|
|
||||||
final int outerDepth = parser.getDepth();
|
final int outerDepth = parser.getDepth();
|
||||||
final AttributeSet attrs = Xml.asAttributeSet(parser);
|
final AttributeSet attrs = Xml.asAttributeSet(parser);
|
||||||
final String screenTitle = XmlParserUtils.getDataTitle(mContext, attrs);
|
final String screenTitle = PreferenceXmlParserUtils.getDataTitle(mContext, attrs);
|
||||||
|
|
||||||
// TODO (b/67996923) Investigate if we need headers for Slices, since they never
|
// TODO (b/67996923) Investigate if we need headers for Slices, since they never
|
||||||
// correspond to an actual setting.
|
// correspond to an actual setting.
|
||||||
@@ -168,15 +168,15 @@ class SliceDataConverter {
|
|||||||
// TODO (b/67996923) This will not work if preferences have nested intents:
|
// TODO (b/67996923) This will not work if preferences have nested intents:
|
||||||
// <pref ....>
|
// <pref ....>
|
||||||
// <intent action="blab"/> </pref>
|
// <intent action="blab"/> </pref>
|
||||||
controllerClassName = XmlParserUtils.getController(mContext, attrs);
|
controllerClassName = PreferenceXmlParserUtils.getController(mContext, attrs);
|
||||||
if (TextUtils.isEmpty(controllerClassName)) {
|
if (TextUtils.isEmpty(controllerClassName)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
title = XmlParserUtils.getDataTitle(mContext, attrs);
|
title = PreferenceXmlParserUtils.getDataTitle(mContext, attrs);
|
||||||
key = XmlParserUtils.getDataKey(mContext, attrs);
|
key = PreferenceXmlParserUtils.getDataKey(mContext, attrs);
|
||||||
iconResId = XmlParserUtils.getDataIcon(mContext, attrs);
|
iconResId = PreferenceXmlParserUtils.getDataIcon(mContext, attrs);
|
||||||
summary = XmlParserUtils.getDataSummary(mContext, attrs);
|
summary = PreferenceXmlParserUtils.getDataSummary(mContext, attrs);
|
||||||
|
|
||||||
xmlSlice = new SliceData.Builder()
|
xmlSlice = new SliceData.Builder()
|
||||||
.setKey(key)
|
.setKey(key)
|
||||||
|
@@ -17,7 +17,6 @@ import com.android.settings.search.DatabaseIndexingUtils;
|
|||||||
import com.android.settings.search.Indexable;
|
import com.android.settings.search.Indexable;
|
||||||
import com.android.settings.search.SearchFeatureProvider;
|
import com.android.settings.search.SearchFeatureProvider;
|
||||||
import com.android.settings.search.SearchFeatureProviderImpl;
|
import com.android.settings.search.SearchFeatureProviderImpl;
|
||||||
import com.android.settings.search.XmlParserUtils;
|
|
||||||
import com.android.settings.security.SecuritySettings;
|
import com.android.settings.security.SecuritySettings;
|
||||||
import com.android.settings.testutils.FakeFeatureFactory;
|
import com.android.settings.testutils.FakeFeatureFactory;
|
||||||
import com.android.settings.testutils.SettingsRobolectricTestRunner;
|
import com.android.settings.testutils.SettingsRobolectricTestRunner;
|
||||||
@@ -183,7 +182,7 @@ public class XmlControllerAttributeTest {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
controllerClassName = XmlParserUtils.getController(mContext, attrs);
|
controllerClassName = PreferenceXmlParserUtils.getController(mContext, attrs);
|
||||||
// If controller is not indexed, then it is not compatible with
|
// If controller is not indexed, then it is not compatible with
|
||||||
if (!TextUtils.isEmpty(controllerClassName)) {
|
if (!TextUtils.isEmpty(controllerClassName)) {
|
||||||
xmlControllers.add(controllerClassName);
|
xmlControllers.add(controllerClassName);
|
||||||
|
@@ -26,6 +26,7 @@ import android.util.Xml;
|
|||||||
|
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
import com.android.settings.TestConfig;
|
import com.android.settings.TestConfig;
|
||||||
|
import com.android.settings.core.PreferenceXmlParserUtils;
|
||||||
import com.android.settings.testutils.SettingsRobolectricTestRunner;
|
import com.android.settings.testutils.SettingsRobolectricTestRunner;
|
||||||
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
@@ -58,7 +59,7 @@ public class XmlParserUtilTest {
|
|||||||
XmlResourceParser parser = getChildByType(R.xml.display_settings,
|
XmlResourceParser parser = getChildByType(R.xml.display_settings,
|
||||||
"com.android.settings.TimeoutListPreference");
|
"com.android.settings.TimeoutListPreference");
|
||||||
final AttributeSet attrs = Xml.asAttributeSet(parser);
|
final AttributeSet attrs = Xml.asAttributeSet(parser);
|
||||||
String title = XmlParserUtils.getDataTitle(mContext, attrs);
|
String title = PreferenceXmlParserUtils.getDataTitle(mContext, attrs);
|
||||||
String expTitle = mContext.getString(R.string.screen_timeout);
|
String expTitle = mContext.getString(R.string.screen_timeout);
|
||||||
assertThat(title).isEqualTo(expTitle);
|
assertThat(title).isEqualTo(expTitle);
|
||||||
}
|
}
|
||||||
@@ -67,7 +68,7 @@ public class XmlParserUtilTest {
|
|||||||
public void testDataKeywordsValid_ReturnsPreferenceKeywords() {
|
public void testDataKeywordsValid_ReturnsPreferenceKeywords() {
|
||||||
XmlResourceParser parser = getParentPrimedParser(R.xml.display_settings);
|
XmlResourceParser parser = getParentPrimedParser(R.xml.display_settings);
|
||||||
final AttributeSet attrs = Xml.asAttributeSet(parser);
|
final AttributeSet attrs = Xml.asAttributeSet(parser);
|
||||||
String keywords = XmlParserUtils.getDataKeywords(mContext, attrs);
|
String keywords = PreferenceXmlParserUtils.getDataKeywords(mContext, attrs);
|
||||||
String expKeywords = mContext.getString(R.string.keywords_display);
|
String expKeywords = mContext.getString(R.string.keywords_display);
|
||||||
assertThat(keywords).isEqualTo(expKeywords);
|
assertThat(keywords).isEqualTo(expKeywords);
|
||||||
}
|
}
|
||||||
@@ -77,7 +78,7 @@ public class XmlParserUtilTest {
|
|||||||
XmlResourceParser parser = getChildByType(R.xml.display_settings,
|
XmlResourceParser parser = getChildByType(R.xml.display_settings,
|
||||||
"com.android.settings.TimeoutListPreference");
|
"com.android.settings.TimeoutListPreference");
|
||||||
final AttributeSet attrs = Xml.asAttributeSet(parser);
|
final AttributeSet attrs = Xml.asAttributeSet(parser);
|
||||||
String key = XmlParserUtils.getDataKey(mContext, attrs);
|
String key = PreferenceXmlParserUtils.getDataKey(mContext, attrs);
|
||||||
String expKey = "screen_timeout";
|
String expKey = "screen_timeout";
|
||||||
assertThat(key).isEqualTo(expKey);
|
assertThat(key).isEqualTo(expKey);
|
||||||
}
|
}
|
||||||
@@ -87,7 +88,7 @@ public class XmlParserUtilTest {
|
|||||||
XmlResourceParser parser = getChildByType(R.xml.display_settings,
|
XmlResourceParser parser = getChildByType(R.xml.display_settings,
|
||||||
"com.android.settings.TimeoutListPreference");
|
"com.android.settings.TimeoutListPreference");
|
||||||
final AttributeSet attrs = Xml.asAttributeSet(parser);
|
final AttributeSet attrs = Xml.asAttributeSet(parser);
|
||||||
String summary = XmlParserUtils.getDataSummary(mContext, attrs);
|
String summary = PreferenceXmlParserUtils.getDataSummary(mContext, attrs);
|
||||||
String expSummary = mContext.getString(R.string.summary_placeholder);
|
String expSummary = mContext.getString(R.string.summary_placeholder);
|
||||||
assertThat(summary).isEqualTo(expSummary);
|
assertThat(summary).isEqualTo(expSummary);
|
||||||
|
|
||||||
@@ -99,9 +100,9 @@ public class XmlParserUtilTest {
|
|||||||
XmlResourceParser parser = getChildByType(R.xml.display_settings, "CheckBoxPreference");
|
XmlResourceParser parser = getChildByType(R.xml.display_settings, "CheckBoxPreference");
|
||||||
final AttributeSet attrs = Xml.asAttributeSet(parser);
|
final AttributeSet attrs = Xml.asAttributeSet(parser);
|
||||||
|
|
||||||
assertThat(XmlParserUtils.getDataSummaryOn(mContext, attrs))
|
assertThat(PreferenceXmlParserUtils.getDataSummaryOn(mContext, attrs))
|
||||||
.isEqualTo("summary_on");
|
.isEqualTo("summary_on");
|
||||||
assertThat(XmlParserUtils.getDataSummaryOff(mContext, attrs))
|
assertThat(PreferenceXmlParserUtils.getDataSummaryOff(mContext, attrs))
|
||||||
.isEqualTo("summary_off");
|
.isEqualTo("summary_off");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -110,7 +111,7 @@ public class XmlParserUtilTest {
|
|||||||
public void testDataEntriesValid_ReturnsPreferenceEntries() {
|
public void testDataEntriesValid_ReturnsPreferenceEntries() {
|
||||||
XmlResourceParser parser = getChildByType(R.xml.display_settings, "ListPreference");
|
XmlResourceParser parser = getChildByType(R.xml.display_settings, "ListPreference");
|
||||||
final AttributeSet attrs = Xml.asAttributeSet(parser);
|
final AttributeSet attrs = Xml.asAttributeSet(parser);
|
||||||
String entries = XmlParserUtils.getDataEntries(mContext, attrs);
|
String entries = PreferenceXmlParserUtils.getDataEntries(mContext, attrs);
|
||||||
String[] expEntries = mContext.getResources()
|
String[] expEntries = mContext.getResources()
|
||||||
.getStringArray(R.array.app_install_location_entries);
|
.getStringArray(R.array.app_install_location_entries);
|
||||||
for (int i = 0; i < expEntries.length; i++) {
|
for (int i = 0; i < expEntries.length; i++) {
|
||||||
@@ -124,7 +125,7 @@ public class XmlParserUtilTest {
|
|||||||
public void testDataKeyInvalid_ReturnsNull() {
|
public void testDataKeyInvalid_ReturnsNull() {
|
||||||
XmlResourceParser parser = getParentPrimedParser(R.xml.display_settings);
|
XmlResourceParser parser = getParentPrimedParser(R.xml.display_settings);
|
||||||
final AttributeSet attrs = Xml.asAttributeSet(parser);
|
final AttributeSet attrs = Xml.asAttributeSet(parser);
|
||||||
String key = XmlParserUtils.getDataKey(mContext, attrs);
|
String key = PreferenceXmlParserUtils.getDataKey(mContext, attrs);
|
||||||
assertThat(key).isNull();
|
assertThat(key).isNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -134,7 +135,7 @@ public class XmlParserUtilTest {
|
|||||||
XmlResourceParser parser = getChildByType(R.xml.about_legal, "Preference");
|
XmlResourceParser parser = getChildByType(R.xml.about_legal, "Preference");
|
||||||
final AttributeSet attrs = Xml.asAttributeSet(parser);
|
final AttributeSet attrs = Xml.asAttributeSet(parser);
|
||||||
|
|
||||||
String controller = XmlParserUtils.getController(mContext, attrs);
|
String controller = PreferenceXmlParserUtils.getController(mContext, attrs);
|
||||||
assertThat(controller).isEqualTo("mind_flayer");
|
assertThat(controller).isEqualTo("mind_flayer");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -142,7 +143,7 @@ public class XmlParserUtilTest {
|
|||||||
public void testDataSummaryInvalid_ReturnsNull() {
|
public void testDataSummaryInvalid_ReturnsNull() {
|
||||||
XmlResourceParser parser = getParentPrimedParser(R.xml.display_settings);
|
XmlResourceParser parser = getParentPrimedParser(R.xml.display_settings);
|
||||||
final AttributeSet attrs = Xml.asAttributeSet(parser);
|
final AttributeSet attrs = Xml.asAttributeSet(parser);
|
||||||
String summary = XmlParserUtils.getDataSummary(mContext, attrs);
|
String summary = PreferenceXmlParserUtils.getDataSummary(mContext, attrs);
|
||||||
assertThat(summary).isNull();
|
assertThat(summary).isNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -150,7 +151,7 @@ public class XmlParserUtilTest {
|
|||||||
public void testDataSummaryOffInvalid_ReturnsNull() {
|
public void testDataSummaryOffInvalid_ReturnsNull() {
|
||||||
XmlResourceParser parser = getParentPrimedParser(R.xml.display_settings);
|
XmlResourceParser parser = getParentPrimedParser(R.xml.display_settings);
|
||||||
final AttributeSet attrs = Xml.asAttributeSet(parser);
|
final AttributeSet attrs = Xml.asAttributeSet(parser);
|
||||||
String summaryOff = XmlParserUtils.getDataSummaryOff(mContext, attrs);
|
String summaryOff = PreferenceXmlParserUtils.getDataSummaryOff(mContext, attrs);
|
||||||
assertThat(summaryOff).isNull();
|
assertThat(summaryOff).isNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -158,7 +159,7 @@ public class XmlParserUtilTest {
|
|||||||
public void testDataEntriesInvalid_ReturnsNull() {
|
public void testDataEntriesInvalid_ReturnsNull() {
|
||||||
XmlResourceParser parser = getParentPrimedParser(R.xml.display_settings);
|
XmlResourceParser parser = getParentPrimedParser(R.xml.display_settings);
|
||||||
final AttributeSet attrs = Xml.asAttributeSet(parser);
|
final AttributeSet attrs = Xml.asAttributeSet(parser);
|
||||||
String entries = XmlParserUtils.getDataEntries(mContext, attrs);
|
String entries = PreferenceXmlParserUtils.getDataEntries(mContext, attrs);
|
||||||
assertThat(entries).isNull();
|
assertThat(entries).isNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -38,7 +38,7 @@ import com.android.settings.search.DatabaseIndexingUtils;
|
|||||||
import com.android.settings.search.Indexable;
|
import com.android.settings.search.Indexable;
|
||||||
import com.android.settings.search.SearchFeatureProvider;
|
import com.android.settings.search.SearchFeatureProvider;
|
||||||
import com.android.settings.search.SearchFeatureProviderImpl;
|
import com.android.settings.search.SearchFeatureProviderImpl;
|
||||||
import com.android.settings.search.XmlParserUtils;
|
import com.android.settings.core.PreferenceXmlParserUtils;
|
||||||
import com.android.settings.testutils.FakeFeatureFactory;
|
import com.android.settings.testutils.FakeFeatureFactory;
|
||||||
import com.android.settings.testutils.SettingsRobolectricTestRunner;
|
import com.android.settings.testutils.SettingsRobolectricTestRunner;
|
||||||
|
|
||||||
@@ -111,7 +111,7 @@ public class SliceControllerInXmlTest {
|
|||||||
if (type == XmlPullParser.END_TAG || type == XmlPullParser.TEXT) {
|
if (type == XmlPullParser.END_TAG || type == XmlPullParser.TEXT) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
controllerClassName = XmlParserUtils.getController(mContext, attrs);
|
controllerClassName = PreferenceXmlParserUtils.getController(mContext, attrs);
|
||||||
|
|
||||||
if (!TextUtils.isEmpty(controllerClassName)) {
|
if (!TextUtils.isEmpty(controllerClassName)) {
|
||||||
mXmlDeclaredControllers.add(controllerClassName);
|
mXmlDeclaredControllers.add(controllerClassName);
|
||||||
|
@@ -7,7 +7,7 @@ import android.content.Context;
|
|||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.util.Xml;
|
import android.util.Xml;
|
||||||
import com.android.settings.search.XmlParserUtils;
|
import com.android.settings.core.PreferenceXmlParserUtils;
|
||||||
import org.xmlpull.v1.XmlPullParser;
|
import org.xmlpull.v1.XmlPullParser;
|
||||||
import org.xmlpull.v1.XmlPullParserException;
|
import org.xmlpull.v1.XmlPullParserException;
|
||||||
|
|
||||||
@@ -35,7 +35,7 @@ public class XmlTestUtils {
|
|||||||
try {
|
try {
|
||||||
while (parser.next() != XmlPullParser.END_DOCUMENT) {
|
while (parser.next() != XmlPullParser.END_DOCUMENT) {
|
||||||
try {
|
try {
|
||||||
key = XmlParserUtils.getDataKey(context, attrs);
|
key = PreferenceXmlParserUtils.getDataKey(context, attrs);
|
||||||
if (!TextUtils.isEmpty(key)) {
|
if (!TextUtils.isEmpty(key)) {
|
||||||
keys.add(key);
|
keys.add(key);
|
||||||
}
|
}
|
||||||
|
@@ -36,7 +36,6 @@ import com.android.settings.search.DatabaseIndexingUtils;
|
|||||||
import com.android.settings.search.Indexable;
|
import com.android.settings.search.Indexable;
|
||||||
import com.android.settings.search.SearchIndexableRaw;
|
import com.android.settings.search.SearchIndexableRaw;
|
||||||
import com.android.settings.search.SearchIndexableResources;
|
import com.android.settings.search.SearchIndexableResources;
|
||||||
import com.android.settings.search.XmlParserUtils;
|
|
||||||
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
@@ -203,7 +202,7 @@ public class UniquePreferenceTest {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
final AttributeSet attrs = Xml.asAttributeSet(parser);
|
final AttributeSet attrs = Xml.asAttributeSet(parser);
|
||||||
final String key = XmlParserUtils.getDataKey(mContext, attrs);
|
final String key = PreferenceXmlParserUtils.getDataKey(mContext, attrs);
|
||||||
if (TextUtils.isEmpty(key)) {
|
if (TextUtils.isEmpty(key)) {
|
||||||
Log.e(TAG, "Every preference must have an key; found null key"
|
Log.e(TAG, "Every preference must have an key; found null key"
|
||||||
+ " in " + className
|
+ " in " + className
|
||||||
|
Reference in New Issue
Block a user