Update from android kk to android l

43
1 Update from Android KK to Android L Kaisa <[email protected]>

description

Update from android kk to android l

Transcript of Update from android kk to android l

Page 1: Update from android kk to android l

1

Update from Android KK to Android L

Kaisa <[email protected]>

Page 2: Update from android kk to android l

2

Overview

API and services overview

Security

PnP

Interaction with other devices

Maintainability.

Java 7 support

What maybe be available in Android M?

Page 3: Update from android kk to android l

3

API and service overview

New API overview

System service overview

Page 4: Update from android kk to android l

4

New API overview

6000+ API is addedAnnotation @SystemAPI tag is added.

Page 5: Update from android kk to android l

5

System service overview

60

10

15

5

0

10

20

30

40

50

60

70

80

JAVA Native

Count of System service

Modify New

Page 6: Update from android kk to android l

6

Security

Android work

SeLinux

Verified boot

Page 7: Update from android kk to android l

7

Android work

• Total solution to make android awesome at work for employees and businesses.

• Support BYOD and COPE

• Based on the multi-user mechanism.

• Unified view of personal and work apps.

• Data isolation and security.

• No modification for existing apps.

• It means that Apks or services belong to

different users can be running at the

same time.

Page 8: Update from android kk to android l

8

Android work architecture

Google backend

services/Google

apps for work

Device policy client

Work profile

Google play

service s for

work

APK for work

APK for work

APK for work

APK for work

APK for workManagerProvisio

n APK

Enterprise server proxy/Device

Management Gateway

AOSP

Enterprise services

Google play for work

MDM architecure

Enterprise server

AFW agent

Page 9: Update from android kk to android l

9

Android work architecture(2)

APKS

Frameworks

Laucher Recent NotificationManagerProvisin

g

UserManagerServi

cAMS

DevicePolicyManagerS

ervicePMS

Settings

MDM

NFC

App

Modified

New

Page 10: Update from android kk to android l

10

Update in Selinux

• “No new root processes without a policy.”

• many of the domains will be moved to enforcing

Page 11: Update from android kk to android l

11

Verified boot

• Boot starts with the bootloader

• Bootloader verifies the keystore

• The keystore is used to verify the boot image

• The boot image verifies the system image.

Page 12: Update from android kk to android l

12

Verified boot

Page 13: Update from android kk to android l

13

PnP

ART

64 bit support

New GC

New memory allocator

Job scheduler

Page 14: Update from android kk to android l

14

ART

JVM interface.

Memory allocator

OAT file format

GC

Page 15: Update from android kk to android l

15

OAT file format

Why Dex is added

Into OAT file?

Type finding

Debug

Page 16: Update from android kk to android l

1616

Dalvik VM vs. ART

Page 17: Update from android kk to android l

17

New GC – Reduce pause

Instead of two pauses totaling about 10ms for each GC,Only one GC(usually under 2ms) can be founded.

Page 18: Update from android kk to android l

18

New GC – Reduce fragmentation

Maintains larger primitives (like bitmaps) in aseparate pool

Page 19: Update from android kk to android l

19

New GC – Be aware of app states

Parallelized portions of the GC runs and optimized collection strategies to be aware of device states.

For example, a full GC will run only when the phone is locked and user interaction responsiveness is no longer important.

Page 20: Update from android kk to android l

20

New memory allocator

For Bionic, Dlmalloc or Jemalloc can be configured

at build time.

For Java, rosmalloc is instead of

Dlmalloc.

Page 21: Update from android kk to android l

21

Job scheduler

New Job Scheduler API that lets you optimize battery life by defining jobs for the system to run asynchronously at a later time or under specified conditions

Page 22: Update from android kk to android l

22

64Bit - Two zygotes

Page 23: Update from android kk to android l

23

64Bit-Start a new APK

Page 24: Update from android kk to android l

24

Interaction with other devices

Android auto

Android wear

Android cast

Page 25: Update from android kk to android l

25

Android auto

Auto.APK

Phone_auto.apk

Carservice.apk

GMSClient

USB

Phone

Auto IVI

Carservice.apk is a GMS.apk which implement the protocols and services to communicate with Auto.apk in IVI system.Auto.apk is an android implementation to support android Auto in IVI system. Phone_auto.APK implements the UI which is be displayed in IVI.

Page 26: Update from android kk to android l

26

Android auto(2)

The implementation of Carservice and HeadUnit can be divided into five layers.

Page 27: Update from android kk to android l

27

Android wear

27

Host android

Phone/TabletAndroid

wear

BlueTooth

Bluetooth 4.0: GATT and RFCOMM over ERD profiles

Android

Wear.apk

Page 28: Update from android kk to android l

28

Android cast – media projection

Media content is prepared by capturing the screen continually and is projected to a connected secondary device for playback, the secondary device only outputs the content in its final form.

Page 29: Update from android kk to android l

29

Maintainability

Split "monolithic" APK Dynamic resource overlay

Page 30: Update from android kk to android l

30

Split "monolithic" APK

A single "monolithic" APK can be implemented as multiple "split" APKs to:

• Improve maintainability.

• Convenient to the update of APK.

• Support maximum of the method in Dex file to beyond 65k.

Page 31: Update from android kk to android l

31

Split "monolithic" APK(2)

Apps packaged as multiple split APKs always consist of a single "base" APK and zero or more "split" APKs. Any subset of these APKs can be installed together, as long as the following constraints are met:

• All APKs must have the exact same package name, version code, and signing certificates.

• All APKs must have unique split names.

• All installations must contain a single base APK.

Page 32: Update from android kk to android l

32

Dynamic resource overlay

The resource in overlay APK will be loaded in running time to instead of the existing resource in original APK

Page 33: Update from android kk to android l

33

Java 7 Support

Type Inference for Generic Instance Creation Strings in switch Statements The try-with-resources Statement Binary Literals Underscores in Numeric Literals Catching Multiple Exception Types and Re-

throwing Exceptions with Improved Type Checking

Page 34: Update from android kk to android l

34

Type Inference for Generic Instance Creation

Before Java7

Map<String, List<String>> myMap = new HashMap<String, List<String>>();

After Java7, you can substitute the parameterized type of the constructor with an empty set of type parameters (<>):

Map<String, List<String>> myMap = new HashMap<>();

Page 35: Update from android kk to android l

35

Strings in switch Statements

public String getTypeOfDayWithSwitchStatement(String dayOfWeekArg) {

String typeOfDay;

switch (dayOfWeekArg) {

case "Monday":

typeOfDay = "Start of work week";

break;

case "Tuesday":

typeOfDay = "Midweek";

break;

default:

throw new IllegalArgumentException("Invalid day of the week: " + dayOfWeekArg);

}

return typeOfDay;

}

Page 36: Update from android kk to android l

36

The try-with-resources Statement

Before Java7String readFirstLine (String path) throws IOException {

BufferedReader br = new BufferedReader(new FileReader(path));

try {

return br.readLine();

} finally {

if (br != null) br.close();

}

}

FromJava7, The try-with-resources statement ensures that each resource (implements java.lang.AutoCloseable/java.io.Closeable) is closed at the end of the statement.

String readFirstLine (String path) throws IOException {

try (BufferedReader br = new BufferedReader(new FileReader(path))) {

return br.readLine();

}

}

Page 37: Update from android kk to android l

37

Binary Literals

In Java SE 7, the integral types (byte, short, int, and long) can also be expressed using the binary number system.

// An 8-bit 'byte' value:

byte aByte = (byte)0b00100001;

// A 16-bit 'short' value:

short aShort = (short)0b1010000101000101;

// Some 32-bit 'int' values:

int anInt1 = 0b10100001010001011010000101000101;

int anInt2 = 0b101;

int anInt3 = 0B101; // The B can be upper or lower case.

Page 38: Update from android kk to android l

38

Underscores in Numeric Literals

To improve the readability of your code.

long creditCardNumber = 1234_5678_9012_3456L;

long socialSecurityNumber = 999_99_9999L;

Page 39: Update from android kk to android l

39

Catching Multiple Exception

Before Java7catch (IOException ex) {

logger.log(ex);

throw ex;

catch (SQLException ex) {

logger.log(ex);

throw ex;

}

FromJava7catch (IOException|SQLException ex) {

logger.log(ex);

throw ex;

}

Page 40: Update from android kk to android l

40

What maybe be available in Android M?

Modularity Security

Dynamic permission checking will be enabled.

All domain will be enforcing in Selinux. Others

Multi-Sim card support.

Page 41: Update from android kk to android l

41

Modularity - One codebase to support different devices on demand

Page 42: Update from android kk to android l

42

Performance - Compact GC to reduce memory fragment

Page 43: Update from android kk to android l

43

Dynamic permission check

Client

AppOpsManager.javaAppOpsManager.cpp

Settings.apk

Server

AppOpsService

3rdPartyApp

BinderAndroid Service

LocationManagerServiceNotificationManagerService

GeofenceManagerGpsLocationProvider

IccSmsInterfaceManagerPhoneInterfaceManger

WifiServiceContentProvider

WindowManagerService…...

Check permission by using

AppOpsManager

Read/write the permission of one apk Binder

appops.xml