Category Archives: Linux

记录最近

最近从SS-A的build错误得到了很多新的概念

Rust — Microsoft C++ build tools for Visual Studio — vspkg&nuget — Perl — openssl

build environment – CI/CD — Android Studio NDK — Clang — llvm — cmake — gcc — mysys2 — mingw — Cygwin — git — docker

CircleCI — Travis-ci — Snap — Bintray — Jcenter — crates.io

libev — socket

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去。

腾达AC9折腾记

京东上买了两台AC9 ,都刷了恩山论坛上提供的改版asuswrt.

经过几天的折腾,发现/jffs/script 是工作的,一开始忘记了脚本+x, 浪费了些时间.

通过测试发现下面这些config都是不工作的.

/jffs/configs/dnsmasq.conf.add

/jffs/configs/dnsmasq.conf

/jffs/configs/dnsmasq.d/dnsmasq.conf

/jffs/configs/dnsmasq.d/dnsmasq.conf.add

然后尝试cp /jffs/configs/dnsmasq.conf /etc/ ,然后kill 掉lsof -c dnsmasq得来的进程号,发现dnsmasq很快再启动后,自定义的配置仍然被覆盖.