Migrate system dialer config to RoleManager

Test: adb logcat | grep Telecomm  - to ensure correct default dialer detected
go to settings-default apps and ensure correct dialer selected in UI
Change-Id: Ib34c07b8259875dfb3c8ea848410436cbeec3796
This commit is contained in:
Eugene Susla
2019-01-24 16:31:15 -08:00
parent 748dfe2b1b
commit 8758d320b4
3 changed files with 21 additions and 0 deletions

View File

@@ -2182,6 +2182,13 @@ public class TextUtils {
return Character.isWhitespace(codePoint) || codePoint == NBSP_CODE_POINT;
}
/** @hide */
@Nullable
public static String withoutPrefix(@Nullable String prefix, @Nullable String str) {
if (prefix == null || str == null) return str;
return str.startsWith(prefix) ? str.substring(prefix.length()) : str;
}
/**
* Remove html, remove bad characters, and truncate string.
*

View File

@@ -690,4 +690,17 @@ public class ArrayUtils {
}
return result;
}
/**
* Returns the first element from the array for which
* condition {@code predicate} is true, or null if there is no such element
*/
public static @Nullable <T> T find(@Nullable T[] items,
@NonNull java.util.function.Predicate<T> predicate) {
if (isEmpty(items)) return null;
for (final T item : items) {
if (predicate.test(item)) return item;
}
return null;
}
}

View File

@@ -1936,6 +1936,7 @@
holders, with each item in the format of "ROLE_NAME: PACKAGE_NAME_1, PACKAGE_NAME_2". -->
<string-array name="config_defaultRoleHolders" translatable="false">
<item>android.app.role.SMS: com.android.messaging</item>
<item>android.app.role.DIALER: com.android.phone</item>
</string-array>
<!-- Enable/disable default bluetooth profiles: