def get_app_icon(self, max_dpi=<NUM_LIT>):
main_activity_name = self.get_main_activity()<EOL>app_icon = self.get_element('<STR_LIT>', '<STR_LIT>', name=main_activity_name)<EOL>if not app_icon:<EOL><INDENT>app_icon = self.get_element('<STR_LIT>', '<STR_LIT>')<EOL><DEDENT>if not app_icon:<EOL><INDENT>res_id = self.get_android_resources().get_res_id_by_key(self.package, '<STR_LIT>', '<STR_LIT>')<EOL>if res_id:<EOL><INDENT>app_icon = "<STR_LIT>" % res_id<EOL><DEDENT><DEDENT>if not app_icon:<EOL><INDENT>res_id = self.get_android_resources().get_res_id_by_key(self.package, '<STR_LIT>', '<STR_LIT>')<EOL>if res_id:<EOL><INDENT>app_icon = "<STR_LIT>" % res_id<EOL><DEDENT><DEDENT>if not app_icon:<EOL><INDENT>return None<EOL><DEDENT>if app_icon.startswith("<STR_LIT:@>"):<EOL><INDENT>res_id = int(app_icon[<NUM_LIT:1>:], <NUM_LIT:16>)<EOL>res_parser = self.get_android_resources()<EOL>candidates = res_parser.get_resolved_res_configs(res_id)<EOL>app_icon = None<EOL>current_dpi = -<NUM_LIT:1><EOL>try:<EOL><INDENT>for config, file_name in candidates:<EOL><INDENT>dpi = config.get_density()<EOL>if current_dpi < dpi <= max_dpi:<EOL><INDENT>app_icon = file_name<EOL>current_dpi = dpi<EOL><DEDENT><DEDENT><DEDENT>except Exception as e:<EOL><INDENT>anconf.warning("<STR_LIT>" % e)<EOL><DEDENT><DEDENT>return app_icon<EOL>
Return the first non-greater density than max_dpi icon file name,
unless exact icon resolution is set in the manifest, in which case
return the exact file

:rtype: string