Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d78d0ea1 authored by Grace Jia's avatar Grace Jia Committed by Automerger Merge Worker
Browse files

Suppress "dialer crashed" notification if the crashed dialer is system am: 98faa9a3

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/services/Telecomm/+/12346112

Change-Id: I21db90f0a271059295ea4fa995c6a5894e80b544
parents 8acf682d 98faa9a3
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -322,7 +322,10 @@ public class InCallController extends CallsManagerListenerBase {
                String packageName = mInCallServiceInfo.getComponentName().getPackageName();
                mContext.unbindService(mServiceConnection);
                mIsConnected = false;
                if (mIsNullBinding) {
                if (mIsNullBinding && mInCallServiceInfo.getType() != IN_CALL_SERVICE_TYPE_NON_UI) {
                    // Non-UI InCallServices are allowed to return null from onBind if they don't
                    // want to handle calls at the moment, so don't report them to the user as
                    // crashed.
                    sendCrashedInCallServiceNotification(packageName);
                }
                if (mCall != null) {
@@ -1815,6 +1818,10 @@ public class InCallController extends CallsManagerListenerBase {
    private void sendCrashedInCallServiceNotification(String packageName) {
        PackageManager packageManager = mContext.getPackageManager();
        CharSequence appName;
        String systemDialer = mDefaultDialerCache.getSystemDialerApplication();
        if ((systemDialer != null) && systemDialer.equals(packageName)) {
            return;
        }
        try {
            appName = packageManager.getApplicationLabel(
                    packageManager.getApplicationInfo(packageName, 0));
+3 −1
Original line number Diff line number Diff line
@@ -592,6 +592,7 @@ public class InCallControllerTests extends TelecomTestCase {
                any(Intent.class), any(ServiceConnection.class), anyInt(), any(UserHandle.class)))
                .thenReturn(true);
        when(mMockContext.getApplicationInfo()).thenReturn(applicationInfo);
        when(mDefaultDialerCache.getDefaultDialerApplication(CURRENT_USER_ID)).thenReturn(DEF_PKG);

        setupMockPackageManager(true /* default */, true /* system */, false /* external calls */);
        mInCallController.bindToServices(mMockCall);
@@ -618,7 +619,7 @@ public class InCallControllerTests extends TelecomTestCase {

        verify(mNotificationManager).notify(eq(NOTIFICATION_TAG),
                eq(IN_CALL_SERVICE_NOTIFICATION_ID), any(Notification.class));
        verify(mCallInfo).addInCallService(eq(sysDialerComponentName.flattenToShortString()),
        verify(mCallInfo).addInCallService(eq(defDialerComponentName.flattenToShortString()),
                anyInt(), anyLong(), eq(true));

        ArgumentCaptor<Intent> bindIntentCaptor2 = ArgumentCaptor.forClass(Intent.class);
@@ -628,6 +629,7 @@ public class InCallControllerTests extends TelecomTestCase {
                eq(Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE
                        | Context.BIND_ALLOW_BACKGROUND_ACTIVITY_STARTS),
                eq(UserHandle.CURRENT));
        assertEquals(sysDialerComponentName, bindIntentCaptor2.getValue().getComponent());
    }

    /**