def _set_launcher_affinity(self):
        try:
            self._launcher_pid = self.device.get_pids_of('com.android.launcher')[0]
            result = self.device.execute('taskset -p {}'.format(self._launcher_pid), busybox=True, as_root=True)
            self._old_launcher_affinity = int(result.split(':')[1].strip(), 16)

            cpu_ids = [i for i, x in enumerate(self.device.core_names) if x == 'a15']
            if not cpu_ids or len(cpu_ids) == len(self.device.core_names):
                self.logger.debug('Cannot set affinity.')
                return

            new_mask = reduce(lambda x, y: x | y, cpu_ids, 0x0)
            self.device.execute('taskset -p 0x{:X} {}'.format(new_mask, self._launcher_pid), busybox=True, as_root=True)
        except __HOLE__:
            raise WorkloadError('Could not set affinity of launcher: PID not found.')
dataset/ETHPy150Open ARM-software/workload-automation/wlauto/workloads/applaunch/__init__.py/ApplaunchWorkload._set_launcher_affinity