更新信息 | 时间 |
---|---|
《记一次还未成功的反编译锤子桌面APP》 | 20171129 |
暴力替换数据库更新item信息 | 20171201 |
暴力替换数据库更新item信息
在之前的分析过程中得知,只要更新数据库的数据,其中设置messageNumber就是角标数,那现在直接取出laucher.db然后手动更新它再替换回去。看是不是会有效果
工具 | 版本 |
---|---|
谷歌N6 | 7.0.1 |
smartisan_launcher_v1.5.1.apk | 1.5.1 |
Navicat Premium | 11.1.13 |
一、导出launcher.db数据库
1.文件存在/data/data/com.smartisans.home/databases/launcher.db,将其导出至电脑(需要root)。
2.修改表(table_iteminfos)中的数据,将其改为你想要的数字,然后重新将launcher.db保存,导入手机重新替换原来的db文件。
3.打开锤子桌面即可看到效果了~
《记一次还未成功的反编译锤子桌面APP》
锤子科技很早就已经发布了“锤子桌面”这款APP,我反编译这个APP源于“角标”适配。锤子除了系统APP有角标之外,单独为微信、应用宝适配了角标。太讨厌了。本次反编译没有取得实质的成果,如果想要成果的可以不用往下看了。
一、工具列表
名称 | 版本 | 下载链接 |
---|---|---|
smartisan_launcher_v1.5.1.apk | 1.5.1 | 官方 |
apktool_2.3.0.jar | 2.3.0 | 官方 |
dex2jar | 2.0 | 官方 |
二、开始反编译
1.使用apktool反编译,直接报错,但是会反编译好AndroidManifest.xml文件,这样可以看到一些静态注册的广播。优先找静态注册的广播是因为多数机型角标的原理是发送广播,由launcher程序接收并更新icon。
2.直接搜索“receiver”关键词查找静态注册的广播,找到两个广播:
<receiver android:name="com.smartisanos.launcher.receiver.LauncherReceiver">
<intent-filter>
<action android:name="android.intent.action.EXTERNAL_APPLICATIONS_AVAILABLE"/>
<action android:name="android.intent.action.EXTERNAL_APPLICATIONS_UNAVAILABLE"/>
</intent-filter>
<intent-filter>
<action android:name="com.android.launcher.action.INSTALL_SHORTCUT"/>
<action android:name="com.smartisanos.launcher.shortcut_removed"/>
</intent-filter>
<intent-filter>
<action android:name="smartisan.intent.action.LAUNCHER_SETTINGS_CHANGED"/>
</intent-filter>
<intent-filter>
<action android:name="com.smartisanos.launcher.update_icon"/>
</intent-filter>
<intent-filter>
<action android:name="com.smartisanos.launcher.SORT_ICON"/>
</intent-filter>
<intent-filter>
<action android:name="com.smartisanos.COLOR_THEME_CHANGED"/>
</intent-filter>
<intent-filter>
<action android:name="com.smartisan.push.MESSAGE_RECEIVE"/>
<data android:mimeType="vnd.com.smartisanos.launcher/*"/>
</intent-filter>
<intent-filter>
<action android:name="com.android.providers.downloads.ACTION_SYNC_DATA_FINISH"/>
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.DOWNLOAD_COMPLETE"/>
</intent-filter>
<intent-filter>
<action android:name="smartisan.alarm.upload.tracker"/>
</intent-filter>
</receiver>
<receiver android:name="com.smartisanos.launcher.receiver.DataDumpReceiver">
<intent-filter>
<action android:name="com.smartisanos.launcher.datadump"/>
<action android:name="launcher.dumpsurfaceview"/>
</intent-filter>
</receiver>
3.解压apk文件,获取class.dex文件,利用dex2jar反编译为jar包,再利用jd-gui查看源码。首先一点就是直接找上述两个广播。只有LauncherReceiver.java有内容,那就只能看它了。
三、尝试调试源码
1.首先找到了比较显眼的ShortCut相关action,这些快捷方式的action也许比较容易有突破口。
2.com.android.launcher.action.INSTALL_SHORTCUT
广播,发现传入的参数会进行一些判断,重要的是判断包名,如果包名是支持的,才会继续往下执行。
接着可以看到,如果是系统APP或者是微信都支持。
发送广播后,Logcat看到输出一些日志:
11-28 23:04:19.729 8884-8884/? E/NewLauncher: ShortcutAction : handleInstallShortcut [微信]
11-28 23:04:19.729 8884-8884/? E/NewLauncher: ShortcutAction : lunch intent [#Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x10000000;package=com.tencent.mm;component=com.tencent.mm/.MainActivity;end]
11-28 23:04:19.729 8884-8884/? E/NewLauncher: Utils : DEBUG : drawableToBitmapWithoutShadow return null by drawable is null
11-28 23:04:19.729 8884-8884/? E/NewLauncher: Utils : isDoubleOpenApp() pkg = com.tencent.mm this is not a doubleApp
11-28 23:04:19.750 8884-9144/? E/NewLauncher: DatabaseHandler : origImg is null, [com.tencent.mm]
11-28 23:04:19.750 8884-9144/? E/NewLauncher: Utils : generateShortcutIcon return null, by src is null
11-28 23:04:19.750 8884-9144/? E/NewLauncher: DatabaseHandler : generateShortcutIcon return null
最后系统会Toast提示“已添加”,然后没有然后了~~
3.com.android.launcher.action.UNINSTALL_SHORTCUT
广播,发送后是不是删除掉快捷方式呢?
发送广播后,Logcat看到输出一些日志
11-28 23:19:24.273 8884-9144/? W/System.err: java.lang.ClassCastException: java.lang.String cannot be cast to com.smartisanos.launcher.data.ShortcutInfo
11-28 23:19:24.273 8884-9144/? W/System.err: at com.smartisanos.launcher.data.DatabaseHandler.handleEventUninstallShortcut(DatabaseHandler.java:3522)
11-28 23:19:24.273 8884-9144/? W/System.err: at com.smartisanos.launcher.data.DatabaseHandler.run(DatabaseHandler.java:533)
11-28 23:19:24.273 8884-9144/? W/System.err: at com.smartisanos.launcher.data.DatabaseHandler.-wrap2(DatabaseHandler.java)
11-28 23:19:24.273 8884-9144/? W/System.err: at com.smartisanos.launcher.data.DatabaseHandler$1.handleMessage(DatabaseHandler.java:124)
11-28 23:19:24.273 8884-9144/? W/System.err: at android.os.Handler.dispatchMessage(Handler.java:102)
11-28 23:19:24.273 8884-9144/? W/System.err: at android.os.Looper.loop(Looper.java:154)
11-28 23:19:24.273 8884-9144/? W/System.err: at android.os.HandlerThread.run(HandlerThread.java:61)
11-28 23:19:24.274 8884-9144/? E/NewLauncher: DatabaseHandler : handleEventUninstallShortcut return by shortcut is null
因为DatabaseHandler.java没有内容,又一次然后没有然后~~
4.com.smartisanos.launcher.update_icon
广播,发送广播后,没有日志输出,也是没有然后,应该是组装的数据JSON格式有问题。
5.com.smartisan.push.MESSAGE_RECEIVE
广播,在AndroidManifest.xml中显示需要设置Type,但是发送广播未有日志,没有然后~~
四、最后
如果能找到方法更新这条数据也许会有进展:
11-29 00:16:46.488 8884-9142/? E/NewLauncher: Cell : ### set item info. setItemInfo(). pid = [3] cid = [4] fid = [-1] id = [68] itemType = [0] userId = [-1] messagesNumber = [0] title = [内涵段子] packageName = [com.ss.android.essay.joke] componentName = [com.ss.android.essay.joke.activity.SplashActivity] isSystemApp = [false] isNewlyInstalled = [false] isNeedDowload = [false] downloadId = [-1]
其中messageNumber就是角标的消息数。