Archive for the android Category

Note: How to make Android O v8.0.0_r4 for Hikey960

Posted in android with tags , on 2017 年 08 月 28 日 by Kun-Yi
  1.  ref .  Using Reference Boards step to download source code, but change branch name to android-8.0.0_r4, like the below
    repo init -u https://android.googlesource.com/platform/manifest -b android-8.0.0_r4
  2.  repo sync -jN (#N for your Host machine, Normally use 8~12, dependency network, SSD/HDD state)
  3. change the below projects to master branch and checkout with special commit hash
    device/linaro/bootloader/OpenPlatfprmPkg — “ca8a8eeb"
    device/linaro/bootloader/arm-trusted-firmware — “d2baddd"
    device/linaro/bootloader/edk2 — “99d893a"
    device/linaro/hikey-kernel — “7517d7dbe"
    device/linaro/hikey — “0ac1c5c5c41
  4. modify device/linaro/hikey/hikey960/BoardConfig.mk
    diff –git a/hikey960/BoardConfig.mk b/hikey960/BoardConfig.mk
    index 00598e7..92321b4 100644
    — a/hikey960/BoardConfig.mk
    +++ b/hikey960/BoardConfig.mk
    @@ -3,8 +3,20 @@ include device/linaro/hikey/BoardConfigCommon.mk
    TARGET_BOOTLOADER_BOARD_NAME := hikey960
    TARGET_BOARD_PLATFORM := hikey960
    -TARGET_CPU_VARIANT := cortex-a73
    -TARGET_2ND_CPU_VARIANT := cortex-a73
    +TARGET_ARCH := arm64
    +TARGET_ARCH_VARIANT := armv8-a
    +TARGET_CPU_ABI := arm64-v8a
    +TARGET_CPU_VARIANT := generic
    +
    +TARGET_2ND_ARCH := arm
    +TARGET_2ND_ARCH_VARIANT := armv7-a-neon
    +TARGET_2ND_CPU_ABI := armeabi-v7a
    +TARGET_2ND_CPU_ABI2 := armeabi
    +TARGET_2ND_CPU_VARIANT := generic
    +
    +#TARGET_CPU_VARIANT := cortex-a73
    +#TARGET_2ND_CPU_VARIANT := cortex-a73
  5. make -jN (dependency your build machine, for me, the value is 8)
  6. waiting build success, then to ref. Using Reference Boards, for update your hikey960 board
  7. enjoy the play
廣告

Note: Hikey960 with Android v8.0.0_r1 boot success!

Posted in android with tags , on 2017 年 08 月 25 日 by Kun-Yi

終於把Hikey960 with Android O v8.0.0_r1 弄開機啦!

https://plus.google.com/u/0/photos/115270660462348164673/album/6458121557908343953/6458121562021074946?authkey=CIHysdm7oNflwQE

https://plus.google.com/u/0/photos/115270660462348164673/album/6458121557908343953/6458121565094052034?authkey=CIHysdm7oNflwQE

https://plus.google.com/u/0/photos/115270660462348164673/album/6458121557908343953/6458121562288292002?authkey=CIHysdm7oNflwQE

https://plus.google.com/u/0/photos/115270660462348164673/album/6458121557908343953/6458121565165748434?authkey=CIHysdm7oNflwQE

Note: Create a local mirror repo of CyanogenMod

Posted in android with tags on 2014 年 08 月 14 日 by Kun-Yi

1. create an AOSP local mirror repos
    mkdir -p ~/mirror_aosp
    cd ~/mirror_aosp
    repo init -u https://android.googlesource.com/mirror/manifest –mirror
    repo sync -j4

2. create CyanogenMod special branch/tag mirror repos
    mkdir ~/mirror_cm11
    cd ~/mirror_cm11
    repo init -u git://github.com/CyangenMod/android.git -b cm-11.0 –mirror –reference=~/mirror_aosp
    repo sync -j4

3. fetch for local development
    mkdir ~/dev_cm11
    cd ~/dev_cm11
    repo init -u ~/mirror_cm11 -b cm-11.0 –reference=~/mirror_cm11
    repo sync -j10

ref.

  1. https://source.android.com/source/downloading.html#using-a-local-mirror
  2. https://www.excentral.org/archives/2011/02/24/android-repo-mirroring

Note: Android default/preferred network setting for RIL

Posted in android with tags , on 2014 年 08 月 11 日 by Kun-Yi

check the code snippet in DatabaseHelper.java for Android Jelly bean,

“property ro.telephony.default_network"

// Set the preferred network mode to 0 = Global, CDMA default
int type;
if (TelephonyManager.getLteOnCdmaModeStatic() == PhoneConstants.LTE_ON_CDMA_TRUE) {
type = Phone.NT_MODE_GLOBAL;
} else {
type = SystemProperties.getInt(“ro.telephony.default_network", RILConstants.PREFERRED_NETWORK_MODE);
}

loadSetting(stmt, Settings.Global.PREFERRED_NETWORK_MODE, type);

Note: Android HWC and CTS test item android.view.cts.DisplayRefreshRateTest

Posted in android with tags , , on 2014 年 07 月 01 日 by Kun-Yi

https://source.android.com/devices/reference/hwcomposer_8h_source.html

裏面有提到 HWComposer 需要回報 display 的一些資訊 如Resolution/DPI/Refresh rate 等等..

常見 android.view.cts.DisplayRefreshRateTest 測試不過就是這邊回報的值不正確

目前OMAP4 平台上是直接修改 hardware/ti/omap4xxx/hwc/display.c 內的 LCD_DISPLAY_FPS

更好的作法是kernel 按照目前的 pixel clock 與 LCD timinig 去算出正確的 refresh rate 然後 HAL 起來的時候去讀

更好的改法如下 (for OMAP4)

 

@@ -195,7 +195,10 @@ static void setup_config(display_config_t *config, int xres, int yres, struct ds
 
 static void setup_lcd_config(display_config_t *config, int xres, int yres, struct dsscomp_display_info *info)
 {
-    setup_config(config, xres, yres, info, LCD_DISPLAY_FPS, LCD_DISPLAY_DEFAULT_DPI);
+    const uint32_t ht = info->timings.x_res + info->timings.hsw + info->timings.hfp + info->timings.hbp;
+    const uint32_t vt = info->timings.y_res + info->timings.vsw + info->timings.vfp + info->timings.vbp;
+    int fps = (info->timings.pixel_clock*100)/((ht*vt)/10);
+    setup_config(config, xres, yres, info, fps, LCD_DISPLAY_DEFAULT_DPI);
 }

Note: Intel defined an ACPI _DSM for Android power button event on x86 platform

Posted in ACPI, android with tags , , , on 2014 年 06 月 24 日 by Kun-Yi

_DSM Parameters
Arg0(Buffer) : UUID : “9c355bcb-35fa-44f7-8a67-447359c36a03″
Arg1(Integer): Revision: 0
Arg2(Integer): Function Index :
0: PWRB_PROBE, detect support power button state method
1: PWRB_REGISTER, enable/register Power button release notify
2: PWRB_LEVEL, get current level of power button
Arg3(package): NULL

Return of Function index
Function 0: PWRB_PROBE
Type: Buffer,
return a bitmask of supported functions as a buffer. Return a failure here as 0:
method not present or not function correctly means “no functions support"

bitmask:
bit 0: supported PWRB_REGISTER(DSM notify)
bit 1: supported PWRB_LEVEL (DSM polling)
Just need support one method, if all support OS driver will use DSM notify method.

Function 1: PWRB_REGISTER
Type: Integer,
0 is success register a support control method power button device.
Notify(PWRB_Obj, 0x80) // 0x80 for press state
Notify(PWRB_Obj, 0xC0) // 0xC0 for release state

Function 2: PWRB_LEVEL
Type: Integer,
1 or 0,  return 1 when press button , others return 0

Note: Android Open Accessory protocol

Posted in android, AOA, USB with tags , , on 2014 年 06 月 14 日 by Kun-Yi

沒有深入瞭解AOA以前, 一直以為是 Android Device(Phone ot Tablet)當成 USB host 端, 然後 Accessory 當 client 畢竟 Accessories 就是給我 client 的聯想, 但是事情不是我這笨人想的那麼簡單, Google 反過來設計 由 Accessories 當作 Host 當 Android device attached 上Accessories 時, 他會透過 AOA 的 protocol 中的 GetProtocol 去確認是否是一個Android powered device. 最早的 AOA 只有 Accessory + adb 模式, 到了 AOA 2.0 (Google I/O 發表 ADK2012) 則多了 Audio, 然後除了透過USB 也可以透過特定的Bluetooth profile 支援

不過已經過去 將近2年, 市場上好像還是沒有受到消費者青睞, 我猜想有幾個原因,

  • 因為各個Device 外型都不同, 不容易設計特定的Dock 吻合多數Android device.
  • 沒有真的開發出Killer app 需要配合的device.
  • Accessory 開發有一定困難, 開發Accessory 的公司很多都很小型, 要他們弄個 USB Host/Bluetooh 方案, 個人覺得還蠻困難的!

不過因為目前工作原因, 覺得有其需要了解, 也利用了 libusb 寫了一個 AOA init 的程式, 可以用來騙 Android device 進入Accessory mode 而且是騙Device 這是一個ADK2012, 所以如果Device 有裝ADK2012 app會被launch, 但是會停在畫面很久. 因為只做到 init stage 還沒完成後續protocol communication 處理!

source code 在 https://github.com/KunYi/pcaoa

PS: Code default 是針對 Samsung Note2 GT-N7100 可以簡單修改 程式碼內的定義針對其他不同的Device

目前改成支援偵測 GT-N7100, HongMi, Blaze (因為我手上就只有這幾台機器, 是可以改成不管VID:PID直接用getProtocol 輪詢, 但是不是很想這樣搞), 優先權依排序順序, 下一步將補齊 protocol process 再來實作 linux audio play, 這樣就完整了