mercredi 6 décembre 2017

Here’s Why Current OnePlus And Nokia Phones Won’t Be Project Treble Certified

Ever since the announcement of Project Treble a week before Google I/O, users have been clamoring to check which devices would be Treble certified. After my report about the benefits that Project Treble support brings to AOSP-based custom ROM development, there was renewed interest in pushing device makers to have their devices be Treble certified with an upgrade to Android Oreo. We have received some requests from users to feature the popular petition going around which requests that OnePlus support Project Treble on their devices, however, we declined to do so because we felt it was an unreasonable request. Here's why current OnePlus (and Nokia) smartphones won't be Project Treble certified.

As I explained in my previous article, the gist of how Project Treble works is that all of the vendor-specific code is separated from the Android OS framework into its own separate partition. What that means is that the Hardware Abstraction Layers (HALs) that interface with the device's hardware are no longer found alongside the OS framework code. Instead, they are moved to a separate vendor partition without having to be recompiled, and new standardized vendor interfaces (defined with HAL Interface Definition Language) allow for the OS framework to communicate with the HALs.

Android Oreo Project Treble

Credits: Google

This allows for the Android OS framework to be upgraded without having to recompile the HALs, cutting down on the time it takes for device makers to start porting their code to the new Android version. So how can Huawei phones upgrading to Oreo meet Project Treble requirements while OnePlus and Nokia can't?

Project Treble and the Vendor Partition

The problem has to do with partitions, or rather, the lack of one—the vendor partition. On devices such as the OnePlus 3/3T and OnePlus 5/5T, the vendor code is located in /system/vendor which is a part of the system partition. On the other hand, Huawei, Essential, and Google phones have already been using a vendor partition to store vendor code on their devices.

Project Treble Vendor Partition

Honor V10 Vendor Partition

Project Treble compatibility requires that a device ship with a separate vendor partition in order to store the vendor HALs. The screenshot above shows a dump of the /vendor partition from the Honor V10, a device which ships with Android 8.0 Oreo and is required to meet Treble's requirements. Since existing OnePlus and Nokia phones lack a vendor partition, it means there is no reason for them to work to meet Treble's requirements when upgrading their devices to Android Oreo.

OnePlus 5 Partitions (A only)

  drwxr-xr-x 2 root root 1440 1970-05-03 14:23 .  drwxr-xr-x 4 root root 1600 1970-05-03 14:23 ..  lrwxrwxrwx 1 root root 16 1970-05-03 14:23 LOGO -> /dev/block/sde18  lrwxrwxrwx 1 root root 16 1970-05-03 14:23 abl -> /dev/block/sde16  lrwxrwxrwx 1 root root 16 1970-05-03 14:23 ablbak -> /dev/block/sde17  lrwxrwxrwx 1 root root 16 1970-05-03 14:23 apdp -> /dev/block/sde31  lrwxrwxrwx 1 root root 16 1970-05-03 14:23 bluetooth -> /dev/block/sde24  lrwxrwxrwx 1 root root 16 1970-05-03 14:23 boot -> /dev/block/sde19  lrwxrwxrwx 1 root root 16 1970-05-03 14:23 boot_aging -> /dev/block/sde20  lrwxrwxrwx 1 root root 15 1970-05-03 14:23 cache -> /dev/block/sda3  lrwxrwxrwx 1 root root 15 1970-05-03 14:23 cdt -> /dev/block/sdd2  lrwxrwxrwx 1 root root 16 1970-05-03 14:23 cmnlib -> /dev/block/sde27  lrwxrwxrwx 1 root root 16 1970-05-03 14:23 cmnlib64 -> /dev/block/sde29  lrwxrwxrwx 1 root root 16 1970-05-03 14:23 cmnlib64bak -> /dev/block/sde30  lrwxrwxrwx 1 root root 16 1970-05-03 14:23 cmnlibbak -> /dev/block/sde28  lrwxrwxrwx 1 root root 16 1970-05-03 14:23 config -> /dev/block/sda12  lrwxrwxrwx 1 root root 15 1970-05-03 14:23 ddr -> /dev/block/sdd3  lrwxrwxrwx 1 root root 16 1970-05-03 14:23 devcfg -> /dev/block/sde39  lrwxrwxrwx 1 root root 16 1970-05-03 14:23 devinfo -> /dev/block/sde23  lrwxrwxrwx 1 root root 16 1970-05-03 14:23 dip -> /dev/block/sde14  lrwxrwxrwx 1 root root 16 1970-05-03 14:23 dpo -> /dev/block/sde33  lrwxrwxrwx 1 root root 16 1970-05-03 14:23 dsp -> /dev/block/sde11  lrwxrwxrwx 1 root root 15 1970-05-03 14:23 frp -> /dev/block/sda6  lrwxrwxrwx 1 root root 15 1970-05-03 14:23 fsc -> /dev/block/sdf4  lrwxrwxrwx 1 root root 15 1970-05-03 14:23 fsg -> /dev/block/sdf3  lrwxrwxrwx 1 root root 16 1970-05-03 14:23 fw_4g9n4 -> /dev/block/sde45  lrwxrwxrwx 1 root root 16 1970-05-03 14:23 fw_4j1ed -> /dev/block/sde43  lrwxrwxrwx 1 root root 16 1970-05-03 14:23 fw_4t0n8 -> /dev/block/sde46  lrwxrwxrwx 1 root root 16 1970-05-03 14:23 fw_8v1ee -> /dev/block/sde44  lrwxrwxrwx 1 root root 15 1970-05-03 14:23 hyp -> /dev/block/sde5  lrwxrwxrwx 1 root root 15 1970-05-03 14:23 hypbak -> /dev/block/sde6  lrwxrwxrwx 1 root root 16 1970-05-03 14:23 keymaster -> /dev/block/sde25  lrwxrwxrwx 1 root root 16 1970-05-03 14:23 keymasterbak -> /dev/block/sde26  lrwxrwxrwx 1 root root 15 1970-05-03 14:23 keystore -> /dev/block/sda5  lrwxrwxrwx 1 root root 16 1970-05-03 14:23 limits -> /dev/block/sde35  lrwxrwxrwx 1 root root 16 1970-05-03 14:23 logdump -> /dev/block/sde40  lrwxrwxrwx 1 root root 16 1970-05-03 14:23 logfs -> /dev/block/sde37  lrwxrwxrwx 1 root root 15 1970-05-03 14:23 md5 -> /dev/block/sdf5  lrwxrwxrwx 1 root root 16 1970-05-03 14:23 mdtp -> /dev/block/sde15  lrwxrwxrwx 1 root root 16 1970-05-03 14:23 mdtpsecapp -> /dev/block/sde12  lrwxrwxrwx 1 root root 16 1970-05-03 14:23 mdtpsecappbak -> /dev/block/sde13  lrwxrwxrwx 1 root root 16 1970-05-03 14:23 minidump -> /dev/block/sde47  lrwxrwxrwx 1 root root 15 1970-05-03 14:23 misc -> /dev/block/sda4  lrwxrwxrwx 1 root root 16 1970-05-03 14:23 modem -> /dev/block/sde10  lrwxrwxrwx 1 root root 15 1970-05-03 14:23 modemst1 -> /dev/block/sdf1  lrwxrwxrwx 1 root root 15 1970-05-03 14:23 modemst2 -> /dev/block/sdf2  lrwxrwxrwx 1 root root 16 1970-05-03 14:23 msadp -> /dev/block/sde32  lrwxrwxrwx 1 root root 15 1970-05-03 14:23 oem_dycnvbk -> /dev/block/sda7  lrwxrwxrwx 1 root root 15 1970-05-03 14:23 oem_stanvbk -> /dev/block/sda8  lrwxrwxrwx 1 root root 15 1970-05-03 14:23 param -> /dev/block/sda9  lrwxrwxrwx 1 root root 15 1970-05-03 14:23 persist -> /dev/block/sda2  lrwxrwxrwx 1 root root 15 1970-05-03 14:23 pmic -> /dev/block/sde8  lrwxrwxrwx 1 root root 15 1970-05-03 14:23 pmicbak -> /dev/block/sde9  lrwxrwxrwx 1 root root 16 1970-05-03 14:23 recovery -> /dev/block/sde22  lrwxrwxrwx 1 root root 15 1970-05-03 14:23 reserve -> /dev/block/sdd1  lrwxrwxrwx 1 root root 16 1970-05-03 14:23 reserve1 -> /dev/block/sda10  lrwxrwxrwx 1 root root 16 1970-05-03 14:23 reserve2 -> /dev/block/sda11  lrwxrwxrwx 1 root root 15 1970-05-03 14:23 rpm -> /dev/block/sde1  lrwxrwxrwx 1 root root 15 1970-05-03 14:23 rpmbak -> /dev/block/sde2  lrwxrwxrwx 1 root root 15 1970-05-03 14:23 sec -> /dev/block/sde7  lrwxrwxrwx 1 root root 16 1970-05-03 14:23 splash -> /dev/block/sde34  lrwxrwxrwx 1 root root 15 1970-05-03 14:23 ssd -> /dev/block/sda1  lrwxrwxrwx 1 root root 16 1970-05-03 14:23 sti -> /dev/block/sde38  lrwxrwxrwx 1 root root 16 1970-05-03 14:23 storsec -> /dev/block/sde41  lrwxrwxrwx 1 root root 16 1970-05-03 14:23 storsecbak -> /dev/block/sde42  lrwxrwxrwx 1 root root 16 1970-05-03 14:23 system -> /dev/block/sde21  lrwxrwxrwx 1 root root 16 1970-05-03 14:23 toolsfv -> /dev/block/sde36  lrwxrwxrwx 1 root root 15 1970-05-03 14:23 tz -> /dev/block/sde3  lrwxrwxrwx 1 root root 15 1970-05-03 14:23 tzbak -> /dev/block/sde4  lrwxrwxrwx 1 root root 16 1970-05-03 14:23 userdata -> /dev/block/sda13  lrwxrwxrwx 1 root root 15 1970-05-03 14:23 xbl -> /dev/block/sdb1  lrwxrwxrwx 1 root root 15 1970-05-03 14:23 xblbak -> /dev/block/sdc1  

Google Pixel 2 XL Partitions (A/B)

  drwxr-xr-x 2 root root 1280 1970-02-07 01:52:01.986666715 -0600 .  drwxr-xr-x 4 root root 1460 1970-02-07 01:52:01.990000048 -0600 ..  lrwxrwxrwx 1 root root 15 1970-02-07 01:52:01.976666714 -0600 abl_a -> /dev/block/sde6  lrwxrwxrwx 1 root root 16 1970-02-07 01:52:01.980000047 -0600 abl_b -> /dev/block/sde20  lrwxrwxrwx 1 root root 16 1970-02-07 01:52:01.970000046 -0600 aes_a -> /dev/block/sda10  lrwxrwxrwx 1 root root 16 1970-02-07 01:52:01.970000046 -0600 aes_b -> /dev/block/sda11  lrwxrwxrwx 1 root root 16 1970-02-07 01:52:01.970000046 -0600 align_parti -> /dev/block/sda12  lrwxrwxrwx 1 root root 16 1970-02-07 01:52:01.983333381 -0600 apdp -> /dev/block/sde29  lrwxrwxrwx 1 root root 15 1970-02-07 01:52:01.970000046 -0600 boot_a -> /dev/block/sde8  lrwxrwxrwx 1 root root 16 1970-02-07 01:52:01.980000047 -0600 boot_b -> /dev/block/sde22  lrwxrwxrwx 1 root root 15 1970-02-07 01:52:01.966666713 -0600 cdt -> /dev/block/sdd1  lrwxrwxrwx 1 root root 16 1970-02-07 01:52:01.970000046 -0600 cmnlib64_a -> /dev/block/sde10  lrwxrwxrwx 1 root root 16 1970-02-07 01:52:01.983333381 -0600 cmnlib64_b -> /dev/block/sde24  lrwxrwxrwx 1 root root 15 1970-02-07 01:52:01.970000046 -0600 cmnlib_a -> /dev/block/sde9  lrwxrwxrwx 1 root root 16 1970-02-07 01:52:01.983333381 -0600 cmnlib_b -> /dev/block/sde23  lrwxrwxrwx 1 root root 15 1970-02-07 01:52:01.973333380 -0600 ddr -> /dev/block/sdd2  lrwxrwxrwx 1 root root 16 1970-02-07 01:52:01.976666714 -0600 devcfg_a -> /dev/block/sde11  lrwxrwxrwx 1 root root 16 1970-02-07 01:52:01.973333380 -0600 devcfg_b -> /dev/block/sde25  lrwxrwxrwx 1 root root 16 1970-02-07 01:52:01.983333381 -0600 devinfo -> /dev/block/sde34  lrwxrwxrwx 1 root root 16 1970-02-07 01:52:01.976666714 -0600 dip -> /dev/block/sde35  lrwxrwxrwx 1 root root 16 1970-02-07 01:52:01.980000047 -0600 dpo -> /dev/block/sde36  lrwxrwxrwx 1 root root 16 1970-02-07 01:52:01.980000047 -0600 dtbo_a -> /dev/block/sde13  lrwxrwxrwx 1 root root 16 1970-02-07 01:52:01.976666714 -0600 dtbo_b -> /dev/block/sde27  lrwxrwxrwx 1 root root 15 1970-02-07 01:52:01.986666715 -0600 frp -> /dev/block/sdg1  lrwxrwxrwx 1 root root 15 1970-02-07 01:52:01.983333381 -0600 fsc -> /dev/block/sdf3  lrwxrwxrwx 1 root root 16 1970-02-07 01:52:01.983333381 -0600 fsg -> /dev/block/sde32  lrwxrwxrwx 1 root root 15 1970-02-07 01:52:01.966666713 -0600 ftm -> /dev/block/sda6  lrwxrwxrwx 1 root root 15 1970-02-07 01:52:01.973333380 -0600 hyp_a -> /dev/block/sde3  lrwxrwxrwx 1 root root 16 1970-02-07 01:52:01.970000046 -0600 hyp_b -> /dev/block/sde17  lrwxrwxrwx 1 root root 15 1970-02-07 01:52:01.973333380 -0600 keymaster_a -> /dev/block/sde7  lrwxrwxrwx 1 root root 16 1970-02-07 01:52:01.980000047 -0600 keymaster_b -> /dev/block/sde21  lrwxrwxrwx 1 root root 15 1970-02-07 01:52:01.976666714 -0600 laf_a -> /dev/block/sda1  lrwxrwxrwx 1 root root 15 1970-02-07 01:52:01.970000046 -0600 laf_b -> /dev/block/sda2  lrwxrwxrwx 1 root root 16 1970-02-07 01:52:01.983333381 -0600 limits -> /dev/block/sde37  lrwxrwxrwx 1 root root 16 1970-02-07 01:52:01.983333381 -0600 logfs -> /dev/block/sde39  lrwxrwxrwx 1 root root 16 1970-02-07 01:52:01.983333381 -0600 metadata -> /dev/block/sde41  lrwxrwxrwx 1 root root 15 1970-02-07 01:52:01.963333379 -0600 misc -> /dev/block/sda5  lrwxrwxrwx 1 root root 15 1970-02-07 01:52:01.976666714 -0600 modem_a -> /dev/block/sde5  lrwxrwxrwx 1 root root 16 1970-02-07 01:52:01.976666714 -0600 modem_b -> /dev/block/sde19  lrwxrwxrwx 1 root root 15 1970-02-07 01:52:01.983333381 -0600 modemst1 -> /dev/block/sdf1  lrwxrwxrwx 1 root root 15 1970-02-07 01:52:01.980000047 -0600 modemst2 -> /dev/block/sdf2  lrwxrwxrwx 1 root root 16 1970-02-07 01:52:01.980000047 -0600 msadp -> /dev/block/sde30  lrwxrwxrwx 1 root root 15 1970-02-07 01:52:01.626666679 -0600 persist -> /dev/block/sda4  lrwxrwxrwx 1 root root 15 1970-02-07 01:52:01.980000047 -0600 pmic_a -> /dev/block/sde4  lrwxrwxrwx 1 root root 16 1970-02-07 01:52:01.973333380 -0600 pmic_b -> /dev/block/sde18  lrwxrwxrwx 1 root root 15 1970-02-07 01:52:01.976666714 -0600 pstore -> /dev/block/sda9  lrwxrwxrwx 1 root root 15 1970-02-07 01:52:01.970000046 -0600 rpm_a -> /dev/block/sde1  lrwxrwxrwx 1 root root 16 1970-02-07 01:52:01.983333381 -0600 rpm_b -> /dev/block/sde15  lrwxrwxrwx 1 root root 16 1970-02-07 01:52:01.973333380 -0600 sec -> /dev/block/sde33  lrwxrwxrwx 1 root root 15 1970-02-07 01:52:01.970000046 -0600 ssd -> /dev/block/sda3  lrwxrwxrwx 1 root root 16 1970-02-07 01:52:01.973333380 -0600 sti -> /dev/block/sde40  lrwxrwxrwx 1 root root 16 1970-02-07 01:52:01.986666715 -0600 storsec -> /dev/block/sde31  lrwxrwxrwx 1 root root 15 1970-02-07 01:52:01.966666713 -0600 system_a -> /dev/block/sda7  lrwxrwxrwx 1 root root 15 1970-02-07 01:52:01.970000046 -0600 system_b -> /dev/block/sda8  lrwxrwxrwx 1 root root 16 1970-02-07 01:52:01.986666715 -0600 toolsfv -> /dev/block/sde38  lrwxrwxrwx 1 root root 15 1970-02-07 01:52:01.966666713 -0600 tz_a -> /dev/block/sde2  lrwxrwxrwx 1 root root 16 1970-02-07 01:52:01.976666714 -0600 tz_b -> /dev/block/sde16  lrwxrwxrwx 1 root root 16 1970-02-07 01:52:01.970000046 -0600 userdata -> /dev/block/sda13  lrwxrwxrwx 1 root root 16 1970-02-07 01:52:01.980000047 -0600 vbmeta_a -> /dev/block/sde12  lrwxrwxrwx 1 root root 16 1970-02-07 01:52:01.983333381 -0600 vbmeta_b -> /dev/block/sde26  lrwxrwxrwx 1 root root 16 1970-02-07 01:52:01.976666714 -0600 vendor_a -> /dev/block/sde14  lrwxrwxrwx 1 root root 16 1970-02-07 01:52:01.633333346 -0600 vendor_b -> /dev/block/sde28  lrwxrwxrwx 1 root root 15 1970-02-07 01:52:01.973333380 -0600 xbl_a -> /dev/block/sdb1  lrwxrwxrwx 1 root root 15 1970-02-07 01:52:01.976666714 -0600 xbl_b -> /dev/block/sdc1  

That doesn't mean it is impossible for them to add a vendor partition, but it can be risky. Since these devices already ship without a separate vendor partition, it means that they would have to re-partition existing devices to include space for the vendor partition. This is possible to do, but there is always a remote chance of unrecoverable data loss in the chance something goes wrong. For the average person, the chance is small that a device may be bricked during re-partitioning. However, multiply that chance by hundreds of thousands or millions of users re-partitioning their devices, and that's a risk that device makers like OnePlus or Nokia can't afford to make.


Lack of Project Treble Support, is it Really a Deal Breaker?

I realize that this news is disappointing to many of you, especially with how promising Project Treble is for custom ROM development. After all, we were able to boot a nearly fully functional AOSP ROM on the Huawei Mate 9. XDA Recognized Developer OldDroid has just released a Treble-compatible ROM for the Honor 8 Pro. And last night, XDA Senior Member phhusson was able to boot Android 8.1 Oreo on the Essential Phone—less than a day after source code was dropped.

Android 8.1 Oreo on the Essential Phone

Android 8.1 Oreo on the Essential Phone

But keep in mind that Project Treble support isn't a requirement for a device to have great software support. After all, the Nokia 8 received Android Oreo very recently and so did the OnePlus 3/3T and the OnePlus 5. Project Treble absolutely makes updating their phones easier for the device maker, but that doesn't mean without supporting it these companies will be slow at updating their phones.

As for why device makers like OnePlus or Nokia never implemented a separate vendor partition, it's because it just wasn't a requirement for them to do so until Android Oreo. Some would argue why the recently released OnePlus 5T didn't launch with Oreo or have a separate vendor partition, and while I can't say for sure why, my best guess is they built the software as close to the OnePlus 5 as possible so they could release unified builds like they do for the OnePlus 3/3T.

Are there other ways to implement Project Treble support? phhusson believes it may be possible for the system partition to itself be gpt-partitioned so it can contain both the system and vendor partitions. Doing this may meet Google's expectations of needing system/vendor/odm/factory/oem partitions. Although this would remove space from the existing system partition, phhusson suggests that the new vendor partition use SquashFS to optimize space. Now, this is merely a proof-of-concept workaround, but it's one possibility that phhusson believes may work in bringing Treble support to devices that lack a vendor partition.

To keep up to date with Project Treble related news, check out our new Project Treble development forum. We will also be covering any new Treble-related developments that crop up given the excitement it has generated for our readers. We recommend you use the XDA Labs app to browse the forums and keep up to date with the XDA Portal for the latest news on Treble.



from xda-developers http://ift.tt/2ACHIN2
via IFTTT

Aucun commentaire:

Enregistrer un commentaire