178a5e6b9c1595c81f72d7a822617cb78db224e48Ihab Awadpackage com.android.server.telecom.components;
278a5e6b9c1595c81f72d7a822617cb78db224e48Ihab Awad
378a5e6b9c1595c81f72d7a822617cb78db224e48Ihab Awadimport com.android.server.telecom.TelecomSystem;
478a5e6b9c1595c81f72d7a822617cb78db224e48Ihab Awad
578a5e6b9c1595c81f72d7a822617cb78db224e48Ihab Awadimport android.content.BroadcastReceiver;
678a5e6b9c1595c81f72d7a822617cb78db224e48Ihab Awadimport android.content.Context;
778a5e6b9c1595c81f72d7a822617cb78db224e48Ihab Awadimport android.content.Intent;
878a5e6b9c1595c81f72d7a822617cb78db224e48Ihab Awad
978a5e6b9c1595c81f72d7a822617cb78db224e48Ihab Awad/**
1078a5e6b9c1595c81f72d7a822617cb78db224e48Ihab Awad * Single point of entry for all outgoing and incoming calls. {@link UserCallIntentProcessor} serves
1178a5e6b9c1595c81f72d7a822617cb78db224e48Ihab Awad * as a trampoline that captures call intents for individual users and forwards it to
1278a5e6b9c1595c81f72d7a822617cb78db224e48Ihab Awad * the {@link PrimaryCallReceiver} which interacts with the rest of Telecom, both of which run only as
1378a5e6b9c1595c81f72d7a822617cb78db224e48Ihab Awad * the primary user.
1478a5e6b9c1595c81f72d7a822617cb78db224e48Ihab Awad */
1578a5e6b9c1595c81f72d7a822617cb78db224e48Ihab Awadpublic class PrimaryCallReceiver extends BroadcastReceiver implements TelecomSystem.Component {
1678a5e6b9c1595c81f72d7a822617cb78db224e48Ihab Awad
1778a5e6b9c1595c81f72d7a822617cb78db224e48Ihab Awad    @Override
1878a5e6b9c1595c81f72d7a822617cb78db224e48Ihab Awad    public void onReceive(Context context, Intent intent) {
198d5d9ddc66b55b6906364ab3c0e244dab4d58f13Ihab Awad        synchronized (getTelecomSystem().getLock()) {
208d5d9ddc66b55b6906364ab3c0e244dab4d58f13Ihab Awad            getTelecomSystem().getCallIntentProcessor().processIntent(intent);
218d5d9ddc66b55b6906364ab3c0e244dab4d58f13Ihab Awad        }
2278a5e6b9c1595c81f72d7a822617cb78db224e48Ihab Awad    }
2378a5e6b9c1595c81f72d7a822617cb78db224e48Ihab Awad
2478a5e6b9c1595c81f72d7a822617cb78db224e48Ihab Awad    @Override
2578a5e6b9c1595c81f72d7a822617cb78db224e48Ihab Awad    public TelecomSystem getTelecomSystem() {
2678a5e6b9c1595c81f72d7a822617cb78db224e48Ihab Awad        return TelecomSystem.getInstance();
2778a5e6b9c1595c81f72d7a822617cb78db224e48Ihab Awad    }
2878a5e6b9c1595c81f72d7a822617cb78db224e48Ihab Awad}
29