1

Where I can find factory home screen layout file?

I would like modify default layout which will persist after I will make a hard reset.

Best

Edit

device: Lenovo A6000, kitkat 4.4.4

rom: orignal stok rom from Lenovo

home screen launcher: LenovoLauncher com.lenovo.xlauncher

| improve this question | | | | |
  • Great, thanks! What I forgot to ask for: the device is rooted, right? Without root, chances are zero, as you will have to modify "system stuff" (most likely the .apk file of the launcher residing in /system/app – but that part I better leave to those with better expertise than I have). – Izzy Jul 19 '15 at 22:20
  • @Izzy so default layout is hardcoded into .apk??? yes I 'm root – usil Jul 19 '15 at 22:45
  • 1
    It's not exactly my area of expertise (I'm not a dev), but that's the only place making sense to me, for several reasons: 1) launchers are replaceable, so while possible it doesn't make much sense to spread the information across the system; 2) on init, /data/data/<package_name> will be created – but a factory reset will remove that again. So where shall it come from? A launcher is a "regular app", even if installed as system app. I wouldn't want that to "mingle" with other OS components. – Izzy Jul 19 '15 at 22:52
  • 1
    @Izzy Good pointer! I extended the theory based on it with a bit of backing from here and there in my answer.- – Firelord Jul 21 '15 at 6:41
  • 1
    Well done, @Firelord (+1 on both ends). That said, we're going "border-line" now – so, lobi, asking how to change that would most likely go beyond this site's scope – unless you only intend to re-populate that database, which should count as power-user part. Though I rather guess with knowing where it is, you're able to figure the rest :) – Izzy Jul 21 '15 at 7:03
4

Izzy opined it correctly here that the only sensible place for having factory home screen layout is the launcher's APK itself.

Since I don't own a Lenovo device let alone your specific model I used my MTK device running stock 4.2.1 as the testing ground. It has stock launcher (com.android.launcher).

About that thing called factory home screen layout -- a launcher usually has one or more databases inside its /data/data/.. directory, and one of that database has a table named favorites (name could differ among launchers but the idea is same). (See my answer for How can I manage “desktop” icons to know what I'm talking about.)

The default setting that you see is nothing but code in the APK creating database(s) from scratch and populating the favorites table with hard-coded entries (like "Contacts", "Phone", "Messages", "Chrome" at the dock).

E.g. See this code snippet from the source code of com.android.launcher:

enter image description here

The code is available here. If you look closely at few lines above the line 262, you would see that the code is creating a new database with proper schema and then populating the database with favorites table which is available to it.

At this point, I didn't bother digging more to know, where does this favorites table or the related content is saved, since my conclusion is drawn from custom launchers as well who also have a different but a factory layout (clearly not saved outside the APK).

I would recommend taking a look at the source code (provided that you can find it first) of your default launcher, or extract the APK and dig under res folder. I found some interesting stuff under res/xml/.


Oh, if someone wants to experiment on OP's question then I suggest you do Clear Data from Settings → Apps → All apps → <Your Launcher> since it would have the same effect as doing a factory reset (not Hard reset).

| improve this answer | | | | |
  • Thanks for answer. I tried to decompile Lenovo Launcher.apk, but problem is that when I recompile it, it stop working properly. When I decompile it. I found this assets/profile/app_config.xml paste.ubuntu.com/11913136 I decopile and recompile with apktool and with apkstudio which is GUI for apktool. – usil Jul 21 '15 at 7:56
  • Sorry lobi, I'm not really familiar with decompiling and recompiling of APKs. Can't be of any help here. May be you can try posting a new question in that regard. – Firelord Jul 21 '15 at 8:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.