summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Kocialkowski <contact@paulk.fr>2014-04-20 23:15:43 +0200
committerPaul Kocialkowski <contact@paulk.fr>2014-04-21 12:21:21 +0200
commit526a0c4b954021654e0f44ed8e50ca7c02e2429d (patch)
tree6cfa0ff1beb16d818656955bb8d3f36c03d7dcc5
parent2be830334f24f6c0e138b473eb699a784b294926 (diff)
downloaddevice_goldelico_gta04-526a0c4b954021654e0f44ed8e50ca7c02e2429d.zip
device_goldelico_gta04-526a0c4b954021654e0f44ed8e50ca7c02e2429d.tar.gz
device_goldelico_gta04-526a0c4b954021654e0f44ed8e50ca7c02e2429d.tar.bz2
Initial Replicant 4.2 commit
Many thanks to Lukas Märdian for his great work: part of the changes introduced in this commit reflect his work. Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
-rw-r--r--Android.mk4
-rw-r--r--AndroidProducts.mk1
-rwxr-xr-xBoardConfig.mk34
-rw-r--r--CleanSpec.mk7
-rw-r--r--bootimg.mk60
-rw-r--r--cm.mk28
-rw-r--r--configs/vold.fstab2
-rw-r--r--full_gta04.mk2
-rw-r--r--gpio-keys.kl1
-rw-r--r--gta04.mk33
-rwxr-xr-xinit.gta04.usb.rc77
-rw-r--r--lights/Android.mk (renamed from liblights/Android.mk)6
-rw-r--r--lights/lights.c (renamed from liblights/lights.c)172
-rw-r--r--overlay/frameworks/base/core/res/res/values/arrays.xml50
-rw-r--r--overlay/frameworks/base/core/res/res/values/config.xml33
-rw-r--r--overlay/frameworks/base/core/res/res/xml/storage_list.xml56
-rw-r--r--overlay/frameworks/base/packages/SettingsProvider/res/values/defaults.xml20
-rw-r--r--overlay/packages/inputmethods/LatinIME/java/res/values/dimens.xml25
-rw-r--r--overlay/packages/inputmethods/LatinIME/java/res/values/donottranslate.xml20
-rw-r--r--recovery/init.recovery.gta04.rc15
-rw-r--r--recovery/recovery.fstab6
-rw-r--r--recovery/recovery_keys.c52
-rw-r--r--releasetools.py23
-rwxr-xr-xreplicant_gta04_install.sh383
-rw-r--r--rootdir/fstab.gta044
-rw-r--r--rootdir/init.gta04.rc (renamed from init.gta04.rc)41
-rwxr-xr-xrootdir/init.gta04.usb.rc70
-rw-r--r--rootdir/initlogo.rle (renamed from initlogo.rle)bin76436 -> 76436 bytes
-rw-r--r--rootdir/initlogo.svg (renamed from initlogo.svg)0
-rw-r--r--rootdir/ueventd.gta04.rc (renamed from ueventd.gta04.rc)0
-rw-r--r--twl4030_pwrbutton.kl1
-rw-r--r--usr/idc/TSC2007_Touchscreen.idc (renamed from tsc2007.idc)0
-rw-r--r--usr/keylayout/Phone_button.kl1
-rw-r--r--usr/keylayout/twl4030_pwrbutton.kl1
34 files changed, 791 insertions, 437 deletions
diff --git a/Android.mk b/Android.mk
index 223a5e5..8e2bd0e 100644
--- a/Android.mk
+++ b/Android.mk
@@ -1,4 +1,4 @@
-# Copyright (C) 2012 Paul Kocialkowski <contact@paulk.fr>
+# Copyright (C) 2012-2014 Paul Kocialkowski <contact@paulk.fr>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -16,8 +16,6 @@ LOCAL_PATH := $(call my-dir)
ifeq ($(TARGET_DEVICE),gta04)
-ifneq ($(TARGET_SIMULATOR),true)
include $(call all-makefiles-under,$(LOCAL_PATH))
-endif
endif
diff --git a/AndroidProducts.mk b/AndroidProducts.mk
index 621c59c..5987620 100644
--- a/AndroidProducts.mk
+++ b/AndroidProducts.mk
@@ -11,7 +11,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
PRODUCT_MAKEFILES := \
$(LOCAL_DIR)/full_gta04.mk
diff --git a/BoardConfig.mk b/BoardConfig.mk
index 3daf6c9..e3a564a 100755
--- a/BoardConfig.mk
+++ b/BoardConfig.mk
@@ -1,4 +1,4 @@
-# Copyright (C) 2012-2013 Paul Kocialkowski <contact@paulk.fr>
+# Copyright (C) 2012-2014 Paul Kocialkowski <contact@paulk.fr>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -15,6 +15,7 @@
# CPU
TARGET_CPU_ABI := armeabi-v7a
TARGET_CPU_ABI2 := armeabi
+TARGET_ARCH := arm
TARGET_ARCH_VARIANT := armv7-a-neon
TARGET_GLOBAL_CFLAGS += -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp
TARGET_GLOBAL_CPPFLAGS += -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp
@@ -26,22 +27,36 @@ TARGET_BOOTLOADER_BOARD_NAME := gta04
# Images
TARGET_NO_RADIOIMAGE := true
-TARGET_NO_BOOTLOADER := false
+TARGET_NO_BOOTLOADER := true
TARGET_NO_KERNEL := false
BOARD_USES_UBOOT := true
BOARD_CUSTOM_BOOTIMG_MK := device/goldelico/gta04/bootimg.mk
+# Partitions
+TARGET_USERIMAGES_USE_EXT4 := true
+BOARD_SYSTEMIMAGE_PARTITION_SIZE := 314572800
+BOARD_USERDATAIMAGE_PARTITION_SIZE := 209715200
+BOARD_FLASH_BLOCK_SIZE := 4096
+
# Bootloaders
-TARGET_BOOTLOADER_SOURCE := bootable/bootloader/goldelico/gta04/u-boot/
-TARGET_BOOTLOADER_CONFIG := omap3_gta04_config
+TARGET_UBOOT_SOURCE := bootable/bootloader/goldelico/gta04/u-boot/
+TARGET_UBOOT_CONFIG := omap3_gta04_config
TARGET_XLOADER_SOURCE := bootable/bootloader/goldelico/gta04/x-loader/
TARGET_XLOADER_CONFIG := omap3530gta04_config
+TARGET_XLOADER_MLO := true
# Kernel
-TARGET_KERNEL_CONFIG := gta04_defconfig
TARGET_KERNEL_SOURCE := kernel/goldelico/gta04
+TARGET_KERNEL_CONFIG := gta04_defconfig
+TARGET_KERNEL_RECOVERY_CONFIG := gta04_recovery_defconfig
TARGET_KERNEL_LOADADDR := 0x80008000
+# Recovery
+TARGET_RECOVERY_FSTAB := device/goldelico/gta04/recovery/recovery.fstab
+BOARD_CUSTOM_RECOVERY_KEYMAPPING := ../../device/goldelico/gta04/recovery/recovery_keys.c
+TARGET_RECOVERY_PRE_COMMAND := "echo 1 > /cache/.startrecovery"
+TARGET_RELEASETOOLS_EXTENSIONS := device/goldelico/gta04
+
# Hardware
BOARD_HAVE_FM_RADIO := false
BOARD_HAVE_BLUETOOTH := false
@@ -50,5 +65,14 @@ USE_CAMERA_STUB := true
BOARD_HAS_NO_SELECT_BUTTON := true
+# Boot animation
+TARGET_BOOTANIMATION_PRELOAD := true
+TARGET_BOOTANIMATION_TEXTURE_CACHE := true
+TARGET_BOOTANIMATION_USE_RGB565 := true
+
+# Graphics
+USE_OPENGL_RENDERER := false
+TARGET_DISABLE_TRIPLE_BUFFERING := true
+
# Audio
BOARD_USE_TINYALSA_AUDIO := true
diff --git a/CleanSpec.mk b/CleanSpec.mk
index c72d2ef..fd8beb0 100644
--- a/CleanSpec.mk
+++ b/CleanSpec.mk
@@ -1,4 +1,4 @@
-# Copyright (C) 2012 Paul Kocialkowski <contact@paulk.fr>
+# Copyright (C) 2012-2014 Paul Kocialkowski <contact@paulk.fr>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -11,10 +11,5 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-$(call add-clean-step, find $(PRODUCT_OUT) -name "*.apk" | xargs rm)
$(call add-clean-step, rm -rf $(TARGET_OUT)/build.prop)
-$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/PACKAGING/systemimage_intermediates)
-# $(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libaudio_intermediates)
-# add newer instructions according to what we'll have in this directory
diff --git a/bootimg.mk b/bootimg.mk
index 540fb11..1ac2bbc 100644
--- a/bootimg.mk
+++ b/bootimg.mk
@@ -1,27 +1,45 @@
+# Copyright (C) 2012-2014 Paul Kocialkowski <contact@paulk.fr>
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
LOCAL_PATH := $(call my-dir)
-INSTALLED_XLOADER_MODULE := $(PRODUCT_OUT)/xloader
+INSTALLED_RAMDISK_TARGET := $(PRODUCT_OUT)/ramdisk.cpio
+INSTALLED_XLOADER_TARGET := $(PRODUCT_OUT)/MLO
+INSTALLED_UBOOT_TARGET := $(PRODUCT_OUT)/u-boot.bin
+INSTALLED_UBOOT_SCRIPT_TARGET := $(PRODUCT_OUT)/boot.scr
+INSTALLED_UBOOT_SPLASH_TARGET := $(PRODUCT_OUT)/splash.rgb16z
+
+BUILT_RAMDISK_TARGET := $(INSTALLED_RAMDISK_TARGET)
-INSTALLED_BOOTLOADERIMAGE_TARGET := $(PRODUCT_OUT)/u-boot.bin
-INSTALLED_XLOADERIMAGE_TARGET := $(PRODUCT_OUT)/MLO
-INSTALLED_BOOTLOADER_SCRIPT_TARGET := $(PRODUCT_OUT)/boot.scr
-INSTALLED_BOOTLOADER_SPLASH_TARGET := $(PRODUCT_OUT)/splash.rgb16z
+$(INSTALLED_RAMDISK_TARGET): $(MKBOOTFS) $(INTERNAL_RAMDISK_FILES)
+ $(call pretty,"Target ram disk: $@")
+ $(hide) $(MKBOOTFS) $(TARGET_ROOT_OUT) > $@
-$(INSTALLED_BOOTIMAGE_TARGET): $(MKIMAGE) $(INSTALLED_RAMDISK_TARGET) $(INSTALLED_KERNEL_TARGET)
- $(call pretty,"Boot image: $@")
+$(INSTALLED_BOOTIMAGE_TARGET): $(INSTALLED_KERNEL_TARGET)
$(ACP) $(INSTALLED_KERNEL_TARGET) $@
- @echo -e ${CL_INS}"Made boot image: $@"${CL_RST}
+ @echo -e ${CL_CYN}"Made boot image: $@"${CL_RST}
+
+$(INSTALLED_RECOVERYIMAGE_TARGET): $(INSTALLED_RECOVERY_KERNEL_TARGET)
+ $(ACP) $(INSTALLED_RECOVERY_KERNEL_TARGET) $@
+ @echo -e ${CL_CYN}"Made recovery image: $@"${CL_RST}
-$(INSTALLED_BOOTLOADERIMAGE_TARGET): $(INSTALLED_XLOADER_MODULE) $(INSTALLED_BOOTLOADER_MODULE) $(MKIMAGE)
- $(call pretty,"X-Loader image: $(INSTALLED_XLOADER_MODULE)")
- $(ACP) $(INSTALLED_XLOADER_MODULE) $(INSTALLED_XLOADERIMAGE_TARGET)
- @echo -e ${CL_INS}"Made X-Loader image: $(INSTALLED_XLOADERIMAGE_TARGET)"${CL_RST}
- $(call pretty,"Bootloader splash: $(INSTALLED_BOOTLOADER_SPLASH_TARGET)")
- $(ACP) $(BOOTLOADER_SRC)/../boot-scr/splash.rgb16z $(INSTALLED_BOOTLOADER_SPLASH_TARGET)
- @echo -e ${CL_INS}"Made bootloader splash: $(INSTALLED_BOOTLOADER_SPLASH_TARGET)"${CL_RST}
- $(call pretty,"Bootloader script: $(INSTALLED_BOOTLOADER_SCRIPT_TARGET)")
- $(MKIMAGE) -A arm -T script -C none -n "boot.scr" -d $(BOOTLOADER_SRC)/../boot-scr/boot.txt $(INSTALLED_BOOTLOADER_SCRIPT_TARGET)
- @echo -e ${CL_INS}"Made bootloader script: $(INSTALLED_BOOTLOADER_SCRIPT_TARGET)"${CL_RST}
- $(call pretty,"Bootloader image: $@")
- $(ACP) $(INSTALLED_BOOTLOADER_MODULE) $@
- @echo -e ${CL_INS}"Made bootloader image: $@"${CL_RST}
+$(INSTALLED_BOOTLOADERIMAGE_TARGET): $(INSTALLED_XLOADER_MODULE) $(INSTALLED_UBOOT_MODULE) $(MKIMAGE)
+ $(ACP) $(INSTALLED_XLOADER_MODULE) $(INSTALLED_XLOADER_TARGET)
+ @echo -e ${CL_CYN}"Made X-Loader: $(INSTALLED_XLOADER_TARGET)"${CL_RST}
+ $(ACP) $(UBOOT_SRC)/../boot-scr/splash.rgb16z $(INSTALLED_UBOOT_SPLASH_TARGET)
+ @echo -e ${CL_CYN}"Made U-Boot splash: $(INSTALLED_UBOOT_SPLASH_TARGET)"${CL_RST}
+ $(MKIMAGE) -A arm -T script -C none -n "boot.scr" -d $(UBOOT_SRC)/../boot-scr/boot.txt $(INSTALLED_UBOOT_SCRIPT_TARGET)
+ @echo -e ${CL_CYN}"Made U-Boot script: $(INSTALLED_UBOOT_SCRIPT_TARGET)"${CL_RST}
+ $(ACP) $(INSTALLED_UBOOT_MODULE) $(INSTALLED_UBOOT_TARGET)
+ @echo -e ${CL_CYN}"Made U-Boot: $(INSTALLED_UBOOT_TARGET)"${CL_RST}
diff --git a/cm.mk b/cm.mk
index 5819f9f..1736ec2 100644
--- a/cm.mk
+++ b/cm.mk
@@ -1,16 +1,30 @@
-# Inherit some common CM stuff.
+# Copyright (C) 2012-2014 Paul Kocialkowski <contact@paulk.fr>
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Inherit GSM config
$(call inherit-product, vendor/replicant/config/gsm.mk)
-PRODUCT_RELEASE_NAME := GTA04
-# Inherit some common CM stuff.
+PRODUCT_RELEASE_NAME := gta04
+
+TARGET_BOOTANIMATION_NAME := vertical-480x640
+
+# Inherit common phone config
$(call inherit-product, vendor/replicant/config/common_full_phone.mk)
-# Inherit device configuration
+# Inherit device config
$(call inherit-product, device/goldelico/gta04/full_gta04.mk)
-# Inherit Software GL configuration.
-$(call inherit-product, vendor/replicant/config/software_gl.mk)
-
PRODUCT_NAME := replicant_gta04
PRODUCT_DEVICE := gta04
PRODUCT_BRAND := Goldelico
diff --git a/configs/vold.fstab b/configs/vold.fstab
new file mode 100644
index 0000000..0615764
--- /dev/null
+++ b/configs/vold.fstab
@@ -0,0 +1,2 @@
+# USB disk
+dev_mount usbdisk /storage/usbdisk auto /devices/platform/musb-omap2430/musb-hdrc.1.auto
diff --git a/full_gta04.mk b/full_gta04.mk
index 7ae3a5a..ae740ce 100644
--- a/full_gta04.mk
+++ b/full_gta04.mk
@@ -16,8 +16,6 @@ $(call inherit-product, $(SRC_TARGET_DIR)/product/languages_full.mk)
$(call inherit-product, $(SRC_TARGET_DIR)/product/full.mk)
$(call inherit-product, device/goldelico/gta04/gta04.mk)
-PRODUCT_LOCALES += hdpi
-
PRODUCT_NAME := full_gta04
PRODUCT_DEVICE := gta04
PRODUCT_BRAND := goldelico
diff --git a/gpio-keys.kl b/gpio-keys.kl
deleted file mode 100644
index 3d30e23..0000000
--- a/gpio-keys.kl
+++ /dev/null
@@ -1 +0,0 @@
-key 169 BACK WAKE_DROPPED
diff --git a/gta04.mk b/gta04.mk
index 507f496..2a284ce 100644
--- a/gta04.mk
+++ b/gta04.mk
@@ -1,4 +1,4 @@
-# Copyright (C) 2012 Paul Kocialkowski <contact@paulk.fr>
+# Copyright (C) 2012-2014 Paul Kocialkowski <contact@paulk.fr>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -21,25 +21,37 @@ PRODUCT_COPY_FILES += \
# Ramdisk
PRODUCT_COPY_FILES += \
- device/goldelico/gta04/init.gta04.rc:root/init.gta04.rc \
- device/goldelico/gta04/init.gta04.usb.rc:root/init.gta04.usb.rc \
- device/goldelico/gta04/ueventd.gta04.rc:root/ueventd.gta04.rc
+ device/goldelico/gta04/rootdir/init.gta04.rc:root/init.gta04.rc \
+ device/goldelico/gta04/rootdir/init.gta04.usb.rc:root/init.gta04.usb.rc \
+ device/goldelico/gta04/rootdir/ueventd.gta04.rc:root/ueventd.gta04.rc \
+ device/goldelico/gta04/rootdir/fstab.gta04:root/fstab.gta04
+
+# Recovery
+PRODUCT_COPY_FILES += \
+ device/goldelico/gta04/recovery/init.recovery.gta04.rc:root/init.recovery.gta04.rc
+
+PRODUCT_PROPERTY_OVERRIDES += \
+ ro.cwm.forbid_format=/boot
# USB
PRODUCT_PROPERTY_OVERRIDES += \
- persist.sys.usb.config=mass_storage,adb
+ persist.sys.usb.config=mtp
+
+# Storage
+PRODUCT_COPY_FILES += \
+ device/goldelico/gta04/configs/vold.fstab:system/etc/vold.fstab
# Input
PRODUCT_COPY_FILES += \
- device/goldelico/gta04/tsc2007.idc:system/usr/idc/tsc2007.idc \
- device/goldelico/gta04/twl4030_pwrbutton.kl:system/usr/keylayout/twl4030_pwrbutton.kl \
- device/goldelico/gta04/gpio-keys.kl:system/usr/keylayout/gpio-keys.kl
+ device/goldelico/gta04/usr/idc/TSC2007_Touchscreen.idc:system/usr/idc/TSC2007_Touchscreen.idc \
+ device/goldelico/gta04/usr/keylayout/twl4030_pwrbutton.kl:system/usr/keylayout/twl4030_pwrbutton.kl \
+ device/goldelico/gta04/usr/keylayout/Phone_button.kl:system/usr/keylayout/Phone_button.kl
# Graphics
PRODUCT_LOCALES := hdpi
PRODUCT_COPY_FILES += \
- device/goldelico/gta04/initlogo.rle:root/initlogo.rle
+ device/goldelico/gta04/rootdir/initlogo.rle:root/initlogo.rle
# Audio
PRODUCT_PACKAGES += \
@@ -58,11 +70,10 @@ PRODUCT_COPY_FILES += \
# Dalvik
PRODUCT_PROPERTY_OVERRIDES += \
- dalvik.vm.lockprof.threshold=500 \
dalvik.vm.dexopt-data-only=1 \
dalvik.vm.checkjni=false \
ro.kernel.android.checkjni=0
PRODUCT_TAGS += dalvik.gc.type-precise
-include frameworks/base/build/phone-hdpi-512-dalvik-heap.mk
+include frameworks/native/build/phone-hdpi-512-dalvik-heap.mk
diff --git a/init.gta04.usb.rc b/init.gta04.usb.rc
deleted file mode 100755
index f417a6c..0000000
--- a/init.gta04.usb.rc
+++ /dev/null
@@ -1,77 +0,0 @@
-on property:sys.usb.config=mass_storage
- write /sys/class/android_usb/android0/enable 0
- write /sys/class/android_usb/android0/idVendor 18d1
- write /sys/class/android_usb/android0/idProduct 0001
- write /sys/class/android_usb/android0/functions $sys.usb.config
- write /sys/class/android_usb/android0/enable 1
- setprop sys.usb.state $sys.usb.config
-
-on property:sys.usb.config=mass_storage,adb
- write /sys/class/android_usb/android0/enable 0
- write /sys/class/android_usb/android0/idVendor 18d1
- write /sys/class/android_usb/android0/idProduct 0003
- write /sys/class/android_usb/android0/functions $sys.usb.config
- write /sys/class/android_usb/android0/enable 1
- start adbd
- setprop sys.usb.state $sys.usb.config
-
-on property:sys.usb.config=mtp
- write /sys/class/android_usb/android0/enable 0
- write /sys/class/android_usb/android0/idVendor 18d1
- write /sys/class/android_usb/android0/idProduct 0006
- write /sys/class/android_usb/android0/functions $sys.usb.config
- write /sys/class/android_usb/android0/enable 1
- setprop sys.usb.state $sys.usb.config
-
-on property:sys.usb.config=mtp,adb
- write /sys/class/android_usb/android0/enable 0
- write /sys/class/android_usb/android0/idVendor 18d1
- write /sys/class/android_usb/android0/idProduct 0007
- write /sys/class/android_usb/android0/functions $sys.usb.config
- write /sys/class/android_usb/android0/enable 1
- start adbd
- setprop sys.usb.state $sys.usb.config
-
-on property:sys.usb.config=ptp
- write /sys/class/android_usb/android0/enable 0
- write /sys/class/android_usb/android0/idVendor 18d1
- write /sys/class/android_usb/android0/idProduct 0008
- write /sys/class/android_usb/android0/functions $sys.usb.config
- write /sys/class/android_usb/android0/enable 1
- setprop sys.usb.state $sys.usb.config
-
-on property:sys.usb.config=ptp,adb
- write /sys/class/android_usb/android0/enable 0
- write /sys/class/android_usb/android0/idVendor 18d1
- write /sys/class/android_usb/android0/idProduct 0009
- write /sys/class/android_usb/android0/functions $sys.usb.config
- write /sys/class/android_usb/android0/enable 1
- start adbd
- setprop sys.usb.state $sys.usb.config
-
-on property:sys.usb.config=rndis
- write /sys/class/android_usb/android0/enable 0
- write /sys/class/android_usb/android0/idVendor 18d1
- write /sys/class/android_usb/android0/idProduct 000a
- write /sys/class/android_usb/android0/functions $sys.usb.config
- write /sys/class/android_usb/android0/bDeviceClass 224
- write /sys/class/android_usb/android0/enable 1
- setprop sys.usb.state $sys.usb.config
-
-on property:sys.usb.config=rndis,adb
- write /sys/class/android_usb/android0/enable 0
- write /sys/class/android_usb/android0/idVendor 18d1
- write /sys/class/android_usb/android0/idProduct 000b
- write /sys/class/android_usb/android0/functions $sys.usb.config
- write /sys/class/android_usb/android0/bDeviceClass 224
- write /sys/class/android_usb/android0/enable 1
- start adbd
- setprop sys.usb.state $sys.usb.config
-
-on property:sys.usb.config=rndis,dm
- write /sys/class/android_usb/android0/enable 0
- write /sys/class/android_usb/android0/idVendor 18d1
- write /sys/class/android_usb/android0/idProduct 000c
- write /sys/class/android_usb/android0/functions $sys.usb.config
- write /sys/class/android_usb/android0/enable 1
- setprop sys.usb.state $sys.usb.config
diff --git a/liblights/Android.mk b/lights/Android.mk
index 49f1d1b..9dc66f6 100644
--- a/liblights/Android.mk
+++ b/lights/Android.mk
@@ -1,4 +1,4 @@
-# Copyright (C) 2012 Paul Kocialkowski <contact@paulk.fr>
+# Copyright (C) 2012-2014 Paul Kocialkowski <contact@paulk.fr>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -12,8 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-ifeq ($(TARGET_DEVICE),gta04)
-
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
@@ -27,5 +25,3 @@ LOCAL_MODULE_TAGS := optional
LOCAL_MODULE := lights.gta04
include $(BUILD_SHARED_LIBRARY)
-
-endif
diff --git a/liblights/lights.c b/lights/lights.c
index 2eeb171..418c5ef 100644
--- a/liblights/lights.c
+++ b/lights/lights.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012 Paul Kocialkowski <contact@paulk.fr>
+ * Copyright (C) 2012-2014 Paul Kocialkowski <contact@paulk.fr>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,8 +14,7 @@
* limitations under the License.
*/
-#define LOG_TAG "lights"
-#include <cutils/log.h>
+#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <errno.h>
@@ -23,14 +22,15 @@
#include <pthread.h>
#include <sys/ioctl.h>
#include <sys/types.h>
+
+#define LOG_TAG "lights"
+#include <cutils/log.h>
#include <hardware/lights.h>
/*
* Globals
*/
-pthread_mutex_t lights_mutex = PTHREAD_MUTEX_INITIALIZER;
-
const char backlight_brightness[] =
"/sys/class/backlight/pwm-backlight/brightness";
const char backlight_max_brightness[] =
@@ -54,161 +54,161 @@ const char notifications_green_brightness[] =
const char notifications_green_max_brightness[] =
"/sys/class/leds/gta04:green:aux/max_brightness";
+pthread_mutex_t lights_mutex = PTHREAD_MUTEX_INITIALIZER;
+
/*
- * Lights utils
+ * Sysfs
*/
-int sysfs_write_int(char *path, int value)
+int sysfs_value_read(const char *path)
{
- char buf[10];
- int length = 0;
- int fd = -1;
- int rc;
+ char buffer[100];
+ int value;
+ int fd = -1;
+ int rc;
- if(path == NULL)
- return -1;
+ if (path == NULL)
+ return -1;
- length = snprintf(buf, 10, "%d\n", value);
+ fd = open(path, O_RDONLY);
+ if (fd < 0)
+ goto error;
- fd = open(path, O_WRONLY);
- if(fd < 0)
- return -1;
+ rc = read(fd, &buffer, sizeof(buffer));
+ if (rc <= 0)
+ goto error;
- rc = write(fd, buf, length);
+ value = atoi(buffer);
+ goto complete;
- close(fd);
+error:
+ value = -1;
- if(rc < length)
- return -1;
+complete:
+ if (fd >= 0)
+ close(fd);
- return 0;
+ return value;
}
-int sysfs_read_int(char *path)
+int sysfs_value_write(const char *path, int value)
{
- char buf[10];
- int val = 0;
- int fd = -1;
- int rc;
+ char buffer[100];
+ int fd = -1;
+ int rc;
- if(path == NULL)
- return -1;
+ if (path == NULL)
+ return -1;
- fd = open(path, O_RDONLY);
- if(fd < 0)
- return -1;
+ fd = open(path, O_WRONLY);
+ if (fd < 0)
+ goto error;
- rc = read(fd, buf, 10);
- if(rc <= 0) {
- close(fd);
- return -1;
- }
+ snprintf((char *) &buffer, sizeof(buffer), "%d\n", value);
+
+ rc = write(fd, buffer, strlen(buffer));
+ if (rc < (int) strlen(buffer))
+ goto error;
+
+ rc = 0;
+ goto complete;
+
+error:
+ rc = -1;
- val = atoi(buf);
+complete:
+ if (fd >= 0)
+ close(fd);
- return val;
+ return rc;
}
/*
- * Lights functions
+ * Lights
*/
-static int set_light_notifications(struct light_device_t *dev,
+int set_light_notifications(struct light_device_t *dev,
const struct light_state_t *state)
{
int red, green;
int max;
- int rc;
+ int rc = 0;
// GTA04 only has red and green
red = state->color & 0x00ff0000;
green = state->color & 0x0000ff00;
- // Red max
pthread_mutex_lock(&lights_mutex);
- max = sysfs_read_int(notifications_red_max_brightness);
- pthread_mutex_unlock(&lights_mutex);
+ // Red max
+ max = sysfs_value_read(notifications_red_max_brightness);
if(max > 0)
red = (red * max) / 0xff;
// Green max
- pthread_mutex_lock(&lights_mutex);
- max = sysfs_read_int(notifications_green_max_brightness);
- pthread_mutex_unlock(&lights_mutex);
-
+ max = sysfs_value_read(notifications_green_max_brightness);
if(max > 0)
green = (green * max) / 0xff;
- pthread_mutex_lock(&lights_mutex);
- rc = sysfs_write_int(notifications_red_brightness, red);
- if(rc >= 0)
- rc = sysfs_write_int(notifications_green_brightness, green);
+ rc |= sysfs_value_write(notifications_red_brightness, red);
+ rc |= sysfs_value_write(notifications_green_brightness, green);
+
pthread_mutex_unlock(&lights_mutex);
return rc;
}
-static int set_light_battery(struct light_device_t *dev,
+int set_light_battery(struct light_device_t *dev,
const struct light_state_t *state)
{
int red, green;
int max;
- int rc;
+ int rc = 0;
// GTA04 only has red and green
red = state->color & 0x00ff0000;
green = state->color & 0x0000ff00;
- // Red max
pthread_mutex_lock(&lights_mutex);
- max = sysfs_read_int(battery_red_max_brightness);
- pthread_mutex_unlock(&lights_mutex);
+ // Red max
+ max = sysfs_value_read(battery_red_max_brightness);
if(max > 0)
red = (red * max) / 0xff;
// Green max
- pthread_mutex_lock(&lights_mutex);
- max = sysfs_read_int(battery_green_max_brightness);
- pthread_mutex_unlock(&lights_mutex);
-
+ max = sysfs_value_read(battery_green_max_brightness);
if(max > 0)
green = (green * max) / 0xff;
- pthread_mutex_lock(&lights_mutex);
- rc = sysfs_write_int(battery_red_brightness, red);
- if(rc >= 0)
- rc = sysfs_write_int(battery_green_brightness, green);
+ rc |= sysfs_value_write(battery_red_brightness, red);
+ rc |= sysfs_value_write(battery_green_brightness, green);
+
pthread_mutex_unlock(&lights_mutex);
return rc;
}
-static int set_light_backlight(struct light_device_t *dev,
+int set_light_backlight(struct light_device_t *dev,
const struct light_state_t *state)
{
+ int brightness;
int color;
- unsigned char brightness;
- int brightness_max;
+ int max;
int rc;
pthread_mutex_lock(&lights_mutex);
- brightness_max =
- sysfs_read_int(backlight_max_brightness);
- pthread_mutex_unlock(&lights_mutex);
color = state->color & 0x00ffffff;
- brightness = ((77*((color>>16) & 0x00ff)) + (150*((color>>8) & 0x00ff))
- + (29*(color & 0x00ff))) >> 8;
+ brightness = ((77 * ((color >> 16) & 0xff)) + (150 * ((color >> 8) & 0xff)) + (29 * (color & 0xff))) >> 8;
- if(brightness_max > 0)
- brightness = (brightness * brightness_max) / 0xff;
+ // Brightness max
+ max = sysfs_value_read(backlight_max_brightness);
+ if(max > 0)
+ brightness = (brightness * max) / 0xff;
- LOGD("Setting brightness to: %d", brightness);
+ rc = sysfs_value_write(backlight_brightness, brightness);
- pthread_mutex_lock(&lights_mutex);
- rc = sysfs_write_int(backlight_brightness, brightness);
pthread_mutex_unlock(&lights_mutex);
return rc;
@@ -218,9 +218,9 @@ static int set_light_backlight(struct light_device_t *dev,
* Interface
*/
-static int close_lights(struct light_device_t *dev)
+int close_lights(struct light_device_t *dev)
{
- LOGD("close_lights()");
+ ALOGD("%s()", __func__);
if(dev != NULL)
free(dev);
@@ -228,14 +228,14 @@ static int close_lights(struct light_device_t *dev)
return 0;
}
-static int open_lights(const struct hw_module_t *module, char const *name,
+int open_lights(const struct hw_module_t *module, char const *name,
struct hw_device_t **device)
{
struct light_device_t *dev = NULL;
int (*set_light)(struct light_device_t *dev,
const struct light_state_t *state);
- LOGD("open_lights(): %s", name);
+ ALOGD("%s(%s)", __func__, name);
if(strcmp(LIGHT_ID_BACKLIGHT, name) == 0) {
set_light = set_light_backlight;
@@ -249,7 +249,7 @@ static int open_lights(const struct hw_module_t *module, char const *name,
pthread_mutex_init(&lights_mutex, NULL);
- dev = calloc(1, sizeof(struct light_device_t));
+ dev = (struct light_device_t *) calloc(1, sizeof(struct light_device_t));
dev->common.tag = HARDWARE_DEVICE_TAG;
dev->common.version = 0;
dev->common.module = (struct hw_module_t *) module;
@@ -261,11 +261,11 @@ static int open_lights(const struct hw_module_t *module, char const *name,
return 0;
}
-static struct hw_module_methods_t lights_module_methods = {
+struct hw_module_methods_t lights_module_methods = {
.open = open_lights,
};
-const struct hw_module_t HAL_MODULE_INFO_SYM = {
+struct hw_module_t HAL_MODULE_INFO_SYM = {
.tag = HARDWARE_MODULE_TAG,
.version_major = 1,
.version_minor = 0,
diff --git a/overlay/frameworks/base/core/res/res/values/arrays.xml b/overlay/frameworks/base/core/res/res/values/arrays.xml
index fd660ad..fb4bbb1 100644
--- a/overlay/frameworks/base/core/res/res/values/arrays.xml
+++ b/overlay/frameworks/base/core/res/res/values/arrays.xml
@@ -1,32 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
-/* //device/apps/common/assets/res/any/colors.xml
-**
-** Copyright 2006, The Android Open Source Project
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
--->
-<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <!-- Defines the shutdown options shown in the reboot dialog. -->
- <array name="shutdown_reboot_options" translatable="false">
- <item>@string/reboot_reboot</item>
- </array>
+ Copyright (C) 2014 Paul Kocialkowski <contact@paulk.fr>
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
- <!-- Do not translate. Defines the shutdown actions passed to the kernel.
- The first item should be empty for regular reboot. -->
- <string-array name="shutdown_reboot_actions" translatable="false">
- <item></item>
- </string-array>
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <array name="shutdown_reboot_options" translatable="false">
+ <item>@string/reboot_reboot</item>
+ <item>@string/reboot_recovery</item>
+ </array>
+ <string-array name="shutdown_reboot_actions" translatable="false">
+ <item></item>
+ <item>recovery</item>
+ </string-array>
</resources>
diff --git a/overlay/frameworks/base/core/res/res/values/config.xml b/overlay/frameworks/base/core/res/res/values/config.xml
index b42bacf..8635e41 100644
--- a/overlay/frameworks/base/core/res/res/values/config.xml
+++ b/overlay/frameworks/base/core/res/res/values/config.xml
@@ -1,27 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
-/*
-** Copyright 2012, Paul Kocialkowski <contact@paulk.fr>
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
--->
+ Copyright (C) 2012 Paul Kocialkowski <contact@paulk.fr>
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
<resources>
- <!-- If this is true, the screen will come on when you unplug usb/power/whatever. -->
<bool name="config_unplugTurnsOnScreen">true</bool>
- <!-- Whether a software navigation bar should be shown. NOTE: in the future this may be
- autodetected from the Configuration. -->
<bool name="config_showNavigationBar">true</bool>
</resources>
diff --git a/overlay/frameworks/base/core/res/res/xml/storage_list.xml b/overlay/frameworks/base/core/res/res/xml/storage_list.xml
index ba086a1..c4213c2 100644
--- a/overlay/frameworks/base/core/res/res/xml/storage_list.xml
+++ b/overlay/frameworks/base/core/res/res/xml/storage_list.xml
@@ -1,41 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
-**
-** Copyright 2011, The Android Open Source Project
-**
-** Licensed under the Apache License, Version 2.0 (the "License")
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
--->
+ Copyright (C) 2014 Paul Kocialkowski <contact@paulk.fr>
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
-<!-- The <device> element should contain one or more <storage> elements.
- Exactly one of these should have the attribute primary="true".
- This storage will be the primary external storage and should have mountPoint="/mnt/sdcard".
- Each storage should have both a mountPoint and storageDescription attribute.
- The following attributes are optional:
+ http://www.apache.org/licenses/LICENSE-2.0
- primary: (boolean) this storage is the primary external storage
- removable: (boolean) this is removable storage (for example, a real SD card)
- emulated: (boolean) the storage is emulated via the FUSE sdcard daemon
- mtpReserve: (integer) number of megabytes of storage MTP should reserve for free storage
- (used for emulated storage that is shared with system's data partition)
-
- A storage should not have both emulated and removable set to true
--->
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
<StorageList xmlns:android="http://schemas.android.com/apk/res/android">
- <storage android:mountPoint="/mnt/sdcard"
- android:storageDescription="@string/storage_internal"
- android:primary="true"
- android:removable="false"
- android:allowMassStorage="true" />
+ <storage android:mountPoint="/storage/sdcard"
+ android:storageDescription="@string/storage_internal"
+ android:primary="true"
+ android:emulated="true"
+ android:mtpReserve="100" />
+
+ <storage android:mountPoint="/storage/usbdisk"
+ android:storageDescription="@string/storage_usb"
+ android:primary="false"
+ android:removable="true" />
</StorageList>
diff --git a/overlay/frameworks/base/packages/SettingsProvider/res/values/defaults.xml b/overlay/frameworks/base/packages/SettingsProvider/res/values/defaults.xml
new file mode 100644
index 0000000..d78d55e
--- /dev/null
+++ b/overlay/frameworks/base/packages/SettingsProvider/res/values/defaults.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2014 Paul Kocialkowski <contact@paulk.fr>
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<resources>
+ <string name="def_quick_settings_tiles">toggleUser|toggleBrightness|toggleVolume|toggleSettings|toggleWifi|toggleMobileData|toggleBattery|toggleAirplane|toggleBluetooth</string>
+</resources>
diff --git a/overlay/packages/inputmethods/LatinIME/java/res/values/dimens.xml b/overlay/packages/inputmethods/LatinIME/java/res/values/dimens.xml
deleted file mode 100644
index 83d2898..0000000
--- a/overlay/packages/inputmethods/LatinIME/java/res/values/dimens.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-**
-** Copyright 2008, The Android Open Source Project
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
--->
-
-<resources>
- <integer name="max_more_suggestions_row">4</integer>
- <!-- key_preview_backing_height = more_suggestions_row_height * max_more_suggestions_row -->
- <dimen name="key_preview_backing_height">160dip</dimen>
-</resources>
diff --git a/overlay/packages/inputmethods/LatinIME/java/res/values/donottranslate.xml b/overlay/packages/inputmethods/LatinIME/java/res/values/donottranslate.xml
new file mode 100644
index 0000000..a0849a9
--- /dev/null
+++ b/overlay/packages/inputmethods/LatinIME/java/res/values/donottranslate.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2014 Paul Kocialkowski <contact@paulk.fr>
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <string name="prefs_suggestion_visibility_default_value">2</string>
+</resources>
diff --git a/recovery/init.recovery.gta04.rc b/recovery/init.recovery.gta04.rc
new file mode 100644
index 0000000..9ba71e5
--- /dev/null
+++ b/recovery/init.recovery.gta04.rc
@@ -0,0 +1,15 @@
+on fs
+ mount ext4 /dev/block/mmcblk0p3 /cache wait
+
+on post-fs
+ rm /cache/.startrecovery
+
+service console /sbin/sh
+ class core
+ console
+ disabled
+ user root
+ group root
+
+on property:ro.debuggable=1
+ start console
diff --git a/recovery/recovery.fstab b/recovery/recovery.fstab
new file mode 100644
index 0000000..625dcdf
--- /dev/null
+++ b/recovery/recovery.fstab
@@ -0,0 +1,6 @@
+/boot vfat /dev/block/mmcblk0p1
+/system ext4 /dev/block/mmcblk0p2
+/cache ext4 /dev/block/mmcblk0p3
+/data ext4 /dev/block/mmcblk0p4
+
+/sdcard datamedia /dev/null
diff --git a/recovery/recovery_keys.c b/recovery/recovery_keys.c
new file mode 100644
index 0000000..1016aea
--- /dev/null
+++ b/recovery/recovery_keys.c
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2014 Paul Kocialkowski <contact@paulk.fr>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <linux/input.h>
+
+#include "recovery_ui.h"
+#include "common.h"
+#include "extendedcommands.h"
+
+int get_allow_toggle_display();
+
+int device_toggle_display(volatile char* key_pressed, int key_code) {
+ int alt = key_pressed[KEY_LEFTALT] || key_pressed[KEY_RIGHTALT];
+ if (alt && key_code == KEY_L)
+ return 1;
+ // allow toggling of the display if the correct key is pressed, and the display toggle is allowed or the display is currently off
+ if (ui_get_showing_back_button()) {
+ return 0;
+ //return get_allow_toggle_display() && (key_code == KEY_HOME || key_code == KEY_MENU || key_code == KEY_END);
+ }
+ return get_allow_toggle_display() && (key_code == KEY_HOME || key_code == KEY_MENU || key_code == KEY_POWER || key_code == KEY_END);
+}
+
+int device_handle_key(int key_code, int visible) {
+ if (visible) {
+ switch (key_code) {
+ case KEY_PHONE:
+ return HIGHLIGHT_DOWN;
+ case KEY_POWER:
+ if (ui_get_showing_back_button()) {
+ return SELECT_ITEM;
+ }
+ if (!get_allow_toggle_display())
+ return GO_BACK;
+ }
+ }
+
+ return NO_ACTION;
+}
diff --git a/releasetools.py b/releasetools.py
new file mode 100644
index 0000000..d339555
--- /dev/null
+++ b/releasetools.py
@@ -0,0 +1,23 @@
+# Copyright (C) 2014 Paul Kocialkowski <contact@paulk.fr>
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import common
+import os
+
+def FullOTA_InstallEnd(info):
+ info.script.script = [ cmd for cmd in info.script.script if not "boot.img" in cmd ]
+
+ info.script.Mount("/boot");
+ info.script.script.append('package_extract_file("boot.img", "/boot/boot.img");')
+ info.script.Unmount("/boot");
diff --git a/replicant_gta04_install.sh b/replicant_gta04_install.sh
index dcca69c..9d1f41d 100755
--- a/replicant_gta04_install.sh
+++ b/replicant_gta04_install.sh
@@ -2,7 +2,7 @@
# Replicant GTA04 installer
#
-# Copyright (C) 2012-2013 Paul Kocialkowski, GPLv2
+# Copyright (C) 2012-2014 Paul Kocialkowski, GPLv2
#
# Based on mkcard.sh v0.5
# Copyright (C) 2009 Graeme Gregory <dp@xora.org.uk>, GPLv2
@@ -18,13 +18,13 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
-# Env vars
+# Environment
#
export LC_ALL=C
#
-# Global vars
+# Globals
#
DRIVE=""
@@ -33,7 +33,10 @@ DRIVE_SIZE=""
DRIVE_CYLINDERS=""
DRIVE_PART=""
-FILES_BASE="./"
+SYSTEM_ZIP="replicant-4.2-gta04.zip"
+BOOT_FILES="MLO u-boot.bin boot.scr splash.rgb16z recovery.img"
+
+FILES_BASE="."
MOUNT_BASE="/media"
#
@@ -42,25 +45,34 @@ MOUNT_BASE="/media"
# Display
+display_help() {
+ echo "Usage: $0 [COMMAND] [DRIVE]"
+ echo ""
+ echo "It is expected that the following files are located in $FILES_BASE:"
+ echo " $BOOT_FILES for setup"
+ echo " $SYSTEM_ZIP for install"
+ echo ""
+ echo "Commands:"
+ echo " setup - setup the drive and copy the base files"
+ echo " install - install the system on the drive"
+ echo ""
+ echo "Optional arguments:"
+ echo " [DRIVE] - drive node to use"
+}
+
display_banner() {
echo "Replicant GTA04 installer"
echo ""
}
-display_help() {
- echo "Usage: $0 [FILES_BASE] [DRIVE]"
+display_complete() {
echo ""
- echo "Arguments:"
- echo "- The [FILES_BASE] argument is the path to the files"
- echo " The following files must be in that directory:"
- echo " MLO, u-boot.bin, splash.rgb16z, boot.scr, boot.img, system.tar.bz2"
- echo "- The [DRIVE] argument is the sdcard drive node and can be omitted"
+ echo "Process completed!"
}
# Drive
-drive_select_list()
-{
+drive_select_list() {
drives_dir="/dev/disk/by-id/"
count=0
@@ -95,8 +107,7 @@ drive_select_list()
done
}
-drive_select()
-{
+drive_select() {
echo "Available devices:"
drive_select_list "show"
@@ -107,10 +118,37 @@ drive_select()
echo ""
}
-drive_select_confirm() {
+drive_umount() {
+ list=$( mount | grep $DRIVE | sed "s|$DRIVE[0-9]* on \([^ ]*\) .*|\1|g" )
+
+ for mount_point in $list
+ do
+ echo "Unmounting $mount_point"
+
+ umount "$mount_point"
+ if [ $? != 0 ]
+ then
+ echo "Unmounting $mount_point failed, arborting!"
+ exit 1
+ fi
+ done
+}
+
+drive_part() {
+ if [ -e "${DRIVE}p1" ]
+ then
+ DRIVE_PART="${DRIVE}p"
+ else
+ DRIVE_PART="${DRIVE}"
+ fi
+}
+
+# Setup
+
+setup_drive_confirm() {
if [ "$DRIVE" = "" ]
then
- echo "Wrong drive block"
+ echo "Invalid drive block"
exit 1
fi
@@ -127,8 +165,8 @@ drive_select_confirm() {
for mount_point in $list
do
- mount_point_dir=$( dirname $mount_point )
- if [ "$mount_point_dir" != "/media" ] && [ "$mount_point_dir" != "/mnt" ] && [ "$mount_point" != "/media" ] && [ "$mount_point" != "/mnt" ]
+ mount_point_check=$( dirname $mount_point | grep -P "^/mnt|mount" )
+ if [ "$mount_point_check" != "" ]
then
echo ""
echo "Warning: the drive is mounted as $mount_point!"
@@ -149,23 +187,9 @@ drive_select_confirm() {
fi
}
-drive_umount() {
- list=$( mount | grep $DRIVE | sed "s|$DRIVE[0-9]* on \([^ ]*\) .*|\1|g" )
-
- for mount_point in $list
- do
- echo "Unmounting $mount_point"
+setup_drive_empty() {
+ drive_umount
- umount "$mount_point"
- if [ $? != 0 ]
- then
- echo "Unmounting $mount_point failed, arborting!"
- exit 1
- fi
- done
-}
-
-drive_empty() {
# Backup
dd if="$DRIVE" of=".drive_start_backup" bs=1024 count=1024
@@ -177,7 +201,7 @@ drive_empty() {
fi
}
-drive_rescue() {
+setup_drive_rescue() {
if [ -f ".drive_start_backup" ]
then
echo -n "Something went wrong, do you want to restore drive start backup? [Y/N] "
@@ -188,19 +212,14 @@ drive_rescue() {
fi
}
-drive_infos_get() {
+setup_drive_infos() {
DRIVE_SIZE=$( fdisk -l "$DRIVE" | grep Disk | grep bytes | awk '{print $5}' )
DRIVE_CYLINDERS=$( echo "$DRIVE_SIZE/255/63/512" | bc )
}
-drive_eject() {
- rm -rf ".drive_start_backup"
- eject "$DRIVE"
-}
-
-drive_partitions_set() {
+setup_drive_partition() {
boot_size=$( echo "(50 * 1024 * 1024) / ($DRIVE_SIZE/$DRIVE_CYLINDERS)" | bc )
- system_size=$( echo "(250 * 1024 * 1024) / ($DRIVE_SIZE/$DRIVE_CYLINDERS)" | bc )
+ system_size=$( echo "(350 * 1024 * 1024) / ($DRIVE_SIZE/$DRIVE_CYLINDERS)" | bc )
cache_size=$( echo "(100 * 1024 * 1024) / ($DRIVE_SIZE/$DRIVE_CYLINDERS)" | bc )
{
@@ -217,32 +236,28 @@ drive_partitions_set() {
sleep 1
- if [ -e "${DRIVE}p1" ]
- then
- DRIVE_PART="${DRIVE}p"
- else
- DRIVE_PART="${DRIVE}"
- fi
+ drive_part
mkfs.vfat -F 32 -n "boot" "${DRIVE_PART}1"
- mkfs.ext2 -L "system" "${DRIVE_PART}2"
- mkfs.ext2 -L "cache" "${DRIVE_PART}3"
- mkfs.ext2 -L "data" "${DRIVE_PART}4"
+ mkfs.ext4 -L "system" "${DRIVE_PART}2"
+ mkfs.ext4 -L "cache" "${DRIVE_PART}3"
+ mkfs.ext4 -L "data" "${DRIVE_PART}4"
sleep 1
}
-drive_write() {
- echo "Writing boot files"
+setup_boot_install() {
+ echo "Installing boot files"
+
+ drive_part
mkdir -p "$MOUNT_BASE/boot"
mount "${DRIVE_PART}1" "$MOUNT_BASE/boot"
- cp $FILES_BASE/MLO "$MOUNT_BASE/boot/"
- cp $FILES_BASE/u-boot.bin "$MOUNT_BASE/boot/"
- cp $FILES_BASE/splash.rgb16z "$MOUNT_BASE/boot"
- cp $FILES_BASE/boot.scr "$MOUNT_BASE/boot"
- cp $FILES_BASE/boot.img "$MOUNT_BASE/boot"
+ for file in $BOOT_FILES
+ do
+ cp "$FILES_BASE/$file" "$MOUNT_BASE/boot/"
+ done
dir=$( pwd )
echo "Syncing boot files"
@@ -252,52 +267,223 @@ drive_write() {
umount "$MOUNT_BASE/boot"
rmdir "$MOUNT_BASE/boot"
+}
+
+setup_drive_eject() {
+ rm -rf ".drive_start_backup"
+ eject "$DRIVE"
+}
- echo "Writing system files"
+# Install
- mkdir -p "$MOUNT_BASE/system"
- mount "${DRIVE_PART}2" "$MOUNT_BASE/system"
+install_package_extract_dir() {
+ destination="$MOUNT_BASE"$( dirname "$2")
- tar -p -xf "system.tar.bz2" -C "$MOUNT_BASE/system/" --strip-components=1 "system/"
- if [ $? != 0 ]
+ if [ $# -lt 2 ]
then
- umount "$MOUNT_BASE/system"
- rmdir "$MOUNT_BASE/system"
+ return
+ fi
- exit 1
+ unzip -o "$FILES_BASE/$SYSTEM_ZIP" "$1/**" -d "$destination"
+}
+
+install_package_extract_file() {
+ destination="$MOUNT_BASE"$( dirname "$2")
+
+ if [ $# -lt 2 ]
+ then
+ return
+ fi
+
+ unzip -o "$FILES_BASE/$SYSTEM_ZIP" "$1" -d "$destination"
+}
+
+install_symlink() {
+ source=""
+
+ if [ $# -lt 2 ]
+ then
+ return
+ fi
+
+ for path in $@
+ do
+ if [ "$source" = "" ]
+ then
+ source="$path"
+ continue
+ fi
+
+ unlink "$MOUNT_BASE$path"
+ ln -s "$source" "$MOUNT_BASE$path"
+ done
+}
+
+install_set_perm() {
+ uid=""
+ gid=""
+ mode=""
+
+ if [ $# -lt 4 ]
+ then
+ return
fi
+ for value in $@
+ do
+ if [ "$uid" = "" ]
+ then
+ uid="$value"
+ continue
+ fi
+
+ if [ "$gid" = "" ]
+ then
+ gid="$value"
+ continue
+ fi
+
+ if [ "$mode" = "" ]
+ then
+ mode="$value"
+ continue
+ fi
+
+ chown "$uid:$gid" "$MOUNT_BASE$value"
+ chmod "$mode" "$MOUNT_BASE$value"
+ done
+}
+
+install_set_perm_recursive() {
+ uid=""
+ gid=""
+ dir_mode=""
+ file_mode=""
+
+ if [ $# -lt 4 ]
+ then
+ return
+ fi
+
+ for value in $@
+ do
+ if [ "$uid" = "" ]
+ then
+ uid="$value"
+ continue
+ fi
+
+ if [ "$gid" = "" ]
+ then
+ gid="$value"
+ continue
+ fi
+
+ if [ "$dir_mode" = "" ]
+ then
+ dir_mode="$value"
+ continue
+ fi
+
+ if [ "$file_mode" = "" ]
+ then
+ file_mode="$value"
+ continue
+ fi
+
+ find "$MOUNT_BASE$value" -type d -exec chown "$uid:$gid" {} \; -exec chmod "$dir_mode" {} \;
+ find "$MOUNT_BASE$value" -type f -exec chown "$uid:$gid" {} \; -exec chmod "$file_mode" {} \;
+ done
+}
+
+install_command() {
+ command=$( echo "$1" | sed "s/[ \t]*\([^(]*\)(.*/\1/g" )
+ arguments=$( echo "$1" | sed -e "s/[^(]*(\([^)]*\));.*/\1/g" -e "s/[ \t]*,[ \t]*/ /g" | tr -d '"')
+
+ case "$command" in
+ "package_extract_dir")
+ install_package_extract_dir $arguments
+ ;;
+ "package_extract_file")
+ install_package_extract_file $arguments
+ ;;
+ "symlink")
+ install_symlink $arguments
+ ;;
+ "set_perm")
+ install_set_perm $arguments
+ ;;
+ "set_perm_recursive")
+ install_set_perm_recursive $arguments
+ ;;
+ esac
+}
+
+install_script() {
+ unzip -p "$FILES_BASE/$SYSTEM_ZIP" "META-INF/com/google/android/updater-script" | while read line
+ do
+ end_test=$( echo "$line" | grep -P "\);$" )
+
+ COMMAND="$COMMAND$line"
+
+ if [ "$end_test" != "" ]
+ then
+ install_command "$COMMAND"
+
+ COMMAND=""
+ fi
+ done
+}
+
+install_mount() {
+ drive_part
+
+ drive_umount
+
+ mkdir -p "$MOUNT_BASE/boot"
+ mount "${DRIVE_PART}1" "$MOUNT_BASE/boot"
+
+ mkdir -p "$MOUNT_BASE/system"
+ mount "${DRIVE_PART}2" "$MOUNT_BASE/system"
+}
+
+install_umount() {
+ drive_part
+
dir=$( pwd )
- echo "Syncing system files"
+ echo "Syncing files"
+
+ cd "$MOUNT_BASE/boot"
+ sync
+ cd "$dir"
+
cd "$MOUNT_BASE/system"
sync
cd "$dir"
+ umount "$MOUNT_BASE/boot"
+ rmdir "$MOUNT_BASE/boot"
+
umount "$MOUNT_BASE/system"
rmdir "$MOUNT_BASE/system"
}
-display_end() {
- echo ""
- echo "Your drive is now ready to be used!"
+install_eject() {
+ eject "$DRIVE"
}
-# Script start
+#
+# Main
+#
-if [ $# -eq 0 ] || [ $# -gt 2 ] || [ "$1" = "--help" ] || [ "$1" = "help" ]
+if [ $# -lt 1 ] || [ $# -gt 2 ]
then
display_help
exit 1
fi
-if [ $# -eq 1 ]
-then
- FILES_BASE=$1
-fi
-
-if [ $# -eq 2 ]
+if [ $# -gt 1 ]
then
- FILES_BASE=$1
DRIVE=$2
fi
@@ -308,15 +494,26 @@ then
drive_select
fi
-# Drive
-drive_select_confirm
-drive_umount
-drive_empty
-drive_infos_get
-
-drive_partitions_set
-drive_write
-
-# Finishing
-display_end
-drive_eject
+case $1 in
+ "setup")
+ setup_drive_confirm
+ drive_umount
+ setup_drive_empty
+ setup_drive_infos
+ setup_drive_partition
+ setup_boot_install
+ setup_drive_eject
+
+ display_complete
+ ;;
+ "install")
+ install_mount
+ install_script
+ install_umount
+ install_eject
+ ;;
+ *)
+ display_help
+ exit 1
+ ;;
+esac
diff --git a/rootdir/fstab.gta04 b/rootdir/fstab.gta04
new file mode 100644
index 0000000..4aaa1cb
--- /dev/null
+++ b/rootdir/fstab.gta04
@@ -0,0 +1,4 @@
+/dev/block/mmcblk0p1 /mnt/boot vfat ro wait
+/dev/block/mmcblk0p2 /system ext4 ro wait
+/dev/block/mmcblk0p3 /cache ext4 nosuid wait
+/dev/block/mmcblk0p4 /data ext4 nosuid wait
diff --git a/init.gta04.rc b/rootdir/init.gta04.rc
index 3245366..57f81f1 100644
--- a/init.gta04.rc
+++ b/rootdir/init.gta04.rc
@@ -1,11 +1,29 @@
import init.gta04.usb.rc
-on early-init
- export EXTERNAL_STORAGE /mnt/sdcard
- mkdir /mnt/sdcard 0000 system system
- symlink /mnt/sdcard /sdcard
+on init
+ mkdir /mnt/boot 0700 system system
- mkdir /mnt/boot 0000 system system
+ mkdir /mnt/shell/emulated 0700 shell shell
+ mkdir /storage/emulated 0555 root root
+
+ export EXTERNAL_STORAGE /storage/emulated/legacy
+ export EMULATED_STORAGE_SOURCE /mnt/shell/emulated
+ export EMULATED_STORAGE_TARGET /storage/emulated
+
+ # Legacy
+ symlink /storage/emulated/legacy /sdcard
+ symlink /storage/emulated/legacy /mnt/sdcard
+ symlink /storage/emulated/legacy /storage/sdcard
+ symlink /mnt/shell/emulated/0 /storage/emulated/legacy
+
+ # USB disk
+ mkdir /storage/usbdisk 0666 system system
+ symlink /storage/usbdisk /mnt/usbdisk
+ symlink /mnt/usbdisk /usbdisk
+
+ symlink /mnt/boot /boot
+
+ chmod 0660 /dev/cpuctl
on boot
# Modem GPIO
@@ -29,15 +47,12 @@ on boot
chmod 0660 /sys/class/gpio/gpio55/value
on fs
- mount ext4 /dev/block/mmcblk0p2 /system wait
- mount ext4 /dev/block/mmcblk0p2 /system ro wait remount
- mount ext4 /dev/block/mmcblk0p3 /cache nosuid wait
- mount ext4 /dev/block/mmcblk0p4 /data nosuid wait
- mount vfat /dev/block/mmcblk0p1 /mnt/boot/ ro wait
+ mount_all /fstab.gta04
+
+ setprop ro.crypto.fuse_sdcard true
on post-fs-data
- mkdir /data/media 0775 media_rw media_rw
- chown media_rw media_rw /data/media
+ mkdir /data/media 0770 media_rw media_rw
-service sdcard /system/bin/sdcard /data/media 1023 1023
+service sdcard /system/bin/sdcard /data/media /mnt/shell/emulated 1023 1023
class late_start
diff --git a/rootdir/init.gta04.usb.rc b/rootdir/init.gta04.usb.rc
new file mode 100755
index 0000000..b6bd413
--- /dev/null
+++ b/rootdir/init.gta04.usb.rc
@@ -0,0 +1,70 @@
+on boot
+ write /sys/class/android_usb/android0/iManufacturer ${ro.product.manufacturer}
+ write /sys/class/android_usb/android0/iProduct ${ro.product.model}
+ write /sys/class/android_usb/android0/iSerial ${ro.serialno}
+
+ write /sys/class/android_usb/android0/f_rndis/manufacturer Goldelico
+ write /sys/class/android_usb/android0/f_rndis/vendorID 18d1
+ write /sys/class/android_usb/android0/f_rndis/wceis 1
+
+on property:sys.usb.config=adb
+ write /sys/class/android_usb/android0/enable 0
+ write /sys/class/android_usb/android0/idVendor 18d1
+ write /sys/class/android_usb/android0/idProduct 0001
+ write /sys/class/android_usb/android0/functions ${sys.usb.config}
+ write /sys/class/android_usb/android0/enable 1
+ start adbd
+ setprop sys.usb.state ${sys.usb.config}
+
+on property:sys.usb.config=mtp
+ write /sys/class/android_usb/android0/enable 0
+ write /sys/class/android_usb/android0/idVendor 18d1
+ write /sys/class/android_usb/android0/idProduct 0002
+ write /sys/class/android_usb/android0/functions ${sys.usb.config}
+ write /sys/class/android_usb/android0/enable 1
+ setprop sys.usb.state ${sys.usb.config}
+
+on property:sys.usb.config=mtp,adb
+ write /sys/class/android_usb/android0/enable 0
+ write /sys/class/android_usb/android0/idVendor 18d1
+ write /sys/class/android_usb/android0/idProduct 0003
+ write /sys/class/android_usb/android0/functions ${sys.usb.config}
+ write /sys/class/android_usb/android0/enable 1
+ start adbd
+ setprop sys.usb.state ${sys.usb.config}
+
+on property:sys.usb.config=ptp
+ write /sys/class/android_usb/android0/enable 0
+ write /sys/class/android_usb/android0/idVendor 18d1
+ write /sys/class/android_usb/android0/idProduct 0004
+ write /sys/class/android_usb/android0/functions ${sys.usb.config}
+ write /sys/class/android_usb/android0/enable 1
+ setprop sys.usb.state ${sys.usb.config}
+
+on property:sys.usb.config=ptp,adb
+ write /sys/class/android_usb/android0/enable 0
+ write /sys/class/android_usb/android0/idVendor 18d1
+ write /sys/class/android_usb/android0/idProduct 0005
+ write /sys/class/android_usb/android0/functions ${sys.usb.config}
+ write /sys/class/android_usb/android0/enable 1
+ start adbd
+ setprop sys.usb.state ${sys.usb.config}
+
+on property:sys.usb.config=rndis
+ write /sys/class/android_usb/android0/enable 0
+ write /sys/class/android_usb/android0/idVendor 18d1
+ write /sys/class/android_usb/android0/idProduct 0008
+ write /sys/class/android_usb/android0/functions ${sys.usb.config}
+ write /sys/class/android_usb/android0/bDeviceClass 224
+ write /sys/class/android_usb/android0/enable 1
+ setprop sys.usb.state ${sys.usb.config}
+
+on property:sys.usb.config=rndis,adb
+ write /sys/class/android_usb/android0/enable 0
+ write /sys/class/android_usb/android0/idVendor 18d1
+ write /sys/class/android_usb/android0/idProduct 0009
+ write /sys/class/android_usb/android0/functions ${sys.usb.config}
+ write /sys/class/android_usb/android0/bDeviceClass 224
+ write /sys/class/android_usb/android0/enable 1
+ start adbd
+ setprop sys.usb.state ${sys.usb.config}
diff --git a/initlogo.rle b/rootdir/initlogo.rle
index 740cc91..740cc91 100644
--- a/initlogo.rle
+++ b/rootdir/initlogo.rle
Binary files differ
diff --git a/initlogo.svg b/rootdir/initlogo.svg
index d8dab57..d8dab57 100644
--- a/initlogo.svg
+++ b/rootdir/initlogo.svg
diff --git a/ueventd.gta04.rc b/rootdir/ueventd.gta04.rc
index 7be3ef3..7be3ef3 100644
--- a/ueventd.gta04.rc
+++ b/rootdir/ueventd.gta04.rc
diff --git a/twl4030_pwrbutton.kl b/twl4030_pwrbutton.kl
deleted file mode 100644
index ef2c8f6..0000000
--- a/twl4030_pwrbutton.kl
+++ /dev/null
@@ -1 +0,0 @@
-key 116 POWER WAKE
diff --git a/tsc2007.idc b/usr/idc/TSC2007_Touchscreen.idc
index 6c1df26..6c1df26 100644
--- a/tsc2007.idc
+++ b/usr/idc/TSC2007_Touchscreen.idc
diff --git a/usr/keylayout/Phone_button.kl b/usr/keylayout/Phone_button.kl
new file mode 100644
index 0000000..1232ea5
--- /dev/null
+++ b/usr/keylayout/Phone_button.kl
@@ -0,0 +1 @@
+key 169 BACK WAKE_DROPPED
diff --git a/usr/keylayout/twl4030_pwrbutton.kl b/usr/keylayout/twl4030_pwrbutton.kl
new file mode 100644
index 0000000..129f9ba
--- /dev/null
+++ b/usr/keylayout/twl4030_pwrbutton.kl
@@ -0,0 +1 @@
+key 116 POWER WAKE_DROPPED