fix the entry ability of apps
This commit is contained in:
@@ -4,6 +4,58 @@ Maps user-friendly app names to HarmonyOS bundle names.
|
||||
These bundle names are used with the 'hdc shell aa start -b <bundle>' command.
|
||||
"""
|
||||
|
||||
# Custom ability names for apps that don't use the default "EntryAbility"
|
||||
# Maps bundle_name -> ability_name
|
||||
# Generated by: python test/find_abilities.py
|
||||
APP_ABILITIES: dict[str, str] = {
|
||||
# Third-party apps
|
||||
"cn.wps.mobileoffice.hap": "DocumentAbility",
|
||||
"com.ccb.mobilebank.hm": "CcbMainAbility",
|
||||
"com.dewu.hos": "HomeAbility",
|
||||
"com.larus.nova.hm": "MainAbility",
|
||||
"com.luna.hm.music": "MainAbility",
|
||||
"com.meitu.meitupic": "MainAbility",
|
||||
"com.ss.hm.article.news": "MainAbility",
|
||||
"com.ss.hm.ugc.aweme": "MainAbility",
|
||||
"com.taobao.taobao4hmos": "Taobao_mainAbility",
|
||||
"com.tencent.videohm": "AppAbility",
|
||||
"com.ximalaya.ting.xmharmony": "MainBundleAbility",
|
||||
"com.zhihu.hmos": "PhoneAbility",
|
||||
|
||||
# Huawei system apps
|
||||
"com.huawei.hmos.browser": "MainAbility",
|
||||
"com.huawei.hmos.calculator": "com.huawei.hmos.calculator.CalculatorAbility",
|
||||
"com.huawei.hmos.calendar": "MainAbility",
|
||||
"com.huawei.hmos.camera": "com.huawei.hmos.camera.MainAbility",
|
||||
"com.huawei.hmos.clock": "com.huawei.hmos.clock.phone",
|
||||
"com.huawei.hmos.clouddrive": "MainAbility",
|
||||
"com.huawei.hmos.email": "ApplicationAbility",
|
||||
"com.huawei.hmos.filemanager": "MainAbility",
|
||||
"com.huawei.hmos.health": "Activity_card_entryAbility",
|
||||
"com.huawei.hmos.notepad": "MainAbility",
|
||||
"com.huawei.hmos.photos": "MainAbility",
|
||||
"com.huawei.hmos.screenrecorder": "com.huawei.hmos.screenrecorder.ServiceExtAbility",
|
||||
"com.huawei.hmos.screenshot": "com.huawei.hmos.screenshot.ServiceExtAbility",
|
||||
"com.huawei.hmos.settings": "com.huawei.hmos.settings.MainAbility",
|
||||
"com.huawei.hmos.soundrecorder": "MainAbility",
|
||||
"com.huawei.hmos.vassistant": "AiCaptionServiceExtAbility",
|
||||
"com.huawei.hmos.wallet": "MainAbility",
|
||||
|
||||
# Huawei services
|
||||
"com.huawei.hmsapp.appgallery": "MainAbility",
|
||||
"com.huawei.hmsapp.books": "MainAbility",
|
||||
"com.huawei.hmsapp.himovie": "MainAbility",
|
||||
"com.huawei.hmsapp.hisearch": "MainAbility",
|
||||
"com.huawei.hmsapp.music": "MainAbility",
|
||||
"com.huawei.hmsapp.thememanager": "MainAbility",
|
||||
"com.huawei.hmsapp.totemweather": "com.huawei.hmsapp.totemweather.MainAbility",
|
||||
|
||||
# OHOS system apps
|
||||
"com.ohos.callui": "com.ohos.callui.ServiceAbility",
|
||||
"com.ohos.contacts": "com.ohos.contacts.MainAbility",
|
||||
"com.ohos.mms": "com.ohos.mms.MainAbility",
|
||||
}
|
||||
|
||||
APP_PACKAGES: dict[str, str] = {
|
||||
# Social & Messaging
|
||||
"微信": "com.tencent.wechat",
|
||||
@@ -17,20 +69,20 @@ APP_PACKAGES: dict[str, str] = {
|
||||
"京东秒送": "com.jd.hm.mall",
|
||||
# Lifestyle & Social
|
||||
"小红书": "com.xingin.xhs_hos",
|
||||
"知乎": "com.zhihu.hmos",
|
||||
# "豆瓣": "com.douban.frodo", # 未在 hdc 列表中找到
|
||||
# "知乎": "com.zhihu.android", # 未在 hdc 列表中找到
|
||||
# Maps & Navigation
|
||||
"高德地图": "com.amap.hmapp",
|
||||
"百度地图": "com.baidu.baiduapp",
|
||||
"百度地图": "com.baidu.hmmap",
|
||||
# Food & Services
|
||||
"美团": "com.sankuai.hmeituan",
|
||||
"美团外卖": "com.meituan.takeaway",
|
||||
"大众点评": "com.sankuai.dianping",
|
||||
"饿了么": "me.ele.eleme",
|
||||
# "肯德基": "com.yek.android.kfc.activitys", # 未在 hdc 列表中找到
|
||||
# Travel
|
||||
# "携程": "ctrip.android.view", # 未在 hdc 列表中找到
|
||||
"铁路12306": "com.tmri.app.harmony12123",
|
||||
"12306": "com.tmri.app.harmony12123",
|
||||
"铁路12306": "com.chinarailway.ticketingHM",
|
||||
"12306": "com.chinarailway.ticketingHM",
|
||||
# "去哪儿": "com.Qunar", # 未在 hdc 列表中找到
|
||||
# "去哪儿旅行": "com.Qunar", # 未在 hdc 列表中找到
|
||||
"滴滴出行": "com.sdu.didi.hmos.psnger",
|
||||
@@ -40,13 +92,13 @@ APP_PACKAGES: dict[str, str] = {
|
||||
"快手": "com.kuaishou.hmapp",
|
||||
"腾讯视频": "com.tencent.videohm",
|
||||
"爱奇艺": "com.qiyi.video.hmy",
|
||||
"芒果TV": "com.mgtv.phone",
|
||||
# "优酷视频": "com.youku.phone", # 未在 hdc 列表中找到
|
||||
# "芒果TV": "com.hunantv.imgo.activity", # 未在 hdc 列表中找到
|
||||
# "红果短剧": "com.phoenix.read", # 未在 hdc 列表中找到
|
||||
# Music & Audio
|
||||
# "网易云音乐": "com.netease.cloudmusic", # 未在 hdc 列表中找到
|
||||
"QQ音乐": "com.tencent.hm.qqmusic",
|
||||
# "汽水音乐": "com.luna.music", # 未在 hdc 列表中找到,但有 com.luna.hm.music
|
||||
"汽水音乐": "com.luna.hm.music",
|
||||
"喜马拉雅": "com.ximalaya.ting.xmharmony",
|
||||
# Reading
|
||||
# "番茄小说": "com.dragon.read", # 未在 hdc 列表中找到
|
||||
@@ -83,6 +135,9 @@ APP_PACKAGES: dict[str, str] = {
|
||||
"唯品会": "com.vip.hosapp",
|
||||
"支付宝": "com.alipay.mobile.client",
|
||||
"UC浏览器": "com.uc.mobile",
|
||||
"闲鱼": "com.taobao.idlefish4ohos",
|
||||
"转转": "com.zhuanzhuan.hmoszz",
|
||||
"迅雷": "com.xunlei.thunder",
|
||||
"搜狗输入法": "com.sogou.input",
|
||||
"扫描全能王": "com.intsig.camscanner.hap",
|
||||
"美图秀秀": "com.meitu.meitupic",
|
||||
@@ -92,6 +147,8 @@ APP_PACKAGES: dict[str, str] = {
|
||||
"中国移动": "com.droi.tong",
|
||||
"中国联通": "com.sinovatech.unicom.ha",
|
||||
"国家税务总局": "cn.gov.chinatax.gt4.hm",
|
||||
"建设银行": "com.ccb.mobilebank.hm",
|
||||
"快手极速版": "com.kuaishou.hmnebula",
|
||||
|
||||
# HarmonyOS 系统应用 - 工具类
|
||||
"浏览器": "com.huawei.hmos.browser",
|
||||
|
||||
@@ -5,7 +5,7 @@ import subprocess
|
||||
import time
|
||||
from typing import List, Optional, Tuple
|
||||
|
||||
from phone_agent.config.apps_harmonyos import APP_PACKAGES
|
||||
from phone_agent.config.apps_harmonyos import APP_ABILITIES, APP_PACKAGES
|
||||
from phone_agent.config.timing import TIMING_CONFIG
|
||||
from phone_agent.hdc.connection import _run_hdc_command
|
||||
|
||||
@@ -242,9 +242,12 @@ def launch_app(
|
||||
hdc_prefix = _get_hdc_prefix(device_id)
|
||||
bundle = APP_PACKAGES[app_name]
|
||||
|
||||
# Get the ability name for this bundle
|
||||
# Default to "EntryAbility" if not specified in APP_ABILITIES
|
||||
ability = APP_ABILITIES.get(bundle, "EntryAbility")
|
||||
|
||||
# HarmonyOS uses 'aa start' command to launch apps
|
||||
# Format: aa start -b {bundle} -a {ability}
|
||||
# Most HarmonyOS apps use "EntryAbility" as the main ability name
|
||||
_run_hdc_command(
|
||||
hdc_prefix
|
||||
+ [
|
||||
@@ -254,7 +257,7 @@ def launch_app(
|
||||
"-b",
|
||||
bundle,
|
||||
"-a",
|
||||
"EntryAbility",
|
||||
ability,
|
||||
],
|
||||
capture_output=True,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user