Showing posts with label android. Show all posts
Showing posts with label android. Show all posts

Tuesday, April 19, 2022

Understanding Audio Tracks and Configurations

Understanding Audio Tracks and Configurations

In the context of audio processing and playback on computer systems or mobile devices, there are various modes and configurations designed to optimize performance and power consumption. These modes can significantly impact the audio quality, latency, and power efficiency of the system. Let's delve into each of the mentioned audio tracks and configurations in detail.

Normal Tracks:

  • Audio Format: PCM (Pulse Code Modulation) is commonly used for high-quality audio playback.
  • Buffer Size: Typical buffer size is approximately 20 milliseconds.
  • Latency: Higher latency, which means there might be a slight delay between when the audio is generated and when it's heard.
  • Purpose: This mode prioritizes audio quality and is suitable for scenarios where latency is not a critical concern, such as music playback or video streaming.

Fast Tracks:

  • Audio Format: PCM (Pulse Code Modulation).
  • Buffer Size: Typical buffer size is 5 milliseconds or even less.
  • Latency: Lower latency, resulting in minimal delay between audio generation and playback.
  • Purpose: Fast tracks are optimized for real-time applications where low latency is essential. This includes voice calls, gaming, and any situation where immediate audio feedback is critical.

Deep Buffer:

  • Audio Format: PCM (Pulse Code Modulation).
  • Buffer Size: Typical buffer size is greater than or equal to 100 milliseconds.
  • Latency: Very high latency, which can result in significant delays.
  • Purpose: Deep buffer mode is primarily used to conserve power. By allowing longer gaps between audio processing, the system can enter low-power states more frequently. This mode may be suitable for audio playback in situations where power efficiency is more critical than low latency, such as background music playback.

Codec Offload:

  • Audio Format: Compressed audio formats like MP3, AAC, etc.
  • Buffer Size: Typically involves very high latency.
  • Latency: Very high latency, similar to deep buffer mode.
  • Purpose: Codec offload mode is designed to save even more power by offloading audio decoding tasks to dedicated hardware or specialized DSPs (Digital Signal Processors). This mode is suitable for scenarios where power consumption needs to be minimized at the expense of higher latency. It's commonly used in low-power or battery-sensitive devices during audio playback.

The command grep -r DEEP_BUFFER in frameworks/av/* is likely used to search for references or configurations related to the "Deep Buffer" mode within the Android Audio/Video framework. This search can help developers or system administrators find specific code or settings related to this mode, allowing them to customize or optimize the audio playback behavior based on their requirements.

In summary, the choice of audio track and configuration mode depends on the specific use case, with trade-offs between audio quality, latency, and power efficiency. Understanding and customizing these modes can help achieve the desired audio performance for various applications.

Building AOSP for Google Pixel 3a (Sargo)

Building Android from Source for Pixel 3a

In this blog post, we will guide you through the process of building Android from source for the Pixel 3a smartphone. Building Android from source gives you full control over the operating system and allows for customization. We'll also cover how to handle common issues during the process.

Step 1: Get the Source Code

  1. Create a directory for the project:
    mkdir aosp12
    cd aosp12
          
  2. Initialize the repository with the Android source code:
    repo init -u https://android.googlesource.com/platform/manifest -b android-12.1.0_r27
          
  3. Sync the source code to your local machine:
    repo sync -c --force-sync --no-clone-bundle --no-tags -j$(nproc --all)
          

Step 2: Handling Repo Sync Errors

If you encounter any errors during the repo sync process, follow these steps:

  1. Navigate to the .repo/repo directory:
    cd .repo/repo
          
  2. Check out forcefully:
    git checkout -f
          
  3. Retry the repo sync with the following command:
    repo sync -c
          

Step 3: Download Driver Binaries

Next, you'll need to download the driver binaries for the same Build ID that you selected previously. For Pixel 3a, you can find the drivers here.

After downloading, extract the driver binaries into your project directory (aosp12).

Step 4: Build Android

  1. Set up the build environment:
    source build/envsetup.sh
          
  2. Choose the build variant (userdebug in this case):
    lunch aosp_sargo-userdebug
          
  3. Build Android. You can specify the number of CPU cores to use for the build. For example, to use one core for kernel compilation and four cores for the rest of the build:
    m -j1 (till kernel compilation)
    m -j4 (after kernel compilation)
          

Step 5: Flash the Build

  1. Reboot your device into bootloader mode:
    adb reboot bootloader
          
  2. Flash the build onto your device. This will wipe all data, so be cautious:
    fastboot flashall -w
          

Step 6: Finalize and Test

After flashing, your device will reboot. You can then:

  1. Reconnect to the device:
    adb root
    adb remount
          
  2. Reboot your device:
    adb reboot
          

Conclusion

Congratulations! You've successfully built and flashed Android from source for your Pixel 3a smartphone. Enjoy your custom Android experience!

Friday, April 15, 2022

Build Pixel Experience 11 for Realme 3 pro

https://wiki.pixelexperience.org/devices/RMX1851/build

pixelexp11/.repo/manifests$ git remote -v
origin https://github.com/PixelExperience/manifest (fetch)
origin https://github.com/PixelExperience/manifest (push)

pixelexp11/.repo/manifests$ git branch -a
* default
  remotes/m/eleven -> origin/eleven
  remotes/origin/eleven

pixelexp$ repo status
project device/realme/RMX1851/                  (*** NO BRANCH ***)
 -m     device.mk
project kernel/realme/sdm710/                   (*** NO BRANCH ***)
 -m     Makefile
 -m     drivers/staging/qcacld-3.0/Kbuild 

pixelexp/device/realme/RMX1851$ git diff
diff --git a/device.mk b/device.mk
index d4a032a..736ab51 100644
--- a/device.mk
+++ b/device.mk
@@ -157,8 +157,8 @@ PRODUCT_COPY_FILES += \
 PRODUCT_PACKAGES += \
     libnl

-PRODUCT_BOOT_JARS += \
-    WfdCommon
+#PRODUCT_BOOT_JARS += \
+#    WfdCommon 

 # Wallpapers
 PRODUCT_PACKAGES += \

no changes added to commit (use "git add" and/or "git commit -a")
pixelexp/kernel/realme/sdm710$ git diff
diff --git a/Makefile b/Makefile
index 276f98015b43..05b4407fdf0d 100755
--- a/Makefile
+++ b/Makefile
@@ -692,6 +692,10 @@ CFLAGS_GCOV        := -fprofile-arcs -ftest-coverage \
        $(call cc-option,-fno-tree-loop-im) \
        $(call cc-disable-warning,maybe-uninitialized,)
 CFLAGS_KCOV    := $(call cc-option,-fsanitize-coverage=trace-pc,)
+
+KBUILD_CFLAGS += $(call cc-option,-Wno-error=maybe-uninitialized,)
+KBUILD_CFLAGS += $(call cc-option,-Wno-error=array-bounds,)
+
 export CFLAGS_GCOV CFLAGS_KCOV

 # Make toolchain changes before including arch/$(SRCARCH)/Makefile to ensure
diff --git a/drivers/staging/qcacld-3.0/Kbuild b/drivers/staging/qcacld-3.0/Kbuild
index 0631e4b76016..93df236bc784 100644
--- a/drivers/staging/qcacld-3.0/Kbuild
+++ b/drivers/staging/qcacld-3.0/Kbuild
@@ -1573,7 +1573,6 @@ ccflags-y += $(INCS)
  cppflags-y +=  -DANI_OS_TYPE_ANDROID=6 \
                -Wall\
-               -Werror\
                -D__linux__
 cppflags-$(CONFIG_PTT_SOCK_SVC_ENABLE) += -DPTT_SOCK_SVC_ENABLE

install android 10 to unlock bootloader using:
https://download.c.realme.com/flash/Rollbackpack/realme_3Pro/sign_RMX1851EX_11_OTA_1180_all_w236tl6xfsaL.ozip

Turn off your phone-->
Long press the volume down and power buttons at the same time enter recovery mode-->
Choose the language -->
Install from storage-->
Input your screen locked password-->
Find & tap the rollback package to go back to the previous version.

Follow steps to unlock bootloader:
https://c.realme.com/in/post-details/1243537172376584192

Flash recovery twrp:
https://www.right-brothers.net//how-to-unlock-bootloader-of-realme-3-pro-guide/n

Install pixel experience
https://www.right-brothers.net/how-to-install-pixel-experience-rom-on-realme-3-pro/

adb reboot bootloader
fastboot flash recovery twrp-3.4.0-0-RMX1851.img

Note: if there is problem with fastboot command, use usb2.0 port or usb2.0 hub

fastboot reboot
adb reboot recovery

wipe all except vendor partition.
install PixelExperience_RMX1851-11.0-20211216-0324-UNOFFICIAL.zip

Build AOSP 10 for Lenovo Vibe K5 Plus

Requirement: Ubuntu 21.04 with 16GB RAM and 10GB swap
https://github.com/AOSP-LEGACY/manifest#readme

mkdir aosp10

cd aosp10
repo init -u https://github.com/AOSP-LEGACY/manifest -b ten
repo sync -c -f --force-sync --optimized-fetch --no-tags --no-clone-bundle --prune -j$(nproc --all)

mkdir -p kernel/lenovo/msm8916 && cd kernel/lenovo/msm8916
git clone https://github.com/ArrowOS-Devices/android_kernel_lenovo_msm8916.git -b arrow-10.0

mkdir -p device/lenovo/A6020 && cd device/lenovo/A6020
git clone https://github.com/ArrowOS-Devices/android_device_lenovo_A6020.git -b arrow-10.0

mkdir -p vendor/lenovo/A6020 && cd vendor/lenovo/A6020
git clone https://github.com/ArrowOS-Devices/android_vendor_lenovo_A6020.git -b arrow-10.0


Add in file: hardware/qcom/wlan/wcnss-service/Android.mk

+ifneq ($(QCPATH),)
 LOCAL_CFLAGS += -DWCNSS_QMI -DMDM_DETECT
 LOCAL_SHARED_LIBRARIES += libwcnss_qmi
 else
 LOCAL_CFLAGS += -DWCNSS_QMI_OSS
 LOCAL_SHARED_LIBRARIES += libdl
+endif #QCPATH
+#include $(BUILD_SHARED_LIBRARY)

Add in file: device/lenovo/A6020/BoardConfig.mk
+ALLOW_MISSING_DEPENDENCIES=true

source build/envsetup.sh
lunch arrow_A6020-userdebug
m -j1 (j1 is set to avoid system hang and kernel failure)
m -j4 otapackage (to build zip flashable package)

make dist (http://jhshi.me/2014/11/09/aosp-release-tools/index.html)

adb reboot bootloader
fastboot boot twrp-3.3.1-0-A6020.img 

wipe all data and partition using twrp recovery 

install aosp-10-20220109-0926-A6020.zip
install open_gapps-arm64-10.0-pico-20211217.zip

Saturday, February 9, 2013

Surface Flinger

References:
http://tjc411.wordpress.com/android/surfaceflinger/
http://kcchao.wikidot.com/surfaceflinger
http://blog.csdn.net/maxleng/article/details/5671271
http://www.cnitblog.com/luofuchong/archive/2011/10/13/76022.html
http://www.cnblogs.com/xl19862005/archive/2011/11/17/2215363.html
http://developer.mips.com/2012/04/11/learning-about-android-graphics-subsystem/
http://stackoverflow.com/questions/3076529/surfaceflinger-test-program
http://blog.csdn.net/yili_xie/article/details/4803548

Stagefright Player

An Overview Of Surface Flinger 

Best Android Internal Tutorial:
http://marakana.com.s3.amazonaws.com/intel/courseware/Android_Internals.html

Complete Video Playback Flow:  
http://marakana.com.s3.amazonaws.com/intel/courseware/Android_Internals.html#slide-80
http://diousk.blogspot.in/2012/03/android-40-ice-cream-sandwich-media.html
http://feed.pixnet.net/blog/posts/atom/iamkcspa
http://comments.gmane.org/gmane.comp.handhelds.android.porting/14423

http://code.google.com/p/andraudio/wiki/GingerbreadMP3Diagrams

http://marakana.com/s/remixing_android,1044/index.html

Binder: http://www.cnblogs.com/innost/archive/2011/01/09/1931456.html