30
Lollipop platform change まとめ @hidenorly

Android 5.0 Lollipop platform change investigation report

Embed Size (px)

DESCRIPTION

Android 5.0 Lollipop brings huge change, compare to before. This report includes statistics from source code with data and hidden features from source code & git log investigation.

Citation preview

Page 1: Android 5.0 Lollipop platform change investigation report

Lollipop platform changeまとめ

@hidenorly

Page 2: Android 5.0 Lollipop platform change investigation report

Statistics about L

Page 3: Android 5.0 Lollipop platform change investigation report

Source code size comparison [GB]

( 9.54GB )(13.63GB)

42.8% UP

Page 4: Android 5.0 Lollipop platform change investigation report

New public API additions

diff -u -r -N jb-mr2/frameworks/base/api/current.txt kkmr2/frameworks/base/api/current.txt | grep "^\+" | grep "public " | wc -ldiff -u -r -N kkmr2/frameworks/base/api/current.txt l/frameworks/base/api/current.txt | grep "^\+" | grep "public " | wc -l

6309

1783x3.54!

Page 5: Android 5.0 Lollipop platform change investigation report

Changed files (frameworks/base)

4475

2162x2.07

diff -u -r -N --exclude=*.xml --exclude=.git --exclude=*.html --exclude=*.png --exclude=*.jpeg --exclude=*.jar --exclude=*.jd --exclude=*.js --exclude=*.css jb-mr2/frameworks/base kkmr2/frameworks/base | grep “^+++” | wc -l

Page 6: Android 5.0 Lollipop platform change investigation report

Diff size comparion (frameworks/base)

$ diff -u -r -N --exclude=*.xml --exclude=.git --exclude=*.html --exclude=*.png --exclude=*.jpeg --exclude=*.jar --exclude=*.jd --exclude=*.js --exclude=*.css jb-mr2/frameworks/base kkmr2/frameworks/base > jbmr2-kkmr2-frameworks-base.txt

$ diff -u -r -N --exclude=*.xml --exclude=.git --exclude=*.html --exclude=*.png --exclude=*.jpeg --exclude=*.jar --exclude=*.jd --exclude=*.js --elude=*.css kkmr2/frameworks/base l-snapshot/frameworks/base > kkmr2-l-frameworks-base.txt

19.14

61.33

x3.2

Page 7: Android 5.0 Lollipop platform change investigation report

Services in frameworks/base/services$ du -ak | grep "\.java" | grep service -i | grep -v "tests"

63

85

Page 8: Android 5.0 Lollipop platform change investigation report

Door to know what’s Lollipop

Page 9: Android 5.0 Lollipop platform change investigation report

What’s new about L CDD?

● CDD stands for Compatible Definition Document.

● But L CDD is NOT published yet.● Please check

○ http://source.android.com/compatibility/○ http://source.android.com/compatibility/android-cdd.pdf

Page 10: Android 5.0 Lollipop platform change investigation report

Nexus & the platform support

Page 11: Android 5.0 Lollipop platform change investigation report

Nexus6 is 560dpi device● Nexus6 uses 560dpi!

○ But it is 492.8dpi (sqrt(2560^2+1440^2)/5.96inch)○ 492.8dpi

Commit a3fb40d5f492825bb86769f541620baca5616e05Author: Dianne Hackborn <[email protected]>Date: Tue Aug 12 15:06:50 2014 -0700

Add 560dpi, and some other stuff.

● Ideal combination is…2560x1440/5.25inch = 560dpi

Page 13: Android 5.0 Lollipop platform change investigation report

Appendix.AES perf (single core) by Geekbench3

0.039

0.034

0.708

1.192744

991

76.8

50.5

Page 14: Android 5.0 Lollipop platform change investigation report

What’s new L- inside of L -

Page 15: Android 5.0 Lollipop platform change investigation report

Security

● All of domain are enforced.○ http://source.android.com/devices/tech/security/se-linux.html

■ In the Android 5.0 (L) release, Android moves to full enforcement of SELinux. ..snip.. In short, Android is shifting from enforcement on a limited set of crucial domains (installd, netd, vold and zygote) to everything (more than 60 domains). This means manufacturers will have to better understand and scale their SELinux implementations to provide compatible devices. Understand that:● Everything is in enforcing mode in the 5.0 release● No processes other than init should run in the init domain● Any generic denial (for a block_device, socket_device,

default_service, etc.) indicates that device needs a special domain

Page 16: Android 5.0 Lollipop platform change investigation report

Default encryption by vold● What we’ve added for Android 5.0

○ Created fast encryption, which only encrypts used blocks on the data partition to avoid first boot taking a long time. Only ext4 and f2fs filesystems currently support fast encryption.

○ Added the forceencrypt flag to encrypt on first boot.○ Added support for patterns and encryption without a password.○ Added hardware-backed storage of the encryption key. See Storing

the encrypted key for more details.Caution: Devices upgraded to Android 5.0 and then encrypted may be returned to an unencrypted state by factory data reset. New Android 5.0 devices encrypted at first boot cannot be returned to an unencrypted state.

● In system/vold/cryptfs.c#define DEFAULT_PASSWORD "64656661756c745f70617373776f7264"

Page 17: Android 5.0 Lollipop platform change investigation report

dm-verity

● dm-verity is block level integrity check mechanism.○ Used on Chromium OS.

● Lollipop supports dm-verity (fully).○ build/target/product/verity.mk

■ PRODUCT_SUPPORTS_VERITY := true■ PRODUCT_VERITY_SIGNING_KEY

○ Kernel: CONFIG_DM_VERITY

Page 18: Android 5.0 Lollipop platform change investigation report

Block level FOTA

Switching to block-oriented OTAsTo enable dm-verity on your devices, you must move from file-based "over the air" (OTA) updates to block-oriented OTAs. This is needed because during OTA, Android attempts to change the contents of the system partition at the filesystem layer.

And since OTA works on a file-by-file basis, it is not guaranteed to write files in a consistent order, have a consistent last modified time or superblock, or even place the blocks in the same location on the block device. For this reason, file-based OTAs will fail on a dm-verity-enabled device.The device will not boot after OTA.

● ota_from_target_files

--blockGenerate a block-based OTA if possible. Will fall back to afile-based OTA if the target_files is older and doesn't supportblock-based OTAs.

Page 19: Android 5.0 Lollipop platform change investigation report

ART’s AOT impacts

● Prebuilt (odex)WITH_PREDEXOPT:=trueOdex size is approx. x3 sizeof classes.dex(In Google I/O, it was announced that the size was x2.

4 of dex.)

● And the odex was copied to /data/dalvik-cache

Page 20: Android 5.0 Lollipop platform change investigation report

Application location <pre-installed>

● /system/{app|priv-app}/apkname/○ apkname.apk (apk itself)○ lib/[arm|arm64]/hoge.so (natibe library (extracted))○ [arm|arm64]/apkname.odex (if WITH_DEXPREOPT:=true)

● commit 1e9189a276e967a7a74ff44a44cf627764396954Author: Jeff Sharkey <[email protected]>Date: Thu Jul 17 10:56:48 2014 -0700Support cluster-style installs for bundled apps.

Page 21: Android 5.0 Lollipop platform change investigation report

Application location <user-installed>

● /data/app/packagename-1/base.apk○ Same as installed apk file itself

● /data/dalvik-cache/arm/data@app@[email protected]@classes.dex○ AOT result

Page 22: Android 5.0 Lollipop platform change investigation report

logcat on adb install hogeApp.apkCopying /data/local/tmp/hogeApp.apk to base.apkRenaming /data/app/vmdl1863917432.tmp to /data/app/com.hoge.hogeApp-1/data/app/com.hoge.hogeApp-1/base.apk pkg=com.hoge.hogeApp isa=arm vmSafeMode=false/system/bin/dex2oat --zip-fd=6 --zip-location=/data/app/com.hoge.hogeApp-1/base.apk --oat-fd=7 --oat-location=/data/dalvik-cache/arm/data@[email protected]@[email protected] --instruction-set=arm --instruction-set-features=div --runtime-arg -Xms64m --runtime-arg -Xmx512mrestoreAtInstall pkg=com.hoge.hogeApp token=15 restoreSet=0Finishing install immediately

Page 23: Android 5.0 Lollipop platform change investigation report

@SystemApi/*** Indicates an API is exposed for use by bundled system applications.* <p>* These APIs are not guaranteed to remain consistent release-to-release,* and are not for use by apps linking against the Android SDK.* </p><p>* This annotation should only appear on API that is already marked <pre>@hide</pre>.* </p>** @hide*/

/work/l/frameworks/base$ grep "@SystemApi" -nr ./* | wc -l

489

Page 24: Android 5.0 Lollipop platform change investigation report

Services… welcome & farewellfrom frameworks/base/services

● Added○ BackgroundDexOptService○ FingerprintService○ HdmiControlService○ JobSchedulerService / JobServiceContext○ KeySetManagerService○ LauncherAppsService○ ManagedServices○ MediaProjectionManagerService○ MediaSessionService○ MmsServiceBroker○ MountServiceIdler○ NetworkScoreService○ PackageInstallerService○ PersistentDataBlockService○ RestrictionsManagerService○ ServiceThread○ SystemService/SystemServiceManager○ TrustManagerService○ TvInputManagerService○ UserUsageStatsService○ VoiceInteractionManagerService/VoiceInteractionManagerServiceImpl

○ WebViewUpdateService

● Gone?○ IIdleMaintenanceService○ RecognitionManagerService○ WifiService

(-> frameworks/opt/net/wifi/service/java/com/android/server/wifi)

Page 25: Android 5.0 Lollipop platform change investigation report

SystemWebView

● Generate symlinks to libwebviewchromium.so in /system/priv-app

● Make the WebView Java library into an APK.● Move WebView resources to separate APK● Update framework resource references.● Prepare WebView library APK.● Include pak files in the WebView apk.

Page 26: Android 5.0 Lollipop platform change investigation report

New HAL since L● hardware/libhardware

○ activity_recognition.h○ audio_alsaops.h○ bt_hf_client.h ○ bt_mce.h○ fingerprint.h○ hdmi_cec.h○ nfc_tag.h○ sound_trigger.h○ tv_input.h○ vibrator.h

● hardware/libhardware_legacy○ gscan.h○ link_layer_stats.h○ rtt.h○ tdls.h○ wifi_hal.h

Page 27: Android 5.0 Lollipop platform change investigation report

Finger print HALtypedef struct fingerprint_enroll {

uint32_t id;

/* samples_remaining goes from N (no data collected, but N scans needed)

* to 0 (no more data is needed to build a template).

* The progress indication may be augmented by a bitmap encoded indication

* of finger area that needs to be presented by the user.

* Bit numbers mapped to physical location:

*

* distal

* +-+-+-+

* |2|1|0|

* |5|4|3|

* medial |8|7|6| lateral

* |b|a|9|

* |e|d|c|

* +-+-+-+

* proximal

*

*/

uint16_t data_collected_bmp;

uint16_t samples_remaining;

} fingerprint_enroll_t;

typedef struct fingerprint_msg {

fingerprint_msg_type_t type;

union {

uint64_t raw;

fingerprint_error_t error;

fingerprint_enroll_t enroll;

fingerprint_removed_t removed;

fingerprint_acquired_t acquired;

fingerprint_processed_t processed;

} data;

} fingerprint_msg_t;

Page 28: Android 5.0 Lollipop platform change investigation report

sound_trigger HAL* Retrieve implementation properties.

int (*get_properties)(const struct sound_trigger_hw_device *dev,

struct sound_trigger_properties *properties);

* Load a sound model. Once loaded, recognition of this model can be started and stopped.

* Only one active recognition per model at a time. The SoundTrigger service will handle

* concurrent recognition requests by different users/applications on the same model.

* The implementation returns a unique handle used by other functions (unload_sound_model(),

* start_recognition(), etc...

int (*load_sound_model)(const struct sound_trigger_hw_device *dev,

struct sound_trigger_sound_model *sound_model,

sound_model_callback_t callback,

void *cookie,

sound_model_handle_t *handle);

* Unload a sound model. A sound model can be unloaded to make room for a new one to overcome

* implementation limitations.

int (*unload_sound_model)(const struct sound_trigger_hw_device *dev,

sound_model_handle_t handle);

/* Start recognition on a given model. Only one recognition active at a time per model.

* Once recognition succeeds of fails, the callback is called.

* TODO: group recognition configuration parameters into one struct and add key phrase options.

int (*start_recognition)(const struct sound_trigger_hw_device *dev,

sound_model_handle_t sound_model_handle,

const struct sound_trigger_recognition_config *config,

recognition_callback_t callback,

void *cookie);

/* Stop recognition on a given model.

* The implementation does not have to call the callback when stopped via this method.

int (*stop_recognition)(const struct sound_trigger_hw_device *dev,

sound_model_handle_t sound_model_handle);

Page 29: Android 5.0 Lollipop platform change investigation report

High definition audio?Float mixer seems not to be used

AudioMixer.cpp in frameworks/av// Set kUseNewMixer to true to use the new mixer engine. Otherwise the

// original code will be used. This is false for now.

static const bool kUseNewMixer = false;

// Set kUseFloat to true to allow floating input into the mixer engine.

// If kUseNewMixer is false, this is ignored or may be overridden internally

// because of downmix/upmix support.

static const bool kUseFloat = true;

t->mMixerInFormat = kUseFloat && kUseNewMixer

? AUDIO_FORMAT_PCM_FLOAT : AUDIO_FORMAT_PCM_16_BIT;

https://www.google.com/events/io/io14videos/0f228fb0-42e0-e311-b297-00155d5066d7

Page 30: Android 5.0 Lollipop platform change investigation report

Multidex as platform build# Build the master framework library.# The framework contains too many method references (>64K) for poor old DEX.# So we first build the framework as a monolithic static library then split it# up into smaller pieces.

LOCAL_MODULE := frameworkLOCAL_DX_FLAGS := --core-library --multi-dex

See more