<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Ruslan Kim on Medium]]></title>
        <description><![CDATA[Stories by Ruslan Kim on Medium]]></description>
        <link>https://medium.com/@kirussell?source=rss-794f266f89b4------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*IUXEmj4eQZnuS93B2QmtIA.png</url>
            <title>Stories by Ruslan Kim on Medium</title>
            <link>https://medium.com/@kirussell?source=rss-794f266f89b4------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 15:03:51 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@kirussell/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Get to know AOSP. I had a struggle to navigate to a Service.]]></title>
            <link>https://proandroiddev.com/get-to-know-aosp-i-had-a-struggle-to-navigate-to-a-service-f1476a113a8a?source=rss-794f266f89b4------2</link>
            <guid isPermaLink="false">https://medium.com/p/f1476a113a8a</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[aosp]]></category>
            <category><![CDATA[android-app-development]]></category>
            <category><![CDATA[androiddev]]></category>
            <dc:creator><![CDATA[Ruslan Kim]]></dc:creator>
            <pubDate>Wed, 14 Jun 2023 22:12:38 GMT</pubDate>
            <atom:updated>2023-06-14T22:14:52.853Z</atom:updated>
            <content:encoded><![CDATA[<p>This is one of those posts where I could have spilled out the answer in one sentence, but I decided to put a whole story behind this small but probably obvious finding of mine about AOSP. When you are an Android Apps developer and are onboarded to a team that builds OS for VR headsets that’s a bit of a challenge. Everything is so familiar but so different.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*n5PxO2hc69cNDwEdBYiYXw.png" /><figcaption>2020 during COVID-19&#39;s “Work from Home” times</figcaption></figure><p>That was 2019 half a year before the pandemic started, I joined Oculus, funny enough plenty of people did not even know it was part of Facebook. I joined the VROS team that was building the best operating system for VR, then MR, and hope AR in the future. I was excited to join VR space with my experience in Android App development: migrations to Dagger, constantly checking better RxJava operators suitable to display a list of items, applying MVP then MVVM then Unidirectional flow, moving Views on screen left 3 pixels then right 4. It was a new area for me and an unknown territory of working with AOSP (VROS is Android under the hood).</p><p>While being a (I hope) decent Android App developer I never understood why would I need Android Services at all. The only thing I remembered about working with services was a super old presentation about HTTP requests in the background where an example showed a service that was using HttpUrlConnection to juggle bytes back and forth. I was always unsure why would it need a Service. One of a few places I dealt with Services as an App developer were all these fancy SDKs and libs that used Services to “grind” things in the background, but you just call SDK API and don’t care much about Services implementations (unless there is a bug).</p><p>So I had a warm welcome from VROS or, actually, AOSP which is mainly Android Services or SystemServices talking to each other through IPCs, HALs, Broadcasts, and Intents. Now it’s not Activity lifecycle quirks anymore but weekdays of going through Java abstractions and JNI to get to native code and lots of times an AIDL to get to underlying Service behaviors. And if in the case of Broadcasts and Intents as an App developer, you know how to search actions and find raw string representations (i.e. <a href="https://cs.android.com/search?q=NEXT_ALARM_CLOCK_CHANGED&amp;sq=&amp;ss=android%2Fplatform%2Fsuperproject">NEXT_ALARM_CLOCK_CHANGED</a>), and JNI is also in most cases searchable by method names cause those are carefully named and can be distinguished from everything else, but for AIDLs, I was scratching my head for some time.</p><p>AIDL, if you don’t remember, is **<a href="https://developer.android.com/guide/components/aidl"><strong>Android Interface Definition Language</strong></a> — an interface that can be implemented somewhere in the code base and cannot be “physically” (as much as this word is applicable to code) connected to implementation if you would be able to use some smart IDE and of course, there is no IDE with indexed search (like ctrl+B in IntelliJ IDEA) that can decently work with whole AOSP. So text search it is — <a href="https://cs.android.com/android/platform/superproject">https://cs.android.com/android/platform/superproject</a>.</p><p>I.e. <a href="https://cs.android.com/android/platform/superproject/+/master:frameworks/base/telephony/java/android/telephony/TelephonyManager.java?q=TelephonyManager&amp;ss=android%2Fplatform%2Fsuperproject">TelephonyManager</a> class which is part of the Android framework that provides “information about telephony services on the device”. It uses <a href="https://cs.android.com/android/platform/superproject/+/master:frameworks/base/telephony/java/com/android/internal/telephony/ITelephony.aidl?q=ITelephony.aidl&amp;ss=android%2Fplatform%2Fsuperproject">ITelephony.aidl</a> under the hood to communicate which other system services that talk to deeper layers to get info. So if you need to find an implementation of the class behind that interface the most obvious thing is to <a href="https://cs.android.com/search?q=ITelephony&amp;sq=&amp;ss=android%2Fplatform%2Fsuperproject">search the exact word “ITelephony”</a> which gives you several hundreds of places to check. Not a super efficient spend of time to go through all of them (which I spent).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fE7oXUAUhpDz4TU-pr5Tag.png" /><figcaption><a href="https://cs.android.com/">cs.android.com</a> search aidl interface by name</figcaption></figure><p>I looked at other examples to make it easier for me to search and will show here just one to prove the point (in reality I spent a few weeks with different tasks to realize how stupid I was). <a href="https://cs.android.com/android/platform/superproject/+/master:frameworks/base/core/java/android/os/PowerManager.java">PowerManager</a> which does not need an introduction and it uses <a href="https://cs.android.com/android/platform/superproject/+/master:frameworks/base/core/java/android/os/IPowerManager.aidl">IPowerManager.aidl</a> which I would expect to be implemented by PowerManager, but no it’s not since it uses one. Same steps — <a href="https://cs.android.com/search?q=IPowerManager&amp;ss=android%2Fplatform%2Fsuperproject">searching “IPowerManager”</a> and luckily high enough in search results:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OEBNB2tiuMWzXNuFkWndqw.png" /><figcaption>IPowerManager.Stu abstract class implementation</figcaption></figure><p>So “IPowerManager.Stub” or even better “extends IPowerManager.Stub” seems like a reasonable query to use. And yes it works with the original case — <a href="https://cs.android.com/android/platform/superproject/+/master:packages/services/Telephony/src/com/android/phone/PhoneInterfaceManager.java?q=%22extends%20ITelephony.Stub%22&amp;ss=android%2Fplatform%2Fsuperproject">“extends ITelephony.Stub”</a> gives exactly one result to be 100% sure it is the implementation I need to mess around with.</p><p>Pretty simple. At some point, I even tried to ask ChatGPT, Bard, and Bing to point me to the implementation of a specified AIDL, so AI is not there yet (close but not correct), Im not losing my job at least this month.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*autwnEnXSzHzWSCB0WX9Jg.png" /><figcaption>Asking ChatGPT 3.5 to find ITelephony.aidl implementation</figcaption></figure><p>If you want to find code that receives and handles calls through AIDL search for “<em>AIDLInterfaceName.Stub”</em> or share a better approach in comments (I would really appreciate it).</p><p>It’s always great to learn something new and even after a decade of working with Android as an App developer diving into AOSP is exciting!</p><p>Are you packing APKs or working with AOSP?</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f1476a113a8a" width="1" height="1" alt=""><hr><p><a href="https://proandroiddev.com/get-to-know-aosp-i-had-a-struggle-to-navigate-to-a-service-f1476a113a8a">Get to know AOSP. I had a struggle to navigate to a Service.</a> was originally published in <a href="https://proandroiddev.com/">ProAndroidDev</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[I re-wrote Grab Android App. Do I regret it?]]></title>
            <link>https://medium.com/better-programming/i-re-wrote-grab-android-app-do-i-regret-517a7bdf710b?source=rss-794f266f89b4------2</link>
            <guid isPermaLink="false">https://medium.com/p/517a7bdf710b</guid>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[android-app-development]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[refactoring]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Ruslan Kim]]></dc:creator>
            <pubDate>Wed, 10 May 2023 23:21:19 GMT</pubDate>
            <atom:updated>2023-05-16T08:16:38.680Z</atom:updated>
            <content:encoded><![CDATA[<p>Back in 2017, I had a great chance to rewrite a popular Android application that had over 30 million users. Of course that was a tremendous effort of the great team of engineers. But I had an opportunity to influence business decisions and then design architecture, and define tech that was fundamental for the future growth of the mobile application. But that was one of the hardest years in my career so far.</p><p>In 2017 I just joined the Android team at Grab — one of the biggest ride-hailing services in South East Asia (SEA) back then that beat Goliath (Uber) in Singapore and across SEA back in 2018 and now it’s the biggest Everyday Everything South East Asia’s leading superapp. But in 2017 it was a mess at least the Android part of the service. It needed some love.</p><p>In short: the whole app was split in 2 Activities with 4k lines of code each and communicating data through global variables, I think that says it’s all. You fix a price tag appearance and that breaks the taxi-booking button. So what would a normal engineering suggests yes… refactoring. So we started.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-hX6pUFPF1uEU37U_19nMg.png" /><figcaption>State of the codebase in 2017, before re-write.</figcaption></figure><p>Split into smaller components, move code around, run, it works, repeat. Except for “run → it works” transition was not always a thing. Highly coupled code and absence of clear requirements for features which is normal for a scrappy startup that has grown up fast is a recipe for a “life in not like a book” type of situation. So while refactoring you end up rewriting the whole activity and another one since those are coupled as I mentioned, and it would not pass any manual Quality Assurance, unit tests were out of the question with highly coupled code, and integration tests were not yet as affordable as today.</p><p>2015–2017 were years of MVW (Model View Whatever) architectures rise, Kotlin was around and was close to become an official language for Android development (Google IO May 2017), Daggerization of the Android world (not Hiltization yet) was a thing already, and Reactive programming was all about RxJava and memoization (pun intended) of how combine() works internally and on which thread emits results (no LiveData, Flow or anything else). Oh, how deep I was on that hype train looking back now. I wanted Everything Everywhere All at Once. So do other teammates — cause we all learn by doing, and we all wanted to learn.</p><p>So if any way we are rewriting the app while doing refactoring why not do a proper re-write? Is it logical? Except the business has agreed on refactoring not a rewrite. So how do you usually work around this? Yes, let’s do refactoring, build new features, and do rewrite all at the same time. Is THIS logical now? Nah, we were not the first we won’t be the last. Business was happy on that promise, we got our rewrite, all happy except for the “people/hours” metric, but it’s a startup right, they call it a hustle for a reason.</p><p>So the team continued building the product and 3 engineers including me seated in a room brainstorming ideas. What are the problems we are trying to solve, what tools do we have/want, and what do we anticipate the app will do? The main product idea at that time was seamless multimodal transportation — in simple words taxi-bike-bus-scooter trips. I still hear the echo of some product manager pitching this idea to management in meeting room again. So we created whole new architecture that composited MVP or MVVM (choose and pick) for features and Booking Core at the heart of the taxi experience.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vTWURLF0w0kQrzZRxHW6HQ.png" /><figcaption>Highlevel architecture of taxi application client</figcaption></figure><p>What went wrong? Uber released blog posts on RIBs or RIBlets architecture and gave an influx of bad ideas with Dagger at the heart of your Multimodal disaster with Kotlin and kapt. We read it like this: beautiful multimodal architecture that solves all your problems for feature teams structured development, isolation, quick builds, team collaboration… mmm perfect. Except for an unspecified mountain of problems with a learning curve, build times and “Do you want 1000 modules by the end of the year” developer life.</p><p>But young and brave we were. Small prototype worked and in 2018, slightly over 7–8 months in we were almost done. A couple of new features were built twice (refactored into new architecture), and old code was rewritten from scratch… from scratch, I repeat (that’s the definition of re-write). The next phase is testing. QA gets the build — we are waiting with temptation.</p><p>Today I hear engineers often say why the f* they need that many developers there are only 2 screens and a map I can build it in a week/month/3 months. I was there too, and you know I did not like to learn it the hard way. Important note here is that I joined in 2017 and a bunch of people who were rewriting joined after and there were no product specs or docs, so you get what you see.</p><p>QA lead showed me their TestRails (all use cases to test) and showed me rewritten app on a screen of an Oppo phone. “No surprise there is an issue, for sure some weird custom OS sh* again”. “Hello, world!”, Half of the screens like error handling, and flows with secondary business features were just missing. Cause we never heard, knew, or thought about those. +6 months of intensive burn-down charts, polishing and literally restoring features. Ah, and building other new features on the go — the main one was app redesign. And finally, we incremented Major Version Digit. Hello, new world — it was!</p><p>That was THE experience I would say. New design, new architecture, all new bells and whistles, bleeding edge technology (at least back then). We did it and that was a relief. Until the next product idea Everyday Everywhere Superapp.</p><p>Do I regret it? I don’t know. I gained experience and skills, I could have tried a roller coaster instead but that would not be that scary. I learned a lot in working with stakeholders, leading an effort, working till midnights :), and tickling nerves cause we could have lost a market because of decisions that I had made or influenced. After 6 years it seems like a big win for my personal growth and the personal growth of each team member.</p><p>Was it beneficial to the business? Probably yes, I was there while it became a leading Superapp in the region, and building blocks were put back then. It has 180 million users today.</p><p>Could that have been done the other way? Definitely yes, but life is not pre-calculated, and it had what it had.</p><p>Thanks for reading it till the end. If you are at that moment thinking to rewrite, think twice or better seven times, and if that’s still yes — go ahead and enjoy that experience! And you know what… check your product before rewriting, who knows what you might miss?</p><p>Would you rather rewrite or refactor?</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=517a7bdf710b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/better-programming/i-re-wrote-grab-android-app-do-i-regret-517a7bdf710b">I re-wrote Grab Android App. Do I regret it?</a> was originally published in <a href="https://betterprogramming.pub/">Better Programming</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Android Stories. Source of truth.]]></title>
            <link>https://medium.com/@kirussell/android-stories-source-of-truth-7f2eb38db807?source=rss-794f266f89b4------2</link>
            <guid isPermaLink="false">https://medium.com/p/7f2eb38db807</guid>
            <category><![CDATA[android]]></category>
            <category><![CDATA[android-app-development]]></category>
            <dc:creator><![CDATA[Ruslan Kim]]></dc:creator>
            <pubDate>Wed, 31 Aug 2016 16:01:02 GMT</pubDate>
            <atom:updated>2023-06-19T21:48:06.850Z</atom:updated>
            <cc:license>https://creativecommons.org/licenses/by-nc/4.0/</cc:license>
            <content:encoded><![CDATA[<h4>What is it all about?</h4><p>How many times did you spend hours to solve some dev problem? Speaking for myself: a lot. So my little stories will be all about these every-day investigations.</p><h4>Sharing is caring</h4><p>Monday, 1 pm, day was nice, lunch was delicious. Going to start new task, searching for good one to improve project and made user experience better. When your app is social net (in my case it is), you want people to have options for sharing things. Android is great in sharing, you just using Intents, preparing right action and right data structures, system will figure out itself who to address it (or user will with nice IntentChooser). This is what social app must have.</p><h4>TICKET-1798: Not able to share to Instagram</h4><p>Intents are good but they are not delivering files (photos/videos), only simple primitive data and one more problem is permissions, other app cannot read files from you sandbox directories. We have already used <a href="https://developer.android.com/reference/android/support/v4/content/FileProvider.html">FileProvider</a>, Lollipop feature, when you are able to share Uri for file and give other apps one-shot permission to use it. So that was the reported bug all about, FileProvider were not working properly. Logs (thx QA) showed that:</p><pre><em>java.lang.IllegalArgumentException: Failed to find configured root that contains &lt;path&gt;</em></pre><h4>I know I know</h4><p>“Yeah” - I said to myself. We’ve just recently changed paths for our file caches, just need to change config for FileProvider. Previous path was returned by <a href="https://developer.android.com/reference/android/content/Context.html#getCacheDir()">Context.getCacheDir()</a> and now it is <a href="https://developer.android.com/reference/android/content/Context.html#getExternalCacheDirs()">Context.getExternalCacheDirs()</a>. Looked into <a href="https://developer.android.com/reference/android/support/v4/content/FileProvider.html#SpecifyFiles">documentation</a> to properly configure paths.</p><pre>&lt;external-cache-path name=&quot;<em>name</em>&quot; path=&quot;<em>path</em>&quot; /&gt;</pre><p>Easy peasy, commit… push… I know, I know… but sometimes you just do. So I did, PR was merged, documentation was self-explanatory. Coffee, yeah, one cup with milk and sugar, just to reward myself.</p><h4>Fail: reproduced with same steps</h4><p>“God help this QA, f#$@%, all has to work correctly” — first thoughts. Ok, non-believer, lets reproduce it… sh%t, same error… why??? What is not correct, checking paths — correct, directories names — correct, documentation again — all seems clear and correct. Ok, <a href="https://medium.com/pointer-io/stack-overflow-as-a-service-eb86bd4b6fdd#.prwelm3zf">SODD</a>, help me. All answers were pointing to things that I had re-checked already: dir names, paths, typos. But all SO examples were using <em>file-path, cache-path and external-path</em>, but not <em>external-</em><strong><em>cache</em></strong><em>-path. </em>Lets, revert to Context.getCacheDir(), it seemed to be working. Ok, working, now what? Why does <em>external-cache-path</em> not working, when it has to? Hour of change-compile-debug iterations showed that all is working, but not what is needed. Thx to collegue with great idea — “try to look sources”. Its support-v4, it can be decompiled (at that time we were using target=24 without sources for awhile, but enough to become annoying and making you to get use to fact that there is no sources at hand)</p><h4>Source of truth</h4><p>And its the only one. <a href="https://android.googlesource.com/platform/frameworks/support/+/e131ccebd5983ad0c0ce530d9a47880c0ccc136c/v4/java/android/support/v4/content/FileProvider.java#577">FileProvider.java</a></p><pre>...<br>if (TAG_ROOT_PATH.equals(tag)) {<br>    target = buildPath(DEVICE_ROOT, path);<br>} else if (TAG_FILES_PATH.equals(tag)) {<br>    target = buildPath(context.getFilesDir(), path);<br>} else if (TAG_CACHE_PATH.equals(tag)) {<br>    target = buildPath(context.getCacheDir(), path);<br>} else if (TAG_EXTERNAL.equals(tag)) {<br>    target = buildPath(Environment.getExternalStorageDirectory(), path);<br>}<br>...</pre><p>These are processed paths. No <em>external-cache-path</em> at all =(. So there is wrong docs or implementation. To go deeper there is an <a href="https://code.google.com/p/android/issues/detail?id=61170">opened issue</a> about related problems, from 2013, reopened recently in June 2016.</p><h4>Hope</h4><p>So that was long and exhausting 2 hours for simple one-line (actually more than 5 lines, refactoring, you know) change. Hope next time I won’t forget, hope next time docs will be changed already.</p><p>Star the <a href="https://code.google.com/p/android/issues/detail?can=2&amp;start=0&amp;num=100&amp;q=&amp;colspec=ID%20Status%20Priority%20Owner%20Summary%20Stars%20Reporter%20Opened&amp;groupby=&amp;sort=&amp;id=61170">issue</a> and thank you for reading.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7f2eb38db807" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>