[Xperia Z1 Compact Android Development] MSe1969:
Thread Closed Per OP Request

This thread is dedicated to provide Lineage-OS 15.1 builds for the Sony Xperia Z1 compact with current security patches.

This thread is

discontinued

- please visit the LineageOS 16.0 successor thread

This is the joint effort of 115ek and MSe1969 (contributions welcome).

There are two build flavors available, both are signed (see further below):

A. Standard LineageOS 15.1

This build flavor aims at providing LineageOS 15.1 "as is" with most recent security patches.

Consider this flavor as continuation of the thread here by 115ek.

Download here

B. Security hardened microG build

For the security/privacy focused

Download here

Pre-installed microG and F-Droid same as the LineageOS for microG project

Pre-installed AuroraStore

[*]Pre-Installed pre-release of microG DroidGuard helper to have a working SafetyNet attestation (

see comments below!

)

Additional security hardening features listed below

Access to /proc/net blocked for user apps

Bundled netmonitor app to allow network monitoring

Enhanced Privacy Guard: Switches for motion sensors, other sensors and certain background activities

Cloudflare as default DNS (instead of Google)

Privacy-preferred default settings

Optional blocking of Facebook- and Google-Tracking

Optional disable captive portal detection

Option to set own DNS

Option to deny new USB connections

Increased max. password length of 64

No submission of IMSI/phone number to Google/Sony when GPS is in use

Default hosts file with many blocked ad/tracking sites

Privacy-enhanced Bromite SystemWebView

Additional restriction options for secondary users

Current release levels

Security string: 2020-02-05

AOSP tag: 8.1.0_r52

System Webview: M79 (Standard build)

Bromite Webview: M79 (microG build)

Source-code and build instructions

Kernel: https://github.com/lin15-microG/kernel_sony_msm8974/tree/lineage-15.1

Build manifest: https://github.com/lin15-microG/local_manifests

TWRP Recovery

Please use the TWRP recovery referred to in this thread

Limitations

Following limitations are known:

NFC-HCE does not work (needed for example for google pay)

FM does not work in stereo mode (mono works fine, though)

Problems with some 5 GHz Wifi channels (can be avoided by not using autochanneling) fixed with 20190408 build

MHL does not work

5 GHz hotspot does not work (2.4 GHz hotspot works fine)

Installation Instructions

YOU ARE RESPONSIBLE SOLELY YOURSELF FOR ANY ACTIONS YOU DO WITH YOUR DEVICE !!!

Please note - we won't explain any single aspect (e.g. how to install 'fastboot' on your PC or troubleshoot USB connectivity issues under Windows). Search the net and consult the search engine of your choice or look here in XDA, there is plenty information available.

Pre-Requisites

Get familiar with the hardware keys of the Xperia Z1 compact device, especially how to enter fastboot mode and recovery mode

Have fastboot and adb installed on your PC and make sure, you can connect via USB to your device in fastboot mode and via adb

Download the most current .ZIP file of our ROM and place it to your phone's internal memory or SD card

Only valid for the "standard build flavor":

If you wish to install Google apps (GApps), please refer to the GApps section further below

An unlocked bootloader (read the warnings carefully and backup your data!)

Only in case your device is still with the pre-delivered Sony Stock ROM: It is recommended that you have updated the Stock ROM to the latest version offered by Sony to make sure that the bootloader has the needed capabilities (see also 'trouble-shooting' below)

Install TWRP recovery

If you come from stock ROM and have just unlocked your boot loader, this is the next thing to do. If you have already a working custom recovery on your device, there is no necessity to replace it. However - we recommend to use the TWRP recovery linked in this thread. The following instructions are based on TWRP.

To install TWRP, download the TWRP.img file (Note: replace "TWRP.img" in the following instructions with the real file name) from this section to your PC, connect the phone via USB to your PC, get it into 'fastboot mode' and enter the following command on your PC:

fastboot flash FOTAKernel TWRP.img

Afterwards, directly boot into 'recovery mode' (enter fastboot reboot on your PC and use the right hardware keys to get into recovery mode) - we recommend not to boot the phone's Android system after having flashed TWRP. Once TWRP has been launched, you may decide to reboot your phone and install the ROM at any time later. But the first boot after flashing TWRP should be TWRP in recovery mode.

Trouble-shooting:

Depending on the Stock ROM you are on, you may face some difficulties to get the phone into recovery after flashing TWRP. If you are facing such difficulties (i.e. phone always boots into Stock ROM), get into fastboot mode, and manually boot into TWRP by entering the below command:

fastboot boot TWRP.img

If that also does not help you, it could be that the firmware, you have previously used, included an outdated bootloader. In that case, use the Sony flash tool (Windows only) or Androxyde's Open source flshtool to flash a more current Sony firmware image.

Both approaches can also help to "unbrick" your device.

Advanced Wipe

ONLY perform the steps described here, if you come from Stock ROM or a different Custom ROM!

Boot into recovery mode. In TWRP, choose "Wipe", "Advanced" and spefify "Dalvik", "System", "Cache" and "Data" to be wiped. Make sure NOT to wipe "Internal memory" or "SD Card". Swipe to confirm the deletion and get back into the main menu.

GApps

DO NOT

attempt to flash GApps on the "microG" build variant!

For the "Standard" variant, the following applies:

You do not need to install GApps, but you may wish to do so. In that case, download GApps from here and put the .ZIP also to the SD card or Internal memory of your device. Choose ARM as platform, Android 8.1 and the flavor of your choice. We recommend "pico", as this leaves you the most freedom to only install, what you really need; you can later still install all the Google products you want and do not need to live with pre-installed Google applications you have no use for.

Install our ROM

In the TWRP main menu, choose "Install". A file manager appears to let you navigate to your internal memory (path /sdcard) or your SD card (path /external_sd). Choose the .ZIP file of our ROM and swipe to flash.

If you update from a previous version of our ROM, you don't need to perform a wipe. If you had GApps already installed before the update, there is no need to flash them again. They will be automatically restored during the flash process. (Note: If you wish to get rid of GApps, navigate to TWRP's file manager in the Advanced section of the main menu, go to path /system/addon.d and delete the file 70-gapps.sh, before flashing the ROM update)

If you come from a different ROM (or stock firmware), make sure that you have performed the Wipe steps above. If you wish to install GApps, select the respective .ZIP file directly afterwards, do not boot into Android before having flashed GApps.

When finished flashing, return to the main menu, choose "Reboot" and then "System", which will cause your phone to boot into our Lineage OS 15.1 - be patient, the first boot after flashing a new ROM takes quite long!

microG

Only valid for the "microG" build variant: After the first installation of this ROM, you need to setup microG.

Please read the instructions given on the LineageOS for microG site, section "Post Install - UnifiedNlp"

Encryption

Encryption works

, however - please consider the below important information:

If you have previously encrypted your device with a "Lollipop" (Android 5.x) based ROM (e.g. this one), our ROM unfortunately cannot decrypt and you will have to format the data partition and encrypt again.

Be aware, that your 'Internal Memory' will be lost in that case, so don't forget to make a backup!

If the device has been encrypted with a "Nougat" (Android 7.x) based ROM, there won't be any issues, even if you switch between different Android releases including Android 8.x and 5.x for testing purposes

If you encrypt the device with our LineageOS 15.1 ROM, you will not be able to decrypt the /data partition with TWRP and have to 'sideload' any updates instead

We consider this as a still open issue. We will be grateful for any advice on how to solve these compatibility issues.

For the time being, it seems that flashing a naked Nougat-ROM (e.g. this one) to perform the encryption and then wipe and install LineageOS 15.1 will leave you with the most flexibility.

Dealing with signed builds

Please note, that our builds are

signed with our own key

. When you come from a different build, you cannot directly "dirty-flash" our build. You either have to perform a "clean flash" (recommended), or - if you e.g. would like to update from one of 115ek's previous builds, you need to follow below instructions.

Coming from 115ek's Lineage 15.1 build:

Download and extract the file migration.sh from this archive

boot into TWRP

push the migration.sh file to the directory /data/local on your device and mount the /system partition in TWRP (you can do so using the dedicated TWRP's menu entry)

launch the built-in terminal in TWRP, cd into /data/local, make migration.sh executable (chmod +x) and execute the command ./migration.sh official

(In case you receive an error, try sh ./migration.sh official instead)

flash the ROM .zip

wipe Cache and Dalvik/ART Cache

reboot system

More background information "theory behind" can be found in the LineageOS wiki and AOSP reference.

Switching between build flavors

You can easily do so via clean-install. However, if you want to switch between the standard build and the microG build and vice-versa without wiping your data, please follow the below instructions:

Standard build => microG build

De-install any of the following apps, in case you have manual installations of them: Yalpstore, Privacy-friendly netmonitor, microG Services Core, microG Services Framework Proxy, Fake Store, F-Droid, Mozilla Unified NLP Backend, Nominatim Geocoder Backend

Deactivate System Webview

If you have flashed GApps before, deactivate all of them to remove any installed updates

Boot into TWRP recovery

If you have flashed GApps before,

delete

the file /system/addon.d/70-gapps.sh

Flash the microG ROM ZIP (make sure not to use an older version than the current standard build)

Wipe Cache & Dalvik and reboot

Follow the 'Post-install' steps outlined here

microG build => standard build

Deactivate the following apps: Yalpstore, Privacy-friendly netmonitor, microG Services Core, microG Services Framework Proxy, Fake Store, F-Droid, Mozilla Unified NLP Backend, Nominatim Geocoder Backend, Bromite System Webview

Boot into TWRP recovery

Flash the standard ROM ZIP (make sure not to use an older version than the current microG build)

If you want to flash GApps, do it before re-boot

Wipe Cache & Dalvik and reboot

Please note, that you may face issues with some apps, which depend on play services. In that case, try solving them in the following order: 1. delete app cache, 2. delete app data, 3. de-install and re-install app

Weather Widget

LineageOS does currently not offer Weather provider apps for LineageOS 15.1 for download (only for LineageOS 14.1)

We've have built an APK for OpenWeatherMap for download from the LineageOS sources here, which works well with LineageOS 15.1

SafetyNet

Google SafetyNet is a device certification system, ensuring that the device is properly secured and compatible with Android CTS. Some applications use SafetyNet for security reasons, to enforce DRM or as a prerequisite for tamper-protection. General information about SafetyNet can be found here or e.g. see LineageOS' statement about SN.

The below information is

only relevant for the microG build

. In the standard build, you have SafetyNet, if you flash Gapps. Whether the SN attestation passes or not is completely out of our influence!

If you don't need SafetyNet (i.e. you don't use apps requiring it), I recommend to switch off SafetyNet in microG settings and in addition, go to Settings - apps, make system processes visible and disable the app 'microG DroidGuard Helper'

In that case, you can safely skip the below information. (If you access the play store with Yalp coming with this build, apps, which the original playstore app would hide because of failed SafetyNet, such as e.g. Netflix, are still listed, so you don't need SafetyNet for that specific purpose)

If you need SafetyNet, because you use an app requiring SafetyNet attestation to pass, switch SafetyNet on in microG settings and make sure the a.m. DroidGuard Helper app is active. Further, please consider below important information.

The typical use-case, for which SafetyNet has been developped and is e.g. used by Google, is e.g. "Google Pay".

Although it seems not to be the intention of Google to make SafetyNet part of "ordinary, average" apps - unfortunately - a certain tendency can be observed that more and more apps make use of it. Especially nosy and privacy intrusive apps seem to start using SafetyNet against Custom ROMs, because Custom ROMs usually allow to at least restrict uncontrolled data collection.

microG GmsCore contains a free implementation of SafetyNet, but the official server requires SafetyNet requests to be signed using the proprietary DroidGuard system. A sandboxed version of DroidGuard has been added to this microG build as a prebuilt “DroidGuard Helper” app to run the Google code in an isolated environment. The chosen approach in my build is proposed and discussed within the microG project, but not yet officially implemented by microG.

As of March 11th 2019, the microG build passes the SafetyNet attestation,

when installed w/o root or Xposed

.

So, if you need SafetyNet and you also need root, Magisk would be the way to go.

To avoid confusion: Magisk can hide itself from being detected by SafetyNet and thus help to pass SN,

if the device would pass SN without having Magisk installed

. Nothing more.

Note: Currently, the DroidGuard helper app is not part of the build, as it currently does not work any more.

There are apps available on the Play store to show, whether SafetyNet attestation is passed, for example 'SafetyNet Test' (org.freeandroidtools.safetynettest)

IMPORTANT

I cannot and I will not give any assurance that SafetyNet attestation is passed by this build!

The SafetyNet code, which is dynamically downloaded from Google servers and executed on the device as part of the defined functionality, is regularly maintained and further developped by Google. Although it currently works, it could stop working in the future, until the microG team finds again a solution.

(Interesting enough: Remote code execution is normally considered a severe vulnerability, but hey, it's Google and we all "trust" them 100%, don't we? ;) -

At least I

, besides others, exactly for that reason, do not use Gapps!)

Further, I for my part refuse to use apps requiring SafetyNet, but that is of course everybody's own decision.

Usage of ANT+

You need the 2 apps:

ANT Radio Service (Github) / (Google play)

ANT+ Plugin Service (Github) / (Google play)

afterwards setting proper permissions is essential!

Go to Apps & Notifications -> See All Apps

Select 'ANT Radio Service'

Select Permissions

Select Additional permissions

Slide switch to allow using of ANT hardware

This refers to those instructions.

Bug reports:

If you have a problem please create a post with these information:

Original Kernel shipped with this rom:

Build Date:

And try to get log as described here

Credits

In continuation of the previous thread, we would like to acknowledge:

Android Open Source project (AOSP)

LineageOS project

AICP project

SpiritCroc: big thanks to him for maintaining the device trees and a lot of very useful hints

rcstar6696

SuperLamic

drakonizer

AdrianDC

munjeni: thanks for tips and tricks

nailyk: thanks for tips and tricks

All the other contributors on sony msm8974 platform

microG project

CopperheadOS project

csagan5 (Bromite)

Yeriomin (Yalp)

XDA:DevDB Information

[ROM][Unofficial][8.1.0][signed] LineageOS 15.1 for Xperia Z1 compact, ROM for the Sony Xperia Z1 Compact

Contributors

MSe1969, 115ek

Source Code: https://github.com/lin15-microG/local_manifests

ROM OS Version: 8.x Oreo

ROM Kernel: Linux 3.4.x

Based On: LineageOS

Version Information

Status: Stable

Stable Release Date: 2020-02-09

Created 2018-12-29

Last Updated 2020-03-09