Notes on understanding Android.
1. Storage
Android storage is really mind-boggling.
Background reading: https://www.kernel.org/doc/Documentation/filesystems/sharedsubtree.txt
2. Security
https://android.stackexchange.com/questions/210139/what-is-the-u-everybody-uid/210159#210159
Selinux?
https://android.stackexchange.com/questions/210139/what-is-the-u-everybody-uid/
Runtime permissions
https://source.android.com/devices/storage#runtime_permissions
Namespaces
https://developer.android.com/training/data-storage#scoped-storage
3. getprop
This is a kind of “Registry” for system properties. “getprop” -T -Z
They have something like selinux attributes attached to them (crazy!), so you need to understand SELinux first, before doing anything useful with them.
I have not found a corresponding setprop, however, there exists settings
4. init.rc
This is something like what Android has instead of init.d (why would you reinvent the wheel again?). Magisk can plug into this file without making the system go insane, but I guess it is better to use Magisk’s services anyway.
5. List of Java apps:
/data/system/packages.list
6. am
Some command for activities/services management.
For example, you can restart “Airplane Mode” by typing:
#!/system/bin/sh settings put global airplane_mode_on 1 sleep 1 am broadcast -a android.intent.action.AIRPLANE_MODE sleep 1 settings put global airplane_mode_on 0 sleep 1 am broadcast -a android.intent.action.AIRPLANE_MODE
7. A list of new issues appeared when learning some more Android
7.1. Unset _JAVA_OPTIONS
Because Android Studio is shit and broken.
7.2. Unset
7.3. Delete all Android Studio data when updating
Otherwise very weird symptoms occur
- ~/.config/
7.4. when you change applicationId, it is not enough to re-sync Gradle
You also have to manually delete all run configurations and re-sync, otherwise weird errors occur.
~/.config/Google/AndroidStudio2024.2/
7.6. Sometimes adb server fails
The symptom is
Adb connection Error:EOF Cannot reach ADB server, attempting to reconnect daemon not running; starting now at tcp:5037
I fixed this by switching from openscreen to bonjour in Debugger settings.
This also makes the emulator start/stop buttons work again.
7.7. Camera APP in the emulator crashes.
This is because Google has a broken AOSP Marshmallow (Android 6.0) image. Use the Google API enabled one.