question: private Bundle queryRcsStackByIntent ( Intent intent ) throws RcsGenericException { final String action = intent . getAction ( ) ; final SyncBroadcastReceiver broadcastReceiver = new SyncBroadcastReceiver ( ) ; intent . setPackage ( RCS_STACK_PACKAGENAME ) ; trySetIntentForActivePackageAndReceiverInForeground ( intent ) ; synchronized ( sInstance ) { synchronized ( broadcastReceiver ) { mContext . sendOrderedBroadcast ( intent , null , broadcastReceiver , mHandler , Activity . RESULT_OK , null , null ) ; long endTime = System . currentTimeMillis ( ) + INTENT_RESPONSE_TIMEOUT ; while ( ! broadcastReceiver . mHaveResult ) { long delay = endTime - System . currentTimeMillis ( ) ; if ( delay <= 0 ) { Log . w ( LOG_TAG , "Waiting for result for " + action + " has reached deadline!" ) ; break ; } try { if ( sAccurateLog ) { Log . d ( LOG_TAG , "Waiting for result for " + action + " during max " + delay + "ms" ) ; } broadcastReceiver . wait ( delay ) ; } catch ( InterruptedException e ) { Log . w ( LOG_TAG , "Waiting for result for " + action + " was interrupted!" ) ; } } Bundle result = broadcastReceiver . getResultExtras ( false ) ; if ( result == null ) { throw new RcsGenericException ( "Failed to get result for " + action + "!" ) ; } result . putLong ( TIME_SPENT , System . currentTimeMillis ( ) - endTime + INTENT_RESPONSE_TIMEOUT ) ; return result ; } } }
target:  Query RCS stack by sending broadcast intent.