Пример #1
0
    def __init__(self, platform, android_abi, asan_enabled_by_default=False):
        super(AndroidConfiguration, self).__init__(platform,
                                                   asan_enabled_by_default)
        self._target_toolchain = None
        self._host_toolchain = None

        self.AppendApplicationConfigurationPath(os.path.dirname(__file__))

        self.android_abi = android_abi

        self.android_home = sdk_utils.GetSdkPath()
        self.android_ndk_home = sdk_utils.GetNdkPath()

        print('Using Android SDK at {}'.format(self.android_home))
        print('Using Android NDK at {}'.format(self.android_ndk_home))
Пример #2
0
    def __init__(self, platform, target_name, config, device_id, **kwargs):

        super(Launcher, self).__init__(platform, target_name, config,
                                       device_id, **kwargs)

        if abstract_launcher.ARG_SYSTOOLS in self.launcher_args:
            # Use default adb binary from path.
            self.adb = 'adb'
        else:
            self.adb = os.path.join(sdk_utils.GetSdkPath(), 'platform-tools',
                                    'adb')

        self.adb_builder = AdbCommandBuilder(self.adb)

        if not self.device_id:
            self.device_id = self._IdentifyDevice()
        else:
            self._ConnectIfNecessary()

        self.adb_builder.device_id = self.device_id

        # Verify connection and dump target build fingerprint.
        self._CheckCallAdb('shell', 'getprop', 'ro.build.fingerprint')

        out_directory = os.path.split(self.GetTargetPath())[0]
        self.apk_path = os.path.join(out_directory,
                                     '{}.apk'.format(target_name))
        if not os.path.exists(self.apk_path):
            raise Exception("Can't find APK {}".format(self.apk_path))

        # This flag is set when the main Run() loop exits.  If Kill() is called
        # after this flag is set, it will not do anything.
        self.killed = threading.Event()

        # Keep track of the port used by ADB forward in order to remove it later
        # on.
        self.local_port = None
Пример #3
0
# String added to queue to indicate process has crashed
_QUEUE_CODE_CRASHED = 'crashed'

# Args to go/crow, which is started if no other device is attached.
_CROW_COMMANDLINE = ['/google/data/ro/teams/mobile_eng_prod/crow/crow.par',
                     '--api_level', '24', '--device', 'tv',
                     '--open_gl_driver', 'host',
                     '--noenable_g3_monitor']

# How long to keep logging after a crash in order to emit the stack trace.
_CRASH_LOG_SECONDS = 1.0

_DEV_NULL = open('/dev/null')

_ADB = os.path.join(sdk_utils.GetSdkPath(), 'platform-tools', 'adb')

_RUNTIME_PERMISSIONS = [
    'android.permission.GET_ACCOUNTS',
    'android.permission.RECORD_AUDIO',
]


def TargetOsPathJoin(*path_elements):
  """os.path.join for the target (Android)."""
  return '/'.join(path_elements)


def CleanLine(line):
  """Removes trailing carriages returns from ADB output."""
  return line.replace('\r', '')