Loading src/java/com/android/internal/telephony/GsmCdmaPhone.java +4 −3 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ import static com.android.internal.telephony.CommandsInterface.SERVICE_CLASS_VOI import android.annotation.NonNull; import android.annotation.Nullable; import android.app.ActivityManager; import android.compat.annotation.UnsupportedAppUsage; import android.content.BroadcastReceiver; import android.content.ContentValues; Loading Loading @@ -776,7 +777,7 @@ public class GsmCdmaPhone extends Phone { Intent intent = new Intent(TelephonyIntents.ACTION_EMERGENCY_CALLBACK_MODE_CHANGED); intent.putExtra(PhoneConstants.PHONE_IN_ECM_STATE, isInEcm()); SubscriptionManager.putPhoneIdAndSubIdExtra(intent, getPhoneId()); mContext.sendStickyBroadcastAsUser(intent, UserHandle.ALL); ActivityManager.broadcastStickyIntent(intent, UserHandle.USER_ALL); logi("sendEmergencyCallbackModeChange"); } Loading @@ -791,7 +792,7 @@ public class GsmCdmaPhone extends Phone { Intent intent = new Intent(TelephonyIntents.ACTION_EMERGENCY_CALL_STATE_CHANGED); intent.putExtra(PhoneConstants.PHONE_IN_EMERGENCY_CALL, callActive); SubscriptionManager.putPhoneIdAndSubIdExtra(intent, getPhoneId()); mContext.sendStickyBroadcastAsUser(intent, UserHandle.ALL); ActivityManager.broadcastStickyIntent(intent, UserHandle.USER_ALL); if (DBG) Rlog.d(LOG_TAG, "sendEmergencyCallStateChange: callActive " + callActive); } } Loading Loading @@ -3729,7 +3730,7 @@ public class GsmCdmaPhone extends Phone { Intent intent = new Intent(TelephonyIntents.ACTION_RADIO_TECHNOLOGY_CHANGED); intent.putExtra(PhoneConstants.PHONE_NAME_KEY, getPhoneName()); SubscriptionManager.putPhoneIdAndSubIdExtra(intent, mPhoneId); mContext.sendStickyBroadcastAsUser(intent, UserHandle.ALL); ActivityManager.broadcastStickyIntent(intent, UserHandle.USER_ALL); } private void switchVoiceRadioTech(int newVoiceRadioTech) { Loading src/java/com/android/internal/telephony/IntentBroadcaster.java +4 −3 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.internal.telephony; import android.app.ActivityManager; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; Loading Loading @@ -55,7 +56,7 @@ public class IntentBroadcaster { logd("Rebroadcasting intent " + i.getAction() + " " + i.getStringExtra(IccCardConstants.INTENT_KEY_ICC_STATE) + " for slotId " + pair.getKey()); context.sendStickyBroadcastAsUser(intent, UserHandle.ALL); ActivityManager.broadcastStickyIntent(i, UserHandle.USER_ALL); } } } Loading Loading @@ -85,12 +86,12 @@ public class IntentBroadcaster { * Wrapper for ActivityManager.broadcastStickyIntent() that also stores intent to be rebroadcast * on USER_UNLOCKED */ public void broadcastStickyIntent(Context context, Intent intent, int phoneId) { public void broadcastStickyIntent(Intent intent, int phoneId) { logd("Broadcasting and adding intent for rebroadcast: " + intent.getAction() + " " + intent.getStringExtra(IccCardConstants.INTENT_KEY_ICC_STATE) + " for phoneId " + phoneId); synchronized (mRebroadcastIntents) { context.sendStickyBroadcastAsUser(intent, UserHandle.ALL); ActivityManager.broadcastStickyIntent(intent, UserHandle.USER_ALL); mRebroadcastIntents.put(phoneId, intent); } } Loading src/java/com/android/internal/telephony/SubscriptionInfoUpdater.java +1 −1 Original line number Diff line number Diff line Loading @@ -1092,7 +1092,7 @@ public class SubscriptionInfoUpdater extends Handler { SubscriptionManager.putPhoneIdAndSubIdExtra(i, phoneId); logd("Broadcasting intent ACTION_SIM_STATE_CHANGED " + state + " reason " + reason + " for phone: " + phoneId); IntentBroadcaster.getInstance().broadcastStickyIntent(sContext, i, phoneId); IntentBroadcaster.getInstance().broadcastStickyIntent(i, phoneId); } private void broadcastSimCardStateChanged(int phoneId, int state) { Loading src/java/com/android/internal/telephony/imsphone/ImsPhone.java +2 −1 Original line number Diff line number Diff line Loading @@ -39,6 +39,7 @@ import static com.android.internal.telephony.CommandsInterface.SERVICE_CLASS_NON import static com.android.internal.telephony.CommandsInterface.SERVICE_CLASS_VOICE; import android.app.Activity; import android.app.ActivityManager; import android.app.Notification; import android.app.NotificationManager; import android.app.PendingIntent; Loading Loading @@ -1697,7 +1698,7 @@ public class ImsPhone extends ImsPhoneBase { Intent intent = new Intent(TelephonyIntents.ACTION_EMERGENCY_CALLBACK_MODE_CHANGED); intent.putExtra(PhoneConstants.PHONE_IN_ECM_STATE, isInEcm()); SubscriptionManager.putPhoneIdAndSubIdExtra(intent, getPhoneId()); mContext.sendStickyBroadcastAsUser(intent, UserHandle.ALL); ActivityManager.broadcastStickyIntent(intent, UserHandle.USER_ALL); if (DBG) logd("sendEmergencyCallbackModeChange: isInEcm=" + isInEcm()); } Loading tests/telephonytests/src/com/android/internal/telephony/GsmCdmaPhoneTest.java +56 −8 Original line number Diff line number Diff line Loading @@ -41,9 +41,13 @@ import static org.mockito.Mockito.spy; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import android.app.Activity; import android.app.IApplicationThread; import android.content.IIntentReceiver; import android.content.Intent; import android.content.SharedPreferences; import android.os.AsyncResult; import android.os.Bundle; import android.os.Handler; import android.os.Message; import android.os.Process; Loading Loading @@ -876,8 +880,19 @@ public class GsmCdmaPhoneTest extends TelephonyTest { // verify ACTION_EMERGENCY_CALLBACK_MODE_CHANGED ArgumentCaptor<Intent> intentArgumentCaptor = ArgumentCaptor.forClass(Intent.class); try { verify(mContext, atLeast(1)).sendStickyBroadcastAsUser(intentArgumentCaptor.capture(), any()); verify(mIActivityManager, atLeast(1)).broadcastIntent(eq((IApplicationThread) null), intentArgumentCaptor.capture(), eq((String) null), eq((IIntentReceiver) null), eq(Activity.RESULT_OK), eq((String) null), eq((Bundle) null), eq((String[]) null), anyInt(), eq((Bundle) null), eq(false), eq(true), anyInt()); } catch(Exception e) { fail("Unexpected exception: " + e.getStackTrace()); } Loading @@ -899,8 +914,19 @@ public class GsmCdmaPhoneTest extends TelephonyTest { // verify ACTION_EMERGENCY_CALLBACK_MODE_CHANGED try { verify(mContext, atLeast(2)).sendStickyBroadcastAsUser(intentArgumentCaptor.capture(), any()); verify(mIActivityManager, atLeast(2)).broadcastIntent(eq((IApplicationThread) null), intentArgumentCaptor.capture(), eq((String) null), eq((IIntentReceiver) null), eq(Activity.RESULT_OK), eq((String) null), eq((Bundle) null), eq((String[]) null), anyInt(), eq((Bundle) null), eq(false), eq(true), anyInt()); } catch(Exception e) { fail("Unexpected exception: " + e.getStackTrace()); } Loading Loading @@ -942,8 +968,19 @@ public class GsmCdmaPhoneTest extends TelephonyTest { // verify ACTION_EMERGENCY_CALLBACK_MODE_CHANGED ArgumentCaptor<Intent> intentArgumentCaptor = ArgumentCaptor.forClass(Intent.class); try { verify(mContext, atLeast(1)).sendStickyBroadcastAsUser(intentArgumentCaptor.capture(), any()); verify(mIActivityManager, atLeast(1)).broadcastIntent(eq((IApplicationThread) null), intentArgumentCaptor.capture(), eq((String) null), eq((IIntentReceiver) null), eq(Activity.RESULT_OK), eq((String) null), eq((Bundle) null), eq((String[]) null), anyInt(), eq((Bundle) null), eq(false), eq(true), anyInt()); } catch (Exception e) { fail("Unexpected exception: " + e.getStackTrace()); } Loading @@ -965,8 +1002,19 @@ public class GsmCdmaPhoneTest extends TelephonyTest { // verify ACTION_EMERGENCY_CALLBACK_MODE_CHANGED try { verify(mContext, atLeast(2)).sendStickyBroadcastAsUser(intentArgumentCaptor.capture(), any()); verify(mIActivityManager, atLeast(2)).broadcastIntent(eq((IApplicationThread) null), intentArgumentCaptor.capture(), eq((String) null), eq((IIntentReceiver) null), eq(Activity.RESULT_OK), eq((String) null), eq((Bundle) null), eq((String[]) null), anyInt(), eq((Bundle) null), eq(false), eq(true), anyInt()); } catch (Exception e) { fail("Unexpected exception: " + e.getStackTrace()); } Loading Loading
src/java/com/android/internal/telephony/GsmCdmaPhone.java +4 −3 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ import static com.android.internal.telephony.CommandsInterface.SERVICE_CLASS_VOI import android.annotation.NonNull; import android.annotation.Nullable; import android.app.ActivityManager; import android.compat.annotation.UnsupportedAppUsage; import android.content.BroadcastReceiver; import android.content.ContentValues; Loading Loading @@ -776,7 +777,7 @@ public class GsmCdmaPhone extends Phone { Intent intent = new Intent(TelephonyIntents.ACTION_EMERGENCY_CALLBACK_MODE_CHANGED); intent.putExtra(PhoneConstants.PHONE_IN_ECM_STATE, isInEcm()); SubscriptionManager.putPhoneIdAndSubIdExtra(intent, getPhoneId()); mContext.sendStickyBroadcastAsUser(intent, UserHandle.ALL); ActivityManager.broadcastStickyIntent(intent, UserHandle.USER_ALL); logi("sendEmergencyCallbackModeChange"); } Loading @@ -791,7 +792,7 @@ public class GsmCdmaPhone extends Phone { Intent intent = new Intent(TelephonyIntents.ACTION_EMERGENCY_CALL_STATE_CHANGED); intent.putExtra(PhoneConstants.PHONE_IN_EMERGENCY_CALL, callActive); SubscriptionManager.putPhoneIdAndSubIdExtra(intent, getPhoneId()); mContext.sendStickyBroadcastAsUser(intent, UserHandle.ALL); ActivityManager.broadcastStickyIntent(intent, UserHandle.USER_ALL); if (DBG) Rlog.d(LOG_TAG, "sendEmergencyCallStateChange: callActive " + callActive); } } Loading Loading @@ -3729,7 +3730,7 @@ public class GsmCdmaPhone extends Phone { Intent intent = new Intent(TelephonyIntents.ACTION_RADIO_TECHNOLOGY_CHANGED); intent.putExtra(PhoneConstants.PHONE_NAME_KEY, getPhoneName()); SubscriptionManager.putPhoneIdAndSubIdExtra(intent, mPhoneId); mContext.sendStickyBroadcastAsUser(intent, UserHandle.ALL); ActivityManager.broadcastStickyIntent(intent, UserHandle.USER_ALL); } private void switchVoiceRadioTech(int newVoiceRadioTech) { Loading
src/java/com/android/internal/telephony/IntentBroadcaster.java +4 −3 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.internal.telephony; import android.app.ActivityManager; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; Loading Loading @@ -55,7 +56,7 @@ public class IntentBroadcaster { logd("Rebroadcasting intent " + i.getAction() + " " + i.getStringExtra(IccCardConstants.INTENT_KEY_ICC_STATE) + " for slotId " + pair.getKey()); context.sendStickyBroadcastAsUser(intent, UserHandle.ALL); ActivityManager.broadcastStickyIntent(i, UserHandle.USER_ALL); } } } Loading Loading @@ -85,12 +86,12 @@ public class IntentBroadcaster { * Wrapper for ActivityManager.broadcastStickyIntent() that also stores intent to be rebroadcast * on USER_UNLOCKED */ public void broadcastStickyIntent(Context context, Intent intent, int phoneId) { public void broadcastStickyIntent(Intent intent, int phoneId) { logd("Broadcasting and adding intent for rebroadcast: " + intent.getAction() + " " + intent.getStringExtra(IccCardConstants.INTENT_KEY_ICC_STATE) + " for phoneId " + phoneId); synchronized (mRebroadcastIntents) { context.sendStickyBroadcastAsUser(intent, UserHandle.ALL); ActivityManager.broadcastStickyIntent(intent, UserHandle.USER_ALL); mRebroadcastIntents.put(phoneId, intent); } } Loading
src/java/com/android/internal/telephony/SubscriptionInfoUpdater.java +1 −1 Original line number Diff line number Diff line Loading @@ -1092,7 +1092,7 @@ public class SubscriptionInfoUpdater extends Handler { SubscriptionManager.putPhoneIdAndSubIdExtra(i, phoneId); logd("Broadcasting intent ACTION_SIM_STATE_CHANGED " + state + " reason " + reason + " for phone: " + phoneId); IntentBroadcaster.getInstance().broadcastStickyIntent(sContext, i, phoneId); IntentBroadcaster.getInstance().broadcastStickyIntent(i, phoneId); } private void broadcastSimCardStateChanged(int phoneId, int state) { Loading
src/java/com/android/internal/telephony/imsphone/ImsPhone.java +2 −1 Original line number Diff line number Diff line Loading @@ -39,6 +39,7 @@ import static com.android.internal.telephony.CommandsInterface.SERVICE_CLASS_NON import static com.android.internal.telephony.CommandsInterface.SERVICE_CLASS_VOICE; import android.app.Activity; import android.app.ActivityManager; import android.app.Notification; import android.app.NotificationManager; import android.app.PendingIntent; Loading Loading @@ -1697,7 +1698,7 @@ public class ImsPhone extends ImsPhoneBase { Intent intent = new Intent(TelephonyIntents.ACTION_EMERGENCY_CALLBACK_MODE_CHANGED); intent.putExtra(PhoneConstants.PHONE_IN_ECM_STATE, isInEcm()); SubscriptionManager.putPhoneIdAndSubIdExtra(intent, getPhoneId()); mContext.sendStickyBroadcastAsUser(intent, UserHandle.ALL); ActivityManager.broadcastStickyIntent(intent, UserHandle.USER_ALL); if (DBG) logd("sendEmergencyCallbackModeChange: isInEcm=" + isInEcm()); } Loading
tests/telephonytests/src/com/android/internal/telephony/GsmCdmaPhoneTest.java +56 −8 Original line number Diff line number Diff line Loading @@ -41,9 +41,13 @@ import static org.mockito.Mockito.spy; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import android.app.Activity; import android.app.IApplicationThread; import android.content.IIntentReceiver; import android.content.Intent; import android.content.SharedPreferences; import android.os.AsyncResult; import android.os.Bundle; import android.os.Handler; import android.os.Message; import android.os.Process; Loading Loading @@ -876,8 +880,19 @@ public class GsmCdmaPhoneTest extends TelephonyTest { // verify ACTION_EMERGENCY_CALLBACK_MODE_CHANGED ArgumentCaptor<Intent> intentArgumentCaptor = ArgumentCaptor.forClass(Intent.class); try { verify(mContext, atLeast(1)).sendStickyBroadcastAsUser(intentArgumentCaptor.capture(), any()); verify(mIActivityManager, atLeast(1)).broadcastIntent(eq((IApplicationThread) null), intentArgumentCaptor.capture(), eq((String) null), eq((IIntentReceiver) null), eq(Activity.RESULT_OK), eq((String) null), eq((Bundle) null), eq((String[]) null), anyInt(), eq((Bundle) null), eq(false), eq(true), anyInt()); } catch(Exception e) { fail("Unexpected exception: " + e.getStackTrace()); } Loading @@ -899,8 +914,19 @@ public class GsmCdmaPhoneTest extends TelephonyTest { // verify ACTION_EMERGENCY_CALLBACK_MODE_CHANGED try { verify(mContext, atLeast(2)).sendStickyBroadcastAsUser(intentArgumentCaptor.capture(), any()); verify(mIActivityManager, atLeast(2)).broadcastIntent(eq((IApplicationThread) null), intentArgumentCaptor.capture(), eq((String) null), eq((IIntentReceiver) null), eq(Activity.RESULT_OK), eq((String) null), eq((Bundle) null), eq((String[]) null), anyInt(), eq((Bundle) null), eq(false), eq(true), anyInt()); } catch(Exception e) { fail("Unexpected exception: " + e.getStackTrace()); } Loading Loading @@ -942,8 +968,19 @@ public class GsmCdmaPhoneTest extends TelephonyTest { // verify ACTION_EMERGENCY_CALLBACK_MODE_CHANGED ArgumentCaptor<Intent> intentArgumentCaptor = ArgumentCaptor.forClass(Intent.class); try { verify(mContext, atLeast(1)).sendStickyBroadcastAsUser(intentArgumentCaptor.capture(), any()); verify(mIActivityManager, atLeast(1)).broadcastIntent(eq((IApplicationThread) null), intentArgumentCaptor.capture(), eq((String) null), eq((IIntentReceiver) null), eq(Activity.RESULT_OK), eq((String) null), eq((Bundle) null), eq((String[]) null), anyInt(), eq((Bundle) null), eq(false), eq(true), anyInt()); } catch (Exception e) { fail("Unexpected exception: " + e.getStackTrace()); } Loading @@ -965,8 +1002,19 @@ public class GsmCdmaPhoneTest extends TelephonyTest { // verify ACTION_EMERGENCY_CALLBACK_MODE_CHANGED try { verify(mContext, atLeast(2)).sendStickyBroadcastAsUser(intentArgumentCaptor.capture(), any()); verify(mIActivityManager, atLeast(2)).broadcastIntent(eq((IApplicationThread) null), intentArgumentCaptor.capture(), eq((String) null), eq((IIntentReceiver) null), eq(Activity.RESULT_OK), eq((String) null), eq((Bundle) null), eq((String[]) null), anyInt(), eq((Bundle) null), eq(false), eq(true), anyInt()); } catch (Exception e) { fail("Unexpected exception: " + e.getStackTrace()); } Loading