Upgrade to Pro — share decks privately, control downloads, hide ads and more …

AOSP Building Blocks (DevFest Berlin 2014)

danybony
November 22, 2014

AOSP Building Blocks (DevFest Berlin 2014)

Most of the Android developers are able to build awesome apps, but do we really know how the Android OS works? In some cases, as when developing a new product, adding customised apps is not enough, and OS modifications are required.
To be able to modify Android at its core, this talk will guide you through the complete process, from setting the correct environment, configuring the different Google’s repositories and downloading the source code, to understand the structure of the source code and how to modify it.

danybony

November 22, 2014
Tweet

More Decks by danybony

Other Decks in Technology

Transcript

  1. Repo and manifest <?xml version="1.0" encoding="UTF-8"?> <manifest> <remote name="aosp" fetch="https://android.googlesource.com/"

    /> <remote name="company" fetch="ssh://[email protected]/third_party/" /> <default revision="refs/tags/android-5.0.0_r7" remote="aosp" sync-j="4" /> <project path="build" name="platform/build" groups="pdk" /> <project path="abi/cpp" name="platform/abi/cpp" groups="pdk" /> <project path="art" name="platform/art" /> <project path="bionic" name="platform/bionic" groups="pdk" /> <project path="bootable/bootloader/legacy" name="platform/bootable/bootloader/legacy" /> <project path="bootable/diskinstaller" name="platform/bootable/diskinstaller" /> <project path="packages/apps/Settings" name="firmware-settings" remote="company" revision="other_branch" /> [...] <manifest/>
  2. @hide public static UserHandle getUserHandleForUser(int userId) { try { Class<UserHandle>

    userHandleClass = UserHandle.class; Constructor<UserHandle> constructor = userHandleClass.getDeclaredConstructor(int.class); constructor.setAccessible(true); return constructor.newInstance(userId); } catch (InvocationTargetException e) { logUnableToFetchUserHandleForUser(userId, e); } catch (NoSuchMethodException e) { logUnableToFetchUserHandleForUser(userId, e); } catch (InstantiationException e) { logUnableToFetchUserHandleForUser(userId, e); } catch (IllegalAccessException e) { logUnableToFetchUserHandleForUser(userId, e); } return null; } REFLECTION
  3. Speeding up the dev cycle make alias for single projects

    m = make from the top of the tree mm = make from the current directory mmm = make from the given directory mmma = make from the given directory WITH dependencies