Android 5.0 Lollipop platform change investigation report
Upcoming SlideShare
Loading in...5
×

Like this? Share it with your network

Share

Android 5.0 Lollipop platform change investigation report

  • 0 views
Uploaded on

Android 5.0 Lollipop brings huge change, compare to before. ...

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.

More in: Mobile
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
0
On Slideshare
0
From Embeds
0
Number of Embeds
1

Actions

Shares
Downloads
0
Comments
0
Likes
1

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Lollipop platform change まとめ @hidenorly
  • 2. Statistics about L
  • 3. Source code size comparison [GB] ( 9.54GB ) (13.63GB) 42.8% UP
  • 4. New public API additions 6309 1783 x3.54! diff -u -r -N jb-mr2/frameworks/base/api/current.txt kkmr2/frameworks/base/api/current.txt | grep "^+" | grep "public " | wc -l diff -u -r -N kkmr2/frameworks/base/api/current.txt l/frameworks/base/api/current.txt | grep "^+" | grep "public " | wc -l
  • 5. Changed files (frameworks/base) 4475 2162 x2.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
  • 6. Diff size comparion (frameworks/base) 19.14 61.33 x3.2 $ 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
  • 7. Services in frameworks/base/services $ du -ak | grep ".java" | grep service -i | grep -v "tests" 63 85
  • 8. Door to know what’s Lollipop
  • 9. 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
  • 10. Nexus & the platform support
  • 11. Nexus6 is 560dpi device ● Nexus6 uses 560dpi! ○ But it is 492.8dpi (sqrt(2560^2+1440^2)/5.96inch) ○ 492.8dpi Commit a3fb40d5f492825bb86769f541620baca5616e05 Author: Dianne Hackborn <hackbod@google.com> Date: Tue Aug 12 15:06:50 2014 -0700 Add 560dpi, and some other stuff. ● Ideal combination is… 2560x1440/5.25inch = 560dpi
  • 12. Nexus9 is the 1st 64bit ARMv8 device ARMv8 crypto extension support ● Userland (external/openssl) ○ Update ARM assembly patch ● kernel ○ Crypto extension for linux kernel crypto API ■ dm-crypt and dm-verity use this. ● Other 64bits ○ Please check my previous presentation also.
  • 13. Appendix. AES perf (single core) by Geekbench3 0.039 0.034 0.708 2744 1.19 991 50.5 76.8
  • 14. What’s new L - inside of L -
  • 15. 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
  • 16. 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"
  • 17. 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
  • 18. Block level FOTA Switching to block-oriented OTAs To 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 --block Generate a block-based OTA if possible. Will fall back to a file-based OTA if the target_files is older and doesn't support block-based OTAs.
  • 19. ART’s AOT impacts ● Prebuilt (odex) WITH_PREDEXOPT:=true Odex 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
  • 20. 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 1e9189a276e967a7a74ff44a44cf627764396954 Author: Jeff Sharkey <jsharkey@android.com> Date: Thu Jul 17 10:56:48 2014 -0700 Support cluster-style installs for bundled apps.
  • 21. Application location <user-installed> ● /data/app/packagename-1/base.apk ○ Same as installed apk file itself ● /data/dalvik-cache/ arm/data@app@packagename- 1@base.apk@classes.dex ○ AOT result
  • 22. logcat on adb install hogeApp.apk Copying /data/local/tmp/hogeApp.apk to base.apk Renaming /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@app@com. hoge.hogeApp-1@base.apk@classes.dex --instruction-set=arm --instruction-set- features=div --runtime-arg -Xms64m --runtime-arg -Xmx512m restoreAtInstall pkg=com.hoge.hogeApp token=15 restoreSet=0 Finishing install immediately
  • 23. @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
  • 24. Services… welcome & farewell from 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/a ndroid/server/wifi)
  • 25. 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.
  • 26. 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
  • 27. Finger print HAL typedef 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;
  • 28. 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);
  • 29. 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
  • 30. 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 := framework LOCAL_DX_FLAGS := --core-library --multi-dex See more