android tv 模拟器默认桌面修改 Alternate Launcher开机自动启动app

搞了个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
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 214,444评论 6 496
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 91,421评论 3 389
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 160,036评论 0 349
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 57,363评论 1 288
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 66,460评论 6 386
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 50,502评论 1 292
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 39,511评论 3 412
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 38,280评论 0 270
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 44,736评论 1 307
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 37,014评论 2 328
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 39,190评论 1 342
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 34,848评论 5 338
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 40,531评论 3 322
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 31,159评论 0 21
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 32,411评论 1 268
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 47,067评论 2 365
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 44,078评论 2 352

推荐阅读更多精彩内容