Buggy code:
public class TransactionService extends Service implements Observer { private static final String TAG = LogTag . TAG ; public static final String TRANSACTION_COMPLETED_ACTION = "android.intent.action.TRANSACTION_COMPLETED_ACTION" ; public static final String ACTION_ONALARM = "android.intent.action.ACTION_ONALARM" ; public static final String ACTION_ENABLE_AUTO_RETRIEVE = "android.intent.action.ACTION_ENABLE_AUTO_RETRIEVE" ; public static final String STATE = "state" ; public static final String STATE_URI = "uri" ; public static final String CANCEL_URI = "canceluri" ; private static final int EVENT_TRANSACTION_REQUEST = 1 ; private static final int EVENT_CONTINUE_MMS_CONNECTIVITY = 3 ; private static final int EVENT_HANDLE_NEXT_PENDING_TRANSACTION = 4 ; private static final int EVENT_NEW_INTENT = 5 ; private static final int EVENT_MMS_CONNECTIVITY_TIMEOUT = 6 ; private static final int EVENT_MMS_PDP_ACTIVATION_TIMEOUT = 7 ; private static final int EVENT_QUIT = 100 ; private static final int MMS_CONNECTIVITY_DELAY = 75 * 1000 ; private static final int MMS_CONNECTIVITY_RETRY_TIMES = 3 ; private static final int TOAST_MSG_QUEUED = 1 ; private static final int TOAST_DOWNLOAD_LATER = 2 ; private static final int TOAST_NO_APN = 3 ; private static final int TOAST_SEND_FAILED_RETRY = 4 ; private static final int TOAST_DOWNLOAD_FAILED_RETRY = 5 ; private static final int TOAST_NONE = - 1 ; private static final int APN_EXTENSION_WAIT = 30 * 1000 ; private static final int PDP_ACTIVATION_TIMEOUT = 60 * 1000 ; private TransactionService . ServiceHandler mServiceHandler ; private Looper mServiceLooper ; private final ArrayList < Transaction > mProcessing = new ArrayList < Transaction > ( ) ; private final ArrayList < Transaction > mPending = new ArrayList < Transaction > ( ) ; private ConnectivityManager mConnMgr ; private WakeLock mWakeLock ; private int mMmsConnecvivityRetryCount ; private NetworkCallback mMmsNetworkCallback = null ; private NetworkRequest mMmsNetworkRequest = null ; private static TransactionService sInstance = null ; public static TransactionService getInstance ( ) { } private NetworkCallback getNetworkCallback ( String subId ) { } private void onMmsPdpConnected ( String subId , Network network ) { } private NetworkRequest buildNetworkRequest ( String subId ) { } public Handler mToastHandler = new Handler ( ) { @ Override public void handleMessage ( Message msg ) { } } ; @ Override public void onCreate ( ) { } @ Override public int onStartCommand ( Intent intent , int flags , int startId ) { } private long [ ] getSubIdFromDb ( Uri uri ) { } private boolean isMmsAllowed ( ) { } private boolean isAirplaneModeActive ( ) { } private boolean isCurrentRatIwlan ( ) { } private boolean isMmsDataConnectivityPossible ( long subId ) { } public void onNewIntent ( Intent intent , int serviceId ) { mConnMgr = ( ( ConnectivityManager ) ( getSystemService ( CONNECTIVITY_SERVICE ) ) ) ; if ( ( ( mConnMgr ) == null ) || ( ! ( MmsConfig . isSmsEnabled ( getApplicationContext ( ) ) ) ) ) { endMmsConnectivity ( ) ; stopSelfIfIdle ( serviceId ) ; return ; } <START_BUG> boolean noNetwork = isMmsAllowed ( ) ; <END_BUG> if ( Log . isLoggable ( TRANSACTION , VERBOSE ) ) { Log . v ( TransactionService . TAG , ( ( ( ( ( "onNewIntent:<seq2seq4repair_space>serviceId:<seq2seq4repair_space>" + serviceId ) + ":<seq2seq4repair_space>" ) + ( intent . getExtras ( ) ) ) + "<seq2seq4repair_space>intent=" ) + intent ) ) ; } Bundle extras = intent . getExtras ( ) ; String action = intent . getAction ( ) ; DownloadManager downloadManager = DownloadManager . getInstance ( ) ; if ( ( ( ( TransactionService . ACTION_ONALARM . equals ( action ) ) || ( TransactionService . ACTION_ENABLE_AUTO_RETRIEVE . equals ( action ) ) ) || ( extras == null ) ) || ( ( ( extras != null ) && ( ! ( extras . containsKey ( "uri" ) ) ) ) && ( ! ( extras . containsKey ( TransactionService . CANCEL_URI ) ) ) ) ) { Cursor cursor = PduPersister . getPduPersister ( this ) . getPendingMessages ( System . currentTimeMillis ( ) ) ; Log . d ( TransactionService . TAG , ( "Cursor=<seq2seq4repair_space>" + ( DatabaseUtils . dumpCursorToString ( cursor ) ) ) ) ; if ( cursor != null ) { try { int count = cursor . getCount ( ) ; if ( Log . isLoggable ( TRANSACTION , VERBOSE ) ) { Log . v ( TransactionService . TAG , ( ( ( "onNewIntent:<seq2seq4repair_space>cursor.count=" + count ) + "<seq2seq4repair_space>action=" ) + action ) ) ; } if ( count == 0 ) { if ( Log . isLoggable ( TRANSACTION , VERBOSE ) ) { Log . v ( TransactionService . TAG , "onNewIntent:<seq2seq4repair_space>no<seq2seq4repair_space>pending<seq2seq4repair_space>messages.<seq2seq4repair_space>Stopping<seq2seq4repair_space>service." ) ; } RetryScheduler . setRetryAlarm ( this ) ; stopSelfIfIdle ( serviceId ) ; return ; } int columnIndexOfMsgId = cursor . getColumnIndexOrThrow ( MSG_ID ) ; int columnIndexOfMsgType = cursor . getColumnIndexOrThrow ( MSG_TYPE ) ; while ( cursor . moveToNext ( ) ) { int msgType = cursor . getInt ( columnIndexOfMsgType ) ; int transactionType = getTransactionType ( msgType ) ; if ( Log . isLoggable ( TRANSACTION , VERBOSE ) ) { Log . v ( TransactionService . TAG , ( ( ( "onNewIntent:<seq2seq4repair_space>msgType=" + msgType ) + "<seq2seq4repair_space>transactionType=" ) + transactionType ) ) ; } if ( noNetwork ) { cursor . moveToLast ( ) ; transactionType = getTransactionType ( cursor . getInt ( columnIndexOfMsgType ) ) ; Uri uri = ContentUris . withAppendedId ( CONTENT_URI , cursor . getLong ( columnIndexOfMsgId ) ) ; boolean inRetry = TransactionService . ACTION_ONALARM . equals ( intent . getAction ( ) ) ; onNetworkUnavailable ( serviceId , transactionType , uri , inRetry ) ; return ; } switch ( transactionType ) { case - 1 : break ; case Transaction . RETRIEVE_TRANSACTION : int failureType = cursor . getInt ( cursor . getColumnIndexOrThrow ( ERROR_TYPE ) ) ; boolean autoDownload = downloadManager . isAuto ( ) ;

Fix:
boolean noNetwork = false ;