Loading src/java/com/android/internal/telephony/CellBroadcastHandler.java +7 −3 Original line number Diff line number Diff line Loading @@ -99,12 +99,16 @@ public class CellBroadcastHandler extends WakeLockStateMachine { SubscriptionManager.putPhoneIdAndSubIdExtra(intent, mPhone.getPhoneId()); if (Build.IS_DEBUGGABLE) { // Send additional broadcast intent to the specified package. This is only for sl4a // automation tests. final String additionalPackage = Settings.Secure.getString( mContext.getContentResolver(), CMAS_ADDITIONAL_BROADCAST_PKG); if (additionalPackage != null) { intent.setPackage(additionalPackage); mContext.sendOrderedBroadcastAsUser(intent, UserHandle.ALL, receiverPermission, appOp, null, getHandler(), Activity.RESULT_OK, null, null); Intent additionalIntent = new Intent(intent); additionalIntent.setPackage(additionalPackage); mContext.sendOrderedBroadcastAsUser(additionalIntent, UserHandle.ALL, receiverPermission, appOp, null, getHandler(), Activity.RESULT_OK, null, null); } } Loading src/java/com/android/internal/telephony/Connection.java +3 −1 Original line number Diff line number Diff line Loading @@ -502,8 +502,10 @@ public abstract class Connection { } protected final void clearPostDialListeners() { if (mPostDialListeners != null) { mPostDialListeners.clear(); } } protected final void notifyPostDialListeners() { if (getPostDialState() == PostDialState.WAIT) { Loading src/java/com/android/internal/telephony/GsmCdmaConnection.java +29 −27 Original line number Diff line number Diff line Loading @@ -225,8 +225,7 @@ public class GsmCdmaConnection extends Connection { releaseAllWakeLocks(); } static boolean equalsHandlesNulls (Object a, Object b) { static boolean equalsHandlesNulls(Object a, Object b) { return (a == null) ? (b == null) : a.equals (b); } Loading Loading @@ -807,13 +806,13 @@ public class GsmCdmaConnection extends Connection { protected void finalize() { /** * It is understood that This finializer is not guaranteed * It is understood that This finalizer is not guaranteed * to be called and the release lock call is here just in * case there is some path that doesn't call onDisconnect * and or onConnectedInOrOut. */ if (mPartialWakeLock.isHeld()) { Rlog.e(LOG_TAG, "[GsmCdmaConn] UNEXPECTED; mPartialWakeLock is held when finalizing."); if (mPartialWakeLock != null && mPartialWakeLock.isHeld()) { Rlog.e(LOG_TAG, "UNEXPECTED; mPartialWakeLock is held when finalizing."); } clearPostDialListeners(); releaseWakeLock(); Loading Loading @@ -938,20 +937,22 @@ public class GsmCdmaConnection extends Connection { notifyPostDialListeners(); } private void createWakeLock(Context context) { private void createWakeLock(Context context) { PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE); mPartialWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, LOG_TAG); } private void acquireWakeLock() { private void acquireWakeLock() { if (mPartialWakeLock != null) { synchronized (mPartialWakeLock) { log("acquireWakeLock"); mPartialWakeLock.acquire(); } } } private void releaseWakeLock() { private void releaseWakeLock() { if (mPartialWakeLock != null) { synchronized (mPartialWakeLock) { if (mPartialWakeLock.isHeld()) { log("releaseWakeLock"); Loading @@ -959,15 +960,17 @@ public class GsmCdmaConnection extends Connection { } } } } private void releaseAllWakeLocks() { private void releaseAllWakeLocks() { if (mPartialWakeLock != null) { synchronized (mPartialWakeLock) { while (mPartialWakeLock.isHeld()) { mPartialWakeLock.release(); } } } } private static boolean isPause(char c) { return c == PhoneNumberUtils.PAUSE; Loading @@ -985,8 +988,7 @@ public class GsmCdmaConnection extends Connection { // This function is to find the next PAUSE character index if // multiple pauses in a row. Otherwise it finds the next non PAUSE or // non WAIT character index. private static int findNextPCharOrNonPOrNonWCharIndex(String phoneNumber, int currIndex) { private static int findNextPCharOrNonPOrNonWCharIndex(String phoneNumber, int currIndex) { boolean wMatched = isWait(phoneNumber.charAt(currIndex)); int index = currIndex + 1; int length = phoneNumber.length(); Loading Loading @@ -1017,8 +1019,8 @@ public class GsmCdmaConnection extends Connection { // This function returns either PAUSE or WAIT character to append. // It is based on the next non PAUSE/WAIT character in the phoneNumber and the // index for the current PAUSE/WAIT character private static char findPOrWCharToAppend(String phoneNumber, int currPwIndex, int nextNonPwCharIndex) { private static char findPOrWCharToAppend(String phoneNumber, int currPwIndex, int nextNonPwCharIndex) { char c = phoneNumber.charAt(currPwIndex); char ret; Loading tests/telephonytests/src/com/android/internal/telephony/DeviceStateMonitorTest.java +5 −6 Original line number Diff line number Diff line Loading @@ -20,7 +20,6 @@ import static android.hardware.radio.V1_0.DeviceStateType.LOW_DATA_EXPECTED; import static com.android.internal.telephony.TelephonyTestUtils.waitForMs; import static org.mockito.Matchers.any; import static org.mockito.Matchers.eq; import static org.mockito.Matchers.nullable; import static org.mockito.Mockito.times; Loading Loading @@ -97,10 +96,10 @@ public class DeviceStateMonitorTest extends TelephonyTest { waitForMs(100); verify(mSimulatedCommandsVerifier, times(1)).setUnsolResponseFilter(eq(0), any(Message.class)); nullable(Message.class)); verify(mSimulatedCommandsVerifier, times(1)).sendDeviceState(eq(LOW_DATA_EXPECTED), eq(true), any(Message.class)); eq(true), nullable(Message.class)); } @FlakyTest Loading @@ -121,12 +120,12 @@ public class DeviceStateMonitorTest extends TelephonyTest { waitForMs(100); verify(mSimulatedCommandsVerifier, times(1)).setUnsolResponseFilter(eq(0), any(Message.class)); nullable(Message.class)); verify(mSimulatedCommandsVerifier, times(1)).sendDeviceState(eq(LOW_DATA_EXPECTED), eq(true), any(Message.class)); eq(true), nullable(Message.class)); verify(mSimulatedCommandsVerifier, times(1)).sendDeviceState(eq(CHARGING_STATE), eq(false), any(Message.class)); eq(false), nullable(Message.class)); } } tests/telephonytests/src/com/android/internal/telephony/ServiceStateTrackerTest.java +2 −1 Original line number Diff line number Diff line Loading @@ -858,7 +858,8 @@ public class ServiceStateTrackerTest extends TelephonyTest { // verify if registered handler has message posted to it messageArgumentCaptor = ArgumentCaptor.forClass(Message.class); verify(mTestHandler).sendMessageAtTime(messageArgumentCaptor.capture(), anyLong()); verify(mTestHandler, times(2)).sendMessageAtTime(messageArgumentCaptor.capture(), anyLong()); assertEquals(EVENT_REGISTERED_TO_NETWORK, messageArgumentCaptor.getValue().what); } Loading Loading
src/java/com/android/internal/telephony/CellBroadcastHandler.java +7 −3 Original line number Diff line number Diff line Loading @@ -99,12 +99,16 @@ public class CellBroadcastHandler extends WakeLockStateMachine { SubscriptionManager.putPhoneIdAndSubIdExtra(intent, mPhone.getPhoneId()); if (Build.IS_DEBUGGABLE) { // Send additional broadcast intent to the specified package. This is only for sl4a // automation tests. final String additionalPackage = Settings.Secure.getString( mContext.getContentResolver(), CMAS_ADDITIONAL_BROADCAST_PKG); if (additionalPackage != null) { intent.setPackage(additionalPackage); mContext.sendOrderedBroadcastAsUser(intent, UserHandle.ALL, receiverPermission, appOp, null, getHandler(), Activity.RESULT_OK, null, null); Intent additionalIntent = new Intent(intent); additionalIntent.setPackage(additionalPackage); mContext.sendOrderedBroadcastAsUser(additionalIntent, UserHandle.ALL, receiverPermission, appOp, null, getHandler(), Activity.RESULT_OK, null, null); } } Loading
src/java/com/android/internal/telephony/Connection.java +3 −1 Original line number Diff line number Diff line Loading @@ -502,8 +502,10 @@ public abstract class Connection { } protected final void clearPostDialListeners() { if (mPostDialListeners != null) { mPostDialListeners.clear(); } } protected final void notifyPostDialListeners() { if (getPostDialState() == PostDialState.WAIT) { Loading
src/java/com/android/internal/telephony/GsmCdmaConnection.java +29 −27 Original line number Diff line number Diff line Loading @@ -225,8 +225,7 @@ public class GsmCdmaConnection extends Connection { releaseAllWakeLocks(); } static boolean equalsHandlesNulls (Object a, Object b) { static boolean equalsHandlesNulls(Object a, Object b) { return (a == null) ? (b == null) : a.equals (b); } Loading Loading @@ -807,13 +806,13 @@ public class GsmCdmaConnection extends Connection { protected void finalize() { /** * It is understood that This finializer is not guaranteed * It is understood that This finalizer is not guaranteed * to be called and the release lock call is here just in * case there is some path that doesn't call onDisconnect * and or onConnectedInOrOut. */ if (mPartialWakeLock.isHeld()) { Rlog.e(LOG_TAG, "[GsmCdmaConn] UNEXPECTED; mPartialWakeLock is held when finalizing."); if (mPartialWakeLock != null && mPartialWakeLock.isHeld()) { Rlog.e(LOG_TAG, "UNEXPECTED; mPartialWakeLock is held when finalizing."); } clearPostDialListeners(); releaseWakeLock(); Loading Loading @@ -938,20 +937,22 @@ public class GsmCdmaConnection extends Connection { notifyPostDialListeners(); } private void createWakeLock(Context context) { private void createWakeLock(Context context) { PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE); mPartialWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, LOG_TAG); } private void acquireWakeLock() { private void acquireWakeLock() { if (mPartialWakeLock != null) { synchronized (mPartialWakeLock) { log("acquireWakeLock"); mPartialWakeLock.acquire(); } } } private void releaseWakeLock() { private void releaseWakeLock() { if (mPartialWakeLock != null) { synchronized (mPartialWakeLock) { if (mPartialWakeLock.isHeld()) { log("releaseWakeLock"); Loading @@ -959,15 +960,17 @@ public class GsmCdmaConnection extends Connection { } } } } private void releaseAllWakeLocks() { private void releaseAllWakeLocks() { if (mPartialWakeLock != null) { synchronized (mPartialWakeLock) { while (mPartialWakeLock.isHeld()) { mPartialWakeLock.release(); } } } } private static boolean isPause(char c) { return c == PhoneNumberUtils.PAUSE; Loading @@ -985,8 +988,7 @@ public class GsmCdmaConnection extends Connection { // This function is to find the next PAUSE character index if // multiple pauses in a row. Otherwise it finds the next non PAUSE or // non WAIT character index. private static int findNextPCharOrNonPOrNonWCharIndex(String phoneNumber, int currIndex) { private static int findNextPCharOrNonPOrNonWCharIndex(String phoneNumber, int currIndex) { boolean wMatched = isWait(phoneNumber.charAt(currIndex)); int index = currIndex + 1; int length = phoneNumber.length(); Loading Loading @@ -1017,8 +1019,8 @@ public class GsmCdmaConnection extends Connection { // This function returns either PAUSE or WAIT character to append. // It is based on the next non PAUSE/WAIT character in the phoneNumber and the // index for the current PAUSE/WAIT character private static char findPOrWCharToAppend(String phoneNumber, int currPwIndex, int nextNonPwCharIndex) { private static char findPOrWCharToAppend(String phoneNumber, int currPwIndex, int nextNonPwCharIndex) { char c = phoneNumber.charAt(currPwIndex); char ret; Loading
tests/telephonytests/src/com/android/internal/telephony/DeviceStateMonitorTest.java +5 −6 Original line number Diff line number Diff line Loading @@ -20,7 +20,6 @@ import static android.hardware.radio.V1_0.DeviceStateType.LOW_DATA_EXPECTED; import static com.android.internal.telephony.TelephonyTestUtils.waitForMs; import static org.mockito.Matchers.any; import static org.mockito.Matchers.eq; import static org.mockito.Matchers.nullable; import static org.mockito.Mockito.times; Loading Loading @@ -97,10 +96,10 @@ public class DeviceStateMonitorTest extends TelephonyTest { waitForMs(100); verify(mSimulatedCommandsVerifier, times(1)).setUnsolResponseFilter(eq(0), any(Message.class)); nullable(Message.class)); verify(mSimulatedCommandsVerifier, times(1)).sendDeviceState(eq(LOW_DATA_EXPECTED), eq(true), any(Message.class)); eq(true), nullable(Message.class)); } @FlakyTest Loading @@ -121,12 +120,12 @@ public class DeviceStateMonitorTest extends TelephonyTest { waitForMs(100); verify(mSimulatedCommandsVerifier, times(1)).setUnsolResponseFilter(eq(0), any(Message.class)); nullable(Message.class)); verify(mSimulatedCommandsVerifier, times(1)).sendDeviceState(eq(LOW_DATA_EXPECTED), eq(true), any(Message.class)); eq(true), nullable(Message.class)); verify(mSimulatedCommandsVerifier, times(1)).sendDeviceState(eq(CHARGING_STATE), eq(false), any(Message.class)); eq(false), nullable(Message.class)); } }
tests/telephonytests/src/com/android/internal/telephony/ServiceStateTrackerTest.java +2 −1 Original line number Diff line number Diff line Loading @@ -858,7 +858,8 @@ public class ServiceStateTrackerTest extends TelephonyTest { // verify if registered handler has message posted to it messageArgumentCaptor = ArgumentCaptor.forClass(Message.class); verify(mTestHandler).sendMessageAtTime(messageArgumentCaptor.capture(), anyLong()); verify(mTestHandler, times(2)).sendMessageAtTime(messageArgumentCaptor.capture(), anyLong()); assertEquals(EVENT_REGISTERED_TO_NETWORK, messageArgumentCaptor.getValue().what); } Loading