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

Commit 8aa4c972 authored by Brad Ebinger's avatar Brad Ebinger Committed by Android (Google) Code Review
Browse files

Merge "Fix NPE in Call.setHandle" into nyc-mr1-dev

parents 30b8e177 6ab66c31
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -176,7 +176,8 @@ public final class TelecomSystem {
        SystemStateProvider systemStateProvider = new SystemStateProvider(mContext);

        mMissedCallNotifier = missedCallNotifierImplFactory
                .makeMissedCallNotifierImpl(mContext, mPhoneAccountRegistrar);
                .makeMissedCallNotifierImpl(mContext, mPhoneAccountRegistrar,
                        phoneNumberUtilsAdapter);

        DefaultDialerManagerAdapter defaultDialerAdapter =
                new TelecomServiceImpl.DefaultDialerManagerAdapterImpl();
+4 −2
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@ import com.android.server.telecom.HeadsetMediaButtonFactory;
import com.android.server.telecom.InCallWakeLockControllerFactory;
import com.android.server.telecom.CallAudioManager;
import com.android.server.telecom.PhoneAccountRegistrar;
import com.android.server.telecom.PhoneNumberUtilsAdapter;
import com.android.server.telecom.PhoneNumberUtilsAdapterImpl;
import com.android.server.telecom.ProximitySensorManagerFactory;
import com.android.server.telecom.InCallWakeLockController;
@@ -79,9 +80,10 @@ public class TelecomService extends Service implements TelecomSystem.Component {
                                @Override
                                public MissedCallNotifierImpl makeMissedCallNotifierImpl(
                                        Context context,
                                        PhoneAccountRegistrar phoneAccountRegistrar) {
                                        PhoneAccountRegistrar phoneAccountRegistrar,
                                        PhoneNumberUtilsAdapter phoneNumberUtilsAdapter) {
                                    return new MissedCallNotifierImpl(context,
                                            phoneAccountRegistrar);
                                            phoneAccountRegistrar, phoneNumberUtilsAdapter);
                                }
                            },
                            new CallerInfoAsyncQueryFactory() {
+13 −5
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@ import com.android.server.telecom.ContactsAsyncHelper;
import com.android.server.telecom.Log;
import com.android.server.telecom.MissedCallNotifier;
import com.android.server.telecom.PhoneAccountRegistrar;
import com.android.server.telecom.PhoneNumberUtilsAdapter;
import com.android.server.telecom.R;
import com.android.server.telecom.Runnable;
import com.android.server.telecom.TelecomBroadcastIntentProcessor;
@@ -93,7 +94,8 @@ public class MissedCallNotifierImpl extends CallsManagerListenerBase implements

    public interface MissedCallNotifierImplFactory {
        MissedCallNotifier makeMissedCallNotifierImpl(Context context,
                PhoneAccountRegistrar phoneAccountRegistrar);
                PhoneAccountRegistrar phoneAccountRegistrar,
                PhoneNumberUtilsAdapter phoneNumberUtilsAdapter);
    }

    public interface NotificationBuilderFactory {
@@ -132,20 +134,25 @@ public class MissedCallNotifierImpl extends CallsManagerListenerBase implements
    private final NotificationManager mNotificationManager;
    private final NotificationBuilderFactory mNotificationBuilderFactory;
    private final ComponentName mNotificationComponent;
    private final PhoneNumberUtilsAdapter mPhoneNumberUtilsAdapter;
    private UserHandle mCurrentUserHandle;

    // Used to track the number of missed calls.
    private ConcurrentMap<UserHandle, AtomicInteger> mMissedCallCounts;

    public MissedCallNotifierImpl(Context context, PhoneAccountRegistrar phoneAccountRegistrar) {
        this(context, phoneAccountRegistrar, new DefaultNotificationBuilderFactory());
    public MissedCallNotifierImpl(Context context, PhoneAccountRegistrar phoneAccountRegistrar,
            PhoneNumberUtilsAdapter phoneNumberUtilsAdapter) {
        this(context, phoneAccountRegistrar, phoneNumberUtilsAdapter,
                new DefaultNotificationBuilderFactory());
    }

    public MissedCallNotifierImpl(Context context,
            PhoneAccountRegistrar phoneAccountRegistrar,
            PhoneNumberUtilsAdapter phoneNumberUtilsAdapter,
            NotificationBuilderFactory notificationBuilderFactory) {
        mContext = context;
        mPhoneAccountRegistrar = phoneAccountRegistrar;
        mPhoneNumberUtilsAdapter = phoneNumberUtilsAdapter;
        mNotificationManager =
                (NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE);
        final String notificationComponent = context.getString(R.string.notification_component);
@@ -600,8 +607,9 @@ public class MissedCallNotifierImpl extends CallsManagerListenerBase implements
                                // Convert the data to a call object
                                Call call = new Call(Call.CALL_ID_UNKNOWN, mContext, callsManager,
                                        lock, null, contactsAsyncHelper,
                                        callerInfoAsyncQueryFactory, null, null, null, null, null,
                                        Call.CALL_DIRECTION_INCOMING, false, false);
                                        callerInfoAsyncQueryFactory, mPhoneNumberUtilsAdapter, null,
                                        null, null, null, Call.CALL_DIRECTION_INCOMING, false,
                                        false);
                                call.setDisconnectCause(
                                        new DisconnectCause(DisconnectCause.MISSED));
                                call.setState(CallState.DISCONNECTED, "throw away call");
+4 −3
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@ import com.android.server.telecom.Call;
import com.android.server.telecom.Constants;
import com.android.server.telecom.MissedCallNotifier;
import com.android.server.telecom.PhoneAccountRegistrar;
import com.android.server.telecom.PhoneNumberUtilsAdapterImpl;
import com.android.server.telecom.TelecomBroadcastIntentProcessor;
import com.android.server.telecom.components.TelecomBroadcastReceiver;
import com.android.server.telecom.ui.MissedCallNotifierImpl;
@@ -166,7 +167,7 @@ public class MissedCallNotifierImplTest extends TelecomTestCase {
                makeNotificationBuilderFactory(builders);

        MissedCallNotifier missedCallNotifier = new MissedCallNotifierImpl(mContext,
                mPhoneAccountRegistrar, fakeBuilderFactory);
                mPhoneAccountRegistrar, new PhoneNumberUtilsAdapterImpl(), fakeBuilderFactory);

        missedCallNotifier.showMissedCallNotification(fakeCall);
        missedCallNotifier.showMissedCallNotification(fakeCall);
@@ -315,7 +316,7 @@ public class MissedCallNotifierImplTest extends TelecomTestCase {
                makeNotificationBuilderFactory(builder1);

        MissedCallNotifier missedCallNotifier = new MissedCallNotifierImpl(mContext,
                mPhoneAccountRegistrar, fakeBuilderFactory);
                mPhoneAccountRegistrar, new PhoneNumberUtilsAdapterImpl(), fakeBuilderFactory);
        PhoneAccount phoneAccount = makePhoneAccount(PRIMARY_USER, NO_CAPABILITY);

        Call fakeCall =
@@ -374,7 +375,7 @@ public class MissedCallNotifierImplTest extends TelecomTestCase {
    private MissedCallNotifier makeMissedCallNotifier(
            NotificationBuilderFactory fakeBuilderFactory, UserHandle currentUser) {
        MissedCallNotifier missedCallNotifier = new MissedCallNotifierImpl(mContext,
                mPhoneAccountRegistrar, fakeBuilderFactory);
                mPhoneAccountRegistrar, new PhoneNumberUtilsAdapterImpl(), fakeBuilderFactory);
        missedCallNotifier.setCurrentUserHandle(currentUser);
        return missedCallNotifier;
    }
+2 −1
Original line number Diff line number Diff line
@@ -349,7 +349,8 @@ public class TelecomSystemTest extends TelecomTestCase {
                new MissedCallNotifierImplFactory() {
                    @Override
                    public MissedCallNotifier makeMissedCallNotifierImpl(Context context,
                            PhoneAccountRegistrar phoneAccountRegistrar) {
                            PhoneAccountRegistrar phoneAccountRegistrar,
                            PhoneNumberUtilsAdapter phoneNumberUtilsAdapter) {
                        return mMissedCallNotifier;
                    }
                },