android tv 模拟器默认桌面修改 Alternate L
搞了个android tv盒子,想修改默认的launcher桌面,网上搜了好几天,没有成功。即使设置了如下默认开机launcher在android tv系统中也不会出来选择开启哪个launcher的选择框,可能android tv 系统跟android 系统还不太一样啊。
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LEANBACK_LAUNCHER" />
<category android:name="android.intent.category.LAUNCHER_APP" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.MONKEY" />
</intent-filter>
于是乎就在网上到处搜方法,还真搜到了一个在模拟器上成功替换默认桌面的方法。
我的模拟器android 版本是 api level 26 应该是android tv 8.0
Name: Android_TV_1080p_API_26
CPU/ABI: Android TV Intel Atom (x86)
Path: C:\Users\root\.android\avd\Android_TV_1080p_API_26.avd
Target: android-tv [Android TV] (API level 26)
呃,要进行替换首先模拟器上要有root权限。但是因为android 7.0之后的模拟器都默认没有root权限了。需要这样再命令行启动模拟器。找到自己的模拟器目录:
C:\Users\root\AppData\Local\Android\Sdk\emulator>emulator -avd Android_TV_1080p_API_26 -writable-system
模拟器起来后,执行adb shell,提示符是$,表示没有root权限,然后su,提示符变成#,获取到root权限。
执行 pm disable-user --user 0 com.google.android.tvlauncher ,禁用google默认的android tv 桌面。执行之前一定要先安装自己的有 android.intent.category.HOME android.intent.category.LAUNCHER android.intent.category.DEFAULT 的app 哦
C:\Users\root>adb shell
generic_x86:/ $ su
generic_x86:/ # pm disable-user --user 0 com.google.android.tvlauncher
Package com.google.android.tvlauncher new state: disabled-user
之后冷重新启动模拟器,你就会发现开机后的桌面变成了自己的app啦。
有空试试我的android tv 机顶盒,看看行不行。
关于不同android tv 版本禁用 google默认 launcher的命令如下,自己多试试,版本对应不一定对,原帖地址是:Alternate Launcher (No Root) on Marshmallow, Nougat, Oreo, Pie Info,为了方便我把内容转过来:
Connect your Shield TV via USB to mini USB with PC, For the 2017 Shield Model please look below for connection info.
Leave the Shield plugged in and turned on as the way u usually use it connected to tv open command prompt (Minimal ADB and Fastboot ) on PC and type adb devices the PC will try to connect with Shield TV via USB. A message will pop up on the tv requesting permission for that device. Confirm that message with the controller or other device you use [mouse](http://i.viglink.com/?key=d2e43d31777d6249cc7d4a64dada8bca&insertId=68ffc0fd4e078f69&type=CD&exp=60%3ACI1C55A%3A5&libId=k4ejna3j01000n4o000DA66a8smwytd8p&loc=https%3A%2F%2Fforum.xda-developers.com%2Fshield-tv%2Fthemes-apps%2Falternate-launcher-root-marshmallow-t3359076&v=1&iid=68ffc0fd4e078f69&opt=true&out=http%3A%2F%2Fwww.ebay.com%2Fsch%2Fi.html%3F_nkw%3Dmouse&title=Alternate%20Launcher%20(No%20Root)%20on%20Marshmallow%2C%E2%80%A6%20%7C%20nVidia%20Shield%20Android%20TV&txt=%3Cspan%3Emouse%3C%2Fspan%3E), remote etc.
Type in the command prompt
adb shell
pm hide com.google.android.leanbacklauncher
To undo this
adb shell
pm unhide com.google.android.leanbacklauncher
This will make the new launcher the default as it hides the leanback
(Commands are different for the Nougat build see Update below)
Also If this is needed because you cannot get into settings on your device afterwards I have attached a copy of the shields setting apk file that I got off the nvidia site just install it as you would any other apk and all is fine access all settings etc.
This should work fine with any launcher that is setup as a Home Launcher please make sure you have a launcher that works and is what u need/want and that it is indeed set up and set as Home launcher.
**UPDATE** : For Shields running Nougat build
This is for Nougat NON Rooted shields, This also works on the 2015 model.
For Nvidia Shield 2017 Model Please follow the updated instructions After you have set up minimal adb and fast boot on PC.
First get a Type-A to Type-A USB cable or an [adapter](http://i.viglink.com/?key=d2e43d31777d6249cc7d4a64dada8bca&insertId=b074541887ac4ffb&type=CD&exp=60%3ACI1C55A%3A5&libId=k4ejna3j01000n4o000DA66a8smwytd8p&loc=https%3A%2F%2Fforum.xda-developers.com%2Fshield-tv%2Fthemes-apps%2Falternate-launcher-root-marshmallow-t3359076&v=1&iid=b074541887ac4ffb&opt=true&out=http%3A%2F%2Fwww.ebay.com%2Fsch%2Fi.html%3F_nkw%3Dadapter&title=Alternate%20Launcher%20(No%20Root)%20on%20Marshmallow%2C%E2%80%A6%20%7C%20nVidia%20Shield%20Android%20TV&txt=%3Cspan%3Eadapter%3C%2Fspan%3E) that makes micro usb to Type-A
Use the Usb port furthest away from the Hdmi Port On The Shield TV
Select Usb device mode In Settings
Select Settings--Storage and Reset -- Using Usb (for Mtp)
Select Settings--About--Build-- Press Build 8 times to enable Developer mode then
Select Settings--Developer Options--Usb debugging (For adb)
Then
Type in the command prompt:
adb shell
pm uninstall -k --user 0 com.google.android.leanbacklauncher
This should work fine with any launcher that is setup as a Home Launcher please make sure you have a launcher that works and is what u need/want and that it is indeed set up and set as Home launcher.
**UPDATE**: OREO Here are the new commands for the Oreo update
Type in the command prompt:
adb shell
pm uninstall -k --user 0 com.google.android.leanbacklauncher
and
pm uninstall -k --user 0 com.google.android.tvlauncher
This will uninstall the Default launcher on non-rooted shields please make sure you have a functional launcher, set as Home launcher before doing this.
**UPDATE:** Pie (8-3-2019) To enable adb debugging on Pie go to Settings -- device preferences -- about then scroll down to build select and click it until developer mode is enabled.
To Disable the New Pie Launcher use this command
adb shell
pm disable-user --user 0 com.google.android.tvlauncher
呃。。。。恢复原有桌面。。。。
C:\Users\root>adb shell
generic_x86:/ $ su
generic_x86:/ # pm enable --user 0 com.google.android.tvlauncher
Package com.google.android.tvlauncher new state: enabled