yashsingh1/xdaforums huggingface dataset:
[Moto G 4G Android Development] redavenger:
yep done that, even cleared cache twice and installed twice but still have the crashes, so can not launch dialer or messenging
[Moto G 4G Android Development] lost101:
These are from the XT1039 Retail EU 5.1 Firmware:

Dialer: http://xdaforums.com/devdb/project/dl/?id=16632

Messenger: http://xdaforums.com/devdb/project/dl/?id=16631​

Maybe you need the Dialer / Messenger for your specific firmware. If this also crashes, let me know which specific ROM you are using.
[Moto G 4G Android Development] wurstel:
Hi [MENTION=1006674]lost101[/MENTION] it would be awesome if you made a flashable zip for the latest (17.6) Europe retail, since it has all the security fixes. Thanks a lot for your work.
[Moto G 4G Android Development] jccz:
Agree :)
[Moto G 4G Android Development] Brotherofsun:
It is not 23.26.6.en.EU rather?
[Moto G 4G Android Development] wurstel:
XT1039_PEREGRINE_RETEU_5.1_LPB23.13-17.6_cid7
[Moto G 4G Android Development] Kong2000:
This is the same. First is system version and second is build number.

Not to forget the new radio firmware.
[Moto G 4G Android Development] lost101:
Right now I'm preparing a new method of flashing ROMs. I will build some new ROMs when I manage to sort that out, but it takes time. Maybe this weekend I will make substantial progress.
[Moto G 4G Android Development] lost101:
[MENTION=6788745]minimale_ldz[/MENTION] - I'm sure people would be glad to see you release this ROM. You are welcome to a start a new thread if you want to do so.
[Moto G 4G Android Development] minimale_ldz:
Thanks. I'm currently making all the changes very carefully as I'm using Peregrine as a daily driver that wakes me up every morning for work, so keeping it stable is an absolute priority ;) So far I only added a couple of apps to it as it comes with no file explorer nor web browser, so going to Play Store is the very first step you need to make to personalize it, and that's the thing I wanted to avoid. I'd like to clean the ROM before installation (remove all the services I listed in previous post, so I don't have to disable them manually), but I don't really know how things work and if simply removing them from "app" or "priv-app" folder is enough. I also don't have any idea how zipaligning work - is it enough to add or remove entries in system/usr/zipalign file to make things work?
[Moto G 4G Android Development] lost101:
Removing folders from "app" and "priv-app" should be enough to disable a service. The zipalign script is in /etc/init.d/ - what is it you want it to do / not do?
[Moto G 4G Android Development] minimale_ldz:
I just want to keep the rom clear, without any unnecessary entries/files and to maintain zipaligning for all apps if possible. So is it enogh to remove an app from "app"/"priv-app" folder and its entry from zipaligh script or is it mentioned somewhere else in the system? And is it enough to add an app to "app"/" priv-app" folder and add its path to zipalign script to make everything work? [Plus -what's the difference between "app" and "priv-app"? Apps added to both locations are considered system apps and unremovable (uninstallable even with Titanium Backup)?]. Thanks
[Moto G 4G Android Development] lost101:
The zipalign script simply scans "app" and "priv-app" for new folders/apks and zipaligns them. The database is stored in /usr/zipalign.db. You don't need to touch either script or database. Just delete folders and forget about zipaligning, it's all automatic.

'app' tends to be more added extras, whereas 'priv-app' is essential system apps / services. It's not really that clean cut as you can see by the contents of each folder - 'app' contains 'Bluetooth' for instance.
[Moto G 4G Android Development] _that:
All properly built apps are zipaligned anyway, AFAIK the Play store even refuses apps that are not.

priv-app contains "privileged" apps, those get more permissions. Apps in "app" are simply bundled with the ROM but they don't get system permissions.
[Moto G 4G Android Development] minimale_ldz:
[MENTION=1006674]lost101[/MENTION]

Feeling brave I removed the following:

From system/app:

1. atfwd

2. BasicDreams

3. com.motorola.android.settings.diag_mdlog

4. Exchange2

5. FaceLock

6. FMRadioService

7. FMRecordService

8. GoogleContactsSyncAdapter

9. HoloSpiralWallpaper

10. LiveWallpapers

11. LiveWallpapersPicker

12. NoiseField

13. PartnerBookmarksProvider

14. PhaseBeam

15. PhotoTable

16. PrintSpooler

17. SoundRecorder

18. UserDictionaryProvider

19. VisualisationWallpaper

From system/priv-app:

1. AudioEffects

2. BackupRestoreConfirmation

3. ContextEngineClient

4. CQATest

5. Email

6. EmaraPhoneExtns

7. GmsCore

8. GoogleBackupTransport

9. GoogleFeedback

10. GoogleLoginService

11. GooglePartnerSetup

12. GoogleServicesFramework

13. Moodles

14. MotCamera

15. MotoOneTimeInitializer

16. MotorolaSettingsProvider

17. Phonesky

18. PreloadContacts

My device won't boot after flashing cleaned ROM. It stucks on Android logo. What could've gone wrong?
[Moto G 4G Android Development] lost101:
I have tried unsuccessfully to bypass setup screens before. Either some or all items in bold are required. Maybe start by restoring 'MotoOneTimeInitializer.'
[Moto G 4G Android Development] minimale_ldz:
[MENTION=1006674]lost101[/MENTION]

I'm afraid you were right about all the items in bold. I was adding them to the ROM one by one and it didn't even start until I added MotoOneTimeInitializer, MotorolaSettingsProvider and GoogleOneTimeInitializer (that I missed on my list). However the initial setup kept stucking on "checking connection" screen after connecting to the wifi network ("skip" button was greyed out when I removed sim card, but even on mobile data it didn't move on). The system started properly after I restored the following:

1. GmsCore

2. GoogleLoginService

3. GoogleOneTimeInitializer

4. GooglePartnerSetup

5. GoogleServicesFramework

6. MotoOneTimeInitializer

7. MotorolaSettingsProvider
[Moto G 4G Android Development] redavenger:
lost have you had time to figure out the issue with the motorola gallery app? why it crashes?

i personally prefer it than the one you have in the optimized package.
[Moto G 4G Android Development] lost101:
As previously mentioned, I'm working on a new way of creating and installing these ROMs. That may resolve the issue.
[Moto G 4G Android Development] redavenger:
Cool bananas. Also with that launcher that you put in there is there a way of changing the home screen icons to the same size and font and spacing as stock launcher/rom
[Moto G 4G Android Development] lost101:
Long-press on homescreen > Swipe three dots up > Swipe up again for more settings. It's only a basic launcher to keep ROM zip size low. Change to something else if it doesn't meet your needs.
[Moto G 4G Android Development] jccz:
Launcher is fine. My only wishlist item is faster (sec) update, so thx for working on it!
[Moto G 4G Android Development] minimale_ldz:
[MENTION=1006674]lost101[/MENTION] and all

I created a new XDA thread about my little modification of your Retail EU 5.1 ROM (Optimized) v1.1 for XT1039.

Thanks for your support.
[Moto G 4G Android Development] lost101:
[MENTION=6788745]minimale_ldz[/MENTION] - Perhaps this is of interest / something you would want to implement into the ROM:

http://xdaforums.com/android/apps-games/app-microg-gmscore-floss-play-services-t3217616​
[Moto G 4G Android Development] redavenger:
bugger still having issues with the stock xt1039 dialer and messenging. still crashes when loading lollipop and when trying to open it

could it have anything to do with the launcher?
[Moto G 4G Android Development] lost101:
It's more likely that either (a) the flashable zip is not deleting the existing files before adding the new ones, or (b) you need the specific files from the untouched ROM that matches your current firmware.
[Moto G 4G Android Development] facundosalas:
cannot change the launcher with optimiized version?
[Moto G 4G Android Development] pio80:
Hi,

Are You going to prepare pure, optimized Motorola stock from titan source?

We look forward to the information[emoji2]

Regards
[Moto G 4G Android Development] lost101:
No. 'Titan' doesn't support LTE / 4G. A 'Thea' Stock MM ROM on the other hand will be ported. Hopefully.
[Moto G 4G Android Development] mooms:
[MENTION=1006674]lost101[/MENTION]:

Are you going to update the XT 1039 ROMS based on the latest build ?

This build have the Stagefright vulnerabilities patched, and also a new modem.

Old baseband: M8926_309101.02.03.14R

New baseband: M8926_309101.02.03.14.01R

ROM: XT1039_PEREGRINE_RETEU_5.1_LPB23.13-17.6_cid7

MODEM: XT1039_Retail_EU_5.1_Radio-new.zip
[Moto G 4G Android Development] lost101:
[MENTION=5561802]mooms[/MENTION] - I've already explained the situation above.

http://xdaforums.com/showpost.php?p=65155838&postcount=826​

I'm working on the project again today. There have been many obstacles, but I believe in the end this new method will be worth it.
[Moto G 4G Android Development] mooms:
OK thanks for the info.
[Moto G 4G Android Development] fonz93:
Motorola gallery depends on a Motorola service that has been removed in optimized ROMs, you need to find out which one and restore it, a friend is using a modded stock ROM by me (with all the Motorola apps updated in /system), he tried to disable every Motorola app and he got that Gallery issue, after renabling all the apps the issue is gone. So i am pretty sure that restoring the dependency will fix the FC's
[Moto G 4G Android Development] lost101:
My observation has been with a certain version of Motorola Gallery, the crashing began. The Falcon GPE ROM has no Motorola services and the Gallery did not crash until an updated version arrived. Perhaps you are correct and the app

does now

depend on the presence of a specific service.

EDIT #1: If I recall correctly, Motorola Gallery was also crashing in the Untouched ROM.

EDIT #2: Good news, I just got my first ROM to boot using the new creation method.
[Moto G 4G Android Development] jccz:
Hip hip hurah :)
[Moto G 4G Android Development] fonz93:
Yes, at some point they made the app dependent to one of the Motorola services, i am sure 100% that on untouched ROMs the gallery works fine, because as i said, a friend of mine is using a ROM where i updated all the apps in /system (including the Moto gallery) and it works perfectly if you don't disable any Motorola service.

If you got any report about gallery crash on untouched ROMs, it's probably because the users disabled or deleted the crucial service/s on their own.
[Moto G 4G Android Development] PremiumMediocre:
Encryption

I've tried with both the optimized and the untouched EU ones. But when I try to encrypt the phone all I get is a soft reboot. Any ideas why it doesn't work?
[Moto G 4G Android Development] lost101:
Have you followed the flashing instructions in first post - exactly?
[Moto G 4G Android Development] PremiumMediocre:
Yes, I did, by the letter. I even tried two recoveries. Both the TWRP-v2.8.7.0 and the 3.0 found in another thread.
[Moto G 4G Android Development] mooms:
Gallery don't crash anymore with the latest stock 5.1 (I have removed nearly all Motorola services and apps with TB).
[Moto G 4G Android Development] lost101:
Are you rooting the ROM? An unrooted 'Untouched' ROM should have functional Encryption support.
[Moto G 4G Android Development] PremiumMediocre:
I tried it on the untouched ROM with no root. In any case I think I know a bit more about what the problem is after I did a logcat.

Even though we are using stock, I have the same problem as this guy has: http://vogelchr.blogspot.se/2015/08/full-disk-encryption-with-cyanogenmod.html

The pertinent part being:

"On android, the footer that tells the operating system that an partition is encrypted resides on the end of the filesystem and it needs a little space between the logical end of the filesystem in a partition, and the physical end of the partition to be squeezed in when converting a phone from unencrypted to encrypted."

Do you think it would be possible to alter your zips in such a way that it leaves that (very small) space?
[Moto G 4G Android Development] lost101:
[MENTION=4882695]PremiumMediocre[/MENTION] - I'll investigate in a few hours. Maybe something has happened to your partition table - gpt.bin is included as part of the firmware image.
[Moto G 4G Android Development] PremiumMediocre:
That would be great, thx
[Moto G 4G Android Development] jccz:
And rooted optimized?
[Moto G 4G Android Development] baxtex:
I made a TWRP backup beacuse I wanted to test another rom. When I restored the backup my wifi didn't work anymore, no matter how much i cleared settings etc, now have to do a full reinstall.
[Moto G 4G Android Development] lost101:
Yes.

I've had this happen with certain versions of TWRP that did not fully support Lollipop. One workaround might be to move the backup off internal storage, wipe /data (userdata) and then restore the backup.

Edit: I personally use ADB Backup.
[Moto G 4G Android Development] PremiumMediocre:
Would you like a logcat of what happens when you try to encrypt? It's very similar to what that other guy experienced, but if you need it I'd be happy to post it.
[Moto G 4G Android Development] tehzaz:
Great job (everything went fine), but I still have the same problem I had on previous ROM .

While in "deep sleep" mode, the alarm doesn't go off sometimes.

When opening the official case, I see an incorrect time (some hours before), then after 1-2 seconds, the correct time is displayed.

I think that somewhere in the night, the system enters into a "deep sleep mode", even turning off the system clock.

It seems that I'm not alone with this problem, but I hoped this optimized ROMs could work.

I have no task killer, I tried different Alarm apps, cache and factory reset...

Anyway, thanks for your work.
[Moto G 4G Android Development] lost101:
I did look into this. If encryption is not working with the Untouched ROM, the issue must be partition related. The ROM has not been modified. I suggest you flash the factory firmware image and test encryption there. You should find encryption will then work with the Untouched ROM, and possibly the Optimized ROM.

Factory Firmware Images: http://xdaforums.com/moto-g/general/index-moto-g-falcon-factory-firmware-t3110795

Formatting /data (userdata) is a key step outlined in OP. Have you done this?
[Moto G 4G Android Development] minimale_ldz:
I found the way around setup screen (build.prop > "ro.setupwizard.mode=OPTIONAL" change to DISABLED), but it looks like Android starts with Home Button, Quick Settings in notifications and Settings button next to user avatar (top right corner) disabled and Setup Wizard somehow enables them all when completed. I have no idea how to fix it ATM.
[Moto G 4G Android Development] lost101:
I somehow never noticed that build.prop command. I had tried to bypass the Setup wizard by not including the apk and observed the same issue.

Edit: Try removing /system/priv-app/Trebuchet and re-adding the stock Launcher from Untouched ROM and the required system/priv-app/Velvet folder - Google Search. You may find you can now successfully bypass Setup Wizard with that build.prop edit.
[Moto G 4G Android Development] minimale_ldz:
Thanks for advice, but it didn't work. I only get the message that launcher has stopped and that's it. Notification area has no quick settings, so I guess the UI is still locked in Setup Wizard mode.

EDIT: I tried the trick again, this time with the following stuff restored:

- GmsCore

- GoogleLoginService

- GoogleOneTimeInitializer

- GooglePartnerSetup

- GoogleServicesFramework

- MotoOneTimeInitializer

- SetupWizard

- SetupWizardExt

(- StorageOptimizer which I think is irrelevant here)

I also had Launcher3 from optimized version instead of stock launcher. System started without Setup WIzard, at first Home and Recents buttons were missing but they both appeared as soon as I pressed on empty space where Home buton should be. Now I need to figure out which of the above is/are responsible for unlocking UI.
[Moto G 4G Android Development] minimale_ldz:
[MENTION=1006674]lost101[/MENTION] - looks like GmsCore, GServicesFramework, SetupWizard and SetupWizardExt is a bare minimum of GApps needed to unlock UI functions.
[Moto G 4G Android Development] lost101:
[MENTION=6788745]minimale_ldz[/MENTION] - With Stock Android 6.0, ro.setupwizard.mode=DISABLED works perfectly with no negative consequences. You may be able to go further in your project with that as a base.
[Moto G 4G Android Development] minimale_ldz:
But it's not available for XT1039, or is it?
[Moto G 4G Android Development] lost101:
Not yet, but I'm working on it.
[Moto G 4G Android Development] minimale_ldz:
:D Can't wait
[Moto G 4G Android Development] Sniper Killer:
Hello!

I lately bought Moto G 4G, and I found this ROM, exactly what I was hoping to find. As not new to android, but as new to this device, I don't know the exact steps to guarantee me a solid flashing not resulting in a bricked device. [MENTION=1006674]lost101[/MENTION] Can you help me with flashing the custom recovery. In my previous device it was easy as 123 because it had 2.3.6 android, but it seems kinda complicated on lollipop. Can i use ODIN to flash the custom recovery, as I have no idea how fastboot works (and I successfully did that to my dad's Moto G2 4G) If not, please can you give me the detailed steps on how to flash the recovery? And as the 4G model of Moto G has a sdcard, can i just put the ROM on the sdcard instead of doing that way you mentioned on the main thread? I just want to be completely sure to continue ahead because I am worried about what could really happen to this phone if i did something wrong.

Thank you!

Tedi
[Moto G 4G Android Development] lost101:
Fastboot can be dangerous if you try random commands, but if you only use those in guides - it's not complicated. I've never used Odin and did not know it could be used with Motorola devices.

All you need to do here is Unlock Bootloader and run a single fastboot command: fastboot flash recovery your_new_recovery.img

There are Moto G Fastboot video tutorials on youtube.

You can load the ROM.zip onto external SDCARD, however I still recommend formatting /data in TWRP to avoid issues.

There is a Moto G 4G FAQ here:

http://xdaforums.com/moto-g/help/rc-faq-frequently-questions-motorola-t2795336​
[Moto G 4G Android Development] Axaion:
Kind of unrelated to this specific rom, but applies to.. everything for me

For some reason i cant flash this Modem on my XT1039

I tried with fastboot, and mfastboot.. but nada it just spits errors at me and does nothing =/
[Moto G 4G Android Development] lost101:
What are the errors?
[Moto G 4G Android Development] Axaion:
Give me a sec, ill try it again in a minute

edit; CMD gives me "Error: Cannot load NON-HLOS.bin"

and Bootloader on phone says ""cmd: getvar:partition-type:modem

---------- Post added at 03:37 AM ---------- Previous post was at 03:09 AM ----------

Disregard what i said, apparently my mfastboot or adb was bugging out, like 20 reboots fixed it and it flashed.
[Moto G 4G Android Development] willowen100:
Hi

I'm having some issues with the optimised version. Safe mode won't work and neither will phone encryption. It just goes around and around on the boot screen. I did adb logcat and it did refer to something along the lines of being unable to unmount the /data partition.

Is it possible to make my own optimised version that would work with encryption? I just love how fast the phone boots and shuts down. It's just I need to encrypt the phone. Other than that, perfect.

Many thanks

Will
[Moto G 4G Android Development] george100:
Hello,

Thanks for your work [MENTION=1006674]lost101[/MENTION], I just installed XT1040 Retail Latin America Untouched version and works fine. I had issues to install it,

I was getting an error during the flash (not the one on 2nd post).

Unfortunately (or not) the flashing worked at the 5th try, when I was ready to take note of the error. But I do remember that it was Error:7 , and also that it finish the zip installation before flashing the kernel.

I used TWRP 3.0.0.0, and I thought that this was the error or perhaps an issue with the CM13 nightly I was using, but none of these were the cause.

I followed the flash instructions step by step and had the error always, tried the solution on 2nd post for the error mentioned there and didn't work.

The issue was that I was not rebooting after doing the first step:

1) Boot into latest TWRP and Format Data (Wipe > Format DATA > Yes) - This step is essential, and will wipe Internal Storage (Downloads, Music, Photos etc, **backup important files**)

I didn't notice that the message on the terminal said: You might need reboot to use /data again.

I'm adding my "do'h" here.

I did the reboot > recovery after the first step, then proceed with step 3)

3) TWRP > Wipe > Factory reset and flash ROM.

and installed perfectly. I'm adding my experience here just in case anybody else has the same problem that I had,

more "do'h" than a problem :)

Best regards!
[Moto G 4G Android Development] _ViBe_:
[MENTION=1006674]lost101[/MENTION] Very nice job with the optimized version for XT1039! Well done! Very responsive even to heavy multitasking!
[Moto G 4G Android Development] coltonbauman:
Nice rom and seems to work very well, I'm just wondering what the optimizing apps is every time i start the phone up. Should it happen every time? Is it just the way the rom works?
[Moto G 4G Android Development] lost101:
It should only happen if you have installed or updated an app since last reboot.
[Moto G 4G Android Development] Brotherofsun:
Lost, how's work on optimized patched version for XT1039? ;)
[Moto G 4G Android Development] lost101:
Surely if you care about security, you should be running Identity Crisis 6 LTE?
[Moto G 4G Android Development] _ViBe_:
[MENTION=1006674]lost101[/MENTION] Hi, I have some wakelocks with GOOGLE_C2DM do you know any workaround except Amplify?
[Moto G 4G Android Development] lost101:
Some ideas here:

http://xdaforums.com/galaxy-s2/help/how-stop-google-c2dm-t1271669​
[Moto G 4G Android Development] _ViBe_:
Just to Turn off background data and don't use anything that uses c2d? But how should I know which app uses c2d?
[Moto G 4G Android Development] lost101:
It might be worth doing a clean install as described in OP, rather than looking for other solutions.
[Moto G 4G Android Development] _ViBe_:
But I did a clean install as described in first post!

I think it is kernel related problem.
[Moto G 4G Android Development] lost101:
I linked to that thread to point out that it's something that has appeared before on other devices. You are the first person to ever mention it regarding any ROM I have worked with. That's why I want to make sure you have flashed the ROM as instructed, including doing: Wipe > Format DATA > Yes.
[Moto G 4G Android Development] _ViBe_:
Yes I did format DATA. C2DM was my problem also on cm roms. Do you know what else can cause these wakelocks? With these wakelocks I have around 3 hours SOT. What would happen if i could kill C2DM? :D It is an amazing rom anyway.
[Moto G 4G Android Development] lost101:
Are you restoring apps or settings with Titanium backup?
[Moto G 4G Android Development] _ViBe_:
No no no. Pure clean install. All installed by hand each time.
[Moto G 4G Android Development] lost101:
I have no solution for you, other than maybe try Identity Crisis 6 LTE.
[Moto G 4G Android Development] _ViBe_:
Thanks for your time! I will see. Maybe i will stay here with my wakelocks.
[Moto G 4G Android Development] lost101:
Full Stagefright Patch (Dec 2015) added to 'Miscellaneous' section of OP. Zip can be flashed with any ROM in OP.

March 2016 OTA security update has started to rollout for Falcon - I'll provide a new zip for that asap.
[Moto G 4G Android Development] Wyneg:
Deleted
[Moto G 4G Android Development] jccz:
Thanks! But VTS for Android still shows three vulnerabilties (CVE-2015-6608, CVE-2015-1528, CVE-2015-3825) - before and after zip install.
[Moto G 4G Android Development] lost101:
That's why the March 2016 Security update is rolling out.
[Moto G 4G Android Development] tme_007:
Hi, any news about this update for our ROM ? :)