Category Archives: Android

Android Interface Definition Language (AIDL)

The Android Interface Definition Language (AIDL) is similar to other IDLs you might have worked with. It allows you to define the programming interface that both the client and service agree upon in order to communicate with each other using interprocess communication (IPC). On Android, one process cannot normally access the memory of another process. So to talk, they need to decompose their objects into primitives that the operating system can understand, and marshall the objects across that boundary for you. The code to do that marshalling is tedious to write, so Android handles it for you with AIDL.

Note: Using AIDL is necessary only if you allow clients from different applications to access your service for IPC and want to handle multithreading in your service. If you do not need to perform concurrent IPC across different applications, you should create your interface by implementing a Binder or, if you want to perform IPC, but do not need to handle multithreading, implement your interface using a Messenger. Regardless, be sure that you understand Bound Services before implementing an AIDL.

 

是时候迁移到Android X了

Jetpack == Androidx <== Android Support,Jetpack内部名称和开源项目都叫AndroidX这个名字。

28.0.x 将会是android.support命名空间的最后一个版本号,所有功能将会完全迁到新的X命名空间,其中也包括Google Play Service, Firebase等Library.

视频传送门

Android coding log

初始化一个Button

Button btn = (Button) findViewById(R.id.button);
btn.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            /* action here*/
        }
});

setOnClickListener Method传递一个OnClickListener Interface Object. 从而Interface的OnClick方法被调用.

Kotlin的{} curly braces 可以是一个匿名函数Anonymous functions , shell 里面叫group command .

Java 子类不能override 父类没有定义的method.

The Activity class is a crucial component of an Android app, and the way activities are launched and put together is a fundamental part of the platform’s application model. Unlike programming paradigms in which apps are launched with a main() method, the Android system initiates code in an Activity instance by invoking specific callback methods that correspond to specific stages of its lifecycle.

A Fragment represents a behavior or a portion of user interface in a FragmentActivity. You can combine multiple fragments in a single activity to build a multi-pane UI and reuse a fragment in multiple activities. You can think of a fragment as a modular section of an activity, which has its own lifecycle, receives its own input events, and which you can add or remove while the activity is running (sort of like a “sub activity” that you can reuse in different activities).

Shell 脚本链接

https://github.com/LineageOS/android_device_xiaomi_mido/blob/lineage-15.1/extract-files.sh

https://github.com/LineageOS/android_device_xiaomi_msm8953-common/blob/lineage-15.1/extract-files.sh

https://github.com/LineageOS/android_vendor_lineage/blob/lineage-15.1/build/tools/extract_utils.sh

https://github.com/LineageOS/android_device_xiaomi_mido/blob/lineage-15.1/proprietary-files.txt

Android GMS Barcode Scanner代码跟踪

用Android Studio看SS-Android 关于Barcode Scanner部分的代码,就想知道Detector是怎么实现Barcode识别的,到最后发现都是系统调用。

类跟踪:BarcodeDetector->zzh->zzn.zza->zzg->IInterface(Binder)->Barcode

Binder is an Android-specific interprocess communication mechanism, and remote method invocation system.

Container for a message: Parcel https://developer.android.com/reference/android/os/Parcel.html

GMS —Google Mobile Services brings Google’s most popular apps and APIs to your Android devices.

With the release of Google Play services 7.8 we’re excited to announce that we’ve added new Mobile Vision APIs which provide bar code detection APIs that read and decode a myriad of different bar code types, quickly, easily and locally.

Google Sample Android -Vision : The Mobile Vision API is now a part of ML Kit. We strongly encourage you to try it out, as it comes with new capabilities like on-device image labeling! Also, note that we ultimately plan to wind down the Mobile Vision API, with all new on-device ML capabilities released via ML Kit. Check out this codelab to use the vision APIs in ML Kit.

Firebase gives you the tools to develop high-quality apps, grow your user base, and earn more money. We cover the essentials so you can monetize your business and focus on your users.

ML Kit (for Firebase) is a mobile SDK that brings Google’s machine learning expertise to Android and iOS apps in a powerful yet easy-to-use package. Whether you’re new or experienced in machine learning, you can implement the functionality you need in just a few lines of code. There’s no need to have deep knowledge of neural networks or model optimization to get started. On the other hand, if you are an experienced ML developer, ML Kit provides convenient APIs that help you use your custom TensorFlow Lite models in your mobile apps.

TensorFlow Lite is a set of tools to help developers run TensorFlow models on mobile, embedded, and IoT devices. It enables on-device machine learning inference with low latency and a small binary size.

The live camera object detection feature uses both existing Material Design components and new elements specific to camera interaction. For code samples and demos of new elements (such as the reticle), check out the ML Kit Material Design showcase apps’ source code for Android and iOS.

Android 和 Google的产品各有偏重,Google强调跨平台,Android 的AOSP强调生态and系统行为模式,GMS 会慢慢简化,能做到跨平台的功能都转到Google去。

ninja: error

编译报错,通过搜索找到台部落相关文章,原来是vendor/qcom/proprietary的问题

ninja: error: ‘out/target/product/msm8953_64/obj_arm/SHARED_LIBRARIES/libqct_resampler_intermediates/export_includes’,
needed by ‘out/target/product/msm8953_64/obj_arm/SHARED_LIBRARIES/libaudioresampler_intermediates/import_includes’,
missing and no known rule to make it

make: *** [ninja_wrapper] Error 1

java 环境设置

export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
export JRE_HOME=/usr/lib/jvm/java-8-openjdk-amd64/jre

export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH
export CLASSPATH=$JAVA_HOME/lib:$JAVA_HOME/jre/lib:$CLASSPATH

Wireless Connectivity Subsystem

repo sync 时注意到qcacld,去看了下代码

https://source.codeaurora.org/quic/la/platform/vendor/qcom-opensource/wlan/qcacld-2.0/tree/

qcacld  应该是指Qualcomm Atheros Cross-Layer Design,有本书叫Improving the Performance of Wireless LANs 详细介绍了此技术的细节。

注意到WCNSS : Wireless Connectivity Subsystem,通过搜索看到了lwn上的记录

记录提到此驱动是remoteproc,解释:https://www.kernel.org/doc/Documentation/remoteproc.txt

lwn上此架构的引申参考Introducing a generic AMP framework

记录一个关于内核的博客:https://saurabhsengarblog.wordpress.com/