! warning !
この投稿はAndroid 7.1 Developer Preview1 - App Shortcutの内容をもとにしています.
今後のバージョンアップで内容が変更されている可能性にご注意ください.
App Shortcutについては下記の投稿もご参考ください.
ショートカットの情報をログ上から確認, 分析することができます. 以下はそのログを取得する方法と確認方法です.
ショートカットサービスの状態をダンプするコマンド
adb shell dumpsys shortcut
試験環境
- Launcherアプリ: com.google.android.apps.nexuslauncher/.NexusLauncherActivity
- ショートカット登録元アプリ: com.example.android.shortcutsample
- Static Shortcut ID: add_website
- Dynamic Shortcut ID: http://www.android.com
- ピン留めされたDynamic Shortcut ID: http://www.android.com
- 動作確認アプリ: GitHub - android-AppShortcuts
- デバイス: Android7.1 エミュレータ
DUMP OF SERVICE shortcut:
Now: [1477132500708] 2016-10-22 19:35:00 Raw last reset: [1477131784076] 2016-10-22 19:23:04 Last reset: [1477131784076] 2016-10-22 19:23:04 Next reset: [1477218184076] 2016-10-23 19:23:04 Config: Max icon dim: 252
Icon format: PNG
Icon quality: 100
saveDelayMillis: 3000
resetInterval: 86400000
maxUpdatesPerInterval: 10
maxShortcutsPerActivity: 5
Stats:
getHomeActivities(): count=8, total=5ms, avg=0.6ms
Launcher permission check: count=169, total=46ms, avg=0.3ms
getPackageInfo(): count=0, total=0ms, avg=0.0ms
getPackageInfo(SIG): count=3, total=1ms, avg=0.3ms
getApplicationInfo: count=41, total=12ms, avg=0.3ms
cleanupDanglingBitmaps: count=0, total=0ms, avg=0.0ms
getActivity+metadata: count=38, total=3ms, avg=0.1ms
getInstalledPackages: count=1, total=11ms, avg=11.0ms
checkPackageChanges: count=1, total=181ms, avg=181.0ms
getApplicationResources: count=24, total=6ms, avg=0.3ms
resourceNameLookup: count=21, total=16ms, avg=0.8ms
getLauncherActivity: count=1, total=0ms, avg=0.0ms
checkLauncherActivity: count=117, total=42ms, avg=0.4ms
isActivityEnabled: count=64, total=7ms, avg=0.1ms
packageUpdateCheck: count=169, total=80ms, avg=0.5ms
asyncPreloadUserDelay: count=1, total=1ms, avg=1.0ms
#Failures: 0
User: 0 Known locales: en-US Last app scan: [1477131791206] 2016-10-22 19:23:11 Last app scan FP: Android/sdk_google_phone_x86_64/generic_x86_64:7.1.1/NPF10D/3354678:userdebug/test-keys
Cached launcher: ComponentInfo{com.google.android.apps.nexuslauncher/com.google.android.apps.nexuslauncher.NexusLauncherActivity}
Last known launcher: ComponentInfo{com.google.android.apps.nexuslauncher/com.google.android.apps.nexuslauncher.NexusLauncherActivity}
Launcher: com.google.android.apps.nexuslauncher Package user: 0 Owner user: 0
PackageInfo:
IsShadow: false
Version: -1
Last package update time: 0
Package: com.example.android.shortcutsample User: 0
Pinned: add_website
Package: com.google.android.apps.messaging UID: 10056
Calls: 0
Last known FG: 734535
Last reset: [1477131784076] 2016-10-22 19:23:04
PackageInfo:
IsShadow: false
Version: 19519170
Last package update time: 1476484657000
Shortcuts:
ShortcutInfo {id=manifest-shortcut-new_message, flags=0x1a4 [ImMIrSr], packageName=com.google.android.apps.messaging, activity=ComponentInfo{com.google.android.apps.messaging/com.google.android.apps.messaging.ui.ConversationListActivity}, shortLabel=New conversation, resId=2131362572[shortcut_new_message_text], longLabel=New conversation, resId=2131362572[shortcut_new_message_text], disabledMessage=Shortcut disabled, resId=2131362573[shortcut_disabled_text], categories={android.shortcut.media, android.shortcut.conversation}, icon=null, rank=0, timestamp=1477131796298, intents=[Intent { act=android.intent.action.VIEW flg=0x1000c000 cmp=com.google.android.apps.messaging/.ui.conversationlist.ConversationListActivity }/PersistableBundle[{via_shortcut=true}], Intent { act=android.intent.action.VIEW cmp=com.google.android.apps.messaging/.ui.conversation.ConversationActivity }/PersistableBundle[{via_shortcut=true}]], extras=null, iconRes=2130838596[drawable/ic_new_message_48dp_clr], bitmapPath=null}
Total bitmap size: 0 (0 B)
Package: com.android.contacts UID: 10003
Calls: 0
Last known FG: 0
Last reset: [1477131784076] 2016-10-22 19:23:04
PackageInfo:
IsShadow: false
Version: 10422
Last package update time: 1476485678000
Shortcuts:
ShortcutInfo {id=shortcut-add-contact, flags=0x1a4 [ImMIrSr], packageName=com.android.contacts, activity=ComponentInfo{com.android.contacts/com.android.contacts.activities.PeopleActivity}, shortLabel=Add Contact, resId=2131427691[menu_new_contact_action_bar], longLabel=null, resId=0[null], disabledMessage=null, resId=0[null], categories=null, icon=null, rank=0, timestamp=1477131791323, intents=[Intent { act=android.intent.action.INSERT dat=content://com.android.contacts/contacts flg=0x1000c000 cmp=com.android.contacts/.activities.CompactContactEditorActivity }/null], extras=null, iconRes=2130837528[drawable/ic_add_circle_24dp], bitmapPath=null}
Total bitmap size: 0 (0 B)
Package: com.example.android.shortcutsample UID: 10071
Calls: 0
Last known FG: 734536
Last reset: [1477131784076] 2016-10-22 19:23:04
PackageInfo:
IsShadow: false
Version: 2
Last package update time: 1477132350724
Shortcuts:
ShortcutInfo {id=add_website, flags=0x1a6 [ImMPIrSr], packageName=com.example.android.shortcutsample, activity=ComponentInfo{com.example.android.shortcutsample/com.example.android.appshortcuts.Main}, shortLabel=Add Website, resId=2131099649[add_new_website_short], longLabel=Add New Website, resId=2131099648[add_new_website], disabledMessage=null, resId=0[null], categories=null, icon=null, rank=0, timestamp=1477132350808, intents=[Intent { act=com.example.android.shortcutsample.ADD_WEBSITE flg=0x1000c000 cmp=com.example.android.shortcutsample/com.example.android.appshortcuts.Main }/null], extras=null, iconRes=2130837504[drawable/add], bitmapPath=null}
ShortcutInfo {id=http://www.android.com, flags=0x85 [DIrSr], packageName=com.example.android.shortcutsample, activity=ComponentInfo{com.example.android.shortcutsample/com.example.android.appshortcuts.Main}, shortLabel=www.android.com, resId=0[null], longLabel=http://www.android.com, resId=0[null], disabledMessage=null, resId=0[null], categories=null, icon=null, rank=0, timestamp=1477132350808, intents=[Intent { act=android.intent.action.VIEW dat=http://www.android.com/... }/null], extras=PersistableBundle[{com.example.android.shortcutsample.EXTRA_LAST_REFRESH=1477131998183}], iconRes=2130837505[drawable/link], bitmapPath=null}
Total bitmap size: 0 (0 B)
Package: com.google.android.apps.maps UID: 10047
Calls: 0
Last known FG: 0
Last reset: [1477131784076] 2016-10-22 19:23:04
PackageInfo:
IsShadow: false
Version: 934100020
Last package update time: 1476484652000
Shortcuts:
ShortcutInfo {id=manifest_home, flags=0x1a4 [ImMIrSr], packageName=com.google.android.apps.maps, activity=ComponentInfo{com.google.android.apps.maps/com.google.android.maps.MapsActivity}, shortLabel=Home, resId=2131821417[HOME_LOCATION], longLabel=null, resId=0[null], disabledMessage=null, resId=0[null], categories=null, icon=null, rank=0, timestamp=1477131791304, intents=[Intent { act=android.intent.action.VIEW flg=0x1000c000 cmp=com.google.android.apps.maps/.LauncherShortcutActivity }/PersistableBundle[{extra_destination_home_key=true}]], extras=null, iconRes=2130838242[drawable/ic_qu_home_launcher], bitmapPath=null}
ShortcutInfo {id=manifest_work, flags=0x1a4 [ImMIrSr], packageName=com.google.android.apps.maps, activity=ComponentInfo{com.google.android.apps.maps/com.google.android.maps.MapsActivity}, shortLabel=Work, resId=2131822823[WORK_LOCATION], longLabel=null, resId=0[null], disabledMessage=null, resId=0[null], categories=null, icon=null, rank=1, timestamp=1477131791304, intents=[Intent { act=android.intent.action.VIEW flg=0x1000c000 cmp=com.google.android.apps.maps/.LauncherShortcutActivity }/PersistableBundle[{extra_destination_work_key=true}]], extras=null, iconRes=2130838389[drawable/ic_qu_work_launcher], bitmapPath=null}
Total bitmap size: 0 (0 B)
Package: com.android.chrome UID: 10030
Calls: 0
Last known FG: 0
Last reset: [1477131784076] 2016-10-22 19:23:04
PackageInfo:
IsShadow: false
Version: 278513462
Last package update time: 1476484675000
Shortcuts:
ShortcutInfo {id=new-tab-shortcut, flags=0x1a4 [ImMIrSr], packageName=com.android.chrome, activity=ComponentInfo{com.android.chrome/com.google.android.apps.chrome.Main}, shortLabel=New tab, resId=2131362518[menu_new_tab], longLabel=null, resId=0[null], disabledMessage=null, resId=0[null], categories=null, icon=null, rank=0, timestamp=1477131791288, intents=[Intent { act=chromium.shortcut.action.OPEN_NEW_TAB flg=0x1000c000 cmp=com.android.chrome/org.chromium.chrome.browser.LauncherShortcutActivity }/null], extras=null, iconRes=2130838003[drawable/shortcut_newtab], bitmapPath=null}
ShortcutInfo {id=new-incognito-tab-shortcut, flags=0x1a4 [ImMIrSr], packageName=com.android.chrome, activity=ComponentInfo{com.android.chrome/com.google.android.apps.chrome.Main}, shortLabel=Incognito Tab, resId=2131362608[accessibility_tabstrip_incognito_identifier], longLabel=New incognito tab, resId=2131362519[menu_new_incognito_tab], disabledMessage=null, resId=0[null], categories=null, icon=null, rank=1, timestamp=1477131791288, intents=[Intent { act=chromium.shortcut.action.OPEN_NEW_INCOGNITO_TAB flg=0x1000c000 cmp=com.android.chrome/org.chromium.chrome.browser.LauncherShortcutActivity }/null], extras=null, iconRes=2130838002[drawable/shortcut_incognito], bitmapPath=null}
Total bitmap size: 0 (0 B)
Package: com.android.settings UID: 1000
Calls: 0
Last known FG: 734537
Last reset: [1477131784076] 2016-10-22 19:23:04
PackageInfo:
IsShadow: false
Version: 25
Last package update time: 1476485764000
Shortcuts:
ShortcutInfo {id=manifest-shortcut-wifi, flags=0x1a4 [ImMIrSr], packageName=com.android.settings, activity=ComponentInfo{com.android.settings/com.android.settings.Settings}, shortLabel=Wi‑Fi, resId=2131624867[wifi_settings], longLabel=null, resId=0[null], disabledMessage=null, resId=0[null], categories=null, icon=null, rank=0, timestamp=1477131806966, intents=[Intent { act=android.settings.WIFI_SETTINGS flg=0x1000c000 }/null], extras=null, iconRes=2130837751[drawable/ic_shortcut_wireless], bitmapPath=null}
ShortcutInfo {id=manifest-shortcut-battery, flags=0x1a4 [ImMIrSr], packageName=com.android.settings, activity=ComponentInfo{com.android.settings/com.android.settings.Settings}, shortLabel=Battery, resId=2131625951[power_usage_summary_title], longLabel=null, resId=0[null], disabledMessage=null, resId=0[null], categories=null, icon=null, rank=2, timestamp=1477131806967, intents=[Intent { act=android.intent.action.POWER_USAGE_SUMMARY flg=0x1000c000 }/null], extras=null, iconRes=2130837749[drawable/ic_shortcut_battery], bitmapPath=null}
ShortcutInfo {id=manifest-shortcut-data-usage, flags=0x1a4 [ImMIrSr], packageName=com.android.settings, activity=ComponentInfo{com.android.settings/com.android.settings.Settings}, shortLabel=Data usage, resId=2131626277[data_usage_summary_title], longLabel=null, resId=0[null], disabledMessage=null, resId=0[null], categories=null, icon=null, rank=1, timestamp=1477131806966, intents=[Intent { act=android.intent.action.MAIN flg=0x1000c000 cmp=com.android.settings/.Settings$DataUsageSummaryActivity }/null], extras=null, iconRes=2130837750[drawable/ic_shortcut_data_usage], bitmapPath=null}
Total bitmap size: 0 (0 B)
Bitmap directories:
Path: bitmaps/ has 0 files, size=0 (0 B)
UID state:
UID=1001 state=0 [FG] last FG=21184
UID=1037 state=16 last FG=0
UID=10001 state=16 last FG=584955
UID=10002 state=16 last FG=0
UID=10005 state=16 last FG=0
UID=10006 state=16 last FG=0
UID=10008 state=16 last FG=160015
UID=10010 state=3 [FG] last FG=24883
UID=10012 state=3 [FG] last FG=719232
UID=10013 state=16 last FG=0
UID=10014 state=2 [FG] last FG=719096
UID=10017 state=16 last FG=25336
UID=10021 state=0 [FG] last FG=21184
UID=10022 state=2 [FG] last FG=719232
UID=10027 state=16 last FG=0
UID=10030 state=16 last FG=0
UID=10033 state=16 last FG=0
UID=10036 state=16 last FG=0
UID=10041 state=16 last FG=0
UID=10043 state=7 last FG=0
UID=10047 state=16 last FG=0
UID=10055 state=16 last FG=0
UID=10056 state=16 last FG=33915
UID=10058 state=3 [FG] last FG=734456
UID=10060 state=16 last FG=0
UID=10071 state=16 last FG=715122
--------- 0.008s was the duration of dumpsys shortcut
ログ解析
maxShortcutsPerActivity: 5
1アプリが持てるStatic/Dynamic Shortcutの数をログ上から確認できる.
Launcher: com.google.android.apps.nexuslauncher Package user: 0 Owner user: 0
ユーザが使用しているランチャーアプリをここで確認できる. 実際にショートカット機能をどこまでサポートしているアプリであるのかを知るために重要な情報になる.
Package: com.example.android.shortcutsample User: 0
Pinned: add_website
ショートカットの情報がログから得ることができる.
今回用意したアプリ(com.example.android.shortcutsample)が登録したadd_website
のショートカットがピン留めされていることが見てとれる.
Package: com.example.android.shortcutsample UID: 10071
Calls: 0
Last known FG: 734536
Last reset: [1477131784076] 2016-10-22 19:23:04
ランチャーアプリが最後に当該アプリがフォアグラウンドに遷移したことを検知した時刻を知ることができる.
ショートカットの更新がRate-Limitに達している可能性があるかをこの時刻から掴むことができる.
Shortcuts:
ShortcutInfo {id=add_website, flags=0x1a6 [ImMPIrSr], packageName=com.example.android.shortcutsample, activity=ComponentInfo{com.example.android.shortcutsample/com.example.android.appshortcuts.Main}, shortLabel=Add Website, resId=2131099649[add_new_website_short], longLabel=Add New Website, resId=2131099648[add_new_website], disabledMessage=null, resId=0[null], categories=null, icon=null, rank=0, timestamp=1477132350808, intents=[Intent { act=com.example.android.shortcutsample.ADD_WEBSITE flg=0x1000c000 cmp=com.example.android.shortcutsample/com.example.android.appshortcuts.Main }/null], extras=null, iconRes=2130837504[drawable/add], bitmapPath=null}
ShortcutInfo {id=http://www.android.com, flags=0x85 [DIrSr], packageName=com.example.android.shortcutsample, activity=ComponentInfo{com.example.android.shortcutsample/com.example.android.appshortcuts.Main}, shortLabel=www.android.com, resId=0[null], longLabel=http://www.android.com, resId=0[null], disabledMessage=null, resId=0[null], categories=null, icon=null, rank=0, timestamp=1477132350808, intents=[Intent { act=android.intent.action.VIEW dat=http://www.android.com/… }/null], extras=PersistableBundle[{com.example.android.shortcutsample.EXTRA_LAST_REFRESH=1477131998183}], iconRes=2130837505[drawable/link], bitmapPath=null}
Total bitmap size: 0 (0 B)
アプリが登録しているショートカット情報の詳細を確認できる.
UID state:
:
UID=10071 state=16 last FG=715122
各アプリの状態についても確認できる.
以上.