简体   繁体   English

如何使用adb shell为Trebuchet启动器设置默认应用程序?

[英]How to set the default app for Trebuchet launcher using adb shell?

I need to set the default application to be launched when clicking the home button. 我需要设置单击主页按钮时要启动的默认应用程序。 Currently I am doing that by selecting the application in the Trebuchet launcher and clicking "Always". 目前,我通过在Trebuchet启动器中选择应用程序并单击“始终”来执行此操作。 But in my case I need to do that using the shell, since I only have remote access the device using SSH. 但在我的情况下,我需要使用shell,因为我只能使用SSH远程访问设备。 Does anyone knows in which file or database the information is stored? 有谁知道信息存储在哪个文件或数据库中?

Preferred apps are stored in 首选应用程序存储在

/data/system/users/0/package-restrictions.xml /data/system/users/0/package-restrictions.xml

Update this file to set default applications as you need. 更新此文件以根据需要设置默认应用程序。 Remember to reboot afterwards to apply the new settings. 请记住之后重新启动以应用新设置。

It's also worth mentioning that the file seems to be always opened and modified by android on boot, so better check after change and reboot that your settings are still there as it might not always be the case (If there is an error for example). 还值得一提的是,该文件似乎总是由android在启动时打开和修改,因此更好地检查更改后重新启动您的设置仍然存在,因为它可能并非总是如此(例如,如果有错误)。

Also if you set an app as default for some intent and this app crashes, you have to change that XML file again to restore your settings as android would automatically unset an app as default if it crashed. 此外,如果您将应用程序设置为某些意图的默认设置并且此应用程序崩溃,您必须再次更改该XML文件以恢复您的设置,因为如果崩溃,安卓会自动取消将应用程序设置为默认设置。

Source 资源

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM