Remove custom schema parsing in favor of Uri

This allows TextClassifier models to add support for additional protocols
after launch.

Bug: 79407639
Test: atest FrameworksCoreTests:TextClassificationManagerTest
Test: atest FrameworksCoreTests:TextClassificationTest
Test: atest CtsViewTestCases:TextClassificationManagerTest
Test: atest CtsViewTestCases:TextClassifierValueObjectsTest
Change-Id: I6781bf476f8c81d2106e2fb73b8f4629068bb0af
This commit is contained in:
Jan Althaus
2018-05-08 15:30:04 +02:00
parent 1b5e2d8b3e
commit 7dd7c5ceda

View File

@@ -755,14 +755,8 @@ public final class TextClassifierImpl implements TextClassifier {
@NonNull
private static List<LabeledIntent> createForUrl(Context context, String text) {
final String httpPrefix = "http://";
final String httpsPrefix = "https://";
if (text.toLowerCase().startsWith(httpPrefix)) {
text = httpPrefix + text.substring(httpPrefix.length());
} else if (text.toLowerCase().startsWith(httpsPrefix)) {
text = httpsPrefix + text.substring(httpsPrefix.length());
} else {
text = httpPrefix + text;
if (Uri.parse(text).getScheme() == null) {
text = "http://" + text;
}
return Arrays.asList(new LabeledIntent(
context.getString(com.android.internal.R.string.browse),