def execute_sample(package, activity):
 try:
  package_activity = ('%s/%s' % (package, activity))
  args = ['/system/bin/sh', '/system/bin/am', 'start', '-n', package_activity]
  output = subprocess.check_output(args)
 except subprocess.CalledProcessError as e:
  log.error('Error executing package activity: %r', e)
  return
 log.info('Executed package activity: %r', output)

def execute_sample ( package , activity ) : try : package_activity = ( '%s/%s' % ( package , activity ) ) args = [ '/system/bin/sh' , '/system/bin/am' , 'start' , '-n' , package_activity ] output = subprocess . check_output ( args ) except subprocess . CalledProcessError as e : log . error ( 'Error executing package activity: %r' , e ) return log . info ( 'Executed package activity: %r' , output )
execute the sample on the emulator via adb .