۵ مطلب در دی ۱۴۰۳ ثبت شده است

ready KODI for android TV

first we need set KODI as Launcher for Android so we need these changes:

 

you can do this with this helper text.

MODIFY ANDROIDMANIFEST.XML.IN TO MAKE KODI DETECTED AS A LAUNCHER

Modify tools/android/packaging/xbmc/AndroidManifest.xml.in to make Kodi a launcher so that:
Launcher intent filter is added to Main activity:

<intent-filter>
    <action android:name="android.intent.action.MAIN" />
        
    <category android:name="android.intent.category.HOME" />
    <category android:name="android.intent.category.DEFAULT" />
</intent-filter>

Splash and Main activities have android:launchMode="singleTop"
Splash and Main activities have android:documentLaunchMode="never"
Splash and Main activities have android:excludeFromRecents="true"
The developer guidelines suggest setting android:launchMode="singleTask" and androidConfusedtateNotNeeded="true" for launchers but this causes significant load times (as it starts from scratch every time you go to the home screen) and I have found no issues running with singleTop and no stateNotNeeded.

 

MODIFY XBMCAPP.CPP TO CATCH HOME BUTTON INTENT
To react to "Home button press" add handling for android.intent.action.MAIN/android.intent.category.HOME in void CXBMCApp::onNewIntent(CJNIIntent intent) (found on line 1076 in xbmc/platform/android/activity/XBMCApp.cpp):

  if(action == "android.intent.action.MAIN" && intent.hasCategory("android.intent.category.HOME"))
  {
    CApplicationMessenger::GetInstance().PostMsg(TMSG_GUI_ACTIVATE_WINDOW, WINDOW_HOME, 0, nullptr); // Sets Home window as active
  } else // below is original code
  if (!targetFile.empty() &&  (action == "android.intent.action.VIEW" || action == "android.intent.action.GET_CONTENT"))
  {
    CLog::Log(LOGDEBUG, "-- targetFile: %s", targetFile.c_str());
    ...

The above will send Kodi to Home.xml when the Home button is pressed (the key press doesn't generate a key press event, it only generates a MAIN/HOME intent). One could look at clearing the "Kodi window stack" as well (so that back button press after pressing home goes nowhere).

 

 

۰ نظر
علی فلاح

unpack amlogic image file and unpack super.img and flash

this instructions uses for unpack amlogic image file and unpack super.img file and then repack and flash on the device.

./bin/unpack  ./path/to/image.img
cd output/image
../../bin/simg2img super.PARTITION ./super.img
lpunpack ./super.img supers
cd supers
resize2fs ./system_a.img 1300M
e2fsck -E unshare_blocks ./system_a.imge2fsck -E unshare_blocks ./system_a.img
e2fsck -f ./system_a.img
mkdir sys
sudo losetup -P /dev/loop0 ./system_a.img
sudo mount /dev/loop0 ./sys -rw
cd sys
(make changes)
cd ..
sudo umount sys
resize2fs -M ./system_a.img
e2fsck -f ./system_a.img
resize2fs -M ./system_a.img
e2fsck -f ./system_a.img

lpmake \
  --metadata-size=65536 \
  --metadata-slots=3 \
  --device super:2097152000 \
  --group amlogic_dynamic_partitions_a:2086666240 \
  --group amlogic_dynamic_partitions_b:2086666240 \
  --partition system_a:readonly:1156333568:amlogic_dynamic_partitions_a \
  --image system_a=./system_a.img \
  --partition system_b:readonly:0:amlogic_dynamic_partitions_b \
  --partition vendor_a:readonly:157237248:amlogic_dynamic_partitions_a \
  --image vendor_a=./vendor_a.img \
  --partition vendor_b:readonly:0:amlogic_dynamic_partitions_b \
  --partition product_a:readonly:455888896:amlogic_dynamic_partitions_a \
  --image product_a=./product_a.img \
  --partition product_b:readonly:0:amlogic_dynamic_partitions_b \
  --partition odm_a:readonly:962560:amlogic_dynamic_partitions_a \
  --image odm_a=./odm_a.img \
  --partition odm_b:readonly:0:amlogic_dynamic_partitions_b \
  --partition system_ext_a:readonly:173031424:amlogic_dynamic_partitions_a \
  --image system_ext_a=./system_ext_a.img \
  --partition system_ext_b:readonly:0:amlogic_dynamic_partitions_b \
  --partition vendor_dlkm_a:readonly:59121664:amlogic_dynamic_partitions_a \
  --image vendor_dlkm_a=./vendor_dlkm_a.img \
  --partition vendor_dlkm_b:readonly:0:amlogic_dynamic_partitions_b \
  --partition system_dlkm_a:readonly:348160:amlogic_dynamic_partitions_a \
  --image system_dlkm_a=./system_dlkm_a.img \
  --partition system_dlkm_b:readonly:0:amlogic_dynamic_partitions_b \
  --partition odm_dlkm_a:readonly:348160:amlogic_dynamic_partitions_a \
  --image odm_dlkm_a=./odm_dlkm_a.img \
  --partition odm_dlkm_b:readonly:0:amlogic_dynamic_partitions_b \
  --sparse \
  --output ../super.PARTITION

./bin/repack ./name.img
./aml-burn-tool -b VIM4 -i /mnt/program/linux-amlogic-toolkit/name.img

 

۰ نظر
علی فلاح

flash and unpack Amlgoc image (S905Y4) in Linux OS

first, download tools from this link:

in newer version of amlogic chip, introdueced a new protocl called ADNL so you can't use old tools to burn image on newer device

./aml-burn-tool -b VIM4 -i /path/to/file.img

 

also, to unpack image fie you can use Linux Amlogic toolkit this repo on github.

 

in new version of android (from Android 10) system.img is not exist and some partition is inside of super.PARTITION so you should extract super partitino again. first you need to use simg2img to convert sparce image to raw image:

./bin/simg2img ./output/image/super.PARTITION  ./output/image/super.img

and then you can use lpunpack tool to unpack super partition:

lpunpack ./super.img supers

supers is a directory that I made.

۰ نظر
علی فلاح

mount system.img in android 10 in Read/Write mode

the error in mounting is:

couldn't mount RDWR because of unsupported optional features (4000)

according to this source; I found out that Android 10's system images are formatted with EXT4_FEATURE_RO_COMPAT_SHARED_BLOCKS. It will deduplicate blocks in the filesystem to reduce the image size. On my Pixel XL, the partition is physically not large enough to successfully run 'e2fsck -E unshare_blocks'.

so to resolve this problem you can use:

e2fsck -E unshare_blocks

but before that you should resize and increase free size of image (because its need beeger than prevois) so you can use:

resize2fs ./system_a.img 1200M

and then 

sudo losetup -P /dev/loop3 ./system_a.img
sudo mount /dev/loop3 ./system -rw

۰ نظر
علی فلاح

connect to Android ADB in virtualbox and Linux as Host

https://android.stackexchange.com/questions/50085/android-x86-virtual-box-with-internet-and-connection-to-adb

 

set NAT and then make an portforwarding roll and then use adb connect localhost:port to connect to adb of virtual machine

۰ نظر
علی فلاح