Loading src/java/com/android/internal/telephony/Phone.java +7 −6 Original line number Diff line number Diff line Loading @@ -1060,16 +1060,17 @@ public abstract class Phone extends Handler implements PhoneInternalInterface { } /** * Notify the phone that an SMS has been sent. This will be used determine if the SMS was sent * to an emergency address. * Notify the phone that an SMS has been sent. This will be used to determine if the SMS was * sent to an emergency address. * * @param destinationAddress the address that the SMS was sent to. */ public void notifySmsSent(String destinationAddress) { TelephonyManager m = (TelephonyManager) getContext().getSystemService( Context.TELEPHONY_SERVICE); TelephonyManager m = (TelephonyManager) getContext().getSystemService(Context.TELEPHONY_SERVICE); if (mContext.getPackageManager() != null && mContext.getPackageManager().hasSystemFeature( PackageManager.FEATURE_TELEPHONY_CALLING)) { && mContext.getPackageManager() .hasSystemFeature(PackageManager.FEATURE_TELEPHONY_MESSAGING)) { if (m != null && m.isEmergencyNumber(destinationAddress)) { mLocalLog.log("Emergency SMS detected, recording time."); mTimeLastEmergencySmsSentMs = SystemClock.elapsedRealtime(); Loading tests/telephonytests/src/com/android/internal/telephony/GsmCdmaPhoneTest.java +4 −4 Original line number Diff line number Diff line Loading @@ -640,16 +640,16 @@ public class GsmCdmaPhoneTest extends TelephonyTest { doReturn(true).when(mTelephonyManager).isEmergencyNumber(emergencyNumber); // Feature flag enabled // Device does not have FEATURE_TELEPHONY_CALLING // Device does not have FEATURE_TELEPHONY_MESSAGING doReturn(false).when(mPackageManager).hasSystemFeature( eq(PackageManager.FEATURE_TELEPHONY_CALLING)); eq(PackageManager.FEATURE_TELEPHONY_MESSAGING)); mPhoneUT.notifySmsSent(emergencyNumber); processAllMessages(); assertFalse(mPhoneUT.isInEmergencySmsMode()); // Device has FEATURE_TELEPHONY_CALLING // Device has FEATURE_TELEPHONY_MESSAGING doReturn(true).when(mPackageManager).hasSystemFeature( eq(PackageManager.FEATURE_TELEPHONY_CALLING)); eq(PackageManager.FEATURE_TELEPHONY_MESSAGING)); mPhoneUT.notifySmsSent(emergencyNumber); processAllMessages(); assertTrue(mPhoneUT.isInEmergencySmsMode()); Loading Loading
src/java/com/android/internal/telephony/Phone.java +7 −6 Original line number Diff line number Diff line Loading @@ -1060,16 +1060,17 @@ public abstract class Phone extends Handler implements PhoneInternalInterface { } /** * Notify the phone that an SMS has been sent. This will be used determine if the SMS was sent * to an emergency address. * Notify the phone that an SMS has been sent. This will be used to determine if the SMS was * sent to an emergency address. * * @param destinationAddress the address that the SMS was sent to. */ public void notifySmsSent(String destinationAddress) { TelephonyManager m = (TelephonyManager) getContext().getSystemService( Context.TELEPHONY_SERVICE); TelephonyManager m = (TelephonyManager) getContext().getSystemService(Context.TELEPHONY_SERVICE); if (mContext.getPackageManager() != null && mContext.getPackageManager().hasSystemFeature( PackageManager.FEATURE_TELEPHONY_CALLING)) { && mContext.getPackageManager() .hasSystemFeature(PackageManager.FEATURE_TELEPHONY_MESSAGING)) { if (m != null && m.isEmergencyNumber(destinationAddress)) { mLocalLog.log("Emergency SMS detected, recording time."); mTimeLastEmergencySmsSentMs = SystemClock.elapsedRealtime(); Loading
tests/telephonytests/src/com/android/internal/telephony/GsmCdmaPhoneTest.java +4 −4 Original line number Diff line number Diff line Loading @@ -640,16 +640,16 @@ public class GsmCdmaPhoneTest extends TelephonyTest { doReturn(true).when(mTelephonyManager).isEmergencyNumber(emergencyNumber); // Feature flag enabled // Device does not have FEATURE_TELEPHONY_CALLING // Device does not have FEATURE_TELEPHONY_MESSAGING doReturn(false).when(mPackageManager).hasSystemFeature( eq(PackageManager.FEATURE_TELEPHONY_CALLING)); eq(PackageManager.FEATURE_TELEPHONY_MESSAGING)); mPhoneUT.notifySmsSent(emergencyNumber); processAllMessages(); assertFalse(mPhoneUT.isInEmergencySmsMode()); // Device has FEATURE_TELEPHONY_CALLING // Device has FEATURE_TELEPHONY_MESSAGING doReturn(true).when(mPackageManager).hasSystemFeature( eq(PackageManager.FEATURE_TELEPHONY_CALLING)); eq(PackageManager.FEATURE_TELEPHONY_MESSAGING)); mPhoneUT.notifySmsSent(emergencyNumber); processAllMessages(); assertTrue(mPhoneUT.isInEmergencySmsMode()); Loading