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

Learn Android with AOSP

Karumi
June 21, 2016

Learn Android with AOSP

Android Open Source Project contains all the code related to the Android SDK and most of the Android system applications. We can learn a lot about Android checking how the system is implemented. We can read the calculator app code to learn about material design, learn about how the Android Manifest works or review how different system activities are launched just reading the ASOP code.

Karumi

June 21, 2016
Tweet

More Decks by Karumi

Other Decks in Technology

Transcript

  1. We embark on every project with a commitment to create

    something elegant, enduring and effective. That is our heartbeat. Our approach is uniquely simple and honest, we are a small dedicated software studio, delivering outstanding work. Karumi is the Rock Solid code software development studio.
  2. Linux Kernel Warelocks / Lowmem / Binder / Logger /

    Ram Console / … Libraries Bionic / OpenGL / WebKit … Native Daemons HAL Init / toolbox Dalvik / Android Runtime / Zygote System Services Power Manager / Package Manager / Windows Manager / android.* Stock Android App Launcher3 / Camera2 / Calculator… java.* Apache Harmony Your Apps / Market Apps App API Binder JNI
  3. Review Manifests <application android:icon="@mipmap/ic_launcher_calculator" android:label="@string/app_name" android:theme="@style/CalculatorTheme"> <activity android:name=".Calculator" android:label="@string/app_name" android:windowSoftInputMode="stateAlwaysHidden">

    <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> <category android:name=“android.intent.category.APP_CALCULATOR"/> </intent-filter> </activity> </application>
  4. Review Manifests Permissions: android:sharedUserId=“android.uid.system" android:sharedUserId="android.uid.shared" Apps in the /system folder.

    System is not mount for write by default. cat /proc/mounts mount -o rw,remount -t ext4 <block-name> /system Signed with the same Certificate
  5. Review Code Sample Calculator Reveal: private void reveal(View sourceView, int

    colorRes, AnimatorListener listener) { … final Animator revealAnimator = ViewAnimationUtils.createCircularReveal (revealView,revealCenterX, revealCenterY, 0.0f, revealRadius); … }
  6. Review Code Using the framework: new ChooseLockSettingsHelper(getActivity(), this) .launchConfirmationActivity(KEYGUARD_REQUEST,"",""); if

    (resultCode == Activity.RESULT_OK && data != null) { String password = data.getStringExtra (ChooseLockSettingsHelper.EXTRA_KEY_PASSWORD); }
  7. Review Code /*hide*/ : smClass = Class.forName(“android.os.ServiceManager"); Method getService =

    smClass.getMethod("getService", String.class); IBinder binder = (IBinder) getService.invoke(null, “power"); IPowerManager powerStub = IPowerManager.Stub. asInterface(binder); powerStub.shutdown(false, true); provided files('providedLibs/layoutlib.jar')