前言
曾几何时,我也喜欢嘟嘟桌面,奈何嘟嘟桌面越来越卡,奈何车机性能的限制,也只能在原厂桌面上想办法
总说周知,原厂桌面只能显示应用商店安装过的应用,然而应用商店无法实现个性化,搜,只能反编译看看原厂桌面的代码查找突破口
干正事
(此处省略大部分代码,惋惜我的头发)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
| #用户安装的app 控制显示 .field private static final SP1_NAME:Ljava/lang/String; = "userappicon" #系统版本号 .field private static final SPFORVERSION_NAME:Ljava/lang/String; = "systemversion" #系统通知 .field private static final SP_NAME:Ljava/lang/String; = "notification" #添加可显示在桌面上的包名 .method public addUserAppIcon(Ljava/lang/String;Z)V .locals 1 .param p1, "packageName" # Ljava/lang/String; .param p2, "exsist" # Z
.line 56 sget-object v0, Lcom/gaei/launcher/SharedPreferencesHelper;->editor1:Landroid/content/SharedPreferences$Editor;
invoke-interface {v0, p1, p2}, Landroid/content/SharedPreferences$Editor;->putBoolean(Ljava/lang/String;Z)Landroid/content/SharedPreferences$Editor;
.line 57 sget-object v0, Lcom/gaei/launcher/SharedPreferencesHelper;->editor1:Landroid/content/SharedPreferences$Editor;
invoke-interface {v0}, Landroid/content/SharedPreferences$Editor;->commit()Z
.line 58 return-void .end method
#判断包名是否存在于配置中 .method public getAppIsExsisted(Ljava/lang/String;)Z .locals 3 .param p1, "packageName" # Ljava/lang/String;
.line 77 const/4 v0, 0x0
.line 78 .local v0, "isExsisted":Z sget-object v1, Lcom/gaei/launcher/SharedPreferencesHelper;->sp1:Landroid/content/SharedPreferences;
if-eqz v1, :cond_0
.line 79 sget-object v1, Lcom/gaei/launcher/SharedPreferencesHelper;->sp1:Landroid/content/SharedPreferences;
const/4 v2, 0x0
invoke-interface {v1, p1, v2}, Landroid/content/SharedPreferences;->getBoolean(Ljava/lang/String;Z)Z
move-result v0
.line 81 :cond_0 return v0 .end method
#从配置中移除包名 .method public removeUserAppIcon(Ljava/lang/String;)V .locals 1 .param p1, "packageName" # Ljava/lang/String;
.line 108 sget-object v0, Lcom/gaei/launcher/SharedPreferencesHelper;->editor1:Landroid/content/SharedPreferences$Editor;
invoke-interface {v0, p1}, Landroid/content/SharedPreferences$Editor;->remove(Ljava/lang/String;)Landroid/content/SharedPreferences$Editor;
.line 109 sget-object v0, Lcom/gaei/launcher/SharedPreferencesHelper;->editor1:Landroid/content/SharedPreferences$Editor;
invoke-interface {v0}, Landroid/content/SharedPreferences$Editor;->commit()Z
.line 110 return-void .end method
|
主要方法为getAppIsExsisted和removeUserAppIcon
getAppIsExsisted中会返回true/false表示是否存在,此处需要修改返回值,让其永恒返回成true
removeUserAppIcon则删除配置,此处我们把方法体内的代码去掉即可
重新打包签名后即可安装
探索其他方式
有人会说,我喜欢原汁原味的,我不想动原厂的桌面,有没有其他办法实现呢?其实是有的
通过上面反编译后得知,控制应用显示的配置其实是userappicon,那么我们可以通过外挂app的方式进行控制
外挂app核心代码:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
| try { Context launcherContext = null; try { launcherContext = createPackageContext("com.gaei.launcher", Context.CONTEXT_IGNORE_SECURITY); } catch (PackageManager.NameNotFoundException e) { e.printStackTrace(); Toast.makeText(getApplicationContext(), "无法获取launcherContext"+e.getMessage(), Toast.LENGTH_LONG).show(); return; } SharedPreferences sharedPreferences = launcherContext.getSharedPreferences("userappicon", Context.MODE_WORLD_WRITEABLE);
if (sharedPreferences!=null) { Toast.makeText(getApplicationContext(), "成功读取!!", Toast.LENGTH_LONG).show();
SharedPreferences.Editor userAppIconEdit = sharedPreferences.edit(); userAppIconEdit.putBoolean("com.chenmo.gaei.box", true); userAppIconEdit.apply(); Toast.makeText(getApplicationContext(), "添加成功",Toast.LENGTH_LONG).show(); }
}catch (Exception ex) { Toast.makeText(getApplicationContext(), "无法获取launcherContext"+ex.getMessage(), Toast.LENGTH_LONG).show(); }
|
下载与安装、卸载
- 安装了破解版的应用商店可直接在应用商店更新 原厂桌面
- 安装有RE之类管理器的,可直接下载apk进行安装 下载
- 未安装RE类管理器的,请联系我提供代理进行安装
卸载
设置->车辆信息(长按)->应用->应用商店/系统更新/启动器->卸载更新