Rounding off GSOC'22: Android SDK Tool in Debian

Rounding off GSOC'22: Android SDK Tool in Debian

I am excited to share a summary of my experience, learning , challenges and progess in the 2022 Google Summer of Code with Debian. Debian maintains a huge repository of Android SDK packages through the Debian Android Tools Team. The work in this round of GSOC is to scale this repository to include those components of Android SDK not yet packaged for Debian, and to update avialable packages to their latest upstream release versions. The goal is to ensure every bit of software required for android development is made fully avialable in linux systems, specifically Debian and Debian-based distros. I work with a co-intern, Raman Sarda to make this happen.

The challenge

Working with android packages required proficiency in Gradle, Maven, Kotlin, Groovy, and Java. This was a major blocker for me as I had no experience in all of these prior to GSOC. I had to deal with learning new technologies and languages on the job. My work was made much easier by the ever-avialability and responsiveness of my mentors. They were very patient with me, always there to answer all my questions, clear my doubts, and recommend resources/links for additional reading. This gave me the needed motivation and made my work fun. I was so immersed in extensive learning, exploring and digesting different technologies, that building new knowledge and skills became as much important as finishing the project.

Summary of work done

Apksig: An existing Debian package updated to the latest upstream release version. Apksig is a project which aims to simplify APK signing and checking whether APK signatures are expected to verify on Android. apksig supports JAR signing (used by Android since day one) and APK Signature Scheme v2 (supported since Android Nougat, API Level 24).

Zipflinger: A new package debianized from Google Android sources. Zipflinger is a library dedicated to ZIP files manipulation. It can create an archive from scratch but also add/remove entries without decompressing/compressing the whole archive.

Bundletool(WIP): A new package debianized from Google Android sources. Bundletool is a tool to manipulate Android App Bundles. Bundletool does the following:

  • Build an Android App Bundle from pre-compiled modules of a project.
  • Generate an APK Set archive containing APKs for all possible devices.
  • Extract APK(s) from the APK Set compatible with a given device.
  • Install APK(s) from the APK Set compatible with a connected device.
  • Extract device spec from a device as a JSON file.
  • Add code transparency to an Android App Bundle. Code transparency is an optional code signing mechanism.

Gen_diff: A helper script for building a .jar file from each tag in Android Apksigner repository, and diffing the resultant .jar agaist the official binary.

Apktool: An existing Debian package updated to the latest upstream release version. Apktool is a tool for reverse engineering 3rd party, closed, binary Android apps. It can decode resources to nearly original form and rebuild them after making some modifications; it makes possible to debug smali code step by step.

Skill gains from GSOC

Learning Java, a statically-typed object-oriented language helped me understand better what Typescript was aiming to achieve in Javascript. Understanding Java interfaces and access modifiers demistified a lot of things in Typescript and Javascript for me. Understanding Java annotations helped me understand Typescript decorators, an experimental feature used heavily in Nestjs. I also learnt the difference between reference and primitive data types as relates to memory management.

Next Steps

My contributions will continue far beyond GSOC. Once I complete the bundletool package, I will proceed to build and update more Android Tools packages for Debian. I will continuosly update this article as more packages are being built/updated.