Loading src/com/android/server/telecom/InCallController.java +26 −16 Original line number Diff line number Diff line Loading @@ -261,8 +261,6 @@ public class InCallController extends CallsManagerListenerBase { public InCallServiceBindingConnection(InCallServiceInfo info) { mInCallServiceInfo = info; mNotificationManager = (NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE); } @Override Loading Loading @@ -325,19 +323,7 @@ public class InCallController extends CallsManagerListenerBase { mContext.unbindService(mServiceConnection); mIsConnected = false; if (mIsNullBinding) { Notification.Builder builder = new Notification.Builder(mContext, NotificationChannelManager.CHANNEL_ID_IN_CALL_SERVICE_CRASH); builder.setSmallIcon(R.drawable.ic_phone) .setColor(mContext.getResources().getColor(R.color.theme_color)) .setContentTitle( mContext.getText( R.string.notification_crashedInCallService_title)) .setStyle(new Notification.BigTextStyle() .bigText(mContext.getString( R.string.notification_crashedInCallService_body, packageName))); mNotificationManager.notify(NOTIFICATION_TAG, IN_CALL_SERVICE_NOTIFICATION_ID, builder.build()); sendCrashedInCallServiceNotification(packageName); } if (mCall != null) { mCall.getAnalytics().addInCallService( Loading Loading @@ -1328,7 +1314,13 @@ public class InCallController extends CallsManagerListenerBase { mCallsManager.getCurrentUserHandle().getIdentifier()); Log.d(this, "Default Dialer package: " + packageName); return getInCallServiceComponent(packageName, IN_CALL_SERVICE_TYPE_DIALER_UI); InCallServiceInfo defaultDialerComponent = getInCallServiceComponent(packageName, IN_CALL_SERVICE_TYPE_DIALER_UI); if (packageName != null && defaultDialerComponent == null) { // The in call service of default phone app is disabled, send notification. sendCrashedInCallServiceNotification(packageName); } return defaultDialerComponent; } private InCallServiceInfo getCurrentCarModeComponent() { Loading Loading @@ -1807,4 +1799,22 @@ public class InCallController extends CallsManagerListenerBase { } } } private void sendCrashedInCallServiceNotification(String packageName) { NotificationManager notificationManager = (NotificationManager) mContext .getSystemService(Context.NOTIFICATION_SERVICE); Notification.Builder builder = new Notification.Builder(mContext, NotificationChannelManager.CHANNEL_ID_IN_CALL_SERVICE_CRASH); builder.setSmallIcon(R.drawable.ic_phone) .setColor(mContext.getResources().getColor(R.color.theme_color)) .setContentTitle( mContext.getText( R.string.notification_crashedInCallService_title)) .setStyle(new Notification.BigTextStyle() .bigText(mContext.getString( R.string.notification_crashedInCallService_body, packageName))); notificationManager.notify(NOTIFICATION_TAG, IN_CALL_SERVICE_NOTIFICATION_ID, builder.build()); } } testapps/res/layout/incall_screen.xml +10 −0 Original line number Diff line number Diff line Loading @@ -131,4 +131,14 @@ android:layout_height="wrap_content" android:layout_marginLeft="10dp"/> </LinearLayout> <Button android:id="@+id/disable_incallservice" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Disable InCallService" /> <Button android:id="@+id/enable_incallservice" android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="Enable InCallService" /> </LinearLayout> testapps/src/com/android/server/telecom/testapps/TestInCallServiceImpl.java +0 −3 Original line number Diff line number Diff line Loading @@ -23,9 +23,6 @@ import android.telecom.InCallService; import android.telecom.Phone; import android.util.Log; import java.lang.Override; import java.lang.String; /** * Test In-Call service implementation. Logs incoming events. Mainly used to test binding to * multiple {@link InCallService} implementations. Loading testapps/src/com/android/server/telecom/testapps/TestInCallUI.java +37 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import android.app.Activity; import android.bluetooth.BluetoothDevice; import android.content.ComponentName; import android.content.Intent; import android.content.pm.PackageManager; import android.os.Bundle; import android.telecom.Call; import android.telecom.CallAudioState; Loading Loading @@ -233,6 +234,20 @@ public class TestInCallUI extends Activity { Call call = mCallList.getCall(0); call.reject(false, null); }); findViewById(R.id.disable_incallservice).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { disableInCallService(); } }); findViewById(R.id.enable_incallservice).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { enableInCallService(); } }); } public void updateCallAudioState(CallAudioState cas) { Loading Loading @@ -285,4 +300,26 @@ public class TestInCallUI extends Activity { SelfManagedCallList.class.getPackage().getName(), SelfManagedConnectionService.class.getName()), "1"); } public void disableInCallService() { ComponentName uiComponent = new ComponentName( TestInCallServiceImpl.class.getPackage().getName(), TestInCallServiceImpl.class.getName()); getPackageManager().setComponentEnabledSetting(uiComponent, PackageManager.COMPONENT_ENABLED_STATE_DISABLED, 0); boolean isEnabled = getPackageManager().getComponentEnabledSetting(uiComponent) == PackageManager.COMPONENT_ENABLED_STATE_ENABLED; Toast.makeText(this, "Is UI enabled? " + isEnabled, Toast.LENGTH_LONG).show(); } public void enableInCallService() { ComponentName uiComponent = new ComponentName( TestInCallServiceImpl.class.getPackage().getName(), TestInCallServiceImpl.class.getName()); getPackageManager().setComponentEnabledSetting(uiComponent, PackageManager.COMPONENT_ENABLED_STATE_ENABLED, 0); boolean isEnabled = getPackageManager().getComponentEnabledSetting(uiComponent) == PackageManager.COMPONENT_ENABLED_STATE_ENABLED; Toast.makeText(this, "Is UI enabled? " + isEnabled, Toast.LENGTH_LONG).show(); } } Loading
src/com/android/server/telecom/InCallController.java +26 −16 Original line number Diff line number Diff line Loading @@ -261,8 +261,6 @@ public class InCallController extends CallsManagerListenerBase { public InCallServiceBindingConnection(InCallServiceInfo info) { mInCallServiceInfo = info; mNotificationManager = (NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE); } @Override Loading Loading @@ -325,19 +323,7 @@ public class InCallController extends CallsManagerListenerBase { mContext.unbindService(mServiceConnection); mIsConnected = false; if (mIsNullBinding) { Notification.Builder builder = new Notification.Builder(mContext, NotificationChannelManager.CHANNEL_ID_IN_CALL_SERVICE_CRASH); builder.setSmallIcon(R.drawable.ic_phone) .setColor(mContext.getResources().getColor(R.color.theme_color)) .setContentTitle( mContext.getText( R.string.notification_crashedInCallService_title)) .setStyle(new Notification.BigTextStyle() .bigText(mContext.getString( R.string.notification_crashedInCallService_body, packageName))); mNotificationManager.notify(NOTIFICATION_TAG, IN_CALL_SERVICE_NOTIFICATION_ID, builder.build()); sendCrashedInCallServiceNotification(packageName); } if (mCall != null) { mCall.getAnalytics().addInCallService( Loading Loading @@ -1328,7 +1314,13 @@ public class InCallController extends CallsManagerListenerBase { mCallsManager.getCurrentUserHandle().getIdentifier()); Log.d(this, "Default Dialer package: " + packageName); return getInCallServiceComponent(packageName, IN_CALL_SERVICE_TYPE_DIALER_UI); InCallServiceInfo defaultDialerComponent = getInCallServiceComponent(packageName, IN_CALL_SERVICE_TYPE_DIALER_UI); if (packageName != null && defaultDialerComponent == null) { // The in call service of default phone app is disabled, send notification. sendCrashedInCallServiceNotification(packageName); } return defaultDialerComponent; } private InCallServiceInfo getCurrentCarModeComponent() { Loading Loading @@ -1807,4 +1799,22 @@ public class InCallController extends CallsManagerListenerBase { } } } private void sendCrashedInCallServiceNotification(String packageName) { NotificationManager notificationManager = (NotificationManager) mContext .getSystemService(Context.NOTIFICATION_SERVICE); Notification.Builder builder = new Notification.Builder(mContext, NotificationChannelManager.CHANNEL_ID_IN_CALL_SERVICE_CRASH); builder.setSmallIcon(R.drawable.ic_phone) .setColor(mContext.getResources().getColor(R.color.theme_color)) .setContentTitle( mContext.getText( R.string.notification_crashedInCallService_title)) .setStyle(new Notification.BigTextStyle() .bigText(mContext.getString( R.string.notification_crashedInCallService_body, packageName))); notificationManager.notify(NOTIFICATION_TAG, IN_CALL_SERVICE_NOTIFICATION_ID, builder.build()); } }
testapps/res/layout/incall_screen.xml +10 −0 Original line number Diff line number Diff line Loading @@ -131,4 +131,14 @@ android:layout_height="wrap_content" android:layout_marginLeft="10dp"/> </LinearLayout> <Button android:id="@+id/disable_incallservice" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Disable InCallService" /> <Button android:id="@+id/enable_incallservice" android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="Enable InCallService" /> </LinearLayout>
testapps/src/com/android/server/telecom/testapps/TestInCallServiceImpl.java +0 −3 Original line number Diff line number Diff line Loading @@ -23,9 +23,6 @@ import android.telecom.InCallService; import android.telecom.Phone; import android.util.Log; import java.lang.Override; import java.lang.String; /** * Test In-Call service implementation. Logs incoming events. Mainly used to test binding to * multiple {@link InCallService} implementations. Loading
testapps/src/com/android/server/telecom/testapps/TestInCallUI.java +37 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import android.app.Activity; import android.bluetooth.BluetoothDevice; import android.content.ComponentName; import android.content.Intent; import android.content.pm.PackageManager; import android.os.Bundle; import android.telecom.Call; import android.telecom.CallAudioState; Loading Loading @@ -233,6 +234,20 @@ public class TestInCallUI extends Activity { Call call = mCallList.getCall(0); call.reject(false, null); }); findViewById(R.id.disable_incallservice).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { disableInCallService(); } }); findViewById(R.id.enable_incallservice).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { enableInCallService(); } }); } public void updateCallAudioState(CallAudioState cas) { Loading Loading @@ -285,4 +300,26 @@ public class TestInCallUI extends Activity { SelfManagedCallList.class.getPackage().getName(), SelfManagedConnectionService.class.getName()), "1"); } public void disableInCallService() { ComponentName uiComponent = new ComponentName( TestInCallServiceImpl.class.getPackage().getName(), TestInCallServiceImpl.class.getName()); getPackageManager().setComponentEnabledSetting(uiComponent, PackageManager.COMPONENT_ENABLED_STATE_DISABLED, 0); boolean isEnabled = getPackageManager().getComponentEnabledSetting(uiComponent) == PackageManager.COMPONENT_ENABLED_STATE_ENABLED; Toast.makeText(this, "Is UI enabled? " + isEnabled, Toast.LENGTH_LONG).show(); } public void enableInCallService() { ComponentName uiComponent = new ComponentName( TestInCallServiceImpl.class.getPackage().getName(), TestInCallServiceImpl.class.getName()); getPackageManager().setComponentEnabledSetting(uiComponent, PackageManager.COMPONENT_ENABLED_STATE_ENABLED, 0); boolean isEnabled = getPackageManager().getComponentEnabledSetting(uiComponent) == PackageManager.COMPONENT_ENABLED_STATE_ENABLED; Toast.makeText(this, "Is UI enabled? " + isEnabled, Toast.LENGTH_LONG).show(); } }