Loading AndroidManifest.xml +1 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ <manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:androidprv="http://schemas.android.com/apk/prv/res/android" package="com.android.server.telecom" android:debuggable="true" coreApp="true" android:sharedUserId="android.uid.phone"> Loading src/com/android/server/telecom/CallsManager.java +2 −0 Original line number Diff line number Diff line Loading @@ -451,6 +451,8 @@ public final class CallsManager extends Call.ListenerBase { List<PhoneAccountHandle> accounts = mPhoneAccountRegistrar.getCallCapablePhoneAccounts(handle.getScheme()); Log.v(this, "startOutgoingCall found accounts = " + accounts); // Only dial with the requested phoneAccount if it is still valid. Otherwise treat this call // as if a phoneAccount was not specified (does the default behavior instead). // Note: We will not attempt to dial with a requested phoneAccount if it is disabled. Loading src/com/android/server/telecom/PhoneAccountRegistrar.java +36 −15 Original line number Diff line number Diff line Loading @@ -84,7 +84,7 @@ public final class PhoneAccountRegistrar { private static final String FILE_NAME = "phone-account-registrar-state.xml"; @VisibleForTesting public static final int EXPECTED_STATE_VERSION = 4; public static final int EXPECTED_STATE_VERSION = 5; /** Keep in sync with the same in SipSettings.java */ private static final String SIP_SHARED_PREFERENCES = "SIP_PREFERENCES"; Loading Loading @@ -394,6 +394,9 @@ public final class PhoneAccountRegistrar { * @param account The {@code PhoneAccount} to add or replace. */ private void addOrReplacePhoneAccount(PhoneAccount account) { Log.d(this, "addOrReplacePhoneAccount(%s -> %s)", account.getAccountHandle(), account); mState.accounts.add(account); // Search for duplicates and remove any that are found. for (int i = 0; i < mState.accounts.size() - 1; i++) { Loading Loading @@ -857,7 +860,8 @@ public final class PhoneAccountRegistrar { private static final String ICON_RES_ID = "icon_res_id"; private static final String ICON_PACKAGE_NAME = "icon_package_name"; private static final String ICON_BITMAP = "icon_bitmap"; private static final String COLOR = "color"; private static final String ICON_TINT = "icon_tint"; private static final String HIGHLIGHT_COLOR = "highlight_color"; private static final String LABEL = "label"; private static final String SHORT_DESCRIPTION = "short_description"; private static final String SUPPORTED_URI_SCHEMES = "supported_uri_schemes"; Loading @@ -880,7 +884,9 @@ public final class PhoneAccountRegistrar { writeTextIfNonNull(ICON_RES_ID, Integer.toString(o.getIconResId()), serializer); writeTextIfNonNull(ICON_PACKAGE_NAME, o.getIconPackageName(), serializer); writeBitmapIfNonNull(ICON_BITMAP, o.getIconBitmap(), serializer); writeTextIfNonNull(COLOR, Integer.toString(o.getColor()), serializer); writeTextIfNonNull(ICON_TINT, Integer.toString(o.getIconTint()), serializer); writeTextIfNonNull(HIGHLIGHT_COLOR, Integer.toString(o.getHighlightColor()), serializer); writeTextIfNonNull(LABEL, o.getLabel(), serializer); writeTextIfNonNull(SHORT_DESCRIPTION, o.getShortDescription(), serializer); writeStringList(SUPPORTED_URI_SCHEMES, o.getSupportedUriSchemes(), serializer); Loading @@ -897,10 +903,11 @@ public final class PhoneAccountRegistrar { Uri address = null; Uri subscriptionAddress = null; int capabilities = 0; int iconResId = 0; int iconResId = PhoneAccount.NO_RESOURCE_ID; String iconPackageName = null; Bitmap icon = null; int color = 0; Bitmap iconBitmap = null; int iconTint = PhoneAccount.NO_COLOR; int highlightColor = PhoneAccount.NO_COLOR; String label = null; String shortDescription = null; List<String> supportedUriSchemes = null; Loading Loading @@ -928,10 +935,13 @@ public final class PhoneAccountRegistrar { iconPackageName = parser.getText(); } else if (parser.getName().equals(ICON_BITMAP)) { parser.next(); icon = readBitmap(parser); } else if (parser.getName().equals(COLOR)) { iconBitmap = readBitmap(parser); } else if (parser.getName().equals(ICON_TINT)) { parser.next(); iconTint = Integer.parseInt(parser.getText()); } else if (parser.getName().equals(HIGHLIGHT_COLOR)) { parser.next(); color = Integer.parseInt(parser.getText()); highlightColor = Integer.parseInt(parser.getText()); } else if (parser.getName().equals(LABEL)) { parser.next(); label = parser.getText(); Loading Loading @@ -964,17 +974,28 @@ public final class PhoneAccountRegistrar { } } return PhoneAccount.builder(accountHandle, label) // Upgrade older phone accounts with explicit package name if (version < 5) { if (iconBitmap == null) { iconPackageName = accountHandle.getComponentName().getPackageName(); } } PhoneAccount.Builder builder = PhoneAccount.builder(accountHandle, label) .setAddress(address) .setSubscriptionAddress(subscriptionAddress) .setCapabilities(capabilities) .setIconResId(iconResId) .setIconPackageName(iconPackageName) .setIconBitmap(icon) .setColor(color) .setShortDescription(shortDescription) .setSupportedUriSchemes(supportedUriSchemes) .build(); .setHighlightColor(highlightColor); if (iconBitmap == null) { builder.setIcon(iconPackageName, iconResId, iconTint); } else { builder.setIcon(iconBitmap); } return builder.build(); } return null; } Loading tests/AndroidManifest.xml +0 −1 Original line number Diff line number Diff line Loading @@ -19,7 +19,6 @@ package="com.android.server.telecom.tests" android:debuggable="true"> <!-- Test connection service outgoing video preview. --> <uses-permission android:name="android.permission.CAMERA" /> <uses-permission android:name="android.permission.CONTROL_INCALL_EXPERIENCE" /> <uses-permission android:name="android.permission.REGISTER_CALL_PROVIDER" /> Loading tests/src/com/android/server/telecom/testapps/CallServiceNotifier.java +13 −16 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ import android.content.Context; import android.content.Intent; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Color; import android.net.Uri; import android.telecom.PhoneAccount; import android.telecom.PhoneAccountHandle; Loading Loading @@ -99,10 +100,6 @@ public class CallServiceNotifier { TelecomManager telecomManager = (TelecomManager) context.getSystemService(Context.TELECOM_SERVICE); Bitmap icon = BitmapFactory.decodeResource( context.getResources(), R.drawable.stat_sys_phone_call); telecomManager.clearAccounts(); telecomManager.registerPhoneAccount(PhoneAccount.builder( Loading @@ -113,7 +110,7 @@ public class CallServiceNotifier { .setAddress(Uri.parse("tel:555-TEST")) .setSubscriptionAddress(Uri.parse("tel:555-TEST")) .setCapabilities(PhoneAccount.CAPABILITY_CALL_PROVIDER) .setIconBitmap(icon) .setIcon(context, R.drawable.stat_sys_phone_call, Color.RED) .setShortDescription("a short description for the call provider") .setSupportedUriSchemes(Arrays.asList("tel")) .build()); Loading @@ -127,7 +124,7 @@ public class CallServiceNotifier { .setSubscriptionAddress(Uri.parse("tel:555-TSIM")) .setCapabilities(PhoneAccount.CAPABILITY_CALL_PROVIDER | PhoneAccount.CAPABILITY_SIM_SUBSCRIPTION) .setIconBitmap(icon) .setIcon(context, R.drawable.stat_sys_phone_call, Color.GREEN) .setShortDescription("a short description for the sim subscription") .build()); Loading @@ -139,7 +136,7 @@ public class CallServiceNotifier { .setAddress(Uri.parse("tel:555-CMGR")) .setSubscriptionAddress(Uri.parse("tel:555-CMGR")) .setCapabilities(PhoneAccount.CAPABILITY_CONNECTION_MANAGER) .setIconBitmap(icon) .setIcon(context, R.drawable.stat_sys_phone_call, Color.BLUE) .setShortDescription("a short description for the connection manager") .build()); } Loading Loading
AndroidManifest.xml +1 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ <manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:androidprv="http://schemas.android.com/apk/prv/res/android" package="com.android.server.telecom" android:debuggable="true" coreApp="true" android:sharedUserId="android.uid.phone"> Loading
src/com/android/server/telecom/CallsManager.java +2 −0 Original line number Diff line number Diff line Loading @@ -451,6 +451,8 @@ public final class CallsManager extends Call.ListenerBase { List<PhoneAccountHandle> accounts = mPhoneAccountRegistrar.getCallCapablePhoneAccounts(handle.getScheme()); Log.v(this, "startOutgoingCall found accounts = " + accounts); // Only dial with the requested phoneAccount if it is still valid. Otherwise treat this call // as if a phoneAccount was not specified (does the default behavior instead). // Note: We will not attempt to dial with a requested phoneAccount if it is disabled. Loading
src/com/android/server/telecom/PhoneAccountRegistrar.java +36 −15 Original line number Diff line number Diff line Loading @@ -84,7 +84,7 @@ public final class PhoneAccountRegistrar { private static final String FILE_NAME = "phone-account-registrar-state.xml"; @VisibleForTesting public static final int EXPECTED_STATE_VERSION = 4; public static final int EXPECTED_STATE_VERSION = 5; /** Keep in sync with the same in SipSettings.java */ private static final String SIP_SHARED_PREFERENCES = "SIP_PREFERENCES"; Loading Loading @@ -394,6 +394,9 @@ public final class PhoneAccountRegistrar { * @param account The {@code PhoneAccount} to add or replace. */ private void addOrReplacePhoneAccount(PhoneAccount account) { Log.d(this, "addOrReplacePhoneAccount(%s -> %s)", account.getAccountHandle(), account); mState.accounts.add(account); // Search for duplicates and remove any that are found. for (int i = 0; i < mState.accounts.size() - 1; i++) { Loading Loading @@ -857,7 +860,8 @@ public final class PhoneAccountRegistrar { private static final String ICON_RES_ID = "icon_res_id"; private static final String ICON_PACKAGE_NAME = "icon_package_name"; private static final String ICON_BITMAP = "icon_bitmap"; private static final String COLOR = "color"; private static final String ICON_TINT = "icon_tint"; private static final String HIGHLIGHT_COLOR = "highlight_color"; private static final String LABEL = "label"; private static final String SHORT_DESCRIPTION = "short_description"; private static final String SUPPORTED_URI_SCHEMES = "supported_uri_schemes"; Loading @@ -880,7 +884,9 @@ public final class PhoneAccountRegistrar { writeTextIfNonNull(ICON_RES_ID, Integer.toString(o.getIconResId()), serializer); writeTextIfNonNull(ICON_PACKAGE_NAME, o.getIconPackageName(), serializer); writeBitmapIfNonNull(ICON_BITMAP, o.getIconBitmap(), serializer); writeTextIfNonNull(COLOR, Integer.toString(o.getColor()), serializer); writeTextIfNonNull(ICON_TINT, Integer.toString(o.getIconTint()), serializer); writeTextIfNonNull(HIGHLIGHT_COLOR, Integer.toString(o.getHighlightColor()), serializer); writeTextIfNonNull(LABEL, o.getLabel(), serializer); writeTextIfNonNull(SHORT_DESCRIPTION, o.getShortDescription(), serializer); writeStringList(SUPPORTED_URI_SCHEMES, o.getSupportedUriSchemes(), serializer); Loading @@ -897,10 +903,11 @@ public final class PhoneAccountRegistrar { Uri address = null; Uri subscriptionAddress = null; int capabilities = 0; int iconResId = 0; int iconResId = PhoneAccount.NO_RESOURCE_ID; String iconPackageName = null; Bitmap icon = null; int color = 0; Bitmap iconBitmap = null; int iconTint = PhoneAccount.NO_COLOR; int highlightColor = PhoneAccount.NO_COLOR; String label = null; String shortDescription = null; List<String> supportedUriSchemes = null; Loading Loading @@ -928,10 +935,13 @@ public final class PhoneAccountRegistrar { iconPackageName = parser.getText(); } else if (parser.getName().equals(ICON_BITMAP)) { parser.next(); icon = readBitmap(parser); } else if (parser.getName().equals(COLOR)) { iconBitmap = readBitmap(parser); } else if (parser.getName().equals(ICON_TINT)) { parser.next(); iconTint = Integer.parseInt(parser.getText()); } else if (parser.getName().equals(HIGHLIGHT_COLOR)) { parser.next(); color = Integer.parseInt(parser.getText()); highlightColor = Integer.parseInt(parser.getText()); } else if (parser.getName().equals(LABEL)) { parser.next(); label = parser.getText(); Loading Loading @@ -964,17 +974,28 @@ public final class PhoneAccountRegistrar { } } return PhoneAccount.builder(accountHandle, label) // Upgrade older phone accounts with explicit package name if (version < 5) { if (iconBitmap == null) { iconPackageName = accountHandle.getComponentName().getPackageName(); } } PhoneAccount.Builder builder = PhoneAccount.builder(accountHandle, label) .setAddress(address) .setSubscriptionAddress(subscriptionAddress) .setCapabilities(capabilities) .setIconResId(iconResId) .setIconPackageName(iconPackageName) .setIconBitmap(icon) .setColor(color) .setShortDescription(shortDescription) .setSupportedUriSchemes(supportedUriSchemes) .build(); .setHighlightColor(highlightColor); if (iconBitmap == null) { builder.setIcon(iconPackageName, iconResId, iconTint); } else { builder.setIcon(iconBitmap); } return builder.build(); } return null; } Loading
tests/AndroidManifest.xml +0 −1 Original line number Diff line number Diff line Loading @@ -19,7 +19,6 @@ package="com.android.server.telecom.tests" android:debuggable="true"> <!-- Test connection service outgoing video preview. --> <uses-permission android:name="android.permission.CAMERA" /> <uses-permission android:name="android.permission.CONTROL_INCALL_EXPERIENCE" /> <uses-permission android:name="android.permission.REGISTER_CALL_PROVIDER" /> Loading
tests/src/com/android/server/telecom/testapps/CallServiceNotifier.java +13 −16 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ import android.content.Context; import android.content.Intent; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Color; import android.net.Uri; import android.telecom.PhoneAccount; import android.telecom.PhoneAccountHandle; Loading Loading @@ -99,10 +100,6 @@ public class CallServiceNotifier { TelecomManager telecomManager = (TelecomManager) context.getSystemService(Context.TELECOM_SERVICE); Bitmap icon = BitmapFactory.decodeResource( context.getResources(), R.drawable.stat_sys_phone_call); telecomManager.clearAccounts(); telecomManager.registerPhoneAccount(PhoneAccount.builder( Loading @@ -113,7 +110,7 @@ public class CallServiceNotifier { .setAddress(Uri.parse("tel:555-TEST")) .setSubscriptionAddress(Uri.parse("tel:555-TEST")) .setCapabilities(PhoneAccount.CAPABILITY_CALL_PROVIDER) .setIconBitmap(icon) .setIcon(context, R.drawable.stat_sys_phone_call, Color.RED) .setShortDescription("a short description for the call provider") .setSupportedUriSchemes(Arrays.asList("tel")) .build()); Loading @@ -127,7 +124,7 @@ public class CallServiceNotifier { .setSubscriptionAddress(Uri.parse("tel:555-TSIM")) .setCapabilities(PhoneAccount.CAPABILITY_CALL_PROVIDER | PhoneAccount.CAPABILITY_SIM_SUBSCRIPTION) .setIconBitmap(icon) .setIcon(context, R.drawable.stat_sys_phone_call, Color.GREEN) .setShortDescription("a short description for the sim subscription") .build()); Loading @@ -139,7 +136,7 @@ public class CallServiceNotifier { .setAddress(Uri.parse("tel:555-CMGR")) .setSubscriptionAddress(Uri.parse("tel:555-CMGR")) .setCapabilities(PhoneAccount.CAPABILITY_CONNECTION_MANAGER) .setIconBitmap(icon) .setIcon(context, R.drawable.stat_sys_phone_call, Color.BLUE) .setShortDescription("a short description for the connection manager") .build()); } Loading