From 096b9ecded658bb6482883deae570deaf1b4a82d Mon Sep 17 00:00:00 2001 From: tilak Date: Thu, 15 Aug 2013 13:00:05 +0530 Subject: adding Device Settings back --- n7100.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/n7100.mk b/n7100.mk index 95c9cba..a803ac6 100644 --- a/n7100.mk +++ b/n7100.mk @@ -44,6 +44,7 @@ PRODUCT_COPY_FILES += \ # Product specific Packages PRODUCT_PACKAGES += \ + DeviceSettings \ libsecril-client \ libsecril-client-sap \ SamsungServiceMode -- cgit v1.1 From 5d73749d461810cbd136e5cd8a3d173eea97a098 Mon Sep 17 00:00:00 2001 From: tilak Date: Fri, 23 Aug 2013 00:09:11 +0530 Subject: N7100: Enable home button wake setting --- .../packages/apps/Settings/res/values/config.xml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 overlay/packages/apps/Settings/res/values/config.xml diff --git a/overlay/packages/apps/Settings/res/values/config.xml b/overlay/packages/apps/Settings/res/values/config.xml new file mode 100644 index 0000000..089b429 --- /dev/null +++ b/overlay/packages/apps/Settings/res/values/config.xml @@ -0,0 +1,21 @@ + + + + + + true + \ No newline at end of file -- cgit v1.1 From 8faf0fe9ff068e2a347ebd132e3ce2d062612c24 Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Mon, 11 Nov 2013 10:59:08 +0530 Subject: updated pa.dependencies --- cm.dependencies | 18 ------------------ pa.dependencies | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 18 deletions(-) delete mode 100644 cm.dependencies create mode 100644 pa.dependencies diff --git a/cm.dependencies b/cm.dependencies deleted file mode 100644 index a78a94f..0000000 --- a/cm.dependencies +++ /dev/null @@ -1,18 +0,0 @@ -[ - { - "repository": "android_device_samsung_smdk4412-common", - "target_path": "device/samsung/smdk4412-common" - }, - { - "repository": "android_kernel_samsung_smdk4412", - "target_path": "kernel/samsung/smdk4412" - }, - { - "repository": "android_packages_apps_SamsungServiceMode", - "target_path": "packages/apps/SamsungServiceMode" - }, - { - "repository": "android_hardware_samsung", - "target_path": "hardware/samsung" - } -] diff --git a/pa.dependencies b/pa.dependencies new file mode 100644 index 0000000..bc4736d --- /dev/null +++ b/pa.dependencies @@ -0,0 +1,37 @@ +[ + { + "remote": "github", + "account": "AOSPA-legacy", + "repository": "android_device_samsung_smdk4412-common", + "target_path": "device/samsung/smdk4412-common", + "revision": "kitkat" + }, + { + "remote": "github", + "account": "AOSPA-legacy", + "repository": "android_kernel_samsung_smdk4412", + "target_path": "kernel/samsung/smdk4412", + "revision": "kitkat" + }, + { + "remote": "cm", + "account": "CyanogenMod", + "repository": "android_packages_apps_SamsungServiceMode", + "target_path": "packages/apps/SamsungServiceMode", + "revision": "cm-11.0" + }, + { + "remote": "github", + "account": "AOSPA-legacy", + "repository": "android_hardware_samsung", + "target_path": "hardware/samsung", + "revision": "kitkat" + }, + { + "remote": "github", + "account": "TheMuppets", + "repository": "proprietary_vendor_samsung", + "target_path": "vendor/samsung", + "revision": "cm-10.2" + } +] -- cgit v1.1 From 3082c79ce9ad320ebe294a34badfa097109f6c9e Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Mon, 11 Nov 2013 11:22:31 +0530 Subject: Disable a few overlays for now --- overlay/frameworks/base/core/res/res/values/config.xml | 16 ++++++++-------- overlay/packages/apps/Settings/res/values/config.xml | 6 +++--- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/overlay/frameworks/base/core/res/res/values/config.xml b/overlay/frameworks/base/core/res/res/values/config.xml index 3502bbc..5e97f15 100644 --- a/overlay/frameworks/base/core/res/res/values/config.xml +++ b/overlay/frameworks/base/core/res/res/values/config.xml @@ -76,11 +76,11 @@ true - - true + - - true + #ffffffff @@ -94,8 +94,8 @@ true - - false + true @@ -109,8 +109,8 @@ 8 - Assistant (search) 16 - App switch For example, a device with Home, Back and Menu keys would set this - config to 7. --> - 7 + config to 7. + 7 --> true diff --git a/overlay/packages/apps/Settings/res/values/config.xml b/overlay/packages/apps/Settings/res/values/config.xml index 089b429..0aa1d84 100644 --- a/overlay/packages/apps/Settings/res/values/config.xml +++ b/overlay/packages/apps/Settings/res/values/config.xml @@ -16,6 +16,6 @@ --> - - true - \ No newline at end of file + + -- cgit v1.1 From 30d5ce56c881b4cdd4f118cbee44429fc8c37b0d Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Tue, 12 Nov 2013 09:56:44 +0530 Subject: N7100: updates for AOSPA --- n7100.mk | 2 -- rootdir/fstab.smdk4x12 | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/n7100.mk b/n7100.mk index 5097c01..cfd3054 100644 --- a/n7100.mk +++ b/n7100.mk @@ -79,8 +79,6 @@ PRODUCT_COPY_FILES += \ PRODUCT_PACKAGES += \ com.android.nfc_extras -$(call inherit-product, vendor/cm/config/nfc_enhanced.mk) - # RIL PRODUCT_PROPERTY_OVERRIDES += \ ro.telephony.ril_class=SamsungExynos4RIL \ diff --git a/rootdir/fstab.smdk4x12 b/rootdir/fstab.smdk4x12 index 86fbd9f..efe528a 100644 --- a/rootdir/fstab.smdk4x12 +++ b/rootdir/fstab.smdk4x12 @@ -10,8 +10,8 @@ /dev/block/mmcblk0p14 /preload ext4 noatime,nosuid,nodev,journal_async_commit wait /dev/block/mmcblk0p16 /data ext4 noatime,nosuid,nodev,discard,noauto_da_alloc,journal_async_commit,errors=panic wait,check,encryptable=footer -/devices/platform/s3c-sdhci.2/mmc_host/mmc1 /storage/sdcard1 auto defaults voldmanaged=sdcard1:auto -/devices/platform/s5p-ehci /storage/usbdisk0 auto defaults voldmanaged=usbdisk0:auto +/devices/platform/s3c-sdhci.2/mmc_host/mmc1 auto auto defaults voldmanaged=sdcard1:auto +/devices/platform/s5p-ehci auto auto defaults voldmanaged=usbdisk0:auto # recovery /dev/block/mmcblk0p8 /boot emmc defaults recoveryonly -- cgit v1.1 From 338cedd2c3076d28d1d3135212b3ca148bbb36f1 Mon Sep 17 00:00:00 2001 From: myko Date: Mon, 11 Nov 2013 12:20:23 +0530 Subject: N7100: Enable Bluetooth Low Energy Change-Id: I8272187a8bfafbe0185be40c65fa166f711d4f1f --- bluetooth/bdroid_buildcfg.h | 4 +++- n7100.mk | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/bluetooth/bdroid_buildcfg.h b/bluetooth/bdroid_buildcfg.h index cdf37f3..93c924c 100644 --- a/bluetooth/bdroid_buildcfg.h +++ b/bluetooth/bdroid_buildcfg.h @@ -19,5 +19,7 @@ #define _BDROID_BUILDCFG_H #define BTM_DEF_LOCAL_NAME "GT-N7100" - +#define BLE_INCLUDED TRUE +#define BTA_GATT_INCLUDED TRUE +#define SMP_INCLUDED TRUE #endif diff --git a/n7100.mk b/n7100.mk index cfd3054..039e76b 100644 --- a/n7100.mk +++ b/n7100.mk @@ -64,6 +64,7 @@ PRODUCT_PACKAGES += \ PRODUCT_COPY_FILES += \ packages/apps/Nfc/migrate_nfc.txt:system/etc/updatecmds/migrate_nfc.txt \ frameworks/base/nfc-extras/com.android.nfc_extras.xml:system/etc/permissions/com.android.nfc_extras.xml \ + frameworks/native/data/etc/android.hardware.bluetooth_le.xml:system/etc/permissions/android.hardware.bluetooth_le.xml \ frameworks/native/data/etc/android.hardware.nfc.xml:system/etc/permissions/android.hardware.nfc.xml # NFCEE access control -- cgit v1.1 From 9b3a3bcd1c75f68d7083bd100f55b75e40415160 Mon Sep 17 00:00:00 2001 From: myko Date: Mon, 11 Nov 2013 12:20:23 +0530 Subject: N7100 - Added Selinux support Change-Id: I8272187a8bfafbe0185be40c65fa166f711d4f1f --- BoardConfig.mk | 16 ++++++++++++++++ selinux/device.te | 3 +++ selinux/domain.te | 2 ++ selinux/file.te | 5 +++++ selinux/file_contexts | 37 +++++++++++++++++++++++++++++++++++++ selinux/init.te | 1 + selinux/mediaserver.te | 3 +++ selinux/rild.te | 7 +++++++ selinux/system.te | 10 ++++++++++ selinux/ueventd.te | 3 +++ selinux/wpa_supplicant.te | 10 ++++++++++ 11 files changed, 97 insertions(+) create mode 100644 selinux/device.te create mode 100644 selinux/domain.te create mode 100644 selinux/file.te create mode 100644 selinux/file_contexts create mode 100644 selinux/init.te create mode 100644 selinux/mediaserver.te create mode 100644 selinux/rild.te create mode 100644 selinux/system.te create mode 100644 selinux/ueventd.te create mode 100755 selinux/wpa_supplicant.te diff --git a/BoardConfig.mk b/BoardConfig.mk index f2cf6b3..a957a02 100644 --- a/BoardConfig.mk +++ b/BoardConfig.mk @@ -40,3 +40,19 @@ TARGET_OTA_ASSERT_DEVICE := t03g,n7100,GT-N7100 # Recovery TARGET_RECOVERY_FSTAB := device/samsung/n7100/rootdir/fstab.smdk4x12 RECOVERY_FSTAB_VERSION := 2 + +# Selinux +BOARD_SEPOLICY_DIRS += \ + device/samsung/n7100/selinux + +BOARD_SEPOLICY_UNION += \ + device.te \ + domain.te \ + file.te \ + file_contexts \ + init.te \ + mediaserver.te \ + rild.te \ + system.te \ + ueventd.te \ + wpa_supplicant.te diff --git a/selinux/device.te b/selinux/device.te new file mode 100644 index 0000000..cca8ee1 --- /dev/null +++ b/selinux/device.te @@ -0,0 +1,3 @@ +type mali_device, dev_type, mlstrustedobject; +type rfkill_device, dev_type; +type efs_block_device, dev_type; diff --git a/selinux/domain.te b/selinux/domain.te new file mode 100644 index 0000000..26e8033 --- /dev/null +++ b/selinux/domain.te @@ -0,0 +1,2 @@ +## /dev/mali, /dev/ump +allow domain mali_device:chr_file rw_file_perms; diff --git a/selinux/file.te b/selinux/file.te new file mode 100644 index 0000000..2a01dac --- /dev/null +++ b/selinux/file.te @@ -0,0 +1,5 @@ +type firmware_mfc, file_type; +type firmware_camera, file_type; + +type camera_data_file, file_type, data_file_type; +type sensors_data_file, file_type, data_file_type; diff --git a/selinux/file_contexts b/selinux/file_contexts new file mode 100644 index 0000000..55022ec --- /dev/null +++ b/selinux/file_contexts @@ -0,0 +1,37 @@ +# GFX +/dev/mali u:object_r:mali_device:s0 +/dev/ump u:object_r:mali_device:s0 +/dev/fimg2d u:object_r:mali_device:s0 + +# RIL +/dev/umts_boot0 u:object_r:radio_device:s0 +/dev/umts_boot1 u:object_r:radio_device:s0 +/dev/umts_ipc0 u:object_r:radio_device:s0 +/dev/umts_ramdump0 u:object_r:radio_device:s0 +/dev/umts_rfs0 u:object_r:radio_device:s0 + +/dev/block/mmcblk0p7 u:object_r:efs_block_device:s0 + +# Camera +/data/ISP_CV u:object_r:camera_data_file:s0 +/dev/exynos-mem u:object_r:video_device:s0 + +# Bluetooth +/dev/ttySAC0 u:object_r:hci_attach_dev:s0 +/efs/bluetooth/(/.*)? u:object_r:bluetooth_efs_file:s0 + +# GPS +/dev/ttySAC1 u:object_r:gps_device:s0 + +# Sensors +/dev/akm8975 u:object_r:sensors_device:s0 +/efs/gyro_cal_data u:object_r:sensors_data_file:s0 + +# Wifi +/dev/rfkill u:object_r:rfkill_device:s0 +/efs/wifi/.mac.info u:object_r:wifi_data_file:s0 + +# Firmwares +/system/vendor/firmware(/.*)? u:object_r:firmware_camera:s0 +/system/vendor/firmware/mfc_fw.bin u:object_r:firmware_mfc:s0 +/data/cfw(/.*)? u:object_r:firmware_camera:s0 diff --git a/selinux/init.te b/selinux/init.te new file mode 100644 index 0000000..3f11893 --- /dev/null +++ b/selinux/init.te @@ -0,0 +1 @@ +allow init wpa_socket:unix_dgram_socket { bind create }; diff --git a/selinux/mediaserver.te b/selinux/mediaserver.te new file mode 100644 index 0000000..520da3a --- /dev/null +++ b/selinux/mediaserver.te @@ -0,0 +1,3 @@ +allow mediaserver { firmware_camera }:file r_file_perms; +allow mediaserver firmware_camera:dir r_dir_perms; +allow mediaserver camera_data_file:file rw_file_perms; diff --git a/selinux/rild.te b/selinux/rild.te new file mode 100644 index 0000000..7f817d0 --- /dev/null +++ b/selinux/rild.te @@ -0,0 +1,7 @@ +allow rild self:netlink_socket { create bind read write }; +allow rild self:netlink_route_socket { write }; +allow rild self:netlink_kobject_uevent_socket { create bind read write setopt }; + +allow rild radio_device:chr_file rw_file_perms; +allow rild efs_block_device:blk_file rw_file_perms; +allow rild efs_file:file { read open write setattr }; diff --git a/selinux/system.te b/selinux/system.te new file mode 100644 index 0000000..395aeea --- /dev/null +++ b/selinux/system.te @@ -0,0 +1,10 @@ +allow system input_device:chr_file { read ioctl write open }; +allow system sensors_device:chr_file { read open }; +allow system sensors_data_file:file r_file_perms; +allow system wpa_socket:unix_dgram_socket sendto; + +allow system sysfs:file { read open write }; +allow system self:capability { sys_module }; + +# /efs/wifi/.mac.info +allow system wifi_data_file:file { read open }; diff --git a/selinux/ueventd.te b/selinux/ueventd.te new file mode 100644 index 0000000..4037e57 --- /dev/null +++ b/selinux/ueventd.te @@ -0,0 +1,3 @@ +# Firmwares +allow ueventd { firmware_mfc }:file r_file_perms; +allow ueventd { firmware_camera }:dir search; diff --git a/selinux/wpa_supplicant.te b/selinux/wpa_supplicant.te new file mode 100755 index 0000000..ab5fb24 --- /dev/null +++ b/selinux/wpa_supplicant.te @@ -0,0 +1,10 @@ +allow wpa init:unix_dgram_socket { read write }; + +# logwrapper used with wpa_supplicant +allow wpa devpts:chr_file { read write }; + +allow wpa wpa_socket:unix_dgram_socket { read write }; +allow wpa_socket system:unix_dgram_socket sendto; + +allow wpa_socket wifi_data_file:sock_file unlink; +allow wpa rfkill_device:chr_file rw_file_perms; \ No newline at end of file -- cgit v1.1 From c4265aceacf50158cc3855d4b037d0f7b9cf092c Mon Sep 17 00:00:00 2001 From: myko Date: Mon, 11 Nov 2013 12:20:23 +0530 Subject: N7100 - Added Selinux support Change-Id: I8272187a8bfafbe0185be40c65fa166f711d4f1f --- BoardConfig.mk | 16 ++++++++++++++++ selinux/device.te | 3 +++ selinux/domain.te | 2 ++ selinux/file.te | 5 +++++ selinux/file_contexts | 37 +++++++++++++++++++++++++++++++++++++ selinux/init.te | 1 + selinux/mediaserver.te | 3 +++ selinux/rild.te | 7 +++++++ selinux/system.te | 10 ++++++++++ selinux/ueventd.te | 3 +++ selinux/wpa_supplicant.te | 10 ++++++++++ 11 files changed, 97 insertions(+) create mode 100644 selinux/device.te create mode 100644 selinux/domain.te create mode 100644 selinux/file.te create mode 100644 selinux/file_contexts create mode 100644 selinux/init.te create mode 100644 selinux/mediaserver.te create mode 100644 selinux/rild.te create mode 100644 selinux/system.te create mode 100644 selinux/ueventd.te create mode 100755 selinux/wpa_supplicant.te diff --git a/BoardConfig.mk b/BoardConfig.mk index f2cf6b3..a957a02 100644 --- a/BoardConfig.mk +++ b/BoardConfig.mk @@ -40,3 +40,19 @@ TARGET_OTA_ASSERT_DEVICE := t03g,n7100,GT-N7100 # Recovery TARGET_RECOVERY_FSTAB := device/samsung/n7100/rootdir/fstab.smdk4x12 RECOVERY_FSTAB_VERSION := 2 + +# Selinux +BOARD_SEPOLICY_DIRS += \ + device/samsung/n7100/selinux + +BOARD_SEPOLICY_UNION += \ + device.te \ + domain.te \ + file.te \ + file_contexts \ + init.te \ + mediaserver.te \ + rild.te \ + system.te \ + ueventd.te \ + wpa_supplicant.te diff --git a/selinux/device.te b/selinux/device.te new file mode 100644 index 0000000..cca8ee1 --- /dev/null +++ b/selinux/device.te @@ -0,0 +1,3 @@ +type mali_device, dev_type, mlstrustedobject; +type rfkill_device, dev_type; +type efs_block_device, dev_type; diff --git a/selinux/domain.te b/selinux/domain.te new file mode 100644 index 0000000..26e8033 --- /dev/null +++ b/selinux/domain.te @@ -0,0 +1,2 @@ +## /dev/mali, /dev/ump +allow domain mali_device:chr_file rw_file_perms; diff --git a/selinux/file.te b/selinux/file.te new file mode 100644 index 0000000..2a01dac --- /dev/null +++ b/selinux/file.te @@ -0,0 +1,5 @@ +type firmware_mfc, file_type; +type firmware_camera, file_type; + +type camera_data_file, file_type, data_file_type; +type sensors_data_file, file_type, data_file_type; diff --git a/selinux/file_contexts b/selinux/file_contexts new file mode 100644 index 0000000..9713bce --- /dev/null +++ b/selinux/file_contexts @@ -0,0 +1,37 @@ +# GFX +/dev/mali u:object_r:mali_device:s0 +/dev/ump u:object_r:mali_device:s0 +/dev/fimg2d u:object_r:mali_device:s0 + +# RIL +/dev/umts_boot0 u:object_r:radio_device:s0 +/dev/umts_boot1 u:object_r:radio_device:s0 +/dev/umts_ipc0 u:object_r:radio_device:s0 +/dev/umts_ramdump0 u:object_r:radio_device:s0 +/dev/umts_rfs0 u:object_r:radio_device:s0 + +/dev/block/mmcblk0p10 u:object_r:efs_block_device:s0 + +# Camera +/data/ISP_CV u:object_r:camera_data_file:s0 +/dev/exynos-mem u:object_r:video_device:s0 + +# Bluetooth +/dev/ttySAC0 u:object_r:hci_attach_dev:s0 +/efs/bluetooth/(/.*)? u:object_r:bluetooth_efs_file:s0 + +# GPS +/dev/ttySAC1 u:object_r:gps_device:s0 + +# Sensors +/dev/akm8975 u:object_r:sensors_device:s0 +/efs/gyro_cal_data u:object_r:sensors_data_file:s0 + +# Wifi +/dev/rfkill u:object_r:rfkill_device:s0 +/efs/wifi/.mac.info u:object_r:wifi_data_file:s0 + +# Firmwares +/system/vendor/firmware(/.*)? u:object_r:firmware_camera:s0 +/system/vendor/firmware/mfc_fw.bin u:object_r:firmware_mfc:s0 +/data/cfw(/.*)? u:object_r:firmware_camera:s0 diff --git a/selinux/init.te b/selinux/init.te new file mode 100644 index 0000000..3f11893 --- /dev/null +++ b/selinux/init.te @@ -0,0 +1 @@ +allow init wpa_socket:unix_dgram_socket { bind create }; diff --git a/selinux/mediaserver.te b/selinux/mediaserver.te new file mode 100644 index 0000000..520da3a --- /dev/null +++ b/selinux/mediaserver.te @@ -0,0 +1,3 @@ +allow mediaserver { firmware_camera }:file r_file_perms; +allow mediaserver firmware_camera:dir r_dir_perms; +allow mediaserver camera_data_file:file rw_file_perms; diff --git a/selinux/rild.te b/selinux/rild.te new file mode 100644 index 0000000..7f817d0 --- /dev/null +++ b/selinux/rild.te @@ -0,0 +1,7 @@ +allow rild self:netlink_socket { create bind read write }; +allow rild self:netlink_route_socket { write }; +allow rild self:netlink_kobject_uevent_socket { create bind read write setopt }; + +allow rild radio_device:chr_file rw_file_perms; +allow rild efs_block_device:blk_file rw_file_perms; +allow rild efs_file:file { read open write setattr }; diff --git a/selinux/system.te b/selinux/system.te new file mode 100644 index 0000000..395aeea --- /dev/null +++ b/selinux/system.te @@ -0,0 +1,10 @@ +allow system input_device:chr_file { read ioctl write open }; +allow system sensors_device:chr_file { read open }; +allow system sensors_data_file:file r_file_perms; +allow system wpa_socket:unix_dgram_socket sendto; + +allow system sysfs:file { read open write }; +allow system self:capability { sys_module }; + +# /efs/wifi/.mac.info +allow system wifi_data_file:file { read open }; diff --git a/selinux/ueventd.te b/selinux/ueventd.te new file mode 100644 index 0000000..4037e57 --- /dev/null +++ b/selinux/ueventd.te @@ -0,0 +1,3 @@ +# Firmwares +allow ueventd { firmware_mfc }:file r_file_perms; +allow ueventd { firmware_camera }:dir search; diff --git a/selinux/wpa_supplicant.te b/selinux/wpa_supplicant.te new file mode 100755 index 0000000..ab5fb24 --- /dev/null +++ b/selinux/wpa_supplicant.te @@ -0,0 +1,10 @@ +allow wpa init:unix_dgram_socket { read write }; + +# logwrapper used with wpa_supplicant +allow wpa devpts:chr_file { read write }; + +allow wpa wpa_socket:unix_dgram_socket { read write }; +allow wpa_socket system:unix_dgram_socket sendto; + +allow wpa_socket wifi_data_file:sock_file unlink; +allow wpa rfkill_device:chr_file rw_file_perms; \ No newline at end of file -- cgit v1.1 From dce6873d00e4ee996bac779a06633485177d6022 Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Sun, 17 Nov 2013 11:49:54 +0530 Subject: Selinux - some change --- selinux/file_contexts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selinux/file_contexts b/selinux/file_contexts index 55022ec..9713bce 100644 --- a/selinux/file_contexts +++ b/selinux/file_contexts @@ -10,7 +10,7 @@ /dev/umts_ramdump0 u:object_r:radio_device:s0 /dev/umts_rfs0 u:object_r:radio_device:s0 -/dev/block/mmcblk0p7 u:object_r:efs_block_device:s0 +/dev/block/mmcblk0p10 u:object_r:efs_block_device:s0 # Camera /data/ISP_CV u:object_r:camera_data_file:s0 -- cgit v1.1 From 5c2d62c6ce2e831d010b8600e2fe5fc7813a6533 Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Fri, 29 Nov 2013 19:47:45 +0530 Subject: N7100: Fix Sensors --- BoardConfig.mk | 3 +++ 1 file changed, 3 insertions(+) diff --git a/BoardConfig.mk b/BoardConfig.mk index a957a02..eaf3179 100644 --- a/BoardConfig.mk +++ b/BoardConfig.mk @@ -41,6 +41,9 @@ TARGET_OTA_ASSERT_DEVICE := t03g,n7100,GT-N7100 TARGET_RECOVERY_FSTAB := device/samsung/n7100/rootdir/fstab.smdk4x12 RECOVERY_FSTAB_VERSION := 2 +# Compatibility with pre-kitkat Sensor HALs +SENSORS_NEED_SETRATE_ON_ENABLE := true + # Selinux BOARD_SEPOLICY_DIRS += \ device/samsung/n7100/selinux -- cgit v1.1 From d9f051cdf73abedf2f06d0854c59422d5165e4c4 Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Fri, 29 Nov 2013 19:52:30 +0530 Subject: N7100 : Added Apollo, Torch and DSPManager --- n7100.mk | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/n7100.mk b/n7100.mk index 039e76b..df61c96 100644 --- a/n7100.mk +++ b/n7100.mk @@ -53,6 +53,15 @@ PRODUCT_PACKAGES += \ libsecril-client-sap \ SamsungServiceMode +# Additional apps +PRODUCT_PACKAGES += \ + Apollo \ + Torch \ + DashClock \ + DSPManager \ + libcyanogen-dsp \ + audio_effects.conf + # NFC PRODUCT_PACKAGES += \ nfc.exynos4 \ -- cgit v1.1 From 574c6800cdfaa1f6453d65cbfb9baec5b82a6b45 Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Tue, 3 Dec 2013 00:00:06 +0530 Subject: overlays: packages/apps/Phone --> packages/services/Telephony --- overlay/packages/apps/Phone/res/values/config.xml | 25 ---------------------- .../services/Telephony/res/values/config.xml | 25 ++++++++++++++++++++++ 2 files changed, 25 insertions(+), 25 deletions(-) delete mode 100644 overlay/packages/apps/Phone/res/values/config.xml create mode 100644 overlay/packages/services/Telephony/res/values/config.xml diff --git a/overlay/packages/apps/Phone/res/values/config.xml b/overlay/packages/apps/Phone/res/values/config.xml deleted file mode 100644 index 23ec4e4..0000000 --- a/overlay/packages/apps/Phone/res/values/config.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - true - - - noise_suppression=true=false - diff --git a/overlay/packages/services/Telephony/res/values/config.xml b/overlay/packages/services/Telephony/res/values/config.xml new file mode 100644 index 0000000..23ec4e4 --- /dev/null +++ b/overlay/packages/services/Telephony/res/values/config.xml @@ -0,0 +1,25 @@ + + + + + + + true + + + noise_suppression=true=false + -- cgit v1.1 From 78665972348cd1654f3d965cc6a9fc235b1ba773 Mon Sep 17 00:00:00 2001 From: Daniel Hillenbrand Date: Fri, 16 Aug 2013 00:35:52 +0200 Subject: n7100: audio: disable voicecall route on init and leaving incall state Original Change-Id in I9300 tree: I5e1ca99f19a715ef509825d46103c60f10d35ce2 Change-Id: I4b3f42ab561dd260d20507f04b1c4398cd07154b --- audio/audio_hw.c | 40 ++++++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/audio/audio_hw.c b/audio/audio_hw.c index 80a5ecc..9ddfeb1 100644 --- a/audio/audio_hw.c +++ b/audio/audio_hw.c @@ -209,7 +209,7 @@ static void in_update_aux_channels(struct m0_stream_in *in, effect_handle_t effe /* The enable flag when 0 makes the assumption that enums are disabled by * "Off" and integers/booleans by 0 */ -static int set_bigroute_by_array(struct mixer *mixer, struct route_setting *route, +static int set_voicecall_route_by_array(struct mixer *mixer, struct route_setting *route, int enable) { struct mixer_ctl *ctl; @@ -588,6 +588,11 @@ static void select_mode(struct m0_audio_device *adev) adev->in_call = 0; end_call(adev); force_all_standby(adev); + + /* Disable voicecall route */ + ALOGE("Disabling voicecall route"); + set_voicecall_route_by_array(adev->mixer, voicecall_default_disable, 1); + select_output_device(adev); select_input_device(adev); } @@ -668,26 +673,26 @@ static void select_output_device(struct m0_audio_device *adev) if (headset_on || headphone_on || speaker_on || earpiece_on) { ALOGD("%s: set voicecall route: voicecall_default", __func__); - set_bigroute_by_array(adev->mixer, voicecall_default, 1); + set_voicecall_route_by_array(adev->mixer, voicecall_default, 1); } else { ALOGD("%s: set voicecall route: voicecall_default_disable", __func__); - set_bigroute_by_array(adev->mixer, voicecall_default_disable, 1); + set_voicecall_route_by_array(adev->mixer, voicecall_default_disable, 1); } if (speaker_on || earpiece_on || headphone_on) { ALOGD("%s: set voicecall route: default_input", __func__); - set_bigroute_by_array(adev->mixer, default_input, 1); + set_voicecall_route_by_array(adev->mixer, default_input, 1); } else { ALOGD("%s: set voicecall route: default_input_disable", __func__); - set_bigroute_by_array(adev->mixer, default_input_disable, 1); + set_voicecall_route_by_array(adev->mixer, default_input_disable, 1); } if (headset_on) { ALOGD("%s: set voicecall route: headset_input", __func__); - set_bigroute_by_array(adev->mixer, headset_input, 1); + set_voicecall_route_by_array(adev->mixer, headset_input, 1); } else { ALOGD("%s: set voicecall route: headset_input_disable", __func__); - set_bigroute_by_array(adev->mixer, headset_input_disable, 1); + set_voicecall_route_by_array(adev->mixer, headset_input_disable, 1); } if (bt_on) { @@ -695,12 +700,12 @@ static void select_output_device(struct m0_audio_device *adev) end_call(adev); start_call(adev); ALOGD("%s: set voicecall route: bt_input", __func__); - set_bigroute_by_array(adev->mixer, bt_input, 1); + set_voicecall_route_by_array(adev->mixer, bt_input, 1); ALOGD("%s: set voicecall route: bt_output", __func__); - set_bigroute_by_array(adev->mixer, bt_output, 1); + set_voicecall_route_by_array(adev->mixer, bt_output, 1); } else { ALOGD("%s: set voicecall route: bt_disable", __func__); - set_bigroute_by_array(adev->mixer, bt_disable, 1); + set_voicecall_route_by_array(adev->mixer, bt_disable, 1); } set_incall_device(adev); @@ -2577,12 +2582,12 @@ static int adev_set_parameters(struct audio_hw_device *dev, const char *kvpairs) ALOGE("%s: enabling two mic control", __func__); ril_set_two_mic_control(&adev->ril, AUDIENCE, TWO_MIC_SOLUTION_ON); /* sub mic */ - set_bigroute_by_array(adev->mixer, noise_suppression, 1); + set_voicecall_route_by_array(adev->mixer, noise_suppression, 1); } else { ALOGE("%s: disabling two mic control", __func__); ril_set_two_mic_control(&adev->ril, AUDIENCE, TWO_MIC_SOLUTION_OFF); /* sub mic */ - set_bigroute_by_array(adev->mixer, noise_suppression_disable, 1); + set_voicecall_route_by_array(adev->mixer, noise_suppression_disable, 1); } } @@ -3053,10 +3058,6 @@ static int adev_open(const hw_module_t* module, const char* name, return -EINVAL; } - /* +30db boost for mics */ - adev->mixer_ctls.mixinl_in1l_volume = mixer_get_ctl_by_name(adev->mixer, "MIXINL IN1L Volume"); - adev->mixer_ctls.mixinl_in2l_volume = mixer_get_ctl_by_name(adev->mixer, "MIXINL IN2L Volume"); - ret = adev_config_parse(adev); if (ret != 0) goto err_mixer; @@ -3068,6 +3069,13 @@ static int adev_open(const hw_module_t* module, const char* name, adev->in_device = AUDIO_DEVICE_IN_BUILTIN_MIC & ~AUDIO_DEVICE_BIT_IN; select_devices(adev); + /* +30db boost for mics */ + adev->mixer_ctls.mixinl_in1l_volume = mixer_get_ctl_by_name(adev->mixer, "MIXINL IN1L Volume"); + adev->mixer_ctls.mixinl_in2l_volume = mixer_get_ctl_by_name(adev->mixer, "MIXINL IN2L Volume"); + + /* Disable voicecall route */ + set_voicecall_route_by_array(adev->mixer, voicecall_default_disable, 1); + adev->pcm_modem_dl = NULL; adev->pcm_modem_ul = NULL; adev->pcm_bt_dl = NULL; -- cgit v1.1 From b2342e73b0c319dc028ea807e280c52f70a1806b Mon Sep 17 00:00:00 2001 From: Dheeraj CVR Date: Mon, 30 Sep 2013 03:29:21 +0530 Subject: n7100: audio: don't disable back mic upon voice call end Back or Secondary Microphone (Sub Mic) is turned on and off using noise_suppression parameter from adev_set_parameters and hence it is not required to disable the back mic explicitly in voicecall_default_disable Original Change-Id in i9300 tree: I0959bfb0d49c0ba75795f5374e6f5ba5eac59cf1 Change-Id: Ie03d8515df11d276d0ac4c0db05be1d9dbb82089 --- audio/audio_hw.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/audio/audio_hw.h b/audio/audio_hw.h index 889f747..3c28d5a 100644 --- a/audio/audio_hw.h +++ b/audio/audio_hw.h @@ -134,8 +134,6 @@ struct route_setting voicecall_default_disable[] = { { .ctl_name = "AIF2DAC Mux", .strval = "AIF3DACDAT", }, { .ctl_name = "Main Mic Switch", .intval = 0, }, { .ctl_name = "MIXINL IN2L Switch", .intval = 0, }, - { .ctl_name = "Sub Mic Switch", .intval = 0, }, - { .ctl_name = "MIXINR IN1R Switch", .intval = 0, }, { .ctl_name = NULL, }, }; -- cgit v1.1 From f841fe4fddbb05a5359299d61feb45e8483f01bd Mon Sep 17 00:00:00 2001 From: Dheeraj CVR Date: Sat, 28 Sep 2013 18:24:01 +0530 Subject: n7100: audio: properly set routing and standby after voice call Disabling the voice call route using voicecall_default_disable is not sufficient since there are additional routes which are used during a voice call, which have to be properly disabled. Also, set the input device to standy which prevents the mic from not working for the first time after a voice call. This could also serve a potential fix for battery drain issues after voice call. Original Change-Id in i9300 tree: I0acd41deafd49da50857d6fe6396c3b5270d911c Change-Id: Id2a0e4f22baca54b0ae7cf775aff6cf5c5b0bd14 --- audio/audio_hw.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/audio/audio_hw.c b/audio/audio_hw.c index 9ddfeb1..1775acc 100644 --- a/audio/audio_hw.c +++ b/audio/audio_hw.c @@ -589,11 +589,18 @@ static void select_mode(struct m0_audio_device *adev) end_call(adev); force_all_standby(adev); - /* Disable voicecall route */ - ALOGE("Disabling voicecall route"); + ALOGD("%s: set voicecall route: voicecall_default_disable", __func__); set_voicecall_route_by_array(adev->mixer, voicecall_default_disable, 1); + ALOGD("%s: set voicecall route: default_input_disable", __func__); + set_voicecall_route_by_array(adev->mixer, default_input_disable, 1); + ALOGD("%s: set voicecall route: headset_input_disable", __func__); + set_voicecall_route_by_array(adev->mixer, headset_input_disable, 1); + ALOGD("%s: set voicecall route: bt_disable", __func__); + set_voicecall_route_by_array(adev->mixer, bt_disable, 1); select_output_device(adev); + //Force Input Standby + adev->in_device = AUDIO_DEVICE_NONE; select_input_device(adev); } } @@ -3066,16 +3073,13 @@ static int adev_open(const hw_module_t* module, const char* name, pthread_mutex_lock(&adev->lock); adev->mode = AUDIO_MODE_NORMAL; adev->out_device = AUDIO_DEVICE_OUT_SPEAKER; - adev->in_device = AUDIO_DEVICE_IN_BUILTIN_MIC & ~AUDIO_DEVICE_BIT_IN; + adev->in_device = AUDIO_DEVICE_NONE; select_devices(adev); /* +30db boost for mics */ adev->mixer_ctls.mixinl_in1l_volume = mixer_get_ctl_by_name(adev->mixer, "MIXINL IN1L Volume"); adev->mixer_ctls.mixinl_in2l_volume = mixer_get_ctl_by_name(adev->mixer, "MIXINL IN2L Volume"); - /* Disable voicecall route */ - set_voicecall_route_by_array(adev->mixer, voicecall_default_disable, 1); - adev->pcm_modem_dl = NULL; adev->pcm_modem_ul = NULL; adev->pcm_bt_dl = NULL; -- cgit v1.1 From 2d0f9bba06f02813bf4f01df1e2c7daea05e5be6 Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Tue, 3 Dec 2013 11:27:11 +0530 Subject: disable some overlays --- overlay/packages/services/Telephony/res/values/config.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/overlay/packages/services/Telephony/res/values/config.xml b/overlay/packages/services/Telephony/res/values/config.xml index 23ec4e4..ecf2927 100644 --- a/overlay/packages/services/Telephony/res/values/config.xml +++ b/overlay/packages/services/Telephony/res/values/config.xml @@ -20,6 +20,6 @@ true - - noise_suppression=true=false + -- cgit v1.1 From 102f71ab583a4f612952986ea933eb06b9d07a58 Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Tue, 3 Dec 2013 19:51:32 +0530 Subject: N7100-Added hardware key overlays --- overlay/frameworks/base/core/res/res/values/config.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/overlay/frameworks/base/core/res/res/values/config.xml b/overlay/frameworks/base/core/res/res/values/config.xml index 5e97f15..13f7b74 100644 --- a/overlay/frameworks/base/core/res/res/values/config.xml +++ b/overlay/frameworks/base/core/res/res/values/config.xml @@ -109,8 +109,8 @@ 8 - Assistant (search) 16 - App switch For example, a device with Home, Back and Menu keys would set this - config to 7. - 7 --> + config to 7. --> + 7 true -- cgit v1.1 From febb9e69aeda9965cac1cd1d6f039f188c072518 Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Wed, 11 Dec 2013 17:30:05 +0530 Subject: pa.dependencies: adjust for new roomservice --- pa.dependencies | 29 ++++++++++++----------------- system.prop | 1 + 2 files changed, 13 insertions(+), 17 deletions(-) diff --git a/pa.dependencies b/pa.dependencies index bc4736d..071bb4d 100644 --- a/pa.dependencies +++ b/pa.dependencies @@ -1,37 +1,32 @@ [ { - "remote": "github", - "account": "AOSPA-legacy", - "repository": "android_device_samsung_smdk4412-common", - "target_path": "device/samsung/smdk4412-common", - "revision": "kitkat" + "repository": "android_device_samsung_n7100", + "target_path": "device/samsung/n7100" }, { - "remote": "github", - "account": "AOSPA-legacy", - "repository": "android_kernel_samsung_smdk4412", - "target_path": "kernel/samsung/smdk4412", - "revision": "kitkat" + "repository": "android_device_samsung_smdk4412-common", + "target_path": "device/samsung/smdk4412-common", }, { "remote": "cm", - "account": "CyanogenMod", "repository": "android_packages_apps_SamsungServiceMode", "target_path": "packages/apps/SamsungServiceMode", "revision": "cm-11.0" }, { - "remote": "github", - "account": "AOSPA-legacy", "repository": "android_hardware_samsung", "target_path": "hardware/samsung", - "revision": "kitkat" }, { - "remote": "github", - "account": "TheMuppets", + "remote": "cm", + "repository": "CyanogenMod/android_packages_apps_Apollo", + "target_path": "packages/apps/Apollo", + "revision": "cm-11.0" + }, + { + "remote": "blobs", "repository": "proprietary_vendor_samsung", "target_path": "vendor/samsung", - "revision": "cm-10.2" + "revision": "cm-11.0" } ] diff --git a/system.prop b/system.prop index 47d42de..22fda1f 100644 --- a/system.prop +++ b/system.prop @@ -7,3 +7,4 @@ rild.libpath=/system/lib/libsec-ril.so rild.libargs=-d /dev/ttyS0 ro.sf.lcd_density=320 ro.lcd_min_brightness=20 +ro.pa.device=n7100 -- cgit v1.1 From d0c088c592c84701640149d5b86fa476ffcafe47 Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Thu, 12 Dec 2013 08:42:51 +0530 Subject: Added Kernel Repo to pa.dependencies --- pa.dependencies | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pa.dependencies b/pa.dependencies index 071bb4d..e5be0b1 100644 --- a/pa.dependencies +++ b/pa.dependencies @@ -5,7 +5,11 @@ }, { "repository": "android_device_samsung_smdk4412-common", - "target_path": "device/samsung/smdk4412-common", + "target_path": "device/samsung/smdk4412-common" + }, + { + "repository": "android_kernel_samsung_smdk4412", + "target_path": "kernel/samsung/smdk4412" }, { "remote": "cm", @@ -15,7 +19,7 @@ }, { "repository": "android_hardware_samsung", - "target_path": "hardware/samsung", + "target_path": "hardware/samsung" }, { "remote": "cm", -- cgit v1.1 From c37701aed3bae2d6005aa3ac6cee987c3881cb68 Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Fri, 13 Dec 2013 20:57:51 +0530 Subject: n7100: update build description and fingerprint to the latest official MK4 4.3 release --- cm.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cm.mk b/cm.mk index 43f6649..02b3945 100644 --- a/cm.mk +++ b/cm.mk @@ -22,4 +22,4 @@ PRODUCT_MODEL := GT-N7100 PRODUCT_MANUFACTURER := samsung # Set build fingerprint / ID / Product Name ect. -PRODUCT_BUILD_PROP_OVERRIDES += PRODUCT_NAME=t03gxx TARGET_DEVICE=t03g BUILD_FINGERPRINT="samsung/t03gxx/t03g:4.1.1/JRO03C/N7100XXALJ3:user/release-keys" PRIVATE_BUILD_DESC="t03gxx-user 4.1.1 JRO03C N7100XXALJ3 release-keys" +PRODUCT_BUILD_PROP_OVERRIDES += PRODUCT_NAME=t03gxx TARGET_DEVICE=t03g BUILD_FINGERPRINT="samsung/t03gxx/t03g:4.3/JSS15J/N7100XXUEMK4:user/release-keys" PRIVATE_BUILD_DESC="t03gxx-user 4.3 JSS15J N7100XXUEMK4 release-keys" -- cgit v1.1 From 6157b8ac6364a7e94c767327cd1c897a717b8494 Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Sat, 14 Dec 2013 17:11:02 +0530 Subject: pa.dependencies: adjust for new roomservice --- pa.dependencies | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pa.dependencies b/pa.dependencies index e5be0b1..933f757 100644 --- a/pa.dependencies +++ b/pa.dependencies @@ -13,13 +13,15 @@ }, { "remote": "cm", - "repository": "android_packages_apps_SamsungServiceMode", + "repository": "CyanogenMod/android_packages_apps_SamsungServiceMode", "target_path": "packages/apps/SamsungServiceMode", "revision": "cm-11.0" }, { - "repository": "android_hardware_samsung", - "target_path": "hardware/samsung" + "remote": "cm", + "repository": "CyanogenMod/android_hardware_samsung", + "target_path": "hardware/samsung", + "revision": "cm-11.0" }, { "remote": "cm", -- cgit v1.1 From 852066e5bee67292ad9aef875cd53515ad9d8485 Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Sun, 15 Dec 2013 16:13:05 +0530 Subject: enabled Battery LED overlay --- overlay/frameworks/base/core/res/res/values/config.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/overlay/frameworks/base/core/res/res/values/config.xml b/overlay/frameworks/base/core/res/res/values/config.xml index 13f7b74..9e7ea06 100644 --- a/overlay/frameworks/base/core/res/res/values/config.xml +++ b/overlay/frameworks/base/core/res/res/values/config.xml @@ -76,11 +76,11 @@ true - + + true - + + true #ffffffff -- cgit v1.1 From d0e16a8bb37029047be19f2577ffee1470f72978 Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Sun, 15 Dec 2013 16:15:28 +0530 Subject: N7100:Removed Torch and added OpenDelta --- n7100.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/n7100.mk b/n7100.mk index df61c96..328b7b4 100644 --- a/n7100.mk +++ b/n7100.mk @@ -56,7 +56,7 @@ PRODUCT_PACKAGES += \ # Additional apps PRODUCT_PACKAGES += \ Apollo \ - Torch \ + OpenDelta \ DashClock \ DSPManager \ libcyanogen-dsp \ -- cgit v1.1 From 1b49b7f25b8f86c7cf82ce37c53792e1a1081a36 Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Wed, 18 Dec 2013 09:39:28 +0530 Subject: n7100: add NFC Host-based card emulation --- n7100.mk | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/n7100.mk b/n7100.mk index 328b7b4..5541155 100644 --- a/n7100.mk +++ b/n7100.mk @@ -74,7 +74,8 @@ PRODUCT_COPY_FILES += \ packages/apps/Nfc/migrate_nfc.txt:system/etc/updatecmds/migrate_nfc.txt \ frameworks/base/nfc-extras/com.android.nfc_extras.xml:system/etc/permissions/com.android.nfc_extras.xml \ frameworks/native/data/etc/android.hardware.bluetooth_le.xml:system/etc/permissions/android.hardware.bluetooth_le.xml \ - frameworks/native/data/etc/android.hardware.nfc.xml:system/etc/permissions/android.hardware.nfc.xml + frameworks/native/data/etc/android.hardware.nfc.xml:system/etc/permissions/android.hardware.nfc.xml \ + frameworks/native/data/etc/android.hardware.nfc.hce.xml:system/etc/permissions/android.hardware.nfc.hce.xml # NFCEE access control ifeq ($(TARGET_BUILD_VARIANT),user) @@ -87,7 +88,8 @@ PRODUCT_COPY_FILES += \ $(NFCEE_ACCESS_PATH):system/etc/nfcee_access.xml PRODUCT_PACKAGES += \ - com.android.nfc_extras + com.android.nfc_extras \ + Stk # RIL PRODUCT_PROPERTY_OVERRIDES += \ -- cgit v1.1 From 83327f0747039d87ef6066fab458fdd8c06ac34f Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Wed, 18 Dec 2013 22:14:03 +0530 Subject: N7100: Enabled a few overlays --- overlay/packages/apps/Settings/res/values/config.xml | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/overlay/packages/apps/Settings/res/values/config.xml b/overlay/packages/apps/Settings/res/values/config.xml index 0aa1d84..f10ae89 100644 --- a/overlay/packages/apps/Settings/res/values/config.xml +++ b/overlay/packages/apps/Settings/res/values/config.xml @@ -16,6 +16,16 @@ --> - + + true + + + true + + + + -- cgit v1.1 From dc94c3c511da43f1962482ab7a237a01ca93ccb9 Mon Sep 17 00:00:00 2001 From: Dominik Marszk Date: Fri, 20 Dec 2013 22:36:05 +0530 Subject: N7100: Audio: Code-formatting Change-Id: I4bc3c7aaf8bacadefa2ac6c45374c27e31ef131c --- audio/audio_hw.c | 119 +++++++++++++++++++++++++++---------------------------- 1 file changed, 59 insertions(+), 60 deletions(-) mode change 100644 => 100755 audio/audio_hw.c diff --git a/audio/audio_hw.c b/audio/audio_hw.c old mode 100644 new mode 100755 index 1775acc..a890b63 --- a/audio/audio_hw.c +++ b/audio/audio_hw.c @@ -2837,86 +2837,85 @@ static void adev_config_start(void *data, const XML_Char *elem, unsigned int i, j; for (i = 0; attr[i]; i += 2) { - if (strcmp(attr[i], "name") == 0) - name = attr[i + 1]; + if (strcmp(attr[i], "name") == 0) + name = attr[i + 1]; - if (strcmp(attr[i], "val") == 0) - val = attr[i + 1]; + if (strcmp(attr[i], "val") == 0) + val = attr[i + 1]; } if (strcmp(elem, "device") == 0) { - if (!name) { - ALOGE("Unnamed device\n"); - return; - } - - for (i = 0; i < sizeof(dev_names) / sizeof(dev_names[0]); i++) { - if (strcmp(dev_names[i].name, name) == 0) { - ALOGI("Allocating device %s\n", name); - dev_cfg = realloc(s->adev->dev_cfgs, - (s->adev->num_dev_cfgs + 1) - * sizeof(*dev_cfg)); - if (!dev_cfg) { - ALOGE("Unable to allocate dev_cfg\n"); + if (!name) { + ALOGE("Unnamed device\n"); return; } - s->dev = &dev_cfg[s->adev->num_dev_cfgs]; - memset(s->dev, 0, sizeof(*s->dev)); - s->dev->mask = dev_names[i].mask; + for (i = 0; i < sizeof(dev_names) / sizeof(dev_names[0]); i++) { + if (strcmp(dev_names[i].name, name) == 0) { + ALOGI("Allocating device %s\n", name); + dev_cfg = realloc(s->adev->dev_cfgs, + (s->adev->num_dev_cfgs + 1) + * sizeof(*dev_cfg)); + if (!dev_cfg) { + ALOGE("Unable to allocate dev_cfg\n"); + return; + } - s->adev->dev_cfgs = dev_cfg; - s->adev->num_dev_cfgs++; - } - } + s->dev = &dev_cfg[s->adev->num_dev_cfgs]; + memset(s->dev, 0, sizeof(*s->dev)); + s->dev->mask = dev_names[i].mask; + s->adev->dev_cfgs = dev_cfg; + s->adev->num_dev_cfgs++; + } + } } else if (strcmp(elem, "path") == 0) { - if (s->path_len) - ALOGW("Nested paths\n"); - - /* If this a path for a device it must have a role */ - if (s->dev) { - /* Need to refactor a bit... */ - if (strcmp(name, "on") == 0) { - s->on = true; - } else if (strcmp(name, "off") == 0) { - s->on = false; - } else { - ALOGW("Unknown path name %s\n", name); + if (s->path_len) + ALOGW("Nested paths\n"); + + /* If this a path for a device it must have a role */ + if (s->dev) { + /* Need to refactor a bit... */ + if (strcmp(name, "on") == 0) { + s->on = true; + } else if (strcmp(name, "off") == 0) { + s->on = false; + } else { + ALOGW("Unknown path name %s\n", name); + } } - } } else if (strcmp(elem, "ctl") == 0) { - struct route_setting *r; + struct route_setting *r; - if (!name) { - ALOGE("Unnamed control\n"); - return; - } + if (!name) { + ALOGE("Unnamed control\n"); + return; + } - if (!val) { - ALOGE("No value specified for %s\n", name); - return; - } + if (!val) { + ALOGE("No value specified for %s\n", name); + return; + } - ALOGV("Parsing control %s => %s\n", name, val); + ALOGV("Parsing control %s => %s\n", name, val); - r = realloc(s->path, sizeof(*r) * (s->path_len + 1)); - if (!r) { - ALOGE("Out of memory handling %s => %s\n", name, val); - return; - } + r = realloc(s->path, sizeof(*r) * (s->path_len + 1)); + if (!r) { + ALOGE("Out of memory handling %s => %s\n", name, val); + return; + } - r[s->path_len].ctl_name = strdup(name); - r[s->path_len].strval = NULL; + r[s->path_len].ctl_name = strdup(name); + r[s->path_len].strval = NULL; - /* This can be fooled but it'll do */ - r[s->path_len].intval = atoi(val); - if (!r[s->path_len].intval && strcmp(val, "0") != 0) - r[s->path_len].strval = strdup(val); + /* This can be fooled but it'll do */ + r[s->path_len].intval = atoi(val); + if (!r[s->path_len].intval && strcmp(val, "0") != 0) + r[s->path_len].strval = strdup(val); - s->path = r; - s->path_len++; + s->path = r; + s->path_len++; } } -- cgit v1.1 From 28e3038bf810016925668ff5d8236325d37aaab9 Mon Sep 17 00:00:00 2001 From: sbrissen Date: Wed, 11 Dec 2013 18:23:22 +0530 Subject: N7100: Open source sensors smdk4412: https://gerrit.omnirom.org/#/c/3934/ This reverts commit 1862e93acf995525493f0c47f4ba6fde37611ba2. Change-Id: Ib5c14f7da94ea1696bae36f7d0bf19a0c63e57e9 Conflicts: BoardConfig.mk --- BoardConfig.mk | 3 - libsensors/AccelSensor.cpp | 155 +++++++++++++++ libsensors/AccelSensor.h | 70 +++++++ libsensors/AkmSensor.cpp | 293 ++++++++++++++++++++++++++++ libsensors/AkmSensor.h | 66 +++++++ libsensors/Android.mk | 47 +++++ libsensors/GyroSensor.cpp | 177 +++++++++++++++++ libsensors/GyroSensor.h | 55 ++++++ libsensors/InputEventReader.cpp | 88 +++++++++ libsensors/InputEventReader.h | 47 +++++ libsensors/LightSensor.cpp | 150 ++++++++++++++ libsensors/LightSensor.h | 55 ++++++ libsensors/MODULE_LICENSE_APACHE2 | 0 libsensors/PressureSensor.cpp | 152 +++++++++++++++ libsensors/PressureSensor.h | 54 ++++++ libsensors/ProximitySensor.cpp | 157 +++++++++++++++ libsensors/ProximitySensor.h | 55 ++++++ libsensors/SensorBase.cpp | 178 +++++++++++++++++ libsensors/SensorBase.h | 71 +++++++ libsensors/sensors.cpp | 397 ++++++++++++++++++++++++++++++++++++++ libsensors/sensors.h | 131 +++++++++++++ n7100.mk | 4 + proprietary-files.txt | 6 - 23 files changed, 2402 insertions(+), 9 deletions(-) create mode 100644 libsensors/AccelSensor.cpp create mode 100644 libsensors/AccelSensor.h create mode 100644 libsensors/AkmSensor.cpp create mode 100644 libsensors/AkmSensor.h create mode 100644 libsensors/Android.mk create mode 100644 libsensors/GyroSensor.cpp create mode 100644 libsensors/GyroSensor.h create mode 100644 libsensors/InputEventReader.cpp create mode 100644 libsensors/InputEventReader.h create mode 100644 libsensors/LightSensor.cpp create mode 100644 libsensors/LightSensor.h create mode 100644 libsensors/MODULE_LICENSE_APACHE2 create mode 100644 libsensors/PressureSensor.cpp create mode 100644 libsensors/PressureSensor.h create mode 100644 libsensors/ProximitySensor.cpp create mode 100644 libsensors/ProximitySensor.h create mode 100644 libsensors/SensorBase.cpp create mode 100644 libsensors/SensorBase.h create mode 100644 libsensors/sensors.cpp create mode 100644 libsensors/sensors.h diff --git a/BoardConfig.mk b/BoardConfig.mk index eaf3179..a957a02 100644 --- a/BoardConfig.mk +++ b/BoardConfig.mk @@ -41,9 +41,6 @@ TARGET_OTA_ASSERT_DEVICE := t03g,n7100,GT-N7100 TARGET_RECOVERY_FSTAB := device/samsung/n7100/rootdir/fstab.smdk4x12 RECOVERY_FSTAB_VERSION := 2 -# Compatibility with pre-kitkat Sensor HALs -SENSORS_NEED_SETRATE_ON_ENABLE := true - # Selinux BOARD_SEPOLICY_DIRS += \ device/samsung/n7100/selinux diff --git a/libsensors/AccelSensor.cpp b/libsensors/AccelSensor.cpp new file mode 100644 index 0000000..2d02bc7 --- /dev/null +++ b/libsensors/AccelSensor.cpp @@ -0,0 +1,155 @@ +/* + * Copyright (C) 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. + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "AccelSensor.h" + +#define LOGTAG "AccelerometerSensor" + +/*****************************************************************************/ +AccelSensor::AccelSensor() + : SensorBase(NULL, "accelerometer_sensor"), + mEnabled(0), + + mInputReader(4), + mHasPendingEvent(false) +{ + mPendingEvent.version = sizeof(sensors_event_t); + mPendingEvent.sensor = ID_A; + mPendingEvent.type = SENSOR_TYPE_ACCELEROMETER; + memset(mPendingEvent.data, 0, sizeof(mPendingEvent.data)); + + if (data_fd) { + strcpy(input_sysfs_path, "/sys/class/input/"); + strcat(input_sysfs_path, input_name); + strcat(input_sysfs_path, "/device/"); + input_sysfs_path_len = strlen(input_sysfs_path); + } +} + +AccelSensor::~AccelSensor() { + + // ALOGD("AccelSensor::~AccelSensor()"); + if (mEnabled) { + enable(0, 0); + } +} + +int AccelSensor::setInitialState() +{ + return 0; +} + +int AccelSensor::enable(int32_t handle, int en) { + int flags = en ? 1 : 0; + int err; + if (flags != mEnabled) { + err = sspEnable(LOGTAG, SSP_ACCEL, en); + if(err >= 0){ + mEnabled = flags; + setInitialState(); + + return 0; + } + return -1; + } + return 0; +} + + +bool AccelSensor::hasPendingEvents() const { + /* FIXME probably here should be returning mEnabled but instead + mHasPendingEvents. It does not work, so we cheat.*/ + //ALOGD("AccelSensor::~hasPendingEvents %d", mHasPendingEvent ? 1 : 0 ); + return mHasPendingEvent; +} + + +int AccelSensor::setDelay(int32_t handle, int64_t ns) +{ + int fd; + + if (ns < 10000000) { + ns = 10000000; // Minimum on stock + } + + strcpy(&input_sysfs_path[input_sysfs_path_len], "acc_poll_delay"); + fd = open(input_sysfs_path, O_RDWR); + if (fd >= 0) { + char buf[80]; + sprintf(buf, "%lld", ns / 10000000 * 10); // Some flooring to match stock value + write(fd, buf, strlen(buf)+1); + close(fd); + return 0; + } + return -1; +} + + +int AccelSensor::readEvents(sensors_event_t* data, int count) +{ + if (count < 1) + return -EINVAL; + + if (mHasPendingEvent) { + mHasPendingEvent = false; + mPendingEvent.timestamp = getTimestamp(); + *data = mPendingEvent; + return mEnabled ? 1 : 0; + } + + ssize_t n = mInputReader.fill(data_fd); + if (n < 0) + return n; + int numEventReceived = 0; + input_event const* event; + + while (count && mInputReader.readEvent(&event)) { + int type = event->type; + if (type == EV_REL) { + float value = event->value; + if (event->code == EVENT_TYPE_ACCEL_X) { + mPendingEvent.acceleration.x = value * CONVERT_A_X; + } else if (event->code == EVENT_TYPE_ACCEL_Y) { + mPendingEvent.acceleration.y = value * CONVERT_A_Y; + } else if (event->code == EVENT_TYPE_ACCEL_Z) { + mPendingEvent.acceleration.z = value * CONVERT_A_Z; + } + } else if (type == EV_SYN) { + mPendingEvent.timestamp = timevalToNano(event->time); + if (mEnabled) { + *data++ = mPendingEvent; + count--; + numEventReceived++; + } + } else { + ALOGE("%s: unknown event (type=%d, code=%d)", LOGTAG, + type, event->code); + } + + mInputReader.next(); + } + return numEventReceived++; + +} diff --git a/libsensors/AccelSensor.h b/libsensors/AccelSensor.h new file mode 100644 index 0000000..0162147 --- /dev/null +++ b/libsensors/AccelSensor.h @@ -0,0 +1,70 @@ +/* + * Copyright (C) 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. + */ + +#ifndef ANDROID_SMB380_SENSOR_H +#define ANDROID_SMB380_SENSOR_H + +#include +#include +#include +#include + +#include "sensors.h" +#include "SensorBase.h" +#include "InputEventReader.h" + +/*****************************************************************************/ + + +struct smb380acc_t { + short x, /**< holds x-axis acceleration data sign extended. Range -512 to 511. */ + y, /**< holds y-axis acceleration data sign extended. Range -512 to 511. */ + z; /**< holds z-axis acceleration data sign extended. Range -512 to 511. */ +} ; + +/* smb ioctl command label */ +#define IOCTL_SMB_GET_ACC_VALUE 0 +#define DCM_IOC_MAGIC 's' +#define IOC_SET_ACCELEROMETER _IO (DCM_IOC_MAGIC, 0x64) +#define BMA150_CALIBRATION _IOWR(DCM_IOC_MAGIC,48,short) + +#define SMB_POWER_OFF 0 +#define SMB_POWER_ON 1 + +struct input_event; + +class AccelSensor : public SensorBase { + int mEnabled; + InputEventCircularReader mInputReader; + sensors_event_t mPendingEvent; + bool mHasPendingEvent; + char input_sysfs_path[PATH_MAX]; + int input_sysfs_path_len; + + int setInitialState(); + +public: + AccelSensor(); + virtual ~AccelSensor(); + virtual int readEvents(sensors_event_t* data, int count); + virtual bool hasPendingEvents() const; + virtual int setDelay(int32_t handle, int64_t ns); + virtual int enable(int32_t handle, int enabled); +}; + +/*****************************************************************************/ + +#endif // ANDROID_GYRO_SENSOR_H diff --git a/libsensors/AkmSensor.cpp b/libsensors/AkmSensor.cpp new file mode 100644 index 0000000..160df2a --- /dev/null +++ b/libsensors/AkmSensor.cpp @@ -0,0 +1,293 @@ +/* + * Copyright (C) 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. + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include "AkmSensor.h" + +#define LOGTAG "AkmSensor" + +//#define ALOG_NDEBUG 0 + +/*****************************************************************************/ + +int (*akm_is_sensor_enabled)(uint32_t sensor_type); +int (*akm_enable_sensor)(uint32_t sensor_type); +int (*akm_disable_sensor)(uint32_t sensor_type); +int (*akm_set_delay)(uint32_t sensor_type, uint64_t delay); + +int stub_is_sensor_enabled(uint32_t sensor_type) { + return 0; +} + +int stub_enable_disable_sensor(uint32_t sensor_type) { + return -ENODEV; +} + +int stub_set_delay(uint32_t sensor_type, uint64_t delay) { + return -ENODEV; +} + + +AkmSensor::AkmSensor() +: SensorBase(NULL, NULL), + mEnabled(0), + mPendingMask(0), + mInputReader(32) +{ + /* Open the library before opening the input device. The library + * creates a uinput device. + */ + if (loadAKMLibrary() == 0) { + data_name = "compass_sensor"; + data_fd = openInput("compass_sensor"); + } + + //Incase first time fails + if(data_fd < 0){ + ALOGI("%s: retrying to open compass sensor", LOGTAG); + data_fd = openInput("compass_sensor"); + } + + if(data_fd > 0){ + ALOGI("%s: compass sensor successfully opened: %i", LOGTAG, data_fd); + }else{ + ALOGI("%s: failed to open compass sensor", LOGTAG); + } + + memset(mPendingEvents, 0, sizeof(mPendingEvents)); + + mPendingEvents[MagneticField].version = sizeof(sensors_event_t); + mPendingEvents[MagneticField].sensor = ID_M; + mPendingEvents[MagneticField].type = SENSOR_TYPE_MAGNETIC_FIELD; + mPendingEvents[MagneticField].magnetic.status = SENSOR_STATUS_ACCURACY_HIGH; + + mPendingEvents[Orientation ].version = sizeof(sensors_event_t); + mPendingEvents[Orientation ].sensor = ID_O; + mPendingEvents[Orientation ].type = SENSOR_TYPE_ORIENTATION; + mPendingEvents[Orientation ].orientation.status = SENSOR_STATUS_ACCURACY_HIGH; + + // read the actual value of all sensors if they're enabled already + struct input_absinfo absinfo; + short flags = 0; + if (akm_is_sensor_enabled(SENSOR_TYPE_MAGNETIC_FIELD)) { + mEnabled |= 1<= numSensors) + return -EINVAL; + + int newState = en ? 1 : 0; + int err = 0; + + if ((uint32_t(newState)<= 0) { + char buf[80]; + sprintf(buf, "%lld", ns); + write(fd, buf, strlen(buf)+1); + close(fd); + } + + mDelays[what] = ns; + return 0; +} + +int AkmSensor::loadAKMLibrary() +{ + mLibAKM = dlopen("libakm.so", RTLD_NOW); + + if (!mLibAKM) { + akm_is_sensor_enabled = stub_is_sensor_enabled; + akm_enable_sensor = stub_enable_disable_sensor; + akm_disable_sensor = stub_enable_disable_sensor; + akm_set_delay = stub_set_delay; + ALOGE("%s: unable to load AKM Library, %s", LOGTAG, dlerror()); + return -ENOENT; + } + + *(void **)&akm_is_sensor_enabled = dlsym(mLibAKM, "akm_is_sensor_enabled"); + *(void **)&akm_enable_sensor = dlsym(mLibAKM, "akm_enable_sensor"); + *(void **)&akm_disable_sensor = dlsym(mLibAKM, "akm_disable_sensor"); + *(void **)&akm_set_delay = dlsym(mLibAKM, "akm_set_delay"); + + return 0; +} + +int AkmSensor::readEvents(sensors_event_t* data, int count) +{ + if (count < 1) + return -EINVAL; + + ssize_t n = mInputReader.fill(data_fd); + if (n < 0) + return n; + + int numEventReceived = 0; + input_event const* event; + + while (count && mInputReader.readEvent(&event)) { + int type = event->type; + if (type == EV_REL) { + processEvent(event->code, event->value); + mInputReader.next(); + } else if (type == EV_ABS) { + processEvent(event->code, event->value); + mInputReader.next(); + } else if (type == EV_SYN) { + int64_t time = timevalToNano(event->time); + for (int j=0 ; count && mPendingMask && jcode); + mInputReader.next(); + } + } + return numEventReceived; +} + +void AkmSensor::processEvent(int code, int value) +{ + switch (code) { + case EVENT_TYPE_MAGV_X: + mPendingMask |= 1< +#include +#include +#include + + +#include "sensors.h" +#include "SensorBase.h" +#include "InputEventReader.h" + +/*****************************************************************************/ + +struct input_event; + +class AkmSensor : public SensorBase { +public: + AkmSensor(); + virtual ~AkmSensor(); + + enum { + Accelerometer = 0, + MagneticField = 1, + Orientation = 2, + numSensors + }; + + virtual int setDelay(int32_t handle, int64_t ns); + virtual int enable(int32_t handle, int enabled); + virtual int readEvents(sensors_event_t* data, int count); + void processEvent(int code, int value); + + int setInitialState(); + +private: + int loadAKMLibrary(); + int update_delay(); + void *mLibAKM; + uint32_t mEnabled; + uint32_t mPendingMask; + InputEventCircularReader mInputReader; + sensors_event_t mPendingEvents[numSensors]; + uint64_t mDelays[numSensors]; +}; + +/*****************************************************************************/ + +#endif // ANDROID_AKM_SENSOR_H diff --git a/libsensors/Android.mk b/libsensors/Android.mk new file mode 100644 index 0000000..47a90e5 --- /dev/null +++ b/libsensors/Android.mk @@ -0,0 +1,47 @@ +# Copyright (C) 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. + + +LOCAL_PATH := $(call my-dir) + +ifneq ($(TARGET_SIMULATOR),true) + +# HAL module implemenation, not prelinked, and stored in +# hw/..so +include $(CLEAR_VARS) + +LOCAL_MODULE := sensors.$(TARGET_BOOTLOADER_BOARD_NAME) + +LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw + +LOCAL_MODULE_TAGS := optional + +LOCAL_CFLAGS := -DALOG_TAG=\"Sensors\" +LOCAL_SRC_FILES := \ + sensors.cpp \ + SensorBase.cpp \ + LightSensor.cpp \ + ProximitySensor.cpp \ + AkmSensor.cpp \ + GyroSensor.cpp \ + InputEventReader.cpp \ + AccelSensor.cpp \ + PressureSensor.cpp + +LOCAL_SHARED_LIBRARIES := liblog libcutils libdl +LOCAL_PRELINK_MODULE := false + +include $(BUILD_SHARED_LIBRARY) + +endif # !TARGET_SIMULATOR diff --git a/libsensors/GyroSensor.cpp b/libsensors/GyroSensor.cpp new file mode 100644 index 0000000..d6dc944 --- /dev/null +++ b/libsensors/GyroSensor.cpp @@ -0,0 +1,177 @@ +/* + * Copyright (C) 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. + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "GyroSensor.h" + +#define LOGTAG "GyroSensor" + +#define FETCH_FULL_EVENT_BEFORE_RETURN 1 +#define IGNORE_EVENT_TIME 350000000 +/*****************************************************************************/ + +GyroSensor::GyroSensor() + : SensorBase(NULL, "gyro_sensor"), + mEnabled(0), + mInputReader(4), + mHasPendingEvent(false), + mEnabledTime(0) +{ + mPendingEvent.version = sizeof(sensors_event_t); + mPendingEvent.sensor = ID_GY; + mPendingEvent.type = SENSOR_TYPE_GYROSCOPE; + memset(mPendingEvent.data, 0, sizeof(mPendingEvent.data)); + + if (data_fd) { + strcpy(input_sysfs_path, "/sys/class/input/"); + strcat(input_sysfs_path, input_name); + strcat(input_sysfs_path, "/device/"); + input_sysfs_path_len = strlen(input_sysfs_path); + enable(0, 1); + } +} + +GyroSensor::~GyroSensor() { + if (mEnabled) { + enable(0, 0); + } +} + +int GyroSensor::setInitialState() { + struct input_absinfo absinfo_x; + struct input_absinfo absinfo_y; + struct input_absinfo absinfo_z; + float value; + if (!ioctl(data_fd, EVIOCGABS(EVENT_TYPE_GYRO_X), &absinfo_x) && + !ioctl(data_fd, EVIOCGABS(EVENT_TYPE_GYRO_X), &absinfo_y) && + !ioctl(data_fd, EVIOCGABS(EVENT_TYPE_GYRO_X), &absinfo_z)) { + value = absinfo_x.value; + mPendingEvent.data[0] = value * CONVERT_GYRO_X; + value = absinfo_x.value; + mPendingEvent.data[1] = value * CONVERT_GYRO_Y; + value = absinfo_x.value; + mPendingEvent.data[2] = value * CONVERT_GYRO_Z; + mHasPendingEvent = true; + } + return 0; +} + +int GyroSensor::enable(int32_t handle, int en) { + int flags = en ? 1 : 0; + int err; + if (flags != mEnabled) { + if(err >= 0){ + mEnabled = flags; + err = sspEnable(LOGTAG, SSP_GYRO, en); + setInitialState(); + + return 0; + } + return -1; + } + return 0; +} + +bool GyroSensor::hasPendingEvents() const { + return mHasPendingEvent; +} + +int GyroSensor::setDelay(int32_t handle, int64_t ns) +{ + int fd; + + strcpy(&input_sysfs_path[input_sysfs_path_len], "gyro_poll_delay"); + fd = open(input_sysfs_path, O_RDWR); + if (fd >= 0) { + char buf[80]; + sprintf(buf, "%lld", ns); + write(fd, buf, strlen(buf)+1); + close(fd); + return 0; + } + return -1; +} + +int GyroSensor::readEvents(sensors_event_t* data, int count) +{ + if (count < 1) + return -EINVAL; + + if (mHasPendingEvent) { + mHasPendingEvent = false; + mPendingEvent.timestamp = getTimestamp(); + *data = mPendingEvent; + return mEnabled ? 1 : 0; + } + + ssize_t n = mInputReader.fill(data_fd); + if (n < 0) + return n; + + int numEventReceived = 0; + input_event const* event; + +#if FETCH_FULL_EVENT_BEFORE_RETURN +again: +#endif + while (count && mInputReader.readEvent(&event)) { + int type = event->type; + if (type == EV_REL) { + float value = event->value; + if (event->code == EVENT_TYPE_GYRO_X) { + mPendingEvent.data[0] = value * CONVERT_GYRO_X; + } else if (event->code == EVENT_TYPE_GYRO_Y) { + mPendingEvent.data[1] = value * CONVERT_GYRO_Y; + } else if (event->code == EVENT_TYPE_GYRO_Z) { + mPendingEvent.data[2] = value * CONVERT_GYRO_Z; + } + } else if (type == EV_SYN) { + mPendingEvent.timestamp = timevalToNano(event->time); + if (mEnabled) { + if (mPendingEvent.timestamp >= mEnabledTime) { + *data++ = mPendingEvent; + numEventReceived++; + } + count--; + } + } else { + ALOGE("%s: unknown event (type=%d, code=%d)", LOGTAG, + type, event->code); + } + mInputReader.next(); + } + +#if FETCH_FULL_EVENT_BEFORE_RETURN + /* if we didn't read a complete event, see if we can fill and + try again instead of returning with nothing and redoing poll. */ + if (numEventReceived == 0 && mEnabled == 1) { + n = mInputReader.fill(data_fd); + if (n) + goto again; + } +#endif + + return numEventReceived; +} + diff --git a/libsensors/GyroSensor.h b/libsensors/GyroSensor.h new file mode 100644 index 0000000..e8997de --- /dev/null +++ b/libsensors/GyroSensor.h @@ -0,0 +1,55 @@ +/* + * Copyright (C) 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. + */ + +#ifndef ANDROID_GYRO_SENSOR_H +#define ANDROID_GYRO_SENSOR_H + +#include +#include +#include +#include + +#include "sensors.h" +#include "SensorBase.h" +#include "InputEventReader.h" + +/*****************************************************************************/ + +struct input_event; + +class GyroSensor : public SensorBase { + int mEnabled; + InputEventCircularReader mInputReader; + sensors_event_t mPendingEvent; + bool mHasPendingEvent; + char input_sysfs_path[PATH_MAX]; + int input_sysfs_path_len; + int64_t mEnabledTime; + + int setInitialState(); + +public: + GyroSensor(); + virtual ~GyroSensor(); + virtual int readEvents(sensors_event_t* data, int count); + virtual bool hasPendingEvents() const; + virtual int setDelay(int32_t handle, int64_t ns); + virtual int enable(int32_t handle, int enabled); +}; + +/*****************************************************************************/ + +#endif // ANDROID_GYRO_SENSOR_H diff --git a/libsensors/InputEventReader.cpp b/libsensors/InputEventReader.cpp new file mode 100644 index 0000000..1014f29 --- /dev/null +++ b/libsensors/InputEventReader.cpp @@ -0,0 +1,88 @@ +/* + * Copyright (C) 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. + */ + +#include +#include +#include +#include + +#include +#include + +#include + +#include + +#include "InputEventReader.h" + +/*****************************************************************************/ + +struct input_event; + +InputEventCircularReader::InputEventCircularReader(size_t numEvents) + : mBuffer(new input_event[numEvents * 2]), + mBufferEnd(mBuffer + numEvents), + mHead(mBuffer), + mCurr(mBuffer), + mFreeSpace(numEvents) +{ +} + +InputEventCircularReader::~InputEventCircularReader() +{ + delete [] mBuffer; +} + +ssize_t InputEventCircularReader::fill(int fd) +{ + size_t numEventsRead = 0; + if (mFreeSpace) { + const ssize_t nread = read(fd, mHead, mFreeSpace * sizeof(input_event)); + if (nread<0 || nread % sizeof(input_event)) { + // we got a partial event!! + return nread<0 ? -errno : -EINVAL; + } + + numEventsRead = nread / sizeof(input_event); + if (numEventsRead) { + mHead += numEventsRead; + mFreeSpace -= numEventsRead; + if (mHead > mBufferEnd) { + size_t s = mHead - mBufferEnd; + memcpy(mBuffer, mBufferEnd, s * sizeof(input_event)); + mHead = mBuffer + s; + } + } + } + + return numEventsRead; +} + +ssize_t InputEventCircularReader::readEvent(input_event const** events) +{ + *events = mCurr; + ssize_t available = (mBufferEnd - mBuffer) - mFreeSpace; + return available ? 1 : 0; +} + +void InputEventCircularReader::next() +{ + mCurr++; + mFreeSpace++; + if (mCurr >= mBufferEnd) { + mCurr = mBuffer; + } +} diff --git a/libsensors/InputEventReader.h b/libsensors/InputEventReader.h new file mode 100644 index 0000000..180aade --- /dev/null +++ b/libsensors/InputEventReader.h @@ -0,0 +1,47 @@ +/* + * Copyright (C) 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. + */ + +#ifndef ANDROID_INPUT_EVENT_READER_H +#define ANDROID_INPUT_EVENT_READER_H + +#include +#include +#include +#include + +/*****************************************************************************/ + +struct input_event; + +class InputEventCircularReader +{ + struct input_event* const mBuffer; + struct input_event* const mBufferEnd; + struct input_event* mHead; + struct input_event* mCurr; + ssize_t mFreeSpace; + +public: + InputEventCircularReader(size_t numEvents); + ~InputEventCircularReader(); + ssize_t fill(int fd); + ssize_t readEvent(input_event const** events); + void next(); +}; + +/*****************************************************************************/ + +#endif // ANDROID_INPUT_EVENT_READER_H diff --git a/libsensors/LightSensor.cpp b/libsensors/LightSensor.cpp new file mode 100644 index 0000000..856000b --- /dev/null +++ b/libsensors/LightSensor.cpp @@ -0,0 +1,150 @@ +/* + * Copyright (C) 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. + */ + +#include +#include +#include +#include +#include +#include +#include + +#include + +#include + +#include "LightSensor.h" + +#define LOGTAG "LightSensor" + +// #define ALOG_NDEBUG 0 + +/*****************************************************************************/ + +LightSensor::LightSensor() + : SensorBase(NULL, "light_sensor"), + mEnabled(0), + mInputReader(4), + mHasPendingEvent(false) +{ + mPendingEvent.version = sizeof(sensors_event_t); + mPendingEvent.sensor = ID_L; + mPendingEvent.type = SENSOR_TYPE_LIGHT; + memset(mPendingEvent.data, 0, sizeof(mPendingEvent.data)); + + if (data_fd) { + strcpy(input_sysfs_path, "/sys/class/input/"); + strcat(input_sysfs_path, input_name); + strcat(input_sysfs_path, "/device/"); + input_sysfs_path_len = strlen(input_sysfs_path); + enable(0, 1); + } +} + +LightSensor::~LightSensor() { + if (mEnabled) { + enable(0, 0); + } +} + +int LightSensor::setInitialState() { + struct input_absinfo absinfo; + if (!ioctl(data_fd, EVIOCGABS(EVENT_TYPE_LIGHT), &absinfo)) { + // make sure to report an event immediately + mHasPendingEvent = true; + mPendingEvent.light = absinfo.value; + } + return 0; +} + +int LightSensor::setDelay(int32_t handle, int64_t ns) +{ + int fd; + + strcpy(&input_sysfs_path[input_sysfs_path_len], "light_poll_delay"); + fd = open(input_sysfs_path, O_RDWR); + if (fd >= 0) { + char buf[80]; + sprintf(buf, "%lld", ns); + write(fd, buf, strlen(buf)+1); + close(fd); + return 0; + } + return -1; +} + +int LightSensor::enable(int32_t handle, int en) +{ + int flags = en ? 1 : 0; + int err; + if (flags != mEnabled) { + err = sspEnable(LOGTAG, SSP_LIGHT, en); + if(err >= 0){ + mEnabled = flags; + setInitialState(); + + return 0; + } + return -1; + } + return 0; +} + +bool LightSensor::hasPendingEvents() const { + return mHasPendingEvent; +} + +int LightSensor::readEvents(sensors_event_t* data, int count) +{ + if (count < 1) + return -EINVAL; + + if (mHasPendingEvent) { + mHasPendingEvent = false; + mPendingEvent.timestamp = getTimestamp(); + *data = mPendingEvent; + return mEnabled ? 1 : 0; + } + + ssize_t n = mInputReader.fill(data_fd); + if (n < 0) + return n; + + int numEventReceived = 0; + input_event const* event; + + while (count && mInputReader.readEvent(&event)) { + int type = event->type; + if (type == EV_REL) { + if (event->code == EVENT_TYPE_LIGHT) { + mPendingEvent.light = event->value; + } + } else if (type == EV_SYN) { + mPendingEvent.timestamp = timevalToNano(event->time); + if (mEnabled) { + *data++ = mPendingEvent; + count--; + numEventReceived++; + } + } else { + ALOGE("%s: unknown event (type=%d, code=%d)", LOGTAG, + type, event->code); + } + mInputReader.next(); + } + + return numEventReceived; +} diff --git a/libsensors/LightSensor.h b/libsensors/LightSensor.h new file mode 100644 index 0000000..85e65d9 --- /dev/null +++ b/libsensors/LightSensor.h @@ -0,0 +1,55 @@ +/* + * Copyright (C) 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. + */ + +#ifndef ANDROID_LIGHT_SENSOR_H +#define ANDROID_LIGHT_SENSOR_H + +#include +#include +#include +#include + +#include "sensors.h" +#include "SensorBase.h" +#include "InputEventReader.h" + +/*****************************************************************************/ + +struct input_event; + +class LightSensor : public SensorBase { + int mEnabled; + InputEventCircularReader mInputReader; + sensors_event_t mPendingEvent; + bool mHasPendingEvent; + char input_sysfs_path[PATH_MAX]; + int input_sysfs_path_len; + + float indexToValue(size_t index) const; + int setInitialState(); + +public: + LightSensor(); + virtual ~LightSensor(); + virtual int readEvents(sensors_event_t* data, int count); + virtual bool hasPendingEvents() const; + virtual int setDelay(int32_t handle, int64_t ns); + virtual int enable(int32_t handle, int enabled); +}; + +/*****************************************************************************/ + +#endif // ANDROID_LIGHT_SENSOR_H diff --git a/libsensors/MODULE_LICENSE_APACHE2 b/libsensors/MODULE_LICENSE_APACHE2 new file mode 100644 index 0000000..e69de29 diff --git a/libsensors/PressureSensor.cpp b/libsensors/PressureSensor.cpp new file mode 100644 index 0000000..0ce514f --- /dev/null +++ b/libsensors/PressureSensor.cpp @@ -0,0 +1,152 @@ +/* + * Copyright (C) 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. + */ + +#include +#include +#include +#include +#include +#include +#include + +#include + +#include "PressureSensor.h" + +#define LOGTAG "PressureSensor" + +/* + * The BMP driver gives pascal values. + * It needs to be changed into hectoPascal + */ +#define PRESSURE_HECTO (1.0f/100.0f) + +/*****************************************************************************/ + +PressureSensor::PressureSensor() + : SensorBase(NULL, "pressure_sensor"), + mEnabled(0), + mInputReader(4), + mHasPendingEvent(false) +{ + mPendingEvent.version = sizeof(sensors_event_t); + mPendingEvent.sensor = ID_PR; + mPendingEvent.type = SENSOR_TYPE_PRESSURE; + memset(mPendingEvent.data, 0, sizeof(mPendingEvent.data)); + + if (data_fd) { + strcpy(input_sysfs_path, "/sys/class/input/"); + strcat(input_sysfs_path, input_name); + strcat(input_sysfs_path, "/device/"); + input_sysfs_path_len = strlen(input_sysfs_path); + enable(0, 1); + } +} + +PressureSensor::~PressureSensor() { + if (mEnabled) { + enable(0, 0); + } +} + +int PressureSensor::setInitialState() { + struct input_absinfo absinfo; + if (!ioctl(data_fd, EVIOCGABS(EVENT_TYPE_PRESSURE), &absinfo)) { + // make sure to report an event immediately + mHasPendingEvent = true; + mPendingEvent.pressure = absinfo.value * PRESSURE_HECTO; + } + return 0; +} + +int PressureSensor::enable(int32_t handle, int en) { + int flags = en ? 1 : 0; + int err; + if (flags != mEnabled) { + err = sspEnable(LOGTAG, SSP_PRESS, en); + if(err >= 0){ + mEnabled = flags; + setInitialState(); + + return 0; + } + return -1; + } + return 0; +} + +bool PressureSensor::hasPendingEvents() const { + return mHasPendingEvent; +} + +int PressureSensor::setDelay(int32_t handle, int64_t ns) +{ + int fd; + + strcpy(&input_sysfs_path[input_sysfs_path_len], "pressure_poll_delay"); + fd = open(input_sysfs_path, O_RDWR); + if (fd >= 0) { + char buf[80]; + sprintf(buf, "%lld", ns); + write(fd, buf, strlen(buf)+1); + close(fd); + return 0; + } + return -1; +} + + +int PressureSensor::readEvents(sensors_event_t* data, int count) +{ + if (count < 1) + return -EINVAL; + + if (mHasPendingEvent) { + mHasPendingEvent = false; + mPendingEvent.timestamp = getTimestamp(); + *data = mPendingEvent; + return mEnabled ? 1 : 0; + } + + ssize_t n = mInputReader.fill(data_fd); + if (n < 0) + return n; + + int numEventReceived = 0; + input_event const* event; + + while (count && mInputReader.readEvent(&event)) { + int type = event->type; + if (type == EV_REL) { + if (event->code == EVENT_TYPE_PRESSURE) { + mPendingEvent.pressure = event->value * PRESSURE_HECTO; + } + } else if (type == EV_SYN) { + mPendingEvent.timestamp = timevalToNano(event->time); + if (mEnabled) { + *data++ = mPendingEvent; + count--; + numEventReceived++; + } + } else { + ALOGE("%s: unknown event (type=%d, code=%d)", LOGTAG, + type, event->code); + } + mInputReader.next(); + } + + return numEventReceived; +} diff --git a/libsensors/PressureSensor.h b/libsensors/PressureSensor.h new file mode 100644 index 0000000..9333d44 --- /dev/null +++ b/libsensors/PressureSensor.h @@ -0,0 +1,54 @@ +/* + * Copyright (C) 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. + */ + +#ifndef ANDROID_PRESSURE_SENSOR_H +#define ANDROID_PRESSURE_SENSOR_H + +#include +#include +#include +#include + +#include "sensors.h" +#include "SensorBase.h" +#include "InputEventReader.h" + +/*****************************************************************************/ + +struct input_event; + +class PressureSensor : public SensorBase { + int mEnabled; + InputEventCircularReader mInputReader; + sensors_event_t mPendingEvent; + bool mHasPendingEvent; + char input_sysfs_path[PATH_MAX]; + int input_sysfs_path_len; + + int setInitialState(); + +public: + PressureSensor(); + virtual ~PressureSensor(); + virtual int readEvents(sensors_event_t* data, int count); + virtual bool hasPendingEvents() const; + virtual int enable(int32_t handle, int enabled); + virtual int setDelay(int32_t handle, int64_t ns); +}; + +/*****************************************************************************/ + +#endif // ANDROID_PRESSURE_SENSOR_H diff --git a/libsensors/ProximitySensor.cpp b/libsensors/ProximitySensor.cpp new file mode 100644 index 0000000..404bdbc --- /dev/null +++ b/libsensors/ProximitySensor.cpp @@ -0,0 +1,157 @@ +/* + * Copyright (C) 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. + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include "ProximitySensor.h" +#include "SensorBase.h" + +#define LOGTAG "ProximitySensor" + +/*****************************************************************************/ + +ProximitySensor::ProximitySensor() + : SensorBase(NULL, "proximity_sensor"), + mEnabled(0), + mInputReader(4), + mHasPendingEvent(false) +{ + mPendingEvent.version = sizeof(sensors_event_t); + mPendingEvent.sensor = ID_P; + mPendingEvent.type = SENSOR_TYPE_PROXIMITY; + memset(mPendingEvent.data, 0, sizeof(mPendingEvent.data)); + + if (data_fd) { + strcpy(input_sysfs_path, "/sys/class/input/"); + strcat(input_sysfs_path, input_name); + strcat(input_sysfs_path, "/device/"); + input_sysfs_path_len = strlen(input_sysfs_path); + enable(0, 1); + } +} + +ProximitySensor::~ProximitySensor() { + if (mEnabled) { + enable(0, 0); + } +} + +int ProximitySensor::setInitialState() { + struct input_absinfo absinfo; + if (!ioctl(data_fd, EVIOCGABS(EVENT_TYPE_PROXIMITY), &absinfo)) { + // make sure to report an event immediately + mHasPendingEvent = true; + mPendingEvent.distance = indexToValue(absinfo.value); + } + return 0; +} + +int ProximitySensor::setDelay(int32_t handle, int64_t ns) +{ + int fd; + + strcpy(&input_sysfs_path[input_sysfs_path_len], "prox_poll_delay"); + fd = open(input_sysfs_path, O_RDWR); + if (fd >= 0) { + char buf[80]; + sprintf(buf, "%lld", ns); + write(fd, buf, strlen(buf)+1); + close(fd); + return 0; + } + return -1; +} + +int ProximitySensor::enable(int32_t handle, int en) { + + int flags = en ? 1 : 0; + int err; + if (flags != mEnabled) { + err = sspEnable(LOGTAG, SSP_PROX, en); + if(err >= 0){ + mEnabled = flags; + setInitialState(); + + return 0; + } + return -1; + } + return 0; +} + +bool ProximitySensor::hasPendingEvents() const { + return mHasPendingEvent; +} + +int ProximitySensor::readEvents(sensors_event_t* data, int count) +{ + if (count < 1) + return -EINVAL; + + if (mHasPendingEvent) { + mHasPendingEvent = false; + mPendingEvent.timestamp = getTimestamp(); + *data = mPendingEvent; + return mEnabled ? 1 : 0; + } + + ssize_t n = mInputReader.fill(data_fd); + if (n < 0) + return n; + + int numEventReceived = 0; + input_event const* event; + + while (count && mInputReader.readEvent(&event)) { + int type = event->type; + if (type == EV_ABS) { + if (event->code == EVENT_TYPE_PROXIMITY) { + if (event->value != -1) { + // FIXME: not sure why we're getting -1 sometimes + mPendingEvent.distance = indexToValue(event->value); + } + } + } else if (type == EV_SYN) { + mPendingEvent.timestamp = timevalToNano(event->time); + if (mEnabled) { + *data++ = mPendingEvent; + count--; + numEventReceived++; + } + } else { + ALOGE("%s: unknown event (type=%d, code=%d)",LOGTAG, + type, event->code); + } + mInputReader.next(); + } + + return numEventReceived; +} + +float ProximitySensor::indexToValue(size_t index) const +{ + ALOGV("%s: Index = %zu",LOGTAG, index); + return index * PROXIMITY_THRESHOLD_CM; +} diff --git a/libsensors/ProximitySensor.h b/libsensors/ProximitySensor.h new file mode 100644 index 0000000..a6aa851 --- /dev/null +++ b/libsensors/ProximitySensor.h @@ -0,0 +1,55 @@ +/* + * Copyright (C) 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. + */ + +#ifndef ANDROID_PROXIMITY_SENSOR_H +#define ANDROID_PROXIMITY_SENSOR_H + +#include +#include +#include +#include + +#include "sensors.h" +#include "SensorBase.h" +#include "InputEventReader.h" + +/*****************************************************************************/ + +struct input_event; + +class ProximitySensor : public SensorBase { + int mEnabled; + InputEventCircularReader mInputReader; + sensors_event_t mPendingEvent; + bool mHasPendingEvent; + char input_sysfs_path[PATH_MAX]; + int input_sysfs_path_len; + + int setInitialState(); + float indexToValue(size_t index) const; + +public: + ProximitySensor(); + virtual ~ProximitySensor(); + virtual int readEvents(sensors_event_t* data, int count); + virtual bool hasPendingEvents() const; + virtual int enable(int32_t handle, int enabled); + virtual int setDelay(int32_t handle, int64_t ns); +}; + +/*****************************************************************************/ + +#endif // ANDROID_PROXIMITY_SENSOR_H diff --git a/libsensors/SensorBase.cpp b/libsensors/SensorBase.cpp new file mode 100644 index 0000000..389edd7 --- /dev/null +++ b/libsensors/SensorBase.cpp @@ -0,0 +1,178 @@ +/* + * Copyright (C) 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. + */ + +#include +#include +#include +#include +#include +#include +#include + +#include + +#include + +#include "SensorBase.h" + +/*****************************************************************************/ + +SensorBase::SensorBase( + const char* dev_name, + const char* data_name) + : dev_name(dev_name), data_name(data_name), + dev_fd(-1), data_fd(-1) +{ + if (data_name) { + data_fd = openInput(data_name); + } +} + +SensorBase::~SensorBase() { + if (data_fd >= 0) { + close(data_fd); + } + if (dev_fd >= 0) { + close(dev_fd); + } +} + +int SensorBase::open_device() { + if (dev_fd<0 && dev_name) { + dev_fd = open(dev_name, O_RDONLY); + ALOGE_IF(dev_fd<0, "Couldn't open %s (%s)", dev_name, strerror(errno)); + } + return 0; +} + +int SensorBase::close_device() { + if (dev_fd >= 0) { + close(dev_fd); + dev_fd = -1; + } + return 0; +} + +int SensorBase::getFd() const { + if (!data_name) { + return dev_fd; + } + return data_fd; +} + +int SensorBase::setDelay(int32_t handle, int64_t ns) { + return 0; +} + +bool SensorBase::hasPendingEvents() const { + return false; +} + +int64_t SensorBase::getTimestamp() { + struct timespec t; + t.tv_sec = t.tv_nsec = 0; + clock_gettime(CLOCK_MONOTONIC, &t); + return int64_t(t.tv_sec)*1000000000LL + t.tv_nsec; +} + +int SensorBase::openInput(const char* inputName) { + int fd = -1; + const char *dirname = "/dev/input"; + char devname[PATH_MAX]; + char *filename; + DIR *dir; + struct dirent *de; + dir = opendir(dirname); + if(dir == NULL) + return -1; + strcpy(devname, dirname); + filename = devname + strlen(devname); + *filename++ = '/'; + while((de = readdir(dir))) { + if(de->d_name[0] == '.' && + (de->d_name[1] == '\0' || + (de->d_name[1] == '.' && de->d_name[2] == '\0'))) + continue; + strcpy(filename, de->d_name); + fd = open(devname, O_RDONLY); + if (fd>=0) { + char name[80]; + if (ioctl(fd, EVIOCGNAME(sizeof(name) - 1), &name) < 1) { + name[0] = '\0'; + } + if (!strcmp(name, inputName)) { + strcpy(input_name, filename); + break; + } else { + close(fd); + fd = -1; + } + } + } + closedir(dir); + ALOGE_IF(fd<0, "couldn't find '%s' input device", inputName); + + return fd; +} + +int SensorBase::batch(int handle, int flags, int64_t period_ns, int64_t timeout) +{ + return 0; +} + +int SensorBase::flush(int handle) +{ + return 0; +} + +int SensorBase::sspEnable(const char* sensorname, int sensorvalue, int en) +{ + FILE* sspfile; + int oldvalue = 0; + int reset = 0; + int newvalue; + int fd, err; + char buf[10]; + + sspfile = fopen(SSP_DEVICE_ENABLE, "r+"); + fscanf(sspfile, "%d", &oldvalue); + fclose(sspfile); + +//Accel sensor is first on and last off, if we are disabling it +// assume the screen is off and zero everything out. + if(sensorvalue == SSP_ACCEL && !en) { + newvalue = '\0'; + //ALOGD("SensorBase: Resetting sensors"); + } else if(en) { + newvalue = oldvalue + sensorvalue; + } else { + newvalue = oldvalue - sensorvalue; + } + + sprintf(buf, "%d", newvalue); + + fd = open(SSP_DEVICE_ENABLE, O_RDWR); + if (fd >= 0) { + err = write(fd, buf, sizeof(buf)); + //ALOGI("%s: sensor: %i old value: %i new value: %i ", sensorname, sensorvalue, oldvalue, newvalue); + close(fd); + return 0; + } else { + ALOGI("%s: error writing to file", sensorname); + close(fd); + return -1; + } +} diff --git a/libsensors/SensorBase.h b/libsensors/SensorBase.h new file mode 100644 index 0000000..d9e4b47 --- /dev/null +++ b/libsensors/SensorBase.h @@ -0,0 +1,71 @@ +/* + * Copyright (C) 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. + */ + +#ifndef ANDROID_SENSOR_BASE_H +#define ANDROID_SENSOR_BASE_H + +#include +#include +#include +#include + +#include "sensors.h" + + +/*****************************************************************************/ + +struct sensors_event_t; + +class SensorBase { +protected: + const char* dev_name; + const char* data_name; + char input_name[PATH_MAX]; + int dev_fd; + int data_fd; + + int openInput(const char* inputName); + static int64_t getTimestamp(); + + + static int64_t timevalToNano(timeval const& t) { + return t.tv_sec*1000000000LL + t.tv_usec*1000; + } + + int open_device(); + int close_device(); + +public: + SensorBase( + const char* dev_name, + const char* data_name); + + virtual ~SensorBase(); + + virtual int readEvents(sensors_event_t* data, int count) = 0; + virtual bool hasPendingEvents() const; + virtual int getFd() const; + virtual int setDelay(int32_t handle, int64_t ns); + virtual int enable(int32_t handle, int enabled) = 0; + int sspEnable(const char* sensorname, int sensorvalue, int en); + virtual int batch(int handle, int flags, int64_t period_ns, int64_t timeout); + virtual int flush(int handle); + +}; + +/*****************************************************************************/ + +#endif // ANDROID_SENSOR_BASE_H diff --git a/libsensors/sensors.cpp b/libsensors/sensors.cpp new file mode 100644 index 0000000..193c932 --- /dev/null +++ b/libsensors/sensors.cpp @@ -0,0 +1,397 @@ +/* + * Copyright (C) 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. + */ + +#define ALOG_TAG "Sensors" + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include + +#include "sensors.h" + +#include "LightSensor.h" +#include "ProximitySensor.h" +#include "AkmSensor.h" +#include "GyroSensor.h" +#include "AccelSensor.h" +#include "PressureSensor.h" + +/*****************************************************************************/ + +#define DELAY_OUT_TIME 0x7FFFFFFF + +#define LIGHT_SENSOR_POLLTIME 2000000000 + + +#define SENSORS_ACCELERATION (1<getFd(); + mPollFds[light].events = POLLIN; + mPollFds[light].revents = 0; + + mSensors[proximity] = new ProximitySensor(); + mPollFds[proximity].fd = mSensors[proximity]->getFd(); + mPollFds[proximity].events = POLLIN; + mPollFds[proximity].revents = 0; + + mSensors[akm] = new AkmSensor(); + mPollFds[akm].fd = mSensors[akm]->getFd(); + mPollFds[akm].events = POLLIN; + mPollFds[akm].revents = 0; + + mSensors[gyro] = new GyroSensor(); + mPollFds[gyro].fd = mSensors[gyro]->getFd(); + mPollFds[gyro].events = POLLIN; + mPollFds[gyro].revents = 0; + + mSensors[accel] = new AccelSensor(); + mPollFds[accel].fd = mSensors[accel]->getFd(); + mPollFds[accel].events = POLLIN; + mPollFds[accel].revents = 0; + + mSensors[pressure] = new PressureSensor(); + mPollFds[pressure].fd = mSensors[pressure]->getFd(); + mPollFds[pressure].events = POLLIN; + mPollFds[pressure].revents = 0; + + int wakeFds[2]; + int result = pipe(wakeFds); + ALOGE_IF(result<0, "error creating wake pipe (%s)", strerror(errno)); + fcntl(wakeFds[0], F_SETFL, O_NONBLOCK); + fcntl(wakeFds[1], F_SETFL, O_NONBLOCK); + mWritePipeFd = wakeFds[1]; + + mPollFds[wake].fd = wakeFds[0]; + mPollFds[wake].events = POLLIN; + mPollFds[wake].revents = 0; + mInitialized = true; +} + +sensors_poll_context_t::~sensors_poll_context_t() { + for (int i=0 ; ienable(handle, enabled); + if (enabled && !err) { + const char wakeMessage(WAKE_MESSAGE); + int result = write(mWritePipeFd, &wakeMessage, 1); + ALOGE_IF(result<0, "error sending wake message (%s)", strerror(errno)); + } + return err; +} + +int sensors_poll_context_t::setDelay(int handle, int64_t ns) { + + int index = handleToDriver(handle); + if (index < 0) return index; + return mSensors[index]->setDelay(handle, ns); +} + +int sensors_poll_context_t::pollEvents(sensors_event_t* data, int count) +{ + int nbEvents = 0; + int n = 0; + + do { + // see if we have some leftover from the last poll() + for (int i=0 ; count && ihasPendingEvents())) { + int nb = sensor->readEvents(data, count); + if (nb < count) { + // no more data for this sensor + mPollFds[i].revents = 0; + } + count -= nb; + nbEvents += nb; + data += nb; + } + } + + if (count) { + // we still have some room, so try to see if we can get + // some events immediately or just wait if we don't have + // anything to return + n = poll(mPollFds, numFds, nbEvents ? 0 : -1); + if (n<0) { + ALOGE("poll() failed (%s)", strerror(errno)); + return -errno; + } + if (mPollFds[wake].revents & POLLIN) { + char msg; + int result = read(mPollFds[wake].fd, &msg, 1); + ALOGE_IF(result<0, "error reading from wake pipe (%s)", strerror(errno)); + ALOGE_IF(msg != WAKE_MESSAGE, "unknown message on wake queue (0x%02x)", int(msg)); + mPollFds[wake].revents = 0; + } + } + // if we have events and space, go read them + } while (n && count); + + return nbEvents; +} + +int sensors_poll_context_t::batch(int handle, int flags, int64_t period_ns, int64_t timeout) +{ + int index = handleToDriver(handle); + if (index < 0) return index; + return mSensors[index]->batch(handle, flags, period_ns, timeout); +} + +int sensors_poll_context_t::flush(int handle) +{ + int index = handleToDriver(handle); + if (index < 0) return index; + return mSensors[index]->flush(handle); +} + +/*****************************************************************************/ + +static int poll__close(struct hw_device_t *dev) +{ + sensors_poll_context_t *ctx = (sensors_poll_context_t *)dev; + if (ctx) { + delete ctx; + } + return 0; +} + +static int poll__activate(struct sensors_poll_device_t *dev, + int handle, int enabled) { + sensors_poll_context_t *ctx = (sensors_poll_context_t *)dev; + return ctx->activate(handle, enabled); +} + +static int poll__setDelay(struct sensors_poll_device_t *dev, + int handle, int64_t ns) { + sensors_poll_context_t *ctx = (sensors_poll_context_t *)dev; + return ctx->setDelay(handle, ns); +} + +static int poll__poll(struct sensors_poll_device_t *dev, + sensors_event_t* data, int count) { + sensors_poll_context_t *ctx = (sensors_poll_context_t *)dev; + return ctx->pollEvents(data, count); +} + +static int poll__batch(struct sensors_poll_device_1 *dev, + int handle, int flags, int64_t period_ns, int64_t timeout) +{ + sensors_poll_context_t *ctx = (sensors_poll_context_t *)dev; + return ctx->batch(handle, flags, period_ns, timeout); +} + +static int poll__flush(struct sensors_poll_device_1 *dev, + int handle) +{ + sensors_poll_context_t *ctx = (sensors_poll_context_t *)dev; + return ctx->flush(handle); +} + +/*****************************************************************************/ + +/** Open a new instance of a sensor device using name */ +static int open_sensors(const struct hw_module_t* module, const char* id, + struct hw_device_t** device) +{ + int status = -EINVAL; + sensors_poll_context_t *dev = new sensors_poll_context_t(); + + memset(&dev->device, 0, sizeof(sensors_poll_device_1)); + + dev->device.common.tag = HARDWARE_DEVICE_TAG; + dev->device.common.version = SENSORS_DEVICE_API_VERSION_1_0; + dev->device.common.module = const_cast(module); + dev->device.common.close = poll__close; + dev->device.activate = poll__activate; + dev->device.setDelay = poll__setDelay; + dev->device.poll = poll__poll; + + /* Batch processing */ + dev->device.batch = poll__batch; + dev->device.flush = poll__flush; + + *device = &dev->device.common; + status = 0; + + return status; +} + diff --git a/libsensors/sensors.h b/libsensors/sensors.h new file mode 100644 index 0000000..a4fe794 --- /dev/null +++ b/libsensors/sensors.h @@ -0,0 +1,131 @@ +/* + * Copyright (C) 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. + */ + +#ifndef ANDROID_SENSORS_H +#define ANDROID_SENSORS_H + +#include +#include +#include +#include + +#include + +#include +#include + +__BEGIN_DECLS + +/*****************************************************************************/ + +#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0])) + +#define ID_A (0) +#define ID_M (1) +#define ID_O (2) +#define ID_L (3) +#define ID_P (4) +#define ID_GY (5) +#define ID_PR (6) +#define ID_LA (7) +#define ID_GR (8) + +#define SSP_ACCEL (1) +#define SSP_GYRO (2) +#define SSP_MAG (4) +#define SSP_PRESS (8) +#define SSP_PROX (32) +#define SSP_LIGHT (64) + +#define SSP_DEVICE_ENABLE "/sys/class/sensors/ssp_sensor/enable" + +/*****************************************************************************/ + +/* + * The SENSORS Module + */ + +/* the CM3663 is a binary proximity sensor that triggers around 6 cm on + * this hardware */ +#define PROXIMITY_THRESHOLD_CM 8.0f + +/*****************************************************************************/ + +#define EVENT_TYPE_ACCEL_X REL_X //1 +#define EVENT_TYPE_ACCEL_Y REL_Y //0 +#define EVENT_TYPE_ACCEL_Z REL_Z //2 +//#define EVENT_TYPE_ACCEL_STATUS ABS_WHEEL //8 + +#define EVENT_TYPE_GRAVITY_X ABS_X //1 +#define EVENT_TYPE_GRAVITY_Y ABS_Y //0 +#define EVENT_TYPE_GRAVITY_Z ABS_Z //2 + +#define EVENT_TYPE_YAW ABS_RX //3 +#define EVENT_TYPE_PITCH ABS_RY //4 +#define EVENT_TYPE_ROLL ABS_RZ //5 +#define EVENT_TYPE_ORIENT_STATUS ABS_WHEEL //8 + +#define EVENT_TYPE_MAGV_X ABS_RX // 3 +#define EVENT_TYPE_MAGV_Y ABS_RY // 4 +#define EVENT_TYPE_MAGV_Z ABS_RZ // 5 + +#define EVENT_TYPE_TEMPERATURE ABS_THROTTLE +#define EVENT_TYPE_STEP_COUNT ABS_GAS +#define EVENT_TYPE_PROXIMITY ABS_DISTANCE +#define EVENT_TYPE_LIGHT REL_HWHEEL + +#define EVENT_TYPE_GYRO_X REL_RX +#define EVENT_TYPE_GYRO_Y REL_RY +#define EVENT_TYPE_GYRO_Z REL_RZ + +#define EVENT_TYPE_PRESSURE REL_HWHEEL + +#define LSG (1000.0f) + +// conversion of acceleration data to SI units (m/s^2) +#define RANGE_A (2*GRAVITY_EARTH) +#define RESOLUTION_A (GRAVITY_EARTH / LSG) +#define CONVERT_A (GRAVITY_EARTH / LSG) +#define CONVERT_A_X (CONVERT_A) +#define CONVERT_A_Y (CONVERT_A) +#define CONVERT_A_Z (CONVERT_A) + +// conversion of magnetic data to uT units +#define CONVERT_M (1.0f/16.0f) +#define CONVERT_M_X (-CONVERT_M) +#define CONVERT_M_Y (CONVERT_M) +#define CONVERT_M_Z (CONVERT_M) + +/* conversion of orientation data to degree units */ +#define CONVERT_O (1.0f/1000.0f) +#define CONVERT_O_A (CONVERT_O) +#define CONVERT_O_P (CONVERT_O) +#define CONVERT_O_R (CONVERT_O) + +// conversion of gyro data to SI units (radian/sec) +#define RANGE_GYRO (500.0f*(float)M_PI/180.0f) +#define CONVERT_GYRO ((70.0f / 4000.0f) * ((float)M_PI / 180.0f)) +#define CONVERT_GYRO_X (-CONVERT_GYRO) +#define CONVERT_GYRO_Y (-CONVERT_GYRO) +#define CONVERT_GYRO_Z (-CONVERT_GYRO) + +#define SENSOR_STATE_MASK (0x7FFF) + +/*****************************************************************************/ + +__END_DECLS + +#endif // ANDROID_SENSORS_H diff --git a/n7100.mk b/n7100.mk index 5541155..1633017 100644 --- a/n7100.mk +++ b/n7100.mk @@ -62,6 +62,10 @@ PRODUCT_PACKAGES += \ libcyanogen-dsp \ audio_effects.conf +# Sensors +PRODUCT_PACKAGES += \ + sensors.smdk4x12 + # NFC PRODUCT_PACKAGES += \ nfc.exynos4 \ diff --git a/proprietary-files.txt b/proprietary-files.txt index 8627379..9fa7cab 100644 --- a/proprietary-files.txt +++ b/proprietary-files.txt @@ -1,13 +1,7 @@ system/bin/gpsd -system/bin/sensorservice -system/bin/sensorhubservice system/lib/hw/gps.exynos4.so -system/lib/hw/sensors.smdk4x12.so -system/lib/hw/sensorhubs.smdk4x12.so system/lib/libakm.so system/lib/libsec-ril.so -system/lib/libsensorservice.so -system/lib/libsensorhubservice.so system/usr/idc/sec_e-pen.idc system/usr/keylayout/sec_e-pen.kl system/usr/keylayout/sec_touchkey.kl -- cgit v1.1 From 5de1b444220eb52c2b11364123226e35fe612c7b Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Wed, 8 Jan 2014 00:48:26 +0530 Subject: n7100: enable ZSL mode --- .../packages/apps/Camera2/res/values/config.xml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 overlay/packages/apps/Camera2/res/values/config.xml diff --git a/overlay/packages/apps/Camera2/res/values/config.xml b/overlay/packages/apps/Camera2/res/values/config.xml new file mode 100644 index 0000000..b98eb58 --- /dev/null +++ b/overlay/packages/apps/Camera2/res/values/config.xml @@ -0,0 +1,22 @@ + + + + + + + true + -- cgit v1.1 From 02ae88a246a7375db01fe858407b8fb526edbce4 Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Tue, 21 Jan 2014 22:10:30 +0530 Subject: LN: Enable dynamic width on n7100 --- .../frameworks/base/Keyguard/res/values/config.xml | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 overlay/frameworks/base/Keyguard/res/values/config.xml diff --git a/overlay/frameworks/base/Keyguard/res/values/config.xml b/overlay/frameworks/base/Keyguard/res/values/config.xml new file mode 100644 index 0000000..d4c3d38 --- /dev/null +++ b/overlay/frameworks/base/Keyguard/res/values/config.xml @@ -0,0 +1,25 @@ + + + + + + + true + + -- cgit v1.1 From 14abba96df7e5395e840818bf1d72473cecd807d Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Mon, 27 Jan 2014 20:43:33 +0530 Subject: [N7100]-Added Lightbulb overlays and removed Torch overlays --- .../base/core/res/res/values/pa_config.xml | 23 ++++++++++++++ .../packages/apps/Lightbulb/res/values/config.xml | 21 +++++++++++++ overlay/packages/apps/Torch/res/values/config.xml | 36 ---------------------- 3 files changed, 44 insertions(+), 36 deletions(-) create mode 100644 overlay/frameworks/base/core/res/res/values/pa_config.xml create mode 100644 overlay/packages/apps/Lightbulb/res/values/config.xml delete mode 100644 overlay/packages/apps/Torch/res/values/config.xml diff --git a/overlay/frameworks/base/core/res/res/values/pa_config.xml b/overlay/frameworks/base/core/res/res/values/pa_config.xml new file mode 100644 index 0000000..13f9a31 --- /dev/null +++ b/overlay/frameworks/base/core/res/res/values/pa_config.xml @@ -0,0 +1,23 @@ + + + + + + true + diff --git a/overlay/packages/apps/Lightbulb/res/values/config.xml b/overlay/packages/apps/Lightbulb/res/values/config.xml new file mode 100644 index 0000000..1315b79 --- /dev/null +++ b/overlay/packages/apps/Lightbulb/res/values/config.xml @@ -0,0 +1,21 @@ + + + + + true + diff --git a/overlay/packages/apps/Torch/res/values/config.xml b/overlay/packages/apps/Torch/res/values/config.xml deleted file mode 100644 index d4611e2..0000000 --- a/overlay/packages/apps/Torch/res/values/config.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - false - - - /sys/class/camera/flash/rear_flash - - - 1 - - 10 - - 15 - - -- cgit v1.1 From 85ca93940a3c306499e493a79ef378410c2482dc Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Mon, 3 Feb 2014 10:33:18 +0530 Subject: enable implement noise suppression for phone calls overlay --- overlay/packages/services/Telephony/res/values/config.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/overlay/packages/services/Telephony/res/values/config.xml b/overlay/packages/services/Telephony/res/values/config.xml index ecf2927..5ebd245 100644 --- a/overlay/packages/services/Telephony/res/values/config.xml +++ b/overlay/packages/services/Telephony/res/values/config.xml @@ -20,6 +20,6 @@ true - + + noise_suppression=true=false -- cgit v1.1 From 4f81dd03ebfec482050ee1c46eb4b0d026570bd0 Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Mon, 3 Feb 2014 20:24:55 +0530 Subject: added menu unlock overlay into keyguard --- overlay/frameworks/base/Keyguard/res/values/config.xml | 3 +++ overlay/frameworks/base/core/res/res/values/config.xml | 3 --- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/overlay/frameworks/base/Keyguard/res/values/config.xml b/overlay/frameworks/base/Keyguard/res/values/config.xml index d4c3d38..cf956e1 100644 --- a/overlay/frameworks/base/Keyguard/res/values/config.xml +++ b/overlay/frameworks/base/Keyguard/res/values/config.xml @@ -22,4 +22,7 @@ true + + true + diff --git a/overlay/frameworks/base/core/res/res/values/config.xml b/overlay/frameworks/base/core/res/res/values/config.xml index 9e7ea06..559b68e 100644 --- a/overlay/frameworks/base/core/res/res/values/config.xml +++ b/overlay/frameworks/base/core/res/res/values/config.xml @@ -91,9 +91,6 @@ 9000 - - true - -- cgit v1.1 From 77ae8c09d5dc50fe3cd0ebcaff210d497fef9112 Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Fri, 7 Feb 2014 12:14:46 +0530 Subject: changes to pa.dependencies --- pa.dependencies | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/pa.dependencies b/pa.dependencies index 933f757..db3ff82 100644 --- a/pa.dependencies +++ b/pa.dependencies @@ -4,12 +4,15 @@ "target_path": "device/samsung/n7100" }, { - "repository": "android_device_samsung_smdk4412-common", - "target_path": "device/samsung/smdk4412-common" + "remote": "github", + "repository": "tilaksidduram/android_device_samsung_smdk4412-common", + "target_path": "device/samsung/smdk4412-common", + "revision": "kitkat" }, { - "repository": "android_kernel_samsung_smdk4412", - "target_path": "kernel/samsung/smdk4412" + "repository": "omnirom/android_kernel_samsung_smdk4412", + "target_path": "kernel/samsung/smdk4412", + "revision": "android-4.4" }, { "remote": "cm", -- cgit v1.1 From a1676c728b0d479541bc48c80fe864c8eb673ec6 Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Sun, 23 Feb 2014 15:26:12 +0530 Subject: N7100 specific LCD densities --- .../apps/Settings/res/values/pa_arrays.xml | 32 ++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 overlay/packages/apps/Settings/res/values/pa_arrays.xml diff --git a/overlay/packages/apps/Settings/res/values/pa_arrays.xml b/overlay/packages/apps/Settings/res/values/pa_arrays.xml new file mode 100644 index 0000000..d4706da --- /dev/null +++ b/overlay/packages/apps/Settings/res/values/pa_arrays.xml @@ -0,0 +1,32 @@ + + + + + + 160 + 180 + 200 + 213 + 220 + 240 + 280 + 300 + 320 + + + -- cgit v1.1 From af060f3fbcea8dca2f2ef49a52759dec773bfa01 Mon Sep 17 00:00:00 2001 From: UtkarshGupta Date: Tue, 18 Feb 2014 16:13:29 +0530 Subject: n7100: audio: hal update Brought in audio hal from i9300 Change-Id: Ib91a8b9bd41e7cdb83c14ca8de7f35e935337176 --- audio/audio_hw.c | 32 +++++++++++++++++++++++--------- audio/audio_hw.h | 4 ++-- configs/tiny_hw.xml | 14 +++++++++++++- 3 files changed, 38 insertions(+), 12 deletions(-) diff --git a/audio/audio_hw.c b/audio/audio_hw.c index a890b63..50b0014 100755 --- a/audio/audio_hw.c +++ b/audio/audio_hw.c @@ -314,7 +314,6 @@ static int set_route_by_array(struct mixer *mixer, struct route_setting *route, void select_devices(struct m0_audio_device *adev) { int i; - if (adev->active_out_device == adev->out_device && adev->active_in_device == adev->in_device) return; @@ -324,26 +323,30 @@ void select_devices(struct m0_audio_device *adev) /* Turn on new devices first so we don't glitch due to powerdown... */ for (i = 0; i < adev->num_dev_cfgs; i++) if ((adev->out_device & adev->dev_cfgs[i].mask) && - !(adev->active_out_device & adev->dev_cfgs[i].mask)) + !(adev->active_out_device & adev->dev_cfgs[i].mask) && + !(adev->dev_cfgs[i].mask & AUDIO_DEVICE_BIT_IN)) set_route_by_array(adev->mixer, adev->dev_cfgs[i].on, adev->dev_cfgs[i].on_len); for (i = 0; i < adev->num_dev_cfgs; i++) if ((adev->in_device & adev->dev_cfgs[i].mask) && - !(adev->active_in_device & adev->dev_cfgs[i].mask)) + !(adev->active_in_device & adev->dev_cfgs[i].mask) && + (adev->dev_cfgs[i].mask & AUDIO_DEVICE_BIT_IN)) set_route_by_array(adev->mixer, adev->dev_cfgs[i].on, adev->dev_cfgs[i].on_len); /* ...then disable old ones. */ for (i = 0; i < adev->num_dev_cfgs; i++) if (!(adev->out_device & adev->dev_cfgs[i].mask) && - (adev->active_out_device & adev->dev_cfgs[i].mask)) + (adev->active_out_device & adev->dev_cfgs[i].mask) && + !(adev->dev_cfgs[i].mask & AUDIO_DEVICE_BIT_IN)) set_route_by_array(adev->mixer, adev->dev_cfgs[i].off, adev->dev_cfgs[i].off_len); for (i = 0; i < adev->num_dev_cfgs; i++) if (!(adev->in_device & adev->dev_cfgs[i].mask) && - (adev->active_in_device & adev->dev_cfgs[i].mask)) + (adev->active_in_device & adev->dev_cfgs[i].mask) && + (adev->dev_cfgs[i].mask & AUDIO_DEVICE_BIT_IN)) set_route_by_array(adev->mixer, adev->dev_cfgs[i].off, adev->dev_cfgs[i].off_len); @@ -493,8 +496,9 @@ static void set_incall_device(struct m0_audio_device *adev) device_type = SOUND_AUDIO_PATH_HANDSET; break; case AUDIO_DEVICE_OUT_SPEAKER: - case AUDIO_DEVICE_OUT_AUX_DIGITAL: + case AUDIO_DEVICE_OUT_ANLG_DOCK_HEADSET: case AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET: + case AUDIO_DEVICE_OUT_AUX_DIGITAL: device_type = SOUND_AUDIO_PATH_SPEAKER; break; case AUDIO_DEVICE_OUT_WIRED_HEADSET: @@ -644,6 +648,12 @@ static void select_output_device(struct m0_audio_device *adev) case AUDIO_DEVICE_OUT_ALL_SCO: ALOGD("%s: AUDIO_DEVICE_OUT_ALL_SCO", __func__); break; + case AUDIO_DEVICE_OUT_USB_ACCESSORY: + ALOGD("%s: AUDIO_DEVICE_OUT_USB_ACCESSORY", __func__); + break; + case AUDIO_DEVICE_OUT_USB_DEVICE: + ALOGD("%s: AUDIO_DEVICE_OUT_USB_DEVICE", __func__); + break; default: ALOGD("%s: AUDIO_DEVICE_OUT_ALL", __func__); break; @@ -721,12 +731,16 @@ static void select_output_device(struct m0_audio_device *adev) static void select_input_device(struct m0_audio_device *adev) { - switch(adev->in_device) { + int input_device = AUDIO_DEVICE_BIT_IN | adev->in_device; + + switch(input_device) { case AUDIO_DEVICE_IN_BUILTIN_MIC: ALOGD("%s: AUDIO_DEVICE_IN_BUILTIN_MIC", __func__); break; case AUDIO_DEVICE_IN_BACK_MIC: - ALOGD("%s: AUDIO_DEVICE_IN_BACK_MIC", __func__); + ALOGD("%s: AUDIO_DEVICE_IN_BACK_MIC | AUDIO_DEVICE_IN_BUILTIN_MIC", __func__); + // Force use both mics for video recording + adev->in_device = (AUDIO_DEVICE_IN_BACK_MIC | AUDIO_DEVICE_IN_BUILTIN_MIC) & ~AUDIO_DEVICE_BIT_IN; break; case AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET: ALOGD("%s: AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET", __func__); @@ -2412,7 +2426,6 @@ static int in_remove_audio_effect(const struct audio_stream *stream, in->preprocessors[in->num_preprocessors].effect_itfe = NULL; in->preprocessors[in->num_preprocessors].channel_configs = NULL; - /* check compatibility between main channel supported and possible auxiliary channels */ in_update_aux_channels(in, NULL); @@ -2820,6 +2833,7 @@ static const struct { { AUDIO_DEVICE_OUT_ANLG_DOCK_HEADSET, "analog-dock" }, { AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET, "digital-dock" }, { AUDIO_DEVICE_OUT_ALL_SCO, "sco-out" }, + { AUDIO_DEVICE_OUT_AUX_DIGITAL, "aux-digital" }, { AUDIO_DEVICE_IN_BUILTIN_MIC, "builtin-mic" }, { AUDIO_DEVICE_IN_BACK_MIC, "back-mic" }, diff --git a/audio/audio_hw.h b/audio/audio_hw.h index 3c28d5a..d7d68d9 100644 --- a/audio/audio_hw.h +++ b/audio/audio_hw.h @@ -175,9 +175,9 @@ struct route_setting noise_suppression_disable[] = { struct route_setting headset_input[] = { { .ctl_name = "MIXINL IN2L Switch", .intval = 0, }, - { .ctl_name = "MIXINR IN1R Switch", .intval = 0, }, + { .ctl_name = "MIXINR IN1R Switch", .intval = 0, }, { .ctl_name = "Headset Mic Switch", .intval = 1, }, - { .ctl_name = "IN1L Volume", .intval = 18, }, + { .ctl_name = "IN1L Volume", .intval = 28, }, { .ctl_name = "MIXINL IN1L Switch", .intval = 1, }, { .ctl_name = "MIXINL IN1L Volume", .intval = 0, }, { .ctl_name = "AIF1ADC1 HPF Mode", .intval = 1, }, diff --git a/configs/tiny_hw.xml b/configs/tiny_hw.xml index c50a139..bbdf2ec 100644 --- a/configs/tiny_hw.xml +++ b/configs/tiny_hw.xml @@ -157,7 +157,7 @@ We are able to have most of our routing static so do that - + @@ -269,6 +269,18 @@ We are able to have most of our routing static so do that + + + + + + + + + + + + -- cgit v1.1 From 8473162168f68028e412e2f6223aec4034a3ed67 Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Tue, 11 Mar 2014 09:34:28 +0530 Subject: pa.dependencies - changed kernel source --- pa.dependencies | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pa.dependencies b/pa.dependencies index db3ff82..b1461b0 100644 --- a/pa.dependencies +++ b/pa.dependencies @@ -10,9 +10,8 @@ "revision": "kitkat" }, { - "repository": "omnirom/android_kernel_samsung_smdk4412", - "target_path": "kernel/samsung/smdk4412", - "revision": "android-4.4" + "repository": "android_kernel_samsung_smdk4412", + "target_path": "kernel/samsung/smdk4412" }, { "remote": "cm", -- cgit v1.1 From 3e5fcd69f24368230865767623c7b6341091e7aa Mon Sep 17 00:00:00 2001 From: UtkarshGupta Date: Thu, 6 Mar 2014 22:17:54 +0530 Subject: n7100: update power_profile Change-Id: Iee84415c349a05fa30c404ac17415a179d3bfca6 --- .../base/core/res/res/xml/power_profile.xml | 86 ++++++++++------------ 1 file changed, 38 insertions(+), 48 deletions(-) diff --git a/overlay/frameworks/base/core/res/res/xml/power_profile.xml b/overlay/frameworks/base/core/res/res/xml/power_profile.xml index 3501baa..0cc7953 100644 --- a/overlay/frameworks/base/core/res/res/xml/power_profile.xml +++ b/overlay/frameworks/base/core/res/res/xml/power_profile.xml @@ -18,52 +18,42 @@ --> - - 0 - 71 - 17 - 0.3 - 35690 - 380 - 0.3 - 96 - 70 - 44 - 280 - 250 - - 82 - 50 - - - 3.4 - 3.4 - - - - 200000 - 500000 - 800000 - 1000000 - 1200000 - 1400000 - 1600000 - - - 4 - - 44 - - - 55.4 - 82.1 - 113.7 - 140.0 - 170.0 - 200.0 - 230.0 - - - 3100 + + 0 + 172 + 17 + 0.3 + 155 + 0.3 + 96 + 70 + 50 + 270 + 250 + 82 + 1 + + 3.4 + 3.4 + + + 1600000 + 1400000 + 1200000 + 1000000 + 800000 + 400000 + 200000 + + 2.0 + + 770 + 582 + 440 + 345 + 260 + 170 + 125 + + 3100 -- cgit v1.1 From d70bf47d8a3fbac42a70832bf920af23387b56c7 Mon Sep 17 00:00:00 2001 From: UtkarshGupta Date: Sat, 1 Mar 2014 14:12:44 +0530 Subject: n7100: audio: update hal Change-Id: I67d8822b68096445dd96ed8f80d21322c778daf2 Conflicts: audio/audio_hw.c --- audio/audio_hw.c | 66 +++++++++++++++++---------------------- audio/audio_hw.h | 8 +++-- configs/tiny_hw.xml | 89 ++++++++++++++++++++--------------------------------- 3 files changed, 66 insertions(+), 97 deletions(-) mode change 100755 => 100644 audio/audio_hw.c diff --git a/audio/audio_hw.c b/audio/audio_hw.c old mode 100755 new mode 100644 index 50b0014..55044f0 --- a/audio/audio_hw.c +++ b/audio/audio_hw.c @@ -73,7 +73,7 @@ struct pcm_config pcm_config_capture = { struct pcm_config pcm_config_vx = { .channels = 2, - .rate = VX_NB_SAMPLING_RATE, + .rate = VX_WB_SAMPLING_RATE, .period_size = 160, .period_count = 2, .format = PCM_FORMAT_S16_LE, @@ -209,7 +209,7 @@ static void in_update_aux_channels(struct m0_stream_in *in, effect_handle_t effe /* The enable flag when 0 makes the assumption that enums are disabled by * "Off" and integers/booleans by 0 */ -static int set_voicecall_route_by_array(struct mixer *mixer, struct route_setting *route, +static int set_bigroute_by_array(struct mixer *mixer, struct route_setting *route, int enable) { struct mixer_ctl *ctl; @@ -360,7 +360,13 @@ static int start_call(struct m0_audio_device *adev) int bt_on; bt_on = adev->out_device & AUDIO_DEVICE_OUT_ALL_SCO; - pcm_config_vx.rate = adev->wb_amr ? VX_WB_SAMPLING_RATE : VX_NB_SAMPLING_RATE; + + if (bt_on) { + /* use amr-nb for bluetooth */ + pcm_config_vx.rate = VX_NB_SAMPLING_RATE; + } else { + pcm_config_vx.rate = adev->wb_amr ? VX_WB_SAMPLING_RATE : VX_NB_SAMPLING_RATE; + } /* Open modem PCM channels */ if (adev->pcm_modem_dl == NULL) { @@ -592,19 +598,7 @@ static void select_mode(struct m0_audio_device *adev) adev->in_call = 0; end_call(adev); force_all_standby(adev); - - ALOGD("%s: set voicecall route: voicecall_default_disable", __func__); - set_voicecall_route_by_array(adev->mixer, voicecall_default_disable, 1); - ALOGD("%s: set voicecall route: default_input_disable", __func__); - set_voicecall_route_by_array(adev->mixer, default_input_disable, 1); - ALOGD("%s: set voicecall route: headset_input_disable", __func__); - set_voicecall_route_by_array(adev->mixer, headset_input_disable, 1); - ALOGD("%s: set voicecall route: bt_disable", __func__); - set_voicecall_route_by_array(adev->mixer, bt_disable, 1); - select_output_device(adev); - //Force Input Standby - adev->in_device = AUDIO_DEVICE_NONE; select_input_device(adev); } } @@ -690,41 +684,37 @@ static void select_output_device(struct m0_audio_device *adev) if (headset_on || headphone_on || speaker_on || earpiece_on) { ALOGD("%s: set voicecall route: voicecall_default", __func__); - set_voicecall_route_by_array(adev->mixer, voicecall_default, 1); + set_bigroute_by_array(adev->mixer, voicecall_default, 1); } else { ALOGD("%s: set voicecall route: voicecall_default_disable", __func__); - set_voicecall_route_by_array(adev->mixer, voicecall_default_disable, 1); + set_bigroute_by_array(adev->mixer, voicecall_default_disable, 1); } if (speaker_on || earpiece_on || headphone_on) { ALOGD("%s: set voicecall route: default_input", __func__); - set_voicecall_route_by_array(adev->mixer, default_input, 1); + set_bigroute_by_array(adev->mixer, default_input, 1); } else { ALOGD("%s: set voicecall route: default_input_disable", __func__); - set_voicecall_route_by_array(adev->mixer, default_input_disable, 1); + set_bigroute_by_array(adev->mixer, default_input_disable, 1); } if (headset_on) { ALOGD("%s: set voicecall route: headset_input", __func__); - set_voicecall_route_by_array(adev->mixer, headset_input, 1); + set_bigroute_by_array(adev->mixer, headset_input, 1); } else { ALOGD("%s: set voicecall route: headset_input_disable", __func__); - set_voicecall_route_by_array(adev->mixer, headset_input_disable, 1); + set_bigroute_by_array(adev->mixer, headset_input_disable, 1); } if (bt_on) { - // bt uses a different port (PORT_BT) for playback, reopen the pcms - end_call(adev); - start_call(adev); ALOGD("%s: set voicecall route: bt_input", __func__); - set_voicecall_route_by_array(adev->mixer, bt_input, 1); + set_bigroute_by_array(adev->mixer, bt_input, 1); ALOGD("%s: set voicecall route: bt_output", __func__); - set_voicecall_route_by_array(adev->mixer, bt_output, 1); + set_bigroute_by_array(adev->mixer, bt_output, 1); } else { ALOGD("%s: set voicecall route: bt_disable", __func__); - set_voicecall_route_by_array(adev->mixer, bt_disable, 1); + set_bigroute_by_array(adev->mixer, bt_disable, 1); } - set_incall_device(adev); } } @@ -738,9 +728,9 @@ static void select_input_device(struct m0_audio_device *adev) ALOGD("%s: AUDIO_DEVICE_IN_BUILTIN_MIC", __func__); break; case AUDIO_DEVICE_IN_BACK_MIC: - ALOGD("%s: AUDIO_DEVICE_IN_BACK_MIC | AUDIO_DEVICE_IN_BUILTIN_MIC", __func__); // Force use both mics for video recording adev->in_device = (AUDIO_DEVICE_IN_BACK_MIC | AUDIO_DEVICE_IN_BUILTIN_MIC) & ~AUDIO_DEVICE_BIT_IN; + ALOGD("%s: AUDIO_DEVICE_IN_BACK_MIC and AUDIO_DEVICE_IN_BUILTIN_MIC", __func__); break; case AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET: ALOGD("%s: AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET", __func__); @@ -2602,12 +2592,12 @@ static int adev_set_parameters(struct audio_hw_device *dev, const char *kvpairs) ALOGE("%s: enabling two mic control", __func__); ril_set_two_mic_control(&adev->ril, AUDIENCE, TWO_MIC_SOLUTION_ON); /* sub mic */ - set_voicecall_route_by_array(adev->mixer, noise_suppression, 1); + set_bigroute_by_array(adev->mixer, noise_suppression, 1); } else { ALOGE("%s: disabling two mic control", __func__); ril_set_two_mic_control(&adev->ril, AUDIENCE, TWO_MIC_SOLUTION_OFF); /* sub mic */ - set_voicecall_route_by_array(adev->mixer, noise_suppression_disable, 1); + set_bigroute_by_array(adev->mixer, noise_suppression_disable, 1); } } @@ -2830,7 +2820,7 @@ static const struct { { AUDIO_DEVICE_OUT_SPEAKER, "speaker" }, { AUDIO_DEVICE_OUT_WIRED_HEADSET | AUDIO_DEVICE_OUT_WIRED_HEADPHONE, "headphone" }, { AUDIO_DEVICE_OUT_EARPIECE, "earpiece" }, - { AUDIO_DEVICE_OUT_ANLG_DOCK_HEADSET, "analog-dock" }, + { AUDIO_DEVICE_OUT_ANLG_DOCK_HEADSET, "analogue-dock" }, { AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET, "digital-dock" }, { AUDIO_DEVICE_OUT_ALL_SCO, "sco-out" }, { AUDIO_DEVICE_OUT_AUX_DIGITAL, "aux-digital" }, @@ -3078,6 +3068,10 @@ static int adev_open(const hw_module_t* module, const char* name, return -EINVAL; } + /* +30db boost for mics */ + adev->mixer_ctls.mixinl_in1l_volume = mixer_get_ctl_by_name(adev->mixer, "MIXINL IN1L Volume"); + adev->mixer_ctls.mixinl_in2l_volume = mixer_get_ctl_by_name(adev->mixer, "MIXINL IN2L Volume"); + ret = adev_config_parse(adev); if (ret != 0) goto err_mixer; @@ -3086,13 +3080,9 @@ static int adev_open(const hw_module_t* module, const char* name, pthread_mutex_lock(&adev->lock); adev->mode = AUDIO_MODE_NORMAL; adev->out_device = AUDIO_DEVICE_OUT_SPEAKER; - adev->in_device = AUDIO_DEVICE_NONE; + adev->in_device = AUDIO_DEVICE_IN_BUILTIN_MIC & ~AUDIO_DEVICE_BIT_IN; select_devices(adev); - /* +30db boost for mics */ - adev->mixer_ctls.mixinl_in1l_volume = mixer_get_ctl_by_name(adev->mixer, "MIXINL IN1L Volume"); - adev->mixer_ctls.mixinl_in2l_volume = mixer_get_ctl_by_name(adev->mixer, "MIXINL IN2L Volume"); - adev->pcm_modem_dl = NULL; adev->pcm_modem_ul = NULL; adev->pcm_bt_dl = NULL; @@ -3128,7 +3118,7 @@ struct audio_module HAL_MODULE_INFO_SYM = { .module_api_version = AUDIO_MODULE_API_VERSION_0_1, .hal_api_version = HARDWARE_HAL_API_VERSION, .id = AUDIO_HARDWARE_MODULE_ID, - .name = "M0 audio HW HAL", + .name = "T03G audio HW HAL", .author = "The CyanogenMod Project", .methods = &hal_module_methods, }, diff --git a/audio/audio_hw.h b/audio/audio_hw.h index d7d68d9..889c249 100644 --- a/audio/audio_hw.h +++ b/audio/audio_hw.h @@ -134,6 +134,8 @@ struct route_setting voicecall_default_disable[] = { { .ctl_name = "AIF2DAC Mux", .strval = "AIF3DACDAT", }, { .ctl_name = "Main Mic Switch", .intval = 0, }, { .ctl_name = "MIXINL IN2L Switch", .intval = 0, }, + { .ctl_name = "Sub Mic Switch", .intval = 0, }, + { .ctl_name = "MIXINR IN1R Switch", .intval = 0, }, { .ctl_name = NULL, }, }; @@ -177,7 +179,7 @@ struct route_setting headset_input[] = { { .ctl_name = "MIXINL IN2L Switch", .intval = 0, }, { .ctl_name = "MIXINR IN1R Switch", .intval = 0, }, { .ctl_name = "Headset Mic Switch", .intval = 1, }, - { .ctl_name = "IN1L Volume", .intval = 28, }, + { .ctl_name = "IN1L Volume", .intval = 18, }, { .ctl_name = "MIXINL IN1L Switch", .intval = 1, }, { .ctl_name = "MIXINL IN1L Volume", .intval = 0, }, { .ctl_name = "AIF1ADC1 HPF Mode", .intval = 1, }, @@ -208,8 +210,8 @@ struct route_setting bt_output[] = { { .ctl_name = "AIF2DAC2R Mixer AIF1.1 Switch", .intval = 1, }, { .ctl_name = "AIF2DAC Volume", .intval = 96, }, { .ctl_name = "MIXINL IN1L Volume", .intval = 1, }, - { .ctl_name = "IN2L Volume", .intval = 25, }, - { .ctl_name = "IN1R Volume", .intval = 25, }, + { .ctl_name = "IN2L Volume", .intval = 28, }, + { .ctl_name = "IN1R Volume", .intval = 28, }, { .ctl_name = "LINEOUT1N Switch", .intval = 0, }, { .ctl_name = "LINEOUT1P Switch", .intval = 0, }, { .ctl_name = "AIF1ADC1 HPF Switch", .intval = 0, }, diff --git a/configs/tiny_hw.xml b/configs/tiny_hw.xml index bbdf2ec..017e9e7 100644 --- a/configs/tiny_hw.xml +++ b/configs/tiny_hw.xml @@ -10,6 +10,9 @@ We are able to have most of our routing static so do that + + + @@ -124,10 +127,12 @@ We are able to have most of our routing static so do that + + - + @@ -159,6 +164,7 @@ We are able to have most of our routing static so do that + @@ -191,82 +197,59 @@ We are able to have most of our routing static so do that - - - - - - - + - - - - - + - + - - - + - - - + - - - - - - - - - - - - + + + + + + + + + - - - - - - - - - - + + + + @@ -298,14 +281,14 @@ We are able to have most of our routing static so do that - + - + @@ -317,18 +300,16 @@ We are able to have most of our routing static so do that - + - + - + - - - + @@ -337,9 +318,9 @@ We are able to have most of our routing static so do that - + - + @@ -348,10 +329,6 @@ We are able to have most of our routing static so do that - - - - -- cgit v1.1 From 3594031aef50e7e4bfd8a34c9fb39ed4bf5a2d6f Mon Sep 17 00:00:00 2001 From: Javier Ferrer Date: Fri, 14 Mar 2014 00:02:10 +0530 Subject: n7100: fix drain after call Change-Id: I60ebd34d5af71a63b0e44a82068a7d5a81f0bdca --- audio/audio_hw.c | 1 + 1 file changed, 1 insertion(+) diff --git a/audio/audio_hw.c b/audio/audio_hw.c index 55044f0..762db0e 100644 --- a/audio/audio_hw.c +++ b/audio/audio_hw.c @@ -596,6 +596,7 @@ static void select_mode(struct m0_audio_device *adev) adev->in_call, adev->mode); if (adev->in_call) { adev->in_call = 0; + ril_set_call_clock_sync(&adev->ril, SOUND_CLOCK_STOP); end_call(adev); force_all_standby(adev); select_output_device(adev); -- cgit v1.1 From 55f503df2b2a5f88620607557102eb0d5f187d42 Mon Sep 17 00:00:00 2001 From: Paul Kocialkowski Date: Fri, 14 Mar 2014 16:23:05 +0530 Subject: n7100: audio: updates from replicant Change-Id: Ie8ba2559d52db3f972a790be9a81b11e272d8333 --- configs/tiny_hw.xml | 35 ++++++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/configs/tiny_hw.xml b/configs/tiny_hw.xml index 017e9e7..64fae98 100644 --- a/configs/tiny_hw.xml +++ b/configs/tiny_hw.xml @@ -127,8 +127,6 @@ We are able to have most of our routing static so do that - - @@ -164,7 +162,6 @@ We are able to have most of our routing static so do that - @@ -197,19 +194,29 @@ We are able to have most of our routing static so do that + + + + + + + - + + + + @@ -281,7 +288,7 @@ We are able to have most of our routing static so do that - + @@ -300,16 +307,18 @@ We are able to have most of our routing static so do that - + - + - + - + + + @@ -318,9 +327,9 @@ We are able to have most of our routing static so do that - + - + @@ -329,6 +338,10 @@ We are able to have most of our routing static so do that + + + + -- cgit v1.1 From e0d420b122c1c5cf1772a362404669dbe9bb816d Mon Sep 17 00:00:00 2001 From: markcs Date: Sat, 22 Mar 2014 19:22:23 +0530 Subject: n7100: audio: fix video issues Now audio is stereo without any static Change-Id: I69c4c66f9a8c91d1d005baf3bd79c3a32a868ac3 --- audio/audio_hw.c | 14 +++++++++++++- configs/tiny_hw.xml | 8 ++++---- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/audio/audio_hw.c b/audio/audio_hw.c index 762db0e..c1471b2 100644 --- a/audio/audio_hw.c +++ b/audio/audio_hw.c @@ -598,6 +598,18 @@ static void select_mode(struct m0_audio_device *adev) adev->in_call = 0; ril_set_call_clock_sync(&adev->ril, SOUND_CLOCK_STOP); end_call(adev); + //Force Input Standby + adev->in_device = AUDIO_DEVICE_NONE; + + ALOGD("%s: set voicecall route: voicecall_default_disable", __func__); + set_bigroute_by_array(adev->mixer, voicecall_default_disable, 1); + ALOGD("%s: set voicecall route: default_input_disable", __func__); + set_bigroute_by_array(adev->mixer, default_input_disable, 1); + ALOGD("%s: set voicecall route: headset_input_disable", __func__); + set_bigroute_by_array(adev->mixer, headset_input_disable, 1); + ALOGD("%s: set voicecall route: bt_disable", __func__); + set_bigroute_by_array(adev->mixer, bt_disable, 1); + force_all_standby(adev); select_output_device(adev); select_input_device(adev); @@ -3081,7 +3093,7 @@ static int adev_open(const hw_module_t* module, const char* name, pthread_mutex_lock(&adev->lock); adev->mode = AUDIO_MODE_NORMAL; adev->out_device = AUDIO_DEVICE_OUT_SPEAKER; - adev->in_device = AUDIO_DEVICE_IN_BUILTIN_MIC & ~AUDIO_DEVICE_BIT_IN; + adev->in_device = AUDIO_DEVICE_NONE; select_devices(adev); adev->pcm_modem_dl = NULL; diff --git a/configs/tiny_hw.xml b/configs/tiny_hw.xml index 64fae98..b84713b 100644 --- a/configs/tiny_hw.xml +++ b/configs/tiny_hw.xml @@ -275,9 +275,9 @@ We are able to have most of our routing static so do that - + - + @@ -295,9 +295,9 @@ We are able to have most of our routing static so do that - + - + -- cgit v1.1 From a57e8d4ba0d50329d515a042b3110758a5bed227 Mon Sep 17 00:00:00 2001 From: ayysir Date: Wed, 26 Mar 2014 14:03:00 -0400 Subject: overlay/pa_arrays: lcd densities does not exist --- .../apps/Settings/res/values/pa_arrays.xml | 32 ---------------------- 1 file changed, 32 deletions(-) delete mode 100644 overlay/packages/apps/Settings/res/values/pa_arrays.xml diff --git a/overlay/packages/apps/Settings/res/values/pa_arrays.xml b/overlay/packages/apps/Settings/res/values/pa_arrays.xml deleted file mode 100644 index d4706da..0000000 --- a/overlay/packages/apps/Settings/res/values/pa_arrays.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - 160 - 180 - 200 - 213 - 220 - 240 - 280 - 300 - 320 - - - -- cgit v1.1 From a8579003813d7999546fd3cb3e167fef0cfbbb2a Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Thu, 10 Apr 2014 10:19:07 +0530 Subject: Update selinux With change http://review.cyanogenmod.org/62219 build fails because of duplicate definition. --- selinux/file.te | 1 - 1 file changed, 1 deletion(-) diff --git a/selinux/file.te b/selinux/file.te index 2a01dac..9d1d823 100644 --- a/selinux/file.te +++ b/selinux/file.te @@ -1,5 +1,4 @@ type firmware_mfc, file_type; type firmware_camera, file_type; -type camera_data_file, file_type, data_file_type; type sensors_data_file, file_type, data_file_type; -- cgit v1.1 From 562847a690e18c40459713eb9b0c0b9bcebb900d Mon Sep 17 00:00:00 2001 From: Utkarsh Gupta Date: Thu, 15 May 2014 17:22:02 +0530 Subject: More SELinux updates Conflicts: selinux/file_contexts --- selinux/file.te | 1 + selinux/file_contexts | 7 ++++++- selinux/mediaserver.te | 5 +++++ selinux/system.te | 1 + selinux/ueventd.te | 5 ++++- 5 files changed, 17 insertions(+), 2 deletions(-) diff --git a/selinux/file.te b/selinux/file.te index 9d1d823..facc492 100644 --- a/selinux/file.te +++ b/selinux/file.te @@ -2,3 +2,4 @@ type firmware_mfc, file_type; type firmware_camera, file_type; type sensors_data_file, file_type, data_file_type; +type volume_data_file, file_type, data_file_type; diff --git a/selinux/file_contexts b/selinux/file_contexts index 9713bce..85bda40 100644 --- a/selinux/file_contexts +++ b/selinux/file_contexts @@ -5,10 +5,12 @@ # RIL /dev/umts_boot0 u:object_r:radio_device:s0 -/dev/umts_boot1 u:object_r:radio_device:s0 +/dev/umts_csd u:object_r:radio_device:s0 /dev/umts_ipc0 u:object_r:radio_device:s0 +/dev/umts_loopback0 u:object_r:radio_device:s0 /dev/umts_ramdump0 u:object_r:radio_device:s0 /dev/umts_rfs0 u:object_r:radio_device:s0 +/dev/umts_router u:object_r:radio_device:s0 /dev/block/mmcblk0p10 u:object_r:efs_block_device:s0 @@ -35,3 +37,6 @@ /system/vendor/firmware(/.*)? u:object_r:firmware_camera:s0 /system/vendor/firmware/mfc_fw.bin u:object_r:firmware_mfc:s0 /data/cfw(/.*)? u:object_r:firmware_camera:s0 + +# Vibrator +/dev/tspdrv u:object_r:input_device:s0 diff --git a/selinux/mediaserver.te b/selinux/mediaserver.te index 520da3a..7cc911c 100644 --- a/selinux/mediaserver.te +++ b/selinux/mediaserver.te @@ -1,3 +1,8 @@ allow mediaserver { firmware_camera }:file r_file_perms; allow mediaserver firmware_camera:dir r_dir_perms; allow mediaserver camera_data_file:file rw_file_perms; +allow mediaserver volume_data_file:file create_file_perms; +allow mediaserver volume_data_file:dir create_dir_perms; + +# Bluetooth audio +allow mediaserver bluetooth:unix_stream_socket { connectto }; diff --git a/selinux/system.te b/selinux/system.te index 395aeea..df7b6fc 100644 --- a/selinux/system.te +++ b/selinux/system.te @@ -2,6 +2,7 @@ allow system input_device:chr_file { read ioctl write open }; allow system sensors_device:chr_file { read open }; allow system sensors_data_file:file r_file_perms; allow system wpa_socket:unix_dgram_socket sendto; +allow system_app volume_data_file:file { read write open getattr }; allow system sysfs:file { read open write }; allow system self:capability { sys_module }; diff --git a/selinux/ueventd.te b/selinux/ueventd.te index 4037e57..1ed58dc 100644 --- a/selinux/ueventd.te +++ b/selinux/ueventd.te @@ -1,3 +1,6 @@ -# Firmwares +# MFC firmware allow ueventd { firmware_mfc }:file r_file_perms; + +# Camera related firmwares allow ueventd { firmware_camera }:dir search; +allow ueventd { firmware_camera }:file r_file_perms; -- cgit v1.1 From cd5145640187472147f77a2e9be8e7055097b581 Mon Sep 17 00:00:00 2001 From: sbrissen Date: Tue, 25 Feb 2014 14:34:07 -0500 Subject: n7100: fix up sensors -dibable all sensors when screen is off. port from t0: http://review.cyanogenmod.org/#/c/60292/ Change-Id: I66566f5a17acdc7c6dda84eef81af928567cfa37 Conflicts: libsensors/sensors.h --- libsensors/ProximitySensor.cpp | 1 + libsensors/SensorBase.cpp | 36 +++++++++++++++++++++++++----------- libsensors/SensorBase.h | 1 + libsensors/sensors.h | 20 +++++++++++++++----- 4 files changed, 42 insertions(+), 16 deletions(-) diff --git a/libsensors/ProximitySensor.cpp b/libsensors/ProximitySensor.cpp index 404bdbc..f9579fa 100644 --- a/libsensors/ProximitySensor.cpp +++ b/libsensors/ProximitySensor.cpp @@ -88,6 +88,7 @@ int ProximitySensor::enable(int32_t handle, int en) { int flags = en ? 1 : 0; int err; + //ALOGD("%s: Enable: %i", __func__, en); if (flags != mEnabled) { err = sspEnable(LOGTAG, SSP_PROX, en); if(err >= 0){ diff --git a/libsensors/SensorBase.cpp b/libsensors/SensorBase.cpp index 389edd7..2de3923 100644 --- a/libsensors/SensorBase.cpp +++ b/libsensors/SensorBase.cpp @@ -144,35 +144,49 @@ int SensorBase::sspEnable(const char* sensorname, int sensorvalue, int en) int oldvalue = 0; int reset = 0; int newvalue; - int fd, err; - char buf[10]; + int fd; sspfile = fopen(SSP_DEVICE_ENABLE, "r+"); fscanf(sspfile, "%d", &oldvalue); fclose(sspfile); //Accel sensor is first on and last off, if we are disabling it -// assume the screen is off and zero everything out. +// assume the screen is off, disable all sensors and zero everything out +// to keep enable file in sync. if(sensorvalue == SSP_ACCEL && !en) { - newvalue = '\0'; //ALOGD("SensorBase: Resetting sensors"); + for(int i; i < 6; i++){ + newvalue = oldvalue - ssp_sensors[i]; + //ALOGD("SensorBase: newvalue: %i ",newvalue); + sspWrite(newvalue); + } + sspWrite('\0'); + return 0; } else if(en) { newvalue = oldvalue + sensorvalue; } else { newvalue = oldvalue - sensorvalue; } + //ALOGI("%s: name: %s sensor: %i old value: %i new value: %i ", __func__, sensorname, sensorvalue, oldvalue, newvalue); + sspWrite(newvalue); + return 0; +} - sprintf(buf, "%d", newvalue); +int SensorBase::sspWrite(int sensorvalue) +{ + char buf[10]; + int fd, ret, err; + sprintf(buf, "%d", sensorvalue); fd = open(SSP_DEVICE_ENABLE, O_RDWR); if (fd >= 0) { err = write(fd, buf, sizeof(buf)); - //ALOGI("%s: sensor: %i old value: %i new value: %i ", sensorname, sensorvalue, oldvalue, newvalue); - close(fd); - return 0; + ret = 0; } else { - ALOGI("%s: error writing to file", sensorname); - close(fd); - return -1; + ALOGI("%s: error writing to file", __func__); + ret = -1; } + + close(fd); + return ret; } diff --git a/libsensors/SensorBase.h b/libsensors/SensorBase.h index d9e4b47..aeac510 100644 --- a/libsensors/SensorBase.h +++ b/libsensors/SensorBase.h @@ -61,6 +61,7 @@ public: virtual int setDelay(int32_t handle, int64_t ns); virtual int enable(int32_t handle, int enabled) = 0; int sspEnable(const char* sensorname, int sensorvalue, int en); + int sspWrite(int sensorvalue); virtual int batch(int handle, int flags, int64_t period_ns, int64_t timeout); virtual int flush(int handle); diff --git a/libsensors/sensors.h b/libsensors/sensors.h index a4fe794..713395b 100644 --- a/libsensors/sensors.h +++ b/libsensors/sensors.h @@ -52,6 +52,16 @@ __BEGIN_DECLS #define SSP_DEVICE_ENABLE "/sys/class/sensors/ssp_sensor/enable" +const int ssp_sensors[] = { + SSP_ACCEL, + SSP_GYRO, + SSP_MAG, + SSP_PRESS, + SSP_PROX, + SSP_LIGHT +}; + + /*****************************************************************************/ /* @@ -105,7 +115,7 @@ __BEGIN_DECLS // conversion of magnetic data to uT units #define CONVERT_M (1.0f/16.0f) -#define CONVERT_M_X (-CONVERT_M) +#define CONVERT_M_X (CONVERT_M) #define CONVERT_M_Y (CONVERT_M) #define CONVERT_M_Z (CONVERT_M) @@ -116,11 +126,11 @@ __BEGIN_DECLS #define CONVERT_O_R (CONVERT_O) // conversion of gyro data to SI units (radian/sec) -#define RANGE_GYRO (500.0f*(float)M_PI/180.0f) +#define RANGE_GYRO (2000.0f*(float)M_PI/180.0f) #define CONVERT_GYRO ((70.0f / 4000.0f) * ((float)M_PI / 180.0f)) -#define CONVERT_GYRO_X (-CONVERT_GYRO) -#define CONVERT_GYRO_Y (-CONVERT_GYRO) -#define CONVERT_GYRO_Z (-CONVERT_GYRO) +#define CONVERT_GYRO_X (CONVERT_GYRO) +#define CONVERT_GYRO_Y (CONVERT_GYRO) +#define CONVERT_GYRO_Z (CONVERT_GYRO) #define SENSOR_STATE_MASK (0x7FFF) -- cgit v1.1 From a3486a1655d2c4ab5003b8d1f66eaa97ec75511f Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Sat, 7 Jun 2014 10:00:55 +0530 Subject: N7100: Enable app2sd --- BoardConfig.mk | 3 +++ overlay/frameworks/base/core/res/res/xml/storage_list.xml | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/BoardConfig.mk b/BoardConfig.mk index a957a02..8f63b1b 100644 --- a/BoardConfig.mk +++ b/BoardConfig.mk @@ -37,6 +37,9 @@ TARGET_OTA_ASSERT_DEVICE := t03g,n7100,GT-N7100 # inherit from the proprietary version -include vendor/samsung/n7100/BoardConfigVendor.mk +# External apps on SD +TARGET_EXTERNAL_APPS = sdcard1 + # Recovery TARGET_RECOVERY_FSTAB := device/samsung/n7100/rootdir/fstab.smdk4x12 RECOVERY_FSTAB_VERSION := 2 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 f98fbb0..9108fdc 100644 --- a/overlay/frameworks/base/core/res/res/xml/storage_list.xml +++ b/overlay/frameworks/base/core/res/res/xml/storage_list.xml @@ -43,10 +43,11 @@ android:storageDescription="@string/storage_sd_card" android:primary="false" android:removable="true" - android:allowMassStorage="true" /> + android:allowMassStorage="true" + android:externalApps="true" /> - \ No newline at end of file + -- cgit v1.1 From 925bf0439f5078585e82aa0d8f00cbd793522597 Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Tue, 10 Jun 2014 20:30:20 +0530 Subject: Some more SELinux updates --- BoardConfig.mk | 1 + rootdir/init.target.rc | 17 +++++++++++++++++ selinux/vold.te | 2 ++ 3 files changed, 20 insertions(+) create mode 100644 selinux/vold.te diff --git a/BoardConfig.mk b/BoardConfig.mk index 8f63b1b..535d6bf 100644 --- a/BoardConfig.mk +++ b/BoardConfig.mk @@ -58,4 +58,5 @@ BOARD_SEPOLICY_UNION += \ rild.te \ system.te \ ueventd.te \ + vold.te \ wpa_supplicant.te diff --git a/rootdir/init.target.rc b/rootdir/init.target.rc index a7fcf72..d3d5407 100644 --- a/rootdir/init.target.rc +++ b/rootdir/init.target.rc @@ -10,6 +10,23 @@ on post-fs-data # make param block device link for SysScope symlink /dev/block/mmcblk0p7 /dev/block/param + # Restorecon + restorecon /efs/nv_data.bin + restorecon /efs/nv_data.bin.md5 + restorecon /efs/.nv_core.bak + restorecon /efs/.nv_core.bak.md5 + restorecon /efs/.nv_data.bak + restorecon /efs/.nv_data.bak.md5 + restorecon /efs/.nv_state + restorecon /efs/bluetooth/bt_addr + restorecon /efs/FactoryApp/factorymode + restorecon /efs/FactoryApp/hw_ver + restorecon /efs/FactoryApp/keystr + restorecon /efs/FactoryApp/serial_no + restorecon /efs/imei/mps_code.dat + restorecon /efs/gyro_cal_data + restorecon /efs/wifi/.mac.info + # SensorHub chown system radio /sys/class/sensors/ssp_sensor/enable chown system radio /sys/class/sensors/ssp_sensor/mcu_rev diff --git a/selinux/vold.te b/selinux/vold.te new file mode 100644 index 0000000..9452abf --- /dev/null +++ b/selinux/vold.te @@ -0,0 +1,2 @@ +allow vold kernel:process setsched; +allow vold sdcardd_exec:file { read open execute execute_no_trans }; -- cgit v1.1 From da2f11839adee60a0ab91f14a97d22735806890e Mon Sep 17 00:00:00 2001 From: Javier Ferrer Date: Wed, 14 May 2014 23:36:36 +0200 Subject: Camera wrapper Conflicts: BoardConfig.mk --- BoardConfig.mk | 3 + camera/Android.mk | 15 ++ camera/CameraWrapper.cpp | 600 +++++++++++++++++++++++++++++++++++++++++++++++ n7100.mk | 4 +- 4 files changed, 620 insertions(+), 2 deletions(-) create mode 100644 camera/Android.mk create mode 100644 camera/CameraWrapper.cpp diff --git a/BoardConfig.mk b/BoardConfig.mk index 535d6bf..0286265 100644 --- a/BoardConfig.mk +++ b/BoardConfig.mk @@ -60,3 +60,6 @@ BOARD_SEPOLICY_UNION += \ ueventd.te \ vold.te \ wpa_supplicant.te + +# Camera wrapper +TARGET_PROVIDES_CAMERA_HAL := true diff --git a/camera/Android.mk b/camera/Android.mk new file mode 100644 index 0000000..a0652a6 --- /dev/null +++ b/camera/Android.mk @@ -0,0 +1,15 @@ +LOCAL_PATH := $(call my-dir) +include $(CLEAR_VARS) + +LOCAL_SRC_FILES := \ + CameraWrapper.cpp + +LOCAL_SHARED_LIBRARIES := \ + libhardware liblog libcamera_client libutils + +LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw +LOCAL_MODULE := camera.exynos4 +LOCAL_MODULE_TAGS := optional + +include $(BUILD_SHARED_LIBRARY) +#include $(BUILD_HEAPTRACKED_SHARED_LIBRARY) diff --git a/camera/CameraWrapper.cpp b/camera/CameraWrapper.cpp new file mode 100644 index 0000000..e503b03 --- /dev/null +++ b/camera/CameraWrapper.cpp @@ -0,0 +1,600 @@ +/* + * Copyright (C) 2012, The CyanogenMod 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. + */ + +/** +* @file CameraWrapper.cpp +* +* This file wraps a vendor camera module. +* +*/ + + +#define LOG_NDEBUG 0 +//#define LOG_PARAMETERS + +#define LOG_TAG "CameraWrapper" +#include + +#include +#include +#include +#include +#include +#include + +static android::Mutex gCameraWrapperLock; +static camera_module_t *gVendorModule = 0; + +bool preview_running = false; + +static int camera_device_open(const hw_module_t* module, const char* name, + hw_device_t** device); +static int camera_device_close(hw_device_t* device); +static int camera_get_number_of_cameras(void); +static int camera_get_camera_info(int camera_id, struct camera_info *info); + +static struct hw_module_methods_t camera_module_methods = { + open: camera_device_open +}; + +camera_module_t HAL_MODULE_INFO_SYM = { + common: { + tag: HARDWARE_MODULE_TAG, + version_major: 1, + version_minor: 0, + id: CAMERA_HARDWARE_MODULE_ID, + name: "Exynos4x12 Camera Wrapper", + author: "Teamhacksung ", + methods: &camera_module_methods, + dso: NULL, /* remove compilation warnings */ + reserved: {0}, /* remove compilation warnings */ + }, + get_number_of_cameras: camera_get_number_of_cameras, + get_camera_info: camera_get_camera_info, +}; + +typedef struct wrapper_camera_device { + camera_device_t base; + int id; + camera_device_t *vendor; +} wrapper_camera_device_t; + +#define VENDOR_CALL(device, func, ...) ({ \ + wrapper_camera_device_t *__wrapper_dev = (wrapper_camera_device_t*) device; \ + __wrapper_dev->vendor->ops->func(__wrapper_dev->vendor, ##__VA_ARGS__); \ +}) + +#define CAMERA_ID(device) (((wrapper_camera_device_t *)(device))->id) + +static int check_vendor_module() +{ + int rv = 0; + ALOGV("%s", __FUNCTION__); + + if(gVendorModule) + return 0; + + rv = hw_get_module("vendor-camera", (const hw_module_t **)&gVendorModule); + if (rv) + ALOGE("failed to open vendor camera module"); + return rv; +} + +const static char * iso_values[] = {"auto,ISO100,ISO200,ISO400,ISO800","auto"}; + +static char * camera_fixup_getparams(int id, const char * settings) +{ + android::CameraParameters params; + params.unflatten(android::String8(settings)); + + // fix params here + params.set(android::CameraParameters::KEY_SUPPORTED_ISO_MODES, iso_values[id]); + params.set(android::CameraParameters::KEY_AUTO_EXPOSURE_LOCK, "false"); + params.set(android::CameraParameters::KEY_VIDEO_SNAPSHOT_SUPPORTED, "true"); + + android::String8 strParams = params.flatten(); + char *ret = strdup(strParams.string()); + + ALOGD("%s: get parameters fixed up", __FUNCTION__); + return ret; +} + +char * camera_fixup_setparams(int id, const char * settings) +{ + android::CameraParameters params; + params.unflatten(android::String8(settings)); + + // fix params here + if(params.get("iso")) { + const char* isoMode = params.get(android::CameraParameters::KEY_ISO_MODE); + if(strcmp(isoMode, "ISO100") == 0) + params.set(android::CameraParameters::KEY_ISO_MODE, "100"); + else if(strcmp(isoMode, "ISO200") == 0) + params.set(android::CameraParameters::KEY_ISO_MODE, "200"); + else if(strcmp(isoMode, "ISO400") == 0) + params.set(android::CameraParameters::KEY_ISO_MODE, "400"); + else if(strcmp(isoMode, "ISO800") == 0) + params.set(android::CameraParameters::KEY_ISO_MODE, "800"); + } + //Workaround for crash when touch to focus is used with flash on. + params.set(android::CameraParameters::KEY_AUTO_EXPOSURE_LOCK, "false"); + +#ifdef CAMERA_WITH_CITYID_PARAM + params.set(android::CameraParameters::KEY_CITYID, 0); +#endif + + android::String8 strParams = params.flatten(); + char *ret = strdup(strParams.string()); + + ALOGD("%s: set parameters fixed up", __FUNCTION__); + return ret; +} + +/******************************************************************* + * implementation of camera_device_ops functions + *******************************************************************/ + +int camera_set_preview_window(struct camera_device * device, + struct preview_stream_ops *window) +{ + ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); + + if(!device) + return -EINVAL; + + return VENDOR_CALL(device, set_preview_window, window); +} + +void camera_set_callbacks(struct camera_device * device, + camera_notify_callback notify_cb, + camera_data_callback data_cb, + camera_data_timestamp_callback data_cb_timestamp, + camera_request_memory get_memory, + void *user) +{ + ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); + ALOGV("%s", __FUNCTION__); + + if(!device) + return; + + VENDOR_CALL(device, set_callbacks, notify_cb, data_cb, data_cb_timestamp, get_memory, user); +} + +void camera_enable_msg_type(struct camera_device * device, int32_t msg_type) +{ + ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); + ALOGV("%s", __FUNCTION__); + + if(!device) + return; + + VENDOR_CALL(device, enable_msg_type, msg_type); +} + +void camera_disable_msg_type(struct camera_device * device, int32_t msg_type) +{ + ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); + ALOGV("%s", __FUNCTION__); + + if(!device) + return; + + VENDOR_CALL(device, disable_msg_type, msg_type); +} + +int camera_msg_type_enabled(struct camera_device * device, int32_t msg_type) +{ + ALOGV("%s", __FUNCTION__); + ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); + + if(!device) + return 0; + + return VENDOR_CALL(device, msg_type_enabled, msg_type); +} + +int camera_start_preview(struct camera_device * device) +{ + int rc; + + ALOGV("%s", __FUNCTION__); + ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); + + if(!device) + return -EINVAL; + + rc = VENDOR_CALL(device, start_preview); + if (rc) + preview_running = true; + + return rc; +} + +void camera_stop_preview(struct camera_device * device) +{ + ALOGV("%s", __FUNCTION__); + ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); + + if(!device) + return; + + // Workaround for camera freezes + VENDOR_CALL(device, send_command, 7, 0, 0); + + VENDOR_CALL(device, stop_preview); + + preview_running = false; +} + +int camera_preview_enabled(struct camera_device * device) +{ + ALOGV("%s", __FUNCTION__); + ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); + + if(!device) + return -EINVAL; + + return VENDOR_CALL(device, preview_enabled); +} + +int camera_store_meta_data_in_buffers(struct camera_device * device, int enable) +{ + ALOGV("%s", __FUNCTION__); + ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); + + if(!device) + return -EINVAL; + + return VENDOR_CALL(device, store_meta_data_in_buffers, enable); +} + +int camera_start_recording(struct camera_device * device) +{ + ALOGV("%s", __FUNCTION__); + ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); + + if(!device) + return EINVAL; + + return VENDOR_CALL(device, start_recording); +} + +void camera_stop_recording(struct camera_device * device) +{ + ALOGV("%s", __FUNCTION__); + ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); + + if(!device) + return; + + + VENDOR_CALL(device, stop_recording); +} + +int camera_recording_enabled(struct camera_device * device) +{ + ALOGV("%s", __FUNCTION__); + ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); + + if(!device) + return -EINVAL; + + return VENDOR_CALL(device, recording_enabled); +} + +void camera_release_recording_frame(struct camera_device * device, + const void *opaque) +{ + ALOGV("%s", __FUNCTION__); + ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); + + if(!device) + return; + + VENDOR_CALL(device, release_recording_frame, opaque); +} + +int camera_auto_focus(struct camera_device * device) +{ + ALOGV("%s", __FUNCTION__); + ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); + + if(!device) + return -EINVAL; + + + return VENDOR_CALL(device, auto_focus); +} + +int camera_cancel_auto_focus(struct camera_device * device) +{ + ALOGV("%s", __FUNCTION__); + ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); + + if(!device) + return -EINVAL; + + if (preview_running) + return VENDOR_CALL(device, cancel_auto_focus); + else + return 0; +} + +int camera_take_picture(struct camera_device * device) +{ + ALOGV("%s", __FUNCTION__); + ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); + + if(!device) + return -EINVAL; + + return VENDOR_CALL(device, take_picture); +} + +int camera_cancel_picture(struct camera_device * device) +{ + ALOGV("%s", __FUNCTION__); + ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); + + if(!device) + return -EINVAL; + + return VENDOR_CALL(device, cancel_picture); +} + +int camera_set_parameters(struct camera_device * device, const char *params) +{ + ALOGV("%s", __FUNCTION__); + ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); + + if(!device) + return -EINVAL; + + char *tmp = NULL; + tmp = camera_fixup_setparams(CAMERA_ID(device), params); + +#ifdef LOG_PARAMETERS + __android_log_write(ANDROID_LOG_VERBOSE, LOG_TAG, tmp); +#endif + + int ret = VENDOR_CALL(device, set_parameters, tmp); + return ret; +} + +char* camera_get_parameters(struct camera_device * device) +{ + ALOGV("%s", __FUNCTION__); + ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); + + if(!device) + return NULL; + + char* params = VENDOR_CALL(device, get_parameters); + +#ifdef LOG_PARAMETERS + __android_log_write(ANDROID_LOG_VERBOSE, LOG_TAG, params); +#endif + + char * tmp = camera_fixup_getparams(CAMERA_ID(device), params); + VENDOR_CALL(device, put_parameters, params); + params = tmp; + +#ifdef LOG_PARAMETERS + __android_log_write(ANDROID_LOG_VERBOSE, LOG_TAG, params); +#endif + + return params; +} + +static void camera_put_parameters(struct camera_device *device, char *params) +{ + ALOGV("%s", __FUNCTION__); + ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); + + if(params) + free(params); +} + +int camera_send_command(struct camera_device * device, + int32_t cmd, int32_t arg1, int32_t arg2) +{ + ALOGV("%s", __FUNCTION__); + ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); + + if(!device) + return -EINVAL; + + return VENDOR_CALL(device, send_command, cmd, arg1, arg2); +} + +void camera_release(struct camera_device * device) +{ + ALOGV("%s", __FUNCTION__); + ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); + + if(!device) + return; + + VENDOR_CALL(device, release); +} + +int camera_dump(struct camera_device * device, int fd) +{ + if(!device) + return -EINVAL; + + return VENDOR_CALL(device, dump, fd); +} + +extern "C" void heaptracker_free_leaked_memory(void); + +int camera_device_close(hw_device_t* device) +{ + int ret = 0; + wrapper_camera_device_t *wrapper_dev = NULL; + + ALOGV("%s", __FUNCTION__); + + android::Mutex::Autolock lock(gCameraWrapperLock); + + if (!device) { + ret = -EINVAL; + goto done; + } + + wrapper_dev = (wrapper_camera_device_t*) device; + + wrapper_dev->vendor->common.close((hw_device_t*)wrapper_dev->vendor); + if (wrapper_dev->base.ops) + free(wrapper_dev->base.ops); + free(wrapper_dev); +done: +#ifdef HEAPTRACKER + heaptracker_free_leaked_memory(); +#endif + return ret; +} + +/******************************************************************* + * implementation of camera_module functions + *******************************************************************/ + +/* open device handle to one of the cameras + * + * assume camera service will keep singleton of each camera + * so this function will always only be called once per camera instance + */ + +int camera_device_open(const hw_module_t* module, const char* name, + hw_device_t** device) +{ + int rv = 0; + int num_cameras = 0; + int cameraid; + wrapper_camera_device_t* camera_device = NULL; + camera_device_ops_t* camera_ops = NULL; + + android::Mutex::Autolock lock(gCameraWrapperLock); + + ALOGV("camera_device open"); + + if (name != NULL) { + if (check_vendor_module()) + return -EINVAL; + + cameraid = atoi(name); + num_cameras = gVendorModule->get_number_of_cameras(); + + if(cameraid > num_cameras) + { + ALOGE("camera service provided cameraid out of bounds, " + "cameraid = %d, num supported = %d", + cameraid, num_cameras); + rv = -EINVAL; + goto fail; + } + + camera_device = (wrapper_camera_device_t*)malloc(sizeof(*camera_device)); + if(!camera_device) + { + ALOGE("camera_device allocation fail"); + rv = -ENOMEM; + goto fail; + } + memset(camera_device, 0, sizeof(*camera_device)); + camera_device->id = cameraid; + + if(rv = gVendorModule->common.methods->open((const hw_module_t*)gVendorModule, name, (hw_device_t**)&(camera_device->vendor))) + { + ALOGE("vendor camera open fail"); + goto fail; + } + ALOGV("%s: got vendor camera device 0x%08X", __FUNCTION__, (uintptr_t)(camera_device->vendor)); + + camera_ops = (camera_device_ops_t*)malloc(sizeof(*camera_ops)); + if(!camera_ops) + { + ALOGE("camera_ops allocation fail"); + rv = -ENOMEM; + goto fail; + } + + memset(camera_ops, 0, sizeof(*camera_ops)); + + camera_device->base.common.tag = HARDWARE_DEVICE_TAG; + camera_device->base.common.version = 0; + camera_device->base.common.module = (hw_module_t *)(module); + camera_device->base.common.close = camera_device_close; + camera_device->base.ops = camera_ops; + + camera_ops->set_preview_window = camera_set_preview_window; + camera_ops->set_callbacks = camera_set_callbacks; + camera_ops->enable_msg_type = camera_enable_msg_type; + camera_ops->disable_msg_type = camera_disable_msg_type; + camera_ops->msg_type_enabled = camera_msg_type_enabled; + camera_ops->start_preview = camera_start_preview; + camera_ops->stop_preview = camera_stop_preview; + camera_ops->preview_enabled = camera_preview_enabled; + camera_ops->store_meta_data_in_buffers = camera_store_meta_data_in_buffers; + camera_ops->start_recording = camera_start_recording; + camera_ops->stop_recording = camera_stop_recording; + camera_ops->recording_enabled = camera_recording_enabled; + camera_ops->release_recording_frame = camera_release_recording_frame; + camera_ops->auto_focus = camera_auto_focus; + camera_ops->cancel_auto_focus = camera_cancel_auto_focus; + camera_ops->take_picture = camera_take_picture; + camera_ops->cancel_picture = camera_cancel_picture; + camera_ops->set_parameters = camera_set_parameters; + camera_ops->get_parameters = camera_get_parameters; + camera_ops->put_parameters = camera_put_parameters; + camera_ops->send_command = camera_send_command; + camera_ops->release = camera_release; + camera_ops->dump = camera_dump; + + *device = &camera_device->base.common; + } + + return rv; + +fail: + if(camera_device) { + free(camera_device); + camera_device = NULL; + } + if(camera_ops) { + free(camera_ops); + camera_ops = NULL; + } + *device = NULL; + return rv; +} + +int camera_get_number_of_cameras(void) +{ + ALOGV("%s", __FUNCTION__); + if (check_vendor_module()) + return 0; + return gVendorModule->get_number_of_cameras(); +} + +int camera_get_camera_info(int camera_id, struct camera_info *info) +{ + ALOGV("%s", __FUNCTION__); + if (check_vendor_module()) + return 0; + return gVendorModule->get_camera_info(camera_id, info); +} diff --git a/n7100.mk b/n7100.mk index 1633017..1bc8d45 100644 --- a/n7100.mk +++ b/n7100.mk @@ -38,9 +38,9 @@ PRODUCT_COPY_FILES += \ PRODUCT_COPY_FILES += \ $(LOCAL_PATH)/configs/tiny_hw.xml:system/etc/sound/t03g -# Camera +# Camera Wrapper PRODUCT_PACKAGES += \ - camera.smdk4x12 + camera.exynos4 # Gps PRODUCT_COPY_FILES += \ -- cgit v1.1 From da70a1e85f9fbc0ed2be6821a739d23e141dc383 Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Tue, 10 Jun 2014 20:42:17 +0530 Subject: remove TVout service --- rootdir/init.target.rc | 9 --------- 1 file changed, 9 deletions(-) diff --git a/rootdir/init.target.rc b/rootdir/init.target.rc index d3d5407..a1e4a08 100644 --- a/rootdir/init.target.rc +++ b/rootdir/init.target.rc @@ -70,12 +70,3 @@ service dmb /system/bin/dmbserver class main user system group radio inet misc audio camera graphics net_bt net_bt_admin sdcard_rw - -# TVout -service TvoutService_C /system/bin/bintvoutservice - class main - user system - group graphics - -on property:ro.tvout.enable=false - stop TvoutService_C -- cgit v1.1 From 25167a3ebc96d346ec41c8361a8396afac77ad5d Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Tue, 10 Jun 2014 21:22:28 +0530 Subject: Revert "n7100: fix up sensors" This reverts commit cd5145640187472147f77a2e9be8e7055097b581. --- libsensors/ProximitySensor.cpp | 1 - libsensors/SensorBase.cpp | 36 +++++++++++------------------------- libsensors/SensorBase.h | 1 - libsensors/sensors.h | 20 +++++--------------- 4 files changed, 16 insertions(+), 42 deletions(-) diff --git a/libsensors/ProximitySensor.cpp b/libsensors/ProximitySensor.cpp index f9579fa..404bdbc 100644 --- a/libsensors/ProximitySensor.cpp +++ b/libsensors/ProximitySensor.cpp @@ -88,7 +88,6 @@ int ProximitySensor::enable(int32_t handle, int en) { int flags = en ? 1 : 0; int err; - //ALOGD("%s: Enable: %i", __func__, en); if (flags != mEnabled) { err = sspEnable(LOGTAG, SSP_PROX, en); if(err >= 0){ diff --git a/libsensors/SensorBase.cpp b/libsensors/SensorBase.cpp index 2de3923..389edd7 100644 --- a/libsensors/SensorBase.cpp +++ b/libsensors/SensorBase.cpp @@ -144,49 +144,35 @@ int SensorBase::sspEnable(const char* sensorname, int sensorvalue, int en) int oldvalue = 0; int reset = 0; int newvalue; - int fd; + int fd, err; + char buf[10]; sspfile = fopen(SSP_DEVICE_ENABLE, "r+"); fscanf(sspfile, "%d", &oldvalue); fclose(sspfile); //Accel sensor is first on and last off, if we are disabling it -// assume the screen is off, disable all sensors and zero everything out -// to keep enable file in sync. +// assume the screen is off and zero everything out. if(sensorvalue == SSP_ACCEL && !en) { + newvalue = '\0'; //ALOGD("SensorBase: Resetting sensors"); - for(int i; i < 6; i++){ - newvalue = oldvalue - ssp_sensors[i]; - //ALOGD("SensorBase: newvalue: %i ",newvalue); - sspWrite(newvalue); - } - sspWrite('\0'); - return 0; } else if(en) { newvalue = oldvalue + sensorvalue; } else { newvalue = oldvalue - sensorvalue; } - //ALOGI("%s: name: %s sensor: %i old value: %i new value: %i ", __func__, sensorname, sensorvalue, oldvalue, newvalue); - sspWrite(newvalue); - return 0; -} -int SensorBase::sspWrite(int sensorvalue) -{ - char buf[10]; - int fd, ret, err; + sprintf(buf, "%d", newvalue); - sprintf(buf, "%d", sensorvalue); fd = open(SSP_DEVICE_ENABLE, O_RDWR); if (fd >= 0) { err = write(fd, buf, sizeof(buf)); - ret = 0; + //ALOGI("%s: sensor: %i old value: %i new value: %i ", sensorname, sensorvalue, oldvalue, newvalue); + close(fd); + return 0; } else { - ALOGI("%s: error writing to file", __func__); - ret = -1; + ALOGI("%s: error writing to file", sensorname); + close(fd); + return -1; } - - close(fd); - return ret; } diff --git a/libsensors/SensorBase.h b/libsensors/SensorBase.h index aeac510..d9e4b47 100644 --- a/libsensors/SensorBase.h +++ b/libsensors/SensorBase.h @@ -61,7 +61,6 @@ public: virtual int setDelay(int32_t handle, int64_t ns); virtual int enable(int32_t handle, int enabled) = 0; int sspEnable(const char* sensorname, int sensorvalue, int en); - int sspWrite(int sensorvalue); virtual int batch(int handle, int flags, int64_t period_ns, int64_t timeout); virtual int flush(int handle); diff --git a/libsensors/sensors.h b/libsensors/sensors.h index 713395b..a4fe794 100644 --- a/libsensors/sensors.h +++ b/libsensors/sensors.h @@ -52,16 +52,6 @@ __BEGIN_DECLS #define SSP_DEVICE_ENABLE "/sys/class/sensors/ssp_sensor/enable" -const int ssp_sensors[] = { - SSP_ACCEL, - SSP_GYRO, - SSP_MAG, - SSP_PRESS, - SSP_PROX, - SSP_LIGHT -}; - - /*****************************************************************************/ /* @@ -115,7 +105,7 @@ const int ssp_sensors[] = { // conversion of magnetic data to uT units #define CONVERT_M (1.0f/16.0f) -#define CONVERT_M_X (CONVERT_M) +#define CONVERT_M_X (-CONVERT_M) #define CONVERT_M_Y (CONVERT_M) #define CONVERT_M_Z (CONVERT_M) @@ -126,11 +116,11 @@ const int ssp_sensors[] = { #define CONVERT_O_R (CONVERT_O) // conversion of gyro data to SI units (radian/sec) -#define RANGE_GYRO (2000.0f*(float)M_PI/180.0f) +#define RANGE_GYRO (500.0f*(float)M_PI/180.0f) #define CONVERT_GYRO ((70.0f / 4000.0f) * ((float)M_PI / 180.0f)) -#define CONVERT_GYRO_X (CONVERT_GYRO) -#define CONVERT_GYRO_Y (CONVERT_GYRO) -#define CONVERT_GYRO_Z (CONVERT_GYRO) +#define CONVERT_GYRO_X (-CONVERT_GYRO) +#define CONVERT_GYRO_Y (-CONVERT_GYRO) +#define CONVERT_GYRO_Z (-CONVERT_GYRO) #define SENSOR_STATE_MASK (0x7FFF) -- cgit v1.1 From e4884eadc0332211a061f4643d4a978e2991a636 Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Tue, 10 Jun 2014 21:22:50 +0530 Subject: Revert "N7100: Open source sensors" This reverts commit 28e3038bf810016925668ff5d8236325d37aaab9. --- BoardConfig.mk | 3 + libsensors/AccelSensor.cpp | 155 --------------- libsensors/AccelSensor.h | 70 ------- libsensors/AkmSensor.cpp | 293 ---------------------------- libsensors/AkmSensor.h | 66 ------- libsensors/Android.mk | 47 ----- libsensors/GyroSensor.cpp | 177 ----------------- libsensors/GyroSensor.h | 55 ------ libsensors/InputEventReader.cpp | 88 --------- libsensors/InputEventReader.h | 47 ----- libsensors/LightSensor.cpp | 150 -------------- libsensors/LightSensor.h | 55 ------ libsensors/MODULE_LICENSE_APACHE2 | 0 libsensors/PressureSensor.cpp | 152 --------------- libsensors/PressureSensor.h | 54 ------ libsensors/ProximitySensor.cpp | 157 --------------- libsensors/ProximitySensor.h | 55 ------ libsensors/SensorBase.cpp | 178 ----------------- libsensors/SensorBase.h | 71 ------- libsensors/sensors.cpp | 397 -------------------------------------- libsensors/sensors.h | 131 ------------- n7100.mk | 4 - proprietary-files.txt | 6 + 23 files changed, 9 insertions(+), 2402 deletions(-) delete mode 100644 libsensors/AccelSensor.cpp delete mode 100644 libsensors/AccelSensor.h delete mode 100644 libsensors/AkmSensor.cpp delete mode 100644 libsensors/AkmSensor.h delete mode 100644 libsensors/Android.mk delete mode 100644 libsensors/GyroSensor.cpp delete mode 100644 libsensors/GyroSensor.h delete mode 100644 libsensors/InputEventReader.cpp delete mode 100644 libsensors/InputEventReader.h delete mode 100644 libsensors/LightSensor.cpp delete mode 100644 libsensors/LightSensor.h delete mode 100644 libsensors/MODULE_LICENSE_APACHE2 delete mode 100644 libsensors/PressureSensor.cpp delete mode 100644 libsensors/PressureSensor.h delete mode 100644 libsensors/ProximitySensor.cpp delete mode 100644 libsensors/ProximitySensor.h delete mode 100644 libsensors/SensorBase.cpp delete mode 100644 libsensors/SensorBase.h delete mode 100644 libsensors/sensors.cpp delete mode 100644 libsensors/sensors.h diff --git a/BoardConfig.mk b/BoardConfig.mk index 0286265..9c77a3f 100644 --- a/BoardConfig.mk +++ b/BoardConfig.mk @@ -44,6 +44,9 @@ TARGET_EXTERNAL_APPS = sdcard1 TARGET_RECOVERY_FSTAB := device/samsung/n7100/rootdir/fstab.smdk4x12 RECOVERY_FSTAB_VERSION := 2 +# Compatibility with pre-kitkat Sensor HALs +SENSORS_NEED_SETRATE_ON_ENABLE := true + # Selinux BOARD_SEPOLICY_DIRS += \ device/samsung/n7100/selinux diff --git a/libsensors/AccelSensor.cpp b/libsensors/AccelSensor.cpp deleted file mode 100644 index 2d02bc7..0000000 --- a/libsensors/AccelSensor.cpp +++ /dev/null @@ -1,155 +0,0 @@ -/* - * Copyright (C) 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. - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "AccelSensor.h" - -#define LOGTAG "AccelerometerSensor" - -/*****************************************************************************/ -AccelSensor::AccelSensor() - : SensorBase(NULL, "accelerometer_sensor"), - mEnabled(0), - - mInputReader(4), - mHasPendingEvent(false) -{ - mPendingEvent.version = sizeof(sensors_event_t); - mPendingEvent.sensor = ID_A; - mPendingEvent.type = SENSOR_TYPE_ACCELEROMETER; - memset(mPendingEvent.data, 0, sizeof(mPendingEvent.data)); - - if (data_fd) { - strcpy(input_sysfs_path, "/sys/class/input/"); - strcat(input_sysfs_path, input_name); - strcat(input_sysfs_path, "/device/"); - input_sysfs_path_len = strlen(input_sysfs_path); - } -} - -AccelSensor::~AccelSensor() { - - // ALOGD("AccelSensor::~AccelSensor()"); - if (mEnabled) { - enable(0, 0); - } -} - -int AccelSensor::setInitialState() -{ - return 0; -} - -int AccelSensor::enable(int32_t handle, int en) { - int flags = en ? 1 : 0; - int err; - if (flags != mEnabled) { - err = sspEnable(LOGTAG, SSP_ACCEL, en); - if(err >= 0){ - mEnabled = flags; - setInitialState(); - - return 0; - } - return -1; - } - return 0; -} - - -bool AccelSensor::hasPendingEvents() const { - /* FIXME probably here should be returning mEnabled but instead - mHasPendingEvents. It does not work, so we cheat.*/ - //ALOGD("AccelSensor::~hasPendingEvents %d", mHasPendingEvent ? 1 : 0 ); - return mHasPendingEvent; -} - - -int AccelSensor::setDelay(int32_t handle, int64_t ns) -{ - int fd; - - if (ns < 10000000) { - ns = 10000000; // Minimum on stock - } - - strcpy(&input_sysfs_path[input_sysfs_path_len], "acc_poll_delay"); - fd = open(input_sysfs_path, O_RDWR); - if (fd >= 0) { - char buf[80]; - sprintf(buf, "%lld", ns / 10000000 * 10); // Some flooring to match stock value - write(fd, buf, strlen(buf)+1); - close(fd); - return 0; - } - return -1; -} - - -int AccelSensor::readEvents(sensors_event_t* data, int count) -{ - if (count < 1) - return -EINVAL; - - if (mHasPendingEvent) { - mHasPendingEvent = false; - mPendingEvent.timestamp = getTimestamp(); - *data = mPendingEvent; - return mEnabled ? 1 : 0; - } - - ssize_t n = mInputReader.fill(data_fd); - if (n < 0) - return n; - int numEventReceived = 0; - input_event const* event; - - while (count && mInputReader.readEvent(&event)) { - int type = event->type; - if (type == EV_REL) { - float value = event->value; - if (event->code == EVENT_TYPE_ACCEL_X) { - mPendingEvent.acceleration.x = value * CONVERT_A_X; - } else if (event->code == EVENT_TYPE_ACCEL_Y) { - mPendingEvent.acceleration.y = value * CONVERT_A_Y; - } else if (event->code == EVENT_TYPE_ACCEL_Z) { - mPendingEvent.acceleration.z = value * CONVERT_A_Z; - } - } else if (type == EV_SYN) { - mPendingEvent.timestamp = timevalToNano(event->time); - if (mEnabled) { - *data++ = mPendingEvent; - count--; - numEventReceived++; - } - } else { - ALOGE("%s: unknown event (type=%d, code=%d)", LOGTAG, - type, event->code); - } - - mInputReader.next(); - } - return numEventReceived++; - -} diff --git a/libsensors/AccelSensor.h b/libsensors/AccelSensor.h deleted file mode 100644 index 0162147..0000000 --- a/libsensors/AccelSensor.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (C) 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. - */ - -#ifndef ANDROID_SMB380_SENSOR_H -#define ANDROID_SMB380_SENSOR_H - -#include -#include -#include -#include - -#include "sensors.h" -#include "SensorBase.h" -#include "InputEventReader.h" - -/*****************************************************************************/ - - -struct smb380acc_t { - short x, /**< holds x-axis acceleration data sign extended. Range -512 to 511. */ - y, /**< holds y-axis acceleration data sign extended. Range -512 to 511. */ - z; /**< holds z-axis acceleration data sign extended. Range -512 to 511. */ -} ; - -/* smb ioctl command label */ -#define IOCTL_SMB_GET_ACC_VALUE 0 -#define DCM_IOC_MAGIC 's' -#define IOC_SET_ACCELEROMETER _IO (DCM_IOC_MAGIC, 0x64) -#define BMA150_CALIBRATION _IOWR(DCM_IOC_MAGIC,48,short) - -#define SMB_POWER_OFF 0 -#define SMB_POWER_ON 1 - -struct input_event; - -class AccelSensor : public SensorBase { - int mEnabled; - InputEventCircularReader mInputReader; - sensors_event_t mPendingEvent; - bool mHasPendingEvent; - char input_sysfs_path[PATH_MAX]; - int input_sysfs_path_len; - - int setInitialState(); - -public: - AccelSensor(); - virtual ~AccelSensor(); - virtual int readEvents(sensors_event_t* data, int count); - virtual bool hasPendingEvents() const; - virtual int setDelay(int32_t handle, int64_t ns); - virtual int enable(int32_t handle, int enabled); -}; - -/*****************************************************************************/ - -#endif // ANDROID_GYRO_SENSOR_H diff --git a/libsensors/AkmSensor.cpp b/libsensors/AkmSensor.cpp deleted file mode 100644 index 160df2a..0000000 --- a/libsensors/AkmSensor.cpp +++ /dev/null @@ -1,293 +0,0 @@ -/* - * Copyright (C) 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. - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include "AkmSensor.h" - -#define LOGTAG "AkmSensor" - -//#define ALOG_NDEBUG 0 - -/*****************************************************************************/ - -int (*akm_is_sensor_enabled)(uint32_t sensor_type); -int (*akm_enable_sensor)(uint32_t sensor_type); -int (*akm_disable_sensor)(uint32_t sensor_type); -int (*akm_set_delay)(uint32_t sensor_type, uint64_t delay); - -int stub_is_sensor_enabled(uint32_t sensor_type) { - return 0; -} - -int stub_enable_disable_sensor(uint32_t sensor_type) { - return -ENODEV; -} - -int stub_set_delay(uint32_t sensor_type, uint64_t delay) { - return -ENODEV; -} - - -AkmSensor::AkmSensor() -: SensorBase(NULL, NULL), - mEnabled(0), - mPendingMask(0), - mInputReader(32) -{ - /* Open the library before opening the input device. The library - * creates a uinput device. - */ - if (loadAKMLibrary() == 0) { - data_name = "compass_sensor"; - data_fd = openInput("compass_sensor"); - } - - //Incase first time fails - if(data_fd < 0){ - ALOGI("%s: retrying to open compass sensor", LOGTAG); - data_fd = openInput("compass_sensor"); - } - - if(data_fd > 0){ - ALOGI("%s: compass sensor successfully opened: %i", LOGTAG, data_fd); - }else{ - ALOGI("%s: failed to open compass sensor", LOGTAG); - } - - memset(mPendingEvents, 0, sizeof(mPendingEvents)); - - mPendingEvents[MagneticField].version = sizeof(sensors_event_t); - mPendingEvents[MagneticField].sensor = ID_M; - mPendingEvents[MagneticField].type = SENSOR_TYPE_MAGNETIC_FIELD; - mPendingEvents[MagneticField].magnetic.status = SENSOR_STATUS_ACCURACY_HIGH; - - mPendingEvents[Orientation ].version = sizeof(sensors_event_t); - mPendingEvents[Orientation ].sensor = ID_O; - mPendingEvents[Orientation ].type = SENSOR_TYPE_ORIENTATION; - mPendingEvents[Orientation ].orientation.status = SENSOR_STATUS_ACCURACY_HIGH; - - // read the actual value of all sensors if they're enabled already - struct input_absinfo absinfo; - short flags = 0; - if (akm_is_sensor_enabled(SENSOR_TYPE_MAGNETIC_FIELD)) { - mEnabled |= 1<= numSensors) - return -EINVAL; - - int newState = en ? 1 : 0; - int err = 0; - - if ((uint32_t(newState)<= 0) { - char buf[80]; - sprintf(buf, "%lld", ns); - write(fd, buf, strlen(buf)+1); - close(fd); - } - - mDelays[what] = ns; - return 0; -} - -int AkmSensor::loadAKMLibrary() -{ - mLibAKM = dlopen("libakm.so", RTLD_NOW); - - if (!mLibAKM) { - akm_is_sensor_enabled = stub_is_sensor_enabled; - akm_enable_sensor = stub_enable_disable_sensor; - akm_disable_sensor = stub_enable_disable_sensor; - akm_set_delay = stub_set_delay; - ALOGE("%s: unable to load AKM Library, %s", LOGTAG, dlerror()); - return -ENOENT; - } - - *(void **)&akm_is_sensor_enabled = dlsym(mLibAKM, "akm_is_sensor_enabled"); - *(void **)&akm_enable_sensor = dlsym(mLibAKM, "akm_enable_sensor"); - *(void **)&akm_disable_sensor = dlsym(mLibAKM, "akm_disable_sensor"); - *(void **)&akm_set_delay = dlsym(mLibAKM, "akm_set_delay"); - - return 0; -} - -int AkmSensor::readEvents(sensors_event_t* data, int count) -{ - if (count < 1) - return -EINVAL; - - ssize_t n = mInputReader.fill(data_fd); - if (n < 0) - return n; - - int numEventReceived = 0; - input_event const* event; - - while (count && mInputReader.readEvent(&event)) { - int type = event->type; - if (type == EV_REL) { - processEvent(event->code, event->value); - mInputReader.next(); - } else if (type == EV_ABS) { - processEvent(event->code, event->value); - mInputReader.next(); - } else if (type == EV_SYN) { - int64_t time = timevalToNano(event->time); - for (int j=0 ; count && mPendingMask && jcode); - mInputReader.next(); - } - } - return numEventReceived; -} - -void AkmSensor::processEvent(int code, int value) -{ - switch (code) { - case EVENT_TYPE_MAGV_X: - mPendingMask |= 1< -#include -#include -#include - - -#include "sensors.h" -#include "SensorBase.h" -#include "InputEventReader.h" - -/*****************************************************************************/ - -struct input_event; - -class AkmSensor : public SensorBase { -public: - AkmSensor(); - virtual ~AkmSensor(); - - enum { - Accelerometer = 0, - MagneticField = 1, - Orientation = 2, - numSensors - }; - - virtual int setDelay(int32_t handle, int64_t ns); - virtual int enable(int32_t handle, int enabled); - virtual int readEvents(sensors_event_t* data, int count); - void processEvent(int code, int value); - - int setInitialState(); - -private: - int loadAKMLibrary(); - int update_delay(); - void *mLibAKM; - uint32_t mEnabled; - uint32_t mPendingMask; - InputEventCircularReader mInputReader; - sensors_event_t mPendingEvents[numSensors]; - uint64_t mDelays[numSensors]; -}; - -/*****************************************************************************/ - -#endif // ANDROID_AKM_SENSOR_H diff --git a/libsensors/Android.mk b/libsensors/Android.mk deleted file mode 100644 index 47a90e5..0000000 --- a/libsensors/Android.mk +++ /dev/null @@ -1,47 +0,0 @@ -# Copyright (C) 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. - - -LOCAL_PATH := $(call my-dir) - -ifneq ($(TARGET_SIMULATOR),true) - -# HAL module implemenation, not prelinked, and stored in -# hw/..so -include $(CLEAR_VARS) - -LOCAL_MODULE := sensors.$(TARGET_BOOTLOADER_BOARD_NAME) - -LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw - -LOCAL_MODULE_TAGS := optional - -LOCAL_CFLAGS := -DALOG_TAG=\"Sensors\" -LOCAL_SRC_FILES := \ - sensors.cpp \ - SensorBase.cpp \ - LightSensor.cpp \ - ProximitySensor.cpp \ - AkmSensor.cpp \ - GyroSensor.cpp \ - InputEventReader.cpp \ - AccelSensor.cpp \ - PressureSensor.cpp - -LOCAL_SHARED_LIBRARIES := liblog libcutils libdl -LOCAL_PRELINK_MODULE := false - -include $(BUILD_SHARED_LIBRARY) - -endif # !TARGET_SIMULATOR diff --git a/libsensors/GyroSensor.cpp b/libsensors/GyroSensor.cpp deleted file mode 100644 index d6dc944..0000000 --- a/libsensors/GyroSensor.cpp +++ /dev/null @@ -1,177 +0,0 @@ -/* - * Copyright (C) 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. - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "GyroSensor.h" - -#define LOGTAG "GyroSensor" - -#define FETCH_FULL_EVENT_BEFORE_RETURN 1 -#define IGNORE_EVENT_TIME 350000000 -/*****************************************************************************/ - -GyroSensor::GyroSensor() - : SensorBase(NULL, "gyro_sensor"), - mEnabled(0), - mInputReader(4), - mHasPendingEvent(false), - mEnabledTime(0) -{ - mPendingEvent.version = sizeof(sensors_event_t); - mPendingEvent.sensor = ID_GY; - mPendingEvent.type = SENSOR_TYPE_GYROSCOPE; - memset(mPendingEvent.data, 0, sizeof(mPendingEvent.data)); - - if (data_fd) { - strcpy(input_sysfs_path, "/sys/class/input/"); - strcat(input_sysfs_path, input_name); - strcat(input_sysfs_path, "/device/"); - input_sysfs_path_len = strlen(input_sysfs_path); - enable(0, 1); - } -} - -GyroSensor::~GyroSensor() { - if (mEnabled) { - enable(0, 0); - } -} - -int GyroSensor::setInitialState() { - struct input_absinfo absinfo_x; - struct input_absinfo absinfo_y; - struct input_absinfo absinfo_z; - float value; - if (!ioctl(data_fd, EVIOCGABS(EVENT_TYPE_GYRO_X), &absinfo_x) && - !ioctl(data_fd, EVIOCGABS(EVENT_TYPE_GYRO_X), &absinfo_y) && - !ioctl(data_fd, EVIOCGABS(EVENT_TYPE_GYRO_X), &absinfo_z)) { - value = absinfo_x.value; - mPendingEvent.data[0] = value * CONVERT_GYRO_X; - value = absinfo_x.value; - mPendingEvent.data[1] = value * CONVERT_GYRO_Y; - value = absinfo_x.value; - mPendingEvent.data[2] = value * CONVERT_GYRO_Z; - mHasPendingEvent = true; - } - return 0; -} - -int GyroSensor::enable(int32_t handle, int en) { - int flags = en ? 1 : 0; - int err; - if (flags != mEnabled) { - if(err >= 0){ - mEnabled = flags; - err = sspEnable(LOGTAG, SSP_GYRO, en); - setInitialState(); - - return 0; - } - return -1; - } - return 0; -} - -bool GyroSensor::hasPendingEvents() const { - return mHasPendingEvent; -} - -int GyroSensor::setDelay(int32_t handle, int64_t ns) -{ - int fd; - - strcpy(&input_sysfs_path[input_sysfs_path_len], "gyro_poll_delay"); - fd = open(input_sysfs_path, O_RDWR); - if (fd >= 0) { - char buf[80]; - sprintf(buf, "%lld", ns); - write(fd, buf, strlen(buf)+1); - close(fd); - return 0; - } - return -1; -} - -int GyroSensor::readEvents(sensors_event_t* data, int count) -{ - if (count < 1) - return -EINVAL; - - if (mHasPendingEvent) { - mHasPendingEvent = false; - mPendingEvent.timestamp = getTimestamp(); - *data = mPendingEvent; - return mEnabled ? 1 : 0; - } - - ssize_t n = mInputReader.fill(data_fd); - if (n < 0) - return n; - - int numEventReceived = 0; - input_event const* event; - -#if FETCH_FULL_EVENT_BEFORE_RETURN -again: -#endif - while (count && mInputReader.readEvent(&event)) { - int type = event->type; - if (type == EV_REL) { - float value = event->value; - if (event->code == EVENT_TYPE_GYRO_X) { - mPendingEvent.data[0] = value * CONVERT_GYRO_X; - } else if (event->code == EVENT_TYPE_GYRO_Y) { - mPendingEvent.data[1] = value * CONVERT_GYRO_Y; - } else if (event->code == EVENT_TYPE_GYRO_Z) { - mPendingEvent.data[2] = value * CONVERT_GYRO_Z; - } - } else if (type == EV_SYN) { - mPendingEvent.timestamp = timevalToNano(event->time); - if (mEnabled) { - if (mPendingEvent.timestamp >= mEnabledTime) { - *data++ = mPendingEvent; - numEventReceived++; - } - count--; - } - } else { - ALOGE("%s: unknown event (type=%d, code=%d)", LOGTAG, - type, event->code); - } - mInputReader.next(); - } - -#if FETCH_FULL_EVENT_BEFORE_RETURN - /* if we didn't read a complete event, see if we can fill and - try again instead of returning with nothing and redoing poll. */ - if (numEventReceived == 0 && mEnabled == 1) { - n = mInputReader.fill(data_fd); - if (n) - goto again; - } -#endif - - return numEventReceived; -} - diff --git a/libsensors/GyroSensor.h b/libsensors/GyroSensor.h deleted file mode 100644 index e8997de..0000000 --- a/libsensors/GyroSensor.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (C) 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. - */ - -#ifndef ANDROID_GYRO_SENSOR_H -#define ANDROID_GYRO_SENSOR_H - -#include -#include -#include -#include - -#include "sensors.h" -#include "SensorBase.h" -#include "InputEventReader.h" - -/*****************************************************************************/ - -struct input_event; - -class GyroSensor : public SensorBase { - int mEnabled; - InputEventCircularReader mInputReader; - sensors_event_t mPendingEvent; - bool mHasPendingEvent; - char input_sysfs_path[PATH_MAX]; - int input_sysfs_path_len; - int64_t mEnabledTime; - - int setInitialState(); - -public: - GyroSensor(); - virtual ~GyroSensor(); - virtual int readEvents(sensors_event_t* data, int count); - virtual bool hasPendingEvents() const; - virtual int setDelay(int32_t handle, int64_t ns); - virtual int enable(int32_t handle, int enabled); -}; - -/*****************************************************************************/ - -#endif // ANDROID_GYRO_SENSOR_H diff --git a/libsensors/InputEventReader.cpp b/libsensors/InputEventReader.cpp deleted file mode 100644 index 1014f29..0000000 --- a/libsensors/InputEventReader.cpp +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (C) 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. - */ - -#include -#include -#include -#include - -#include -#include - -#include - -#include - -#include "InputEventReader.h" - -/*****************************************************************************/ - -struct input_event; - -InputEventCircularReader::InputEventCircularReader(size_t numEvents) - : mBuffer(new input_event[numEvents * 2]), - mBufferEnd(mBuffer + numEvents), - mHead(mBuffer), - mCurr(mBuffer), - mFreeSpace(numEvents) -{ -} - -InputEventCircularReader::~InputEventCircularReader() -{ - delete [] mBuffer; -} - -ssize_t InputEventCircularReader::fill(int fd) -{ - size_t numEventsRead = 0; - if (mFreeSpace) { - const ssize_t nread = read(fd, mHead, mFreeSpace * sizeof(input_event)); - if (nread<0 || nread % sizeof(input_event)) { - // we got a partial event!! - return nread<0 ? -errno : -EINVAL; - } - - numEventsRead = nread / sizeof(input_event); - if (numEventsRead) { - mHead += numEventsRead; - mFreeSpace -= numEventsRead; - if (mHead > mBufferEnd) { - size_t s = mHead - mBufferEnd; - memcpy(mBuffer, mBufferEnd, s * sizeof(input_event)); - mHead = mBuffer + s; - } - } - } - - return numEventsRead; -} - -ssize_t InputEventCircularReader::readEvent(input_event const** events) -{ - *events = mCurr; - ssize_t available = (mBufferEnd - mBuffer) - mFreeSpace; - return available ? 1 : 0; -} - -void InputEventCircularReader::next() -{ - mCurr++; - mFreeSpace++; - if (mCurr >= mBufferEnd) { - mCurr = mBuffer; - } -} diff --git a/libsensors/InputEventReader.h b/libsensors/InputEventReader.h deleted file mode 100644 index 180aade..0000000 --- a/libsensors/InputEventReader.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (C) 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. - */ - -#ifndef ANDROID_INPUT_EVENT_READER_H -#define ANDROID_INPUT_EVENT_READER_H - -#include -#include -#include -#include - -/*****************************************************************************/ - -struct input_event; - -class InputEventCircularReader -{ - struct input_event* const mBuffer; - struct input_event* const mBufferEnd; - struct input_event* mHead; - struct input_event* mCurr; - ssize_t mFreeSpace; - -public: - InputEventCircularReader(size_t numEvents); - ~InputEventCircularReader(); - ssize_t fill(int fd); - ssize_t readEvent(input_event const** events); - void next(); -}; - -/*****************************************************************************/ - -#endif // ANDROID_INPUT_EVENT_READER_H diff --git a/libsensors/LightSensor.cpp b/libsensors/LightSensor.cpp deleted file mode 100644 index 856000b..0000000 --- a/libsensors/LightSensor.cpp +++ /dev/null @@ -1,150 +0,0 @@ -/* - * Copyright (C) 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. - */ - -#include -#include -#include -#include -#include -#include -#include - -#include - -#include - -#include "LightSensor.h" - -#define LOGTAG "LightSensor" - -// #define ALOG_NDEBUG 0 - -/*****************************************************************************/ - -LightSensor::LightSensor() - : SensorBase(NULL, "light_sensor"), - mEnabled(0), - mInputReader(4), - mHasPendingEvent(false) -{ - mPendingEvent.version = sizeof(sensors_event_t); - mPendingEvent.sensor = ID_L; - mPendingEvent.type = SENSOR_TYPE_LIGHT; - memset(mPendingEvent.data, 0, sizeof(mPendingEvent.data)); - - if (data_fd) { - strcpy(input_sysfs_path, "/sys/class/input/"); - strcat(input_sysfs_path, input_name); - strcat(input_sysfs_path, "/device/"); - input_sysfs_path_len = strlen(input_sysfs_path); - enable(0, 1); - } -} - -LightSensor::~LightSensor() { - if (mEnabled) { - enable(0, 0); - } -} - -int LightSensor::setInitialState() { - struct input_absinfo absinfo; - if (!ioctl(data_fd, EVIOCGABS(EVENT_TYPE_LIGHT), &absinfo)) { - // make sure to report an event immediately - mHasPendingEvent = true; - mPendingEvent.light = absinfo.value; - } - return 0; -} - -int LightSensor::setDelay(int32_t handle, int64_t ns) -{ - int fd; - - strcpy(&input_sysfs_path[input_sysfs_path_len], "light_poll_delay"); - fd = open(input_sysfs_path, O_RDWR); - if (fd >= 0) { - char buf[80]; - sprintf(buf, "%lld", ns); - write(fd, buf, strlen(buf)+1); - close(fd); - return 0; - } - return -1; -} - -int LightSensor::enable(int32_t handle, int en) -{ - int flags = en ? 1 : 0; - int err; - if (flags != mEnabled) { - err = sspEnable(LOGTAG, SSP_LIGHT, en); - if(err >= 0){ - mEnabled = flags; - setInitialState(); - - return 0; - } - return -1; - } - return 0; -} - -bool LightSensor::hasPendingEvents() const { - return mHasPendingEvent; -} - -int LightSensor::readEvents(sensors_event_t* data, int count) -{ - if (count < 1) - return -EINVAL; - - if (mHasPendingEvent) { - mHasPendingEvent = false; - mPendingEvent.timestamp = getTimestamp(); - *data = mPendingEvent; - return mEnabled ? 1 : 0; - } - - ssize_t n = mInputReader.fill(data_fd); - if (n < 0) - return n; - - int numEventReceived = 0; - input_event const* event; - - while (count && mInputReader.readEvent(&event)) { - int type = event->type; - if (type == EV_REL) { - if (event->code == EVENT_TYPE_LIGHT) { - mPendingEvent.light = event->value; - } - } else if (type == EV_SYN) { - mPendingEvent.timestamp = timevalToNano(event->time); - if (mEnabled) { - *data++ = mPendingEvent; - count--; - numEventReceived++; - } - } else { - ALOGE("%s: unknown event (type=%d, code=%d)", LOGTAG, - type, event->code); - } - mInputReader.next(); - } - - return numEventReceived; -} diff --git a/libsensors/LightSensor.h b/libsensors/LightSensor.h deleted file mode 100644 index 85e65d9..0000000 --- a/libsensors/LightSensor.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (C) 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. - */ - -#ifndef ANDROID_LIGHT_SENSOR_H -#define ANDROID_LIGHT_SENSOR_H - -#include -#include -#include -#include - -#include "sensors.h" -#include "SensorBase.h" -#include "InputEventReader.h" - -/*****************************************************************************/ - -struct input_event; - -class LightSensor : public SensorBase { - int mEnabled; - InputEventCircularReader mInputReader; - sensors_event_t mPendingEvent; - bool mHasPendingEvent; - char input_sysfs_path[PATH_MAX]; - int input_sysfs_path_len; - - float indexToValue(size_t index) const; - int setInitialState(); - -public: - LightSensor(); - virtual ~LightSensor(); - virtual int readEvents(sensors_event_t* data, int count); - virtual bool hasPendingEvents() const; - virtual int setDelay(int32_t handle, int64_t ns); - virtual int enable(int32_t handle, int enabled); -}; - -/*****************************************************************************/ - -#endif // ANDROID_LIGHT_SENSOR_H diff --git a/libsensors/MODULE_LICENSE_APACHE2 b/libsensors/MODULE_LICENSE_APACHE2 deleted file mode 100644 index e69de29..0000000 diff --git a/libsensors/PressureSensor.cpp b/libsensors/PressureSensor.cpp deleted file mode 100644 index 0ce514f..0000000 --- a/libsensors/PressureSensor.cpp +++ /dev/null @@ -1,152 +0,0 @@ -/* - * Copyright (C) 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. - */ - -#include -#include -#include -#include -#include -#include -#include - -#include - -#include "PressureSensor.h" - -#define LOGTAG "PressureSensor" - -/* - * The BMP driver gives pascal values. - * It needs to be changed into hectoPascal - */ -#define PRESSURE_HECTO (1.0f/100.0f) - -/*****************************************************************************/ - -PressureSensor::PressureSensor() - : SensorBase(NULL, "pressure_sensor"), - mEnabled(0), - mInputReader(4), - mHasPendingEvent(false) -{ - mPendingEvent.version = sizeof(sensors_event_t); - mPendingEvent.sensor = ID_PR; - mPendingEvent.type = SENSOR_TYPE_PRESSURE; - memset(mPendingEvent.data, 0, sizeof(mPendingEvent.data)); - - if (data_fd) { - strcpy(input_sysfs_path, "/sys/class/input/"); - strcat(input_sysfs_path, input_name); - strcat(input_sysfs_path, "/device/"); - input_sysfs_path_len = strlen(input_sysfs_path); - enable(0, 1); - } -} - -PressureSensor::~PressureSensor() { - if (mEnabled) { - enable(0, 0); - } -} - -int PressureSensor::setInitialState() { - struct input_absinfo absinfo; - if (!ioctl(data_fd, EVIOCGABS(EVENT_TYPE_PRESSURE), &absinfo)) { - // make sure to report an event immediately - mHasPendingEvent = true; - mPendingEvent.pressure = absinfo.value * PRESSURE_HECTO; - } - return 0; -} - -int PressureSensor::enable(int32_t handle, int en) { - int flags = en ? 1 : 0; - int err; - if (flags != mEnabled) { - err = sspEnable(LOGTAG, SSP_PRESS, en); - if(err >= 0){ - mEnabled = flags; - setInitialState(); - - return 0; - } - return -1; - } - return 0; -} - -bool PressureSensor::hasPendingEvents() const { - return mHasPendingEvent; -} - -int PressureSensor::setDelay(int32_t handle, int64_t ns) -{ - int fd; - - strcpy(&input_sysfs_path[input_sysfs_path_len], "pressure_poll_delay"); - fd = open(input_sysfs_path, O_RDWR); - if (fd >= 0) { - char buf[80]; - sprintf(buf, "%lld", ns); - write(fd, buf, strlen(buf)+1); - close(fd); - return 0; - } - return -1; -} - - -int PressureSensor::readEvents(sensors_event_t* data, int count) -{ - if (count < 1) - return -EINVAL; - - if (mHasPendingEvent) { - mHasPendingEvent = false; - mPendingEvent.timestamp = getTimestamp(); - *data = mPendingEvent; - return mEnabled ? 1 : 0; - } - - ssize_t n = mInputReader.fill(data_fd); - if (n < 0) - return n; - - int numEventReceived = 0; - input_event const* event; - - while (count && mInputReader.readEvent(&event)) { - int type = event->type; - if (type == EV_REL) { - if (event->code == EVENT_TYPE_PRESSURE) { - mPendingEvent.pressure = event->value * PRESSURE_HECTO; - } - } else if (type == EV_SYN) { - mPendingEvent.timestamp = timevalToNano(event->time); - if (mEnabled) { - *data++ = mPendingEvent; - count--; - numEventReceived++; - } - } else { - ALOGE("%s: unknown event (type=%d, code=%d)", LOGTAG, - type, event->code); - } - mInputReader.next(); - } - - return numEventReceived; -} diff --git a/libsensors/PressureSensor.h b/libsensors/PressureSensor.h deleted file mode 100644 index 9333d44..0000000 --- a/libsensors/PressureSensor.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (C) 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. - */ - -#ifndef ANDROID_PRESSURE_SENSOR_H -#define ANDROID_PRESSURE_SENSOR_H - -#include -#include -#include -#include - -#include "sensors.h" -#include "SensorBase.h" -#include "InputEventReader.h" - -/*****************************************************************************/ - -struct input_event; - -class PressureSensor : public SensorBase { - int mEnabled; - InputEventCircularReader mInputReader; - sensors_event_t mPendingEvent; - bool mHasPendingEvent; - char input_sysfs_path[PATH_MAX]; - int input_sysfs_path_len; - - int setInitialState(); - -public: - PressureSensor(); - virtual ~PressureSensor(); - virtual int readEvents(sensors_event_t* data, int count); - virtual bool hasPendingEvents() const; - virtual int enable(int32_t handle, int enabled); - virtual int setDelay(int32_t handle, int64_t ns); -}; - -/*****************************************************************************/ - -#endif // ANDROID_PRESSURE_SENSOR_H diff --git a/libsensors/ProximitySensor.cpp b/libsensors/ProximitySensor.cpp deleted file mode 100644 index 404bdbc..0000000 --- a/libsensors/ProximitySensor.cpp +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Copyright (C) 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. - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include "ProximitySensor.h" -#include "SensorBase.h" - -#define LOGTAG "ProximitySensor" - -/*****************************************************************************/ - -ProximitySensor::ProximitySensor() - : SensorBase(NULL, "proximity_sensor"), - mEnabled(0), - mInputReader(4), - mHasPendingEvent(false) -{ - mPendingEvent.version = sizeof(sensors_event_t); - mPendingEvent.sensor = ID_P; - mPendingEvent.type = SENSOR_TYPE_PROXIMITY; - memset(mPendingEvent.data, 0, sizeof(mPendingEvent.data)); - - if (data_fd) { - strcpy(input_sysfs_path, "/sys/class/input/"); - strcat(input_sysfs_path, input_name); - strcat(input_sysfs_path, "/device/"); - input_sysfs_path_len = strlen(input_sysfs_path); - enable(0, 1); - } -} - -ProximitySensor::~ProximitySensor() { - if (mEnabled) { - enable(0, 0); - } -} - -int ProximitySensor::setInitialState() { - struct input_absinfo absinfo; - if (!ioctl(data_fd, EVIOCGABS(EVENT_TYPE_PROXIMITY), &absinfo)) { - // make sure to report an event immediately - mHasPendingEvent = true; - mPendingEvent.distance = indexToValue(absinfo.value); - } - return 0; -} - -int ProximitySensor::setDelay(int32_t handle, int64_t ns) -{ - int fd; - - strcpy(&input_sysfs_path[input_sysfs_path_len], "prox_poll_delay"); - fd = open(input_sysfs_path, O_RDWR); - if (fd >= 0) { - char buf[80]; - sprintf(buf, "%lld", ns); - write(fd, buf, strlen(buf)+1); - close(fd); - return 0; - } - return -1; -} - -int ProximitySensor::enable(int32_t handle, int en) { - - int flags = en ? 1 : 0; - int err; - if (flags != mEnabled) { - err = sspEnable(LOGTAG, SSP_PROX, en); - if(err >= 0){ - mEnabled = flags; - setInitialState(); - - return 0; - } - return -1; - } - return 0; -} - -bool ProximitySensor::hasPendingEvents() const { - return mHasPendingEvent; -} - -int ProximitySensor::readEvents(sensors_event_t* data, int count) -{ - if (count < 1) - return -EINVAL; - - if (mHasPendingEvent) { - mHasPendingEvent = false; - mPendingEvent.timestamp = getTimestamp(); - *data = mPendingEvent; - return mEnabled ? 1 : 0; - } - - ssize_t n = mInputReader.fill(data_fd); - if (n < 0) - return n; - - int numEventReceived = 0; - input_event const* event; - - while (count && mInputReader.readEvent(&event)) { - int type = event->type; - if (type == EV_ABS) { - if (event->code == EVENT_TYPE_PROXIMITY) { - if (event->value != -1) { - // FIXME: not sure why we're getting -1 sometimes - mPendingEvent.distance = indexToValue(event->value); - } - } - } else if (type == EV_SYN) { - mPendingEvent.timestamp = timevalToNano(event->time); - if (mEnabled) { - *data++ = mPendingEvent; - count--; - numEventReceived++; - } - } else { - ALOGE("%s: unknown event (type=%d, code=%d)",LOGTAG, - type, event->code); - } - mInputReader.next(); - } - - return numEventReceived; -} - -float ProximitySensor::indexToValue(size_t index) const -{ - ALOGV("%s: Index = %zu",LOGTAG, index); - return index * PROXIMITY_THRESHOLD_CM; -} diff --git a/libsensors/ProximitySensor.h b/libsensors/ProximitySensor.h deleted file mode 100644 index a6aa851..0000000 --- a/libsensors/ProximitySensor.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (C) 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. - */ - -#ifndef ANDROID_PROXIMITY_SENSOR_H -#define ANDROID_PROXIMITY_SENSOR_H - -#include -#include -#include -#include - -#include "sensors.h" -#include "SensorBase.h" -#include "InputEventReader.h" - -/*****************************************************************************/ - -struct input_event; - -class ProximitySensor : public SensorBase { - int mEnabled; - InputEventCircularReader mInputReader; - sensors_event_t mPendingEvent; - bool mHasPendingEvent; - char input_sysfs_path[PATH_MAX]; - int input_sysfs_path_len; - - int setInitialState(); - float indexToValue(size_t index) const; - -public: - ProximitySensor(); - virtual ~ProximitySensor(); - virtual int readEvents(sensors_event_t* data, int count); - virtual bool hasPendingEvents() const; - virtual int enable(int32_t handle, int enabled); - virtual int setDelay(int32_t handle, int64_t ns); -}; - -/*****************************************************************************/ - -#endif // ANDROID_PROXIMITY_SENSOR_H diff --git a/libsensors/SensorBase.cpp b/libsensors/SensorBase.cpp deleted file mode 100644 index 389edd7..0000000 --- a/libsensors/SensorBase.cpp +++ /dev/null @@ -1,178 +0,0 @@ -/* - * Copyright (C) 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. - */ - -#include -#include -#include -#include -#include -#include -#include - -#include - -#include - -#include "SensorBase.h" - -/*****************************************************************************/ - -SensorBase::SensorBase( - const char* dev_name, - const char* data_name) - : dev_name(dev_name), data_name(data_name), - dev_fd(-1), data_fd(-1) -{ - if (data_name) { - data_fd = openInput(data_name); - } -} - -SensorBase::~SensorBase() { - if (data_fd >= 0) { - close(data_fd); - } - if (dev_fd >= 0) { - close(dev_fd); - } -} - -int SensorBase::open_device() { - if (dev_fd<0 && dev_name) { - dev_fd = open(dev_name, O_RDONLY); - ALOGE_IF(dev_fd<0, "Couldn't open %s (%s)", dev_name, strerror(errno)); - } - return 0; -} - -int SensorBase::close_device() { - if (dev_fd >= 0) { - close(dev_fd); - dev_fd = -1; - } - return 0; -} - -int SensorBase::getFd() const { - if (!data_name) { - return dev_fd; - } - return data_fd; -} - -int SensorBase::setDelay(int32_t handle, int64_t ns) { - return 0; -} - -bool SensorBase::hasPendingEvents() const { - return false; -} - -int64_t SensorBase::getTimestamp() { - struct timespec t; - t.tv_sec = t.tv_nsec = 0; - clock_gettime(CLOCK_MONOTONIC, &t); - return int64_t(t.tv_sec)*1000000000LL + t.tv_nsec; -} - -int SensorBase::openInput(const char* inputName) { - int fd = -1; - const char *dirname = "/dev/input"; - char devname[PATH_MAX]; - char *filename; - DIR *dir; - struct dirent *de; - dir = opendir(dirname); - if(dir == NULL) - return -1; - strcpy(devname, dirname); - filename = devname + strlen(devname); - *filename++ = '/'; - while((de = readdir(dir))) { - if(de->d_name[0] == '.' && - (de->d_name[1] == '\0' || - (de->d_name[1] == '.' && de->d_name[2] == '\0'))) - continue; - strcpy(filename, de->d_name); - fd = open(devname, O_RDONLY); - if (fd>=0) { - char name[80]; - if (ioctl(fd, EVIOCGNAME(sizeof(name) - 1), &name) < 1) { - name[0] = '\0'; - } - if (!strcmp(name, inputName)) { - strcpy(input_name, filename); - break; - } else { - close(fd); - fd = -1; - } - } - } - closedir(dir); - ALOGE_IF(fd<0, "couldn't find '%s' input device", inputName); - - return fd; -} - -int SensorBase::batch(int handle, int flags, int64_t period_ns, int64_t timeout) -{ - return 0; -} - -int SensorBase::flush(int handle) -{ - return 0; -} - -int SensorBase::sspEnable(const char* sensorname, int sensorvalue, int en) -{ - FILE* sspfile; - int oldvalue = 0; - int reset = 0; - int newvalue; - int fd, err; - char buf[10]; - - sspfile = fopen(SSP_DEVICE_ENABLE, "r+"); - fscanf(sspfile, "%d", &oldvalue); - fclose(sspfile); - -//Accel sensor is first on and last off, if we are disabling it -// assume the screen is off and zero everything out. - if(sensorvalue == SSP_ACCEL && !en) { - newvalue = '\0'; - //ALOGD("SensorBase: Resetting sensors"); - } else if(en) { - newvalue = oldvalue + sensorvalue; - } else { - newvalue = oldvalue - sensorvalue; - } - - sprintf(buf, "%d", newvalue); - - fd = open(SSP_DEVICE_ENABLE, O_RDWR); - if (fd >= 0) { - err = write(fd, buf, sizeof(buf)); - //ALOGI("%s: sensor: %i old value: %i new value: %i ", sensorname, sensorvalue, oldvalue, newvalue); - close(fd); - return 0; - } else { - ALOGI("%s: error writing to file", sensorname); - close(fd); - return -1; - } -} diff --git a/libsensors/SensorBase.h b/libsensors/SensorBase.h deleted file mode 100644 index d9e4b47..0000000 --- a/libsensors/SensorBase.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (C) 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. - */ - -#ifndef ANDROID_SENSOR_BASE_H -#define ANDROID_SENSOR_BASE_H - -#include -#include -#include -#include - -#include "sensors.h" - - -/*****************************************************************************/ - -struct sensors_event_t; - -class SensorBase { -protected: - const char* dev_name; - const char* data_name; - char input_name[PATH_MAX]; - int dev_fd; - int data_fd; - - int openInput(const char* inputName); - static int64_t getTimestamp(); - - - static int64_t timevalToNano(timeval const& t) { - return t.tv_sec*1000000000LL + t.tv_usec*1000; - } - - int open_device(); - int close_device(); - -public: - SensorBase( - const char* dev_name, - const char* data_name); - - virtual ~SensorBase(); - - virtual int readEvents(sensors_event_t* data, int count) = 0; - virtual bool hasPendingEvents() const; - virtual int getFd() const; - virtual int setDelay(int32_t handle, int64_t ns); - virtual int enable(int32_t handle, int enabled) = 0; - int sspEnable(const char* sensorname, int sensorvalue, int en); - virtual int batch(int handle, int flags, int64_t period_ns, int64_t timeout); - virtual int flush(int handle); - -}; - -/*****************************************************************************/ - -#endif // ANDROID_SENSOR_BASE_H diff --git a/libsensors/sensors.cpp b/libsensors/sensors.cpp deleted file mode 100644 index 193c932..0000000 --- a/libsensors/sensors.cpp +++ /dev/null @@ -1,397 +0,0 @@ -/* - * Copyright (C) 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. - */ - -#define ALOG_TAG "Sensors" - -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include -#include - -#include "sensors.h" - -#include "LightSensor.h" -#include "ProximitySensor.h" -#include "AkmSensor.h" -#include "GyroSensor.h" -#include "AccelSensor.h" -#include "PressureSensor.h" - -/*****************************************************************************/ - -#define DELAY_OUT_TIME 0x7FFFFFFF - -#define LIGHT_SENSOR_POLLTIME 2000000000 - - -#define SENSORS_ACCELERATION (1<getFd(); - mPollFds[light].events = POLLIN; - mPollFds[light].revents = 0; - - mSensors[proximity] = new ProximitySensor(); - mPollFds[proximity].fd = mSensors[proximity]->getFd(); - mPollFds[proximity].events = POLLIN; - mPollFds[proximity].revents = 0; - - mSensors[akm] = new AkmSensor(); - mPollFds[akm].fd = mSensors[akm]->getFd(); - mPollFds[akm].events = POLLIN; - mPollFds[akm].revents = 0; - - mSensors[gyro] = new GyroSensor(); - mPollFds[gyro].fd = mSensors[gyro]->getFd(); - mPollFds[gyro].events = POLLIN; - mPollFds[gyro].revents = 0; - - mSensors[accel] = new AccelSensor(); - mPollFds[accel].fd = mSensors[accel]->getFd(); - mPollFds[accel].events = POLLIN; - mPollFds[accel].revents = 0; - - mSensors[pressure] = new PressureSensor(); - mPollFds[pressure].fd = mSensors[pressure]->getFd(); - mPollFds[pressure].events = POLLIN; - mPollFds[pressure].revents = 0; - - int wakeFds[2]; - int result = pipe(wakeFds); - ALOGE_IF(result<0, "error creating wake pipe (%s)", strerror(errno)); - fcntl(wakeFds[0], F_SETFL, O_NONBLOCK); - fcntl(wakeFds[1], F_SETFL, O_NONBLOCK); - mWritePipeFd = wakeFds[1]; - - mPollFds[wake].fd = wakeFds[0]; - mPollFds[wake].events = POLLIN; - mPollFds[wake].revents = 0; - mInitialized = true; -} - -sensors_poll_context_t::~sensors_poll_context_t() { - for (int i=0 ; ienable(handle, enabled); - if (enabled && !err) { - const char wakeMessage(WAKE_MESSAGE); - int result = write(mWritePipeFd, &wakeMessage, 1); - ALOGE_IF(result<0, "error sending wake message (%s)", strerror(errno)); - } - return err; -} - -int sensors_poll_context_t::setDelay(int handle, int64_t ns) { - - int index = handleToDriver(handle); - if (index < 0) return index; - return mSensors[index]->setDelay(handle, ns); -} - -int sensors_poll_context_t::pollEvents(sensors_event_t* data, int count) -{ - int nbEvents = 0; - int n = 0; - - do { - // see if we have some leftover from the last poll() - for (int i=0 ; count && ihasPendingEvents())) { - int nb = sensor->readEvents(data, count); - if (nb < count) { - // no more data for this sensor - mPollFds[i].revents = 0; - } - count -= nb; - nbEvents += nb; - data += nb; - } - } - - if (count) { - // we still have some room, so try to see if we can get - // some events immediately or just wait if we don't have - // anything to return - n = poll(mPollFds, numFds, nbEvents ? 0 : -1); - if (n<0) { - ALOGE("poll() failed (%s)", strerror(errno)); - return -errno; - } - if (mPollFds[wake].revents & POLLIN) { - char msg; - int result = read(mPollFds[wake].fd, &msg, 1); - ALOGE_IF(result<0, "error reading from wake pipe (%s)", strerror(errno)); - ALOGE_IF(msg != WAKE_MESSAGE, "unknown message on wake queue (0x%02x)", int(msg)); - mPollFds[wake].revents = 0; - } - } - // if we have events and space, go read them - } while (n && count); - - return nbEvents; -} - -int sensors_poll_context_t::batch(int handle, int flags, int64_t period_ns, int64_t timeout) -{ - int index = handleToDriver(handle); - if (index < 0) return index; - return mSensors[index]->batch(handle, flags, period_ns, timeout); -} - -int sensors_poll_context_t::flush(int handle) -{ - int index = handleToDriver(handle); - if (index < 0) return index; - return mSensors[index]->flush(handle); -} - -/*****************************************************************************/ - -static int poll__close(struct hw_device_t *dev) -{ - sensors_poll_context_t *ctx = (sensors_poll_context_t *)dev; - if (ctx) { - delete ctx; - } - return 0; -} - -static int poll__activate(struct sensors_poll_device_t *dev, - int handle, int enabled) { - sensors_poll_context_t *ctx = (sensors_poll_context_t *)dev; - return ctx->activate(handle, enabled); -} - -static int poll__setDelay(struct sensors_poll_device_t *dev, - int handle, int64_t ns) { - sensors_poll_context_t *ctx = (sensors_poll_context_t *)dev; - return ctx->setDelay(handle, ns); -} - -static int poll__poll(struct sensors_poll_device_t *dev, - sensors_event_t* data, int count) { - sensors_poll_context_t *ctx = (sensors_poll_context_t *)dev; - return ctx->pollEvents(data, count); -} - -static int poll__batch(struct sensors_poll_device_1 *dev, - int handle, int flags, int64_t period_ns, int64_t timeout) -{ - sensors_poll_context_t *ctx = (sensors_poll_context_t *)dev; - return ctx->batch(handle, flags, period_ns, timeout); -} - -static int poll__flush(struct sensors_poll_device_1 *dev, - int handle) -{ - sensors_poll_context_t *ctx = (sensors_poll_context_t *)dev; - return ctx->flush(handle); -} - -/*****************************************************************************/ - -/** Open a new instance of a sensor device using name */ -static int open_sensors(const struct hw_module_t* module, const char* id, - struct hw_device_t** device) -{ - int status = -EINVAL; - sensors_poll_context_t *dev = new sensors_poll_context_t(); - - memset(&dev->device, 0, sizeof(sensors_poll_device_1)); - - dev->device.common.tag = HARDWARE_DEVICE_TAG; - dev->device.common.version = SENSORS_DEVICE_API_VERSION_1_0; - dev->device.common.module = const_cast(module); - dev->device.common.close = poll__close; - dev->device.activate = poll__activate; - dev->device.setDelay = poll__setDelay; - dev->device.poll = poll__poll; - - /* Batch processing */ - dev->device.batch = poll__batch; - dev->device.flush = poll__flush; - - *device = &dev->device.common; - status = 0; - - return status; -} - diff --git a/libsensors/sensors.h b/libsensors/sensors.h deleted file mode 100644 index a4fe794..0000000 --- a/libsensors/sensors.h +++ /dev/null @@ -1,131 +0,0 @@ -/* - * Copyright (C) 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. - */ - -#ifndef ANDROID_SENSORS_H -#define ANDROID_SENSORS_H - -#include -#include -#include -#include - -#include - -#include -#include - -__BEGIN_DECLS - -/*****************************************************************************/ - -#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0])) - -#define ID_A (0) -#define ID_M (1) -#define ID_O (2) -#define ID_L (3) -#define ID_P (4) -#define ID_GY (5) -#define ID_PR (6) -#define ID_LA (7) -#define ID_GR (8) - -#define SSP_ACCEL (1) -#define SSP_GYRO (2) -#define SSP_MAG (4) -#define SSP_PRESS (8) -#define SSP_PROX (32) -#define SSP_LIGHT (64) - -#define SSP_DEVICE_ENABLE "/sys/class/sensors/ssp_sensor/enable" - -/*****************************************************************************/ - -/* - * The SENSORS Module - */ - -/* the CM3663 is a binary proximity sensor that triggers around 6 cm on - * this hardware */ -#define PROXIMITY_THRESHOLD_CM 8.0f - -/*****************************************************************************/ - -#define EVENT_TYPE_ACCEL_X REL_X //1 -#define EVENT_TYPE_ACCEL_Y REL_Y //0 -#define EVENT_TYPE_ACCEL_Z REL_Z //2 -//#define EVENT_TYPE_ACCEL_STATUS ABS_WHEEL //8 - -#define EVENT_TYPE_GRAVITY_X ABS_X //1 -#define EVENT_TYPE_GRAVITY_Y ABS_Y //0 -#define EVENT_TYPE_GRAVITY_Z ABS_Z //2 - -#define EVENT_TYPE_YAW ABS_RX //3 -#define EVENT_TYPE_PITCH ABS_RY //4 -#define EVENT_TYPE_ROLL ABS_RZ //5 -#define EVENT_TYPE_ORIENT_STATUS ABS_WHEEL //8 - -#define EVENT_TYPE_MAGV_X ABS_RX // 3 -#define EVENT_TYPE_MAGV_Y ABS_RY // 4 -#define EVENT_TYPE_MAGV_Z ABS_RZ // 5 - -#define EVENT_TYPE_TEMPERATURE ABS_THROTTLE -#define EVENT_TYPE_STEP_COUNT ABS_GAS -#define EVENT_TYPE_PROXIMITY ABS_DISTANCE -#define EVENT_TYPE_LIGHT REL_HWHEEL - -#define EVENT_TYPE_GYRO_X REL_RX -#define EVENT_TYPE_GYRO_Y REL_RY -#define EVENT_TYPE_GYRO_Z REL_RZ - -#define EVENT_TYPE_PRESSURE REL_HWHEEL - -#define LSG (1000.0f) - -// conversion of acceleration data to SI units (m/s^2) -#define RANGE_A (2*GRAVITY_EARTH) -#define RESOLUTION_A (GRAVITY_EARTH / LSG) -#define CONVERT_A (GRAVITY_EARTH / LSG) -#define CONVERT_A_X (CONVERT_A) -#define CONVERT_A_Y (CONVERT_A) -#define CONVERT_A_Z (CONVERT_A) - -// conversion of magnetic data to uT units -#define CONVERT_M (1.0f/16.0f) -#define CONVERT_M_X (-CONVERT_M) -#define CONVERT_M_Y (CONVERT_M) -#define CONVERT_M_Z (CONVERT_M) - -/* conversion of orientation data to degree units */ -#define CONVERT_O (1.0f/1000.0f) -#define CONVERT_O_A (CONVERT_O) -#define CONVERT_O_P (CONVERT_O) -#define CONVERT_O_R (CONVERT_O) - -// conversion of gyro data to SI units (radian/sec) -#define RANGE_GYRO (500.0f*(float)M_PI/180.0f) -#define CONVERT_GYRO ((70.0f / 4000.0f) * ((float)M_PI / 180.0f)) -#define CONVERT_GYRO_X (-CONVERT_GYRO) -#define CONVERT_GYRO_Y (-CONVERT_GYRO) -#define CONVERT_GYRO_Z (-CONVERT_GYRO) - -#define SENSOR_STATE_MASK (0x7FFF) - -/*****************************************************************************/ - -__END_DECLS - -#endif // ANDROID_SENSORS_H diff --git a/n7100.mk b/n7100.mk index 1bc8d45..857f938 100644 --- a/n7100.mk +++ b/n7100.mk @@ -62,10 +62,6 @@ PRODUCT_PACKAGES += \ libcyanogen-dsp \ audio_effects.conf -# Sensors -PRODUCT_PACKAGES += \ - sensors.smdk4x12 - # NFC PRODUCT_PACKAGES += \ nfc.exynos4 \ diff --git a/proprietary-files.txt b/proprietary-files.txt index 9fa7cab..8627379 100644 --- a/proprietary-files.txt +++ b/proprietary-files.txt @@ -1,7 +1,13 @@ system/bin/gpsd +system/bin/sensorservice +system/bin/sensorhubservice system/lib/hw/gps.exynos4.so +system/lib/hw/sensors.smdk4x12.so +system/lib/hw/sensorhubs.smdk4x12.so system/lib/libakm.so system/lib/libsec-ril.so +system/lib/libsensorservice.so +system/lib/libsensorhubservice.so system/usr/idc/sec_e-pen.idc system/usr/keylayout/sec_e-pen.kl system/usr/keylayout/sec_touchkey.kl -- cgit v1.1 From 0a499126670ffc029713c3c245d6f6bb73192b12 Mon Sep 17 00:00:00 2001 From: Javier Ferrer Date: Wed, 14 May 2014 23:36:36 +0200 Subject: Camera wrapper update Change-Id: I7bf11d68b28cf8f16324ae44edce554d03b74e60 Conflicts: BoardConfig.mk camera/CameraWrapper.cpp --- camera/CameraWrapper.cpp | 164 ++++++++++++++++++++++++++++------------------- 1 file changed, 99 insertions(+), 65 deletions(-) diff --git a/camera/CameraWrapper.cpp b/camera/CameraWrapper.cpp index e503b03..be454d9 100644 --- a/camera/CameraWrapper.cpp +++ b/camera/CameraWrapper.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012, The CyanogenMod Project + * Copyright (C) 2012-2013, The CyanogenMod Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,8 +21,7 @@ * */ - -#define LOG_NDEBUG 0 +//#define LOG_NDEBUG 0 //#define LOG_PARAMETERS #define LOG_TAG "CameraWrapper" @@ -38,10 +37,10 @@ static android::Mutex gCameraWrapperLock; static camera_module_t *gVendorModule = 0; -bool preview_running = false; +static bool preview_running = false; -static int camera_device_open(const hw_module_t* module, const char* name, - hw_device_t** device); +static int camera_device_open(const hw_module_t* module, const char *name, + hw_device_t **device); static int camera_device_close(hw_device_t* device); static int camera_get_number_of_cameras(void); static int camera_get_camera_info(int camera_id, struct camera_info *info); @@ -56,14 +55,15 @@ camera_module_t HAL_MODULE_INFO_SYM = { version_major: 1, version_minor: 0, id: CAMERA_HARDWARE_MODULE_ID, - name: "Exynos4x12 Camera Wrapper", - author: "Teamhacksung ", + name: "m0xx Camera Wrapper", + author: "The CyanogenMod Project", methods: &camera_module_methods, dso: NULL, /* remove compilation warnings */ reserved: {0}, /* remove compilation warnings */ }, get_number_of_cameras: camera_get_number_of_cameras, get_camera_info: camera_get_camera_info, + set_callbacks: NULL, }; typedef struct wrapper_camera_device { @@ -84,10 +84,10 @@ static int check_vendor_module() int rv = 0; ALOGV("%s", __FUNCTION__); - if(gVendorModule) + if (gVendorModule) return 0; - rv = hw_get_module("vendor-camera", (const hw_module_t **)&gVendorModule); + rv = hw_get_module_by_class("camera", "vendor", (const hw_module_t **)&gVendorModule); if (rv) ALOGE("failed to open vendor camera module"); return rv; @@ -97,49 +97,93 @@ const static char * iso_values[] = {"auto,ISO100,ISO200,ISO400,ISO800","auto"}; static char * camera_fixup_getparams(int id, const char * settings) { + bool videoMode = false; + char *manipBuf; + android::CameraParameters params; params.unflatten(android::String8(settings)); - // fix params here + ALOGV("%s: original parameters:", __func__); + //params.dump(); + + if (params.get(android::CameraParameters::KEY_RECORDING_HINT)) { + videoMode = (!strcmp(params.get(android::CameraParameters::KEY_RECORDING_HINT), "true")); + } + +#if 0 // this is busted atm + /* Set supported scene modes */ + if (!videoMode) { + manipBuf = strdup(params.get(android::CameraParameters::KEY_SUPPORTED_SCENE_MODES)); + if (manipBuf != NULL && strstr(manipBuf,"hdr") == NULL) { + strncat(manipBuf,",hdr",4); + params.set(android::CameraParameters::KEY_SUPPORTED_SCENE_MODES, + manipBuf); + } + free(manipBuf); + } + + if (params.get("hdr-mode") && !strncmp(params.get("hdr-mode"),"1",1)) { + params.set(android::CameraParameters::KEY_SCENE_MODE, "hdr"); + } +#endif + params.set(android::CameraParameters::KEY_SUPPORTED_ISO_MODES, iso_values[id]); - params.set(android::CameraParameters::KEY_AUTO_EXPOSURE_LOCK, "false"); + + /* We do support it, so announce it */ params.set(android::CameraParameters::KEY_VIDEO_SNAPSHOT_SUPPORTED, "true"); + ALOGV("%s: fixed parameters:", __func__); + //params.dump(); + android::String8 strParams = params.flatten(); char *ret = strdup(strParams.string()); - ALOGD("%s: get parameters fixed up", __FUNCTION__); return ret; } char * camera_fixup_setparams(int id, const char * settings) { + int previewW, previewH; + bool videoMode = false; + const char *sceneMode = "auto"; + android::CameraParameters params; params.unflatten(android::String8(settings)); - // fix params here - if(params.get("iso")) { + ALOGV("%s: original parameters:", __func__); + //params.dump(); + + if (params.get(android::CameraParameters::KEY_RECORDING_HINT)) { + videoMode = (!strcmp(params.get(android::CameraParameters::KEY_RECORDING_HINT), "true")); + } + +#if 0 // this is busted atm + if (!videoMode && !strncmp(params.get(android::CameraParameters::KEY_SCENE_MODE),"hdr",3)) { + params.set("hdr-mode", "1"); + params.set(android::CameraParameters::KEY_SCENE_MODE, "auto"); + } else { + params.set("hdr-mode", "0"); + } +#endif + + if (params.get("iso")) { const char* isoMode = params.get(android::CameraParameters::KEY_ISO_MODE); - if(strcmp(isoMode, "ISO100") == 0) + if (strcmp(isoMode, "ISO100") == 0) params.set(android::CameraParameters::KEY_ISO_MODE, "100"); - else if(strcmp(isoMode, "ISO200") == 0) + else if (strcmp(isoMode, "ISO200") == 0) params.set(android::CameraParameters::KEY_ISO_MODE, "200"); - else if(strcmp(isoMode, "ISO400") == 0) + else if (strcmp(isoMode, "ISO400") == 0) params.set(android::CameraParameters::KEY_ISO_MODE, "400"); - else if(strcmp(isoMode, "ISO800") == 0) + else if (strcmp(isoMode, "ISO800") == 0) params.set(android::CameraParameters::KEY_ISO_MODE, "800"); } - //Workaround for crash when touch to focus is used with flash on. - params.set(android::CameraParameters::KEY_AUTO_EXPOSURE_LOCK, "false"); -#ifdef CAMERA_WITH_CITYID_PARAM - params.set(android::CameraParameters::KEY_CITYID, 0); -#endif + //params.dump(); android::String8 strParams = params.flatten(); char *ret = strdup(strParams.string()); - ALOGD("%s: set parameters fixed up", __FUNCTION__); + ALOGD("%s: fixed parameters:", __func__); return ret; } @@ -152,7 +196,7 @@ int camera_set_preview_window(struct camera_device * device, { ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); - if(!device) + if (!device) return -EINVAL; return VENDOR_CALL(device, set_preview_window, window); @@ -168,7 +212,7 @@ void camera_set_callbacks(struct camera_device * device, ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); ALOGV("%s", __FUNCTION__); - if(!device) + if (!device) return; VENDOR_CALL(device, set_callbacks, notify_cb, data_cb, data_cb_timestamp, get_memory, user); @@ -179,7 +223,7 @@ void camera_enable_msg_type(struct camera_device * device, int32_t msg_type) ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); ALOGV("%s", __FUNCTION__); - if(!device) + if (!device) return; VENDOR_CALL(device, enable_msg_type, msg_type); @@ -190,7 +234,7 @@ void camera_disable_msg_type(struct camera_device * device, int32_t msg_type) ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); ALOGV("%s", __FUNCTION__); - if(!device) + if (!device) return; VENDOR_CALL(device, disable_msg_type, msg_type); @@ -201,7 +245,7 @@ int camera_msg_type_enabled(struct camera_device * device, int32_t msg_type) ALOGV("%s", __FUNCTION__); ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); - if(!device) + if (!device) return 0; return VENDOR_CALL(device, msg_type_enabled, msg_type); @@ -210,17 +254,15 @@ int camera_msg_type_enabled(struct camera_device * device, int32_t msg_type) int camera_start_preview(struct camera_device * device) { int rc; - - ALOGV("%s", __FUNCTION__); + ALOGV("%s", __FUNCTION__); ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); - if(!device) + if (!device) return -EINVAL; rc = VENDOR_CALL(device, start_preview); if (rc) preview_running = true; - return rc; } @@ -229,14 +271,10 @@ void camera_stop_preview(struct camera_device * device) ALOGV("%s", __FUNCTION__); ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); - if(!device) + if (!device) return; - // Workaround for camera freezes - VENDOR_CALL(device, send_command, 7, 0, 0); - VENDOR_CALL(device, stop_preview); - preview_running = false; } @@ -245,7 +283,7 @@ int camera_preview_enabled(struct camera_device * device) ALOGV("%s", __FUNCTION__); ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); - if(!device) + if (!device) return -EINVAL; return VENDOR_CALL(device, preview_enabled); @@ -256,7 +294,7 @@ int camera_store_meta_data_in_buffers(struct camera_device * device, int enable) ALOGV("%s", __FUNCTION__); ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); - if(!device) + if (!device) return -EINVAL; return VENDOR_CALL(device, store_meta_data_in_buffers, enable); @@ -267,7 +305,7 @@ int camera_start_recording(struct camera_device * device) ALOGV("%s", __FUNCTION__); ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); - if(!device) + if (!device) return EINVAL; return VENDOR_CALL(device, start_recording); @@ -278,7 +316,7 @@ void camera_stop_recording(struct camera_device * device) ALOGV("%s", __FUNCTION__); ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); - if(!device) + if (!device) return; @@ -290,7 +328,7 @@ int camera_recording_enabled(struct camera_device * device) ALOGV("%s", __FUNCTION__); ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); - if(!device) + if (!device) return -EINVAL; return VENDOR_CALL(device, recording_enabled); @@ -302,7 +340,7 @@ void camera_release_recording_frame(struct camera_device * device, ALOGV("%s", __FUNCTION__); ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); - if(!device) + if (!device) return; VENDOR_CALL(device, release_recording_frame, opaque); @@ -313,7 +351,7 @@ int camera_auto_focus(struct camera_device * device) ALOGV("%s", __FUNCTION__); ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); - if(!device) + if (!device) return -EINVAL; @@ -325,7 +363,7 @@ int camera_cancel_auto_focus(struct camera_device * device) ALOGV("%s", __FUNCTION__); ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); - if(!device) + if (!device) return -EINVAL; if (preview_running) @@ -339,7 +377,7 @@ int camera_take_picture(struct camera_device * device) ALOGV("%s", __FUNCTION__); ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); - if(!device) + if (!device) return -EINVAL; return VENDOR_CALL(device, take_picture); @@ -350,7 +388,7 @@ int camera_cancel_picture(struct camera_device * device) ALOGV("%s", __FUNCTION__); ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); - if(!device) + if (!device) return -EINVAL; return VENDOR_CALL(device, cancel_picture); @@ -361,7 +399,7 @@ int camera_set_parameters(struct camera_device * device, const char *params) ALOGV("%s", __FUNCTION__); ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); - if(!device) + if (!device) return -EINVAL; char *tmp = NULL; @@ -380,16 +418,16 @@ char* camera_get_parameters(struct camera_device * device) ALOGV("%s", __FUNCTION__); ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); - if(!device) + if (!device) return NULL; - char* params = VENDOR_CALL(device, get_parameters); + char *params = VENDOR_CALL(device, get_parameters); #ifdef LOG_PARAMETERS __android_log_write(ANDROID_LOG_VERBOSE, LOG_TAG, params); #endif - char * tmp = camera_fixup_getparams(CAMERA_ID(device), params); + char *tmp = camera_fixup_getparams(CAMERA_ID(device), params); VENDOR_CALL(device, put_parameters, params); params = tmp; @@ -405,7 +443,7 @@ static void camera_put_parameters(struct camera_device *device, char *params) ALOGV("%s", __FUNCTION__); ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); - if(params) + if (params) free(params); } @@ -415,7 +453,7 @@ int camera_send_command(struct camera_device * device, ALOGV("%s", __FUNCTION__); ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); - if(!device) + if (!device) return -EINVAL; return VENDOR_CALL(device, send_command, cmd, arg1, arg2); @@ -426,7 +464,7 @@ void camera_release(struct camera_device * device) ALOGV("%s", __FUNCTION__); ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); - if(!device) + if (!device) return; VENDOR_CALL(device, release); @@ -434,7 +472,7 @@ void camera_release(struct camera_device * device) int camera_dump(struct camera_device * device, int fd) { - if(!device) + if (!device) return -EINVAL; return VENDOR_CALL(device, dump, fd); @@ -499,8 +537,7 @@ int camera_device_open(const hw_module_t* module, const char* name, cameraid = atoi(name); num_cameras = gVendorModule->get_number_of_cameras(); - if(cameraid > num_cameras) - { + if (cameraid > num_cameras) { ALOGE("camera service provided cameraid out of bounds, " "cameraid = %d, num supported = %d", cameraid, num_cameras); @@ -509,8 +546,7 @@ int camera_device_open(const hw_module_t* module, const char* name, } camera_device = (wrapper_camera_device_t*)malloc(sizeof(*camera_device)); - if(!camera_device) - { + if (!camera_device) { ALOGE("camera_device allocation fail"); rv = -ENOMEM; goto fail; @@ -518,16 +554,14 @@ int camera_device_open(const hw_module_t* module, const char* name, memset(camera_device, 0, sizeof(*camera_device)); camera_device->id = cameraid; - if(rv = gVendorModule->common.methods->open((const hw_module_t*)gVendorModule, name, (hw_device_t**)&(camera_device->vendor))) - { + if ((rv = gVendorModule->common.methods->open((const hw_module_t*)gVendorModule, name, (hw_device_t**)&(camera_device->vendor)))) { ALOGE("vendor camera open fail"); goto fail; } ALOGV("%s: got vendor camera device 0x%08X", __FUNCTION__, (uintptr_t)(camera_device->vendor)); camera_ops = (camera_device_ops_t*)malloc(sizeof(*camera_ops)); - if(!camera_ops) - { + if (!camera_ops) { ALOGE("camera_ops allocation fail"); rv = -ENOMEM; goto fail; -- cgit v1.1 From 54f66e6fb83ef1680030c4e199e6393f70de6c95 Mon Sep 17 00:00:00 2001 From: Josue Rivera Date: Sun, 13 Jul 2014 16:16:11 +0200 Subject: N7100: Fix video snapshots * Video snapshots was causing FC'ing or locking up of Google camera app & Slim camera app. Removed this thinking it would disable it but it actually fixed it. Change-Id: Id3c22a26649375cbe6de17567ab4b739662b872d Signed-off-by: Josue Rivera --- camera/CameraWrapper.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/camera/CameraWrapper.cpp b/camera/CameraWrapper.cpp index be454d9..41f62d5 100644 --- a/camera/CameraWrapper.cpp +++ b/camera/CameraWrapper.cpp @@ -129,9 +129,6 @@ static char * camera_fixup_getparams(int id, const char * settings) params.set(android::CameraParameters::KEY_SUPPORTED_ISO_MODES, iso_values[id]); - /* We do support it, so announce it */ - params.set(android::CameraParameters::KEY_VIDEO_SNAPSHOT_SUPPORTED, "true"); - ALOGV("%s: fixed parameters:", __func__); //params.dump(); -- cgit v1.1 From 9805ad81acfd42f6eafa43378d2c1a9717c51d8f Mon Sep 17 00:00:00 2001 From: Ketut Putu Kumajaya Date: Sun, 13 Jul 2014 22:43:34 +0700 Subject: Audio parameter for setting noise suppression Change-Id: I1fb529396f7a039bf9843368f4f1b5036c889e82 --- audio/audio_hw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/audio/audio_hw.c b/audio/audio_hw.c index c1471b2..6d8891f 100644 --- a/audio/audio_hw.c +++ b/audio/audio_hw.c @@ -2601,7 +2601,7 @@ static int adev_set_parameters(struct audio_hw_device *dev, const char *kvpairs) ret = str_parms_get_str(parms, "noise_suppression", value, sizeof(value)); if (ret >= 0) { - if (strcmp(value, "true") == 0) { + if (strcmp(value, "on") == 0) { ALOGE("%s: enabling two mic control", __func__); ril_set_two_mic_control(&adev->ril, AUDIENCE, TWO_MIC_SOLUTION_ON); /* sub mic */ -- cgit v1.1 From 261ac8b02d61daf925a9fd526fac4515c636cd74 Mon Sep 17 00:00:00 2001 From: Unpublished Date: Sat, 12 Jul 2014 16:29:28 +0200 Subject: Enable eject SDCard Change-Id: I48355287ec7800dd4668047b066dce0aa42a6636 --- overlay/frameworks/base/core/res/res/values/config.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/overlay/frameworks/base/core/res/res/values/config.xml b/overlay/frameworks/base/core/res/res/values/config.xml index 559b68e..341a683 100644 --- a/overlay/frameworks/base/core/res/res/values/config.xml +++ b/overlay/frameworks/base/core/res/res/values/config.xml @@ -73,6 +73,9 @@ pdp0 + + true + true -- cgit v1.1 From f27ad8fd43a10918b8b5c90d1780a30954b9e2da Mon Sep 17 00:00:00 2001 From: Utkarsh Gupta Date: Thu, 15 May 2014 17:21:41 +0530 Subject: Overlay updates Change-Id: If632307dc0f2de13e0036f4cfef9803bbd45c72c Conflicts: overlay/frameworks/base/core/res/res/values/config.xml overlay/packages/apps/Torch/res/values/config.xml --- .../frameworks/base/core/res/res/values/config.xml | 27 +++++++++++----------- .../packages/apps/Settings/res/values/bools.xml | 20 ---------------- 2 files changed, 14 insertions(+), 33 deletions(-) delete mode 100644 overlay/packages/apps/Settings/res/values/bools.xml diff --git a/overlay/frameworks/base/core/res/res/values/config.xml b/overlay/frameworks/base/core/res/res/values/config.xml index 341a683..3c8a86c 100644 --- a/overlay/frameworks/base/core/res/res/values/config.xml +++ b/overlay/frameworks/base/core/res/res/values/config.xml @@ -18,9 +18,8 @@ --> + for different hardware and product builds. Do not translate. --> - false @@ -28,6 +27,9 @@ + + [# simultaneous connection types]" --> "1,1" "0,1" @@ -85,21 +90,18 @@ true - - #ffffffff - 1000 9000 - - true + + true + + config to 7. --> 7 - - true - true + + true diff --git a/overlay/packages/apps/Settings/res/values/bools.xml b/overlay/packages/apps/Settings/res/values/bools.xml deleted file mode 100644 index 63f1363..0000000 --- a/overlay/packages/apps/Settings/res/values/bools.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - true - -- cgit v1.1 From 5bb524184033eab64fbb3337eaf46211f682edae Mon Sep 17 00:00:00 2001 From: Dheeraj CVR Date: Sat, 2 Aug 2014 12:29:57 +0530 Subject: audio: fix noise supression and update mixer ctls Change-Id: Id887b35932e4872a0679053d385c38142f860689 Conflicts: overlay/packages/services/Telephony/res/values/config.xml --- audio/audio_hw.c | 190 +++++++-------------- audio/audio_hw.h | 77 ++++----- configs/tiny_hw.xml | 88 ++++------ overlay/packages/apps/Phone | 1 + .../services/Telephony/res/values/config.xml | 2 +- 5 files changed, 140 insertions(+), 218 deletions(-) create mode 120000 overlay/packages/apps/Phone diff --git a/audio/audio_hw.c b/audio/audio_hw.c index 6d8891f..f0f2233 100644 --- a/audio/audio_hw.c +++ b/audio/audio_hw.c @@ -103,7 +103,6 @@ struct m0_audio_device { struct m0_stream_in *active_input; struct m0_stream_out *outputs[OUTPUT_TOTAL]; bool mic_mute; - int tty_mode; struct echo_reference_itfe *echo_reference; bool bluetooth_nrec; int wb_amr; @@ -532,15 +531,6 @@ static void set_incall_device(struct m0_audio_device *adev) ril_set_call_audio_path(&adev->ril, device_type); } -static void set_input_volumes(struct m0_audio_device *adev, int main_mic_on, - int headset_mic_on, int sub_mic_on) -{ -} - -static void set_output_volumes(struct m0_audio_device *adev, bool tty_volume) -{ -} - static void force_all_standby(struct m0_audio_device *adev) { struct m0_stream_in *in; @@ -598,8 +588,7 @@ static void select_mode(struct m0_audio_device *adev) adev->in_call = 0; ril_set_call_clock_sync(&adev->ril, SOUND_CLOCK_STOP); end_call(adev); - //Force Input Standby - adev->in_device = AUDIO_DEVICE_NONE; + force_all_standby(adev); ALOGD("%s: set voicecall route: voicecall_default_disable", __func__); set_bigroute_by_array(adev->mixer, voicecall_default_disable, 1); @@ -610,8 +599,9 @@ static void select_mode(struct m0_audio_device *adev) ALOGD("%s: set voicecall route: bt_disable", __func__); set_bigroute_by_array(adev->mixer, bt_disable, 1); - force_all_standby(adev); select_output_device(adev); + //Force Input Standby + adev->in_device = AUDIO_DEVICE_NONE; select_input_device(adev); } } @@ -624,7 +614,6 @@ static void select_output_device(struct m0_audio_device *adev) int speaker_on; int earpiece_on; int bt_on; - bool tty_volume = false; unsigned int channel; headset_on = adev->out_device & AUDIO_DEVICE_OUT_WIRED_HEADSET; @@ -671,29 +660,6 @@ static void select_output_device(struct m0_audio_device *adev) set_eq_filter(adev); if (adev->mode == AUDIO_MODE_IN_CALL) { - if (!bt_on) { - /* force tx path according to TTY mode when in call */ - switch(adev->tty_mode) { - case TTY_MODE_FULL: - case TTY_MODE_HCO: - /* tx path from headset mic */ - headphone_on = 0; - headset_on = 1; - speaker_on = 0; - earpiece_on = 0; - break; - case TTY_MODE_VCO: - /* tx path from device sub mic */ - headphone_on = 0; - headset_on = 0; - speaker_on = 1; - earpiece_on = 0; - break; - case TTY_MODE_OFF: - default: - break; - } - } if (headset_on || headphone_on || speaker_on || earpiece_on) { ALOGD("%s: set voicecall route: voicecall_default", __func__); @@ -2559,30 +2525,6 @@ static int adev_set_parameters(struct audio_hw_device *dev, const char *kvpairs) int ret; parms = str_parms_create_str(kvpairs); - ret = str_parms_get_str(parms, AUDIO_PARAMETER_KEY_TTY_MODE, value, sizeof(value)); - if (ret >= 0) { - int tty_mode; - - if (strcmp(value, AUDIO_PARAMETER_VALUE_TTY_OFF) == 0) - tty_mode = TTY_MODE_OFF; - else if (strcmp(value, AUDIO_PARAMETER_VALUE_TTY_VCO) == 0) - tty_mode = TTY_MODE_VCO; - else if (strcmp(value, AUDIO_PARAMETER_VALUE_TTY_HCO) == 0) - tty_mode = TTY_MODE_HCO; - else if (strcmp(value, AUDIO_PARAMETER_VALUE_TTY_FULL) == 0) - tty_mode = TTY_MODE_FULL; - else - return -EINVAL; - - pthread_mutex_lock(&adev->lock); - if (tty_mode != adev->tty_mode) { - adev->tty_mode = tty_mode; - if (adev->mode == AUDIO_MODE_IN_CALL) - select_output_device(adev); - } - pthread_mutex_unlock(&adev->lock); - } - ret = str_parms_get_str(parms, AUDIO_PARAMETER_KEY_BT_NREC, value, sizeof(value)); if (ret >= 0) { if (strcmp(value, AUDIO_PARAMETER_VALUE_ON) == 0) @@ -2601,16 +2543,12 @@ static int adev_set_parameters(struct audio_hw_device *dev, const char *kvpairs) ret = str_parms_get_str(parms, "noise_suppression", value, sizeof(value)); if (ret >= 0) { - if (strcmp(value, "on") == 0) { + if (strcmp(value, "true") == 0) { ALOGE("%s: enabling two mic control", __func__); ril_set_two_mic_control(&adev->ril, AUDIENCE, TWO_MIC_SOLUTION_ON); - /* sub mic */ - set_bigroute_by_array(adev->mixer, noise_suppression, 1); } else { ALOGE("%s: disabling two mic control", __func__); ril_set_two_mic_control(&adev->ril, AUDIENCE, TWO_MIC_SOLUTION_OFF); - /* sub mic */ - set_bigroute_by_array(adev->mixer, noise_suppression_disable, 1); } } @@ -2854,85 +2792,86 @@ static void adev_config_start(void *data, const XML_Char *elem, unsigned int i, j; for (i = 0; attr[i]; i += 2) { - if (strcmp(attr[i], "name") == 0) - name = attr[i + 1]; + if (strcmp(attr[i], "name") == 0) + name = attr[i + 1]; - if (strcmp(attr[i], "val") == 0) - val = attr[i + 1]; + if (strcmp(attr[i], "val") == 0) + val = attr[i + 1]; } if (strcmp(elem, "device") == 0) { - if (!name) { - ALOGE("Unnamed device\n"); + if (!name) { + ALOGE("Unnamed device\n"); + return; + } + + for (i = 0; i < sizeof(dev_names) / sizeof(dev_names[0]); i++) { + if (strcmp(dev_names[i].name, name) == 0) { + ALOGI("Allocating device %s\n", name); + dev_cfg = realloc(s->adev->dev_cfgs, + (s->adev->num_dev_cfgs + 1) + * sizeof(*dev_cfg)); + if (!dev_cfg) { + ALOGE("Unable to allocate dev_cfg\n"); return; } - for (i = 0; i < sizeof(dev_names) / sizeof(dev_names[0]); i++) { - if (strcmp(dev_names[i].name, name) == 0) { - ALOGI("Allocating device %s\n", name); - dev_cfg = realloc(s->adev->dev_cfgs, - (s->adev->num_dev_cfgs + 1) - * sizeof(*dev_cfg)); - if (!dev_cfg) { - ALOGE("Unable to allocate dev_cfg\n"); - return; - } - - s->dev = &dev_cfg[s->adev->num_dev_cfgs]; - memset(s->dev, 0, sizeof(*s->dev)); - s->dev->mask = dev_names[i].mask; + s->dev = &dev_cfg[s->adev->num_dev_cfgs]; + memset(s->dev, 0, sizeof(*s->dev)); + s->dev->mask = dev_names[i].mask; - s->adev->dev_cfgs = dev_cfg; - s->adev->num_dev_cfgs++; - } + s->adev->dev_cfgs = dev_cfg; + s->adev->num_dev_cfgs++; } + } + } else if (strcmp(elem, "path") == 0) { - if (s->path_len) - ALOGW("Nested paths\n"); - - /* If this a path for a device it must have a role */ - if (s->dev) { - /* Need to refactor a bit... */ - if (strcmp(name, "on") == 0) { - s->on = true; - } else if (strcmp(name, "off") == 0) { - s->on = false; - } else { - ALOGW("Unknown path name %s\n", name); - } + if (s->path_len) + ALOGW("Nested paths\n"); + + /* If this a path for a device it must have a role */ + if (s->dev) { + /* Need to refactor a bit... */ + if (strcmp(name, "on") == 0) { + s->on = true; + } else if (strcmp(name, "off") == 0) { + s->on = false; + } else { + ALOGW("Unknown path name %s\n", name); } + } } else if (strcmp(elem, "ctl") == 0) { - struct route_setting *r; + struct route_setting *r; - if (!name) { - ALOGE("Unnamed control\n"); - return; - } + if (!name) { + ALOGE("Unnamed control\n"); + return; + } - if (!val) { - ALOGE("No value specified for %s\n", name); - return; - } + if (!val) { + ALOGE("No value specified for %s\n", name); + return; + } - ALOGV("Parsing control %s => %s\n", name, val); + ALOGV("Parsing control %s => %s\n", name, val); - r = realloc(s->path, sizeof(*r) * (s->path_len + 1)); - if (!r) { - ALOGE("Out of memory handling %s => %s\n", name, val); - return; - } + r = realloc(s->path, sizeof(*r) * (s->path_len + 1)); + if (!r) { + ALOGE("Out of memory handling %s => %s\n", name, val); + return; + } - r[s->path_len].ctl_name = strdup(name); - r[s->path_len].strval = NULL; + r[s->path_len].ctl_name = strdup(name); + r[s->path_len].strval = NULL; - /* This can be fooled but it'll do */ - r[s->path_len].intval = atoi(val); - if (!r[s->path_len].intval && strcmp(val, "0") != 0) - r[s->path_len].strval = strdup(val); + /* This can be fooled but it'll do */ + r[s->path_len].intval = atoi(val); + if (!r[s->path_len].intval && strcmp(val, "0") != 0) + r[s->path_len].strval = strdup(val); - s->path = r; - s->path_len++; + s->path = r; + s->path_len++; } } @@ -3101,7 +3040,6 @@ static int adev_open(const hw_module_t* module, const char* name, adev->pcm_bt_dl = NULL; adev->pcm_bt_ul = NULL; adev->voice_volume = 1.0f; - adev->tty_mode = TTY_MODE_OFF; adev->bluetooth_nrec = true; adev->wb_amr = 0; diff --git a/audio/audio_hw.h b/audio/audio_hw.h index 889c249..d7c655b 100644 --- a/audio/audio_hw.h +++ b/audio/audio_hw.h @@ -97,13 +97,6 @@ enum output_type { OUTPUT_TOTAL }; -enum tty_modes { - TTY_MODE_OFF, - TTY_MODE_VCO, - TTY_MODE_HCO, - TTY_MODE_FULL -}; - struct mixer_ctls { struct mixer_ctl *mixinl_in1l_volume; @@ -118,6 +111,11 @@ struct route_setting }; struct route_setting voicecall_default[] = { + { .ctl_name = "DAC1L Mixer AIF1.1 Switch", .intval = 1, }, + { .ctl_name = "DAC1R Mixer AIF1.1 Switch", .intval = 1, }, + { .ctl_name = "AIF2ADCL DRC Switch", .intval = 0, }, + { .ctl_name = "AIF2DACL Source", .intval = 0, }, + { .ctl_name = "AIF2DACR Source", .intval = 0, }, { .ctl_name = "AIF2 Mode", .intval = 0, }, { .ctl_name = "DAC1L Mixer AIF1.1 Switch", .intval = 1, }, { .ctl_name = "DAC1R Mixer AIF1.1 Switch", .intval = 1, }, @@ -128,73 +126,72 @@ struct route_setting voicecall_default[] = { }; struct route_setting voicecall_default_disable[] = { - { .ctl_name = "AIF2 Mode", .intval = 0, }, { .ctl_name = "DAC1L Mixer AIF2 Switch", .intval = 0, }, { .ctl_name = "DAC1R Mixer AIF2 Switch", .intval = 0, }, { .ctl_name = "AIF2DAC Mux", .strval = "AIF3DACDAT", }, - { .ctl_name = "Main Mic Switch", .intval = 0, }, - { .ctl_name = "MIXINL IN2L Switch", .intval = 0, }, - { .ctl_name = "Sub Mic Switch", .intval = 0, }, - { .ctl_name = "MIXINR IN1R Switch", .intval = 0, }, + { .ctl_name = "AIF2 Mode", .intval = 1, }, { .ctl_name = NULL, }, }; struct route_setting default_input[] = { { .ctl_name = "Main Mic Switch", .intval = 1, }, { .ctl_name = "MainMicBias Mode", .intval = 1, }, - { .ctl_name = "IN2L Volume", .intval = 28, }, + { .ctl_name = "AIF1ADCL Source", .intval = 0, }, + { .ctl_name = "AIF2ADCL Source", .intval = 0, }, { .ctl_name = "MIXINL IN2L Switch", .intval = 1, }, + { .ctl_name = "Sub Mic Switch", .intval = 1, }, + { .ctl_name = "AIF1ADCR Source", .intval = 1, }, + { .ctl_name = "AIF2ADCR Source", .intval = 1, }, + { .ctl_name = "MIXINR IN1R Switch", .intval = 1, }, + { .ctl_name = "IN1L Volume", .intval = 25, }, { .ctl_name = "MIXINL IN2L Volume", .intval = 0, }, - { .ctl_name = "AIF1ADC1 HPF Mode", .intval = 0, }, - { .ctl_name = "AIF1ADC1 HPF Switch", .intval = 1, }, + { .ctl_name = "DAC2 Left Sidetone Volume", .intval = 12, }, + { .ctl_name = "DAC2 Right Sidetone Volume", .intval = 12, }, + { .ctl_name = "AIF2ADC Volume", .intval = 96, }, + { .ctl_name = "AIF2ADCL DRC Switch", .intval = 0, }, { .ctl_name = NULL, }, }; struct route_setting default_input_disable[] = { { .ctl_name = "Main Mic Switch", .intval = 0, }, - { .ctl_name = "IN2L Volume", .intval = 4, }, { .ctl_name = "MIXINL IN2L Switch", .intval = 0, }, - { .ctl_name = "AIF1ADC1 HPF Switch", .intval = 0, }, - { .ctl_name = NULL, }, -}; - -struct route_setting noise_suppression[] = { - { .ctl_name = "Sub Mic Switch", .intval = 1, }, - { .ctl_name = "IN1R Volume", .intval = 25, }, - { .ctl_name = "MIXINR IN1R Switch", .intval = 1, }, - { .ctl_name = "MIXINR IN1R Volume", .intval = 0, }, - { .ctl_name = "AIF1ADCR Source", .intval = 1, }, - { .ctl_name = NULL, }, -}; - -struct route_setting noise_suppression_disable[] = { { .ctl_name = "Sub Mic Switch", .intval = 0, }, - { .ctl_name = "IN1R Volume", .intval = 7, }, { .ctl_name = "MIXINR IN1R Switch", .intval = 0, }, - { .ctl_name = "MIXINR IN1R Volume", .intval = 0, }, + { .ctl_name = "AIF2DACL Source", .intval = 0, }, + { .ctl_name = "AIF2DACR Source", .intval = 1, }, { .ctl_name = NULL, }, }; struct route_setting headset_input[] = { + { .ctl_name = "AIF2DAC2L Mixer AIF2 Switch", .intval = 0, }, + { .ctl_name = "AIF2DAC2R Mixer AIF2 Switch", .intval = 0, }, + { .ctl_name = "Headphone ZC Switch", .intval = 0, }, + { .ctl_name = "AIF1DAC1 Volume", .intval = 96, }, + { .ctl_name = "AIF2DAC Volume", .intval = 96, }, + { .ctl_name = "AIF1 Boost Volume", .intval = 0, }, + { .ctl_name = "AIF2 Boost Volume", .intval = 0, }, + { .ctl_name = "DAC1 Volume", .intval = 96, }, + { .ctl_name = "Headphone Volume", .intval = 49, }, { .ctl_name = "MIXINL IN2L Switch", .intval = 0, }, { .ctl_name = "MIXINR IN1R Switch", .intval = 0, }, { .ctl_name = "Headset Mic Switch", .intval = 1, }, - { .ctl_name = "IN1L Volume", .intval = 18, }, - { .ctl_name = "MIXINL IN1L Switch", .intval = 1, }, - { .ctl_name = "MIXINL IN1L Volume", .intval = 0, }, - { .ctl_name = "AIF1ADC1 HPF Mode", .intval = 1, }, - { .ctl_name = "AIF1ADC1 HPF Switch", .intval = 1, }, - { .ctl_name = "AIF1ADC1 Volume", .intval = 96, }, { .ctl_name = "AIF1ADCL Source", .intval = 0, }, { .ctl_name = "AIF1ADCR Source", .intval = 0, }, + { .ctl_name = "AIF2ADCL Source", .intval = 0, }, + { .ctl_name = "MIXINL IN1L Switch", .intval = 1, }, + { .ctl_name = "IN1L Volume", .intval = 28, }, + { .ctl_name = "MIXINL IN1L Volume", .intval = 0, }, + { .ctl_name = "DAC2 Left Sidetone Volume", .intval = 12, }, + { .ctl_name = "AIF2ADC Volume", .intval = 96, }, + { .ctl_name = "AIF2ADCL DRC Switch", .intval = 0, }, { .ctl_name = NULL, }, }; struct route_setting headset_input_disable[] = { { .ctl_name = "Headset Mic Switch", .intval = 0, }, { .ctl_name = "MIXINL IN1L Switch", .intval = 0, }, - { .ctl_name = "AIF1ADC1 HPF Mode", .intval = 0, }, - { .ctl_name = "AIF1ADC1 HPF Switch", .intval = 0, }, + { .ctl_name = "AIF2DACL Source", .intval = 0, }, + { .ctl_name = "AIF2DACR Source", .intval = 1, }, { .ctl_name = NULL, }, }; diff --git a/configs/tiny_hw.xml b/configs/tiny_hw.xml index b84713b..b7c4c12 100644 --- a/configs/tiny_hw.xml +++ b/configs/tiny_hw.xml @@ -120,6 +120,14 @@ We are able to have most of our routing static so do that + + + + + + + + @@ -127,36 +135,31 @@ We are able to have most of our routing static so do that + + - + - - - - - - - - - - - - + - - + + + + + + @@ -165,13 +168,6 @@ We are able to have most of our routing static so do that - - - - - - - @@ -184,18 +180,9 @@ We are able to have most of our routing static so do that - - - - - - - - - @@ -210,7 +197,6 @@ We are able to have most of our routing static so do that - @@ -275,11 +261,14 @@ We are able to have most of our routing static so do that - + - - - + + + + + + @@ -287,17 +276,15 @@ We are able to have most of our routing static so do that - - - + - + @@ -307,32 +294,31 @@ We are able to have most of our routing static so do that - + + - + + + + + + + + - - - - - - - - - diff --git a/overlay/packages/apps/Phone b/overlay/packages/apps/Phone new file mode 120000 index 0000000..0f8d39e --- /dev/null +++ b/overlay/packages/apps/Phone @@ -0,0 +1 @@ +../services/Telephony/ \ No newline at end of file diff --git a/overlay/packages/services/Telephony/res/values/config.xml b/overlay/packages/services/Telephony/res/values/config.xml index 5ebd245..23ec4e4 100644 --- a/overlay/packages/services/Telephony/res/values/config.xml +++ b/overlay/packages/services/Telephony/res/values/config.xml @@ -20,6 +20,6 @@ true - + noise_suppression=true=false -- cgit v1.1 From 108dcbe431508f7424046e55ee2f4ae88ae49648 Mon Sep 17 00:00:00 2001 From: Dheeraj CVR Date: Mon, 4 Aug 2014 06:02:26 +0530 Subject: audio: make builtin mic and back mic volumes consistent Change-Id: I9f94363e78bed7b3185110d1f7d90a9f36a4ba10 --- audio/audio_hw.c | 5 ----- audio/audio_hw.h | 9 ++------- configs/tiny_hw.xml | 2 +- 3 files changed, 3 insertions(+), 13 deletions(-) diff --git a/audio/audio_hw.c b/audio/audio_hw.c index f0f2233..e567e38 100644 --- a/audio/audio_hw.c +++ b/audio/audio_hw.c @@ -88,7 +88,6 @@ struct m0_audio_device { struct m0_dev_cfg *dev_cfgs; int num_dev_cfgs; struct mixer *mixer; - struct mixer_ctls mixer_ctls; audio_mode_t mode; int active_out_device; int out_device; @@ -3020,10 +3019,6 @@ static int adev_open(const hw_module_t* module, const char* name, return -EINVAL; } - /* +30db boost for mics */ - adev->mixer_ctls.mixinl_in1l_volume = mixer_get_ctl_by_name(adev->mixer, "MIXINL IN1L Volume"); - adev->mixer_ctls.mixinl_in2l_volume = mixer_get_ctl_by_name(adev->mixer, "MIXINL IN2L Volume"); - ret = adev_config_parse(adev); if (ret != 0) goto err_mixer; diff --git a/audio/audio_hw.h b/audio/audio_hw.h index d7c655b..88433ed 100644 --- a/audio/audio_hw.h +++ b/audio/audio_hw.h @@ -97,12 +97,6 @@ enum output_type { OUTPUT_TOTAL }; -struct mixer_ctls -{ - struct mixer_ctl *mixinl_in1l_volume; - struct mixer_ctl *mixinl_in2l_volume; -}; - struct route_setting { char *ctl_name; @@ -143,7 +137,8 @@ struct route_setting default_input[] = { { .ctl_name = "AIF1ADCR Source", .intval = 1, }, { .ctl_name = "AIF2ADCR Source", .intval = 1, }, { .ctl_name = "MIXINR IN1R Switch", .intval = 1, }, - { .ctl_name = "IN1L Volume", .intval = 25, }, + { .ctl_name = "IN2L Volume", .intval = 25, }, + { .ctl_name = "IN1R Volume", .intval = 25, }, { .ctl_name = "MIXINL IN2L Volume", .intval = 0, }, { .ctl_name = "DAC2 Left Sidetone Volume", .intval = 12, }, { .ctl_name = "DAC2 Right Sidetone Volume", .intval = 12, }, diff --git a/configs/tiny_hw.xml b/configs/tiny_hw.xml index b7c4c12..88f3651 100644 --- a/configs/tiny_hw.xml +++ b/configs/tiny_hw.xml @@ -261,7 +261,7 @@ We are able to have most of our routing static so do that - + -- cgit v1.1 From 52b7c332c29b7736f180fee0e51b0d101644091c Mon Sep 17 00:00:00 2001 From: Dheeraj CVR Date: Wed, 6 Aug 2014 20:38:30 +0530 Subject: audio: fix MicBias mode for voice call Change-Id: Ibf6d69495a9209d420621b9c53a82f9bf7b7e48d --- audio/audio_hw.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/audio/audio_hw.h b/audio/audio_hw.h index 88433ed..b4919c4 100644 --- a/audio/audio_hw.h +++ b/audio/audio_hw.h @@ -134,6 +134,7 @@ struct route_setting default_input[] = { { .ctl_name = "AIF2ADCL Source", .intval = 0, }, { .ctl_name = "MIXINL IN2L Switch", .intval = 1, }, { .ctl_name = "Sub Mic Switch", .intval = 1, }, + { .ctl_name = "SubMicBias Mode", .intval = 1, }, { .ctl_name = "AIF1ADCR Source", .intval = 1, }, { .ctl_name = "AIF2ADCR Source", .intval = 1, }, { .ctl_name = "MIXINR IN1R Switch", .intval = 1, }, @@ -149,8 +150,10 @@ struct route_setting default_input[] = { struct route_setting default_input_disable[] = { { .ctl_name = "Main Mic Switch", .intval = 0, }, + { .ctl_name = "MainMicBias Mode", .intval = 0, }, { .ctl_name = "MIXINL IN2L Switch", .intval = 0, }, { .ctl_name = "Sub Mic Switch", .intval = 0, }, + { .ctl_name = "SubMicBias Mode", .intval = 0, }, { .ctl_name = "MIXINR IN1R Switch", .intval = 0, }, { .ctl_name = "AIF2DACL Source", .intval = 0, }, { .ctl_name = "AIF2DACR Source", .intval = 1, }, -- cgit v1.1 From de7462ec9b0dd4ee101b70fb7132cd64560e4112 Mon Sep 17 00:00:00 2001 From: Dheeraj CVR Date: Tue, 12 Aug 2014 22:33:18 +0530 Subject: audio: set noise suppression based on audio parameter Change-Id: I014541ead917f2385c9ec8d88910f11e8a6b6e92 --- audio/audio_hw.c | 4 ++++ audio/audio_hw.h | 26 ++++++++++++++++---------- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/audio/audio_hw.c b/audio/audio_hw.c index e567e38..31aecad 100644 --- a/audio/audio_hw.c +++ b/audio/audio_hw.c @@ -2545,9 +2545,13 @@ static int adev_set_parameters(struct audio_hw_device *dev, const char *kvpairs) if (strcmp(value, "true") == 0) { ALOGE("%s: enabling two mic control", __func__); ril_set_two_mic_control(&adev->ril, AUDIENCE, TWO_MIC_SOLUTION_ON); + /* sub mic */ + set_bigroute_by_array(adev->mixer, noise_suppression, 1); } else { ALOGE("%s: disabling two mic control", __func__); ril_set_two_mic_control(&adev->ril, AUDIENCE, TWO_MIC_SOLUTION_OFF); + /* sub mic */ + set_bigroute_by_array(adev->mixer, noise_suppression_disable, 1); } } diff --git a/audio/audio_hw.h b/audio/audio_hw.h index b4919c4..5ba0e9e 100644 --- a/audio/audio_hw.h +++ b/audio/audio_hw.h @@ -133,16 +133,8 @@ struct route_setting default_input[] = { { .ctl_name = "AIF1ADCL Source", .intval = 0, }, { .ctl_name = "AIF2ADCL Source", .intval = 0, }, { .ctl_name = "MIXINL IN2L Switch", .intval = 1, }, - { .ctl_name = "Sub Mic Switch", .intval = 1, }, - { .ctl_name = "SubMicBias Mode", .intval = 1, }, - { .ctl_name = "AIF1ADCR Source", .intval = 1, }, - { .ctl_name = "AIF2ADCR Source", .intval = 1, }, - { .ctl_name = "MIXINR IN1R Switch", .intval = 1, }, { .ctl_name = "IN2L Volume", .intval = 25, }, - { .ctl_name = "IN1R Volume", .intval = 25, }, { .ctl_name = "MIXINL IN2L Volume", .intval = 0, }, - { .ctl_name = "DAC2 Left Sidetone Volume", .intval = 12, }, - { .ctl_name = "DAC2 Right Sidetone Volume", .intval = 12, }, { .ctl_name = "AIF2ADC Volume", .intval = 96, }, { .ctl_name = "AIF2ADCL DRC Switch", .intval = 0, }, { .ctl_name = NULL, }, @@ -152,11 +144,25 @@ struct route_setting default_input_disable[] = { { .ctl_name = "Main Mic Switch", .intval = 0, }, { .ctl_name = "MainMicBias Mode", .intval = 0, }, { .ctl_name = "MIXINL IN2L Switch", .intval = 0, }, + { .ctl_name = "AIF2DACL Source", .intval = 0, }, + { .ctl_name = "AIF2DACR Source", .intval = 1, }, + { .ctl_name = NULL, }, +}; + +struct route_setting noise_suppression[] = { + { .ctl_name = "Sub Mic Switch", .intval = 1, }, + { .ctl_name = "SubMicBias Mode", .intval = 1, }, + { .ctl_name = "IN1R Volume", .intval = 25, }, + { .ctl_name = "MIXINR IN1R Switch", .intval = 1, }, + { .ctl_name = "MIXINR IN1R Volume", .intval = 0, }, + { .ctl_name = "AIF1ADCR Source", .intval = 1, }, + { .ctl_name = NULL, }, +}; +struct route_setting noise_suppression_disable[] = { { .ctl_name = "Sub Mic Switch", .intval = 0, }, { .ctl_name = "SubMicBias Mode", .intval = 0, }, { .ctl_name = "MIXINR IN1R Switch", .intval = 0, }, - { .ctl_name = "AIF2DACL Source", .intval = 0, }, - { .ctl_name = "AIF2DACR Source", .intval = 1, }, + { .ctl_name = "MIXINR IN1R Volume", .intval = 0, }, { .ctl_name = NULL, }, }; -- cgit v1.1 From dc8ad459100dc13e945a2dbec15ce1b76b4a7047 Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Fri, 22 Aug 2014 11:05:55 +0530 Subject: Make low in-call volume fix configurable By making it configurable, it can be integrated in CM source without impact on other devices which don't have the problem --- overlay/packages/services/Telephony/res/values/config.xml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/overlay/packages/services/Telephony/res/values/config.xml b/overlay/packages/services/Telephony/res/values/config.xml index 23ec4e4..ba30c16 100644 --- a/overlay/packages/services/Telephony/res/values/config.xml +++ b/overlay/packages/services/Telephony/res/values/config.xml @@ -22,4 +22,16 @@ noise_suppression=true=false + + + true + + + true -- cgit v1.1 From 59e275e97913d84e1279d163a30b51a80bf8103d Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Sat, 27 Sep 2014 17:42:27 +0530 Subject: Revert "Make low in-call volume fix configurable" This reverts commit dc8ad459100dc13e945a2dbec15ce1b76b4a7047. --- overlay/packages/services/Telephony/res/values/config.xml | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/overlay/packages/services/Telephony/res/values/config.xml b/overlay/packages/services/Telephony/res/values/config.xml index ba30c16..23ec4e4 100644 --- a/overlay/packages/services/Telephony/res/values/config.xml +++ b/overlay/packages/services/Telephony/res/values/config.xml @@ -22,16 +22,4 @@ noise_suppression=true=false - - - true - - - true -- cgit v1.1 From ba2fcc722d9c9acb5d5bd4931e126eee4277015d Mon Sep 17 00:00:00 2001 From: Utkarsh Gupta Date: Thu, 25 Sep 2014 15:49:29 +0530 Subject: Audio: minor tweaks Change-Id: If350efed6ce6d1bcf3ac1c64a600ab5fe2cedc08 --- configs/tiny_hw.xml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/configs/tiny_hw.xml b/configs/tiny_hw.xml index 88f3651..924005d 100644 --- a/configs/tiny_hw.xml +++ b/configs/tiny_hw.xml @@ -163,7 +163,7 @@ We are able to have most of our routing static so do that - + @@ -261,16 +261,16 @@ We are able to have most of our routing static so do that - + - + - + @@ -282,13 +282,13 @@ We are able to have most of our routing static so do that - + - + - + -- cgit v1.1 From 1270d0cdbeb01e6c43ca2927718f54336676b11c Mon Sep 17 00:00:00 2001 From: Utkarsh Gupta Date: Thu, 15 May 2014 17:21:20 +0530 Subject: Audio HAL updates Change-Id: Ie41cade3494dc9d3f8ba886ae1f4977e25b97423 Conflicts: configs/tiny_hw.xml --- audio/audio_hw.c | 131 ++++++++++++++++++++++++++++------------------------ configs/tiny_hw.xml | 16 +++---- 2 files changed, 79 insertions(+), 68 deletions(-) diff --git a/audio/audio_hw.c b/audio/audio_hw.c index 31aecad..b54ea35 100644 --- a/audio/audio_hw.c +++ b/audio/audio_hw.c @@ -587,6 +587,18 @@ static void select_mode(struct m0_audio_device *adev) adev->in_call = 0; ril_set_call_clock_sync(&adev->ril, SOUND_CLOCK_STOP); end_call(adev); + //Force Input Standby + adev->in_device = AUDIO_DEVICE_NONE; + + ALOGD("%s: set voicecall route: voicecall_default_disable", __func__); + set_bigroute_by_array(adev->mixer, voicecall_default_disable, 1); + ALOGD("%s: set voicecall route: default_input_disable", __func__); + set_bigroute_by_array(adev->mixer, default_input_disable, 1); + ALOGD("%s: set voicecall route: headset_input_disable", __func__); + set_bigroute_by_array(adev->mixer, headset_input_disable, 1); + ALOGD("%s: set voicecall route: bt_disable", __func__); + set_bigroute_by_array(adev->mixer, bt_disable, 1); + force_all_standby(adev); ALOGD("%s: set voicecall route: voicecall_default_disable", __func__); @@ -2795,86 +2807,85 @@ static void adev_config_start(void *data, const XML_Char *elem, unsigned int i, j; for (i = 0; attr[i]; i += 2) { - if (strcmp(attr[i], "name") == 0) - name = attr[i + 1]; + if (strcmp(attr[i], "name") == 0) + name = attr[i + 1]; - if (strcmp(attr[i], "val") == 0) - val = attr[i + 1]; + if (strcmp(attr[i], "val") == 0) + val = attr[i + 1]; } if (strcmp(elem, "device") == 0) { - if (!name) { - ALOGE("Unnamed device\n"); - return; - } - - for (i = 0; i < sizeof(dev_names) / sizeof(dev_names[0]); i++) { - if (strcmp(dev_names[i].name, name) == 0) { - ALOGI("Allocating device %s\n", name); - dev_cfg = realloc(s->adev->dev_cfgs, - (s->adev->num_dev_cfgs + 1) - * sizeof(*dev_cfg)); - if (!dev_cfg) { - ALOGE("Unable to allocate dev_cfg\n"); + if (!name) { + ALOGE("Unnamed device\n"); return; } - s->dev = &dev_cfg[s->adev->num_dev_cfgs]; - memset(s->dev, 0, sizeof(*s->dev)); - s->dev->mask = dev_names[i].mask; + for (i = 0; i < sizeof(dev_names) / sizeof(dev_names[0]); i++) { + if (strcmp(dev_names[i].name, name) == 0) { + ALOGI("Allocating device %s\n", name); + dev_cfg = realloc(s->adev->dev_cfgs, + (s->adev->num_dev_cfgs + 1) + * sizeof(*dev_cfg)); + if (!dev_cfg) { + ALOGE("Unable to allocate dev_cfg\n"); + return; + } - s->adev->dev_cfgs = dev_cfg; - s->adev->num_dev_cfgs++; - } - } + s->dev = &dev_cfg[s->adev->num_dev_cfgs]; + memset(s->dev, 0, sizeof(*s->dev)); + s->dev->mask = dev_names[i].mask; + s->adev->dev_cfgs = dev_cfg; + s->adev->num_dev_cfgs++; + } + } } else if (strcmp(elem, "path") == 0) { - if (s->path_len) - ALOGW("Nested paths\n"); - - /* If this a path for a device it must have a role */ - if (s->dev) { - /* Need to refactor a bit... */ - if (strcmp(name, "on") == 0) { - s->on = true; - } else if (strcmp(name, "off") == 0) { - s->on = false; - } else { - ALOGW("Unknown path name %s\n", name); + if (s->path_len) + ALOGW("Nested paths\n"); + + /* If this a path for a device it must have a role */ + if (s->dev) { + /* Need to refactor a bit... */ + if (strcmp(name, "on") == 0) { + s->on = true; + } else if (strcmp(name, "off") == 0) { + s->on = false; + } else { + ALOGW("Unknown path name %s\n", name); + } } - } } else if (strcmp(elem, "ctl") == 0) { - struct route_setting *r; + struct route_setting *r; - if (!name) { - ALOGE("Unnamed control\n"); - return; - } + if (!name) { + ALOGE("Unnamed control\n"); + return; + } - if (!val) { - ALOGE("No value specified for %s\n", name); - return; - } + if (!val) { + ALOGE("No value specified for %s\n", name); + return; + } - ALOGV("Parsing control %s => %s\n", name, val); + ALOGV("Parsing control %s => %s\n", name, val); - r = realloc(s->path, sizeof(*r) * (s->path_len + 1)); - if (!r) { - ALOGE("Out of memory handling %s => %s\n", name, val); - return; - } + r = realloc(s->path, sizeof(*r) * (s->path_len + 1)); + if (!r) { + ALOGE("Out of memory handling %s => %s\n", name, val); + return; + } - r[s->path_len].ctl_name = strdup(name); - r[s->path_len].strval = NULL; + r[s->path_len].ctl_name = strdup(name); + r[s->path_len].strval = NULL; - /* This can be fooled but it'll do */ - r[s->path_len].intval = atoi(val); - if (!r[s->path_len].intval && strcmp(val, "0") != 0) - r[s->path_len].strval = strdup(val); + /* This can be fooled but it'll do */ + r[s->path_len].intval = atoi(val); + if (!r[s->path_len].intval && strcmp(val, "0") != 0) + r[s->path_len].strval = strdup(val); - s->path = r; - s->path_len++; + s->path = r; + s->path_len++; } } diff --git a/configs/tiny_hw.xml b/configs/tiny_hw.xml index 924005d..c693c0d 100644 --- a/configs/tiny_hw.xml +++ b/configs/tiny_hw.xml @@ -140,7 +140,7 @@ We are able to have most of our routing static so do that - + @@ -163,7 +163,7 @@ We are able to have most of our routing static so do that - + @@ -261,16 +261,16 @@ We are able to have most of our routing static so do that - + - + - + @@ -282,13 +282,13 @@ We are able to have most of our routing static so do that - + - + - + -- cgit v1.1 From d7ae560a7ae5a00ac45eeaff0494640b51af13ba Mon Sep 17 00:00:00 2001 From: Dheeraj CVR Date: Tue, 12 Aug 2014 19:45:59 +0530 Subject: Update audio profiles Change-Id: I05c379455be8dbf000837b12d942000c404dba20 Conflicts: audio/audio_hw.c configs/tiny_hw.xml --- audio/audio_hw.c | 131 ++++++++++++++++++++++++---------------------------- configs/tiny_hw.xml | 8 ++-- 2 files changed, 64 insertions(+), 75 deletions(-) diff --git a/audio/audio_hw.c b/audio/audio_hw.c index b54ea35..31aecad 100644 --- a/audio/audio_hw.c +++ b/audio/audio_hw.c @@ -587,18 +587,6 @@ static void select_mode(struct m0_audio_device *adev) adev->in_call = 0; ril_set_call_clock_sync(&adev->ril, SOUND_CLOCK_STOP); end_call(adev); - //Force Input Standby - adev->in_device = AUDIO_DEVICE_NONE; - - ALOGD("%s: set voicecall route: voicecall_default_disable", __func__); - set_bigroute_by_array(adev->mixer, voicecall_default_disable, 1); - ALOGD("%s: set voicecall route: default_input_disable", __func__); - set_bigroute_by_array(adev->mixer, default_input_disable, 1); - ALOGD("%s: set voicecall route: headset_input_disable", __func__); - set_bigroute_by_array(adev->mixer, headset_input_disable, 1); - ALOGD("%s: set voicecall route: bt_disable", __func__); - set_bigroute_by_array(adev->mixer, bt_disable, 1); - force_all_standby(adev); ALOGD("%s: set voicecall route: voicecall_default_disable", __func__); @@ -2807,85 +2795,86 @@ static void adev_config_start(void *data, const XML_Char *elem, unsigned int i, j; for (i = 0; attr[i]; i += 2) { - if (strcmp(attr[i], "name") == 0) - name = attr[i + 1]; + if (strcmp(attr[i], "name") == 0) + name = attr[i + 1]; - if (strcmp(attr[i], "val") == 0) - val = attr[i + 1]; + if (strcmp(attr[i], "val") == 0) + val = attr[i + 1]; } if (strcmp(elem, "device") == 0) { - if (!name) { - ALOGE("Unnamed device\n"); + if (!name) { + ALOGE("Unnamed device\n"); + return; + } + + for (i = 0; i < sizeof(dev_names) / sizeof(dev_names[0]); i++) { + if (strcmp(dev_names[i].name, name) == 0) { + ALOGI("Allocating device %s\n", name); + dev_cfg = realloc(s->adev->dev_cfgs, + (s->adev->num_dev_cfgs + 1) + * sizeof(*dev_cfg)); + if (!dev_cfg) { + ALOGE("Unable to allocate dev_cfg\n"); return; } - for (i = 0; i < sizeof(dev_names) / sizeof(dev_names[0]); i++) { - if (strcmp(dev_names[i].name, name) == 0) { - ALOGI("Allocating device %s\n", name); - dev_cfg = realloc(s->adev->dev_cfgs, - (s->adev->num_dev_cfgs + 1) - * sizeof(*dev_cfg)); - if (!dev_cfg) { - ALOGE("Unable to allocate dev_cfg\n"); - return; - } - - s->dev = &dev_cfg[s->adev->num_dev_cfgs]; - memset(s->dev, 0, sizeof(*s->dev)); - s->dev->mask = dev_names[i].mask; + s->dev = &dev_cfg[s->adev->num_dev_cfgs]; + memset(s->dev, 0, sizeof(*s->dev)); + s->dev->mask = dev_names[i].mask; - s->adev->dev_cfgs = dev_cfg; - s->adev->num_dev_cfgs++; - } + s->adev->dev_cfgs = dev_cfg; + s->adev->num_dev_cfgs++; } + } + } else if (strcmp(elem, "path") == 0) { - if (s->path_len) - ALOGW("Nested paths\n"); - - /* If this a path for a device it must have a role */ - if (s->dev) { - /* Need to refactor a bit... */ - if (strcmp(name, "on") == 0) { - s->on = true; - } else if (strcmp(name, "off") == 0) { - s->on = false; - } else { - ALOGW("Unknown path name %s\n", name); - } + if (s->path_len) + ALOGW("Nested paths\n"); + + /* If this a path for a device it must have a role */ + if (s->dev) { + /* Need to refactor a bit... */ + if (strcmp(name, "on") == 0) { + s->on = true; + } else if (strcmp(name, "off") == 0) { + s->on = false; + } else { + ALOGW("Unknown path name %s\n", name); } + } } else if (strcmp(elem, "ctl") == 0) { - struct route_setting *r; + struct route_setting *r; - if (!name) { - ALOGE("Unnamed control\n"); - return; - } + if (!name) { + ALOGE("Unnamed control\n"); + return; + } - if (!val) { - ALOGE("No value specified for %s\n", name); - return; - } + if (!val) { + ALOGE("No value specified for %s\n", name); + return; + } - ALOGV("Parsing control %s => %s\n", name, val); + ALOGV("Parsing control %s => %s\n", name, val); - r = realloc(s->path, sizeof(*r) * (s->path_len + 1)); - if (!r) { - ALOGE("Out of memory handling %s => %s\n", name, val); - return; - } + r = realloc(s->path, sizeof(*r) * (s->path_len + 1)); + if (!r) { + ALOGE("Out of memory handling %s => %s\n", name, val); + return; + } - r[s->path_len].ctl_name = strdup(name); - r[s->path_len].strval = NULL; + r[s->path_len].ctl_name = strdup(name); + r[s->path_len].strval = NULL; - /* This can be fooled but it'll do */ - r[s->path_len].intval = atoi(val); - if (!r[s->path_len].intval && strcmp(val, "0") != 0) - r[s->path_len].strval = strdup(val); + /* This can be fooled but it'll do */ + r[s->path_len].intval = atoi(val); + if (!r[s->path_len].intval && strcmp(val, "0") != 0) + r[s->path_len].strval = strdup(val); - s->path = r; - s->path_len++; + s->path = r; + s->path_len++; } } diff --git a/configs/tiny_hw.xml b/configs/tiny_hw.xml index c693c0d..88f3651 100644 --- a/configs/tiny_hw.xml +++ b/configs/tiny_hw.xml @@ -140,7 +140,7 @@ We are able to have most of our routing static so do that - + @@ -261,14 +261,14 @@ We are able to have most of our routing static so do that - + - + - + -- cgit v1.1 From ef5ba786d2c210c875f6dc7ed45b5baaaa551625 Mon Sep 17 00:00:00 2001 From: Andrew Jiang Date: Tue, 14 Jan 2014 12:08:52 -0500 Subject: N7100: Update RIL header to v9 [2/2] Change-Id: I6a4ba37f402f8c41e2e7fb43a7d8a3deae1a9193 --- include/telephony/ril.h | 114 ++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 111 insertions(+), 3 deletions(-) diff --git a/include/telephony/ril.h b/include/telephony/ril.h index 5678439..572aa46 100644 --- a/include/telephony/ril.h +++ b/include/telephony/ril.h @@ -19,6 +19,7 @@ #include #include +#include #ifndef FEATURE_UNIT_TEST #include #endif /* !FEATURE_UNIT_TEST */ @@ -27,7 +28,7 @@ extern "C" { #endif -#define RIL_VERSION 8 /* Current version */ +#define RIL_VERSION 9 /* Current version */ #ifdef LEGACY_RIL #define RIL_VERSION_MIN 2 /* Minimum RIL_VERSION supported */ #else @@ -125,7 +126,8 @@ typedef enum { PREF_NET_TYPE_LTE_CDMA_EVDO = 8, /* LTE, CDMA and EvDo */ PREF_NET_TYPE_LTE_GSM_WCDMA = 9, /* LTE, GSM/WCDMA */ PREF_NET_TYPE_LTE_CMDA_EVDO_GSM_WCDMA = 10, /* LTE, CDMA, EvDo, GSM/WCDMA */ - PREF_NET_TYPE_LTE_ONLY = 11 /* LTE only */ + PREF_NET_TYPE_LTE_ONLY = 11, /* LTE only */ + PREF_NET_TYPE_LTE_WCDMA = 12 /* LTE/WCDMA */ } RIL_PreferredNetworkType; /* Source for cdma subscription */ @@ -239,6 +241,28 @@ typedef struct { to point connections. */ } RIL_Data_Call_Response_v6; +typedef enum { + RADIO_TECH_3GPP = 1, /* 3GPP Technologies - GSM, WCDMA */ + RADIO_TECH_3GPP2 = 2 /* 3GPP2 Technologies - CDMA */ +} RIL_RadioTechnologyFamily; + +typedef struct { + RIL_RadioTechnologyFamily tech; + unsigned char retry; /* 0 == not retry, nonzero == retry */ + int messageRef; /* Valid field if retry is set to nonzero. + Contains messageRef from RIL_SMS_Response + corresponding to failed MO SMS. + */ + + union { + /* Valid field if tech is RADIO_TECH_3GPP2. See RIL_REQUEST_CDMA_SEND_SMS */ + RIL_CDMA_SMS_Message* cdmaMessage; + + /* Valid field if tech is RADIO_TECH_3GPP. See RIL_REQUEST_SEND_SMS */ + char** gsmMessage; + } message; +} RIL_IMS_SMS_Message; + typedef struct { int messageRef; /* TP-Message-Reference for GSM, and BearerData MessageId for CDMA @@ -394,6 +418,7 @@ typedef enum { PDP_FAIL_SERVICE_OPTION_NOT_SUBSCRIBED = 0x21, /* no retry */ PDP_FAIL_SERVICE_OPTION_OUT_OF_ORDER = 0x22, PDP_FAIL_NSAPI_IN_USE = 0x23, /* no retry */ + PDP_FAIL_REGULAR_DEACTIVATION = 0x24, /* restart radio */ PDP_FAIL_ONLY_IPV4_ALLOWED = 0x32, /* no retry */ PDP_FAIL_ONLY_IPV6_ALLOWED = 0x33, /* no retry */ PDP_FAIL_ONLY_SINGLE_BEARER_ALLOWED = 0x34, @@ -404,7 +429,7 @@ typedef enum { PDP_FAIL_DATA_REGISTRATION_FAIL = -2, /* reasons for data call drop - network/modem disconnect */ - PDP_FAIL_SIGNAL_LOST = -3, /* no retry */ + PDP_FAIL_SIGNAL_LOST = -3, PDP_FAIL_PREF_RADIO_TECH_CHANGED = -4,/* preferred technology has changed, should retry with parameters appropriate for new technology */ PDP_FAIL_RADIO_POWER_OFF = -5, /* data call was disconnected because radio was resetting, @@ -3494,6 +3519,66 @@ typedef struct { */ #define RIL_REQUEST_SET_UNSOL_CELL_INFO_LIST_RATE 110 +/** + * RIL_REQUEST_SET_INITIAL_ATTACH_APN + * + * Set an apn to initial attach network + * "response" is NULL + * + * Valid errors: + * SUCCESS + * RADIO_NOT_AVAILABLE (radio resetting) + * GENERIC_FAILURE + * SUBSCRIPTION_NOT_AVAILABLE + */ +#define RIL_REQUEST_SET_INITIAL_ATTACH_APN 111 + +/** + * RIL_REQUEST_IMS_REGISTRATION_STATE + * + * Request current IMS registration state + * + * "data" is NULL + * + * "response" is int * + * ((int *)response)[0] is registration state: + * 0 - Not registered + * 1 - Registered + * + * If ((int*)response)[0] is = 1, then ((int *) response)[1] + * must follow with IMS SMS format: + * + * ((int *) response)[1] is of type RIL_RadioTechnologyFamily + * + * Valid errors: + * SUCCESS + * RADIO_NOT_AVAILABLE + * GENERIC_FAILURE + */ +#define RIL_REQUEST_IMS_REGISTRATION_STATE 112 + +/** + * RIL_REQUEST_IMS_SEND_SMS + * + * Send a SMS message over IMS + * + * "data" is const RIL_IMS_SMS_Message * + * + * "response" is a const RIL_SMS_Response * + * + * Based on the return error, caller decides to resend if sending sms + * fails. SMS_SEND_FAIL_RETRY means retry, and other errors means no retry. + * In case of retry, data is encoded based on Voice Technology available. + * + * Valid errors: + * SUCCESS + * RADIO_NOT_AVAILABLE + * SMS_SEND_FAIL_RETRY + * FDN_CHECK_FAILURE + * GENERIC_FAILURE + * + */ +#define RIL_REQUEST_IMS_SEND_SMS 113 /* SAMSUNG REQUESTS */ #define RIL_REQUEST_GET_CELL_BROADCAST_CONFIG 10002 @@ -4037,6 +4122,21 @@ typedef struct { */ #define RIL_UNSOL_CELL_INFO_LIST 1036 +/** + * RIL_UNSOL_RESPONSE_IMS_NETWORK_STATE_CHANGED + * + * Called when IMS registration state has changed + * + * To get IMS registration state and IMS SMS format, callee needs to invoke the + * following request on main thread: + * + * RIL_REQUEST_IMS_REGISTRATION_STATE + * + * "data" is NULL + * + */ +#define RIL_UNSOL_RESPONSE_IMS_NETWORK_STATE_CHANGED 1037 + /* SAMSUNG RESPONSE */ #define SAMSUNG_UNSOL_RESPONSE_BASE 11000 @@ -4140,6 +4240,14 @@ typedef struct { RIL_GetVersion getVersion; } RIL_RadioFunctions; +typedef struct { + char *apn; + char *protocol; + int authtype; + char *username; + char *password; +} RIL_InitialAttachApn; + #ifdef RIL_SHLIB struct RIL_Env { /** -- cgit v1.1 From eea07f75d1aaa377639fa53e5c39e5be0d27e544 Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Thu, 20 Nov 2014 08:10:44 +0530 Subject: Initial bringup for lollipop --- n7100.mk | 1 - pa.dependencies | 20 +++++++++++++------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/n7100.mk b/n7100.mk index 857f938..ada8c6d 100644 --- a/n7100.mk +++ b/n7100.mk @@ -57,7 +57,6 @@ PRODUCT_PACKAGES += \ PRODUCT_PACKAGES += \ Apollo \ OpenDelta \ - DashClock \ DSPManager \ libcyanogen-dsp \ audio_effects.conf diff --git a/pa.dependencies b/pa.dependencies index b1461b0..2ea9bd9 100644 --- a/pa.dependencies +++ b/pa.dependencies @@ -7,7 +7,7 @@ "remote": "github", "repository": "tilaksidduram/android_device_samsung_smdk4412-common", "target_path": "device/samsung/smdk4412-common", - "revision": "kitkat" + "revision": "lollipop" }, { "repository": "android_kernel_samsung_smdk4412", @@ -17,24 +17,30 @@ "remote": "cm", "repository": "CyanogenMod/android_packages_apps_SamsungServiceMode", "target_path": "packages/apps/SamsungServiceMode", - "revision": "cm-11.0" + "revision": "cm-12.0" }, { "remote": "cm", "repository": "CyanogenMod/android_hardware_samsung", "target_path": "hardware/samsung", - "revision": "cm-11.0" + "revision": "cm-12.0" }, { "remote": "cm", "repository": "CyanogenMod/android_packages_apps_Apollo", "target_path": "packages/apps/Apollo", - "revision": "cm-11.0" + "revision": "cm-12.0" }, { - "remote": "blobs", - "repository": "proprietary_vendor_samsung", + "remote": "github", + "repository": "CrazyWeasel/proprietary_vendor_samsung", "target_path": "vendor/samsung", - "revision": "cm-11.0" + "revision": "n-2.0" + }, + { + "remote": "github", + "repository": "Fortune-OS/android_hardware_samsung_slsi_exynos4", + "target_path": "hardware/samsung_slsi/exynos4", + "revision": "android-5.0" } ] -- cgit v1.1 From d8c86560e2cbf54aece35051a7bb7a527104976f Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Wed, 12 Nov 2014 18:53:12 +0530 Subject: n7100: fixes for SElinux --- selinux/system.te | 14 +++++++------- selinux/wpa_supplicant.te | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/selinux/system.te b/selinux/system.te index df7b6fc..4ea6c98 100644 --- a/selinux/system.te +++ b/selinux/system.te @@ -1,11 +1,11 @@ -allow system input_device:chr_file { read ioctl write open }; -allow system sensors_device:chr_file { read open }; -allow system sensors_data_file:file r_file_perms; -allow system wpa_socket:unix_dgram_socket sendto; +allow system_server input_device:chr_file { read ioctl write open }; +allow system_server sensors_device:chr_file { read open }; +allow system_server sensors_data_file:file r_file_perms; +allow system_server wpa_socket:unix_dgram_socket sendto; allow system_app volume_data_file:file { read write open getattr }; -allow system sysfs:file { read open write }; -allow system self:capability { sys_module }; +allow system_server sysfs:file { read open write }; +allow system_server self:capability { sys_module }; # /efs/wifi/.mac.info -allow system wifi_data_file:file { read open }; +allow system_server wifi_data_file:file { read open }; diff --git a/selinux/wpa_supplicant.te b/selinux/wpa_supplicant.te index ab5fb24..c438b88 100755 --- a/selinux/wpa_supplicant.te +++ b/selinux/wpa_supplicant.te @@ -4,7 +4,7 @@ allow wpa init:unix_dgram_socket { read write }; allow wpa devpts:chr_file { read write }; allow wpa wpa_socket:unix_dgram_socket { read write }; -allow wpa_socket system:unix_dgram_socket sendto; +allow wpa_socket system_server:unix_dgram_socket sendto; allow wpa_socket wifi_data_file:sock_file unlink; -allow wpa rfkill_device:chr_file rw_file_perms; \ No newline at end of file +allow wpa rfkill_device:chr_file rw_file_perms; -- cgit v1.1 From 78a558314d7188d50e37b9bf7042ee79db5f1316 Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Wed, 12 Nov 2014 18:54:52 +0530 Subject: n7100: Add missing include for Camera wrapper --- camera/Android.mk | 3 +++ 1 file changed, 3 insertions(+) diff --git a/camera/Android.mk b/camera/Android.mk index a0652a6..38270ed 100644 --- a/camera/Android.mk +++ b/camera/Android.mk @@ -7,6 +7,9 @@ LOCAL_SRC_FILES := \ LOCAL_SHARED_LIBRARIES := \ libhardware liblog libcamera_client libutils +LOCAL_C_INCLUDES += \ + system/media/camera/include + LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw LOCAL_MODULE := camera.exynos4 LOCAL_MODULE_TAGS := optional -- cgit v1.1 From 845888aae1723199b55d11f99888d869fd8a9d1c Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Thu, 20 Nov 2014 08:18:49 +0530 Subject: n7100: storage_list: no more external app moving --- overlay/frameworks/base/core/res/res/xml/storage_list.xml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) 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 9108fdc..b576f8a 100644 --- a/overlay/frameworks/base/core/res/res/xml/storage_list.xml +++ b/overlay/frameworks/base/core/res/res/xml/storage_list.xml @@ -43,8 +43,7 @@ android:storageDescription="@string/storage_sd_card" android:primary="false" android:removable="true" - android:allowMassStorage="true" - android:externalApps="true" /> + android:allowMassStorage="true" /> Date: Sat, 15 Nov 2014 12:26:07 +0530 Subject: disable SElinux for now --- BoardConfig.mk | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/BoardConfig.mk b/BoardConfig.mk index 9c77a3f..9f1b56f 100644 --- a/BoardConfig.mk +++ b/BoardConfig.mk @@ -48,21 +48,21 @@ RECOVERY_FSTAB_VERSION := 2 SENSORS_NEED_SETRATE_ON_ENABLE := true # Selinux -BOARD_SEPOLICY_DIRS += \ - device/samsung/n7100/selinux +#BOARD_SEPOLICY_DIRS += \ +# device/samsung/n7100/selinux -BOARD_SEPOLICY_UNION += \ - device.te \ - domain.te \ - file.te \ - file_contexts \ - init.te \ - mediaserver.te \ - rild.te \ - system.te \ - ueventd.te \ - vold.te \ - wpa_supplicant.te +#BOARD_SEPOLICY_UNION += \ +# device.te \ +# domain.te \ +# file.te \ +# file_contexts \ +# init.te \ +# mediaserver.te \ +# rild.te \ +# system.te \ +# ueventd.te \ +# vold.te \ +# wpa_supplicant.te # Camera wrapper TARGET_PROVIDES_CAMERA_HAL := true -- cgit v1.1 From fd9a749c5cb9ac51ded5babc897dde3d883bfa57 Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Sat, 15 Nov 2014 12:27:50 +0530 Subject: Several updates to gps --- include/hardware/gps.h | 1027 +++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 939 insertions(+), 88 deletions(-) diff --git a/include/hardware/gps.h b/include/hardware/gps.h index f149e98..60bad77 100644 --- a/include/hardware/gps.h +++ b/include/hardware/gps.h @@ -21,6 +21,8 @@ #include #include #include +#include +#include #include @@ -38,6 +40,9 @@ typedef int64_t GpsUtcTime; /** Maximum number of SVs for gps_sv_status_callback(). */ #define GPS_MAX_SVS 32 +/** Maximum number of Measurements in gps_measurement_callback(). */ +#define GPS_MAX_MEASUREMENT 32 + /** Requested operational mode for GPS operation. */ typedef uint32_t GpsPositionMode; // IMPORTANT: Note that the following values must match @@ -133,6 +138,12 @@ typedef uint16_t AGpsSetIDType; #define AGPS_SETID_TYPE_IMSI 1 #define AGPS_SETID_TYPE_MSISDN 2 +typedef uint16_t ApnIpType; +#define APN_IP_INVALID 0 +#define APN_IP_IPV4 1 +#define APN_IP_IPV6 2 +#define APN_IP_IPV4V6 3 + /** * String length constants */ @@ -204,6 +215,137 @@ typedef uint16_t AGpsStatusValue; #define AGPS_RIL_NETWORK_TTYPE_WIMAX 6 /** + * Flags to indicate what fields in GpsClock are valid. + */ +typedef uint16_t GpsClockFlags; +/** A valid 'leap second' is stored in the data structure. */ +#define GPS_CLOCK_HAS_LEAP_SECOND (1<<0) +/** A valid 'time uncertainty' is stored in the data structure. */ +#define GPS_CLOCK_HAS_TIME_UNCERTAINTY (1<<1) +/** A valid 'full bias' is stored in the data structure. */ +#define GPS_CLOCK_HAS_FULL_BIAS (1<<2) +/** A valid 'bias' is stored in the data structure. */ +#define GPS_CLOCK_HAS_BIAS (1<<3) +/** A valid 'bias uncertainty' is stored in the data structure. */ +#define GPS_CLOCK_HAS_BIAS_UNCERTAINTY (1<<4) +/** A valid 'drift' is stored in the data structure. */ +#define GPS_CLOCK_HAS_DRIFT (1<<5) +/** A valid 'drift uncertainty' is stored in the data structure. */ +#define GPS_CLOCK_HAS_DRIFT_UNCERTAINTY (1<<6) + +/** + * Enumeration of the available values for the GPS Clock type. + */ +typedef uint8_t GpsClockType; +/** The type is not available ot it is unknown. */ +#define GPS_CLOCK_TYPE_UNKNOWN 0 +/** The source of the time value reported by GPS clock is the local hardware clock. */ +#define GPS_CLOCK_TYPE_LOCAL_HW_TIME 1 +/** + * The source of the time value reported by GPS clock is the GPS time derived from satellites + * (epoch = Jan 6, 1980) + */ +#define GPS_CLOCK_TYPE_GPS_TIME 2 + +/** + * Flags to indicate what fields in GpsMeasurement are valid. + */ +typedef uint32_t GpsMeasurementFlags; +/** A valid 'snr' is stored in the data structure. */ +#define GPS_MEASUREMENT_HAS_SNR (1<<0) +/** A valid 'elevation' is stored in the data structure. */ +#define GPS_MEASUREMENT_HAS_ELEVATION (1<<1) +/** A valid 'elevation uncertainty' is stored in the data structure. */ +#define GPS_MEASUREMENT_HAS_ELEVATION_UNCERTAINTY (1<<2) +/** A valid 'azimuth' is stored in the data structure. */ +#define GPS_MEASUREMENT_HAS_AZIMUTH (1<<3) +/** A valid 'azimuth uncertainty' is stored in the data structure. */ +#define GPS_MEASUREMENT_HAS_AZIMUTH_UNCERTAINTY (1<<4) +/** A valid 'pseudorange' is stored in the data structure. */ +#define GPS_MEASUREMENT_HAS_PSEUDORANGE (1<<5) +/** A valid 'pseudorange uncertainty' is stored in the data structure. */ +#define GPS_MEASUREMENT_HAS_PSEUDORANGE_UNCERTAINTY (1<<6) +/** A valid 'code phase' is stored in the data structure. */ +#define GPS_MEASUREMENT_HAS_CODE_PHASE (1<<7) +/** A valid 'code phase uncertainty' is stored in the data structure. */ +#define GPS_MEASUREMENT_HAS_CODE_PHASE_UNCERTAINTY (1<<8) +/** A valid 'carrier frequency' is stored in the data structure. */ +#define GPS_MEASUREMENT_HAS_CARRIER_FREQUENCY (1<<9) +/** A valid 'carrier cycles' is stored in the data structure. */ +#define GPS_MEASUREMENT_HAS_CARRIER_CYCLES (1<<10) +/** A valid 'carrier phase' is stored in the data structure. */ +#define GPS_MEASUREMENT_HAS_CARRIER_PHASE (1<<11) +/** A valid 'carrier phase uncertainty' is stored in the data structure. */ +#define GPS_MEASUREMENT_HAS_CARRIER_PHASE_UNCERTAINTY (1<<12) +/** A valid 'bit number' is stored in the data structure. */ +#define GPS_MEASUREMENT_HAS_BIT_NUMBER (1<<13) +/** A valid 'time from last bit' is stored in the data structure. */ +#define GPS_MEASUREMENT_HAS_TIME_FROM_LAST_BIT (1<<14) +/** A valid 'doppler shift' is stored in the data structure. */ +#define GPS_MEASUREMENT_HAS_DOPPLER_SHIFT (1<<15) +/** A valid 'doppler shift uncertainty' is stored in the data structure. */ +#define GPS_MEASUREMENT_HAS_DOPPLER_SHIFT_UNCERTAINTY (1<<16) +/** A valid 'used in fix' flag is stored in the data structure. */ +#define GPS_MEASUREMENT_HAS_USED_IN_FIX (1<<17) + +/** + * Enumeration of the available values for the GPS Measurement's loss of lock. + */ +typedef uint8_t GpsLossOfLock; +/** The indicator is not available or it is unknown. */ +#define GPS_LOSS_OF_LOCK_UNKNOWN 0 +/** The measurement does not present any indication of loss of lock. */ +#define GPS_LOSS_OF_LOCK_OK 1 +/** Loss of lock between previous and current observation: cycle slip possible. */ +#define GPS_LOSS_OF_LOCK_CYCLE_SLIP 2 + +/** + * Enumeration of available values for the GPS Measurement's multipath indicator. + */ +typedef uint8_t GpsMultipathIndicator; +/** The indicator is not available or unknown. */ +#define GPS_MULTIPATH_INDICATOR_UNKNOWN 0 +/** The measurement has been indicated to use multipath. */ +#define GPS_MULTIPATH_INDICATOR_DETECTED 1 +/** The measurement has been indicated Not to use multipath. */ +#define GPS_MULTIPATH_INDICATOR_NOT_USED 2 + +/** + * Flags indicating the GPS measurement state. + */ +typedef uint16_t GpsMeasurementState; +#define GPS_MEASUREMENT_STATE_UNKNOWN 0 +#define GPS_MEASUREMENT_STATE_CODE_LOCK (1<<0) +#define GPS_MEASUREMENT_STATE_BIT_SYNC (1<<1) +#define GPS_MEASUREMENT_STATE_SUBFRAME_SYNC (1<<2) +#define GPS_MEASUREMENT_STATE_TOW_DECODED (1<<3) + +/** + * Flags indicating the Accumulated Delta Range's states. + */ +typedef uint16_t GpsAccumulatedDeltaRangeState; +#define GPS_ADR_STATE_UNKNOWN 0 +#define GPS_ADR_STATE_VALID (1<<0) +#define GPS_ADR_STATE_RESET (1<<1) +#define GPS_ADR_STATE_CYCLE_SLIP (1<<2) + +/** + * Enumeration of available values to indicate the available GPS Natigation message types. + */ +typedef uint8_t GpsNavigationMessageType; +/** The message type is unknown. */ +#define GPS_NAVIGATION_MESSAGE_TYPE_UNKNOWN 0 +/** L1 C/A message contained in the structure. */ +#define GPS_NAVIGATION_MESSAGE_TYPE_L1CA 1 +/** L2-CNAV message contained in the structure. */ +#define GPS_NAVIGATION_MESSAGE_TYPE_L2CNAV 2 +/** L5-CNAV message contained in the structure. */ +#define GPS_NAVIGATION_MESSAGE_TYPE_L5CNAV 3 +/** CNAV-2 message contained in the structure. */ +#define GPS_NAVIGATION_MESSAGE_TYPE_CNAV2 4 + + +/** * Name for the GPS XTRA interface. */ #define GPS_XTRA_INTERFACE "gps-xtra" @@ -219,6 +361,11 @@ typedef uint16_t AGpsStatusValue; #define AGPS_INTERFACE "agps" /** + * Name of the Supl Certificate interface. + */ +#define SUPL_CERTIFICATE_INTERFACE "supl-certificate" + +/** * Name for NI interface */ #define GPS_NI_INTERFACE "gps-ni" @@ -238,6 +385,22 @@ typedef uint16_t AGpsStatusValue; */ #define GPS_GEOFENCING_INTERFACE "gps_geofencing" +/** + * Name of the GPS Measurements interface. + */ +#define GPS_MEASUREMENT_INTERFACE "gps_measurement" + +/** + * Name of the GPS navigation message interface. + */ +#define GPS_NAVIGATION_MESSAGE_INTERFACE "gps_navigation_message" + +/** + * Name of the GNSS/GPS configuration interface. + */ +#define GNSS_CONFIGURATION_INTERFACE "gnss_configuration" + + /** Represents a location. */ typedef struct { /** set to sizeof(GpsLocation) */ @@ -353,8 +516,9 @@ typedef void (* gps_location_callback)(GpsLocation* location); */ typedef void (* gps_status_callback)(GpsStatus* status); -/** Callback with SV status information. - * Can only be called from a thread created by create_thread_cb. +/** + * Callback with SV status information. + * Can only be called from a thread created by create_thread_cb. */ typedef void (* gps_sv_status_callback)(GpsSvStatus* sv_info); @@ -488,13 +652,45 @@ typedef struct { /** Represents the status of AGPS. */ typedef struct { - /** set to sizeof(AGpsStatus) */ + /** set to sizeof(AGpsStatus_v1) */ + size_t size; + + AGpsType type; + AGpsStatusValue status; +} AGpsStatus_v1; + +/** Represents the status of AGPS augmented with a IPv4 address field. */ +typedef struct { + /** set to sizeof(AGpsStatus_v2) */ size_t size; AGpsType type; AGpsStatusValue status; uint32_t ipaddr; -} AGpsStatus; +} AGpsStatus_v2; + +/* Represents the status of AGPS augmented to support IPv4 and IPv6. */ +typedef struct { + /** set to sizeof(AGpsStatus_v3) */ + size_t size; + + AGpsType type; + AGpsStatusValue status; + + /** + * Must be set to a valid IPv4 address if the field 'addr' contains an IPv4 + * address, or set to INADDR_NONE otherwise. + */ + uint32_t ipaddr; + + /** + * Must contain the IPv4 (AF_INET) or IPv6 (AF_INET6) address to report. + * Any other value of addr.ss_family will be rejected. + * */ + struct sockaddr_storage addr; +} AGpsStatus_v3; + +typedef AGpsStatus_v3 AGpsStatus; /** Callback with AGPS status information. * Can only be called from a thread created by create_thread_cb. @@ -510,16 +706,16 @@ typedef struct { /** Extended interface for AGPS support. */ typedef struct { - /** set to sizeof(AGpsInterface) */ + /** set to sizeof(AGpsInterface_v1) */ size_t size; /** * Opens the AGPS interface and provides the callback routines - * to the implemenation of this interface. + * to the implementation of this interface. */ void (*init)( AGpsCallbacks* callbacks ); /** - * Notifies that a data connection is available and sets + * Notifies that a data connection is available and sets * the name of the APN to be used for SUPL. */ int (*data_conn_open)( const char* apn ); @@ -528,15 +724,124 @@ typedef struct { */ int (*data_conn_closed)(); /** - * Notifies that a data connection is not available for AGPS. + * Notifies that a data connection is not available for AGPS. */ int (*data_conn_failed)(); /** * Sets the hostname and port for the AGPS server. */ int (*set_server)( AGpsType type, const char* hostname, int port ); -} AGpsInterface; +} AGpsInterface_v1; + +/** + * Extended interface for AGPS support, it is augmented to enable to pass + * extra APN data. + */ +typedef struct { + /** set to sizeof(AGpsInterface_v2) */ + size_t size; + + /** + * Opens the AGPS interface and provides the callback routines to the + * implementation of this interface. + */ + void (*init)(AGpsCallbacks* callbacks); + /** + * Deprecated. + * If the HAL supports AGpsInterface_v2 this API will not be used, see + * data_conn_open_with_apn_ip_type for more information. + */ + int (*data_conn_open)(const char* apn); + /** + * Notifies that the AGPS data connection has been closed. + */ + int (*data_conn_closed)(); + /** + * Notifies that a data connection is not available for AGPS. + */ + int (*data_conn_failed)(); + /** + * Sets the hostname and port for the AGPS server. + */ + int (*set_server)(AGpsType type, const char* hostname, int port); + + /** + * Notifies that a data connection is available and sets the name of the + * APN, and its IP type, to be used for SUPL connections. + */ + int (*data_conn_open_with_apn_ip_type)( + const char* apn, + ApnIpType apnIpType); +} AGpsInterface_v2; + +typedef AGpsInterface_v2 AGpsInterface; + +/** Error codes associated with certificate operations */ +#define AGPS_CERTIFICATE_OPERATION_SUCCESS 0 +#define AGPS_CERTIFICATE_ERROR_GENERIC -100 +#define AGPS_CERTIFICATE_ERROR_TOO_MANY_CERTIFICATES -101 + +/** A data structure that represents an X.509 certificate using DER encoding */ +typedef struct { + size_t length; + u_char* data; +} DerEncodedCertificate; +/** + * A type definition for SHA1 Fingerprints used to identify X.509 Certificates + * The Fingerprint is a digest of the DER Certificate that uniquely identifies it. + */ +typedef struct { + u_char data[20]; +} Sha1CertificateFingerprint; + +/** AGPS Interface to handle SUPL certificate operations */ +typedef struct { + /** set to sizeof(SuplCertificateInterface) */ + size_t size; + + /** + * Installs a set of Certificates used for SUPL connections to the AGPS server. + * If needed the HAL should find out internally any certificates that need to be removed to + * accommodate the certificates to install. + * The certificates installed represent a full set of valid certificates needed to connect to + * AGPS SUPL servers. + * The list of certificates is required, and all must be available at the same time, when trying + * to establish a connection with the AGPS Server. + * + * Parameters: + * certificates - A pointer to an array of DER encoded certificates that are need to be + * installed in the HAL. + * length - The number of certificates to install. + * Returns: + * AGPS_CERTIFICATE_OPERATION_SUCCESS if the operation is completed successfully + * AGPS_CERTIFICATE_ERROR_TOO_MANY_CERTIFICATES if the HAL cannot store the number of + * certificates attempted to be installed, the state of the certificates stored should + * remain the same as before on this error case. + * + * IMPORTANT: + * If needed the HAL should find out internally the set of certificates that need to be + * removed to accommodate the certificates to install. + */ + int (*install_certificates) ( const DerEncodedCertificate* certificates, size_t length ); + + /** + * Notifies the HAL that a list of certificates used for SUPL connections are revoked. It is + * expected that the given set of certificates is removed from the internal store of the HAL. + * + * Parameters: + * fingerprints - A pointer to an array of SHA1 Fingerprints to identify the set of + * certificates to revoke. + * length - The number of fingerprints provided. + * Returns: + * AGPS_CERTIFICATE_OPERATION_SUCCESS if the operation is completed successfully. + * + * IMPORTANT: + * If any of the certificates provided (through its fingerprint) is not known by the HAL, + * it should be ignored and continue revoking/deleting the rest of them. + */ + int (*revoke_certificates) ( const Sha1CertificateFingerprint* fingerprints, size_t length ); +} SuplCertificateInterface; /** Represents an NI request */ typedef struct { @@ -662,7 +967,7 @@ typedef struct { size_t size; /** * Opens the AGPS interface and provides the callback routines - * to the implemenation of this interface. + * to the implementation of this interface. */ void (*init)( AGpsRilCallbacks* callbacks ); @@ -692,6 +997,7 @@ typedef struct { */ void (*update_network_availability) (int avaiable, const char* apn); } AGpsRilInterface; + /** * GPS Geofence. * There are 3 states associated with a Geofence: Inside, Outside, Unknown. @@ -778,28 +1084,29 @@ typedef struct { #define GPS_GEOFENCE_ERROR_ID_UNKNOWN -102 #define GPS_GEOFENCE_ERROR_INVALID_TRANSITION -103 #define GPS_GEOFENCE_ERROR_GENERIC -149 + /** -* The callback associated with the geofence. -* Parameters: -* geofence_id - The id associated with the add_geofence_area. -* location - The current GPS location. -* transition - Can be one of GPS_GEOFENCE_ENTERED, GPS_GEOFENCE_EXITED, -* GPS_GEOFENCE_UNCERTAIN. -* timestamp - Timestamp when the transition was detected. -* -* The callback should only be called when the caller is interested in that -* particular transition. For instance, if the caller is interested only in -* ENTERED transition, then the callback should NOT be called with the EXITED -* transition. -* -* IMPORTANT: If a transition is triggered resulting in this callback, the GPS -* subsystem will wake up the application processor, if its in suspend state. -*/ + * The callback associated with the geofence. + * Parameters: + * geofence_id - The id associated with the add_geofence_area. + * location - The current GPS location. + * transition - Can be one of GPS_GEOFENCE_ENTERED, GPS_GEOFENCE_EXITED, + * GPS_GEOFENCE_UNCERTAIN. + * timestamp - Timestamp when the transition was detected. + * + * The callback should only be called when the caller is interested in that + * particular transition. For instance, if the caller is interested only in + * ENTERED transition, then the callback should NOT be called with the EXITED + * transition. + * + * IMPORTANT: If a transition is triggered resulting in this callback, the GPS + * subsystem will wake up the application processor, if its in suspend state. + */ typedef void (*gps_geofence_transition_callback) (int32_t geofence_id, GpsLocation* location, -int32_t transition, GpsUtcTime timestamp); + int32_t transition, GpsUtcTime timestamp); /** - * The callback associated with the availablity of the GPS system for geofencing + * The callback associated with the availability of the GPS system for geofencing * monitoring. If the GPS system determines that it cannot monitor geofences * because of lack of reliability or unavailability of the GPS signals, it will * call this callback with GPS_GEOFENCE_UNAVAILABLE parameter. @@ -872,78 +1179,622 @@ typedef struct { /** Extended interface for GPS_Geofencing support */ typedef struct { - /** set to sizeof(GpsGeofencingInterface) */ - size_t size; + /** set to sizeof(GpsGeofencingInterface) */ + size_t size; + + /** + * Opens the geofence interface and provides the callback routines + * to the implementation of this interface. + */ + void (*init)( GpsGeofenceCallbacks* callbacks ); + + /** + * Add a geofence area. This api currently supports circular geofences. + * Parameters: + * geofence_id - The id for the geofence. If a geofence with this id + * already exists, an error value (GPS_GEOFENCE_ERROR_ID_EXISTS) + * should be returned. + * latitude, longtitude, radius_meters - The lat, long and radius + * (in meters) for the geofence + * last_transition - The current state of the geofence. For example, if + * the system already knows that the user is inside the geofence, + * this will be set to GPS_GEOFENCE_ENTERED. In most cases, it + * will be GPS_GEOFENCE_UNCERTAIN. + * monitor_transition - Which transitions to monitor. Bitwise OR of + * GPS_GEOFENCE_ENTERED, GPS_GEOFENCE_EXITED and + * GPS_GEOFENCE_UNCERTAIN. + * notification_responsiveness_ms - Defines the best-effort description + * of how soon should the callback be called when the transition + * associated with the Geofence is triggered. For instance, if set + * to 1000 millseconds with GPS_GEOFENCE_ENTERED, the callback + * should be called 1000 milliseconds within entering the geofence. + * This parameter is defined in milliseconds. + * NOTE: This is not to be confused with the rate that the GPS is + * polled at. It is acceptable to dynamically vary the rate of + * sampling the GPS for power-saving reasons; thus the rate of + * sampling may be faster or slower than this. + * unknown_timer_ms - The time limit after which the UNCERTAIN transition + * should be triggered. This parameter is defined in milliseconds. + * See above for a detailed explanation. + */ + void (*add_geofence_area) (int32_t geofence_id, double latitude, double longitude, + double radius_meters, int last_transition, int monitor_transitions, + int notification_responsiveness_ms, int unknown_timer_ms); + + /** + * Pause monitoring a particular geofence. + * Parameters: + * geofence_id - The id for the geofence. + */ + void (*pause_geofence) (int32_t geofence_id); + + /** + * Resume monitoring a particular geofence. + * Parameters: + * geofence_id - The id for the geofence. + * monitor_transitions - Which transitions to monitor. Bitwise OR of + * GPS_GEOFENCE_ENTERED, GPS_GEOFENCE_EXITED and + * GPS_GEOFENCE_UNCERTAIN. + * This supersedes the value associated provided in the + * add_geofence_area call. + */ + void (*resume_geofence) (int32_t geofence_id, int monitor_transitions); + + /** + * Remove a geofence area. After the function returns, no notifications + * should be sent. + * Parameter: + * geofence_id - The id for the geofence. + */ + void (*remove_geofence_area) (int32_t geofence_id); +} GpsGeofencingInterface; + + +/** + * Represents an estimate of the GPS clock time. + */ +typedef struct { + /** set to sizeof(GpsClock) */ + size_t size; + + /** A set of flags indicating the validity of the fields in this data structure. */ + GpsClockFlags flags; /** - * Opens the geofence interface and provides the callback routines - * to the implemenation of this interface. + * Leap second data. + * The sign of the value is defined by the following equation: + * utc_time_ns = time_ns + (full_bias_ns + bias_ns) - leap_second * 1,000,000,000 + * + * If the data is available 'flags' must contain GPS_CLOCK_HAS_LEAP_SECOND. */ - void (*init)( GpsGeofenceCallbacks* callbacks ); + int16_t leap_second; /** - * Add a geofence area. This api currently supports circular geofences. - * Parameters: - * geofence_id - The id for the geofence. If a geofence with this id - * already exists, an error value (GPS_GEOFENCE_ERROR_ID_EXISTS) - * should be returned. - * latitude, longtitude, radius_meters - The lat, long and radius - * (in meters) for the geofence - * last_transition - The current state of the geofence. For example, if - * the system already knows that the user is inside the geofence, - * this will be set to GPS_GEOFENCE_ENTERED. In most cases, it - * will be GPS_GEOFENCE_UNCERTAIN. - * monitor_transition - Which transitions to monitor. Bitwise OR of - * GPS_GEOFENCE_ENTERED, GPS_GEOFENCE_EXITED and - * GPS_GEOFENCE_UNCERTAIN. - * notification_responsiveness_ms - Defines the best-effort description - * of how soon should the callback be called when the transition - * associated with the Geofence is triggered. For instance, if set - * to 1000 millseconds with GPS_GEOFENCE_ENTERED, the callback - * should be called 1000 milliseconds within entering the geofence. - * This parameter is defined in milliseconds. - * NOTE: This is not to be confused with the rate that the GPS is - * polled at. It is acceptable to dynamically vary the rate of - * sampling the GPS for power-saving reasons; thus the rate of - * sampling may be faster or slower than this. - * unknown_timer_ms - The time limit after which the UNCERTAIN transition - * should be triggered. This paramter is defined in milliseconds. - * See above for a detailed explanation. - */ - void (*add_geofence_area) (int32_t geofence_id, double latitude, - double longitude, double radius_meters, - int last_transition, int monitor_transitions, - int notification_responsiveness_ms, - int unknown_timer_ms); - - /** - * Pause monitoring a particular geofence. - * Parameters: - * geofence_id - The id for the geofence. + * Indicates the type of time reported by the 'time_ns' field. + * This is a Mandatory field. */ - void (*pause_geofence) (int32_t geofence_id); + GpsClockType type; /** - * Resume monitoring a particular geofence. - * Parameters: - * geofence_id - The id for the geofence. - * monitor_transitions - Which transitions to monitor. Bitwise OR of - * GPS_GEOFENCE_ENTERED, GPS_GEOFENCE_EXITED and - * GPS_GEOFENCE_UNCERTAIN. - * This supersedes the value associated provided in the - * add_geofence_area call. + * The GPS receiver internal clock value. This can be either the local hardware clock value + * (GPS_CLOCK_TYPE_LOCAL_HW_TIME), or the current GPS time derived inside GPS receiver + * (GPS_CLOCK_TYPE_GPS_TIME). The field 'type' defines the time reported. + * + * For local hardware clock, this value is expected to be monotonically increasing during + * the reporting session. The real GPS time can be derived by compensating the 'full bias' + * (when it is available) from this value. + * + * For GPS time, this value is expected to be the best estimation of current GPS time that GPS + * receiver can achieve. Set the 'time uncertainty' appropriately when GPS time is specified. + * + * Sub-nanosecond accuracy can be provided by means of the 'bias' field. + * The value contains the 'time uncertainty' in it. + * + * This is a Mandatory field. + */ + int64_t time_ns; + + /** + * 1-Sigma uncertainty associated with the clock's time in nanoseconds. + * The uncertainty is represented as an absolute (single sided) value. + * + * This value should be set if GPS_CLOCK_TYPE_GPS_TIME is set. + * If the data is available 'flags' must contain GPS_CLOCK_HAS_TIME_UNCERTAINTY. */ - void (*resume_geofence) (int32_t geofence_id, int monitor_transitions); + double time_uncertainty_ns; /** - * Remove a geofence area. After the function returns, no notifications - * should be sent. - * Parameter: - * geofence_id - The id for the geofence. + * The difference between hardware clock ('time' field) inside GPS receiver and the true GPS + * time since 0000Z, January 6, 1980, in nanoseconds. + * This value is used if and only if GPS_CLOCK_TYPE_LOCAL_HW_TIME is set, and GPS receiver + * has solved the clock for GPS time. + * The caller is responsible for using the 'bias uncertainty' field for quality check. + * + * The sign of the value is defined by the following equation: + * true time (GPS time) = time_ns + (full_bias_ns + bias_ns) + * + * This value contains the 'bias uncertainty' in it. + * If the data is available 'flags' must contain GPS_CLOCK_HAS_FULL_BIAS. */ - void (*remove_geofence_area) (int32_t geofence_id); -} GpsGeofencingInterface; + int64_t full_bias_ns; + + /** + * Sub-nanosecond bias. + * The value contains the 'bias uncertainty' in it. + * + * If the data is available 'flags' must contain GPS_CLOCK_HAS_BIAS. + */ + double bias_ns; + + /** + * 1-Sigma uncertainty associated with the clock's bias in nanoseconds. + * The uncertainty is represented as an absolute (single sided) value. + * + * If the data is available 'flags' must contain GPS_CLOCK_HAS_BIAS_UNCERTAINTY. + */ + double bias_uncertainty_ns; + + /** + * The clock's drift in nanoseconds (per second). + * A positive value means that the frequency is higher than the nominal frequency. + * + * The value contains the 'drift uncertainty' in it. + * If the data is available 'flags' must contain GPS_CLOCK_HAS_DRIFT. + */ + double drift_nsps; + + /** + * 1-Sigma uncertainty associated with the clock's drift in nanoseconds (per second). + * The uncertainty is represented as an absolute (single sided) value. + * + * If the data is available 'flags' must contain GPS_CLOCK_HAS_DRIFT_UNCERTAINTY. + */ + double drift_uncertainty_nsps; +} GpsClock; + +/** + * Represents a GPS Measurement, it contains raw and computed information. + */ +typedef struct { + /** set to sizeof(GpsMeasurement) */ + size_t size; + + /** A set of flags indicating the validity of the fields in this data structure. */ + GpsMeasurementFlags flags; + + /** + * Pseudo-random number in the range of [1, 32] + * This is a Mandatory value. + */ + int8_t prn; + + /** + * Time offset at which the measurement was taken in nanoseconds. + * The reference receiver's time is specified by GpsData::clock::time_ns and should be + * interpreted in the same way as indicated by GpsClock::type. + * + * The sign of time_offset_ns is given by the following equation: + * measurement time = GpsClock::time_ns + time_offset_ns + * + * It provides an individual time-stamp for the measurement, and allows sub-nanosecond accuracy. + * This is a Mandatory value. + */ + double time_offset_ns; + + /** + * Per satellite sync state. It represents the current sync state for the associated satellite. + * Based on the sync state, the 'received GPS tow' field should be interpreted accordingly. + * + * This is a Mandatory value. + */ + GpsMeasurementState state; + + /** + * Received GPS Time-of-Week at the measurement time, in nanoseconds. + * The value is relative to the beginning of the current GPS week. + * + * Given the sync state of GPS receiver, per each satellite, valid range for this field can be: + * Searching : [ 0 ] : GPS_MEASUREMENT_STATE_UNKNOWN + * Ranging code lock : [ 0 1ms ] : GPS_MEASUREMENT_STATE_CODE_LOCK is set + * Bit sync : [ 0 20ms ] : GPS_MEASUREMENT_STATE_BIT_SYNC is set + * Subframe sync : [ 0 6ms ] : GPS_MEASUREMENT_STATE_SUBFRAME_SYNC is set + * TOW decoded : [ 0 1week ] : GPS_MEASUREMENT_STATE_TOW_DECODED is set + */ + int64_t received_gps_tow_ns; + + /** + * 1-Sigma uncertainty of the Received GPS Time-of-Week in nanoseconds. + */ + int64_t received_gps_tow_uncertainty_ns; + + /** + * Carrier-to-noise density in dB-Hz, in the range [0, 63]. + * It contains the measured C/N0 value for the signal at the antenna input. + * + * This is a Mandatory value. + */ + double c_n0_dbhz; + + /** + * Pseudorange rate at the timestamp in m/s. + * The value also includes the effects of the receiver clock frequency and satellite clock + * frequency errors. + * + * The value includes the 'pseudorange rate uncertainty' in it. + * A positive value indicates that the pseudorange is getting larger. + * + * This is a Mandatory value. + */ + double pseudorange_rate_mps; + + /** + * 1-Sigma uncertainty of the pseudurange rate in m/s. + * The uncertainty is represented as an absolute (single sided) value. + * + * This is a Mandatory value. + */ + double pseudorange_rate_uncertainty_mps; + + /** + * Accumulated delta range's state. It indicates whether ADR is reset or there is a cycle slip + * (indicating loss of lock). + * + * This is a Mandatory value. + */ + GpsAccumulatedDeltaRangeState accumulated_delta_range_state; + + /** + * Accumulated delta range since the last channel reset in meters. + * The data is available if 'accumulated delta range state' != GPS_ADR_STATE_UNKNOWN. + */ + double accumulated_delta_range_m; + + /** + * 1-Sigma uncertainty of the accumulated delta range in meters. + * The data is available if 'accumulated delta range state' != GPS_ADR_STATE_UNKNOWN. + */ + double accumulated_delta_range_uncertainty_m; + + /** + * Best derived Pseudorange by the chip-set, in meters. + * The value contains the 'pseudorange uncertainty' in it. + * + * If the data is available, 'flags' must contain GPS_MEASUREMENT_HAS_PSEUDORANGE. + */ + double pseudorange_m; + + /** + * 1-Sigma uncertainty of the pseudorange in meters. + * The value contains the 'pseudorange' and 'clock' uncertainty in it. + * The uncertainty is represented as an absolute (single sided) value. + * + * If the data is available, 'flags' must contain GPS_MEASUREMENT_HAS_PSEUDORANGE_UNCERTAINTY. + */ + double pseudorange_uncertainty_m; + + /** + * A fraction of the current C/A code cycle, in the range [0.0, 1023.0] + * This value contains the time (in Chip units) since the last C/A code cycle (GPS Msec epoch). + * + * The reference frequency is given by the field 'carrier_frequency_hz'. + * The value contains the 'code-phase uncertainty' in it. + * + * If the data is available, 'flags' must contain GPS_MEASUREMENT_HAS_CODE_PHASE. + */ + double code_phase_chips; + + /** + * 1-Sigma uncertainty of the code-phase, in a fraction of chips. + * The uncertainty is represented as an absolute (single sided) value. + * + * If the data is available, 'flags' must contain GPS_MEASUREMENT_HAS_CODE_PHASE_UNCERTAINTY. + */ + double code_phase_uncertainty_chips; + + /** + * Carrier frequency at which codes and messages are modulated, it can be L1 or L2. + * If the field is not set, the carrier frequency is assumed to be L1. + * + * If the data is available, 'flags' must contain GPS_MEASUREMENT_HAS_CARRIER_FREQUENCY. + */ + float carrier_frequency_hz; + + /** + * The number of full carrier cycles between the satellite and the receiver. + * The reference frequency is given by the field 'carrier_frequency_hz'. + * + * If the data is available, 'flags' must contain GPS_MEASUREMENT_HAS_CARRIER_CYCLES. + */ + int64_t carrier_cycles; + + /** + * The RF phase detected by the receiver, in the range [0.0, 1.0]. + * This is usually the fractional part of the complete carrier phase measurement. + * + * The reference frequency is given by the field 'carrier_frequency_hz'. + * The value contains the 'carrier-phase uncertainty' in it. + * + * If the data is available, 'flags' must contain GPS_MEASUREMENT_HAS_CARRIER_PHASE. + */ + double carrier_phase; + + /** + * 1-Sigma uncertainty of the carrier-phase. + * If the data is available, 'flags' must contain GPS_MEASUREMENT_HAS_CARRIER_PHASE_UNCERTAINTY. + */ + double carrier_phase_uncertainty; + + /** + * An enumeration that indicates the 'loss of lock' state of the event. + */ + GpsLossOfLock loss_of_lock; + + /** + * The number of GPS bits transmitted since Sat-Sun midnight (GPS week). + * If the data is available, 'flags' must contain GPS_MEASUREMENT_HAS_BIT_NUMBER. + */ + int32_t bit_number; + + /** + * The elapsed time since the last received bit in milliseconds, in the range [0, 20] + * If the data is available, 'flags' must contain GPS_MEASUREMENT_HAS_TIME_FROM_LAST_BIT. + */ + int16_t time_from_last_bit_ms; + + /** + * Doppler shift in Hz. + * A positive value indicates that the SV is moving toward the receiver. + * + * The reference frequency is given by the field 'carrier_frequency_hz'. + * The value contains the 'doppler shift uncertainty' in it. + * + * If the data is available, 'flags' must contain GPS_MEASUREMENT_HAS_DOPPLER_SHIFT. + */ + double doppler_shift_hz; + + /** + * 1-Sigma uncertainty of the doppler shift in Hz. + * If the data is available, 'flags' must contain GPS_MEASUREMENT_HAS_DOPPLER_SHIFT_UNCERTAINTY. + */ + double doppler_shift_uncertainty_hz; + + /** + * An enumeration that indicates the 'multipath' state of the event. + */ + GpsMultipathIndicator multipath_indicator; + + /** + * Signal-to-noise ratio in dB. + * If the data is available, 'flags' must contain GPS_MEASUREMENT_HAS_SNR. + */ + double snr_db; + + /** + * Elevation in degrees, the valid range is [-90, 90]. + * The value contains the 'elevation uncertainty' in it. + * If the data is available, 'flags' must contain GPS_MEASUREMENT_HAS_ELEVATION. + */ + double elevation_deg; + + /** + * 1-Sigma uncertainty of the elevation in degrees, the valid range is [0, 90]. + * The uncertainty is represented as the absolute (single sided) value. + * + * If the data is available, 'flags' must contain GPS_MEASUREMENT_HAS_ELEVATION_UNCERTAINTY. + */ + double elevation_uncertainty_deg; + + /** + * Azimuth in degrees, in the range [0, 360). + * The value contains the 'azimuth uncertainty' in it. + * If the data is available, 'flags' must contain GPS_MEASUREMENT_HAS_AZIMUTH. + * */ + double azimuth_deg; + + /** + * 1-Sigma uncertainty of the azimuth in degrees, the valid range is [0, 180]. + * The uncertainty is represented as an absolute (single sided) value. + * + * If the data is available, 'flags' must contain GPS_MEASUREMENT_HAS_AZIMUTH_UNCERTAINTY. + */ + double azimuth_uncertainty_deg; + + /** + * Whether the GPS represented by the measurement was used for computing the most recent fix. + * If the data is available, 'flags' must contain GPS_MEASUREMENT_HAS_USED_IN_FIX. + */ + bool used_in_fix; +} GpsMeasurement; + +/** Represents a reading of GPS measurements. */ +typedef struct { + /** set to sizeof(GpsData) */ + size_t size; + + /** Number of measurements. */ + size_t measurement_count; + + /** The array of measurements. */ + GpsMeasurement measurements[GPS_MAX_MEASUREMENT]; + + /** The GPS clock time reading. */ + GpsClock clock; +} GpsData; + +/** + * The callback for to report measurements from the HAL. + * + * Parameters: + * data - A data structure containing the measurements. + */ +typedef void (*gps_measurement_callback) (GpsData* data); + +typedef struct { + /** set to sizeof(GpsMeasurementCallbacks) */ + size_t size; + gps_measurement_callback measurement_callback; +} GpsMeasurementCallbacks; + +#define GPS_MEASUREMENT_OPERATION_SUCCESS 0 +#define GPS_MEASUREMENT_ERROR_ALREADY_INIT -100 +#define GPS_MEASUREMENT_ERROR_GENERIC -101 + +/** + * Extended interface for GPS Measurements support. + */ +typedef struct { + /** Set to sizeof(GpsMeasurementInterface) */ + size_t size; + + /** + * Initializes the interface and registers the callback routines with the HAL. + * After a successful call to 'init' the HAL must begin to provide updates at its own phase. + * + * Status: + * GPS_MEASUREMENT_OPERATION_SUCCESS + * GPS_MEASUREMENT_ERROR_ALREADY_INIT - if a callback has already been registered without a + * corresponding call to 'close' + * GPS_MEASUREMENT_ERROR_GENERIC - if any other error occurred, it is expected that the HAL + * will not generate any updates upon returning this error code. + */ + int (*init) (GpsMeasurementCallbacks* callbacks); + + /** + * Stops updates from the HAL, and unregisters the callback routines. + * After a call to stop, the previously registered callbacks must be considered invalid by the + * HAL. + * If stop is invoked without a previous 'init', this function should perform no work. + */ + void (*close) (); + +} GpsMeasurementInterface; + + +/** Represents a GPS navigation message (or a fragment of it). */ +typedef struct { + /** set to sizeof(GpsNavigationMessage) */ + size_t size; + + /** + * Pseudo-random number in the range of [1, 32] + * This is a Mandatory value. + */ + int8_t prn; + + /** + * The type of message contained in the structure. + * This is a Mandatory value. + */ + GpsNavigationMessageType type; + + /** + * Message identifier. + * It provides an index so the complete Navigation Message can be assembled. i.e. fo L1 C/A + * subframe 4 and 5, this value corresponds to the 'frame id' of the navigation message. + * Subframe 1, 2, 3 does not contain a 'frame id' and this value can be set to -1. + */ + int16_t message_id; + + /** + * Sub-message identifier. + * If required by the message 'type', this value contains a sub-index within the current + * message (or frame) that is being transmitted. + * i.e. for L1 C/A the submessage id corresponds to the sub-frame id of the navigation message. + */ + int16_t submessage_id; + + /** + * The length of the data (in bytes) contained in the current message. + * If this value is different from zero, 'data' must point to an array of the same size. + * e.g. for L1 C/A the size of the sub-frame will be 40 bytes (10 words, 30 bits/word). + * + * This is a Mandatory value. + */ + size_t data_length; + + /** + * The data of the reported GPS message. + * The bytes (or words) specified using big endian format (MSB first). + * + * For L1 C/A, each subframe contains 10 30-bit GPS words. Each GPS word (30 bits) should be + * fitted into the last 30 bits in a 4-byte word (skip B31 and B32), with MSB first. + */ + uint8_t* data; + +} GpsNavigationMessage; + +/** + * The callback to report an available fragment of a GPS navigation messages from the HAL. + * + * Parameters: + * message - The GPS navigation submessage/subframe representation. + */ +typedef void (*gps_navigation_message_callback) (GpsNavigationMessage* message); + +typedef struct { + /** set to sizeof(GpsNavigationMessageCallbacks) */ + size_t size; + gps_navigation_message_callback navigation_message_callback; +} GpsNavigationMessageCallbacks; + +#define GPS_NAVIGATION_MESSAGE_OPERATION_SUCCESS 0 +#define GPS_NAVIGATION_MESSAGE_ERROR_ALREADY_INIT -100 +#define GPS_NAVIGATION_MESSAGE_ERROR_GENERIC -101 + +/** + * Extended interface for GPS navigation message reporting support. + */ +typedef struct { + /** Set to sizeof(GpsNavigationMessageInterface) */ + size_t size; + + /** + * Initializes the interface and registers the callback routines with the HAL. + * After a successful call to 'init' the HAL must begin to provide updates as they become + * available. + * + * Status: + * GPS_NAVIGATION_MESSAGE_OPERATION_SUCCESS + * GPS_NAVIGATION_MESSAGE_ERROR_ALREADY_INIT - if a callback has already been registered + * without a corresponding call to 'close'. + * GPS_NAVIGATION_MESSAGE_ERROR_GENERIC - if any other error occurred, it is expected that + * the HAL will not generate any updates upon returning this error code. + */ + int (*init) (GpsNavigationMessageCallbacks* callbacks); + + /** + * Stops updates from the HAL, and unregisters the callback routines. + * After a call to stop, the previously registered callbacks must be considered invalid by the + * HAL. + * If stop is invoked without a previous 'init', this function should perform no work. + */ + void (*close) (); + +} GpsNavigationMessageInterface; + +/** + * Interface for passing GNSS configuration contents from platform to HAL. + */ +typedef struct { + /** Set to sizeof(GnssConfigurationInterface) */ + size_t size; + + /** + * Deliver GNSS configuration contents to HAL. + * Parameters: + * config_data - a pointer to a char array which holds what usually is expected from + file(/etc/gps.conf), i.e., a sequence of UTF8 strings separated by '\n'. + * length - total number of UTF8 characters in configuraiton data. + * + * IMPORTANT: + * GPS HAL should expect this function can be called multiple times. And it may be + * called even when GpsLocationProvider is already constructed and enabled. GPS HAL + * should maintain the existing requests for various callback regardless the change + * in configuration data. + */ + void (*configuration_update) (const char* config_data, int32_t length); +} GnssConfigurationInterface; + __END_DECLS #endif /* ANDROID_INCLUDE_HARDWARE_GPS_H */ - -- cgit v1.1 From 44f95ae0ecbcce9f84414d9f919d006cbd2f9635 Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Thu, 20 Nov 2014 09:49:48 +0530 Subject: dependencie file updated --- pa.dependencies | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pa.dependencies b/pa.dependencies index 2ea9bd9..9e85500 100644 --- a/pa.dependencies +++ b/pa.dependencies @@ -20,10 +20,10 @@ "revision": "cm-12.0" }, { - "remote": "cm", - "repository": "CyanogenMod/android_hardware_samsung", + "remote": "github", + "repository": "tilaksidduram/android_hardware_samsung", "target_path": "hardware/samsung", - "revision": "cm-12.0" + "revision": "lollipop" }, { "remote": "cm", @@ -41,6 +41,6 @@ "remote": "github", "repository": "Fortune-OS/android_hardware_samsung_slsi_exynos4", "target_path": "hardware/samsung_slsi/exynos4", - "revision": "android-5.0" + "revision": "android-5.0" } ] -- cgit v1.1 From f09d0012af2fdac047aae8be9869562a6772f5fd Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Thu, 20 Nov 2014 19:55:56 +0530 Subject: disable some overlays --- .../frameworks/base/core/res/res/values/config.xml | 20 ++++++++++---------- .../base/core/res/res/values/pa_config.xml | 4 ++-- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/overlay/frameworks/base/core/res/res/values/config.xml b/overlay/frameworks/base/core/res/res/values/config.xml index 3c8a86c..da0991f 100644 --- a/overlay/frameworks/base/core/res/res/values/config.xml +++ b/overlay/frameworks/base/core/res/res/values/config.xml @@ -84,11 +84,11 @@ true - - true + - - true + 1000 @@ -96,8 +96,8 @@ 9000 - - true + true @@ -114,9 +114,9 @@ config to 7. --> 7 - - true + - - true + diff --git a/overlay/frameworks/base/core/res/res/values/pa_config.xml b/overlay/frameworks/base/core/res/res/values/pa_config.xml index 13f9a31..63eba10 100644 --- a/overlay/frameworks/base/core/res/res/values/pa_config.xml +++ b/overlay/frameworks/base/core/res/res/values/pa_config.xml @@ -18,6 +18,6 @@ --> - - true + -- cgit v1.1 From 39a5964beea3061992a7ed059330009893ce0395 Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Sat, 22 Nov 2014 16:24:49 +0530 Subject: add nfc enhanced --- n7100.mk | 2 ++ 1 file changed, 2 insertions(+) diff --git a/n7100.mk b/n7100.mk index ada8c6d..b8e08ab 100644 --- a/n7100.mk +++ b/n7100.mk @@ -90,6 +90,8 @@ PRODUCT_PACKAGES += \ com.android.nfc_extras \ Stk +$(call inherit-product, vendor/pa/configs/nfc_enhanced.mk) + # RIL PRODUCT_PROPERTY_OVERRIDES += \ ro.telephony.ril_class=SamsungExynos4RIL \ -- cgit v1.1 From e5eeb1dd04560d2495d48704ad79537993244660 Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Mon, 24 Nov 2014 09:50:38 +0530 Subject: enable samsung stk overlay --- overlay/frameworks/base/core/res/res/values/config.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/overlay/frameworks/base/core/res/res/values/config.xml b/overlay/frameworks/base/core/res/res/values/config.xml index da0991f..c99dca1 100644 --- a/overlay/frameworks/base/core/res/res/values/config.xml +++ b/overlay/frameworks/base/core/res/res/values/config.xml @@ -114,8 +114,8 @@ config to 7. --> 7 - + + true -- cgit v1.1 From 3b58f2d4e26284ad18bfc88728a1918a5e03eb4b Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Mon, 24 Nov 2014 09:54:17 +0530 Subject: N7100: Add ambient display doze feature --- overlay/frameworks/base/core/res/res/values/config.xml | 7 +++++++ overlay/frameworks/base/packages/SystemUI/res/values/config.xml | 6 ++++++ 2 files changed, 13 insertions(+) diff --git a/overlay/frameworks/base/core/res/res/values/config.xml b/overlay/frameworks/base/core/res/res/values/config.xml index c99dca1..c4f59d6 100644 --- a/overlay/frameworks/base/core/res/res/values/config.xml +++ b/overlay/frameworks/base/core/res/res/values/config.xml @@ -119,4 +119,11 @@ + + + com.android.systemui/com.android.systemui.doze.DozeService + 10 + true + true + true diff --git a/overlay/frameworks/base/packages/SystemUI/res/values/config.xml b/overlay/frameworks/base/packages/SystemUI/res/values/config.xml index 88851f7..49b1c81 100644 --- a/overlay/frameworks/base/packages/SystemUI/res/values/config.xml +++ b/overlay/frameworks/base/packages/SystemUI/res/values/config.xml @@ -22,5 +22,11 @@ true + + + true + + + true -- cgit v1.1 From 7b6559c05bd89a766c76ab11f89b960efedee8d6 Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Wed, 26 Nov 2014 01:17:04 +0530 Subject: overlay: Enable Battery & Notification LED settings --- overlay/frameworks/base/core/res/res/values/config.xml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/overlay/frameworks/base/core/res/res/values/config.xml b/overlay/frameworks/base/core/res/res/values/config.xml index c4f59d6..e0b6d0f 100644 --- a/overlay/frameworks/base/core/res/res/values/config.xml +++ b/overlay/frameworks/base/core/res/res/values/config.xml @@ -84,11 +84,11 @@ true - + + true - + + true 1000 @@ -122,7 +122,7 @@ com.android.systemui/com.android.systemui.doze.DozeService - 10 + 20 true true true -- cgit v1.1 From 36283f47e2f7f0cc1162897a3fea2638dc4a892d Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Wed, 26 Nov 2014 21:09:37 +0530 Subject: n7100: more update to GPS header --- include/hardware/gps.h | 57 +++++++++++++++++++++++++++++++++++--------------- 1 file changed, 40 insertions(+), 17 deletions(-) diff --git a/include/hardware/gps.h b/include/hardware/gps.h index 60bad77..834516f 100644 --- a/include/hardware/gps.h +++ b/include/hardware/gps.h @@ -108,25 +108,47 @@ typedef uint16_t GpsLocationFlags; #define GPS_CAPABILITY_SINGLE_SHOT 0x0000008 /** GPS supports on demand time injection */ #define GPS_CAPABILITY_ON_DEMAND_TIME 0x0000010 +/** GPS supports Geofencing */ +#define GPS_CAPABILITY_GEOFENCING 0x0000020 +/** GPS supports Measurements */ +#define GPS_CAPABILITY_MEASUREMENTS 0x0000040 +/** GPS supports Navigation Messages */ +#define GPS_CAPABILITY_NAV_MESSAGES 0x0000080 /** Flags used to specify which aiding data to delete when calling delete_aiding_data(). */ -typedef uint16_t GpsAidingData; +typedef uint32_t GpsAidingData; // IMPORTANT: Note that the following values must match // constants in GpsLocationProvider.java. -#define GPS_DELETE_EPHEMERIS 0x0001 -#define GPS_DELETE_ALMANAC 0x0002 -#define GPS_DELETE_POSITION 0x0004 -#define GPS_DELETE_TIME 0x0008 -#define GPS_DELETE_IONO 0x0010 -#define GPS_DELETE_UTC 0x0020 -#define GPS_DELETE_HEALTH 0x0040 -#define GPS_DELETE_SVDIR 0x0080 -#define GPS_DELETE_SVSTEER 0x0100 -#define GPS_DELETE_SADATA 0x0200 -#define GPS_DELETE_RTI 0x0400 -#define GPS_DELETE_CELLDB_INFO 0x8000 -#define GPS_DELETE_ALL 0xFFFF +#define GPS_DELETE_EPHEMERIS 0x00000001 +#define GPS_DELETE_ALMANAC 0x00000002 +#define GPS_DELETE_POSITION 0x00000004 +#define GPS_DELETE_TIME 0x00000008 +#define GPS_DELETE_IONO 0x00000010 +#define GPS_DELETE_UTC 0x00000020 +#define GPS_DELETE_HEALTH 0x00000040 +#define GPS_DELETE_SVDIR 0x00000080 +#define GPS_DELETE_SVSTEER 0x00000100 +#define GPS_DELETE_SADATA 0x00000200 +#define GPS_DELETE_RTI 0x00000400 +#define GPS_DELETE_CELLDB_INFO 0x00000800 +#define GPS_DELETE_ALMANAC_CORR 0x00001000 +#define GPS_DELETE_FREQ_BIAS_EST 0x00002000 +#define GLO_DELETE_EPHEMERIS 0x00004000 +#define GLO_DELETE_ALMANAC 0x00008000 +#define GLO_DELETE_SVDIR 0x00010000 +#define GLO_DELETE_SVSTEER 0x00020000 +#define GLO_DELETE_ALMANAC_CORR 0x00040000 +#define GPS_DELETE_TIME_GPS 0x00080000 +#define GLO_DELETE_TIME 0x00100000 +#define BDS_DELETE_SVDIR 0X00200000 +#define BDS_DELETE_SVSTEER 0X00400000 +#define BDS_DELETE_TIME 0X00800000 +#define BDS_DELETE_ALMANAC_CORR 0X01000000 +#define BDS_DELETE_EPHEMERIS 0X02000000 +#define BDS_DELETE_ALMANAC 0X04000000 + +#define GPS_DELETE_ALL 0xFFFFFFFF /** AGPS type */ typedef uint16_t AGpsType; @@ -380,7 +402,7 @@ typedef uint8_t GpsNavigationMessageType; */ #define AGPS_USE_PSC -/* +/** * Name for the GPS_Geofencing interface. */ #define GPS_GEOFENCING_INTERFACE "gps_geofencing" @@ -480,6 +502,7 @@ typedef struct { uint32_t used_in_fix_mask; } GpsSvStatus; + /* 2G and 3G */ /* In 3G lac is discarded */ typedef struct { @@ -570,7 +593,7 @@ typedef struct { size_t size; /** * Opens the interface and provides the callback routines - * to the implemenation of this interface. + * to the implementation of this interface. */ int (*init)( GpsCallbacks* callbacks ); @@ -631,7 +654,7 @@ typedef struct { size_t size; /** * Opens the XTRA interface and provides the callback routines - * to the implemenation of this interface. + * to the implementation of this interface. */ int (*init)( GpsXtraCallbacks* callbacks ); /** Injects XTRA data into the GPS. */ -- cgit v1.1 From 8446116f0e83199213748ce3fc50b2d1b7e81274 Mon Sep 17 00:00:00 2001 From: Dheeraj CVR Date: Mon, 17 Nov 2014 07:42:35 +0530 Subject: n7100: update mobile data interfaces Change-Id: Id12e56cbe08bdee0e83589ddce691bc01fe72646 --- n7100.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/n7100.mk b/n7100.mk index b8e08ab..d3e0d6d 100644 --- a/n7100.mk +++ b/n7100.mk @@ -95,7 +95,7 @@ $(call inherit-product, vendor/pa/configs/nfc_enhanced.mk) # RIL PRODUCT_PROPERTY_OVERRIDES += \ ro.telephony.ril_class=SamsungExynos4RIL \ - mobiledata.interfaces=pdp0,wlan0,gprs,ppp0 \ + mobiledata.interfaces=pdp0,gprs,ppp0,rmnet0,rmnet1 \ ro.telephony.call_ring.multiple=false \ ro.telephony.call_ring.delay=3000 -- cgit v1.1 From 0cf727cfa78e5795b9e10aab1288f245e62e2ab8 Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Wed, 26 Nov 2014 21:19:48 +0530 Subject: n7100: add missing overlay for Notification Led --- overlay/frameworks/base/core/res/res/values/config.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/overlay/frameworks/base/core/res/res/values/config.xml b/overlay/frameworks/base/core/res/res/values/config.xml index e0b6d0f..dbcfa88 100644 --- a/overlay/frameworks/base/core/res/res/values/config.xml +++ b/overlay/frameworks/base/core/res/res/values/config.xml @@ -84,6 +84,9 @@ true + + true + true -- cgit v1.1 From c0dc734598e49b4d9e8d5ef5a74c058cc44ee414 Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Fri, 28 Nov 2014 00:03:27 +0530 Subject: n7100: removed not required nfc permission. --- n7100.mk | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/n7100.mk b/n7100.mk index d3e0d6d..7103aca 100644 --- a/n7100.mk +++ b/n7100.mk @@ -73,8 +73,7 @@ PRODUCT_COPY_FILES += \ packages/apps/Nfc/migrate_nfc.txt:system/etc/updatecmds/migrate_nfc.txt \ frameworks/base/nfc-extras/com.android.nfc_extras.xml:system/etc/permissions/com.android.nfc_extras.xml \ frameworks/native/data/etc/android.hardware.bluetooth_le.xml:system/etc/permissions/android.hardware.bluetooth_le.xml \ - frameworks/native/data/etc/android.hardware.nfc.xml:system/etc/permissions/android.hardware.nfc.xml \ - frameworks/native/data/etc/android.hardware.nfc.hce.xml:system/etc/permissions/android.hardware.nfc.hce.xml + frameworks/native/data/etc/android.hardware.nfc.xml:system/etc/permissions/android.hardware.nfc.xml # NFCEE access control ifeq ($(TARGET_BUILD_VARIANT),user) -- cgit v1.1 From ec035c624a748a77ad75083f52ae5a305a6c543d Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Fri, 28 Nov 2014 00:05:08 +0530 Subject: Revert "N7100: Fix video snapshots" This reverts commit 54f66e6fb83ef1680030c4e199e6393f70de6c95. --- camera/CameraWrapper.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/camera/CameraWrapper.cpp b/camera/CameraWrapper.cpp index 41f62d5..be454d9 100644 --- a/camera/CameraWrapper.cpp +++ b/camera/CameraWrapper.cpp @@ -129,6 +129,9 @@ static char * camera_fixup_getparams(int id, const char * settings) params.set(android::CameraParameters::KEY_SUPPORTED_ISO_MODES, iso_values[id]); + /* We do support it, so announce it */ + params.set(android::CameraParameters::KEY_VIDEO_SNAPSHOT_SUPPORTED, "true"); + ALOGV("%s: fixed parameters:", __func__); //params.dump(); -- cgit v1.1 From 4bf77cc5ecac137d0c654035afa4508b5c309ecb Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Fri, 28 Nov 2014 00:05:21 +0530 Subject: Revert "Camera wrapper update" This reverts commit 0a499126670ffc029713c3c245d6f6bb73192b12. --- camera/CameraWrapper.cpp | 164 +++++++++++++++++++---------------------------- 1 file changed, 65 insertions(+), 99 deletions(-) diff --git a/camera/CameraWrapper.cpp b/camera/CameraWrapper.cpp index be454d9..e503b03 100644 --- a/camera/CameraWrapper.cpp +++ b/camera/CameraWrapper.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012-2013, The CyanogenMod Project + * Copyright (C) 2012, The CyanogenMod Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,7 +21,8 @@ * */ -//#define LOG_NDEBUG 0 + +#define LOG_NDEBUG 0 //#define LOG_PARAMETERS #define LOG_TAG "CameraWrapper" @@ -37,10 +38,10 @@ static android::Mutex gCameraWrapperLock; static camera_module_t *gVendorModule = 0; -static bool preview_running = false; +bool preview_running = false; -static int camera_device_open(const hw_module_t* module, const char *name, - hw_device_t **device); +static int camera_device_open(const hw_module_t* module, const char* name, + hw_device_t** device); static int camera_device_close(hw_device_t* device); static int camera_get_number_of_cameras(void); static int camera_get_camera_info(int camera_id, struct camera_info *info); @@ -55,15 +56,14 @@ camera_module_t HAL_MODULE_INFO_SYM = { version_major: 1, version_minor: 0, id: CAMERA_HARDWARE_MODULE_ID, - name: "m0xx Camera Wrapper", - author: "The CyanogenMod Project", + name: "Exynos4x12 Camera Wrapper", + author: "Teamhacksung ", methods: &camera_module_methods, dso: NULL, /* remove compilation warnings */ reserved: {0}, /* remove compilation warnings */ }, get_number_of_cameras: camera_get_number_of_cameras, get_camera_info: camera_get_camera_info, - set_callbacks: NULL, }; typedef struct wrapper_camera_device { @@ -84,10 +84,10 @@ static int check_vendor_module() int rv = 0; ALOGV("%s", __FUNCTION__); - if (gVendorModule) + if(gVendorModule) return 0; - rv = hw_get_module_by_class("camera", "vendor", (const hw_module_t **)&gVendorModule); + rv = hw_get_module("vendor-camera", (const hw_module_t **)&gVendorModule); if (rv) ALOGE("failed to open vendor camera module"); return rv; @@ -97,93 +97,49 @@ const static char * iso_values[] = {"auto,ISO100,ISO200,ISO400,ISO800","auto"}; static char * camera_fixup_getparams(int id, const char * settings) { - bool videoMode = false; - char *manipBuf; - android::CameraParameters params; params.unflatten(android::String8(settings)); - ALOGV("%s: original parameters:", __func__); - //params.dump(); - - if (params.get(android::CameraParameters::KEY_RECORDING_HINT)) { - videoMode = (!strcmp(params.get(android::CameraParameters::KEY_RECORDING_HINT), "true")); - } - -#if 0 // this is busted atm - /* Set supported scene modes */ - if (!videoMode) { - manipBuf = strdup(params.get(android::CameraParameters::KEY_SUPPORTED_SCENE_MODES)); - if (manipBuf != NULL && strstr(manipBuf,"hdr") == NULL) { - strncat(manipBuf,",hdr",4); - params.set(android::CameraParameters::KEY_SUPPORTED_SCENE_MODES, - manipBuf); - } - free(manipBuf); - } - - if (params.get("hdr-mode") && !strncmp(params.get("hdr-mode"),"1",1)) { - params.set(android::CameraParameters::KEY_SCENE_MODE, "hdr"); - } -#endif - + // fix params here params.set(android::CameraParameters::KEY_SUPPORTED_ISO_MODES, iso_values[id]); - - /* We do support it, so announce it */ + params.set(android::CameraParameters::KEY_AUTO_EXPOSURE_LOCK, "false"); params.set(android::CameraParameters::KEY_VIDEO_SNAPSHOT_SUPPORTED, "true"); - ALOGV("%s: fixed parameters:", __func__); - //params.dump(); - android::String8 strParams = params.flatten(); char *ret = strdup(strParams.string()); + ALOGD("%s: get parameters fixed up", __FUNCTION__); return ret; } char * camera_fixup_setparams(int id, const char * settings) { - int previewW, previewH; - bool videoMode = false; - const char *sceneMode = "auto"; - android::CameraParameters params; params.unflatten(android::String8(settings)); - ALOGV("%s: original parameters:", __func__); - //params.dump(); - - if (params.get(android::CameraParameters::KEY_RECORDING_HINT)) { - videoMode = (!strcmp(params.get(android::CameraParameters::KEY_RECORDING_HINT), "true")); - } - -#if 0 // this is busted atm - if (!videoMode && !strncmp(params.get(android::CameraParameters::KEY_SCENE_MODE),"hdr",3)) { - params.set("hdr-mode", "1"); - params.set(android::CameraParameters::KEY_SCENE_MODE, "auto"); - } else { - params.set("hdr-mode", "0"); - } -#endif - - if (params.get("iso")) { + // fix params here + if(params.get("iso")) { const char* isoMode = params.get(android::CameraParameters::KEY_ISO_MODE); - if (strcmp(isoMode, "ISO100") == 0) + if(strcmp(isoMode, "ISO100") == 0) params.set(android::CameraParameters::KEY_ISO_MODE, "100"); - else if (strcmp(isoMode, "ISO200") == 0) + else if(strcmp(isoMode, "ISO200") == 0) params.set(android::CameraParameters::KEY_ISO_MODE, "200"); - else if (strcmp(isoMode, "ISO400") == 0) + else if(strcmp(isoMode, "ISO400") == 0) params.set(android::CameraParameters::KEY_ISO_MODE, "400"); - else if (strcmp(isoMode, "ISO800") == 0) + else if(strcmp(isoMode, "ISO800") == 0) params.set(android::CameraParameters::KEY_ISO_MODE, "800"); } + //Workaround for crash when touch to focus is used with flash on. + params.set(android::CameraParameters::KEY_AUTO_EXPOSURE_LOCK, "false"); - //params.dump(); +#ifdef CAMERA_WITH_CITYID_PARAM + params.set(android::CameraParameters::KEY_CITYID, 0); +#endif android::String8 strParams = params.flatten(); char *ret = strdup(strParams.string()); - ALOGD("%s: fixed parameters:", __func__); + ALOGD("%s: set parameters fixed up", __FUNCTION__); return ret; } @@ -196,7 +152,7 @@ int camera_set_preview_window(struct camera_device * device, { ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); - if (!device) + if(!device) return -EINVAL; return VENDOR_CALL(device, set_preview_window, window); @@ -212,7 +168,7 @@ void camera_set_callbacks(struct camera_device * device, ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); ALOGV("%s", __FUNCTION__); - if (!device) + if(!device) return; VENDOR_CALL(device, set_callbacks, notify_cb, data_cb, data_cb_timestamp, get_memory, user); @@ -223,7 +179,7 @@ void camera_enable_msg_type(struct camera_device * device, int32_t msg_type) ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); ALOGV("%s", __FUNCTION__); - if (!device) + if(!device) return; VENDOR_CALL(device, enable_msg_type, msg_type); @@ -234,7 +190,7 @@ void camera_disable_msg_type(struct camera_device * device, int32_t msg_type) ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); ALOGV("%s", __FUNCTION__); - if (!device) + if(!device) return; VENDOR_CALL(device, disable_msg_type, msg_type); @@ -245,7 +201,7 @@ int camera_msg_type_enabled(struct camera_device * device, int32_t msg_type) ALOGV("%s", __FUNCTION__); ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); - if (!device) + if(!device) return 0; return VENDOR_CALL(device, msg_type_enabled, msg_type); @@ -254,15 +210,17 @@ int camera_msg_type_enabled(struct camera_device * device, int32_t msg_type) int camera_start_preview(struct camera_device * device) { int rc; - ALOGV("%s", __FUNCTION__); + + ALOGV("%s", __FUNCTION__); ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); - if (!device) + if(!device) return -EINVAL; rc = VENDOR_CALL(device, start_preview); if (rc) preview_running = true; + return rc; } @@ -271,10 +229,14 @@ void camera_stop_preview(struct camera_device * device) ALOGV("%s", __FUNCTION__); ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); - if (!device) + if(!device) return; + // Workaround for camera freezes + VENDOR_CALL(device, send_command, 7, 0, 0); + VENDOR_CALL(device, stop_preview); + preview_running = false; } @@ -283,7 +245,7 @@ int camera_preview_enabled(struct camera_device * device) ALOGV("%s", __FUNCTION__); ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); - if (!device) + if(!device) return -EINVAL; return VENDOR_CALL(device, preview_enabled); @@ -294,7 +256,7 @@ int camera_store_meta_data_in_buffers(struct camera_device * device, int enable) ALOGV("%s", __FUNCTION__); ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); - if (!device) + if(!device) return -EINVAL; return VENDOR_CALL(device, store_meta_data_in_buffers, enable); @@ -305,7 +267,7 @@ int camera_start_recording(struct camera_device * device) ALOGV("%s", __FUNCTION__); ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); - if (!device) + if(!device) return EINVAL; return VENDOR_CALL(device, start_recording); @@ -316,7 +278,7 @@ void camera_stop_recording(struct camera_device * device) ALOGV("%s", __FUNCTION__); ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); - if (!device) + if(!device) return; @@ -328,7 +290,7 @@ int camera_recording_enabled(struct camera_device * device) ALOGV("%s", __FUNCTION__); ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); - if (!device) + if(!device) return -EINVAL; return VENDOR_CALL(device, recording_enabled); @@ -340,7 +302,7 @@ void camera_release_recording_frame(struct camera_device * device, ALOGV("%s", __FUNCTION__); ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); - if (!device) + if(!device) return; VENDOR_CALL(device, release_recording_frame, opaque); @@ -351,7 +313,7 @@ int camera_auto_focus(struct camera_device * device) ALOGV("%s", __FUNCTION__); ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); - if (!device) + if(!device) return -EINVAL; @@ -363,7 +325,7 @@ int camera_cancel_auto_focus(struct camera_device * device) ALOGV("%s", __FUNCTION__); ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); - if (!device) + if(!device) return -EINVAL; if (preview_running) @@ -377,7 +339,7 @@ int camera_take_picture(struct camera_device * device) ALOGV("%s", __FUNCTION__); ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); - if (!device) + if(!device) return -EINVAL; return VENDOR_CALL(device, take_picture); @@ -388,7 +350,7 @@ int camera_cancel_picture(struct camera_device * device) ALOGV("%s", __FUNCTION__); ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); - if (!device) + if(!device) return -EINVAL; return VENDOR_CALL(device, cancel_picture); @@ -399,7 +361,7 @@ int camera_set_parameters(struct camera_device * device, const char *params) ALOGV("%s", __FUNCTION__); ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); - if (!device) + if(!device) return -EINVAL; char *tmp = NULL; @@ -418,16 +380,16 @@ char* camera_get_parameters(struct camera_device * device) ALOGV("%s", __FUNCTION__); ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); - if (!device) + if(!device) return NULL; - char *params = VENDOR_CALL(device, get_parameters); + char* params = VENDOR_CALL(device, get_parameters); #ifdef LOG_PARAMETERS __android_log_write(ANDROID_LOG_VERBOSE, LOG_TAG, params); #endif - char *tmp = camera_fixup_getparams(CAMERA_ID(device), params); + char * tmp = camera_fixup_getparams(CAMERA_ID(device), params); VENDOR_CALL(device, put_parameters, params); params = tmp; @@ -443,7 +405,7 @@ static void camera_put_parameters(struct camera_device *device, char *params) ALOGV("%s", __FUNCTION__); ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); - if (params) + if(params) free(params); } @@ -453,7 +415,7 @@ int camera_send_command(struct camera_device * device, ALOGV("%s", __FUNCTION__); ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); - if (!device) + if(!device) return -EINVAL; return VENDOR_CALL(device, send_command, cmd, arg1, arg2); @@ -464,7 +426,7 @@ void camera_release(struct camera_device * device) ALOGV("%s", __FUNCTION__); ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); - if (!device) + if(!device) return; VENDOR_CALL(device, release); @@ -472,7 +434,7 @@ void camera_release(struct camera_device * device) int camera_dump(struct camera_device * device, int fd) { - if (!device) + if(!device) return -EINVAL; return VENDOR_CALL(device, dump, fd); @@ -537,7 +499,8 @@ int camera_device_open(const hw_module_t* module, const char* name, cameraid = atoi(name); num_cameras = gVendorModule->get_number_of_cameras(); - if (cameraid > num_cameras) { + if(cameraid > num_cameras) + { ALOGE("camera service provided cameraid out of bounds, " "cameraid = %d, num supported = %d", cameraid, num_cameras); @@ -546,7 +509,8 @@ int camera_device_open(const hw_module_t* module, const char* name, } camera_device = (wrapper_camera_device_t*)malloc(sizeof(*camera_device)); - if (!camera_device) { + if(!camera_device) + { ALOGE("camera_device allocation fail"); rv = -ENOMEM; goto fail; @@ -554,14 +518,16 @@ int camera_device_open(const hw_module_t* module, const char* name, memset(camera_device, 0, sizeof(*camera_device)); camera_device->id = cameraid; - if ((rv = gVendorModule->common.methods->open((const hw_module_t*)gVendorModule, name, (hw_device_t**)&(camera_device->vendor)))) { + if(rv = gVendorModule->common.methods->open((const hw_module_t*)gVendorModule, name, (hw_device_t**)&(camera_device->vendor))) + { ALOGE("vendor camera open fail"); goto fail; } ALOGV("%s: got vendor camera device 0x%08X", __FUNCTION__, (uintptr_t)(camera_device->vendor)); camera_ops = (camera_device_ops_t*)malloc(sizeof(*camera_ops)); - if (!camera_ops) { + if(!camera_ops) + { ALOGE("camera_ops allocation fail"); rv = -ENOMEM; goto fail; -- cgit v1.1 From 158ad6ccbe75bf0aad07cdb1ccb2676a27159c66 Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Fri, 28 Nov 2014 00:08:06 +0530 Subject: Revert "n7100: Add missing include for Camera wrapper" This reverts commit 78a558314d7188d50e37b9bf7042ee79db5f1316. --- camera/Android.mk | 3 --- 1 file changed, 3 deletions(-) diff --git a/camera/Android.mk b/camera/Android.mk index 38270ed..a0652a6 100644 --- a/camera/Android.mk +++ b/camera/Android.mk @@ -7,9 +7,6 @@ LOCAL_SRC_FILES := \ LOCAL_SHARED_LIBRARIES := \ libhardware liblog libcamera_client libutils -LOCAL_C_INCLUDES += \ - system/media/camera/include - LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw LOCAL_MODULE := camera.exynos4 LOCAL_MODULE_TAGS := optional -- cgit v1.1 From be72b21ef723adb1ad14950f8a426af1144ec071 Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Fri, 28 Nov 2014 00:10:03 +0530 Subject: Revert "Camera wrapper" This reverts commit da2f11839adee60a0ab91f14a97d22735806890e. Conflicts: BoardConfig.mk --- BoardConfig.mk | 3 - camera/Android.mk | 15 -- camera/CameraWrapper.cpp | 600 ----------------------------------------------- n7100.mk | 4 +- 4 files changed, 2 insertions(+), 620 deletions(-) delete mode 100644 camera/Android.mk delete mode 100644 camera/CameraWrapper.cpp diff --git a/BoardConfig.mk b/BoardConfig.mk index 9f1b56f..9a1a144 100644 --- a/BoardConfig.mk +++ b/BoardConfig.mk @@ -63,6 +63,3 @@ SENSORS_NEED_SETRATE_ON_ENABLE := true # ueventd.te \ # vold.te \ # wpa_supplicant.te - -# Camera wrapper -TARGET_PROVIDES_CAMERA_HAL := true diff --git a/camera/Android.mk b/camera/Android.mk deleted file mode 100644 index a0652a6..0000000 --- a/camera/Android.mk +++ /dev/null @@ -1,15 +0,0 @@ -LOCAL_PATH := $(call my-dir) -include $(CLEAR_VARS) - -LOCAL_SRC_FILES := \ - CameraWrapper.cpp - -LOCAL_SHARED_LIBRARIES := \ - libhardware liblog libcamera_client libutils - -LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw -LOCAL_MODULE := camera.exynos4 -LOCAL_MODULE_TAGS := optional - -include $(BUILD_SHARED_LIBRARY) -#include $(BUILD_HEAPTRACKED_SHARED_LIBRARY) diff --git a/camera/CameraWrapper.cpp b/camera/CameraWrapper.cpp deleted file mode 100644 index e503b03..0000000 --- a/camera/CameraWrapper.cpp +++ /dev/null @@ -1,600 +0,0 @@ -/* - * Copyright (C) 2012, The CyanogenMod 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. - */ - -/** -* @file CameraWrapper.cpp -* -* This file wraps a vendor camera module. -* -*/ - - -#define LOG_NDEBUG 0 -//#define LOG_PARAMETERS - -#define LOG_TAG "CameraWrapper" -#include - -#include -#include -#include -#include -#include -#include - -static android::Mutex gCameraWrapperLock; -static camera_module_t *gVendorModule = 0; - -bool preview_running = false; - -static int camera_device_open(const hw_module_t* module, const char* name, - hw_device_t** device); -static int camera_device_close(hw_device_t* device); -static int camera_get_number_of_cameras(void); -static int camera_get_camera_info(int camera_id, struct camera_info *info); - -static struct hw_module_methods_t camera_module_methods = { - open: camera_device_open -}; - -camera_module_t HAL_MODULE_INFO_SYM = { - common: { - tag: HARDWARE_MODULE_TAG, - version_major: 1, - version_minor: 0, - id: CAMERA_HARDWARE_MODULE_ID, - name: "Exynos4x12 Camera Wrapper", - author: "Teamhacksung ", - methods: &camera_module_methods, - dso: NULL, /* remove compilation warnings */ - reserved: {0}, /* remove compilation warnings */ - }, - get_number_of_cameras: camera_get_number_of_cameras, - get_camera_info: camera_get_camera_info, -}; - -typedef struct wrapper_camera_device { - camera_device_t base; - int id; - camera_device_t *vendor; -} wrapper_camera_device_t; - -#define VENDOR_CALL(device, func, ...) ({ \ - wrapper_camera_device_t *__wrapper_dev = (wrapper_camera_device_t*) device; \ - __wrapper_dev->vendor->ops->func(__wrapper_dev->vendor, ##__VA_ARGS__); \ -}) - -#define CAMERA_ID(device) (((wrapper_camera_device_t *)(device))->id) - -static int check_vendor_module() -{ - int rv = 0; - ALOGV("%s", __FUNCTION__); - - if(gVendorModule) - return 0; - - rv = hw_get_module("vendor-camera", (const hw_module_t **)&gVendorModule); - if (rv) - ALOGE("failed to open vendor camera module"); - return rv; -} - -const static char * iso_values[] = {"auto,ISO100,ISO200,ISO400,ISO800","auto"}; - -static char * camera_fixup_getparams(int id, const char * settings) -{ - android::CameraParameters params; - params.unflatten(android::String8(settings)); - - // fix params here - params.set(android::CameraParameters::KEY_SUPPORTED_ISO_MODES, iso_values[id]); - params.set(android::CameraParameters::KEY_AUTO_EXPOSURE_LOCK, "false"); - params.set(android::CameraParameters::KEY_VIDEO_SNAPSHOT_SUPPORTED, "true"); - - android::String8 strParams = params.flatten(); - char *ret = strdup(strParams.string()); - - ALOGD("%s: get parameters fixed up", __FUNCTION__); - return ret; -} - -char * camera_fixup_setparams(int id, const char * settings) -{ - android::CameraParameters params; - params.unflatten(android::String8(settings)); - - // fix params here - if(params.get("iso")) { - const char* isoMode = params.get(android::CameraParameters::KEY_ISO_MODE); - if(strcmp(isoMode, "ISO100") == 0) - params.set(android::CameraParameters::KEY_ISO_MODE, "100"); - else if(strcmp(isoMode, "ISO200") == 0) - params.set(android::CameraParameters::KEY_ISO_MODE, "200"); - else if(strcmp(isoMode, "ISO400") == 0) - params.set(android::CameraParameters::KEY_ISO_MODE, "400"); - else if(strcmp(isoMode, "ISO800") == 0) - params.set(android::CameraParameters::KEY_ISO_MODE, "800"); - } - //Workaround for crash when touch to focus is used with flash on. - params.set(android::CameraParameters::KEY_AUTO_EXPOSURE_LOCK, "false"); - -#ifdef CAMERA_WITH_CITYID_PARAM - params.set(android::CameraParameters::KEY_CITYID, 0); -#endif - - android::String8 strParams = params.flatten(); - char *ret = strdup(strParams.string()); - - ALOGD("%s: set parameters fixed up", __FUNCTION__); - return ret; -} - -/******************************************************************* - * implementation of camera_device_ops functions - *******************************************************************/ - -int camera_set_preview_window(struct camera_device * device, - struct preview_stream_ops *window) -{ - ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); - - if(!device) - return -EINVAL; - - return VENDOR_CALL(device, set_preview_window, window); -} - -void camera_set_callbacks(struct camera_device * device, - camera_notify_callback notify_cb, - camera_data_callback data_cb, - camera_data_timestamp_callback data_cb_timestamp, - camera_request_memory get_memory, - void *user) -{ - ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); - ALOGV("%s", __FUNCTION__); - - if(!device) - return; - - VENDOR_CALL(device, set_callbacks, notify_cb, data_cb, data_cb_timestamp, get_memory, user); -} - -void camera_enable_msg_type(struct camera_device * device, int32_t msg_type) -{ - ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); - ALOGV("%s", __FUNCTION__); - - if(!device) - return; - - VENDOR_CALL(device, enable_msg_type, msg_type); -} - -void camera_disable_msg_type(struct camera_device * device, int32_t msg_type) -{ - ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); - ALOGV("%s", __FUNCTION__); - - if(!device) - return; - - VENDOR_CALL(device, disable_msg_type, msg_type); -} - -int camera_msg_type_enabled(struct camera_device * device, int32_t msg_type) -{ - ALOGV("%s", __FUNCTION__); - ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); - - if(!device) - return 0; - - return VENDOR_CALL(device, msg_type_enabled, msg_type); -} - -int camera_start_preview(struct camera_device * device) -{ - int rc; - - ALOGV("%s", __FUNCTION__); - ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); - - if(!device) - return -EINVAL; - - rc = VENDOR_CALL(device, start_preview); - if (rc) - preview_running = true; - - return rc; -} - -void camera_stop_preview(struct camera_device * device) -{ - ALOGV("%s", __FUNCTION__); - ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); - - if(!device) - return; - - // Workaround for camera freezes - VENDOR_CALL(device, send_command, 7, 0, 0); - - VENDOR_CALL(device, stop_preview); - - preview_running = false; -} - -int camera_preview_enabled(struct camera_device * device) -{ - ALOGV("%s", __FUNCTION__); - ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); - - if(!device) - return -EINVAL; - - return VENDOR_CALL(device, preview_enabled); -} - -int camera_store_meta_data_in_buffers(struct camera_device * device, int enable) -{ - ALOGV("%s", __FUNCTION__); - ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); - - if(!device) - return -EINVAL; - - return VENDOR_CALL(device, store_meta_data_in_buffers, enable); -} - -int camera_start_recording(struct camera_device * device) -{ - ALOGV("%s", __FUNCTION__); - ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); - - if(!device) - return EINVAL; - - return VENDOR_CALL(device, start_recording); -} - -void camera_stop_recording(struct camera_device * device) -{ - ALOGV("%s", __FUNCTION__); - ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); - - if(!device) - return; - - - VENDOR_CALL(device, stop_recording); -} - -int camera_recording_enabled(struct camera_device * device) -{ - ALOGV("%s", __FUNCTION__); - ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); - - if(!device) - return -EINVAL; - - return VENDOR_CALL(device, recording_enabled); -} - -void camera_release_recording_frame(struct camera_device * device, - const void *opaque) -{ - ALOGV("%s", __FUNCTION__); - ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); - - if(!device) - return; - - VENDOR_CALL(device, release_recording_frame, opaque); -} - -int camera_auto_focus(struct camera_device * device) -{ - ALOGV("%s", __FUNCTION__); - ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); - - if(!device) - return -EINVAL; - - - return VENDOR_CALL(device, auto_focus); -} - -int camera_cancel_auto_focus(struct camera_device * device) -{ - ALOGV("%s", __FUNCTION__); - ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); - - if(!device) - return -EINVAL; - - if (preview_running) - return VENDOR_CALL(device, cancel_auto_focus); - else - return 0; -} - -int camera_take_picture(struct camera_device * device) -{ - ALOGV("%s", __FUNCTION__); - ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); - - if(!device) - return -EINVAL; - - return VENDOR_CALL(device, take_picture); -} - -int camera_cancel_picture(struct camera_device * device) -{ - ALOGV("%s", __FUNCTION__); - ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); - - if(!device) - return -EINVAL; - - return VENDOR_CALL(device, cancel_picture); -} - -int camera_set_parameters(struct camera_device * device, const char *params) -{ - ALOGV("%s", __FUNCTION__); - ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); - - if(!device) - return -EINVAL; - - char *tmp = NULL; - tmp = camera_fixup_setparams(CAMERA_ID(device), params); - -#ifdef LOG_PARAMETERS - __android_log_write(ANDROID_LOG_VERBOSE, LOG_TAG, tmp); -#endif - - int ret = VENDOR_CALL(device, set_parameters, tmp); - return ret; -} - -char* camera_get_parameters(struct camera_device * device) -{ - ALOGV("%s", __FUNCTION__); - ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); - - if(!device) - return NULL; - - char* params = VENDOR_CALL(device, get_parameters); - -#ifdef LOG_PARAMETERS - __android_log_write(ANDROID_LOG_VERBOSE, LOG_TAG, params); -#endif - - char * tmp = camera_fixup_getparams(CAMERA_ID(device), params); - VENDOR_CALL(device, put_parameters, params); - params = tmp; - -#ifdef LOG_PARAMETERS - __android_log_write(ANDROID_LOG_VERBOSE, LOG_TAG, params); -#endif - - return params; -} - -static void camera_put_parameters(struct camera_device *device, char *params) -{ - ALOGV("%s", __FUNCTION__); - ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); - - if(params) - free(params); -} - -int camera_send_command(struct camera_device * device, - int32_t cmd, int32_t arg1, int32_t arg2) -{ - ALOGV("%s", __FUNCTION__); - ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); - - if(!device) - return -EINVAL; - - return VENDOR_CALL(device, send_command, cmd, arg1, arg2); -} - -void camera_release(struct camera_device * device) -{ - ALOGV("%s", __FUNCTION__); - ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); - - if(!device) - return; - - VENDOR_CALL(device, release); -} - -int camera_dump(struct camera_device * device, int fd) -{ - if(!device) - return -EINVAL; - - return VENDOR_CALL(device, dump, fd); -} - -extern "C" void heaptracker_free_leaked_memory(void); - -int camera_device_close(hw_device_t* device) -{ - int ret = 0; - wrapper_camera_device_t *wrapper_dev = NULL; - - ALOGV("%s", __FUNCTION__); - - android::Mutex::Autolock lock(gCameraWrapperLock); - - if (!device) { - ret = -EINVAL; - goto done; - } - - wrapper_dev = (wrapper_camera_device_t*) device; - - wrapper_dev->vendor->common.close((hw_device_t*)wrapper_dev->vendor); - if (wrapper_dev->base.ops) - free(wrapper_dev->base.ops); - free(wrapper_dev); -done: -#ifdef HEAPTRACKER - heaptracker_free_leaked_memory(); -#endif - return ret; -} - -/******************************************************************* - * implementation of camera_module functions - *******************************************************************/ - -/* open device handle to one of the cameras - * - * assume camera service will keep singleton of each camera - * so this function will always only be called once per camera instance - */ - -int camera_device_open(const hw_module_t* module, const char* name, - hw_device_t** device) -{ - int rv = 0; - int num_cameras = 0; - int cameraid; - wrapper_camera_device_t* camera_device = NULL; - camera_device_ops_t* camera_ops = NULL; - - android::Mutex::Autolock lock(gCameraWrapperLock); - - ALOGV("camera_device open"); - - if (name != NULL) { - if (check_vendor_module()) - return -EINVAL; - - cameraid = atoi(name); - num_cameras = gVendorModule->get_number_of_cameras(); - - if(cameraid > num_cameras) - { - ALOGE("camera service provided cameraid out of bounds, " - "cameraid = %d, num supported = %d", - cameraid, num_cameras); - rv = -EINVAL; - goto fail; - } - - camera_device = (wrapper_camera_device_t*)malloc(sizeof(*camera_device)); - if(!camera_device) - { - ALOGE("camera_device allocation fail"); - rv = -ENOMEM; - goto fail; - } - memset(camera_device, 0, sizeof(*camera_device)); - camera_device->id = cameraid; - - if(rv = gVendorModule->common.methods->open((const hw_module_t*)gVendorModule, name, (hw_device_t**)&(camera_device->vendor))) - { - ALOGE("vendor camera open fail"); - goto fail; - } - ALOGV("%s: got vendor camera device 0x%08X", __FUNCTION__, (uintptr_t)(camera_device->vendor)); - - camera_ops = (camera_device_ops_t*)malloc(sizeof(*camera_ops)); - if(!camera_ops) - { - ALOGE("camera_ops allocation fail"); - rv = -ENOMEM; - goto fail; - } - - memset(camera_ops, 0, sizeof(*camera_ops)); - - camera_device->base.common.tag = HARDWARE_DEVICE_TAG; - camera_device->base.common.version = 0; - camera_device->base.common.module = (hw_module_t *)(module); - camera_device->base.common.close = camera_device_close; - camera_device->base.ops = camera_ops; - - camera_ops->set_preview_window = camera_set_preview_window; - camera_ops->set_callbacks = camera_set_callbacks; - camera_ops->enable_msg_type = camera_enable_msg_type; - camera_ops->disable_msg_type = camera_disable_msg_type; - camera_ops->msg_type_enabled = camera_msg_type_enabled; - camera_ops->start_preview = camera_start_preview; - camera_ops->stop_preview = camera_stop_preview; - camera_ops->preview_enabled = camera_preview_enabled; - camera_ops->store_meta_data_in_buffers = camera_store_meta_data_in_buffers; - camera_ops->start_recording = camera_start_recording; - camera_ops->stop_recording = camera_stop_recording; - camera_ops->recording_enabled = camera_recording_enabled; - camera_ops->release_recording_frame = camera_release_recording_frame; - camera_ops->auto_focus = camera_auto_focus; - camera_ops->cancel_auto_focus = camera_cancel_auto_focus; - camera_ops->take_picture = camera_take_picture; - camera_ops->cancel_picture = camera_cancel_picture; - camera_ops->set_parameters = camera_set_parameters; - camera_ops->get_parameters = camera_get_parameters; - camera_ops->put_parameters = camera_put_parameters; - camera_ops->send_command = camera_send_command; - camera_ops->release = camera_release; - camera_ops->dump = camera_dump; - - *device = &camera_device->base.common; - } - - return rv; - -fail: - if(camera_device) { - free(camera_device); - camera_device = NULL; - } - if(camera_ops) { - free(camera_ops); - camera_ops = NULL; - } - *device = NULL; - return rv; -} - -int camera_get_number_of_cameras(void) -{ - ALOGV("%s", __FUNCTION__); - if (check_vendor_module()) - return 0; - return gVendorModule->get_number_of_cameras(); -} - -int camera_get_camera_info(int camera_id, struct camera_info *info) -{ - ALOGV("%s", __FUNCTION__); - if (check_vendor_module()) - return 0; - return gVendorModule->get_camera_info(camera_id, info); -} diff --git a/n7100.mk b/n7100.mk index 7103aca..a52e0e9 100644 --- a/n7100.mk +++ b/n7100.mk @@ -38,9 +38,9 @@ PRODUCT_COPY_FILES += \ PRODUCT_COPY_FILES += \ $(LOCAL_PATH)/configs/tiny_hw.xml:system/etc/sound/t03g -# Camera Wrapper +# Camera PRODUCT_PACKAGES += \ - camera.exynos4 + camera.smdk4x12 # Gps PRODUCT_COPY_FILES += \ -- cgit v1.1 From 845fac6dcb06ac0a97ad4491d813b4e984663f97 Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Wed, 3 Dec 2014 10:04:23 +0530 Subject: n7100: Add Ril header --- BoardConfig.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/BoardConfig.mk b/BoardConfig.mk index 9a1a144..9338278 100644 --- a/BoardConfig.mk +++ b/BoardConfig.mk @@ -22,6 +22,7 @@ # RIL BOARD_PROVIDES_LIBRIL := true BOARD_MODEM_TYPE := xmm6262 +BOARD_RIL_CLASS := ../../../hardware/samsung/ril TARGET_SPECIFIC_HEADER_PATH := device/samsung/n7100/include # Bluetooth -- cgit v1.1 From 7e5b3b523210bfce1931e97f60f862302769d1c5 Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Fri, 5 Dec 2014 10:28:43 +0530 Subject: Use legacy mmap --- BoardConfig.mk | 2 ++ 1 file changed, 2 insertions(+) diff --git a/BoardConfig.mk b/BoardConfig.mk index 9338278..029f0a0 100644 --- a/BoardConfig.mk +++ b/BoardConfig.mk @@ -45,6 +45,8 @@ TARGET_EXTERNAL_APPS = sdcard1 TARGET_RECOVERY_FSTAB := device/samsung/n7100/rootdir/fstab.smdk4x12 RECOVERY_FSTAB_VERSION := 2 +BOARD_USES_LEGACY_MMAP := true + # Compatibility with pre-kitkat Sensor HALs SENSORS_NEED_SETRATE_ON_ENABLE := true -- cgit v1.1 From 1220dd2be89b11032ea3bad91b87aa0c17376a92 Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Fri, 5 Dec 2014 10:30:00 +0530 Subject: add -DNEEDS_VECTORIMPL_SYMBOLS flag for blobs --- BoardConfig.mk | 3 +++ 1 file changed, 3 insertions(+) diff --git a/BoardConfig.mk b/BoardConfig.mk index 029f0a0..7f5cd64 100644 --- a/BoardConfig.mk +++ b/BoardConfig.mk @@ -41,6 +41,9 @@ TARGET_OTA_ASSERT_DEVICE := t03g,n7100,GT-N7100 # External apps on SD TARGET_EXTERNAL_APPS = sdcard1 +# Blobs +COMMON_GLOBAL_CFLAGS += -DNEEDS_VECTORIMPL_SYMBOLS + # Recovery TARGET_RECOVERY_FSTAB := device/samsung/n7100/rootdir/fstab.smdk4x12 RECOVERY_FSTAB_VERSION := 2 -- cgit v1.1 From 46236a0089fb1ae4848c645b05676b6200d88a3e Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Fri, 5 Dec 2014 10:33:35 +0530 Subject: Update for new syntax --- rootdir/fstab.smdk4x12 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rootdir/fstab.smdk4x12 b/rootdir/fstab.smdk4x12 index efe528a..4732091 100644 --- a/rootdir/fstab.smdk4x12 +++ b/rootdir/fstab.smdk4x12 @@ -10,8 +10,8 @@ /dev/block/mmcblk0p14 /preload ext4 noatime,nosuid,nodev,journal_async_commit wait /dev/block/mmcblk0p16 /data ext4 noatime,nosuid,nodev,discard,noauto_da_alloc,journal_async_commit,errors=panic wait,check,encryptable=footer -/devices/platform/s3c-sdhci.2/mmc_host/mmc1 auto auto defaults voldmanaged=sdcard1:auto -/devices/platform/s5p-ehci auto auto defaults voldmanaged=usbdisk0:auto +/devices/platform/s3c-sdhci.2/mmc_host/mmc1* auto auto defaults voldmanaged=sdcard1:auto +/devices/platform/s5p-ehci* auto auto defaults voldmanaged=usbdisk0:auto # recovery /dev/block/mmcblk0p8 /boot emmc defaults recoveryonly -- cgit v1.1 From d1411e7965cdeee7874e914c4c321873ee8e2cc1 Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Fri, 5 Dec 2014 10:35:09 +0530 Subject: Add extended font support --- BoardConfig.mk | 3 +++ 1 file changed, 3 insertions(+) diff --git a/BoardConfig.mk b/BoardConfig.mk index 7f5cd64..7e3d268 100644 --- a/BoardConfig.mk +++ b/BoardConfig.mk @@ -50,6 +50,9 @@ RECOVERY_FSTAB_VERSION := 2 BOARD_USES_LEGACY_MMAP := true +# Include an expanded selection of fonts +EXTENDED_FONT_FOOTPRINT := true + # Compatibility with pre-kitkat Sensor HALs SENSORS_NEED_SETRATE_ON_ENABLE := true -- cgit v1.1 From 796b270956ec4722fb1767d3881a1f050e1516f5 Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Sat, 6 Dec 2014 13:47:26 +0530 Subject: n7100: Enable multiuser --- overlay/frameworks/base/core/res/res/values/config.xml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/overlay/frameworks/base/core/res/res/values/config.xml b/overlay/frameworks/base/core/res/res/values/config.xml index dbcfa88..b0be8a8 100644 --- a/overlay/frameworks/base/core/res/res/values/config.xml +++ b/overlay/frameworks/base/core/res/res/values/config.xml @@ -129,4 +129,10 @@ true true true + + + 4 + + + true -- cgit v1.1 From 1f35dacaa31323567bbde44889e97dd2d9863f17 Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Sun, 7 Dec 2014 13:03:57 +0530 Subject: n7100: update gps --- include/hardware/gps.h | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/include/hardware/gps.h b/include/hardware/gps.h index 834516f..b70da93 100644 --- a/include/hardware/gps.h +++ b/include/hardware/gps.h @@ -398,11 +398,6 @@ typedef uint8_t GpsNavigationMessageType; #define AGPS_RIL_INTERFACE "agps_ril" /** - * The GPS chipset can use Psc for AGPS. - */ -#define AGPS_USE_PSC - -/** * Name for the GPS_Geofencing interface. */ #define GPS_GEOFENCING_INTERFACE "gps_geofencing" @@ -422,6 +417,11 @@ typedef uint8_t GpsNavigationMessageType; */ #define GNSS_CONFIGURATION_INTERFACE "gnss_configuration" +/** + * The GPS chipset can use Psc for AGPS. + */ +#define AGPS_USE_PSC + /** Represents a location. */ typedef struct { @@ -502,7 +502,6 @@ typedef struct { uint32_t used_in_fix_mask; } GpsSvStatus; - /* 2G and 3G */ /* In 3G lac is discarded */ typedef struct { -- cgit v1.1 From 8af59ac9ef7a807554f0f70e268b3ddfe56e2020 Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Sun, 7 Dec 2014 13:19:15 +0530 Subject: n7100: Update overlays again. --- .../frameworks/base/core/res/res/values/config.xml | 119 ++++++++++++++++++++- 1 file changed, 117 insertions(+), 2 deletions(-) diff --git a/overlay/frameworks/base/core/res/res/values/config.xml b/overlay/frameworks/base/core/res/res/values/config.xml index b0be8a8..5e3cb4e 100644 --- a/overlay/frameworks/base/core/res/res/values/config.xml +++ b/overlay/frameworks/base/core/res/res/values/config.xml @@ -24,6 +24,115 @@ autodetected from the Configuration. --> false + + + 150 + 300 + 600 + 1000 + 3000 + 8000 + 15000 + 28000 + 41000 + 54000 + 67000 + 80000 + 100000 + 150000 + 200000 + + + + + 20 + 30 + 40 + 50 + 60 + 70 + 80 + 100 + 120 + 140 + 160 + 180 + 200 + 220 + 240 + 255 + + + + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + @@ -93,6 +202,9 @@ true + + #ffffffff + 1000 @@ -113,10 +225,14 @@ 4 - Menu 8 - Assistant (search) 16 - App switch + 32 - Camera For example, a device with Home, Back and Menu keys would set this - config to 7. --> + config to 7. --> 7 + + false + true @@ -127,7 +243,6 @@ com.android.systemui/com.android.systemui.doze.DozeService 20 true - true true -- cgit v1.1 From 039b8db878267f1871abc30d1d06d6a2feebabf0 Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Sun, 7 Dec 2014 13:23:38 +0530 Subject: n7100: Enable SElinux This reverts commit fd12f10a780a5af4ccc3e67498dc3d7d3f89b1f5. Conflicts: BoardConfig.mk --- BoardConfig.mk | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/BoardConfig.mk b/BoardConfig.mk index 7e3d268..e8aa874 100644 --- a/BoardConfig.mk +++ b/BoardConfig.mk @@ -57,18 +57,18 @@ EXTENDED_FONT_FOOTPRINT := true SENSORS_NEED_SETRATE_ON_ENABLE := true # Selinux -#BOARD_SEPOLICY_DIRS += \ -# device/samsung/n7100/selinux +BOARD_SEPOLICY_DIRS += \ + device/samsung/n7100/selinux -#BOARD_SEPOLICY_UNION += \ -# device.te \ -# domain.te \ -# file.te \ -# file_contexts \ -# init.te \ -# mediaserver.te \ -# rild.te \ -# system.te \ -# ueventd.te \ -# vold.te \ -# wpa_supplicant.te +BOARD_SEPOLICY_UNION += \ + device.te \ + domain.te \ + file.te \ + file_contexts \ + init.te \ + mediaserver.te \ + rild.te \ + system.te \ + ueventd.te \ + vold.te \ + wpa_supplicant.te -- cgit v1.1 From 50ae0df4f9697f8e9a59c3ff6b591c22e7692efc Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Sat, 13 Dec 2014 17:23:15 +0530 Subject: Remove apollo and DSPmanager from device --- n7100.mk | 6 +----- pa.dependencies | 8 +------- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/n7100.mk b/n7100.mk index a52e0e9..d034981 100644 --- a/n7100.mk +++ b/n7100.mk @@ -55,11 +55,7 @@ PRODUCT_PACKAGES += \ # Additional apps PRODUCT_PACKAGES += \ - Apollo \ - OpenDelta \ - DSPManager \ - libcyanogen-dsp \ - audio_effects.conf + OpenDelta # NFC PRODUCT_PACKAGES += \ diff --git a/pa.dependencies b/pa.dependencies index 9e85500..0bb9839 100644 --- a/pa.dependencies +++ b/pa.dependencies @@ -26,12 +26,6 @@ "revision": "lollipop" }, { - "remote": "cm", - "repository": "CyanogenMod/android_packages_apps_Apollo", - "target_path": "packages/apps/Apollo", - "revision": "cm-12.0" - }, - { "remote": "github", "repository": "CrazyWeasel/proprietary_vendor_samsung", "target_path": "vendor/samsung", @@ -39,7 +33,7 @@ }, { "remote": "github", - "repository": "Fortune-OS/android_hardware_samsung_slsi_exynos4", + "repository": "tilaksidduram/android_hardware_samsung_slsi_exynos4", "target_path": "hardware/samsung_slsi/exynos4", "revision": "android-5.0" } -- cgit v1.1 From ea5d43559586e1a44e3ef1f204e079c92e75c1b1 Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Wed, 17 Dec 2014 22:40:15 +0530 Subject: n7100: Re-enable hardware keyboard overlay --- overlay/frameworks/base/core/res/res/values/config.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/overlay/frameworks/base/core/res/res/values/config.xml b/overlay/frameworks/base/core/res/res/values/config.xml index 5e3cb4e..d1b9b21 100644 --- a/overlay/frameworks/base/core/res/res/values/config.xml +++ b/overlay/frameworks/base/core/res/res/values/config.xml @@ -211,8 +211,8 @@ 9000 - + + true true -- cgit v1.1 From 7f324930ff3bf2927537c2847815468bacdc689c Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Sun, 21 Dec 2014 22:40:01 +0530 Subject: Revert "Add extended font support" This reverts commit d1411e7965cdeee7874e914c4c321873ee8e2cc1. This is already defined in smdk4412-common --- BoardConfig.mk | 3 --- 1 file changed, 3 deletions(-) diff --git a/BoardConfig.mk b/BoardConfig.mk index e8aa874..a6d108d 100644 --- a/BoardConfig.mk +++ b/BoardConfig.mk @@ -50,9 +50,6 @@ RECOVERY_FSTAB_VERSION := 2 BOARD_USES_LEGACY_MMAP := true -# Include an expanded selection of fonts -EXTENDED_FONT_FOOTPRINT := true - # Compatibility with pre-kitkat Sensor HALs SENSORS_NEED_SETRATE_ON_ENABLE := true -- cgit v1.1 From e7468ff27a6548ce2b0e87e8b9435a00a40ad97e Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Sun, 21 Dec 2014 22:40:37 +0530 Subject: Revert "add -DNEEDS_VECTORIMPL_SYMBOLS flag for blobs" This reverts commit 1220dd2be89b11032ea3bad91b87aa0c17376a92. --- BoardConfig.mk | 3 --- 1 file changed, 3 deletions(-) diff --git a/BoardConfig.mk b/BoardConfig.mk index a6d108d..fc3b53d 100644 --- a/BoardConfig.mk +++ b/BoardConfig.mk @@ -41,9 +41,6 @@ TARGET_OTA_ASSERT_DEVICE := t03g,n7100,GT-N7100 # External apps on SD TARGET_EXTERNAL_APPS = sdcard1 -# Blobs -COMMON_GLOBAL_CFLAGS += -DNEEDS_VECTORIMPL_SYMBOLS - # Recovery TARGET_RECOVERY_FSTAB := device/samsung/n7100/rootdir/fstab.smdk4x12 RECOVERY_FSTAB_VERSION := 2 -- cgit v1.1 From c413e6212cf32b2f273ca992af184d3e1ec670a9 Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Sun, 21 Dec 2014 22:40:53 +0530 Subject: Revert "Use legacy mmap" This reverts commit 7e5b3b523210bfce1931e97f60f862302769d1c5. This is already defined in smdk4412-common --- BoardConfig.mk | 2 -- 1 file changed, 2 deletions(-) diff --git a/BoardConfig.mk b/BoardConfig.mk index fc3b53d..87d0aaa 100644 --- a/BoardConfig.mk +++ b/BoardConfig.mk @@ -45,8 +45,6 @@ TARGET_EXTERNAL_APPS = sdcard1 TARGET_RECOVERY_FSTAB := device/samsung/n7100/rootdir/fstab.smdk4x12 RECOVERY_FSTAB_VERSION := 2 -BOARD_USES_LEGACY_MMAP := true - # Compatibility with pre-kitkat Sensor HALs SENSORS_NEED_SETRATE_ON_ENABLE := true -- cgit v1.1 From af692b5d93d0bef772552b1c9ec93919529ec265 Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Sun, 21 Dec 2014 22:48:00 +0530 Subject: n7100: Updated dependencies --- pa.dependencies | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/pa.dependencies b/pa.dependencies index 0bb9839..465bc59 100644 --- a/pa.dependencies +++ b/pa.dependencies @@ -23,18 +23,12 @@ "remote": "github", "repository": "tilaksidduram/android_hardware_samsung", "target_path": "hardware/samsung", - "revision": "lollipop" + "revision": "cm-12.0" }, { "remote": "github", - "repository": "CrazyWeasel/proprietary_vendor_samsung", + "repository": "TheMuppets/proprietary_vendor_samsung", "target_path": "vendor/samsung", - "revision": "n-2.0" - }, - { - "remote": "github", - "repository": "tilaksidduram/android_hardware_samsung_slsi_exynos4", - "target_path": "hardware/samsung_slsi/exynos4", - "revision": "android-5.0" + "revision": "cm-12.0" } ] -- cgit v1.1 From 4ddd83a3a224e440597eafbb1272e426c06c9de4 Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Mon, 22 Dec 2014 23:41:19 +0530 Subject: Revert "n7100: Re-enable hardware keyboard overlay" This reverts commit ea5d43559586e1a44e3ef1f204e079c92e75c1b1. --- overlay/frameworks/base/core/res/res/values/config.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/overlay/frameworks/base/core/res/res/values/config.xml b/overlay/frameworks/base/core/res/res/values/config.xml index d1b9b21..5e3cb4e 100644 --- a/overlay/frameworks/base/core/res/res/values/config.xml +++ b/overlay/frameworks/base/core/res/res/values/config.xml @@ -211,8 +211,8 @@ 9000 - - true + true -- cgit v1.1 From 9897de1a719b2863e89fcc955a9350898a3d6071 Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Tue, 23 Dec 2014 00:09:14 +0530 Subject: n7100: Update hardware keys overlay --- overlay/frameworks/base/core/res/res/values/config.xml | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/overlay/frameworks/base/core/res/res/values/config.xml b/overlay/frameworks/base/core/res/res/values/config.xml index 5e3cb4e..df2e599 100644 --- a/overlay/frameworks/base/core/res/res/values/config.xml +++ b/overlay/frameworks/base/core/res/res/values/config.xml @@ -226,9 +226,24 @@ 8 - Assistant (search) 16 - App switch 32 - Camera + 64 - Volume rocker For example, a device with Home, Back and Menu keys would set this config to 7. --> - 7 + 71 + + + 65 false -- cgit v1.1 From 5a2a536d00e53567f09a13600007fe0cafbd2b5a Mon Sep 17 00:00:00 2001 From: Dheeraj CVR Date: Sat, 27 Dec 2014 08:52:25 +0530 Subject: n7100: init: cleanup Change-Id: I764a87e5cea6361d8d267dd1ac53dc9dbd887e88 --- rootdir/init.target.rc | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/rootdir/init.target.rc b/rootdir/init.target.rc index a1e4a08..1fbba77 100644 --- a/rootdir/init.target.rc +++ b/rootdir/init.target.rc @@ -40,13 +40,6 @@ on post-fs-data on boot -# icd -service icd /system/bin/icd - class main - user system - group system log - onrestart exec icd_check - # cbd service cpboot-daemon /sbin/cbd -d -p 10 class main @@ -64,9 +57,4 @@ service gpsd /system/bin/gpsd -c /system/etc/gps.xml class main socket gps seqpacket 0660 gps system user gps - group system inet sdcard_rw - -service dmb /system/bin/dmbserver - class main - user system - group radio inet misc audio camera graphics net_bt net_bt_admin sdcard_rw + group system inet sdcard_rw \ No newline at end of file -- cgit v1.1 From 9fec655291ddf36e5e568ce57a8ae10a161e3a5a Mon Sep 17 00:00:00 2001 From: Dheeraj CVR Date: Thu, 1 Jan 2015 21:33:39 +0530 Subject: n7100: Bring back open source sensors This reverts commit 00ac0f43785afd63a16b74034f4701928e941360. Change-Id: I810bad7b533d8c8edf0152b36874789e02994bad n7100: sensors: Fix buffer size Change-Id: I93a999a47ade6982c0b1fec56d611465f8dad830 Conflicts: n7100.mk --- libsensors/AccelSensor.cpp | 155 +++++++++++++++ libsensors/AccelSensor.h | 70 +++++++ libsensors/AkmSensor.cpp | 274 ++++++++++++++++++++++++++ libsensors/AkmSensor.h | 66 +++++++ libsensors/Android.mk | 47 +++++ libsensors/GyroSensor.cpp | 177 +++++++++++++++++ libsensors/GyroSensor.h | 55 ++++++ libsensors/InputEventReader.cpp | 88 +++++++++ libsensors/InputEventReader.h | 47 +++++ libsensors/LightSensor.cpp | 150 +++++++++++++++ libsensors/LightSensor.h | 55 ++++++ libsensors/MODULE_LICENSE_APACHE2 | 0 libsensors/PressureSensor.cpp | 152 +++++++++++++++ libsensors/PressureSensor.h | 54 ++++++ libsensors/ProximitySensor.cpp | 158 +++++++++++++++ libsensors/ProximitySensor.h | 55 ++++++ libsensors/SensorBase.cpp | 192 +++++++++++++++++++ libsensors/SensorBase.h | 72 +++++++ libsensors/sensors.cpp | 392 ++++++++++++++++++++++++++++++++++++++ libsensors/sensors.h | 134 +++++++++++++ n7100.mk | 4 + proprietary-files.txt | 1 - 22 files changed, 2397 insertions(+), 1 deletion(-) create mode 100644 libsensors/AccelSensor.cpp create mode 100644 libsensors/AccelSensor.h create mode 100644 libsensors/AkmSensor.cpp create mode 100644 libsensors/AkmSensor.h create mode 100644 libsensors/Android.mk create mode 100644 libsensors/GyroSensor.cpp create mode 100644 libsensors/GyroSensor.h create mode 100644 libsensors/InputEventReader.cpp create mode 100644 libsensors/InputEventReader.h create mode 100644 libsensors/LightSensor.cpp create mode 100644 libsensors/LightSensor.h create mode 100644 libsensors/MODULE_LICENSE_APACHE2 create mode 100644 libsensors/PressureSensor.cpp create mode 100644 libsensors/PressureSensor.h create mode 100644 libsensors/ProximitySensor.cpp create mode 100644 libsensors/ProximitySensor.h create mode 100644 libsensors/SensorBase.cpp create mode 100644 libsensors/SensorBase.h create mode 100644 libsensors/sensors.cpp create mode 100644 libsensors/sensors.h diff --git a/libsensors/AccelSensor.cpp b/libsensors/AccelSensor.cpp new file mode 100644 index 0000000..2d02bc7 --- /dev/null +++ b/libsensors/AccelSensor.cpp @@ -0,0 +1,155 @@ +/* + * Copyright (C) 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. + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "AccelSensor.h" + +#define LOGTAG "AccelerometerSensor" + +/*****************************************************************************/ +AccelSensor::AccelSensor() + : SensorBase(NULL, "accelerometer_sensor"), + mEnabled(0), + + mInputReader(4), + mHasPendingEvent(false) +{ + mPendingEvent.version = sizeof(sensors_event_t); + mPendingEvent.sensor = ID_A; + mPendingEvent.type = SENSOR_TYPE_ACCELEROMETER; + memset(mPendingEvent.data, 0, sizeof(mPendingEvent.data)); + + if (data_fd) { + strcpy(input_sysfs_path, "/sys/class/input/"); + strcat(input_sysfs_path, input_name); + strcat(input_sysfs_path, "/device/"); + input_sysfs_path_len = strlen(input_sysfs_path); + } +} + +AccelSensor::~AccelSensor() { + + // ALOGD("AccelSensor::~AccelSensor()"); + if (mEnabled) { + enable(0, 0); + } +} + +int AccelSensor::setInitialState() +{ + return 0; +} + +int AccelSensor::enable(int32_t handle, int en) { + int flags = en ? 1 : 0; + int err; + if (flags != mEnabled) { + err = sspEnable(LOGTAG, SSP_ACCEL, en); + if(err >= 0){ + mEnabled = flags; + setInitialState(); + + return 0; + } + return -1; + } + return 0; +} + + +bool AccelSensor::hasPendingEvents() const { + /* FIXME probably here should be returning mEnabled but instead + mHasPendingEvents. It does not work, so we cheat.*/ + //ALOGD("AccelSensor::~hasPendingEvents %d", mHasPendingEvent ? 1 : 0 ); + return mHasPendingEvent; +} + + +int AccelSensor::setDelay(int32_t handle, int64_t ns) +{ + int fd; + + if (ns < 10000000) { + ns = 10000000; // Minimum on stock + } + + strcpy(&input_sysfs_path[input_sysfs_path_len], "acc_poll_delay"); + fd = open(input_sysfs_path, O_RDWR); + if (fd >= 0) { + char buf[80]; + sprintf(buf, "%lld", ns / 10000000 * 10); // Some flooring to match stock value + write(fd, buf, strlen(buf)+1); + close(fd); + return 0; + } + return -1; +} + + +int AccelSensor::readEvents(sensors_event_t* data, int count) +{ + if (count < 1) + return -EINVAL; + + if (mHasPendingEvent) { + mHasPendingEvent = false; + mPendingEvent.timestamp = getTimestamp(); + *data = mPendingEvent; + return mEnabled ? 1 : 0; + } + + ssize_t n = mInputReader.fill(data_fd); + if (n < 0) + return n; + int numEventReceived = 0; + input_event const* event; + + while (count && mInputReader.readEvent(&event)) { + int type = event->type; + if (type == EV_REL) { + float value = event->value; + if (event->code == EVENT_TYPE_ACCEL_X) { + mPendingEvent.acceleration.x = value * CONVERT_A_X; + } else if (event->code == EVENT_TYPE_ACCEL_Y) { + mPendingEvent.acceleration.y = value * CONVERT_A_Y; + } else if (event->code == EVENT_TYPE_ACCEL_Z) { + mPendingEvent.acceleration.z = value * CONVERT_A_Z; + } + } else if (type == EV_SYN) { + mPendingEvent.timestamp = timevalToNano(event->time); + if (mEnabled) { + *data++ = mPendingEvent; + count--; + numEventReceived++; + } + } else { + ALOGE("%s: unknown event (type=%d, code=%d)", LOGTAG, + type, event->code); + } + + mInputReader.next(); + } + return numEventReceived++; + +} diff --git a/libsensors/AccelSensor.h b/libsensors/AccelSensor.h new file mode 100644 index 0000000..0162147 --- /dev/null +++ b/libsensors/AccelSensor.h @@ -0,0 +1,70 @@ +/* + * Copyright (C) 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. + */ + +#ifndef ANDROID_SMB380_SENSOR_H +#define ANDROID_SMB380_SENSOR_H + +#include +#include +#include +#include + +#include "sensors.h" +#include "SensorBase.h" +#include "InputEventReader.h" + +/*****************************************************************************/ + + +struct smb380acc_t { + short x, /**< holds x-axis acceleration data sign extended. Range -512 to 511. */ + y, /**< holds y-axis acceleration data sign extended. Range -512 to 511. */ + z; /**< holds z-axis acceleration data sign extended. Range -512 to 511. */ +} ; + +/* smb ioctl command label */ +#define IOCTL_SMB_GET_ACC_VALUE 0 +#define DCM_IOC_MAGIC 's' +#define IOC_SET_ACCELEROMETER _IO (DCM_IOC_MAGIC, 0x64) +#define BMA150_CALIBRATION _IOWR(DCM_IOC_MAGIC,48,short) + +#define SMB_POWER_OFF 0 +#define SMB_POWER_ON 1 + +struct input_event; + +class AccelSensor : public SensorBase { + int mEnabled; + InputEventCircularReader mInputReader; + sensors_event_t mPendingEvent; + bool mHasPendingEvent; + char input_sysfs_path[PATH_MAX]; + int input_sysfs_path_len; + + int setInitialState(); + +public: + AccelSensor(); + virtual ~AccelSensor(); + virtual int readEvents(sensors_event_t* data, int count); + virtual bool hasPendingEvents() const; + virtual int setDelay(int32_t handle, int64_t ns); + virtual int enable(int32_t handle, int enabled); +}; + +/*****************************************************************************/ + +#endif // ANDROID_GYRO_SENSOR_H diff --git a/libsensors/AkmSensor.cpp b/libsensors/AkmSensor.cpp new file mode 100644 index 0000000..baca688 --- /dev/null +++ b/libsensors/AkmSensor.cpp @@ -0,0 +1,274 @@ +/* + * Copyright (C) 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. + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include "AkmSensor.h" + +#define LOGTAG "AkmSensor" + +//#define ALOG_NDEBUG 0 + +/*****************************************************************************/ + +int (*akm_is_sensor_enabled)(uint32_t sensor_type); +int (*akm_enable_sensor)(uint32_t sensor_type); +int (*akm_disable_sensor)(uint32_t sensor_type); +int (*akm_set_delay)(uint32_t sensor_type, uint64_t delay); + +int stub_is_sensor_enabled(uint32_t sensor_type) { + return 0; +} + +int stub_enable_disable_sensor(uint32_t sensor_type) { + return -ENODEV; +} + +int stub_set_delay(uint32_t sensor_type, uint64_t delay) { + return -ENODEV; +} + + +AkmSensor::AkmSensor() +: SensorBase(NULL, NULL), + mEnabled(0), + mPendingMask(0), + mInputReader(32) +{ + /* Open the library before opening the input device. The library + * creates a uinput device. + */ + if (loadAKMLibrary() == 0) { + data_name = "compass_sensor"; + data_fd = openInput("compass_sensor"); + } + + //Incase first time fails + if(data_fd < 0){ + ALOGI("%s: retrying to open compass sensor", LOGTAG); + data_fd = openInput("compass_sensor"); + } + + if(data_fd > 0){ + ALOGI("%s: compass sensor successfully opened: %i", LOGTAG, data_fd); + }else{ + ALOGI("%s: failed to open compass sensor", LOGTAG); + } + + memset(mPendingEvents, 0, sizeof(mPendingEvents)); + + mPendingEvents[MagneticField].version = sizeof(sensors_event_t); + mPendingEvents[MagneticField].sensor = ID_M; + mPendingEvents[MagneticField].type = SENSOR_TYPE_MAGNETIC_FIELD; + mPendingEvents[MagneticField].magnetic.status = SENSOR_STATUS_ACCURACY_HIGH; + + // read the actual value of all sensors if they're enabled already + struct input_absinfo absinfo; + short flags = 0; + if (akm_is_sensor_enabled(SENSOR_TYPE_MAGNETIC_FIELD)) { + mEnabled |= 1<= numSensors) + return -EINVAL; + + int newState = en ? 1 : 0; + int err = 0; + + if ((uint32_t(newState)<= 0) { + char buf[80]; + sprintf(buf, "%lld", ns); + write(fd, buf, strlen(buf)+1); + close(fd); + } + + fd = open("/sys/class/sensors/ssp_sensor/ori_poll_delay", O_RDWR); + if (fd >= 0) { + char buf[80]; + sprintf(buf, "%lld", ns); + write(fd, buf, strlen(buf)+1); + close(fd); + } + + mDelays[what] = ns; + return 0; +} + +int AkmSensor::loadAKMLibrary() +{ + mLibAKM = dlopen("libakm.so", RTLD_NOW); + + if (!mLibAKM) { + akm_is_sensor_enabled = stub_is_sensor_enabled; + akm_enable_sensor = stub_enable_disable_sensor; + akm_disable_sensor = stub_enable_disable_sensor; + akm_set_delay = stub_set_delay; + ALOGE("%s: unable to load AKM Library, %s", LOGTAG, dlerror()); + return -ENOENT; + } + + *(void **)&akm_is_sensor_enabled = dlsym(mLibAKM, "akm_is_sensor_enabled"); + *(void **)&akm_enable_sensor = dlsym(mLibAKM, "akm_enable_sensor"); + *(void **)&akm_disable_sensor = dlsym(mLibAKM, "akm_disable_sensor"); + *(void **)&akm_set_delay = dlsym(mLibAKM, "akm_set_delay"); + + return 0; +} + +int AkmSensor::readEvents(sensors_event_t* data, int count) +{ + if (count < 1) + return -EINVAL; + + ssize_t n = mInputReader.fill(data_fd); + if (n < 0) + return n; + + int numEventReceived = 0; + input_event const* event; + + while (count && mInputReader.readEvent(&event)) { + int type = event->type; + if (type == EV_REL) { + processEvent(event->code, event->value); + mInputReader.next(); + } else if (type == EV_ABS) { + processEvent(event->code, event->value); + mInputReader.next(); + } else if (type == EV_SYN) { + int64_t time = timevalToNano(event->time); + for (int j=0 ; count && mPendingMask && jcode); + mInputReader.next(); + } + } + return numEventReceived; +} + +void AkmSensor::processEvent(int code, int value) +{ + switch (code) { + case EVENT_TYPE_MAGV_X: + mPendingMask |= 1< +#include +#include +#include + + +#include "sensors.h" +#include "SensorBase.h" +#include "InputEventReader.h" + +/*****************************************************************************/ + +struct input_event; + +class AkmSensor : public SensorBase { +public: + AkmSensor(); + virtual ~AkmSensor(); + + enum { + Accelerometer = 0, + MagneticField = 1, + Orientation = 2, + numSensors + }; + + virtual int setDelay(int32_t handle, int64_t ns); + virtual int enable(int32_t handle, int enabled); + virtual int readEvents(sensors_event_t* data, int count); + void processEvent(int code, int value); + + int setInitialState(); + +private: + int loadAKMLibrary(); + int update_delay(); + void *mLibAKM; + uint32_t mEnabled; + uint32_t mPendingMask; + InputEventCircularReader mInputReader; + sensors_event_t mPendingEvents[numSensors]; + uint64_t mDelays[numSensors]; +}; + +/*****************************************************************************/ + +#endif // ANDROID_AKM_SENSOR_H diff --git a/libsensors/Android.mk b/libsensors/Android.mk new file mode 100644 index 0000000..47a90e5 --- /dev/null +++ b/libsensors/Android.mk @@ -0,0 +1,47 @@ +# Copyright (C) 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. + + +LOCAL_PATH := $(call my-dir) + +ifneq ($(TARGET_SIMULATOR),true) + +# HAL module implemenation, not prelinked, and stored in +# hw/..so +include $(CLEAR_VARS) + +LOCAL_MODULE := sensors.$(TARGET_BOOTLOADER_BOARD_NAME) + +LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw + +LOCAL_MODULE_TAGS := optional + +LOCAL_CFLAGS := -DALOG_TAG=\"Sensors\" +LOCAL_SRC_FILES := \ + sensors.cpp \ + SensorBase.cpp \ + LightSensor.cpp \ + ProximitySensor.cpp \ + AkmSensor.cpp \ + GyroSensor.cpp \ + InputEventReader.cpp \ + AccelSensor.cpp \ + PressureSensor.cpp + +LOCAL_SHARED_LIBRARIES := liblog libcutils libdl +LOCAL_PRELINK_MODULE := false + +include $(BUILD_SHARED_LIBRARY) + +endif # !TARGET_SIMULATOR diff --git a/libsensors/GyroSensor.cpp b/libsensors/GyroSensor.cpp new file mode 100644 index 0000000..d6dc944 --- /dev/null +++ b/libsensors/GyroSensor.cpp @@ -0,0 +1,177 @@ +/* + * Copyright (C) 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. + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "GyroSensor.h" + +#define LOGTAG "GyroSensor" + +#define FETCH_FULL_EVENT_BEFORE_RETURN 1 +#define IGNORE_EVENT_TIME 350000000 +/*****************************************************************************/ + +GyroSensor::GyroSensor() + : SensorBase(NULL, "gyro_sensor"), + mEnabled(0), + mInputReader(4), + mHasPendingEvent(false), + mEnabledTime(0) +{ + mPendingEvent.version = sizeof(sensors_event_t); + mPendingEvent.sensor = ID_GY; + mPendingEvent.type = SENSOR_TYPE_GYROSCOPE; + memset(mPendingEvent.data, 0, sizeof(mPendingEvent.data)); + + if (data_fd) { + strcpy(input_sysfs_path, "/sys/class/input/"); + strcat(input_sysfs_path, input_name); + strcat(input_sysfs_path, "/device/"); + input_sysfs_path_len = strlen(input_sysfs_path); + enable(0, 1); + } +} + +GyroSensor::~GyroSensor() { + if (mEnabled) { + enable(0, 0); + } +} + +int GyroSensor::setInitialState() { + struct input_absinfo absinfo_x; + struct input_absinfo absinfo_y; + struct input_absinfo absinfo_z; + float value; + if (!ioctl(data_fd, EVIOCGABS(EVENT_TYPE_GYRO_X), &absinfo_x) && + !ioctl(data_fd, EVIOCGABS(EVENT_TYPE_GYRO_X), &absinfo_y) && + !ioctl(data_fd, EVIOCGABS(EVENT_TYPE_GYRO_X), &absinfo_z)) { + value = absinfo_x.value; + mPendingEvent.data[0] = value * CONVERT_GYRO_X; + value = absinfo_x.value; + mPendingEvent.data[1] = value * CONVERT_GYRO_Y; + value = absinfo_x.value; + mPendingEvent.data[2] = value * CONVERT_GYRO_Z; + mHasPendingEvent = true; + } + return 0; +} + +int GyroSensor::enable(int32_t handle, int en) { + int flags = en ? 1 : 0; + int err; + if (flags != mEnabled) { + if(err >= 0){ + mEnabled = flags; + err = sspEnable(LOGTAG, SSP_GYRO, en); + setInitialState(); + + return 0; + } + return -1; + } + return 0; +} + +bool GyroSensor::hasPendingEvents() const { + return mHasPendingEvent; +} + +int GyroSensor::setDelay(int32_t handle, int64_t ns) +{ + int fd; + + strcpy(&input_sysfs_path[input_sysfs_path_len], "gyro_poll_delay"); + fd = open(input_sysfs_path, O_RDWR); + if (fd >= 0) { + char buf[80]; + sprintf(buf, "%lld", ns); + write(fd, buf, strlen(buf)+1); + close(fd); + return 0; + } + return -1; +} + +int GyroSensor::readEvents(sensors_event_t* data, int count) +{ + if (count < 1) + return -EINVAL; + + if (mHasPendingEvent) { + mHasPendingEvent = false; + mPendingEvent.timestamp = getTimestamp(); + *data = mPendingEvent; + return mEnabled ? 1 : 0; + } + + ssize_t n = mInputReader.fill(data_fd); + if (n < 0) + return n; + + int numEventReceived = 0; + input_event const* event; + +#if FETCH_FULL_EVENT_BEFORE_RETURN +again: +#endif + while (count && mInputReader.readEvent(&event)) { + int type = event->type; + if (type == EV_REL) { + float value = event->value; + if (event->code == EVENT_TYPE_GYRO_X) { + mPendingEvent.data[0] = value * CONVERT_GYRO_X; + } else if (event->code == EVENT_TYPE_GYRO_Y) { + mPendingEvent.data[1] = value * CONVERT_GYRO_Y; + } else if (event->code == EVENT_TYPE_GYRO_Z) { + mPendingEvent.data[2] = value * CONVERT_GYRO_Z; + } + } else if (type == EV_SYN) { + mPendingEvent.timestamp = timevalToNano(event->time); + if (mEnabled) { + if (mPendingEvent.timestamp >= mEnabledTime) { + *data++ = mPendingEvent; + numEventReceived++; + } + count--; + } + } else { + ALOGE("%s: unknown event (type=%d, code=%d)", LOGTAG, + type, event->code); + } + mInputReader.next(); + } + +#if FETCH_FULL_EVENT_BEFORE_RETURN + /* if we didn't read a complete event, see if we can fill and + try again instead of returning with nothing and redoing poll. */ + if (numEventReceived == 0 && mEnabled == 1) { + n = mInputReader.fill(data_fd); + if (n) + goto again; + } +#endif + + return numEventReceived; +} + diff --git a/libsensors/GyroSensor.h b/libsensors/GyroSensor.h new file mode 100644 index 0000000..e8997de --- /dev/null +++ b/libsensors/GyroSensor.h @@ -0,0 +1,55 @@ +/* + * Copyright (C) 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. + */ + +#ifndef ANDROID_GYRO_SENSOR_H +#define ANDROID_GYRO_SENSOR_H + +#include +#include +#include +#include + +#include "sensors.h" +#include "SensorBase.h" +#include "InputEventReader.h" + +/*****************************************************************************/ + +struct input_event; + +class GyroSensor : public SensorBase { + int mEnabled; + InputEventCircularReader mInputReader; + sensors_event_t mPendingEvent; + bool mHasPendingEvent; + char input_sysfs_path[PATH_MAX]; + int input_sysfs_path_len; + int64_t mEnabledTime; + + int setInitialState(); + +public: + GyroSensor(); + virtual ~GyroSensor(); + virtual int readEvents(sensors_event_t* data, int count); + virtual bool hasPendingEvents() const; + virtual int setDelay(int32_t handle, int64_t ns); + virtual int enable(int32_t handle, int enabled); +}; + +/*****************************************************************************/ + +#endif // ANDROID_GYRO_SENSOR_H diff --git a/libsensors/InputEventReader.cpp b/libsensors/InputEventReader.cpp new file mode 100644 index 0000000..1014f29 --- /dev/null +++ b/libsensors/InputEventReader.cpp @@ -0,0 +1,88 @@ +/* + * Copyright (C) 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. + */ + +#include +#include +#include +#include + +#include +#include + +#include + +#include + +#include "InputEventReader.h" + +/*****************************************************************************/ + +struct input_event; + +InputEventCircularReader::InputEventCircularReader(size_t numEvents) + : mBuffer(new input_event[numEvents * 2]), + mBufferEnd(mBuffer + numEvents), + mHead(mBuffer), + mCurr(mBuffer), + mFreeSpace(numEvents) +{ +} + +InputEventCircularReader::~InputEventCircularReader() +{ + delete [] mBuffer; +} + +ssize_t InputEventCircularReader::fill(int fd) +{ + size_t numEventsRead = 0; + if (mFreeSpace) { + const ssize_t nread = read(fd, mHead, mFreeSpace * sizeof(input_event)); + if (nread<0 || nread % sizeof(input_event)) { + // we got a partial event!! + return nread<0 ? -errno : -EINVAL; + } + + numEventsRead = nread / sizeof(input_event); + if (numEventsRead) { + mHead += numEventsRead; + mFreeSpace -= numEventsRead; + if (mHead > mBufferEnd) { + size_t s = mHead - mBufferEnd; + memcpy(mBuffer, mBufferEnd, s * sizeof(input_event)); + mHead = mBuffer + s; + } + } + } + + return numEventsRead; +} + +ssize_t InputEventCircularReader::readEvent(input_event const** events) +{ + *events = mCurr; + ssize_t available = (mBufferEnd - mBuffer) - mFreeSpace; + return available ? 1 : 0; +} + +void InputEventCircularReader::next() +{ + mCurr++; + mFreeSpace++; + if (mCurr >= mBufferEnd) { + mCurr = mBuffer; + } +} diff --git a/libsensors/InputEventReader.h b/libsensors/InputEventReader.h new file mode 100644 index 0000000..180aade --- /dev/null +++ b/libsensors/InputEventReader.h @@ -0,0 +1,47 @@ +/* + * Copyright (C) 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. + */ + +#ifndef ANDROID_INPUT_EVENT_READER_H +#define ANDROID_INPUT_EVENT_READER_H + +#include +#include +#include +#include + +/*****************************************************************************/ + +struct input_event; + +class InputEventCircularReader +{ + struct input_event* const mBuffer; + struct input_event* const mBufferEnd; + struct input_event* mHead; + struct input_event* mCurr; + ssize_t mFreeSpace; + +public: + InputEventCircularReader(size_t numEvents); + ~InputEventCircularReader(); + ssize_t fill(int fd); + ssize_t readEvent(input_event const** events); + void next(); +}; + +/*****************************************************************************/ + +#endif // ANDROID_INPUT_EVENT_READER_H diff --git a/libsensors/LightSensor.cpp b/libsensors/LightSensor.cpp new file mode 100644 index 0000000..856000b --- /dev/null +++ b/libsensors/LightSensor.cpp @@ -0,0 +1,150 @@ +/* + * Copyright (C) 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. + */ + +#include +#include +#include +#include +#include +#include +#include + +#include + +#include + +#include "LightSensor.h" + +#define LOGTAG "LightSensor" + +// #define ALOG_NDEBUG 0 + +/*****************************************************************************/ + +LightSensor::LightSensor() + : SensorBase(NULL, "light_sensor"), + mEnabled(0), + mInputReader(4), + mHasPendingEvent(false) +{ + mPendingEvent.version = sizeof(sensors_event_t); + mPendingEvent.sensor = ID_L; + mPendingEvent.type = SENSOR_TYPE_LIGHT; + memset(mPendingEvent.data, 0, sizeof(mPendingEvent.data)); + + if (data_fd) { + strcpy(input_sysfs_path, "/sys/class/input/"); + strcat(input_sysfs_path, input_name); + strcat(input_sysfs_path, "/device/"); + input_sysfs_path_len = strlen(input_sysfs_path); + enable(0, 1); + } +} + +LightSensor::~LightSensor() { + if (mEnabled) { + enable(0, 0); + } +} + +int LightSensor::setInitialState() { + struct input_absinfo absinfo; + if (!ioctl(data_fd, EVIOCGABS(EVENT_TYPE_LIGHT), &absinfo)) { + // make sure to report an event immediately + mHasPendingEvent = true; + mPendingEvent.light = absinfo.value; + } + return 0; +} + +int LightSensor::setDelay(int32_t handle, int64_t ns) +{ + int fd; + + strcpy(&input_sysfs_path[input_sysfs_path_len], "light_poll_delay"); + fd = open(input_sysfs_path, O_RDWR); + if (fd >= 0) { + char buf[80]; + sprintf(buf, "%lld", ns); + write(fd, buf, strlen(buf)+1); + close(fd); + return 0; + } + return -1; +} + +int LightSensor::enable(int32_t handle, int en) +{ + int flags = en ? 1 : 0; + int err; + if (flags != mEnabled) { + err = sspEnable(LOGTAG, SSP_LIGHT, en); + if(err >= 0){ + mEnabled = flags; + setInitialState(); + + return 0; + } + return -1; + } + return 0; +} + +bool LightSensor::hasPendingEvents() const { + return mHasPendingEvent; +} + +int LightSensor::readEvents(sensors_event_t* data, int count) +{ + if (count < 1) + return -EINVAL; + + if (mHasPendingEvent) { + mHasPendingEvent = false; + mPendingEvent.timestamp = getTimestamp(); + *data = mPendingEvent; + return mEnabled ? 1 : 0; + } + + ssize_t n = mInputReader.fill(data_fd); + if (n < 0) + return n; + + int numEventReceived = 0; + input_event const* event; + + while (count && mInputReader.readEvent(&event)) { + int type = event->type; + if (type == EV_REL) { + if (event->code == EVENT_TYPE_LIGHT) { + mPendingEvent.light = event->value; + } + } else if (type == EV_SYN) { + mPendingEvent.timestamp = timevalToNano(event->time); + if (mEnabled) { + *data++ = mPendingEvent; + count--; + numEventReceived++; + } + } else { + ALOGE("%s: unknown event (type=%d, code=%d)", LOGTAG, + type, event->code); + } + mInputReader.next(); + } + + return numEventReceived; +} diff --git a/libsensors/LightSensor.h b/libsensors/LightSensor.h new file mode 100644 index 0000000..85e65d9 --- /dev/null +++ b/libsensors/LightSensor.h @@ -0,0 +1,55 @@ +/* + * Copyright (C) 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. + */ + +#ifndef ANDROID_LIGHT_SENSOR_H +#define ANDROID_LIGHT_SENSOR_H + +#include +#include +#include +#include + +#include "sensors.h" +#include "SensorBase.h" +#include "InputEventReader.h" + +/*****************************************************************************/ + +struct input_event; + +class LightSensor : public SensorBase { + int mEnabled; + InputEventCircularReader mInputReader; + sensors_event_t mPendingEvent; + bool mHasPendingEvent; + char input_sysfs_path[PATH_MAX]; + int input_sysfs_path_len; + + float indexToValue(size_t index) const; + int setInitialState(); + +public: + LightSensor(); + virtual ~LightSensor(); + virtual int readEvents(sensors_event_t* data, int count); + virtual bool hasPendingEvents() const; + virtual int setDelay(int32_t handle, int64_t ns); + virtual int enable(int32_t handle, int enabled); +}; + +/*****************************************************************************/ + +#endif // ANDROID_LIGHT_SENSOR_H diff --git a/libsensors/MODULE_LICENSE_APACHE2 b/libsensors/MODULE_LICENSE_APACHE2 new file mode 100644 index 0000000..e69de29 diff --git a/libsensors/PressureSensor.cpp b/libsensors/PressureSensor.cpp new file mode 100644 index 0000000..0ce514f --- /dev/null +++ b/libsensors/PressureSensor.cpp @@ -0,0 +1,152 @@ +/* + * Copyright (C) 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. + */ + +#include +#include +#include +#include +#include +#include +#include + +#include + +#include "PressureSensor.h" + +#define LOGTAG "PressureSensor" + +/* + * The BMP driver gives pascal values. + * It needs to be changed into hectoPascal + */ +#define PRESSURE_HECTO (1.0f/100.0f) + +/*****************************************************************************/ + +PressureSensor::PressureSensor() + : SensorBase(NULL, "pressure_sensor"), + mEnabled(0), + mInputReader(4), + mHasPendingEvent(false) +{ + mPendingEvent.version = sizeof(sensors_event_t); + mPendingEvent.sensor = ID_PR; + mPendingEvent.type = SENSOR_TYPE_PRESSURE; + memset(mPendingEvent.data, 0, sizeof(mPendingEvent.data)); + + if (data_fd) { + strcpy(input_sysfs_path, "/sys/class/input/"); + strcat(input_sysfs_path, input_name); + strcat(input_sysfs_path, "/device/"); + input_sysfs_path_len = strlen(input_sysfs_path); + enable(0, 1); + } +} + +PressureSensor::~PressureSensor() { + if (mEnabled) { + enable(0, 0); + } +} + +int PressureSensor::setInitialState() { + struct input_absinfo absinfo; + if (!ioctl(data_fd, EVIOCGABS(EVENT_TYPE_PRESSURE), &absinfo)) { + // make sure to report an event immediately + mHasPendingEvent = true; + mPendingEvent.pressure = absinfo.value * PRESSURE_HECTO; + } + return 0; +} + +int PressureSensor::enable(int32_t handle, int en) { + int flags = en ? 1 : 0; + int err; + if (flags != mEnabled) { + err = sspEnable(LOGTAG, SSP_PRESS, en); + if(err >= 0){ + mEnabled = flags; + setInitialState(); + + return 0; + } + return -1; + } + return 0; +} + +bool PressureSensor::hasPendingEvents() const { + return mHasPendingEvent; +} + +int PressureSensor::setDelay(int32_t handle, int64_t ns) +{ + int fd; + + strcpy(&input_sysfs_path[input_sysfs_path_len], "pressure_poll_delay"); + fd = open(input_sysfs_path, O_RDWR); + if (fd >= 0) { + char buf[80]; + sprintf(buf, "%lld", ns); + write(fd, buf, strlen(buf)+1); + close(fd); + return 0; + } + return -1; +} + + +int PressureSensor::readEvents(sensors_event_t* data, int count) +{ + if (count < 1) + return -EINVAL; + + if (mHasPendingEvent) { + mHasPendingEvent = false; + mPendingEvent.timestamp = getTimestamp(); + *data = mPendingEvent; + return mEnabled ? 1 : 0; + } + + ssize_t n = mInputReader.fill(data_fd); + if (n < 0) + return n; + + int numEventReceived = 0; + input_event const* event; + + while (count && mInputReader.readEvent(&event)) { + int type = event->type; + if (type == EV_REL) { + if (event->code == EVENT_TYPE_PRESSURE) { + mPendingEvent.pressure = event->value * PRESSURE_HECTO; + } + } else if (type == EV_SYN) { + mPendingEvent.timestamp = timevalToNano(event->time); + if (mEnabled) { + *data++ = mPendingEvent; + count--; + numEventReceived++; + } + } else { + ALOGE("%s: unknown event (type=%d, code=%d)", LOGTAG, + type, event->code); + } + mInputReader.next(); + } + + return numEventReceived; +} diff --git a/libsensors/PressureSensor.h b/libsensors/PressureSensor.h new file mode 100644 index 0000000..9333d44 --- /dev/null +++ b/libsensors/PressureSensor.h @@ -0,0 +1,54 @@ +/* + * Copyright (C) 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. + */ + +#ifndef ANDROID_PRESSURE_SENSOR_H +#define ANDROID_PRESSURE_SENSOR_H + +#include +#include +#include +#include + +#include "sensors.h" +#include "SensorBase.h" +#include "InputEventReader.h" + +/*****************************************************************************/ + +struct input_event; + +class PressureSensor : public SensorBase { + int mEnabled; + InputEventCircularReader mInputReader; + sensors_event_t mPendingEvent; + bool mHasPendingEvent; + char input_sysfs_path[PATH_MAX]; + int input_sysfs_path_len; + + int setInitialState(); + +public: + PressureSensor(); + virtual ~PressureSensor(); + virtual int readEvents(sensors_event_t* data, int count); + virtual bool hasPendingEvents() const; + virtual int enable(int32_t handle, int enabled); + virtual int setDelay(int32_t handle, int64_t ns); +}; + +/*****************************************************************************/ + +#endif // ANDROID_PRESSURE_SENSOR_H diff --git a/libsensors/ProximitySensor.cpp b/libsensors/ProximitySensor.cpp new file mode 100644 index 0000000..f9579fa --- /dev/null +++ b/libsensors/ProximitySensor.cpp @@ -0,0 +1,158 @@ +/* + * Copyright (C) 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. + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include "ProximitySensor.h" +#include "SensorBase.h" + +#define LOGTAG "ProximitySensor" + +/*****************************************************************************/ + +ProximitySensor::ProximitySensor() + : SensorBase(NULL, "proximity_sensor"), + mEnabled(0), + mInputReader(4), + mHasPendingEvent(false) +{ + mPendingEvent.version = sizeof(sensors_event_t); + mPendingEvent.sensor = ID_P; + mPendingEvent.type = SENSOR_TYPE_PROXIMITY; + memset(mPendingEvent.data, 0, sizeof(mPendingEvent.data)); + + if (data_fd) { + strcpy(input_sysfs_path, "/sys/class/input/"); + strcat(input_sysfs_path, input_name); + strcat(input_sysfs_path, "/device/"); + input_sysfs_path_len = strlen(input_sysfs_path); + enable(0, 1); + } +} + +ProximitySensor::~ProximitySensor() { + if (mEnabled) { + enable(0, 0); + } +} + +int ProximitySensor::setInitialState() { + struct input_absinfo absinfo; + if (!ioctl(data_fd, EVIOCGABS(EVENT_TYPE_PROXIMITY), &absinfo)) { + // make sure to report an event immediately + mHasPendingEvent = true; + mPendingEvent.distance = indexToValue(absinfo.value); + } + return 0; +} + +int ProximitySensor::setDelay(int32_t handle, int64_t ns) +{ + int fd; + + strcpy(&input_sysfs_path[input_sysfs_path_len], "prox_poll_delay"); + fd = open(input_sysfs_path, O_RDWR); + if (fd >= 0) { + char buf[80]; + sprintf(buf, "%lld", ns); + write(fd, buf, strlen(buf)+1); + close(fd); + return 0; + } + return -1; +} + +int ProximitySensor::enable(int32_t handle, int en) { + + int flags = en ? 1 : 0; + int err; + //ALOGD("%s: Enable: %i", __func__, en); + if (flags != mEnabled) { + err = sspEnable(LOGTAG, SSP_PROX, en); + if(err >= 0){ + mEnabled = flags; + setInitialState(); + + return 0; + } + return -1; + } + return 0; +} + +bool ProximitySensor::hasPendingEvents() const { + return mHasPendingEvent; +} + +int ProximitySensor::readEvents(sensors_event_t* data, int count) +{ + if (count < 1) + return -EINVAL; + + if (mHasPendingEvent) { + mHasPendingEvent = false; + mPendingEvent.timestamp = getTimestamp(); + *data = mPendingEvent; + return mEnabled ? 1 : 0; + } + + ssize_t n = mInputReader.fill(data_fd); + if (n < 0) + return n; + + int numEventReceived = 0; + input_event const* event; + + while (count && mInputReader.readEvent(&event)) { + int type = event->type; + if (type == EV_ABS) { + if (event->code == EVENT_TYPE_PROXIMITY) { + if (event->value != -1) { + // FIXME: not sure why we're getting -1 sometimes + mPendingEvent.distance = indexToValue(event->value); + } + } + } else if (type == EV_SYN) { + mPendingEvent.timestamp = timevalToNano(event->time); + if (mEnabled) { + *data++ = mPendingEvent; + count--; + numEventReceived++; + } + } else { + ALOGE("%s: unknown event (type=%d, code=%d)",LOGTAG, + type, event->code); + } + mInputReader.next(); + } + + return numEventReceived; +} + +float ProximitySensor::indexToValue(size_t index) const +{ + ALOGV("%s: Index = %zu",LOGTAG, index); + return index * PROXIMITY_THRESHOLD_CM; +} diff --git a/libsensors/ProximitySensor.h b/libsensors/ProximitySensor.h new file mode 100644 index 0000000..a6aa851 --- /dev/null +++ b/libsensors/ProximitySensor.h @@ -0,0 +1,55 @@ +/* + * Copyright (C) 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. + */ + +#ifndef ANDROID_PROXIMITY_SENSOR_H +#define ANDROID_PROXIMITY_SENSOR_H + +#include +#include +#include +#include + +#include "sensors.h" +#include "SensorBase.h" +#include "InputEventReader.h" + +/*****************************************************************************/ + +struct input_event; + +class ProximitySensor : public SensorBase { + int mEnabled; + InputEventCircularReader mInputReader; + sensors_event_t mPendingEvent; + bool mHasPendingEvent; + char input_sysfs_path[PATH_MAX]; + int input_sysfs_path_len; + + int setInitialState(); + float indexToValue(size_t index) const; + +public: + ProximitySensor(); + virtual ~ProximitySensor(); + virtual int readEvents(sensors_event_t* data, int count); + virtual bool hasPendingEvents() const; + virtual int enable(int32_t handle, int enabled); + virtual int setDelay(int32_t handle, int64_t ns); +}; + +/*****************************************************************************/ + +#endif // ANDROID_PROXIMITY_SENSOR_H diff --git a/libsensors/SensorBase.cpp b/libsensors/SensorBase.cpp new file mode 100644 index 0000000..9c27184 --- /dev/null +++ b/libsensors/SensorBase.cpp @@ -0,0 +1,192 @@ +/* + * Copyright (C) 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. + */ + +#include +#include +#include +#include +#include +#include +#include + +#include + +#include + +#include "SensorBase.h" + +/*****************************************************************************/ + +SensorBase::SensorBase( + const char* dev_name, + const char* data_name) + : dev_name(dev_name), data_name(data_name), + dev_fd(-1), data_fd(-1) +{ + if (data_name) { + data_fd = openInput(data_name); + } +} + +SensorBase::~SensorBase() { + if (data_fd >= 0) { + close(data_fd); + } + if (dev_fd >= 0) { + close(dev_fd); + } +} + +int SensorBase::open_device() { + if (dev_fd<0 && dev_name) { + dev_fd = open(dev_name, O_RDONLY); + ALOGE_IF(dev_fd<0, "Couldn't open %s (%s)", dev_name, strerror(errno)); + } + return 0; +} + +int SensorBase::close_device() { + if (dev_fd >= 0) { + close(dev_fd); + dev_fd = -1; + } + return 0; +} + +int SensorBase::getFd() const { + if (!data_name) { + return dev_fd; + } + return data_fd; +} + +int SensorBase::setDelay(int32_t handle, int64_t ns) { + return 0; +} + +bool SensorBase::hasPendingEvents() const { + return false; +} + +int64_t SensorBase::getTimestamp() { + struct timespec t; + t.tv_sec = t.tv_nsec = 0; + clock_gettime(CLOCK_MONOTONIC, &t); + return int64_t(t.tv_sec)*1000000000LL + t.tv_nsec; +} + +int SensorBase::openInput(const char* inputName) { + int fd = -1; + const char *dirname = "/dev/input"; + char devname[PATH_MAX]; + char *filename; + DIR *dir; + struct dirent *de; + dir = opendir(dirname); + if(dir == NULL) + return -1; + strcpy(devname, dirname); + filename = devname + strlen(devname); + *filename++ = '/'; + while((de = readdir(dir))) { + if(de->d_name[0] == '.' && + (de->d_name[1] == '\0' || + (de->d_name[1] == '.' && de->d_name[2] == '\0'))) + continue; + strcpy(filename, de->d_name); + fd = open(devname, O_RDONLY); + if (fd>=0) { + char name[80]; + if (ioctl(fd, EVIOCGNAME(sizeof(name) - 1), &name) < 1) { + name[0] = '\0'; + } + if (!strcmp(name, inputName)) { + strcpy(input_name, filename); + break; + } else { + close(fd); + fd = -1; + } + } + } + closedir(dir); + ALOGE_IF(fd<0, "couldn't find '%s' input device", inputName); + + return fd; +} + +int SensorBase::batch(int handle, int flags, int64_t period_ns, int64_t timeout) +{ + return 0; +} + +int SensorBase::flush(int handle) +{ + return 0; +} + +int SensorBase::sspEnable(const char* sensorname, int sensorvalue, int en) +{ + FILE* sspfile; + int oldvalue = 0; + int reset = 0; + int newvalue; + int fd; + + sspfile = fopen(SSP_DEVICE_ENABLE, "r+"); + fscanf(sspfile, "%d", &oldvalue); + fclose(sspfile); + +//Accel sensor is first on and last off, if we are disabling it +// assume the screen is off, disable all sensors and zero everything out +// to keep enable file in sync. + if(sensorvalue == SSP_ACCEL && !en) { + //ALOGD("SensorBase: Resetting sensors"); + for(int i; i < 6; i++){ + newvalue = oldvalue - ssp_sensors[i]; + //ALOGD("SensorBase: newvalue: %i ",newvalue); + sspWrite(newvalue); + } + sspWrite('\0'); + return 0; + } else if(en) { + newvalue = oldvalue + sensorvalue; + } else { + newvalue = oldvalue - sensorvalue; + } + //ALOGI("%s: name: %s sensor: %i old value: %i new value: %i ", __func__, sensorname, sensorvalue, oldvalue, newvalue); + sspWrite(newvalue); + return 0; +} + +int SensorBase::sspWrite(int sensorvalue) +{ + char buf[12]; + int fd, ret, err; + + sprintf(buf, "%d", sensorvalue); + fd = open(SSP_DEVICE_ENABLE, O_RDWR); + if (fd >= 0) { + err = write(fd, buf, sizeof(buf)); + ret = 0; + } else { + ALOGI("%s: error writing to file", __func__); + ret = -1; + } + + close(fd); + return ret; +} diff --git a/libsensors/SensorBase.h b/libsensors/SensorBase.h new file mode 100644 index 0000000..aeac510 --- /dev/null +++ b/libsensors/SensorBase.h @@ -0,0 +1,72 @@ +/* + * Copyright (C) 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. + */ + +#ifndef ANDROID_SENSOR_BASE_H +#define ANDROID_SENSOR_BASE_H + +#include +#include +#include +#include + +#include "sensors.h" + + +/*****************************************************************************/ + +struct sensors_event_t; + +class SensorBase { +protected: + const char* dev_name; + const char* data_name; + char input_name[PATH_MAX]; + int dev_fd; + int data_fd; + + int openInput(const char* inputName); + static int64_t getTimestamp(); + + + static int64_t timevalToNano(timeval const& t) { + return t.tv_sec*1000000000LL + t.tv_usec*1000; + } + + int open_device(); + int close_device(); + +public: + SensorBase( + const char* dev_name, + const char* data_name); + + virtual ~SensorBase(); + + virtual int readEvents(sensors_event_t* data, int count) = 0; + virtual bool hasPendingEvents() const; + virtual int getFd() const; + virtual int setDelay(int32_t handle, int64_t ns); + virtual int enable(int32_t handle, int enabled) = 0; + int sspEnable(const char* sensorname, int sensorvalue, int en); + int sspWrite(int sensorvalue); + virtual int batch(int handle, int flags, int64_t period_ns, int64_t timeout); + virtual int flush(int handle); + +}; + +/*****************************************************************************/ + +#endif // ANDROID_SENSOR_BASE_H diff --git a/libsensors/sensors.cpp b/libsensors/sensors.cpp new file mode 100644 index 0000000..689c717 --- /dev/null +++ b/libsensors/sensors.cpp @@ -0,0 +1,392 @@ +/* + * Copyright (C) 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. + */ + +#define ALOG_TAG "Sensors" + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include + +#include "sensors.h" + +#include "LightSensor.h" +#include "ProximitySensor.h" +#include "AkmSensor.h" +#include "GyroSensor.h" +#include "AccelSensor.h" +#include "PressureSensor.h" + +/*****************************************************************************/ + +#define DELAY_OUT_TIME 0x7FFFFFFF + +#define LIGHT_SENSOR_POLLTIME 2000000000 + + +#define SENSORS_ACCELERATION (1<getFd(); + mPollFds[light].events = POLLIN; + mPollFds[light].revents = 0; + + mSensors[proximity] = new ProximitySensor(); + mPollFds[proximity].fd = mSensors[proximity]->getFd(); + mPollFds[proximity].events = POLLIN; + mPollFds[proximity].revents = 0; + + mSensors[akm] = new AkmSensor(); + mPollFds[akm].fd = mSensors[akm]->getFd(); + mPollFds[akm].events = POLLIN; + mPollFds[akm].revents = 0; + + mSensors[gyro] = new GyroSensor(); + mPollFds[gyro].fd = mSensors[gyro]->getFd(); + mPollFds[gyro].events = POLLIN; + mPollFds[gyro].revents = 0; + + mSensors[accel] = new AccelSensor(); + mPollFds[accel].fd = mSensors[accel]->getFd(); + mPollFds[accel].events = POLLIN; + mPollFds[accel].revents = 0; + + mSensors[pressure] = new PressureSensor(); + mPollFds[pressure].fd = mSensors[pressure]->getFd(); + mPollFds[pressure].events = POLLIN; + mPollFds[pressure].revents = 0; + + int wakeFds[2]; + int result = pipe(wakeFds); + ALOGE_IF(result<0, "error creating wake pipe (%s)", strerror(errno)); + fcntl(wakeFds[0], F_SETFL, O_NONBLOCK); + fcntl(wakeFds[1], F_SETFL, O_NONBLOCK); + mWritePipeFd = wakeFds[1]; + + mPollFds[wake].fd = wakeFds[0]; + mPollFds[wake].events = POLLIN; + mPollFds[wake].revents = 0; + mInitialized = true; +} + +sensors_poll_context_t::~sensors_poll_context_t() { + for (int i=0 ; ienable(handle, enabled); + if (enabled && !err) { + const char wakeMessage(WAKE_MESSAGE); + int result = write(mWritePipeFd, &wakeMessage, 1); + ALOGE_IF(result<0, "error sending wake message (%s)", strerror(errno)); + } + return err; +} + +int sensors_poll_context_t::setDelay(int handle, int64_t ns) { + + int index = handleToDriver(handle); + if (index < 0) return index; + return mSensors[index]->setDelay(handle, ns); +} + +int sensors_poll_context_t::pollEvents(sensors_event_t* data, int count) +{ + int nbEvents = 0; + int n = 0; + + do { + // see if we have some leftover from the last poll() + for (int i=0 ; count && ihasPendingEvents())) { + int nb = sensor->readEvents(data, count); + if (nb < count) { + // no more data for this sensor + mPollFds[i].revents = 0; + } + count -= nb; + nbEvents += nb; + data += nb; + } + } + + if (count) { + // we still have some room, so try to see if we can get + // some events immediately or just wait if we don't have + // anything to return + n = poll(mPollFds, numFds, nbEvents ? 0 : -1); + if (n<0) { + ALOGE("poll() failed (%s)", strerror(errno)); + return -errno; + } + if (mPollFds[wake].revents & POLLIN) { + char msg; + int result = read(mPollFds[wake].fd, &msg, 1); + ALOGE_IF(result<0, "error reading from wake pipe (%s)", strerror(errno)); + ALOGE_IF(msg != WAKE_MESSAGE, "unknown message on wake queue (0x%02x)", int(msg)); + mPollFds[wake].revents = 0; + } + } + // if we have events and space, go read them + } while (n && count); + + return nbEvents; +} + +int sensors_poll_context_t::batch(int handle, int flags, int64_t period_ns, int64_t timeout) +{ + int index = handleToDriver(handle); + if (index < 0) return index; + return mSensors[index]->batch(handle, flags, period_ns, timeout); +} + +int sensors_poll_context_t::flush(int handle) +{ + int index = handleToDriver(handle); + if (index < 0) return index; + return mSensors[index]->flush(handle); +} + +/*****************************************************************************/ + +static int poll__close(struct hw_device_t *dev) +{ + sensors_poll_context_t *ctx = (sensors_poll_context_t *)dev; + if (ctx) { + delete ctx; + } + return 0; +} + +static int poll__activate(struct sensors_poll_device_t *dev, + int handle, int enabled) { + sensors_poll_context_t *ctx = (sensors_poll_context_t *)dev; + return ctx->activate(handle, enabled); +} + +static int poll__setDelay(struct sensors_poll_device_t *dev, + int handle, int64_t ns) { + sensors_poll_context_t *ctx = (sensors_poll_context_t *)dev; + return ctx->setDelay(handle, ns); +} + +static int poll__poll(struct sensors_poll_device_t *dev, + sensors_event_t* data, int count) { + sensors_poll_context_t *ctx = (sensors_poll_context_t *)dev; + return ctx->pollEvents(data, count); +} + +static int poll__batch(struct sensors_poll_device_1 *dev, + int handle, int flags, int64_t period_ns, int64_t timeout) +{ + sensors_poll_context_t *ctx = (sensors_poll_context_t *)dev; + return ctx->batch(handle, flags, period_ns, timeout); +} + +static int poll__flush(struct sensors_poll_device_1 *dev, + int handle) +{ + sensors_poll_context_t *ctx = (sensors_poll_context_t *)dev; + return ctx->flush(handle); +} + +/*****************************************************************************/ + +/** Open a new instance of a sensor device using name */ +static int open_sensors(const struct hw_module_t* module, const char* id, + struct hw_device_t** device) +{ + int status = -EINVAL; + sensors_poll_context_t *dev = new sensors_poll_context_t(); + + memset(&dev->device, 0, sizeof(sensors_poll_device_1)); + + dev->device.common.tag = HARDWARE_DEVICE_TAG; + dev->device.common.version = SENSORS_DEVICE_API_VERSION_1_0; + dev->device.common.module = const_cast(module); + dev->device.common.close = poll__close; + dev->device.activate = poll__activate; + dev->device.setDelay = poll__setDelay; + dev->device.poll = poll__poll; + + /* Batch processing */ + dev->device.batch = poll__batch; + dev->device.flush = poll__flush; + + *device = &dev->device.common; + status = 0; + + return status; +} + diff --git a/libsensors/sensors.h b/libsensors/sensors.h new file mode 100644 index 0000000..5ad1b80 --- /dev/null +++ b/libsensors/sensors.h @@ -0,0 +1,134 @@ +/* + * Copyright (C) 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. + */ + +#ifndef ANDROID_SENSORS_H +#define ANDROID_SENSORS_H + +#include +#include +#include +#include + +#include + +#include +#include + +__BEGIN_DECLS + +/*****************************************************************************/ + +#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0])) + +#define ID_A (0) +#define ID_M (1) +#define ID_O (2) +#define ID_L (3) +#define ID_P (4) +#define ID_GY (5) +#define ID_PR (6) + +#define SSP_ACCEL (1) +#define SSP_GYRO (2) +#define SSP_MAG (4) +#define SSP_PRESS (8) +#define SSP_PROX (32) +#define SSP_LIGHT (64) + +#define SSP_DEVICE_ENABLE "/sys/class/sensors/ssp_sensor/enable" + +const int ssp_sensors[] = { + SSP_ACCEL, + SSP_GYRO, + SSP_MAG, + SSP_PRESS, + SSP_PROX, + SSP_LIGHT +}; + + +/*****************************************************************************/ + +/* + * The SENSORS Module + */ + +/* the CM3663 is a binary proximity sensor that triggers around 6 cm on + * this hardware */ +#define PROXIMITY_THRESHOLD_CM 8.0f + +/*****************************************************************************/ + +#define EVENT_TYPE_ACCEL_X REL_X //1 +#define EVENT_TYPE_ACCEL_Y REL_Y //0 +#define EVENT_TYPE_ACCEL_Z REL_Z //2 + +#define EVENT_TYPE_YAW ABS_RX //3 +#define EVENT_TYPE_PITCH ABS_RY //4 +#define EVENT_TYPE_ROLL ABS_RZ //5 +#define EVENT_TYPE_ORIENT_STATUS ABS_WHEEL //8 + +#define EVENT_TYPE_MAGV_X ABS_RX // 3 +#define EVENT_TYPE_MAGV_Y ABS_RY // 4 +#define EVENT_TYPE_MAGV_Z ABS_RZ // 5 + +#define EVENT_TYPE_TEMPERATURE ABS_THROTTLE +#define EVENT_TYPE_STEP_COUNT ABS_GAS +#define EVENT_TYPE_PROXIMITY ABS_DISTANCE +#define EVENT_TYPE_LIGHT REL_MISC + +#define EVENT_TYPE_GYRO_X REL_RX +#define EVENT_TYPE_GYRO_Y REL_RY +#define EVENT_TYPE_GYRO_Z REL_RZ + +#define EVENT_TYPE_PRESSURE REL_HWHEEL + +#define LSG (1000.0f) + +// conversion of acceleration data to SI units (m/s^2) +#define RANGE_A (2*GRAVITY_EARTH) +#define RESOLUTION_A (GRAVITY_EARTH / LSG) +#define CONVERT_A (GRAVITY_EARTH / LSG) +#define CONVERT_A_X (CONVERT_A) +#define CONVERT_A_Y (CONVERT_A) +#define CONVERT_A_Z (CONVERT_A) + +// conversion of magnetic data to uT units +#define CONVERT_M (1.0f/16.0f) +#define CONVERT_M_X (CONVERT_M) +#define CONVERT_M_Y (CONVERT_M) +#define CONVERT_M_Z (CONVERT_M) + +/* conversion of orientation data to degree units */ +#define CONVERT_O (1.0f/1000.0f) +#define CONVERT_O_A (CONVERT_O) +#define CONVERT_O_P (CONVERT_O) +#define CONVERT_O_R (CONVERT_O) + +// conversion of gyro data to SI units (radian/sec) +#define RANGE_GYRO (2000.0f*(float)M_PI/180.0f) +#define CONVERT_GYRO ((70.0f / 4000.0f) * ((float)M_PI / 180.0f)) +#define CONVERT_GYRO_X (CONVERT_GYRO) +#define CONVERT_GYRO_Y (CONVERT_GYRO) +#define CONVERT_GYRO_Z (CONVERT_GYRO) + +#define SENSOR_STATE_MASK (0x7FFF) + +/*****************************************************************************/ + +__END_DECLS + +#endif // ANDROID_SENSORS_H diff --git a/n7100.mk b/n7100.mk index d034981..d5bd417 100644 --- a/n7100.mk +++ b/n7100.mk @@ -57,6 +57,10 @@ PRODUCT_PACKAGES += \ PRODUCT_PACKAGES += \ OpenDelta +# Sensors +PRODUCT_PACKAGES += \ + sensors.smdk4x12 + # NFC PRODUCT_PACKAGES += \ nfc.exynos4 \ diff --git a/proprietary-files.txt b/proprietary-files.txt index 8627379..1deea9d 100644 --- a/proprietary-files.txt +++ b/proprietary-files.txt @@ -2,7 +2,6 @@ system/bin/gpsd system/bin/sensorservice system/bin/sensorhubservice system/lib/hw/gps.exynos4.so -system/lib/hw/sensors.smdk4x12.so system/lib/hw/sensorhubs.smdk4x12.so system/lib/libakm.so system/lib/libsec-ril.so -- cgit v1.1 From 7fab701f70788f95eebe53eb3728e4fbc0dda255 Mon Sep 17 00:00:00 2001 From: sbrissen Date: Wed, 3 Dec 2014 08:57:55 -0500 Subject: n7100: update sensors for L Change-Id: I94bed7e8e1a722cef01649930c82c84276720946 --- libsensors/LightSensor.cpp | 2 -- libsensors/sensors.cpp | 21 ++++++++++++++------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/libsensors/LightSensor.cpp b/libsensors/LightSensor.cpp index 856000b..5d9eb07 100644 --- a/libsensors/LightSensor.cpp +++ b/libsensors/LightSensor.cpp @@ -22,8 +22,6 @@ #include #include -#include - #include #include "LightSensor.h" diff --git a/libsensors/sensors.cpp b/libsensors/sensors.cpp index 689c717..1140aed 100644 --- a/libsensors/sensors.cpp +++ b/libsensors/sensors.cpp @@ -73,31 +73,38 @@ static const struct sensor_t sSensorList[] = { { "LSM330DLC Acceleration Sensor", "STMicroelectronics", 1, SENSORS_ACCELERATION_HANDLE, - SENSOR_TYPE_ACCELEROMETER, RANGE_A, CONVERT_A, 0.23f, 20000, 0, 0, { } }, + SENSOR_TYPE_ACCELEROMETER, RANGE_A, CONVERT_A, 0.23f, 20000, 0, 0, + SENSOR_STRING_TYPE_ACCELEROMETER, "", 0, SENSOR_FLAG_CONTINUOUS_MODE, { } }, { "AK8963C Magnetic field Sensor", "Asahi Kasei Microdevices", 1, SENSORS_MAGNETIC_FIELD_HANDLE, - SENSOR_TYPE_MAGNETIC_FIELD, 2000.0f, CONVERT_M, 6.8f, 16667, 0, 0, { } }, + SENSOR_TYPE_MAGNETIC_FIELD, 2000.0f, CONVERT_M, 6.8f, 16667, 0, 0, + SENSOR_STRING_TYPE_MAGNETIC_FIELD, "", 0, SENSOR_FLAG_CONTINUOUS_MODE, { } }, { "AK8963C Orientation Sensor", "Asahi Kasei Microdevices", 1, SENSORS_ORIENTATION_HANDLE, - SENSOR_TYPE_ORIENTATION, 360.0f, CONVERT_O, 7.8f, 16667, 0, 0, { } }, + SENSOR_TYPE_ORIENTATION, 360.0f, CONVERT_O, 7.8f, 16667, 0, 0, + SENSOR_STRING_TYPE_ORIENTATION, "", 0, SENSOR_FLAG_CONTINUOUS_MODE, { } }, { "LSM330DLC Gyroscope Sensor", "STMicroelectronics", 1, SENSORS_GYROSCOPE_HANDLE, - SENSOR_TYPE_GYROSCOPE, RANGE_GYRO, CONVERT_GYRO, 6.1f, 1190, 0, 0, { } }, + SENSOR_TYPE_GYROSCOPE, RANGE_GYRO, CONVERT_GYRO, 6.1f, 1190, 0, 0, + SENSOR_STRING_TYPE_GYROSCOPE, "", 0, SENSOR_FLAG_CONTINUOUS_MODE, { } }, { "BMP182 Pressure sensor", "Bosch", 1, SENSORS_PRESSURE_HANDLE, - SENSOR_TYPE_PRESSURE, 1100.0f, 0.01f, 0.06f, 50000, 0, 0, { } }, + SENSOR_TYPE_PRESSURE, 1100.0f, 0.01f, 0.06f, 50000, 0, 0, + SENSOR_STRING_TYPE_PRESSURE, "", 0, SENSOR_FLAG_CONTINUOUS_MODE, { } }, { "CM36651 Proximity Sensor", "Capella Microsystems", 1, SENSORS_PROXIMITY_HANDLE, - SENSOR_TYPE_PROXIMITY, 5.0f, 5.0f, 0.75f, 0, 0, 0, { } }, + SENSOR_TYPE_PROXIMITY, 5.0f, 5.0f, 0.75f, 0, 0, 0, + SENSOR_STRING_TYPE_PROXIMITY, "", 0, SENSOR_FLAG_WAKE_UP, { } }, { "CM36651 Light Sensor", "Capella Microsystems", 1, SENSORS_LIGHT_HANDLE, - SENSOR_TYPE_LIGHT, 10240.0f, 1.0f, 0.75f, 0, 0, 0, { } }, + SENSOR_TYPE_LIGHT, 10240.0f, 1.0f, 0.75f, 0, 0, 0, + SENSOR_STRING_TYPE_LIGHT, "", 0, SENSOR_FLAG_CONTINUOUS_MODE, { } }, }; -- cgit v1.1 From f4e064db516feb2111a94ccf23d763e12aeef527 Mon Sep 17 00:00:00 2001 From: DerTeufel Date: Mon, 29 Dec 2014 18:52:07 +0100 Subject: libsensors: update paths to match new kernel base Change-Id: I89bcc9c86d1974348f67ec4b5974f52c05de711d --- libsensors/AccelSensor.cpp | 2 +- libsensors/GyroSensor.cpp | 2 +- libsensors/LightSensor.cpp | 2 +- libsensors/PressureSensor.cpp | 2 +- libsensors/ProximitySensor.cpp | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/libsensors/AccelSensor.cpp b/libsensors/AccelSensor.cpp index 2d02bc7..290b023 100644 --- a/libsensors/AccelSensor.cpp +++ b/libsensors/AccelSensor.cpp @@ -94,7 +94,7 @@ int AccelSensor::setDelay(int32_t handle, int64_t ns) ns = 10000000; // Minimum on stock } - strcpy(&input_sysfs_path[input_sysfs_path_len], "acc_poll_delay"); + strcpy(&input_sysfs_path[input_sysfs_path_len], "poll_delay"); fd = open(input_sysfs_path, O_RDWR); if (fd >= 0) { char buf[80]; diff --git a/libsensors/GyroSensor.cpp b/libsensors/GyroSensor.cpp index d6dc944..eb2a076 100644 --- a/libsensors/GyroSensor.cpp +++ b/libsensors/GyroSensor.cpp @@ -101,7 +101,7 @@ int GyroSensor::setDelay(int32_t handle, int64_t ns) { int fd; - strcpy(&input_sysfs_path[input_sysfs_path_len], "gyro_poll_delay"); + strcpy(&input_sysfs_path[input_sysfs_path_len], "poll_delay"); fd = open(input_sysfs_path, O_RDWR); if (fd >= 0) { char buf[80]; diff --git a/libsensors/LightSensor.cpp b/libsensors/LightSensor.cpp index 5d9eb07..fd1587f 100644 --- a/libsensors/LightSensor.cpp +++ b/libsensors/LightSensor.cpp @@ -72,7 +72,7 @@ int LightSensor::setDelay(int32_t handle, int64_t ns) { int fd; - strcpy(&input_sysfs_path[input_sysfs_path_len], "light_poll_delay"); + strcpy(&input_sysfs_path[input_sysfs_path_len], "poll_delay"); fd = open(input_sysfs_path, O_RDWR); if (fd >= 0) { char buf[80]; diff --git a/libsensors/PressureSensor.cpp b/libsensors/PressureSensor.cpp index 0ce514f..825a961 100644 --- a/libsensors/PressureSensor.cpp +++ b/libsensors/PressureSensor.cpp @@ -96,7 +96,7 @@ int PressureSensor::setDelay(int32_t handle, int64_t ns) { int fd; - strcpy(&input_sysfs_path[input_sysfs_path_len], "pressure_poll_delay"); + strcpy(&input_sysfs_path[input_sysfs_path_len], "poll_delay"); fd = open(input_sysfs_path, O_RDWR); if (fd >= 0) { char buf[80]; diff --git a/libsensors/ProximitySensor.cpp b/libsensors/ProximitySensor.cpp index f9579fa..53d6381 100644 --- a/libsensors/ProximitySensor.cpp +++ b/libsensors/ProximitySensor.cpp @@ -72,7 +72,7 @@ int ProximitySensor::setDelay(int32_t handle, int64_t ns) { int fd; - strcpy(&input_sysfs_path[input_sysfs_path_len], "prox_poll_delay"); + strcpy(&input_sysfs_path[input_sysfs_path_len], "poll_delay"); fd = open(input_sysfs_path, O_RDWR); if (fd >= 0) { char buf[80]; -- cgit v1.1 From 12b9a752609f8fe26caad6e3b581fd1b1f200ce8 Mon Sep 17 00:00:00 2001 From: Dheeraj CVR Date: Fri, 2 Jan 2015 03:49:07 +0530 Subject: n7100: use opensource sensors Change-Id: I8656a410982ee64295476a016f44cfa49a2e900f --- proprietary-files.txt | 5 ----- rootdir/init.target.rc | 6 ------ 2 files changed, 11 deletions(-) diff --git a/proprietary-files.txt b/proprietary-files.txt index 1deea9d..9fa7cab 100644 --- a/proprietary-files.txt +++ b/proprietary-files.txt @@ -1,12 +1,7 @@ system/bin/gpsd -system/bin/sensorservice -system/bin/sensorhubservice system/lib/hw/gps.exynos4.so -system/lib/hw/sensorhubs.smdk4x12.so system/lib/libakm.so system/lib/libsec-ril.so -system/lib/libsensorservice.so -system/lib/libsensorhubservice.so system/usr/idc/sec_e-pen.idc system/usr/keylayout/sec_e-pen.kl system/usr/keylayout/sec_touchkey.kl diff --git a/rootdir/init.target.rc b/rootdir/init.target.rc index 1fbba77..a3b06d4 100644 --- a/rootdir/init.target.rc +++ b/rootdir/init.target.rc @@ -46,12 +46,6 @@ service cpboot-daemon /sbin/cbd -d -p 10 user root group radio cache inet misc audio sdcard_rw log -# sensorhub -service sensorhubservice /system/bin/sensorhubservice - class main - user system - group input - # GPS service gpsd /system/bin/gpsd -c /system/etc/gps.xml class main -- cgit v1.1 From 2373d4ad07281d90a19a632e9cb652b07f8ec435 Mon Sep 17 00:00:00 2001 From: Dheeraj CVR Date: Fri, 2 Jan 2015 06:39:43 +0530 Subject: n7100: audio: adjust microphone sensitivity * Lower the main and sub mic gain to prevent distortion. * Increase the headset mic gain * Enable +30db boost for headset mic Change-Id: Ie13c25cc1f119c372031a9e5f6a95374bace3ae2 --- configs/tiny_hw.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/configs/tiny_hw.xml b/configs/tiny_hw.xml index 88f3651..57129c9 100644 --- a/configs/tiny_hw.xml +++ b/configs/tiny_hw.xml @@ -261,7 +261,7 @@ We are able to have most of our routing static so do that - + @@ -282,7 +282,7 @@ We are able to have most of our routing static so do that - + @@ -309,9 +309,9 @@ We are able to have most of our routing static so do that - + - + -- cgit v1.1 From 1c3ccd1cbf98430dc091240fe1aa494a51908980 Mon Sep 17 00:00:00 2001 From: MarcKe Date: Thu, 29 Jan 2015 20:32:59 +0100 Subject: audio: fix incall mute --- audio/audio_hw.c | 42 ++++++++++++++++++++++++++++++++++++++++++ audio/audio_hw.h | 7 +++++++ 2 files changed, 49 insertions(+) diff --git a/audio/audio_hw.c b/audio/audio_hw.c index 31aecad..5335d7d 100644 --- a/audio/audio_hw.c +++ b/audio/audio_hw.c @@ -2603,10 +2603,52 @@ static int adev_set_mode(struct audio_hw_device *dev, audio_mode_t mode) static int adev_set_mic_mute(struct audio_hw_device *dev, bool state) { + int headset_on; + int headphone_on; + int speaker_on; + int earpiece_on; + int bt_on; + struct m0_audio_device *adev = (struct m0_audio_device *)dev; + headset_on = adev->out_device & AUDIO_DEVICE_OUT_WIRED_HEADSET; + headphone_on = adev->out_device & AUDIO_DEVICE_OUT_WIRED_HEADPHONE; + speaker_on = adev->out_device & AUDIO_DEVICE_OUT_SPEAKER; + earpiece_on = adev->out_device & AUDIO_DEVICE_OUT_EARPIECE; + bt_on = adev->out_device & AUDIO_DEVICE_OUT_ALL_SCO; + adev->mic_mute = state; + if (adev->mode == AUDIO_MODE_IN_CALL) { + if (state) { + if (speaker_on || earpiece_on || headphone_on) { + ALOGD("%s: set voicecall route: default_input_disable", __func__); + set_bigroute_by_array(adev->mixer, default_input_disable, 1); + } + if (headset_on) { + ALOGD("%s: set voicecall route: headset_input_disable", __func__); + set_bigroute_by_array(adev->mixer, headset_input_disable, 1); + } + if (bt_on) { + ALOGD("%s: set voicecall route: bt_input_disable", __func__); + set_bigroute_by_array(adev->mixer, bt_input_disable, 1); + } + } else { + if (speaker_on || earpiece_on || headphone_on) { + ALOGD("%s: set voicecall route: default_input", __func__); + set_bigroute_by_array(adev->mixer, default_input, 1); + } + if (headset_on) { + ALOGD("%s: set voicecall route: headset_input", __func__); + set_bigroute_by_array(adev->mixer, headset_input, 1); + } + if (bt_on) { + ALOGD("%s: set voicecall route: bt_input", __func__); + set_bigroute_by_array(adev->mixer, bt_input, 1); + } + } + } + return 0; } diff --git a/audio/audio_hw.h b/audio/audio_hw.h index 5ba0e9e..3481501 100644 --- a/audio/audio_hw.h +++ b/audio/audio_hw.h @@ -237,6 +237,13 @@ struct route_setting bt_input[] = { { .ctl_name = NULL, }, }; +struct route_setting bt_input_disable[] = { + { .ctl_name = "AIF2ADC Mux", .intval = 0, }, + { .ctl_name = "AIF1ADC1R Mixer AIF2 Switch", .intval = 0, }, + { .ctl_name = "AIF1ADC1L Mixer AIF2 Switch", .intval = 0, }, + { .ctl_name = NULL, }, +}; + struct route_setting bt_disable[] = { { .ctl_name = "AIF1DAC1 Volume", .intval = 96, }, { .ctl_name = "AIF1 Boost Volume", .intval = 0, }, -- cgit v1.1 From bcdf1703920397f7af1a8b1bc164ea4450cf2c2f Mon Sep 17 00:00:00 2001 From: MarcKe Date: Thu, 29 Jan 2015 20:50:09 +0100 Subject: audio: fix mute when switching devices --- audio/audio_hw.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/audio/audio_hw.c b/audio/audio_hw.c index 5335d7d..16013ef 100644 --- a/audio/audio_hw.c +++ b/audio/audio_hw.c @@ -693,6 +693,9 @@ static void select_output_device(struct m0_audio_device *adev) ALOGD("%s: set voicecall route: bt_disable", __func__); set_bigroute_by_array(adev->mixer, bt_disable, 1); } + // this is needed to mute the current device when output devices are switched, but mute is set + adev->hw_device.set_mic_mute(&adev->hw_device, adev->mic_mute); + set_incall_device(adev); } } -- cgit v1.1 From 92f336d3360900376176bb22930e59c973a70010 Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Wed, 11 Feb 2015 01:46:48 +0530 Subject: n7100: Enable Stylus gestures --- overlay/frameworks/base/core/res/res/values/config.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/overlay/frameworks/base/core/res/res/values/config.xml b/overlay/frameworks/base/core/res/res/values/config.xml index df2e599..d8d3ade 100644 --- a/overlay/frameworks/base/core/res/res/values/config.xml +++ b/overlay/frameworks/base/core/res/res/values/config.xml @@ -251,8 +251,8 @@ true - + + true com.android.systemui/com.android.systemui.doze.DozeService -- cgit v1.1 From d47ea654edb1246cd767588659055c6714200440 Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Wed, 11 Feb 2015 01:49:23 +0530 Subject: n7100: Enable Wifi display --- overlay/frameworks/base/core/res/res/values/config.xml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/overlay/frameworks/base/core/res/res/values/config.xml b/overlay/frameworks/base/core/res/res/values/config.xml index d8d3ade..65e1896 100644 --- a/overlay/frameworks/base/core/res/res/values/config.xml +++ b/overlay/frameworks/base/core/res/res/values/config.xml @@ -265,4 +265,18 @@ true + + + true -- cgit v1.1 From e89aa59f47994f6bfd3c270470f4eee281896fde Mon Sep 17 00:00:00 2001 From: Dheeraj CVR Date: Wed, 21 Jan 2015 19:36:31 +0530 Subject: sound: remove absent AIF1ADC2L mixer controls AIF1ADC2L mixer controls are no longer present on the newer kernel. Remove them to prevent failure errors. Change-Id: I163a3ca105f048a4aea06817bde794c8721cbfcf --- configs/tiny_hw.xml | 3 --- 1 file changed, 3 deletions(-) diff --git a/configs/tiny_hw.xml b/configs/tiny_hw.xml index 57129c9..03c613c 100644 --- a/configs/tiny_hw.xml +++ b/configs/tiny_hw.xml @@ -266,7 +266,6 @@ We are able to have most of our routing static so do that - @@ -307,8 +306,6 @@ We are able to have most of our routing static so do that - - -- cgit v1.1 From a0ae6e1f8928dd155e7764bbe128b9af0dd2092d Mon Sep 17 00:00:00 2001 From: Dheeraj CVR Date: Wed, 21 Jan 2015 19:04:31 +0530 Subject: libsensors: fix sensors enable and disable * "//Accel sensor is first on and last off" This is totally wrong. The since we are using a single sysfs path to enable and disable all of the sensors, the kernel driver uses bitwise operations on the input value to know which sensors should be enabled. The current logic wrongly assumes that the sensors are enabled and disabled in a specific order and if accelerometer was disabled, all of the other sensors were being disabled too. This caused inconsistent sensor states between the sensor HAL and the kernel driver and most of the time, the sensors failed to work properly and drained battery. Simplify the code to use bitwise operations instead of arithematic operations to keep things clean. Additionally, since two or more sensors can be enabled or disabled at the same time, we use a lock to prevent race conditions. Change-Id: Ifc3fab1456d4061f58d52f2ecda822c6157aae6e --- libsensors/SensorBase.cpp | 40 ++++++++++++++++------------------------ 1 file changed, 16 insertions(+), 24 deletions(-) diff --git a/libsensors/SensorBase.cpp b/libsensors/SensorBase.cpp index 9c27184..1a25c96 100644 --- a/libsensors/SensorBase.cpp +++ b/libsensors/SensorBase.cpp @@ -21,6 +21,7 @@ #include #include #include +#include #include @@ -30,6 +31,8 @@ /*****************************************************************************/ +static pthread_mutex_t sspEnableLock = PTHREAD_MUTEX_INITIALIZER; + SensorBase::SensorBase( const char* dev_name, const char* data_name) @@ -141,34 +144,23 @@ int SensorBase::flush(int handle) int SensorBase::sspEnable(const char* sensorname, int sensorvalue, int en) { FILE* sspfile; - int oldvalue = 0; - int reset = 0; - int newvalue; - int fd; + int sspValue = 0; + + pthread_mutex_lock(&sspEnableLock); sspfile = fopen(SSP_DEVICE_ENABLE, "r+"); - fscanf(sspfile, "%d", &oldvalue); + fscanf(sspfile, "%d", &sspValue); fclose(sspfile); -//Accel sensor is first on and last off, if we are disabling it -// assume the screen is off, disable all sensors and zero everything out -// to keep enable file in sync. - if(sensorvalue == SSP_ACCEL && !en) { - //ALOGD("SensorBase: Resetting sensors"); - for(int i; i < 6; i++){ - newvalue = oldvalue - ssp_sensors[i]; - //ALOGD("SensorBase: newvalue: %i ",newvalue); - sspWrite(newvalue); - } - sspWrite('\0'); - return 0; - } else if(en) { - newvalue = oldvalue + sensorvalue; - } else { - newvalue = oldvalue - sensorvalue; - } - //ALOGI("%s: name: %s sensor: %i old value: %i new value: %i ", __func__, sensorname, sensorvalue, oldvalue, newvalue); - sspWrite(newvalue); + if (en) + sspValue |= sensorvalue; + else + sspValue &= ~sensorvalue; + + sspWrite(sspValue); + + pthread_mutex_unlock(&sspEnableLock); + return 0; } -- cgit v1.1 From c32a58cd0b45369fe76b0282819a68f83ffa2cf8 Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Sun, 22 Feb 2015 09:02:21 +0530 Subject: added dreams overlay --- overlay/frameworks/base/core/res/res/values/config.xml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/overlay/frameworks/base/core/res/res/values/config.xml b/overlay/frameworks/base/core/res/res/values/config.xml index 65e1896..bd4d36e 100644 --- a/overlay/frameworks/base/core/res/res/values/config.xml +++ b/overlay/frameworks/base/core/res/res/values/config.xml @@ -107,7 +107,7 @@ 0 @@ -279,4 +279,16 @@ * The device must be provisioned with HDCP keys (for protected content). --> true + + + true + + + false -- cgit v1.1 From c18273331470f65c3eb98289e1d2defdaebafbc3 Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Tue, 24 Feb 2015 00:58:35 +0530 Subject: N7100: Accelerometer for Ambient Display --- overlay/frameworks/base/core/res/res/values/config.xml | 2 ++ overlay/frameworks/base/packages/SystemUI/res/values/config.xml | 3 +++ 2 files changed, 5 insertions(+) diff --git a/overlay/frameworks/base/core/res/res/values/config.xml b/overlay/frameworks/base/core/res/res/values/config.xml index bd4d36e..3566767 100644 --- a/overlay/frameworks/base/core/res/res/values/config.xml +++ b/overlay/frameworks/base/core/res/res/values/config.xml @@ -259,6 +259,8 @@ 20 true true + + true 4 diff --git a/overlay/frameworks/base/packages/SystemUI/res/values/config.xml b/overlay/frameworks/base/packages/SystemUI/res/values/config.xml index 49b1c81..31e7533 100644 --- a/overlay/frameworks/base/packages/SystemUI/res/values/config.xml +++ b/overlay/frameworks/base/packages/SystemUI/res/values/config.xml @@ -28,5 +28,8 @@ true + + + 5 -- cgit v1.1 From 587184388277e05abc3f3da5c62693ee00ed62cd Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Tue, 24 Feb 2015 01:27:52 +0530 Subject: Enable tethering credits to DimitriMayakovsky --- n7100.mk | 3 +++ 1 file changed, 3 insertions(+) diff --git a/n7100.mk b/n7100.mk index d5bd417..814f253 100644 --- a/n7100.mk +++ b/n7100.mk @@ -103,5 +103,8 @@ PRODUCT_COPY_FILES += \ frameworks/native/data/etc/handheld_core_hardware.xml:system/etc/permissions/handheld_core_hardware.xml \ frameworks/native/data/etc/android.hardware.telephony.gsm.xml:system/etc/permissions/android.hardware.telephony.gsm.xml +# Allow tethering without provisioning app +PRODUCT_PROPERTY_OVERRIDES += \ + net.tethering.noprovisioning=true $(call inherit-product-if-exists, vendor/samsung/n7100/n7100-vendor.mk) -- cgit v1.1 From 83df8d9098c290507f1e59e9c7d342327651bf71 Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Wed, 25 Feb 2015 10:00:47 +0530 Subject: Revert "audio: fix incall mute" This reverts commit 1c3ccd1cbf98430dc091240fe1aa494a51908980. --- audio/audio_hw.c | 42 ------------------------------------------ audio/audio_hw.h | 7 ------- 2 files changed, 49 deletions(-) diff --git a/audio/audio_hw.c b/audio/audio_hw.c index 16013ef..d728776 100644 --- a/audio/audio_hw.c +++ b/audio/audio_hw.c @@ -2606,52 +2606,10 @@ static int adev_set_mode(struct audio_hw_device *dev, audio_mode_t mode) static int adev_set_mic_mute(struct audio_hw_device *dev, bool state) { - int headset_on; - int headphone_on; - int speaker_on; - int earpiece_on; - int bt_on; - struct m0_audio_device *adev = (struct m0_audio_device *)dev; - headset_on = adev->out_device & AUDIO_DEVICE_OUT_WIRED_HEADSET; - headphone_on = adev->out_device & AUDIO_DEVICE_OUT_WIRED_HEADPHONE; - speaker_on = adev->out_device & AUDIO_DEVICE_OUT_SPEAKER; - earpiece_on = adev->out_device & AUDIO_DEVICE_OUT_EARPIECE; - bt_on = adev->out_device & AUDIO_DEVICE_OUT_ALL_SCO; - adev->mic_mute = state; - if (adev->mode == AUDIO_MODE_IN_CALL) { - if (state) { - if (speaker_on || earpiece_on || headphone_on) { - ALOGD("%s: set voicecall route: default_input_disable", __func__); - set_bigroute_by_array(adev->mixer, default_input_disable, 1); - } - if (headset_on) { - ALOGD("%s: set voicecall route: headset_input_disable", __func__); - set_bigroute_by_array(adev->mixer, headset_input_disable, 1); - } - if (bt_on) { - ALOGD("%s: set voicecall route: bt_input_disable", __func__); - set_bigroute_by_array(adev->mixer, bt_input_disable, 1); - } - } else { - if (speaker_on || earpiece_on || headphone_on) { - ALOGD("%s: set voicecall route: default_input", __func__); - set_bigroute_by_array(adev->mixer, default_input, 1); - } - if (headset_on) { - ALOGD("%s: set voicecall route: headset_input", __func__); - set_bigroute_by_array(adev->mixer, headset_input, 1); - } - if (bt_on) { - ALOGD("%s: set voicecall route: bt_input", __func__); - set_bigroute_by_array(adev->mixer, bt_input, 1); - } - } - } - return 0; } diff --git a/audio/audio_hw.h b/audio/audio_hw.h index 3481501..5ba0e9e 100644 --- a/audio/audio_hw.h +++ b/audio/audio_hw.h @@ -237,13 +237,6 @@ struct route_setting bt_input[] = { { .ctl_name = NULL, }, }; -struct route_setting bt_input_disable[] = { - { .ctl_name = "AIF2ADC Mux", .intval = 0, }, - { .ctl_name = "AIF1ADC1R Mixer AIF2 Switch", .intval = 0, }, - { .ctl_name = "AIF1ADC1L Mixer AIF2 Switch", .intval = 0, }, - { .ctl_name = NULL, }, -}; - struct route_setting bt_disable[] = { { .ctl_name = "AIF1DAC1 Volume", .intval = 96, }, { .ctl_name = "AIF1 Boost Volume", .intval = 0, }, -- cgit v1.1 From c7697ed05b3115d2e2c490e411fea59cd0df5717 Mon Sep 17 00:00:00 2001 From: Dheeraj CVR Date: Wed, 11 Feb 2015 10:52:07 +0530 Subject: audio: forward call mute to RIL client interface Change-Id: Iccb763b48a687b88692c84976a7cddf72031b5be --- audio/audio_hw.c | 3 +++ audio/ril_interface.c | 14 ++++++++++++-- audio/ril_interface.h | 6 ++++++ 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/audio/audio_hw.c b/audio/audio_hw.c index d728776..d53cd94 100644 --- a/audio/audio_hw.c +++ b/audio/audio_hw.c @@ -2608,6 +2608,9 @@ static int adev_set_mic_mute(struct audio_hw_device *dev, bool state) { struct m0_audio_device *adev = (struct m0_audio_device *)dev; + if (adev->mode == AUDIO_MODE_IN_CALL) + ril_set_mic_mute(&adev->ril, state); + adev->mic_mute = state; return 0; diff --git a/audio/ril_interface.c b/audio/ril_interface.c index a77efc0..493e438 100644 --- a/audio/ril_interface.c +++ b/audio/ril_interface.c @@ -38,6 +38,7 @@ int (*_ril_set_call_volume)(void *, enum ril_sound_type, int); int (*_ril_set_call_audio_path)(void *, enum ril_audio_path); int (*_ril_set_call_clock_sync)(void *, enum ril_clock_state); int (*_ril_set_two_mic_control)(void *, enum ril_two_mic_device, enum ril_two_mic_state); +int (*_ril_set_mic_mute)(void *, enum ril_mic_mute); int (*_ril_register_unsolicited_handler)(void *, int, void *); int (*_ril_get_wb_amr)(void *, void *); @@ -108,6 +109,7 @@ int ril_open(struct ril_handle *ril) _ril_set_call_audio_path = dlsym(ril->handle, "SetCallAudioPath"); _ril_set_call_clock_sync = dlsym(ril->handle, "SetCallClockSync"); _ril_set_two_mic_control = dlsym(ril->handle, "SetTwoMicControl"); + _ril_set_mic_mute = dlsym(ril->handle, "SetMute"); _ril_register_unsolicited_handler = dlsym(ril->handle, "RegisterUnsolicitedHandler"); /* since this function is not supported in all RILs, don't require it */ @@ -115,8 +117,8 @@ int ril_open(struct ril_handle *ril) if (!_ril_open_client || !_ril_close_client || !_ril_connect || !_ril_is_connected || !_ril_disconnect || !_ril_set_call_volume || - !_ril_set_call_audio_path || !_ril_set_two_mic_control || !_ril_set_call_clock_sync || - !_ril_register_unsolicited_handler) { + !_ril_set_call_audio_path || !_ril_set_two_mic_control || !_ril_set_mic_mute || + !_ril_set_call_clock_sync || !_ril_register_unsolicited_handler) { ALOGE("Cannot get symbols from '%s'", RIL_CLIENT_LIBPATH); dlclose(ril->handle); return -1; @@ -191,3 +193,11 @@ int ril_set_two_mic_control(struct ril_handle *ril, enum ril_two_mic_device devi return _ril_set_two_mic_control(ril->client, device, state); } + +int ril_set_mic_mute(struct ril_handle *ril, enum ril_mic_mute state) +{ + if (ril_connect_if_required(ril)) + return 0; + + return _ril_set_mic_mute(ril->client, state); +} diff --git a/audio/ril_interface.h b/audio/ril_interface.h index 4b401aa..7d4b87e 100644 --- a/audio/ril_interface.h +++ b/audio/ril_interface.h @@ -70,6 +70,11 @@ enum ril_two_mic_state { TWO_MIC_SOLUTION_ON }; +enum ril_mic_mute { + MIC_UNMUTE, + MIC_MUTE +}; + /* Function prototypes */ int ril_open(struct ril_handle *ril); int ril_close(struct ril_handle *ril); @@ -79,5 +84,6 @@ int ril_set_call_audio_path(struct ril_handle *ril, enum ril_audio_path path); int ril_set_call_clock_sync(struct ril_handle *ril, enum ril_clock_state state); void ril_register_set_wb_amr_callback(void *function, void *data); int ril_set_two_mic_control(struct ril_handle *ril, enum ril_two_mic_device device, enum ril_two_mic_state state); +int ril_set_mic_mute(struct ril_handle *ril, enum ril_mic_mute state); #endif -- cgit v1.1 From fa76e7793077fb0353b700bdd53773da8736c7d3 Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Mon, 2 Mar 2015 20:32:58 +0530 Subject: Enable USB-OTG credits to DimitriMayakovsky --- n7100.mk | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/n7100.mk b/n7100.mk index 814f253..38159a8 100644 --- a/n7100.mk +++ b/n7100.mk @@ -107,4 +107,8 @@ PRODUCT_COPY_FILES += \ PRODUCT_PROPERTY_OVERRIDES += \ net.tethering.noprovisioning=true +# USB-OTG +PRODUCT_PROPERTY_OVERRIDES += \ + persist.sys.isUsbOtgEnabled=true + $(call inherit-product-if-exists, vendor/samsung/n7100/n7100-vendor.mk) -- cgit v1.1 From 3dceb55d96345d18de89adea68d5c4add4cf8f92 Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Tue, 10 Mar 2015 20:34:58 +0530 Subject: App2SD 2/2 credits to Ivanmeler --- rootdir/fstab.smdk4x12 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rootdir/fstab.smdk4x12 b/rootdir/fstab.smdk4x12 index 4732091..286d93c 100644 --- a/rootdir/fstab.smdk4x12 +++ b/rootdir/fstab.smdk4x12 @@ -10,7 +10,7 @@ /dev/block/mmcblk0p14 /preload ext4 noatime,nosuid,nodev,journal_async_commit wait /dev/block/mmcblk0p16 /data ext4 noatime,nosuid,nodev,discard,noauto_da_alloc,journal_async_commit,errors=panic wait,check,encryptable=footer -/devices/platform/s3c-sdhci.2/mmc_host/mmc1* auto auto defaults voldmanaged=sdcard1:auto +/devices/platform/s3c-sdhci.2/mmc_host/mmc1* auto auto defaults voldmanaged=sdcard1:auto,noemulatedsd /devices/platform/s5p-ehci* auto auto defaults voldmanaged=usbdisk0:auto # recovery -- cgit v1.1 From 9a3be307eccf1b4ae7537125d0eab042224d9f0b Mon Sep 17 00:00:00 2001 From: KNIGHT97 Date: Tue, 3 Mar 2015 23:45:37 +0530 Subject: Config : GPS : update GPS server --- configs/gps.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configs/gps.xml b/configs/gps.xml index d482215..9107daf 100644 --- a/configs/gps.xml +++ b/configs/gps.xml @@ -34,7 +34,7 @@ LbsEnable="true" LbsLocal="false" - LbsServer="BCMLS2.glpals.com" + LbsServer="gllto.glpals.com/7day/glo/v2/latest/" LbsPort="7275" LbsSyncLto="false" SyncLto="true" @@ -68,4 +68,4 @@ EnableLowPowerPmm="true" /> - + \ No newline at end of file -- cgit v1.1 From 48b260027406ede6168bd343611975ff1803e0fd Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Wed, 22 Apr 2015 11:54:45 +0530 Subject: Revert "Config : GPS : update GPS server" This reverts commit 9a3be307eccf1b4ae7537125d0eab042224d9f0b. --- configs/gps.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configs/gps.xml b/configs/gps.xml index 9107daf..d482215 100644 --- a/configs/gps.xml +++ b/configs/gps.xml @@ -34,7 +34,7 @@ LbsEnable="true" LbsLocal="false" - LbsServer="gllto.glpals.com/7day/glo/v2/latest/" + LbsServer="BCMLS2.glpals.com" LbsPort="7275" LbsSyncLto="false" SyncLto="true" @@ -68,4 +68,4 @@ EnableLowPowerPmm="true" /> - \ No newline at end of file + -- cgit v1.1 From 04a5b0151821db228aaf7d9530b0dc0037378b25 Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Wed, 6 May 2015 11:05:19 +0530 Subject: add doze_enabled option to device config --- overlay/frameworks/base/core/res/res/values/config.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/overlay/frameworks/base/core/res/res/values/config.xml b/overlay/frameworks/base/core/res/res/values/config.xml index 3566767..48f3b89 100644 --- a/overlay/frameworks/base/core/res/res/values/config.xml +++ b/overlay/frameworks/base/core/res/res/values/config.xml @@ -261,6 +261,8 @@ true true + + true 4 -- cgit v1.1 From 2a0a108ef3bc7bb4f941b850d7b6d75052e8344b Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Sat, 20 Jun 2015 11:51:48 +0530 Subject: n7100: update dependencies --- pa.dependencies | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/pa.dependencies b/pa.dependencies index 465bc59..d79b58f 100644 --- a/pa.dependencies +++ b/pa.dependencies @@ -1,34 +1,32 @@ [ { - "repository": "android_device_samsung_n7100", - "target_path": "device/samsung/n7100" - }, - { "remote": "github", "repository": "tilaksidduram/android_device_samsung_smdk4412-common", "target_path": "device/samsung/smdk4412-common", - "revision": "lollipop" + "revision": "lollipop-mr1" }, { - "repository": "android_kernel_samsung_smdk4412", - "target_path": "kernel/samsung/smdk4412" + "remote": "github", + "repository": "AOSPA-L/android_kernel_samsung_smdk4412", + "target_path": "kernel/samsung/smdk4412", + "revision": "lollipop-mr1" }, { - "remote": "cm", + "remote": "github", "repository": "CyanogenMod/android_packages_apps_SamsungServiceMode", "target_path": "packages/apps/SamsungServiceMode", - "revision": "cm-12.0" + "revision": "cm-12.1" }, { "remote": "github", "repository": "tilaksidduram/android_hardware_samsung", "target_path": "hardware/samsung", - "revision": "cm-12.0" + "revision": "lollipop-mr1" }, { "remote": "github", - "repository": "TheMuppets/proprietary_vendor_samsung", + "repository": "CrazyWeasel/proprietary_vendor_samsung", "target_path": "vendor/samsung", - "revision": "cm-12.0" + "revision": "n-2.1" } ] -- cgit v1.1 From f17f21c24d322577d99064f8904cfeaee2888097 Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Mon, 11 May 2015 23:30:47 +0530 Subject: added accelerometer overlay --- overlay/frameworks/base/core/res/res/values/config.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/overlay/frameworks/base/core/res/res/values/config.xml b/overlay/frameworks/base/core/res/res/values/config.xml index 48f3b89..4dbefd7 100644 --- a/overlay/frameworks/base/core/res/res/values/config.xml +++ b/overlay/frameworks/base/core/res/res/values/config.xml @@ -295,4 +295,7 @@ false + + + true -- cgit v1.1 From 8b75f1c2d979dc4772e94020dc80de00563ef3a1 Mon Sep 17 00:00:00 2001 From: Utkarsh Gupta Date: Fri, 1 May 2015 00:00:00 +0000 Subject: Update gps.h --- include/hardware/gps.h | 45 ++++++++++++++++++++++++++++++++++++++------- 1 file changed, 38 insertions(+), 7 deletions(-) diff --git a/include/hardware/gps.h b/include/hardware/gps.h index b70da93..ff24016 100644 --- a/include/hardware/gps.h +++ b/include/hardware/gps.h @@ -334,6 +334,12 @@ typedef uint8_t GpsMultipathIndicator; /** * Flags indicating the GPS measurement state. + * The expected behavior here is for GPS HAL to set all the flags that applies. For + * example, if the state for a satellite is only C/A code locked and bit synchronized, + * and there is still millisecond ambiguity, the state should be set as: + * GPS_MEASUREMENT_STATE_CODE_LOCK|GPS_MEASUREMENT_STATE_BIT_SYNC|GPS_MEASUREMENT_STATE_MSEC_AMBIGUOUS + * If GPS is still searching for a satellite, the corresponding state should be set to + * GPS_MEASUREMENT_STATE_UNKNOWN(0). */ typedef uint16_t GpsMeasurementState; #define GPS_MEASUREMENT_STATE_UNKNOWN 0 @@ -341,6 +347,7 @@ typedef uint16_t GpsMeasurementState; #define GPS_MEASUREMENT_STATE_BIT_SYNC (1<<1) #define GPS_MEASUREMENT_STATE_SUBFRAME_SYNC (1<<2) #define GPS_MEASUREMENT_STATE_TOW_DECODED (1<<3) +#define GPS_MEASUREMENT_STATE_MSEC_AMBIGUOUS (1<<4) /** * Flags indicating the Accumulated Delta Range's states. @@ -352,7 +359,7 @@ typedef uint16_t GpsAccumulatedDeltaRangeState; #define GPS_ADR_STATE_CYCLE_SLIP (1<<2) /** - * Enumeration of available values to indicate the available GPS Natigation message types. + * Enumeration of available values to indicate the available GPS Navigation message types. */ typedef uint8_t GpsNavigationMessageType; /** The message type is unknown. */ @@ -366,6 +373,19 @@ typedef uint8_t GpsNavigationMessageType; /** CNAV-2 message contained in the structure. */ #define GPS_NAVIGATION_MESSAGE_TYPE_CNAV2 4 +/** + * Status of Navigation Message + * When a message is received properly without any parity error in its navigation words, the + * status should be set to NAV_MESSAGE_STATUS_PARITY_PASSED. But if a message is received + * with words that failed parity check, but GPS is able to correct those words, the status + * should be set to NAV_MESSAGE_STATUS_PARITY_REBUILT. + * No need to send any navigation message that contains words with parity error and cannot be + * corrected. + */ +typedef uint16_t NavigationMessageStatus; +#define NAV_MESSAGE_STATUS_UNKONW 0 +#define NAV_MESSAGE_STATUS_PARITY_PASSED (1<<0) +#define NAV_MESSAGE_STATUS_PARITY_REBUILT (1<<1) /** * Name for the GPS XTRA interface. @@ -1415,12 +1435,16 @@ typedef struct { * Received GPS Time-of-Week at the measurement time, in nanoseconds. * The value is relative to the beginning of the current GPS week. * - * Given the sync state of GPS receiver, per each satellite, valid range for this field can be: - * Searching : [ 0 ] : GPS_MEASUREMENT_STATE_UNKNOWN - * Ranging code lock : [ 0 1ms ] : GPS_MEASUREMENT_STATE_CODE_LOCK is set - * Bit sync : [ 0 20ms ] : GPS_MEASUREMENT_STATE_BIT_SYNC is set - * Subframe sync : [ 0 6ms ] : GPS_MEASUREMENT_STATE_SUBFRAME_SYNC is set - * TOW decoded : [ 0 1week ] : GPS_MEASUREMENT_STATE_TOW_DECODED is set + * Given the highest sync state that can be achieved, per each satellite, valid range for + * this field can be: + * Searching : [ 0 ] : GPS_MEASUREMENT_STATE_UNKNOWN + * C/A code lock : [ 0 1ms ] : GPS_MEASUREMENT_STATE_CODE_LOCK is set + * Bit sync : [ 0 20ms ] : GPS_MEASUREMENT_STATE_BIT_SYNC is set + * Subframe sync : [ 0 6s ] : GPS_MEASUREMENT_STATE_SUBFRAME_SYNC is set + * TOW decoded : [ 0 1week ] : GPS_MEASUREMENT_STATE_TOW_DECODED is set + * + * However, if there is any ambiguity in integer millisecond, + * GPS_MEASUREMENT_STATE_MSEC_AMBIGUOUS should be set accordingly, in the 'state' field. */ int64_t received_gps_tow_ns; @@ -1710,6 +1734,13 @@ typedef struct { GpsNavigationMessageType type; /** + * The status of the received navigation message. + * No need to send any navigation message that contains words with parity error and cannot be + * corrected. + */ + NavigationMessageStatus status; + + /** * Message identifier. * It provides an index so the complete Navigation Message can be assembled. i.e. fo L1 C/A * subframe 4 and 5, this value corresponds to the 'frame id' of the navigation message. -- cgit v1.1 From fe82fa6be7b74762da37a069fdde15a55e616c42 Mon Sep 17 00:00:00 2001 From: Utkarsh Gupta Date: Fri, 1 May 2015 00:00:00 +0000 Subject: ril: update ril header to v11 --- include/telephony/ril.h | 948 +++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 929 insertions(+), 19 deletions(-) diff --git a/include/telephony/ril.h b/include/telephony/ril.h index 572aa46..5514977 100644 --- a/include/telephony/ril.h +++ b/include/telephony/ril.h @@ -20,6 +20,9 @@ #include #include #include +#include +#include + #ifndef FEATURE_UNIT_TEST #include #endif /* !FEATURE_UNIT_TEST */ @@ -28,19 +31,53 @@ extern "C" { #endif -#define RIL_VERSION 9 /* Current version */ -#ifdef LEGACY_RIL -#define RIL_VERSION_MIN 2 /* Minimum RIL_VERSION supported */ + +#if defined(ANDROID_SIM_COUNT_2) +#define SIM_COUNT 2 +#elif defined(ANDROID_SIM_COUNT_3) +#define SIM_COUNT 3 +#elif defined(ANDROID_SIM_COUNT_4) +#define SIM_COUNT 4 #else -#define RIL_VERSION_MIN 6 /* Minimum RIL_VERSION supported */ +#define SIM_COUNT 1 #endif +#ifndef ANDROID_MULTI_SIM +#define SIM_COUNT 1 +#endif + +#define RIL_VERSION 11 /* Current version */ +#define RIL_VERSION_MIN 6 /* Minimum RIL_VERSION supported */ + #define CDMA_ALPHA_INFO_BUFFER_LENGTH 64 #define CDMA_NUMBER_INFO_BUFFER_LENGTH 81 +#define MAX_RILDS 3 +#define MAX_SOCKET_NAME_LENGTH 6 +#define MAX_CLIENT_ID_LENGTH 2 +#define MAX_DEBUG_SOCKET_NAME_LENGTH 12 +#define MAX_QEMU_PIPE_NAME_LENGTH 11 +#define MAX_UUID_LENGTH 64 + + typedef void * RIL_Token; typedef enum { + RIL_SOCKET_1, +#if (SIM_COUNT >= 2) + RIL_SOCKET_2, +#if (SIM_COUNT >= 3) + RIL_SOCKET_3, +#endif +#if (SIM_COUNT >= 4) + RIL_SOCKET_4, +#endif +#endif + RIL_SOCKET_NUM +} RIL_SOCKET_ID; + + +typedef enum { RIL_E_SUCCESS = 0, RIL_E_RADIO_NOT_AVAILABLE = 1, /* If radio did not start or is resetting */ RIL_E_GENERIC_FAILURE = 2, @@ -61,8 +98,24 @@ typedef enum { location */ RIL_E_MODE_NOT_SUPPORTED = 13, /* HW does not support preferred network type */ RIL_E_FDN_CHECK_FAILURE = 14, /* command failed because recipient is not on FDN list */ - RIL_E_ILLEGAL_SIM_OR_ME = 15 /* network selection failed due to + RIL_E_ILLEGAL_SIM_OR_ME = 15, /* network selection failed due to illegal SIM or ME */ + RIL_E_MISSING_RESOURCE = 16, /* no logical channel available */ + RIL_E_NO_SUCH_ELEMENT = 17, /* application not found on SIM */ + RIL_E_DIAL_MODIFIED_TO_USSD = 18, /* DIAL request modified to USSD */ + RIL_E_DIAL_MODIFIED_TO_SS = 19, /* DIAL request modified to SS */ + RIL_E_DIAL_MODIFIED_TO_DIAL = 20, /* DIAL request modified to DIAL with different + data */ + RIL_E_USSD_MODIFIED_TO_DIAL = 21, /* USSD request modified to DIAL */ + RIL_E_USSD_MODIFIED_TO_SS = 22, /* USSD request modified to SS */ + RIL_E_USSD_MODIFIED_TO_USSD = 23, /* USSD request modified to different USSD + request */ + RIL_E_SS_MODIFIED_TO_DIAL = 24, /* SS request modified to DIAL */ + RIL_E_SS_MODIFIED_TO_USSD = 25, /* SS request modified to USSD */ + RIL_E_SUBSCRIPTION_NOT_SUPPORTED = 26, /* Subscription not supported by RIL */ + RIL_E_SS_MODIFIED_TO_SS = 27 /* SS request modified to different SS request */ + + } RIL_Errno; typedef enum { @@ -109,9 +162,65 @@ typedef enum { RADIO_TECH_LTE = 14, RADIO_TECH_HSPAP = 15, // HSPA+ RADIO_TECH_GSM = 16, // Only supports voice - RADIO_TECH_DCHSPAP = 30 + RADIO_TECH_TD_SCDMA = 17 } RIL_RadioTechnology; +typedef enum { + RAF_UNKNOWN = (1 << RADIO_TECH_UNKNOWN), + RAF_GPRS = (1 << RADIO_TECH_GPRS), + RAF_EDGE = (1 << RADIO_TECH_EDGE), + RAF_UMTS = (1 << RADIO_TECH_UMTS), + RAF_IS95A = (1 << RADIO_TECH_IS95A), + RAF_IS95B = (1 << RADIO_TECH_IS95B), + RAF_1xRTT = (1 << RADIO_TECH_1xRTT), + RAF_EVDO_0 = (1 << RADIO_TECH_EVDO_0), + RAF_EVDO_A = (1 << RADIO_TECH_EVDO_A), + RAF_HSDPA = (1 << RADIO_TECH_HSDPA), + RAF_HSUPA = (1 << RADIO_TECH_HSUPA), + RAF_HSPA = (1 << RADIO_TECH_HSPA), + RAF_EVDO_B = (1 << RADIO_TECH_EVDO_B), + RAF_EHRPD = (1 << RADIO_TECH_EHRPD), + RAF_LTE = (1 << RADIO_TECH_LTE), + RAF_HSPAP = (1 << RADIO_TECH_HSPAP), + RAF_GSM = (1 << RADIO_TECH_GSM), + RAF_TD_SCDMA = (1 << RADIO_TECH_TD_SCDMA), +} RIL_RadioAccessFamily; + +typedef enum { + RC_PHASE_CONFIGURED = 0, // LM is configured is initial value and value after FINISH completes + RC_PHASE_START = 1, // START is sent before Apply and indicates that an APPLY will be + // forthcoming with these same parameters + RC_PHASE_APPLY = 2, // APPLY is sent after all LM's receive START and returned + // RIL_RadioCapability.status = 0, if any START's fail no + // APPLY will be sent + RC_PHASE_UNSOL_RSP = 3, // UNSOL_RSP is sent with RIL_UNSOL_RADIO_CAPABILITY + RC_PHASE_FINISH = 4 // FINISH is sent after all commands have completed. If an error + // occurs in any previous command the RIL_RadioAccessesFamily and + // logicalModemUuid fields will be the prior configuration thus + // restoring the configuration to the previous value. An error + // returned by this command will generally be ignored or may + // cause that logical modem to be removed from service. +} RadioCapabilityPhase; + +typedef enum { + RC_STATUS_NONE = 0, // This parameter has no meaning with RC_PHASE_START, + // RC_PHASE_APPLY + RC_STATUS_SUCCESS = 1, // Tell modem the action transaction of set radio + // capability was success with RC_PHASE_FINISH + RC_STATUS_FAIL = 2, // Tell modem the action transaction of set radio + // capability is fail with RC_PHASE_FINISH. +} RadioCapabilityStatus; + +#define RIL_RADIO_CAPABILITY_VERSION 1 +typedef struct { + int version; // Version of structure, RIL_RADIO_CAPABILITY_VERSION + int session; // Unique session value defined by framework returned in all "responses/unsol" + int phase; // CONFIGURED, START, APPLY, FINISH + int rat; // RIL_RadioAccessFamily for the radio + char logicalModemUuid[MAX_UUID_LENGTH]; // A UUID typically "com.xxxx.lmX where X is the logical modem. + int status; // Return status and an input parameter for RC_PHASE_FINISH +} RIL_RadioCapability; + // Do we want to split Data from Voice and the use // RIL_RadioTechnology for get/setPreferredVoice/Data ? typedef enum { @@ -210,7 +319,6 @@ typedef struct { */ typedef struct { int status; /* A RIL_DataCallFailCause, 0 which is PDP_FAIL_NONE if no error */ -#ifndef HCRADIO int suggestedRetryTime; /* If status != 0, this fields indicates the suggested retry back-off timer value RIL wants to override the one pre-configured in FW. @@ -218,7 +326,6 @@ typedef struct { The value < 0 means no value is suggested. The value 0 means retry should be done ASAP. The value of INT_MAX(0x7fffffff) means no retry. */ -#endif int cid; /* Context ID, uniquely identifies this call */ int active; /* 0=inactive, 1=active/physical link down, 2=active/physical link up */ char * type; /* One of the PDP_type values in TS 27.007 section 10.1.1. @@ -241,6 +348,75 @@ typedef struct { to point connections. */ } RIL_Data_Call_Response_v6; +typedef struct { + int status; /* A RIL_DataCallFailCause, 0 which is PDP_FAIL_NONE if no error */ + int suggestedRetryTime; /* If status != 0, this fields indicates the suggested retry + back-off timer value RIL wants to override the one + pre-configured in FW. + The unit is miliseconds. + The value < 0 means no value is suggested. + The value 0 means retry should be done ASAP. + The value of INT_MAX(0x7fffffff) means no retry. */ + int cid; /* Context ID, uniquely identifies this call */ + int active; /* 0=inactive, 1=active/physical link down, 2=active/physical link up */ + char * type; /* One of the PDP_type values in TS 27.007 section 10.1.1. + For example, "IP", "IPV6", "IPV4V6", or "PPP". If status is + PDP_FAIL_ONLY_SINGLE_BEARER_ALLOWED this is the type supported + such as "IP" or "IPV6" */ + char * ifname; /* The network interface name */ + char * addresses; /* A space-delimited list of addresses with optional "/" prefix length, + e.g., "192.0.1.3" or "192.0.1.11/16 2001:db8::1/64". + May not be empty, typically 1 IPv4 or 1 IPv6 or + one of each. If the prefix length is absent the addresses + are assumed to be point to point with IPv4 having a prefix + length of 32 and IPv6 128. */ + char * dnses; /* A space-delimited list of DNS server addresses, + e.g., "192.0.1.3" or "192.0.1.11 2001:db8::1". + May be empty. */ + char * gateways; /* A space-delimited list of default gateway addresses, + e.g., "192.0.1.3" or "192.0.1.11 2001:db8::1". + May be empty in which case the addresses represent point + to point connections. */ + char * pcscf; /* the Proxy Call State Control Function address + via PCO(Protocol Configuration Option) for IMS client. */ +} RIL_Data_Call_Response_v9; + +typedef struct { + int status; /* A RIL_DataCallFailCause, 0 which is PDP_FAIL_NONE if no error */ + int suggestedRetryTime; /* If status != 0, this fields indicates the suggested retry + back-off timer value RIL wants to override the one + pre-configured in FW. + The unit is miliseconds. + The value < 0 means no value is suggested. + The value 0 means retry should be done ASAP. + The value of INT_MAX(0x7fffffff) means no retry. */ + int cid; /* Context ID, uniquely identifies this call */ + int active; /* 0=inactive, 1=active/physical link down, 2=active/physical link up */ + char * type; /* One of the PDP_type values in TS 27.007 section 10.1.1. + For example, "IP", "IPV6", "IPV4V6", or "PPP". If status is + PDP_FAIL_ONLY_SINGLE_BEARER_ALLOWED this is the type supported + such as "IP" or "IPV6" */ + char * ifname; /* The network interface name */ + char * addresses; /* A space-delimited list of addresses with optional "/" prefix length, + e.g., "192.0.1.3" or "192.0.1.11/16 2001:db8::1/64". + May not be empty, typically 1 IPv4 or 1 IPv6 or + one of each. If the prefix length is absent the addresses + are assumed to be point to point with IPv4 having a prefix + length of 32 and IPv6 128. */ + char * dnses; /* A space-delimited list of DNS server addresses, + e.g., "192.0.1.3" or "192.0.1.11 2001:db8::1". + May be empty. */ + char * gateways; /* A space-delimited list of default gateway addresses, + e.g., "192.0.1.3" or "192.0.1.11 2001:db8::1". + May be empty in which case the addresses represent point + to point connections. */ + char * pcscf; /* the Proxy Call State Control Function address + via PCO(Protocol Configuration Option) for IMS client. */ + int mtu; /* MTU received from network + Value <= 0 means network has either not sent a value or + sent an invalid value */ +} RIL_Data_Call_Response_v11; + typedef enum { RADIO_TECH_3GPP = 1, /* 3GPP Technologies - GSM, WCDMA */ RADIO_TECH_3GPP2 = 2 /* 3GPP2 Technologies - CDMA */ @@ -327,10 +503,27 @@ typedef struct { char *aidPtr; /* AID value, See ETSI 102.221 8.1 and 101.220 4, NULL if no value. */ } RIL_SIM_IO_v6; +/* Used by RIL_REQUEST_SIM_TRANSMIT_APDU_CHANNEL and + * RIL_REQUEST_SIM_TRANSMIT_APDU_BASIC. */ +typedef struct { + int sessionid; /* "sessionid" from TS 27.007 +CGLA command. Should be + ignored for +CSIM command. */ + + /* Following fields are used to derive the APDU ("command" and "length" + values in TS 27.007 +CSIM and +CGLA commands). */ + int cla; + int instruction; + int p1; + int p2; + int p3; /* A negative P3 implies a 4 byte APDU. */ + char *data; /* May be NULL. In hex string format. */ +} RIL_SIM_APDU; + typedef struct { int sw1; int sw2; - char *simResponse; /* In hex string format ([a-fA-F0-9]*). */ + char *simResponse; /* In hex string format ([a-fA-F0-9]*), except for SIM_AUTHENTICATION + response for which it is in Base64 format, see 3GPP TS 31.102 7.1.2 */ } RIL_SIM_IO_Response; /* See also com.android.internal.telephony.gsm.CallForwardInfo */ @@ -383,6 +576,9 @@ typedef enum { CALL_FAIL_FDN_BLOCKED = 241, CALL_FAIL_IMSI_UNKNOWN_IN_VLR = 242, CALL_FAIL_IMEI_NOT_ACCEPTED = 243, + CALL_FAIL_DIAL_MODIFIED_TO_USSD = 244, /* STK Call Control */ + CALL_FAIL_DIAL_MODIFIED_TO_SS = 245, + CALL_FAIL_DIAL_MODIFIED_TO_DIAL = 246, CALL_FAIL_CDMA_LOCKED_UNTIL_POWER_CYCLE = 1000, CALL_FAIL_CDMA_DROP = 1001, CALL_FAIL_CDMA_INTERCEPT = 1002, @@ -418,7 +614,8 @@ typedef enum { PDP_FAIL_SERVICE_OPTION_NOT_SUBSCRIBED = 0x21, /* no retry */ PDP_FAIL_SERVICE_OPTION_OUT_OF_ORDER = 0x22, PDP_FAIL_NSAPI_IN_USE = 0x23, /* no retry */ - PDP_FAIL_REGULAR_DEACTIVATION = 0x24, /* restart radio */ + PDP_FAIL_REGULAR_DEACTIVATION = 0x24, /* possibly restart radio, + based on framework config */ PDP_FAIL_ONLY_IPV4_ALLOWED = 0x32, /* no retry */ PDP_FAIL_ONLY_IPV6_ALLOWED = 0x33, /* no retry */ PDP_FAIL_ONLY_SINGLE_BEARER_ALLOWED = 0x34, @@ -445,7 +642,11 @@ typedef enum { typedef enum { RIL_DATA_PROFILE_DEFAULT = 0, RIL_DATA_PROFILE_TETHERED = 1, - RIL_DATA_PROFILE_OEM_BASE = 1000 /* Start of OEM-specific profiles */ + RIL_DATA_PROFILE_IMS = 2, + RIL_DATA_PROFILE_FOTA = 3, + RIL_DATA_PROFILE_CBS = 4, + RIL_DATA_PROFILE_OEM_BASE = 1000, /* Start of OEM-specific profiles */ + RIL_DATA_PROFILE_INVALID = 0xFFFFFFFF } RIL_DataProfile; /* Used by RIL_UNSOL_SUPP_SVC_NOTIFICATION */ @@ -749,6 +950,13 @@ typedef struct { * also: http://www.cellular-planningoptimization.com/2010/02/timing-advance-with-calculation.html */ } RIL_LTE_SignalStrength_v8; +typedef struct { + int rscp; /* The Received Signal Code Power in dBm multipled by -1. + * Range : 25 to 120 + * INT_MAX: 0x7FFFFFFF denotes invalid value. + * Reference: 3GPP TS 25.123, section 9.1.1.1 */ +} RIL_TD_SCDMA_SignalStrength; + /* Deprecated, use RIL_SignalStrength_v6 */ typedef struct { RIL_GW_SignalStrength GW_SignalStrength; @@ -770,6 +978,14 @@ typedef struct { RIL_LTE_SignalStrength_v8 LTE_SignalStrength; } RIL_SignalStrength_v8; +typedef struct { + RIL_GW_SignalStrength GW_SignalStrength; + RIL_CDMA_SignalStrength CDMA_SignalStrength; + RIL_EVDO_SignalStrength EVDO_SignalStrength; + RIL_LTE_SignalStrength_v8 LTE_SignalStrength; + RIL_TD_SCDMA_SignalStrength TD_SCDMA_SignalStrength; +} RIL_SignalStrength_v10; + /** RIL_CellIdentityGsm */ typedef struct { int mcc; /* 3-digit Mobile Country Code, 0..999, INT_MAX if unknown */ @@ -812,6 +1028,15 @@ typedef struct { int tac; /* 16-bit tracking area code, INT_MAX if unknown */ } RIL_CellIdentityLte; +/** RIL_CellIdentityTdscdma */ +typedef struct { + int mcc; /* 3-digit Mobile Country Code, 0..999, INT_MAX if unknown */ + int mnc; /* 2 or 3-digit Mobile Network Code, 0..999, INT_MAX if unknown */ + int lac; /* 16-bit Location Area Code, 0..65535, INT_MAX if unknown */ + int cid; /* 28-bit UMTS Cell Identity described in TS 25.331, 0..268435455, INT_MAX if unknown */ + int cpid; /* 8-bit Cell Parameters ID described in TS 25.331, 0..127, INT_MAX if unknown */ +} RIL_CellIdentityTdscdma; + /** RIL_CellInfoGsm */ typedef struct { RIL_CellIdentityGsm cellIdentityGsm; @@ -837,12 +1062,19 @@ typedef struct { RIL_LTE_SignalStrength_v8 signalStrengthLte; } RIL_CellInfoLte; +/** RIL_CellInfoTdscdma */ +typedef struct { + RIL_CellIdentityTdscdma cellIdentityTdscdma; + RIL_TD_SCDMA_SignalStrength signalStrengthTdscdma; +} RIL_CellInfoTdscdma; + // Must be the same as CellInfo.TYPE_XXX typedef enum { RIL_CELL_INFO_TYPE_GSM = 1, RIL_CELL_INFO_TYPE_CDMA = 2, RIL_CELL_INFO_TYPE_LTE = 3, RIL_CELL_INFO_TYPE_WCDMA = 4, + RIL_CELL_INFO_TYPE_TD_SCDMA = 5 } RIL_CellInfoType; // Must be the same as CellInfo.TIMESTAMP_TYPE_XXX @@ -864,6 +1096,7 @@ typedef struct { RIL_CellInfoCdma cdma; RIL_CellInfoLte lte; RIL_CellInfoWcdma wcdma; + RIL_CellInfoTdscdma tdscdma; } CellInfo; } RIL_CellInfo; @@ -981,6 +1214,185 @@ typedef struct { RIL_CDMA_InformationRecord infoRec[RIL_CDMA_MAX_NUMBER_OF_INFO_RECS]; } RIL_CDMA_InformationRecords; +/* See RIL_REQUEST_NV_READ_ITEM */ +typedef struct { + RIL_NV_Item itemID; +} RIL_NV_ReadItem; + +/* See RIL_REQUEST_NV_WRITE_ITEM */ +typedef struct { + RIL_NV_Item itemID; + char * value; +} RIL_NV_WriteItem; + +typedef enum { + HANDOVER_STARTED = 0, + HANDOVER_COMPLETED = 1, + HANDOVER_FAILED = 2, + HANDOVER_CANCELED = 3 +} RIL_SrvccState; + +/* hardware configuration reported to RILJ. */ +typedef enum { + RIL_HARDWARE_CONFIG_MODEM = 0, + RIL_HARDWARE_CONFIG_SIM = 1, +} RIL_HardwareConfig_Type; + +typedef enum { + RIL_HARDWARE_CONFIG_STATE_ENABLED = 0, + RIL_HARDWARE_CONFIG_STATE_STANDBY = 1, + RIL_HARDWARE_CONFIG_STATE_DISABLED = 2, +} RIL_HardwareConfig_State; + +typedef struct { + int rilModel; + uint32_t rat; /* bitset - ref. RIL_RadioTechnology. */ + int maxVoice; + int maxData; + int maxStandby; +} RIL_HardwareConfig_Modem; + +typedef struct { + char modemUuid[MAX_UUID_LENGTH]; +} RIL_HardwareConfig_Sim; + +typedef struct { + RIL_HardwareConfig_Type type; + char uuid[MAX_UUID_LENGTH]; + RIL_HardwareConfig_State state; + union { + RIL_HardwareConfig_Modem modem; + RIL_HardwareConfig_Sim sim; + } cfg; +} RIL_HardwareConfig; + +typedef enum { + SS_CFU, + SS_CF_BUSY, + SS_CF_NO_REPLY, + SS_CF_NOT_REACHABLE, + SS_CF_ALL, + SS_CF_ALL_CONDITIONAL, + SS_CLIP, + SS_CLIR, + SS_COLP, + SS_COLR, + SS_WAIT, + SS_BAOC, + SS_BAOIC, + SS_BAOIC_EXC_HOME, + SS_BAIC, + SS_BAIC_ROAMING, + SS_ALL_BARRING, + SS_OUTGOING_BARRING, + SS_INCOMING_BARRING +} RIL_SsServiceType; + +typedef enum { + SS_ACTIVATION, + SS_DEACTIVATION, + SS_INTERROGATION, + SS_REGISTRATION, + SS_ERASURE +} RIL_SsRequestType; + +typedef enum { + SS_ALL_TELE_AND_BEARER_SERVICES, + SS_ALL_TELESEVICES, + SS_TELEPHONY, + SS_ALL_DATA_TELESERVICES, + SS_SMS_SERVICES, + SS_ALL_TELESERVICES_EXCEPT_SMS +} RIL_SsTeleserviceType; + +#define SS_INFO_MAX 4 +#define NUM_SERVICE_CLASSES 7 + +typedef struct { + int numValidIndexes; /* This gives the number of valid values in cfInfo. + For example if voice is forwarded to one number and data + is forwarded to a different one then numValidIndexes will be + 2 indicating total number of valid values in cfInfo. + Similarly if all the services are forwarded to the same + number then the value of numValidIndexes will be 1. */ + + RIL_CallForwardInfo cfInfo[NUM_SERVICE_CLASSES]; /* This is the response data + for SS request to query call + forward status. see + RIL_REQUEST_QUERY_CALL_FORWARD_STATUS */ +} RIL_CfData; + +typedef struct { + RIL_SsServiceType serviceType; + RIL_SsRequestType requestType; + RIL_SsTeleserviceType teleserviceType; + int serviceClass; + RIL_Errno result; + + union { + int ssInfo[SS_INFO_MAX]; /* This is the response data for most of the SS GET/SET + RIL requests. E.g. RIL_REQUSET_GET_CLIR returns + two ints, so first two values of ssInfo[] will be + used for response if serviceType is SS_CLIR and + requestType is SS_INTERROGATION */ + + RIL_CfData cfData; + }; +} RIL_StkCcUnsolSsResponse; + +/** + * Data connection power state + */ +typedef enum { + RIL_DC_POWER_STATE_LOW = 1, // Low power state + RIL_DC_POWER_STATE_MEDIUM = 2, // Medium power state + RIL_DC_POWER_STATE_HIGH = 3, // High power state + RIL_DC_POWER_STATE_UNKNOWN = INT32_MAX // Unknown state +} RIL_DcPowerStates; + +/** + * Data connection real time info + */ +typedef struct { + uint64_t time; // Time in nanos as returned by ril_nano_time + RIL_DcPowerStates powerState; // Current power state +} RIL_DcRtInfo; + +/** + * Data profile to modem + */ +typedef struct { + /* id of the data profile */ + int profileId; + /* the APN to connect to */ + char* apn; + /** one of the PDP_type values in TS 27.007 section 10.1.1. + * For example, "IP", "IPV6", "IPV4V6", or "PPP". + */ + char* protocol; + /** authentication protocol used for this PDP context + * (None: 0, PAP: 1, CHAP: 2, PAP&CHAP: 3) + */ + int authType; + /* the username for APN, or NULL */ + char* user; + /* the password for APN, or NULL */ + char* password; + /* the profile type, TYPE_COMMON-0, TYPE_3GPP-1, TYPE_3GPP2-2 */ + int type; + /* the period in seconds to limit the maximum connections */ + int maxConnsTime; + /* the maximum connections during maxConnsTime */ + int maxConns; + /** the required wait time in seconds after a successful UE initiated + * disconnect of a given PDN connection before the device can send + * a new PDN connection request for that given PDN + */ + int waitTime; + /* true to enable the profile, 0 to disable, 1 to enable */ + int enabled; +} RIL_DataProfileInfo; + /** * RIL_REQUEST_GET_SIM_STATUS * @@ -1017,7 +1429,6 @@ typedef struct { #define RIL_REQUEST_ENTER_SIM_PIN 2 - /** * RIL_REQUEST_ENTER_SIM_PUK * @@ -1195,6 +1606,9 @@ typedef struct { * Valid errors: * SUCCESS * RADIO_NOT_AVAILABLE (radio resetting) + * DIAL_MODIFIED_TO_USSD + * DIAL_MODIFIED_TO_SS + * DIAL_MODIFIED_TO_DIAL * GENERIC_FAILURE */ #define RIL_REQUEST_DIAL 10 @@ -1730,7 +2144,7 @@ typedef struct { * For example, "IP", "IPV6", "IPV4V6", or "PPP". * ((const char **)data)[7] Optional connection property parameters, format to be defined. * - * "response" is a RIL_Data_Call_Response_v6 + * "response" is a RIL_Data_Call_Response_v11 * * FIXME may need way to configure QoS settings * @@ -1798,6 +2212,9 @@ typedef struct { * SUCCESS * RADIO_NOT_AVAILABLE * FDN_CHECK_FAILURE + * USSD_MODIFIED_TO_DIAL + * USSD_MODIFIED_TO_SS + * USSD_MODIFIED_TO_USSD * GENERIC_FAILURE * * See also: RIL_REQUEST_CANCEL_USSD, RIL_UNSOL_ON_USSD @@ -1833,6 +2250,9 @@ typedef struct { * Valid errors: * SUCCESS * RADIO_NOT_AVAILABLE + * SS_MODIFIED_TO_DIAL + * SS_MODIFIED_TO_USSD + * SS_MODIFIED_TO_SS * GENERIC_FAILURE */ #define RIL_REQUEST_GET_CLIR 31 @@ -1848,6 +2268,9 @@ typedef struct { * Valid errors: * SUCCESS * RADIO_NOT_AVAILABLE + * SS_MODIFIED_TO_DIAL + * SS_MODIFIED_TO_USSD + * SS_MODIFIED_TO_SS * GENERIC_FAILURE */ #define RIL_REQUEST_SET_CLIR 32 @@ -1871,6 +2294,9 @@ typedef struct { * Valid errors: * SUCCESS * RADIO_NOT_AVAILABLE + * SS_MODIFIED_TO_DIAL + * SS_MODIFIED_TO_USSD + * SS_MODIFIED_TO_SS * GENERIC_FAILURE */ #define RIL_REQUEST_QUERY_CALL_FORWARD_STATUS 33 @@ -1887,6 +2313,9 @@ typedef struct { * Valid errors: * SUCCESS * RADIO_NOT_AVAILABLE + * SS_MODIFIED_TO_DIAL + * SS_MODIFIED_TO_USSD + * SS_MODIFIED_TO_SS * GENERIC_FAILURE */ #define RIL_REQUEST_SET_CALL_FORWARD 34 @@ -1913,6 +2342,9 @@ typedef struct { * Valid errors: * SUCCESS * RADIO_NOT_AVAILABLE + * SS_MODIFIED_TO_DIAL + * SS_MODIFIED_TO_USSD + * SS_MODIFIED_TO_SS * GENERIC_FAILURE */ #define RIL_REQUEST_QUERY_CALL_WAITING 35 @@ -1932,6 +2364,9 @@ typedef struct { * Valid errors: * SUCCESS * RADIO_NOT_AVAILABLE + * SS_MODIFIED_TO_DIAL + * SS_MODIFIED_TO_USSD + * SS_MODIFIED_TO_SS * GENERIC_FAILURE */ #define RIL_REQUEST_SET_CALL_WAITING 36 @@ -2074,6 +2509,9 @@ typedef struct { * Valid errors: * SUCCESS * RADIO_NOT_AVAILABLE + * SS_MODIFIED_TO_DIAL + * SS_MODIFIED_TO_USSD + * SS_MODIFIED_TO_SS * GENERIC_FAILURE * */ @@ -2103,6 +2541,9 @@ typedef struct { * Valid errors: * SUCCESS * RADIO_NOT_AVAILABLE + * SS_MODIFIED_TO_DIAL + * SS_MODIFIED_TO_USSD + * SS_MODIFIED_TO_SS * GENERIC_FAILURE * */ @@ -2125,6 +2566,9 @@ typedef struct { * Valid errors: * SUCCESS * RADIO_NOT_AVAILABLE + * SS_MODIFIED_TO_DIAL + * SS_MODIFIED_TO_USSD + * SS_MODIFIED_TO_SS * GENERIC_FAILURE * */ @@ -2345,6 +2789,9 @@ typedef struct { * Valid errors: * SUCCESS * RADIO_NOT_AVAILABLE (radio resetting) + * SS_MODIFIED_TO_DIAL + * SS_MODIFIED_TO_USSD + * SS_MODIFIED_TO_SS * GENERIC_FAILURE */ @@ -3580,7 +4027,335 @@ typedef struct { */ #define RIL_REQUEST_IMS_SEND_SMS 113 +/** + * RIL_REQUEST_SIM_TRANSMIT_APDU_BASIC + * + * Request APDU exchange on the basic channel. This command reflects TS 27.007 + * "generic SIM access" operation (+CSIM). The modem must ensure proper function + * of GSM/CDMA, and filter commands appropriately. It should filter + * channel management and SELECT by DF name commands. + * + * "data" is a const RIL_SIM_APDU * + * "sessionid" field should be ignored. + * + * "response" is a const RIL_SIM_IO_Response * + * + * Valid errors: + * SUCCESS + * RADIO_NOT_AVAILABLE + * GENERIC_FAILURE + */ +#define RIL_REQUEST_SIM_TRANSMIT_APDU_BASIC 114 + +/** + * RIL_REQUEST_SIM_OPEN_CHANNEL + * + * Open a new logical channel and select the given application. This command + * reflects TS 27.007 "open logical channel" operation (+CCHO). + * + * "data" is const char * and set to AID value, See ETSI 102.221 and 101.220. + * + * "response" is int * + * ((int *)data)[0] contains the session id of the logical channel. + * ((int *)data)[1] onwards may optionally contain the select response for the + * open channel command with one byte per integer. + * + * Valid errors: + * SUCCESS + * RADIO_NOT_AVAILABLE + * GENERIC_FAILURE + * MISSING_RESOURCE + * NO_SUCH_ELEMENT + */ +#define RIL_REQUEST_SIM_OPEN_CHANNEL 115 + +/** + * RIL_REQUEST_SIM_CLOSE_CHANNEL + * + * Close a previously opened logical channel. This command reflects TS 27.007 + * "close logical channel" operation (+CCHC). + * + * "data" is int * + * ((int *)data)[0] is the session id of logical the channel to close. + * + * "response" is NULL + * + * Valid errors: + * SUCCESS + * RADIO_NOT_AVAILABLE + * GENERIC_FAILURE + */ +#define RIL_REQUEST_SIM_CLOSE_CHANNEL 116 + +/** + * RIL_REQUEST_SIM_TRANSMIT_APDU_CHANNEL + * + * Exchange APDUs with a UICC over a previously opened logical channel. This + * command reflects TS 27.007 "generic logical channel access" operation + * (+CGLA). The modem should filter channel management and SELECT by DF name + * commands. + * + * "data" is a const RIL_SIM_APDU* + * + * "response" is a const RIL_SIM_IO_Response * + * + * Valid errors: + * SUCCESS + * RADIO_NOT_AVAILABLE + * GENERIC_FAILURE + */ +#define RIL_REQUEST_SIM_TRANSMIT_APDU_CHANNEL 117 + +/** + * RIL_REQUEST_NV_READ_ITEM + * + * Read one of the radio NV items defined in RadioNVItems.java / ril_nv_items.h. + * This is used for device configuration by some CDMA operators. + * + * "data" is a const RIL_NV_ReadItem * + * + * "response" is const char * containing the contents of the NV item + * + * Valid errors: + * SUCCESS + * RADIO_NOT_AVAILABLE + * GENERIC_FAILURE + */ +#define RIL_REQUEST_NV_READ_ITEM 118 + +/** + * RIL_REQUEST_NV_WRITE_ITEM + * + * Write one of the radio NV items defined in RadioNVItems.java / ril_nv_items.h. + * This is used for device configuration by some CDMA operators. + * + * "data" is a const RIL_NV_WriteItem * + * + * "response" is NULL + * + * Valid errors: + * SUCCESS + * RADIO_NOT_AVAILABLE + * GENERIC_FAILURE + */ +#define RIL_REQUEST_NV_WRITE_ITEM 119 + +/** + * RIL_REQUEST_NV_WRITE_CDMA_PRL + * + * Update the CDMA Preferred Roaming List (PRL) in the radio NV storage. + * This is used for device configuration by some CDMA operators. + * + * "data" is a const char * containing the PRL as a byte array + * + * "response" is NULL + * + * Valid errors: + * SUCCESS + * RADIO_NOT_AVAILABLE + * GENERIC_FAILURE + */ +#define RIL_REQUEST_NV_WRITE_CDMA_PRL 120 + +/** + * RIL_REQUEST_NV_RESET_CONFIG + * + * Reset the radio NV configuration to the factory state. + * This is used for device configuration by some CDMA operators. + * + * "data" is int * + * ((int *)data)[0] is 1 to reload all NV items + * ((int *)data)[0] is 2 for erase NV reset (SCRTN) + * ((int *)data)[0] is 3 for factory reset (RTN) + * + * "response" is NULL + * + * Valid errors: + * SUCCESS + * RADIO_NOT_AVAILABLE + * GENERIC_FAILURE + */ +#define RIL_REQUEST_NV_RESET_CONFIG 121 + + /** RIL_REQUEST_SET_UICC_SUBSCRIPTION + * FIXME This API needs to have more documentation. + * + * Selection/de-selection of a subscription from a SIM card + * "data" is const RIL_SelectUiccSub* + + * + * "response" is NULL + * + * Valid errors: + * SUCCESS + * RADIO_NOT_AVAILABLE (radio resetting) + * GENERIC_FAILURE + * SUBSCRIPTION_NOT_SUPPORTED + * + */ +#define RIL_REQUEST_SET_UICC_SUBSCRIPTION 122 + +/** + * RIL_REQUEST_ALLOW_DATA + * + * Tells the modem whether data calls are allowed or not + * + * "data" is int * + * FIXME slotId and aid will be added. + * ((int *)data)[0] is == 0 to allow data calls + * ((int *)data)[0] is == 1 to disallow data calls + * + * "response" is NULL + * + * Valid errors: + * + * SUCCESS + * RADIO_NOT_AVAILABLE (radio resetting) + * GENERIC_FAILURE + * + */ +#define RIL_REQUEST_ALLOW_DATA 123 + +/** + * RIL_REQUEST_GET_HARDWARE_CONFIG + * + * Request all of the current hardware (modem and sim) associated + * with the RIL. + * + * "data" is NULL + * + * "response" is an array of RIL_HardwareConfig. + */ +#define RIL_REQUEST_GET_HARDWARE_CONFIG 124 + +/** + * RIL_REQUEST_SIM_AUTHENTICATION + * + * Returns the response of SIM Authentication through RIL to a + * challenge request. + * + * "data" Base64 encoded string containing challenge: + * int authContext; P2 value of authentication command, see P2 parameter in + * 3GPP TS 31.102 7.1.2 + * char *authData; the challenge string in Base64 format, see 3GPP + * TS 31.102 7.1.2 + * char *aid; AID value, See ETSI 102.221 8.1 and 101.220 4, + * NULL if no value + * + * "response" Base64 encoded strings containing response: + * int sw1; Status bytes per 3GPP TS 31.102 section 7.3 + * int sw2; + * char *simResponse; Response in Base64 format, see 3GPP TS 31.102 7.1.2 + */ +#define RIL_REQUEST_SIM_AUTHENTICATION 125 + +/** + * RIL_REQUEST_GET_DC_RT_INFO + * + * Requests the Data Connection Real Time Info + * + * "data" is NULL + * + * "response" is the most recent RIL_DcRtInfo + * + * Valid errors: + * SUCCESS + * RADIO_NOT_AVAILABLE + * GENERIC_FAILURE + * + * See also: RIL_UNSOL_DC_RT_INFO_CHANGED + */ +#define RIL_REQUEST_GET_DC_RT_INFO 126 + +/** + * RIL_REQUEST_SET_DC_RT_INFO_RATE + * + * This is the minimum number of milliseconds between successive + * RIL_UNSOL_DC_RT_INFO_CHANGED messages and defines the highest rate + * at which RIL_UNSOL_DC_RT_INFO_CHANGED's will be sent. A value of + * 0 means send as fast as possible. + * + * "data" The number of milliseconds as an int + * + * "response" is null + * + * Valid errors: + * SUCCESS must not fail + */ +#define RIL_REQUEST_SET_DC_RT_INFO_RATE 127 + +/** + * RIL_REQUEST_SET_DATA_PROFILE + * + * Set data profile in modem + * Modem should erase existed profiles from framework, and apply new profiles + * "data" is an const RIL_DataProfileInfo ** + * "datalen" is count * sizeof(const RIL_DataProfileInfo *) + * "response" is NULL + * + * Valid errors: + * SUCCESS + * RADIO_NOT_AVAILABLE (radio resetting) + * GENERIC_FAILURE + * SUBSCRIPTION_NOT_AVAILABLE + */ +#define RIL_REQUEST_SET_DATA_PROFILE 128 + +/** + * RIL_REQUEST_SHUTDOWN + * + * Device is shutting down. All further commands are ignored + * and RADIO_NOT_AVAILABLE must be returned. + * + * "data" is null + * "response" is NULL + * + * Valid errors: + * SUCCESS + * RADIO_NOT_AVAILABLE + * GENERIC_FAILURE + */ +#define RIL_REQUEST_SHUTDOWN 129 + +/** + * RIL_REQUEST_GET_RADIO_CAPABILITY + * + * Used to get phone radio capablility. + * + * "data" is int * + * ((int *)data)[0] is the phone radio access family defined in + * RadioAccessFamily. It's a bit mask value to represent the support type. + * + * Valid errors: + * SUCCESS + * RADIO_NOT_AVAILABLE + * GENERIC_FAILURE + */ +#define RIL_REQUEST_GET_RADIO_CAPABILITY 130 + +/** + * RIL_REQUEST_SET_RADIO_CAPABILITY + * + * Used to set the phones radio capability. Be VERY careful + * using this request as it may cause some vendor modems to reset. Because + * of the possible modem reset any RIL commands after this one may not be + * processed. + * + * "data" is the RIL_RadioCapability structure + * + * "response" is the RIL_RadioCapability structure, used to feedback return status + * + * Valid errors: + * SUCCESS means a RIL_UNSOL_RADIO_CAPABILITY will be sent within 30 seconds. + * RADIO_NOT_AVAILABLE + * GENERIC_FAILURE + */ +#define RIL_REQUEST_SET_RADIO_CAPABILITY 131 + /* SAMSUNG REQUESTS */ +#undef RIL_REQUEST_SIM_OPEN_CHANNEL +#undef RIL_REQUEST_SIM_CLOSE_CHANNEL + #define RIL_REQUEST_GET_CELL_BROADCAST_CONFIG 10002 #define RIL_REQUEST_SEND_ENCODED_USSD 10005 @@ -3768,7 +4543,6 @@ typedef struct { */ #define RIL_UNSOL_ON_USSD_REQUEST 1007 - /** * RIL_UNSOL_NITZ_TIME_RECEIVED * @@ -4137,6 +4911,90 @@ typedef struct { */ #define RIL_UNSOL_RESPONSE_IMS_NETWORK_STATE_CHANGED 1037 +/** + * RIL_UNSOL_UICC_SUBSCRIPTION_STATUS_CHANGED + * + * Indicated when there is a change in subscription status. + * This event will be sent in the following scenarios + * - subscription readiness at modem, which was selected by telephony layer + * - when subscription is deactivated by modem due to UICC card removal + * - When network invalidates the subscription i.e. attach reject due to authentication reject + * + * "data" is const int * + * ((const int *)data)[0] == 0 for Subscription Deactivated + * ((const int *)data)[0] == 1 for Subscription Activated + * + */ +#define RIL_UNSOL_UICC_SUBSCRIPTION_STATUS_CHANGED 1038 + +/** + * RIL_UNSOL_SRVCC_STATE_NOTIFY + * + * Called when Single Radio Voice Call Continuity(SRVCC) + * progress state has changed + * + * "data" is int * + * ((int *)data)[0] is of type const RIL_SrvccState + * + */ + +#define RIL_UNSOL_SRVCC_STATE_NOTIFY 1039 + +/** + * RIL_UNSOL_HARDWARE_CONFIG_CHANGED + * + * Called when the hardware configuration associated with the RILd changes + * + * "data" is an array of RIL_HardwareConfig + * + */ +#define RIL_UNSOL_HARDWARE_CONFIG_CHANGED 1040 + +/** + * RIL_UNSOL_DC_RT_INFO_CHANGED + * + * Sent when the DC_RT_STATE changes but the time + * between these messages must not be less than the + * value set by RIL_REQUEST_SET_DC_RT_RATE. + * + * "data" is the most recent RIL_DcRtInfo + * + */ +#define RIL_UNSOL_DC_RT_INFO_CHANGED 1041 + +/** + * RIL_UNSOL_RADIO_CAPABILITY + * + * Sent when RIL_REQUEST_SET_RADIO_CAPABILITY completes. + * Returns the phone radio capability exactly as + * RIL_REQUEST_GET_RADIO_CAPABILITY and should be the + * same set as sent by RIL_REQUEST_SET_RADIO_CAPABILITY. + * + * "data" is the RIL_RadioCapability structure + */ +#define RIL_UNSOL_RADIO_CAPABILITY 1042 + +/* + * RIL_UNSOL_ON_SS + * + * Called when SS response is received when DIAL/USSD/SS is changed to SS by + * call control. + * + * "data" is const RIL_StkCcUnsolSsResponse * + * + */ +#define RIL_UNSOL_ON_SS 1043 + +/** + * RIL_UNSOL_STK_CC_ALPHA_NOTIFY + * + * Called when there is an ALPHA from UICC during Call Control. + * + * "data" is const char * containing ALPHA string from UICC in UTF-8 format. + * + */ +#define RIL_UNSOL_STK_CC_ALPHA_NOTIFY 1044 + /* SAMSUNG RESPONSE */ #define SAMSUNG_UNSOL_RESPONSE_BASE 11000 @@ -4175,6 +5033,28 @@ typedef struct { /***********************************************************************/ +#if defined(ANDROID_MULTI_SIM) +/** + * RIL_Request Function pointer + * + * @param request is one of RIL_REQUEST_* + * @param data is pointer to data defined for that RIL_REQUEST_* + * data is owned by caller, and should not be modified or freed by callee + * @param t should be used in subsequent call to RIL_onResponse + * @param datalen the length of data + * + */ +typedef void (*RIL_RequestFunc) (int request, void *data, + size_t datalen, RIL_Token t, RIL_SOCKET_ID socket_id); + +/** + * This function should return the current radio state synchronously + */ +typedef RIL_RadioState (*RIL_RadioStateRequest)(RIL_SOCKET_ID socket_id); + +#else +/* Backward compatible */ + /** * RIL_Request Function pointer * @@ -4193,6 +5073,9 @@ typedef void (*RIL_RequestFunc) (int request, void *data, */ typedef RIL_RadioState (*RIL_RadioStateRequest)(); +#endif + + /** * This function returns "1" if the specified RIL_REQUEST code is * supported and 0 if it is not @@ -4248,6 +5131,15 @@ typedef struct { char *password; } RIL_InitialAttachApn; +typedef struct { + int authContext; /* P2 value of authentication command, see P2 parameter in + 3GPP TS 31.102 7.1.2 */ + char *authData; /* the challenge string in Base64 format, see 3GPP + TS 31.102 7.1.2 */ + char *aid; /* AID value, See ETSI 102.221 8.1 and 101.220 4, + NULL if no value. */ +} RIL_SimAuthentication; + #ifdef RIL_SHLIB struct RIL_Env { /** @@ -4264,16 +5156,23 @@ struct RIL_Env { void (*OnRequestComplete)(RIL_Token t, RIL_Errno e, void *response, size_t responselen); +#if defined(ANDROID_MULTI_SIM) /** * "unsolResponse" is one of RIL_UNSOL_RESPONSE_* * "data" is pointer to data defined for that RIL_UNSOL_RESPONSE_* * * "data" is owned by caller, and should not be modified or freed by callee */ - - void (*OnUnsolicitedResponse)(int unsolResponse, const void *data, - size_t datalen); - + void (*OnUnsolicitedResponse)(int unsolResponse, const void *data, size_t datalen, RIL_SOCKET_ID socket_id); +#else + /** + * "unsolResponse" is one of RIL_UNSOL_RESPONSE_* + * "data" is pointer to data defined for that RIL_UNSOL_RESPONSE_* + * + * "data" is owned by caller, and should not be modified or freed by callee + */ + void (*OnUnsolicitedResponse)(int unsolResponse, const void *data, size_t datalen); +#endif /** * Call user-specifed "callback" function on on the same thread that * RIL_RequestFunc is called. If "relativeTime" is specified, then it specifies @@ -4324,6 +5223,7 @@ void RIL_register (const RIL_RadioFunctions *callbacks); void RIL_onRequestComplete(RIL_Token t, RIL_Errno e, void *response, size_t responselen); +#if defined(ANDROID_MULTI_SIM) /** * @param unsolResponse is one of RIL_UNSOL_RESPONSE_* * @param data is pointer to data defined for that RIL_UNSOL_RESPONSE_* @@ -4332,8 +5232,18 @@ void RIL_onRequestComplete(RIL_Token t, RIL_Errno e, */ void RIL_onUnsolicitedResponse(int unsolResponse, const void *data, - size_t datalen); + size_t datalen, RIL_SOCKET_ID socket_id); +#else +/** + * @param unsolResponse is one of RIL_UNSOL_RESPONSE_* + * @param data is pointer to data defined for that RIL_UNSOL_RESPONSE_* + * "data" is owned by caller, and should not be modified or freed by callee + * @param datalen the length of data in byte + */ +void RIL_onUnsolicitedResponse(int unsolResponse, const void *data, + size_t datalen); +#endif /** * Call user-specifed "callback" function on on the same thread that -- cgit v1.1 From 572e512bbedc361d211dc48a4fb2b74301368f6f Mon Sep 17 00:00:00 2001 From: Dheeraj CVR Date: Tue, 19 May 2015 00:56:45 +0400 Subject: audio: enable noise suppression by default Framework was responsible for enabling or disabling the noise suppression using audio parameters. However, this is currently broken in lollipop and most of the newer devices have noise suppression enabled by default. Use noise suppression when using the default input device (main microphone). Change-Id: Ie8bdfe1d9860fdad996640d1664e8111df7d3cec --- audio/audio_hw.c | 34 ++++++++++++---------- overlay/packages/apps/Phone | 1 - .../services/Telephony/res/values/config.xml | 25 ---------------- 3 files changed, 19 insertions(+), 41 deletions(-) delete mode 120000 overlay/packages/apps/Phone delete mode 100644 overlay/packages/services/Telephony/res/values/config.xml diff --git a/audio/audio_hw.c b/audio/audio_hw.c index d53cd94..f266c35 100644 --- a/audio/audio_hw.c +++ b/audio/audio_hw.c @@ -200,6 +200,7 @@ struct m0_dev_cfg { static void select_output_device(struct m0_audio_device *adev); static void select_input_device(struct m0_audio_device *adev); +static void set_noise_supression(struct m0_audio_device *adev, int enable); static int adev_set_voice_volume(struct audio_hw_device *dev, float volume); static int do_input_standby(struct m0_stream_in *in); static int do_output_standby(struct m0_stream_out *out); @@ -593,6 +594,7 @@ static void select_mode(struct m0_audio_device *adev) set_bigroute_by_array(adev->mixer, voicecall_default_disable, 1); ALOGD("%s: set voicecall route: default_input_disable", __func__); set_bigroute_by_array(adev->mixer, default_input_disable, 1); + set_noise_supression(adev, 0); ALOGD("%s: set voicecall route: headset_input_disable", __func__); set_bigroute_by_array(adev->mixer, headset_input_disable, 1); ALOGD("%s: set voicecall route: bt_disable", __func__); @@ -671,9 +673,11 @@ static void select_output_device(struct m0_audio_device *adev) if (speaker_on || earpiece_on || headphone_on) { ALOGD("%s: set voicecall route: default_input", __func__); set_bigroute_by_array(adev->mixer, default_input, 1); + set_noise_supression(adev, 1); } else { ALOGD("%s: set voicecall route: default_input_disable", __func__); set_bigroute_by_array(adev->mixer, default_input_disable, 1); + set_noise_supression(adev, 0); } if (headset_on) { @@ -726,6 +730,21 @@ static void select_input_device(struct m0_audio_device *adev) select_devices(adev); } +static void set_noise_supression(struct m0_audio_device *adev, int enable) +{ + if (enable) { + // Enable Noise suppression for builtin microphone + ALOGE("%s: enabling two mic control", __func__); + ril_set_two_mic_control(&adev->ril, AUDIENCE, TWO_MIC_SOLUTION_ON); + set_bigroute_by_array(adev->mixer, noise_suppression, 1); + } else { + // Disable Noise suppression for builtin microphone + ALOGE("%s: disabling two mic control", __func__); + ril_set_two_mic_control(&adev->ril, AUDIENCE, TWO_MIC_SOLUTION_OFF); + set_bigroute_by_array(adev->mixer, noise_suppression_disable, 1); + } +} + /* must be called with hw device and output stream mutexes locked */ static int start_output_stream_low_latency(struct m0_stream_out *out) { @@ -2543,21 +2562,6 @@ static int adev_set_parameters(struct audio_hw_device *dev, const char *kvpairs) adev->screen_off = true; } - ret = str_parms_get_str(parms, "noise_suppression", value, sizeof(value)); - if (ret >= 0) { - if (strcmp(value, "true") == 0) { - ALOGE("%s: enabling two mic control", __func__); - ril_set_two_mic_control(&adev->ril, AUDIENCE, TWO_MIC_SOLUTION_ON); - /* sub mic */ - set_bigroute_by_array(adev->mixer, noise_suppression, 1); - } else { - ALOGE("%s: disabling two mic control", __func__); - ril_set_two_mic_control(&adev->ril, AUDIENCE, TWO_MIC_SOLUTION_OFF); - /* sub mic */ - set_bigroute_by_array(adev->mixer, noise_suppression_disable, 1); - } - } - str_parms_destroy(parms); return ret; } diff --git a/overlay/packages/apps/Phone b/overlay/packages/apps/Phone deleted file mode 120000 index 0f8d39e..0000000 --- a/overlay/packages/apps/Phone +++ /dev/null @@ -1 +0,0 @@ -../services/Telephony/ \ No newline at end of file diff --git a/overlay/packages/services/Telephony/res/values/config.xml b/overlay/packages/services/Telephony/res/values/config.xml deleted file mode 100644 index 23ec4e4..0000000 --- a/overlay/packages/services/Telephony/res/values/config.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - true - - - noise_suppression=true=false - -- cgit v1.1 From 55d7df1e375bfa7f51e0cd4df4dad6753bd8a605 Mon Sep 17 00:00:00 2001 From: Dheeraj CVR Date: Wed, 10 Jun 2015 21:47:12 +0400 Subject: n7100: cleanup and add settings overlay for audio dock Change-Id: Idf8a7803a96cfa81c1af818617dc66aeb872f68e --- overlay/packages/apps/Settings/res/values/bools.xml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 overlay/packages/apps/Settings/res/values/bools.xml diff --git a/overlay/packages/apps/Settings/res/values/bools.xml b/overlay/packages/apps/Settings/res/values/bools.xml new file mode 100644 index 0000000..88338eb --- /dev/null +++ b/overlay/packages/apps/Settings/res/values/bools.xml @@ -0,0 +1,21 @@ + + + + + + true + -- cgit v1.1 From ac4c22394966a4eb82be6d402ad19e235f7c7b26 Mon Sep 17 00:00:00 2001 From: JustArchi Date: Fri, 10 Jul 2015 06:42:32 +0200 Subject: N7100: Boost earpiece volume I'm still wondering what exactly happened that resulted earpiece volume that low between CM11 and CM12. I compared all current earpiece CTLs and they seem to be exactly the same as stock ones, although volume is still too low. Let's fix it by enabling boost level 1 (possible <0,3>) and increasing output volume to 60 (possible <57,63>) Perhaps I find some better solution in future. Closes #101 --- configs/tiny_hw.xml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/configs/tiny_hw.xml b/configs/tiny_hw.xml index 03c613c..195a909 100644 --- a/configs/tiny_hw.xml +++ b/configs/tiny_hw.xml @@ -158,16 +158,19 @@ We are able to have most of our routing static so do that - - + + - + + + + -- cgit v1.1 From 0c0c14b7febe638f493bcfc0eb7d9c58c395d8ec Mon Sep 17 00:00:00 2001 From: Ivan Meler Date: Fri, 10 Jul 2015 18:31:35 +0200 Subject: Test..: Increase sound volume on main speaker --- configs/tiny_hw.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configs/tiny_hw.xml b/configs/tiny_hw.xml index 195a909..5df1aab 100644 --- a/configs/tiny_hw.xml +++ b/configs/tiny_hw.xml @@ -132,16 +132,16 @@ We are able to have most of our routing static so do that - + - + - + -- cgit v1.1 From 5b9051f1d6c092a2fc7505e3ea879b712697c33a Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Tue, 17 Nov 2015 10:53:31 +0530 Subject: n7100: MM bringup for CM --- cm.dependencies | 18 ++++++++++++++++++ cm.mk | 27 +++++++++++++++++++++++++-- n7100.mk | 1 - pa.dependencies | 32 -------------------------------- system.prop | 1 - 5 files changed, 43 insertions(+), 36 deletions(-) create mode 100644 cm.dependencies delete mode 100644 pa.dependencies diff --git a/cm.dependencies b/cm.dependencies new file mode 100644 index 0000000..a78a94f --- /dev/null +++ b/cm.dependencies @@ -0,0 +1,18 @@ +[ + { + "repository": "android_device_samsung_smdk4412-common", + "target_path": "device/samsung/smdk4412-common" + }, + { + "repository": "android_kernel_samsung_smdk4412", + "target_path": "kernel/samsung/smdk4412" + }, + { + "repository": "android_packages_apps_SamsungServiceMode", + "target_path": "packages/apps/SamsungServiceMode" + }, + { + "repository": "android_hardware_samsung", + "target_path": "hardware/samsung" + } +] diff --git a/cm.mk b/cm.mk index 02b3945..2214f55 100644 --- a/cm.mk +++ b/cm.mk @@ -1,5 +1,28 @@ -# Specify phone tech before including full_phone -$(call inherit-product, vendor/cm/config/gsm.mk) +# Inherit device configuration +$(call inherit-product, device/samsung/n7100/full_n7100.mk) + +# Copyright (C) 2012 The CyanogenMod 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. + +# +# This file is the build configuration for a full Android +# build for toro hardware. This cleanly combines a set of +# device-specific aspects (drivers) with a device-agnostic +# product configuration (apps). Except for a few implementation +# details, it only fundamentally contains two inherit-product +# lines, full and toro, hence its name. +# # Release name PRODUCT_RELEASE_NAME := n7100 diff --git a/n7100.mk b/n7100.mk index 38159a8..9c683fc 100644 --- a/n7100.mk +++ b/n7100.mk @@ -72,7 +72,6 @@ PRODUCT_PACKAGES += \ PRODUCT_COPY_FILES += \ packages/apps/Nfc/migrate_nfc.txt:system/etc/updatecmds/migrate_nfc.txt \ frameworks/base/nfc-extras/com.android.nfc_extras.xml:system/etc/permissions/com.android.nfc_extras.xml \ - frameworks/native/data/etc/android.hardware.bluetooth_le.xml:system/etc/permissions/android.hardware.bluetooth_le.xml \ frameworks/native/data/etc/android.hardware.nfc.xml:system/etc/permissions/android.hardware.nfc.xml # NFCEE access control diff --git a/pa.dependencies b/pa.dependencies deleted file mode 100644 index d79b58f..0000000 --- a/pa.dependencies +++ /dev/null @@ -1,32 +0,0 @@ -[ - { - "remote": "github", - "repository": "tilaksidduram/android_device_samsung_smdk4412-common", - "target_path": "device/samsung/smdk4412-common", - "revision": "lollipop-mr1" - }, - { - "remote": "github", - "repository": "AOSPA-L/android_kernel_samsung_smdk4412", - "target_path": "kernel/samsung/smdk4412", - "revision": "lollipop-mr1" - }, - { - "remote": "github", - "repository": "CyanogenMod/android_packages_apps_SamsungServiceMode", - "target_path": "packages/apps/SamsungServiceMode", - "revision": "cm-12.1" - }, - { - "remote": "github", - "repository": "tilaksidduram/android_hardware_samsung", - "target_path": "hardware/samsung", - "revision": "lollipop-mr1" - }, - { - "remote": "github", - "repository": "CrazyWeasel/proprietary_vendor_samsung", - "target_path": "vendor/samsung", - "revision": "n-2.1" - } -] diff --git a/system.prop b/system.prop index 22fda1f..47d42de 100644 --- a/system.prop +++ b/system.prop @@ -7,4 +7,3 @@ rild.libpath=/system/lib/libsec-ril.so rild.libargs=-d /dev/ttyS0 ro.sf.lcd_density=320 ro.lcd_min_brightness=20 -ro.pa.device=n7100 -- cgit v1.1 From da1c09bab64af799eacfa7da0933881d16a2a663 Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Tue, 17 Nov 2015 10:55:19 +0530 Subject: Remove USB-OTG --- n7100.mk | 4 ---- 1 file changed, 4 deletions(-) diff --git a/n7100.mk b/n7100.mk index 9c683fc..7e17fca 100644 --- a/n7100.mk +++ b/n7100.mk @@ -106,8 +106,4 @@ PRODUCT_COPY_FILES += \ PRODUCT_PROPERTY_OVERRIDES += \ net.tethering.noprovisioning=true -# USB-OTG -PRODUCT_PROPERTY_OVERRIDES += \ - persist.sys.isUsbOtgEnabled=true - $(call inherit-product-if-exists, vendor/samsung/n7100/n7100-vendor.mk) -- cgit v1.1 From a72ca544028a6a0549cb064df75edd4b08798e80 Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Tue, 17 Nov 2015 10:58:02 +0530 Subject: n7100: Update fstab --- rootdir/fstab.smdk4x12 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rootdir/fstab.smdk4x12 b/rootdir/fstab.smdk4x12 index 286d93c..fd258bc 100644 --- a/rootdir/fstab.smdk4x12 +++ b/rootdir/fstab.smdk4x12 @@ -10,8 +10,8 @@ /dev/block/mmcblk0p14 /preload ext4 noatime,nosuid,nodev,journal_async_commit wait /dev/block/mmcblk0p16 /data ext4 noatime,nosuid,nodev,discard,noauto_da_alloc,journal_async_commit,errors=panic wait,check,encryptable=footer -/devices/platform/s3c-sdhci.2/mmc_host/mmc1* auto auto defaults voldmanaged=sdcard1:auto,noemulatedsd -/devices/platform/s5p-ehci* auto auto defaults voldmanaged=usbdisk0:auto +/devices/platform/s3c-sdhci.2/mmc_host/mmc1* auto auto defaults voldmanaged=sdcard1:auto,encryptable=userdata +/devices/platform/s5p-ehci* auto auto defaults voldmanaged=usb:auto,noemulatedsd # recovery /dev/block/mmcblk0p8 /boot emmc defaults recoveryonly -- cgit v1.1 From 946bcebf51f3f73207a19d6a025699ae6462bf27 Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Tue, 17 Nov 2015 10:59:31 +0530 Subject: n7100: Download and build stlport * Building of stlport is now moved to smdk4412-common --- cm.dependencies | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cm.dependencies b/cm.dependencies index a78a94f..4969689 100644 --- a/cm.dependencies +++ b/cm.dependencies @@ -14,5 +14,9 @@ { "repository": "android_hardware_samsung", "target_path": "hardware/samsung" + }, + { + "repository": "android_external_stlport", + "target_path": "external/stlport" } ] -- cgit v1.1 From 0febca49cba68a7a4ceb7d7a55df8c9b9d384afb Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Tue, 17 Nov 2015 11:03:32 +0530 Subject: n7100: Remove deprecated storage_list --- .../base/core/res/res/xml/storage_list.xml | 52 ---------------------- 1 file changed, 52 deletions(-) delete mode 100644 overlay/frameworks/base/core/res/res/xml/storage_list.xml diff --git a/overlay/frameworks/base/core/res/res/xml/storage_list.xml b/overlay/frameworks/base/core/res/res/xml/storage_list.xml deleted file mode 100644 index b576f8a..0000000 --- a/overlay/frameworks/base/core/res/res/xml/storage_list.xml +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - - - - - - - -- cgit v1.1 From 86a5f7480a7f3b02eda02a08f1309fa28b67b65c Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Tue, 17 Nov 2015 11:07:53 +0530 Subject: n7100: Fix sensors build --- libsensors/AccelSensor.cpp | 1 + libsensors/AkmSensor.cpp | 1 + libsensors/GyroSensor.cpp | 1 + libsensors/InputEventReader.cpp | 1 + libsensors/LightSensor.cpp | 1 + libsensors/PressureSensor.cpp | 1 + libsensors/ProximitySensor.cpp | 1 + libsensors/SensorBase.cpp | 1 + libsensors/sensors.cpp | 1 + 9 files changed, 9 insertions(+) diff --git a/libsensors/AccelSensor.cpp b/libsensors/AccelSensor.cpp index 290b023..0b05ed5 100644 --- a/libsensors/AccelSensor.cpp +++ b/libsensors/AccelSensor.cpp @@ -22,6 +22,7 @@ #include #include #include +#include #include "AccelSensor.h" diff --git a/libsensors/AkmSensor.cpp b/libsensors/AkmSensor.cpp index baca688..9dc98bc 100644 --- a/libsensors/AkmSensor.cpp +++ b/libsensors/AkmSensor.cpp @@ -22,6 +22,7 @@ #include #include #include +#include #include #include "AkmSensor.h" diff --git a/libsensors/GyroSensor.cpp b/libsensors/GyroSensor.cpp index eb2a076..7d3a2d9 100644 --- a/libsensors/GyroSensor.cpp +++ b/libsensors/GyroSensor.cpp @@ -22,6 +22,7 @@ #include #include #include +#include #include "GyroSensor.h" diff --git a/libsensors/InputEventReader.cpp b/libsensors/InputEventReader.cpp index 1014f29..ab23a22 100644 --- a/libsensors/InputEventReader.cpp +++ b/libsensors/InputEventReader.cpp @@ -21,6 +21,7 @@ #include #include +#include #include diff --git a/libsensors/LightSensor.cpp b/libsensors/LightSensor.cpp index fd1587f..4423412 100644 --- a/libsensors/LightSensor.cpp +++ b/libsensors/LightSensor.cpp @@ -21,6 +21,7 @@ #include #include #include +#include #include diff --git a/libsensors/PressureSensor.cpp b/libsensors/PressureSensor.cpp index 825a961..e77ee79 100644 --- a/libsensors/PressureSensor.cpp +++ b/libsensors/PressureSensor.cpp @@ -21,6 +21,7 @@ #include #include #include +#include #include diff --git a/libsensors/ProximitySensor.cpp b/libsensors/ProximitySensor.cpp index 53d6381..ab7db13 100644 --- a/libsensors/ProximitySensor.cpp +++ b/libsensors/ProximitySensor.cpp @@ -22,6 +22,7 @@ #include #include #include +#include #include diff --git a/libsensors/SensorBase.cpp b/libsensors/SensorBase.cpp index 1a25c96..77c6865 100644 --- a/libsensors/SensorBase.cpp +++ b/libsensors/SensorBase.cpp @@ -22,6 +22,7 @@ #include #include #include +#include #include diff --git a/libsensors/sensors.cpp b/libsensors/sensors.cpp index 1140aed..e7e48ec 100644 --- a/libsensors/sensors.cpp +++ b/libsensors/sensors.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #include -- cgit v1.1 From 0892f48f2f454ec19517c5b57b5836974b4483c3 Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Thu, 19 Nov 2015 23:27:29 +0530 Subject: n7100: remove selinux --- BoardConfig.mk | 17 ----------------- selinux/device.te | 3 --- selinux/domain.te | 2 -- selinux/file.te | 5 ----- selinux/file_contexts | 42 ------------------------------------------ selinux/init.te | 1 - selinux/mediaserver.te | 8 -------- selinux/rild.te | 7 ------- selinux/system.te | 11 ----------- selinux/ueventd.te | 6 ------ selinux/vold.te | 2 -- selinux/wpa_supplicant.te | 10 ---------- 12 files changed, 114 deletions(-) delete mode 100644 selinux/device.te delete mode 100644 selinux/domain.te delete mode 100644 selinux/file.te delete mode 100644 selinux/file_contexts delete mode 100644 selinux/init.te delete mode 100644 selinux/mediaserver.te delete mode 100644 selinux/rild.te delete mode 100644 selinux/system.te delete mode 100644 selinux/ueventd.te delete mode 100644 selinux/vold.te delete mode 100755 selinux/wpa_supplicant.te diff --git a/BoardConfig.mk b/BoardConfig.mk index 87d0aaa..2f87c38 100644 --- a/BoardConfig.mk +++ b/BoardConfig.mk @@ -47,20 +47,3 @@ RECOVERY_FSTAB_VERSION := 2 # Compatibility with pre-kitkat Sensor HALs SENSORS_NEED_SETRATE_ON_ENABLE := true - -# Selinux -BOARD_SEPOLICY_DIRS += \ - device/samsung/n7100/selinux - -BOARD_SEPOLICY_UNION += \ - device.te \ - domain.te \ - file.te \ - file_contexts \ - init.te \ - mediaserver.te \ - rild.te \ - system.te \ - ueventd.te \ - vold.te \ - wpa_supplicant.te diff --git a/selinux/device.te b/selinux/device.te deleted file mode 100644 index cca8ee1..0000000 --- a/selinux/device.te +++ /dev/null @@ -1,3 +0,0 @@ -type mali_device, dev_type, mlstrustedobject; -type rfkill_device, dev_type; -type efs_block_device, dev_type; diff --git a/selinux/domain.te b/selinux/domain.te deleted file mode 100644 index 26e8033..0000000 --- a/selinux/domain.te +++ /dev/null @@ -1,2 +0,0 @@ -## /dev/mali, /dev/ump -allow domain mali_device:chr_file rw_file_perms; diff --git a/selinux/file.te b/selinux/file.te deleted file mode 100644 index facc492..0000000 --- a/selinux/file.te +++ /dev/null @@ -1,5 +0,0 @@ -type firmware_mfc, file_type; -type firmware_camera, file_type; - -type sensors_data_file, file_type, data_file_type; -type volume_data_file, file_type, data_file_type; diff --git a/selinux/file_contexts b/selinux/file_contexts deleted file mode 100644 index 85bda40..0000000 --- a/selinux/file_contexts +++ /dev/null @@ -1,42 +0,0 @@ -# GFX -/dev/mali u:object_r:mali_device:s0 -/dev/ump u:object_r:mali_device:s0 -/dev/fimg2d u:object_r:mali_device:s0 - -# RIL -/dev/umts_boot0 u:object_r:radio_device:s0 -/dev/umts_csd u:object_r:radio_device:s0 -/dev/umts_ipc0 u:object_r:radio_device:s0 -/dev/umts_loopback0 u:object_r:radio_device:s0 -/dev/umts_ramdump0 u:object_r:radio_device:s0 -/dev/umts_rfs0 u:object_r:radio_device:s0 -/dev/umts_router u:object_r:radio_device:s0 - -/dev/block/mmcblk0p10 u:object_r:efs_block_device:s0 - -# Camera -/data/ISP_CV u:object_r:camera_data_file:s0 -/dev/exynos-mem u:object_r:video_device:s0 - -# Bluetooth -/dev/ttySAC0 u:object_r:hci_attach_dev:s0 -/efs/bluetooth/(/.*)? u:object_r:bluetooth_efs_file:s0 - -# GPS -/dev/ttySAC1 u:object_r:gps_device:s0 - -# Sensors -/dev/akm8975 u:object_r:sensors_device:s0 -/efs/gyro_cal_data u:object_r:sensors_data_file:s0 - -# Wifi -/dev/rfkill u:object_r:rfkill_device:s0 -/efs/wifi/.mac.info u:object_r:wifi_data_file:s0 - -# Firmwares -/system/vendor/firmware(/.*)? u:object_r:firmware_camera:s0 -/system/vendor/firmware/mfc_fw.bin u:object_r:firmware_mfc:s0 -/data/cfw(/.*)? u:object_r:firmware_camera:s0 - -# Vibrator -/dev/tspdrv u:object_r:input_device:s0 diff --git a/selinux/init.te b/selinux/init.te deleted file mode 100644 index 3f11893..0000000 --- a/selinux/init.te +++ /dev/null @@ -1 +0,0 @@ -allow init wpa_socket:unix_dgram_socket { bind create }; diff --git a/selinux/mediaserver.te b/selinux/mediaserver.te deleted file mode 100644 index 7cc911c..0000000 --- a/selinux/mediaserver.te +++ /dev/null @@ -1,8 +0,0 @@ -allow mediaserver { firmware_camera }:file r_file_perms; -allow mediaserver firmware_camera:dir r_dir_perms; -allow mediaserver camera_data_file:file rw_file_perms; -allow mediaserver volume_data_file:file create_file_perms; -allow mediaserver volume_data_file:dir create_dir_perms; - -# Bluetooth audio -allow mediaserver bluetooth:unix_stream_socket { connectto }; diff --git a/selinux/rild.te b/selinux/rild.te deleted file mode 100644 index 7f817d0..0000000 --- a/selinux/rild.te +++ /dev/null @@ -1,7 +0,0 @@ -allow rild self:netlink_socket { create bind read write }; -allow rild self:netlink_route_socket { write }; -allow rild self:netlink_kobject_uevent_socket { create bind read write setopt }; - -allow rild radio_device:chr_file rw_file_perms; -allow rild efs_block_device:blk_file rw_file_perms; -allow rild efs_file:file { read open write setattr }; diff --git a/selinux/system.te b/selinux/system.te deleted file mode 100644 index 4ea6c98..0000000 --- a/selinux/system.te +++ /dev/null @@ -1,11 +0,0 @@ -allow system_server input_device:chr_file { read ioctl write open }; -allow system_server sensors_device:chr_file { read open }; -allow system_server sensors_data_file:file r_file_perms; -allow system_server wpa_socket:unix_dgram_socket sendto; -allow system_app volume_data_file:file { read write open getattr }; - -allow system_server sysfs:file { read open write }; -allow system_server self:capability { sys_module }; - -# /efs/wifi/.mac.info -allow system_server wifi_data_file:file { read open }; diff --git a/selinux/ueventd.te b/selinux/ueventd.te deleted file mode 100644 index 1ed58dc..0000000 --- a/selinux/ueventd.te +++ /dev/null @@ -1,6 +0,0 @@ -# MFC firmware -allow ueventd { firmware_mfc }:file r_file_perms; - -# Camera related firmwares -allow ueventd { firmware_camera }:dir search; -allow ueventd { firmware_camera }:file r_file_perms; diff --git a/selinux/vold.te b/selinux/vold.te deleted file mode 100644 index 9452abf..0000000 --- a/selinux/vold.te +++ /dev/null @@ -1,2 +0,0 @@ -allow vold kernel:process setsched; -allow vold sdcardd_exec:file { read open execute execute_no_trans }; diff --git a/selinux/wpa_supplicant.te b/selinux/wpa_supplicant.te deleted file mode 100755 index c438b88..0000000 --- a/selinux/wpa_supplicant.te +++ /dev/null @@ -1,10 +0,0 @@ -allow wpa init:unix_dgram_socket { read write }; - -# logwrapper used with wpa_supplicant -allow wpa devpts:chr_file { read write }; - -allow wpa wpa_socket:unix_dgram_socket { read write }; -allow wpa_socket system_server:unix_dgram_socket sendto; - -allow wpa_socket wifi_data_file:sock_file unlink; -allow wpa rfkill_device:chr_file rw_file_perms; -- cgit v1.1 From c6f728db28a6d9bce47af01d5211041fa6e686ec Mon Sep 17 00:00:00 2001 From: Dimitris Mantzouranis Date: Sat, 26 Sep 2015 15:48:28 +0200 Subject: n7100: implement SE policy selinux: let's add some more sepolicy: we need more! sepolicy: are we there yet? sepolicy: one more time sepolicy: one more.. --- BoardConfig.mk | 28 ++++++++++++++++++++++ sepolicy/bluetooth.te | 4 ++++ sepolicy/bootanim.te | 1 + sepolicy/device.te | 21 ++++++++++++++++ sepolicy/file.te | 13 ++++++++++ sepolicy/file_contexts | 60 ++++++++++++++++++++++++++++++++++++++++++++++ sepolicy/gpsd.te | 9 +++++++ sepolicy/hostapd.te | 1 + sepolicy/mediaserver.te | 3 +++ sepolicy/netd.te | 1 + sepolicy/nfc.te | 1 + sepolicy/platform_app.te | 1 + sepolicy/radio.te | 2 ++ sepolicy/rild.te | 3 +++ sepolicy/service_contexts | 2 ++ sepolicy/servicemanager.te | 4 ++++ sepolicy/surfaceflinger.te | 1 + sepolicy/system_app.te | 3 +++ sepolicy/system_server.te | 7 ++++++ sepolicy/ueventd.te | 3 +++ sepolicy/untrusted_app.te | 2 ++ sepolicy/vold.te | 2 ++ sepolicy/wpa.te | 1 + 23 files changed, 173 insertions(+) create mode 100644 sepolicy/bluetooth.te create mode 100644 sepolicy/bootanim.te create mode 100644 sepolicy/device.te create mode 100644 sepolicy/file.te create mode 100644 sepolicy/file_contexts create mode 100644 sepolicy/gpsd.te create mode 100644 sepolicy/hostapd.te create mode 100644 sepolicy/mediaserver.te create mode 100644 sepolicy/netd.te create mode 100644 sepolicy/nfc.te create mode 100644 sepolicy/platform_app.te create mode 100644 sepolicy/radio.te create mode 100644 sepolicy/rild.te create mode 100644 sepolicy/service_contexts create mode 100644 sepolicy/servicemanager.te create mode 100644 sepolicy/surfaceflinger.te create mode 100644 sepolicy/system_app.te create mode 100644 sepolicy/system_server.te create mode 100644 sepolicy/ueventd.te create mode 100644 sepolicy/untrusted_app.te create mode 100644 sepolicy/vold.te create mode 100644 sepolicy/wpa.te diff --git a/BoardConfig.mk b/BoardConfig.mk index 2f87c38..0f517dc 100644 --- a/BoardConfig.mk +++ b/BoardConfig.mk @@ -47,3 +47,31 @@ RECOVERY_FSTAB_VERSION := 2 # Compatibility with pre-kitkat Sensor HALs SENSORS_NEED_SETRATE_ON_ENABLE := true + +#Selinux +BOARD_SEPOLICY_DIRS +=\ + device/samsung/n7100/sepolicy + +BOARD_SEPOLICY_UNION +=\ + bluetooth.te \ + bootanim.te \ + device.te \ + file_contexts \ + file.te \ + gpsd.te \ + hostapd.te \ + mediaserver.te \ + netd.te \ + nfc.te \ + platform_app.te \ + radio.te \ + rild.te \ + service_contexts \ + servicemanager.te \ + surfaceflinger.te \ + system_app.te \ + system_server.te \ + ueventd.te \ + untrusted_app.te \ + vold.te \ + wpa.te diff --git a/sepolicy/bluetooth.te b/sepolicy/bluetooth.te new file mode 100644 index 0000000..7106722 --- /dev/null +++ b/sepolicy/bluetooth.te @@ -0,0 +1,4 @@ +allow bluetooth firmware_exynos:dir { read open search }; +allow bluetooth firmware_exynos:file { read open }; +allow bluetooth bluetooth_efs_file:dir search; +allow bluetooth bluetooth_efs_file:file read; diff --git a/sepolicy/bootanim.te b/sepolicy/bootanim.te new file mode 100644 index 0000000..8a18e92 --- /dev/null +++ b/sepolicy/bootanim.te @@ -0,0 +1 @@ +allow bootanim ump_device:chr_file { open read write ioctl }; diff --git a/sepolicy/device.te b/sepolicy/device.te new file mode 100644 index 0000000..ef8edbe --- /dev/null +++ b/sepolicy/device.te @@ -0,0 +1,21 @@ +# Secure memory +type secmem_device, dev_type; + +# Unified Memory Management +type ump_device, dev_type; + +# Efs block device +type efs_block_device, dev_type; + +# Rfkill device +type rfkill_device, dev_type; + +# MFC device +type mfc_device, dev_type; + +# Fm radio device +type fm_radio_device, dev_type; + +# Gadget serial device +type gadget_serial_device, dev_type; + diff --git a/sepolicy/file.te b/sepolicy/file.te new file mode 100644 index 0000000..6ada8e6 --- /dev/null +++ b/sepolicy/file.te @@ -0,0 +1,13 @@ +# MFC firmware +type firmware_mfc, file_type; + +# Common Exynos firmware +type firmware_exynos, file_type; + +# Sensors data +type sensors_data_file, file_type, data_file_type; + +# Display sysfs +type sysfs_display, fs_type, sysfs_type; + + diff --git a/sepolicy/file_contexts b/sepolicy/file_contexts new file mode 100644 index 0000000..5b0abcb --- /dev/null +++ b/sepolicy/file_contexts @@ -0,0 +1,60 @@ +# Graphics +/dev/mali u:object_r:gpu_device:s0 +/dev/ump u:object_r:ump_device:s0 +/dev/fimg2d u:object_r:video_device:s0 +/dev/s5p-smem u:object_r:secmem_device:s0 + +# RIL +/dev/umts_boot0 u:object_r:radio_device:s0 +/dev/umts_csd u:object_r:radio_device:s0 +/dev/umts_ipc0 u:object_r:radio_device:s0 +/dev/umts_loopback0 u:object_r:radio_device:s0 +/dev/umts_ramdump0 u:object_r:radio_device:s0 +/dev/umts_rfs0 u:object_r:radio_device:s0 +/dev/umts_router u:object_r:radio_device:s0 + +# Efs +/dev/block/mmcblk0p3 u:object_r:efs_block_device:s0 +/factory(/.*)? u:object_r:efs_file:s0 + +# Camera +/data/ISP_CV u:object_r:camera_data_file:s0 +/dev/exynos-mem u:object_r:video_device:s0 +/dev/s3c-mfc u:object_r:mfc_device:s0 +/dev/video[0-3]* u:object_r:camera_device:s0 + +# Bluetooth +/dev/ttySAC0 u:object_r:hci_attach_dev:s0 +/factory/bluetooth(/.*)? u:object_r:bluetooth_efs_file:s0 +/sys/class/rfkill/rfkill0/state u:object_r:sysfs_bluetooth_writable:s0 +/sys/class/rfkill/rfkill0/type u:object_r:sysfs_bluetooth_writable:s0 + +# Display +/sys/class/mdnie/mdnie/scenario u:object_r:sysfs_display:s0 +/sys/class/mdnie/mdnie/mode u:object_r:sysfs_display:s0 + +# GPS +/dev/ttySAC1 u:object_r:gps_device:s0 +/system/bin/gpsd u:object_r:gpsd_exec:s0 + +# Sensors +/dev/akm8963 u:object_r:sensors_device:s0 +/efs/gyro_cal_data u:object_r:sensors_data_file:s0 + +# Wifi +/dev/rfkill u:object_r:rfkill_device:s0 +/factory/wifi/.mac.info u:object_r:wifi_data_file:s0 + +# Firmwares +/system/vendor/firmware(/.*)? u:object_r:firmware_exynos:s0 +/system/vendor/firmware/mfc_fw.bin u:object_r:firmware_mfc:s0 +/data/cfw(/.*)? u:object_r:firmware_exynos:s0 + +# Vibrator +/dev/tspdrv u:object_r:input_device:s0 +/sys/vibrator/pwm_val u:object_r:sysfs:s0 + +# Misc +/dev/HPD u:object_r:video_device:s0 +/dev/fmradio u:object_r:fm_radio_device:s0 +/dev/ttyGS[0-9]* u:object_r:gadget_serial_device:s0 diff --git a/sepolicy/gpsd.te b/sepolicy/gpsd.te new file mode 100644 index 0000000..309ab1a --- /dev/null +++ b/sepolicy/gpsd.te @@ -0,0 +1,9 @@ +allow gpsd rild:unix_stream_socket connectto; +allow gpsd system_data_file:dir { add_name write }; +allow gpsd system_data_file:file { create write lock open }; +allow gpsd system_data_file:fifo_file { create read write open setattr }; +allow gpsd sysfs_wake_lock:file { read write open }; +allow gpsd servicemanager:binder call; +allow gpsd system_server:binder call; +allow gpsd system_server:unix_stream_socket { read write }; + diff --git a/sepolicy/hostapd.te b/sepolicy/hostapd.te new file mode 100644 index 0000000..7e0b91b --- /dev/null +++ b/sepolicy/hostapd.te @@ -0,0 +1 @@ +allow hostapd rfkill_device:chr_file { read open }; diff --git a/sepolicy/mediaserver.te b/sepolicy/mediaserver.te new file mode 100644 index 0000000..8d43cdb --- /dev/null +++ b/sepolicy/mediaserver.te @@ -0,0 +1,3 @@ +allow mediaserver camera_data_file:file write; +allow mediaserver mfc_device:chr_file { read write ioctl open }; +allow mediaserver ump_device:chr_file { read write ioctl open }; diff --git a/sepolicy/netd.te b/sepolicy/netd.te new file mode 100644 index 0000000..ee1496b --- /dev/null +++ b/sepolicy/netd.te @@ -0,0 +1 @@ +allow netd self:capability fsetid; diff --git a/sepolicy/nfc.te b/sepolicy/nfc.te new file mode 100644 index 0000000..6a6e324 --- /dev/null +++ b/sepolicy/nfc.te @@ -0,0 +1 @@ +allow nfc firmware_exynos:dir search; diff --git a/sepolicy/platform_app.te b/sepolicy/platform_app.te new file mode 100644 index 0000000..fd825e9 --- /dev/null +++ b/sepolicy/platform_app.te @@ -0,0 +1 @@ +allow platform_app ump_device:chr_file { read write ioctl open }; diff --git a/sepolicy/radio.te b/sepolicy/radio.te new file mode 100644 index 0000000..c19e0cf --- /dev/null +++ b/sepolicy/radio.te @@ -0,0 +1,2 @@ +allow radio ump_device:chr_file { read write ioctl open }; + diff --git a/sepolicy/rild.te b/sepolicy/rild.te new file mode 100644 index 0000000..061742a --- /dev/null +++ b/sepolicy/rild.te @@ -0,0 +1,3 @@ +allow rild self:process execmem; +allow rild system_data_file:dir { write remove_name add_name setattr }; +allow rild system_data_file:file { write create unlink setattr }; diff --git a/sepolicy/service_contexts b/sepolicy/service_contexts new file mode 100644 index 0000000..c01caa2 --- /dev/null +++ b/sepolicy/service_contexts @@ -0,0 +1,2 @@ +Exynos.HWCService u:object_r:surfaceflinger_service:s0 +Exynos.IPService u:object_r:surfaceflinger_service:s0 diff --git a/sepolicy/servicemanager.te b/sepolicy/servicemanager.te new file mode 100644 index 0000000..3b3bda8 --- /dev/null +++ b/sepolicy/servicemanager.te @@ -0,0 +1,4 @@ +allow servicemanager gpsd:dir search; +allow servicemanager gpsd:file { read open }; +allow servicemanager gpsd:process getattr; + diff --git a/sepolicy/surfaceflinger.te b/sepolicy/surfaceflinger.te new file mode 100644 index 0000000..a9a8d6a --- /dev/null +++ b/sepolicy/surfaceflinger.te @@ -0,0 +1 @@ +allow surfaceflinger ump_device:chr_file { open read write ioctl }; diff --git a/sepolicy/system_app.te b/sepolicy/system_app.te new file mode 100644 index 0000000..2cb531f --- /dev/null +++ b/sepolicy/system_app.te @@ -0,0 +1,3 @@ +allow system_app sysfs_display:file { write getattr open }; +allow system_app ump_device:chr_file { ioctl open read write }; + diff --git a/sepolicy/system_server.te b/sepolicy/system_server.te new file mode 100644 index 0000000..f18517d --- /dev/null +++ b/sepolicy/system_server.te @@ -0,0 +1,7 @@ +allow system_server efs_file:file { read open }; +allow system_server efs_file:dir search; +allow system_server sensors_data_file:file { read open }; +allow system_server uhid_device:chr_file { read write ioctl open }; +allow system_server ump_device:chr_file { read write ioctl open }; +allow system_server gpsd:binder transfer; + diff --git a/sepolicy/ueventd.te b/sepolicy/ueventd.te new file mode 100644 index 0000000..af59995 --- /dev/null +++ b/sepolicy/ueventd.te @@ -0,0 +1,3 @@ +allow ueventd firmware_mfc:file { read getattr open }; +allow ueventd firmware_exynos:dir search; +allow ueventd firmware_exynos:file { read getattr open }; diff --git a/sepolicy/untrusted_app.te b/sepolicy/untrusted_app.te new file mode 100644 index 0000000..adaf51a --- /dev/null +++ b/sepolicy/untrusted_app.te @@ -0,0 +1,2 @@ +allow untrusted_app ump_device:chr_file { open read write ioctl }; + diff --git a/sepolicy/vold.te b/sepolicy/vold.te new file mode 100644 index 0000000..8068d38 --- /dev/null +++ b/sepolicy/vold.te @@ -0,0 +1,2 @@ +allow vold efs_file:dir { read getattr open ioctl }; + diff --git a/sepolicy/wpa.te b/sepolicy/wpa.te new file mode 100644 index 0000000..4f5ef08 --- /dev/null +++ b/sepolicy/wpa.te @@ -0,0 +1 @@ +allow wpa rfkill_device:chr_file { read open }; -- cgit v1.1 From de7f8bee799fea52316f423a23673ded12cd33f6 Mon Sep 17 00:00:00 2001 From: Dimitris Mantzouranis Date: Sat, 26 Sep 2015 19:29:19 +0200 Subject: n7100: init: restorecon -> do it recursive Conflicts: rootdir/init.target.rc --- rootdir/init.target.rc | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/rootdir/init.target.rc b/rootdir/init.target.rc index a3b06d4..8636c30 100644 --- a/rootdir/init.target.rc +++ b/rootdir/init.target.rc @@ -11,21 +11,7 @@ on post-fs-data symlink /dev/block/mmcblk0p7 /dev/block/param # Restorecon - restorecon /efs/nv_data.bin - restorecon /efs/nv_data.bin.md5 - restorecon /efs/.nv_core.bak - restorecon /efs/.nv_core.bak.md5 - restorecon /efs/.nv_data.bak - restorecon /efs/.nv_data.bak.md5 - restorecon /efs/.nv_state - restorecon /efs/bluetooth/bt_addr - restorecon /efs/FactoryApp/factorymode - restorecon /efs/FactoryApp/hw_ver - restorecon /efs/FactoryApp/keystr - restorecon /efs/FactoryApp/serial_no - restorecon /efs/imei/mps_code.dat - restorecon /efs/gyro_cal_data - restorecon /efs/wifi/.mac.info + restorecon_recursive /efs # SensorHub chown system radio /sys/class/sensors/ssp_sensor/enable @@ -51,4 +37,4 @@ service gpsd /system/bin/gpsd -c /system/etc/gps.xml class main socket gps seqpacket 0660 gps system user gps - group system inet sdcard_rw \ No newline at end of file + group system inet sdcard_rw -- cgit v1.1 From d6b4b26b09b0225e419f360e625e368f06826708 Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Thu, 19 Nov 2015 23:57:15 +0530 Subject: n7100: Add vendorsetup.sh for lunch --- vendorsetup.sh | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 vendorsetup.sh diff --git a/vendorsetup.sh b/vendorsetup.sh new file mode 100644 index 0000000..ec8ca52 --- /dev/null +++ b/vendorsetup.sh @@ -0,0 +1,2 @@ +add_lunch_combo cm_n7100-userdebug +add_lunch_combo cm_n7100-eng -- cgit v1.1 From c35595e6798851a28f31b29ee0bd87aab4b3bde1 Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Fri, 20 Nov 2015 00:18:25 +0530 Subject: fix vendor path --- n7100.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/n7100.mk b/n7100.mk index 7e17fca..b216e8e 100644 --- a/n7100.mk +++ b/n7100.mk @@ -88,7 +88,7 @@ PRODUCT_PACKAGES += \ com.android.nfc_extras \ Stk -$(call inherit-product, vendor/pa/configs/nfc_enhanced.mk) +$(call inherit-product, vendor/cm/config/nfc_enhanced.mk) # RIL PRODUCT_PROPERTY_OVERRIDES += \ -- cgit v1.1 From 5673bd24f3d7ca36c37773086fb9a2f5eb024009 Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Fri, 20 Nov 2015 00:35:14 +0530 Subject: n7100: removed Board_sepolicy_union --- BoardConfig.mk | 27 +-------------------------- 1 file changed, 1 insertion(+), 26 deletions(-) diff --git a/BoardConfig.mk b/BoardConfig.mk index 0f517dc..a7e016f 100644 --- a/BoardConfig.mk +++ b/BoardConfig.mk @@ -49,29 +49,4 @@ RECOVERY_FSTAB_VERSION := 2 SENSORS_NEED_SETRATE_ON_ENABLE := true #Selinux -BOARD_SEPOLICY_DIRS +=\ - device/samsung/n7100/sepolicy - -BOARD_SEPOLICY_UNION +=\ - bluetooth.te \ - bootanim.te \ - device.te \ - file_contexts \ - file.te \ - gpsd.te \ - hostapd.te \ - mediaserver.te \ - netd.te \ - nfc.te \ - platform_app.te \ - radio.te \ - rild.te \ - service_contexts \ - servicemanager.te \ - surfaceflinger.te \ - system_app.te \ - system_server.te \ - ueventd.te \ - untrusted_app.te \ - vold.te \ - wpa.te +BOARD_SEPOLICY_DIRS += \device/samsung/n7100/sepolicy -- cgit v1.1 From d1034e1eb18f46b55632f4898eba4ce958564ba2 Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Fri, 20 Nov 2015 01:01:15 +0530 Subject: n7100: removed not required Doze overlays --- overlay/frameworks/base/core/res/res/values/config.xml | 4 ---- overlay/frameworks/base/packages/SystemUI/res/values/config.xml | 3 --- 2 files changed, 7 deletions(-) diff --git a/overlay/frameworks/base/core/res/res/values/config.xml b/overlay/frameworks/base/core/res/res/values/config.xml index 4dbefd7..a72d6d2 100644 --- a/overlay/frameworks/base/core/res/res/values/config.xml +++ b/overlay/frameworks/base/core/res/res/values/config.xml @@ -259,10 +259,6 @@ 20 true true - - true - - true 4 diff --git a/overlay/frameworks/base/packages/SystemUI/res/values/config.xml b/overlay/frameworks/base/packages/SystemUI/res/values/config.xml index 31e7533..49b1c81 100644 --- a/overlay/frameworks/base/packages/SystemUI/res/values/config.xml +++ b/overlay/frameworks/base/packages/SystemUI/res/values/config.xml @@ -28,8 +28,5 @@ true - - - 5 -- cgit v1.1 From 67b5d0dd835a116fdea3b219f4aa5d20fb72e08c Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Fri, 20 Nov 2015 01:03:11 +0530 Subject: n7100: Enable doze powersaving --- overlay/frameworks/base/core/res/res/values/config.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/overlay/frameworks/base/core/res/res/values/config.xml b/overlay/frameworks/base/core/res/res/values/config.xml index a72d6d2..bb482ed 100644 --- a/overlay/frameworks/base/core/res/res/values/config.xml +++ b/overlay/frameworks/base/core/res/res/values/config.xml @@ -294,4 +294,7 @@ true + + + true -- cgit v1.1 From 7dc38211588da183a67349d5814e342f5d57dd48 Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Fri, 20 Nov 2015 01:05:45 +0530 Subject: n7100: added longpress overlays --- .../frameworks/base/core/res/res/values/config.xml | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/overlay/frameworks/base/core/res/res/values/config.xml b/overlay/frameworks/base/core/res/res/values/config.xml index bb482ed..33fa5e0 100644 --- a/overlay/frameworks/base/core/res/res/values/config.xml +++ b/overlay/frameworks/base/core/res/res/values/config.xml @@ -245,6 +245,30 @@ config to 7. --> 65 + + 3 + + 2 + + + 0 + false -- cgit v1.1 From bf09a17aaeaa177a582d749d8c8d41db55b90927 Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Fri, 20 Nov 2015 12:09:44 +0530 Subject: n7100: removed few overlays --- overlay/frameworks/base/core/res/res/values/config.xml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/overlay/frameworks/base/core/res/res/values/config.xml b/overlay/frameworks/base/core/res/res/values/config.xml index 33fa5e0..82f0a86 100644 --- a/overlay/frameworks/base/core/res/res/values/config.xml +++ b/overlay/frameworks/base/core/res/res/values/config.xml @@ -269,9 +269,6 @@ policy/src/com/android/internal/policy/impl/PhoneWindowManager.java --> 0 - - false - true @@ -316,9 +313,6 @@ false - - true - true -- cgit v1.1 From b9382656be8e21727ba646340ca95255c7cda65d Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Sat, 21 Nov 2015 13:07:00 +0530 Subject: n7100: Update sepolicy for M --- sepolicy/bluetooth.te | 2 ++ sepolicy/device.te | 1 + sepolicy/file.te | 2 ++ sepolicy/gpsd.te | 3 ++- sepolicy/mediaserver.te | 3 +++ sepolicy/netd.te | 2 ++ sepolicy/nfc.te | 3 ++- sepolicy/rild.te | 2 +- sepolicy/servicemanager.te | 1 + sepolicy/shared_relro.te | 1 + sepolicy/system_server.te | 3 +++ sepolicy/untrusted_app.te | 5 +++++ sepolicy/vold.te | 1 + sepolicy/wpa.te | 1 + sepolicy/wpa_supplicant.te | 11 +++++++++++ sepolicy/zygote.te | 1 + 16 files changed, 39 insertions(+), 3 deletions(-) create mode 100644 sepolicy/shared_relro.te create mode 100644 sepolicy/wpa_supplicant.te create mode 100644 sepolicy/zygote.te diff --git a/sepolicy/bluetooth.te b/sepolicy/bluetooth.te index 7106722..d2dd05f 100644 --- a/sepolicy/bluetooth.te +++ b/sepolicy/bluetooth.te @@ -2,3 +2,5 @@ allow bluetooth firmware_exynos:dir { read open search }; allow bluetooth firmware_exynos:file { read open }; allow bluetooth bluetooth_efs_file:dir search; allow bluetooth bluetooth_efs_file:file read; +allow bluetooth sysfs:file write; +allow bluetooth efs_device_file:dir search; diff --git a/sepolicy/device.te b/sepolicy/device.te index ef8edbe..4d1980c 100644 --- a/sepolicy/device.te +++ b/sepolicy/device.te @@ -12,6 +12,7 @@ type rfkill_device, dev_type; # MFC device type mfc_device, dev_type; +type hpd_device, dev_type; # Fm radio device type fm_radio_device, dev_type; diff --git a/sepolicy/file.te b/sepolicy/file.te index 6ada8e6..a5fb225 100644 --- a/sepolicy/file.te +++ b/sepolicy/file.te @@ -10,4 +10,6 @@ type sensors_data_file, file_type, data_file_type; # Display sysfs type sysfs_display, fs_type, sysfs_type; +type efs_device_file, file_type; + diff --git a/sepolicy/gpsd.te b/sepolicy/gpsd.te index 309ab1a..9d588f3 100644 --- a/sepolicy/gpsd.te +++ b/sepolicy/gpsd.te @@ -1,7 +1,8 @@ allow gpsd rild:unix_stream_socket connectto; allow gpsd system_data_file:dir { add_name write }; -allow gpsd system_data_file:file { create write lock open }; +#allow gpsd system_data_file:file { create write lock open }; allow gpsd system_data_file:fifo_file { create read write open setattr }; +allow gpsd system_data_file:dir { read write setattr open add_name }; allow gpsd sysfs_wake_lock:file { read write open }; allow gpsd servicemanager:binder call; allow gpsd system_server:binder call; diff --git a/sepolicy/mediaserver.te b/sepolicy/mediaserver.te index 8d43cdb..0cfdc9c 100644 --- a/sepolicy/mediaserver.te +++ b/sepolicy/mediaserver.te @@ -1,3 +1,6 @@ allow mediaserver camera_data_file:file write; allow mediaserver mfc_device:chr_file { read write ioctl open }; allow mediaserver ump_device:chr_file { read write ioctl open }; + +# Bluetooth audio +allow mediaserver bluetooth:unix_stream_socket { connectto }; diff --git a/sepolicy/netd.te b/sepolicy/netd.te index ee1496b..30d6940 100644 --- a/sepolicy/netd.te +++ b/sepolicy/netd.te @@ -1 +1,3 @@ allow netd self:capability fsetid; +allow netd init:tcp_socket { read write getopt }; +allow netd log_device:chr_file { open write }; diff --git a/sepolicy/nfc.te b/sepolicy/nfc.te index 6a6e324..e1f83cb 100644 --- a/sepolicy/nfc.te +++ b/sepolicy/nfc.te @@ -1 +1,2 @@ -allow nfc firmware_exynos:dir search; +allow nfc firmware_camera:dir { search }; +allow nfc log_device:chr_file { write }; diff --git a/sepolicy/rild.te b/sepolicy/rild.te index 061742a..32f520c 100644 --- a/sepolicy/rild.te +++ b/sepolicy/rild.te @@ -1,3 +1,3 @@ allow rild self:process execmem; -allow rild system_data_file:dir { write remove_name add_name setattr }; +#allow rild system_data_file:dir { write remove_name add_name setattr }; allow rild system_data_file:file { write create unlink setattr }; diff --git a/sepolicy/servicemanager.te b/sepolicy/servicemanager.te index 3b3bda8..4f5475d 100644 --- a/sepolicy/servicemanager.te +++ b/sepolicy/servicemanager.te @@ -1,4 +1,5 @@ allow servicemanager gpsd:dir search; allow servicemanager gpsd:file { read open }; allow servicemanager gpsd:process getattr; +allow servicemanager log_device:chr_file { open write }; diff --git a/sepolicy/shared_relro.te b/sepolicy/shared_relro.te new file mode 100644 index 0000000..f7f75b3 --- /dev/null +++ b/sepolicy/shared_relro.te @@ -0,0 +1 @@ +allow shared_relro log_device:chr_file { write }; diff --git a/sepolicy/system_server.te b/sepolicy/system_server.te index f18517d..4b700e5 100644 --- a/sepolicy/system_server.te +++ b/sepolicy/system_server.te @@ -4,4 +4,7 @@ allow system_server sensors_data_file:file { read open }; allow system_server uhid_device:chr_file { read write ioctl open }; allow system_server ump_device:chr_file { read write ioctl open }; allow system_server gpsd:binder transfer; +allow system_server dex2oat_exec:file { execute execute_no_trans read open }; +allow system_server system_file:file { execmod }; +allow system_server self:capability sys_module; diff --git a/sepolicy/untrusted_app.te b/sepolicy/untrusted_app.te index adaf51a..a937288 100644 --- a/sepolicy/untrusted_app.te +++ b/sepolicy/untrusted_app.te @@ -1,2 +1,7 @@ allow untrusted_app ump_device:chr_file { open read write ioctl }; +allow untrusted_app block_device:dir { open read search }; +allow untrusted_app kernel:system { module_request }; +allow untrusted_app firmware_camera:dir { read getattr open }; +allow untrusted_app firmware_camera:file getattr; +allow untrusted_app firmware_mfc:file getattr; diff --git a/sepolicy/vold.te b/sepolicy/vold.te index 8068d38..1418d7a 100644 --- a/sepolicy/vold.te +++ b/sepolicy/vold.te @@ -1,2 +1,3 @@ allow vold efs_file:dir { read getattr open ioctl }; +allow vold boot_block_device:blk_file { read write open ioctl getattr }; diff --git a/sepolicy/wpa.te b/sepolicy/wpa.te index 4f5ef08..b44a49c 100644 --- a/sepolicy/wpa.te +++ b/sepolicy/wpa.te @@ -1 +1,2 @@ allow wpa rfkill_device:chr_file { read open }; +allow wpa log_device:chr_file { open write }; diff --git a/sepolicy/wpa_supplicant.te b/sepolicy/wpa_supplicant.te new file mode 100644 index 0000000..98fdc25 --- /dev/null +++ b/sepolicy/wpa_supplicant.te @@ -0,0 +1,11 @@ +allow wpa init:unix_dgram_socket { read write }; + +# logwrapper used with wpa_supplicant +allow wpa devpts:chr_file { read write }; + +allow wpa wpa_socket:unix_dgram_socket { read write }; +allow wpa_socket system_server:unix_dgram_socket sendto; + +allow wpa_socket wifi_data_file:sock_file unlink; +allow wpa rfkill_device:chr_file rw_file_perms; +allow wpa log_device:chr_file { open }; diff --git a/sepolicy/zygote.te b/sepolicy/zygote.te new file mode 100644 index 0000000..05c4d7d --- /dev/null +++ b/sepolicy/zygote.te @@ -0,0 +1 @@ +allow zygote log_device:chr_file { open }; -- cgit v1.1 From 92459fdb5380df316c9a41a2733376e0c486c1a3 Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Sat, 21 Nov 2015 13:19:17 +0530 Subject: n7100 : MM update for ril --- include/telephony/ril.h | 136 ++++++++++++++++++++- .../frameworks/base/core/res/res/values/config.xml | 4 +- 2 files changed, 132 insertions(+), 8 deletions(-) diff --git a/include/telephony/ril.h b/include/telephony/ril.h index 5514977..1b0374a 100644 --- a/include/telephony/ril.h +++ b/include/telephony/ril.h @@ -101,7 +101,7 @@ typedef enum { RIL_E_ILLEGAL_SIM_OR_ME = 15, /* network selection failed due to illegal SIM or ME */ RIL_E_MISSING_RESOURCE = 16, /* no logical channel available */ - RIL_E_NO_SUCH_ELEMENT = 17, /* application not found on SIM */ + RIL_E_NO_SUCH_ELEMENT = 17, /* application not found on SIM */ RIL_E_DIAL_MODIFIED_TO_USSD = 18, /* DIAL request modified to USSD */ RIL_E_DIAL_MODIFIED_TO_SS = 19, /* DIAL request modified to SS */ RIL_E_DIAL_MODIFIED_TO_DIAL = 20, /* DIAL request modified to DIAL with different @@ -113,7 +113,8 @@ typedef enum { RIL_E_SS_MODIFIED_TO_DIAL = 24, /* SS request modified to DIAL */ RIL_E_SS_MODIFIED_TO_USSD = 25, /* SS request modified to USSD */ RIL_E_SUBSCRIPTION_NOT_SUPPORTED = 26, /* Subscription not supported by RIL */ - RIL_E_SS_MODIFIED_TO_SS = 27 /* SS request modified to different SS request */ + RIL_E_SS_MODIFIED_TO_SS = 27, /* SS request modified to different SS request */ + RIL_E_LCE_NOT_SUPPORTED = 36 /* LCE service not supported(36 in RILConstants.java) */ } RIL_Errno; @@ -162,7 +163,8 @@ typedef enum { RADIO_TECH_LTE = 14, RADIO_TECH_HSPAP = 15, // HSPA+ RADIO_TECH_GSM = 16, // Only supports voice - RADIO_TECH_TD_SCDMA = 17 + RADIO_TECH_TD_SCDMA = 17, + RADIO_TECH_IWLAN = 18 } RIL_RadioTechnology; typedef enum { @@ -565,6 +567,27 @@ typedef struct { */ } RIL_NeighboringCell; +typedef struct { + char lce_status; /* LCE service status: + * -1 = not supported; + * 0 = stopped; + * 1 = active. + */ + unsigned int actual_interval_ms; /* actual LCE reporting interval, + * meaningful only if LCEStatus = 1. + */ +} RIL_LceStatusInfo; + +typedef struct { + unsigned int last_hop_capacity_kbps; /* last-hop cellular capacity: kilobits/second. */ + unsigned char confidence_level; /* capacity estimate confidence: 0-100 */ + unsigned char lce_suspended; /* LCE report going to be suspended? (e.g., radio + * moves to inactive state or network type change) + * 1 = suspended; + * 0 = not suspended. + */ +} RIL_LceDataInfo; + /* See RIL_REQUEST_LAST_CALL_FAIL_CAUSE */ typedef enum { CALL_FAIL_UNOBTAINABLE_NUMBER = 1, @@ -593,6 +616,11 @@ typedef enum { CALL_FAIL_ERROR_UNSPECIFIED = 0xffff } RIL_LastCallFailCause; +typedef struct { + RIL_LastCallFailCause cause_code; + char * vendor_cause; +} RIL_LastCallFailCauseInfo; + /* See RIL_REQUEST_LAST_DATA_CALL_FAIL_CAUSE */ typedef enum { PDP_FAIL_NONE = 0, /* No error, connection ok */ @@ -1393,6 +1421,24 @@ typedef struct { int enabled; } RIL_DataProfileInfo; +/* Tx Power Levels */ +#define RIL_NUM_TX_POWER_LEVELS 5 + +typedef struct { + + /* period (in ms) when modem is power collapsed */ + uint32_t sleep_mode_time_ms; + + /* period (in ms) when modem is awake and in idle mode*/ + uint32_t idle_mode_time_ms; + + /* period (in ms) for which Tx is active */ + uint32_t tx_mode_time_ms[RIL_NUM_TX_POWER_LEVELS]; + + /* period (in ms) for which Rx is active */ + uint32_t rx_mode_time_ms; +} RIL_ActivityStatsInfo; + /** * RIL_REQUEST_GET_SIM_STATUS * @@ -4252,6 +4298,7 @@ typedef struct { /** * RIL_REQUEST_GET_DC_RT_INFO * + * The request is DEPRECATED, use RIL_REQUEST_GET_ACTIVITY_INFO * Requests the Data Connection Real Time Info * * "data" is NULL @@ -4270,6 +4317,7 @@ typedef struct { /** * RIL_REQUEST_SET_DC_RT_INFO_RATE * + * The request is DEPRECATED * This is the minimum number of milliseconds between successive * RIL_UNSOL_DC_RT_INFO_CHANGED messages and defines the highest rate * at which RIL_UNSOL_DC_RT_INFO_CHANGED's will be sent. A value of @@ -4322,9 +4370,7 @@ typedef struct { * * Used to get phone radio capablility. * - * "data" is int * - * ((int *)data)[0] is the phone radio access family defined in - * RadioAccessFamily. It's a bit mask value to represent the support type. + * "data" is the RIL_RadioCapability structure * * Valid errors: * SUCCESS @@ -4352,6 +4398,73 @@ typedef struct { */ #define RIL_REQUEST_SET_RADIO_CAPABILITY 131 +/** + * RIL_REQUEST_START_LCE + * + * Start Link Capacity Estimate (LCE) service if supported by the radio. + * + * "data" is const int * + * ((const int*)data)[0] specifies the desired reporting interval (ms). + * ((const int*)data)[1] specifies the LCE service mode. 1: PULL; 0: PUSH. + * + * "response" is the RIL_LceStatusInfo. + * + * Valid errors: + * SUCCESS + * RADIO_NOT_AVAILABLE + * LCE_NOT_SUPPORTED + */ +#define RIL_REQUEST_START_LCE 132 + +/** + * RIL_REQUEST_STOP_LCE + * + * Stop Link Capacity Estimate (LCE) service, the STOP operation should be + * idempotent for the radio modem. + * + * "response" is the RIL_LceStatusInfo. + * + * Valid errors: + * SUCCESS + * RADIO_NOT_AVAILABLE + * LCE_NOT_SUPPORTED + */ +#define RIL_REQUEST_STOP_LCE 133 + +/** + * RIL_REQUEST_PULL_LCEDATA + * + * Pull LCE service for capacity information. + * + * "response" is the RIL_LceDataInfo. + * + * Valid errors: + * SUCCESS + * RADIO_NOT_AVAILABLE + * LCE_NOT_SUPPORTED + */ +#define RIL_REQUEST_PULL_LCEDATA 134 + +/** + * RIL_REQUEST_GET_ACTIVITY_INFO + * + * Get modem activity statisitics info. + * + * There can be multiple RIL_REQUEST_GET_ACTIVITY_INFO calls to modem. + * Once the response for the request is sent modem will clear + * current statistics information. + * + * "data" is null + * "response" is const RIL_ActivityStatsInfo * + * + * Valid errors: + * + * SUCCESS + * RADIO_NOT_AVAILABLE (radio resetting) + * GENERIC_FAILURE + */ +#define RIL_REQUEST_GET_ACTIVITY_INFO 135 + /* SAMSUNG REQUESTS */ #undef RIL_REQUEST_SIM_OPEN_CHANNEL #undef RIL_REQUEST_SIM_CLOSE_CHANNEL @@ -4953,6 +5066,7 @@ typedef struct { /** * RIL_UNSOL_DC_RT_INFO_CHANGED * + * The message is DEPRECATED, use RIL_REQUEST_GET_ACTIVITY_INFO * Sent when the DC_RT_STATE changes but the time * between these messages must not be less than the * value set by RIL_REQUEST_SET_DC_RT_RATE. @@ -4995,6 +5109,16 @@ typedef struct { */ #define RIL_UNSOL_STK_CC_ALPHA_NOTIFY 1044 +/** + * RIL_UNSOL_LCEDATA_RECV + * + * Called when there is an incoming Link Capacity Estimate (LCE) info report. + * + * "data" is the RIL_LceDataInfo structure. + * + */ +#define RIL_UNSOL_LCEDATA_RECV 1045 + /* SAMSUNG RESPONSE */ #define SAMSUNG_UNSOL_RESPONSE_BASE 11000 diff --git a/overlay/frameworks/base/core/res/res/values/config.xml b/overlay/frameworks/base/core/res/res/values/config.xml index 82f0a86..c432e22 100644 --- a/overlay/frameworks/base/core/res/res/values/config.xml +++ b/overlay/frameworks/base/core/res/res/values/config.xml @@ -269,8 +269,8 @@ policy/src/com/android/internal/policy/impl/PhoneWindowManager.java --> 0 - - true + true -- cgit v1.1 From c2a505be07cf27f1235ae976310083ae1c75046a Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Sat, 21 Nov 2015 16:33:47 +0530 Subject: n7100: sepolicy fixes --- sepolicy/nfc.te | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sepolicy/nfc.te b/sepolicy/nfc.te index e1f83cb..99b86bd 100644 --- a/sepolicy/nfc.te +++ b/sepolicy/nfc.te @@ -1,2 +1,2 @@ -allow nfc firmware_camera:dir { search }; +allow nfc firmware_camera:dir search; allow nfc log_device:chr_file { write }; -- cgit v1.1 From 41701ea291c5586ec426650ecd6ff09ae1cd5d3a Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Mon, 23 Nov 2015 09:16:21 +0530 Subject: n7100: added SamsungExynos4RIL to the device --- BoardConfig.mk | 2 +- .../internal/telephony/SamsungExynos4RIL.java | 478 +++++++++++++++++++++ 2 files changed, 479 insertions(+), 1 deletion(-) create mode 100644 ril/telephony/java/com/android/internal/telephony/SamsungExynos4RIL.java diff --git a/BoardConfig.mk b/BoardConfig.mk index a7e016f..c3f92ed 100644 --- a/BoardConfig.mk +++ b/BoardConfig.mk @@ -22,7 +22,7 @@ # RIL BOARD_PROVIDES_LIBRIL := true BOARD_MODEM_TYPE := xmm6262 -BOARD_RIL_CLASS := ../../../hardware/samsung/ril +BOARD_RIL_CLASS := ../../../device/samsung/n7100/ril TARGET_SPECIFIC_HEADER_PATH := device/samsung/n7100/include # Bluetooth diff --git a/ril/telephony/java/com/android/internal/telephony/SamsungExynos4RIL.java b/ril/telephony/java/com/android/internal/telephony/SamsungExynos4RIL.java new file mode 100644 index 0000000..7d31a69 --- /dev/null +++ b/ril/telephony/java/com/android/internal/telephony/SamsungExynos4RIL.java @@ -0,0 +1,478 @@ +/* + * Copyright (C) 2011 The CyanogenMod 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. + */ + +package com.android.internal.telephony; + +import static com.android.internal.telephony.RILConstants.*; + +import android.content.Context; +import android.os.AsyncResult; +import android.os.Handler; +import android.os.HandlerThread; +import android.os.Looper; +import android.os.Message; +import android.os.Parcel; +import android.os.Registrant; +import android.text.TextUtils; +import android.telephony.Rlog; + +import android.telephony.PhoneNumberUtils; + +import java.util.ArrayList; + +public class SamsungExynos4RIL extends RIL implements CommandsInterface { + + //SAMSUNG STATES + static final int RIL_REQUEST_GET_CELL_BROADCAST_CONFIG = 10002; + + static final int RIL_REQUEST_SEND_ENCODED_USSD = 10005; + static final int RIL_REQUEST_SET_PDA_MEMORY_STATUS = 10006; + static final int RIL_REQUEST_GET_PHONEBOOK_STORAGE_INFO = 10007; + static final int RIL_REQUEST_GET_PHONEBOOK_ENTRY = 10008; + static final int RIL_REQUEST_ACCESS_PHONEBOOK_ENTRY = 10009; + static final int RIL_REQUEST_DIAL_VIDEO_CALL = 10010; + static final int RIL_REQUEST_CALL_DEFLECTION = 10011; + static final int RIL_REQUEST_READ_SMS_FROM_SIM = 10012; + static final int RIL_REQUEST_USIM_PB_CAPA = 10013; + static final int RIL_REQUEST_LOCK_INFO = 10014; + + static final int RIL_REQUEST_DIAL_EMERGENCY = 10016; + static final int RIL_REQUEST_GET_STOREAD_MSG_COUNT = 10017; + static final int RIL_REQUEST_STK_SIM_INIT_EVENT = 10018; + static final int RIL_REQUEST_GET_LINE_ID = 10019; + static final int RIL_REQUEST_SET_LINE_ID = 10020; + static final int RIL_REQUEST_GET_SERIAL_NUMBER = 10021; + static final int RIL_REQUEST_GET_MANUFACTURE_DATE_NUMBER = 10022; + static final int RIL_REQUEST_GET_BARCODE_NUMBER = 10023; + static final int RIL_REQUEST_UICC_GBA_AUTHENTICATE_BOOTSTRAP = 10024; + static final int RIL_REQUEST_UICC_GBA_AUTHENTICATE_NAF = 10025; + static final int RIL_REQUEST_SIM_TRANSMIT_BASIC = 10026; + static final int RIL_REQUEST_SIM_OPEN_CHANNEL = 10027; + static final int RIL_REQUEST_SIM_CLOSE_CHANNEL = 10028; + static final int RIL_REQUEST_SIM_TRANSMIT_CHANNEL = 10029; + static final int RIL_REQUEST_SIM_AUTH = 10030; + static final int RIL_REQUEST_PS_ATTACH = 10031; + static final int RIL_REQUEST_PS_DETACH = 10032; + static final int RIL_REQUEST_ACTIVATE_DATA_CALL = 10033; + static final int RIL_REQUEST_CHANGE_SIM_PERSO = 10034; + static final int RIL_REQUEST_ENTER_SIM_PERSO = 10035; + static final int RIL_REQUEST_GET_TIME_INFO = 10036; + static final int RIL_REQUEST_OMADM_SETUP_SESSION = 10037; + static final int RIL_REQUEST_OMADM_SERVER_START_SESSION = 10038; + static final int RIL_REQUEST_OMADM_CLIENT_START_SESSION = 10039; + static final int RIL_REQUEST_OMADM_SEND_DATA = 10040; + static final int RIL_REQUEST_CDMA_GET_DATAPROFILE = 10041; + static final int RIL_REQUEST_CDMA_SET_DATAPROFILE = 10042; + static final int RIL_REQUEST_CDMA_GET_SYSTEMPROPERTIES = 10043; + static final int RIL_REQUEST_CDMA_SET_SYSTEMPROPERTIES = 10044; + static final int RIL_REQUEST_SEND_SMS_COUNT = 10045; + static final int RIL_REQUEST_SEND_SMS_MSG = 10046; + static final int RIL_REQUEST_SEND_SMS_MSG_READ_STATUS = 10047; + static final int RIL_REQUEST_MODEM_HANGUP = 10048; + static final int RIL_REQUEST_SET_SIM_POWER = 10049; + static final int RIL_REQUEST_SET_PREFERRED_NETWORK_LIST = 10050; + static final int RIL_REQUEST_GET_PREFERRED_NETWORK_LIST = 10051; + static final int RIL_REQUEST_HANGUP_VT = 10052; + + static final int RIL_UNSOL_RELEASE_COMPLETE_MESSAGE = 11001; + static final int RIL_UNSOL_STK_SEND_SMS_RESULT = 11002; + static final int RIL_UNSOL_STK_CALL_CONTROL_RESULT = 11003; + static final int RIL_UNSOL_DUN_CALL_STATUS = 11004; + + static final int RIL_UNSOL_O2_HOME_ZONE_INFO = 11007; + static final int RIL_UNSOL_DEVICE_READY_NOTI = 11008; + static final int RIL_UNSOL_GPS_NOTI = 11009; + static final int RIL_UNSOL_AM = 11010; + static final int RIL_UNSOL_DUN_PIN_CONTROL_SIGNAL = 11011; + static final int RIL_UNSOL_DATA_SUSPEND_RESUME = 11012; + static final int RIL_UNSOL_SAP = 11013; + + static final int RIL_UNSOL_SIM_SMS_STORAGE_AVAILALE = 11015; + static final int RIL_UNSOL_HSDPA_STATE_CHANGED = 11016; + static final int RIL_UNSOL_WB_AMR_STATE = 11017; + static final int RIL_UNSOL_TWO_MIC_STATE = 11018; + static final int RIL_UNSOL_DHA_STATE = 11019; + static final int RIL_UNSOL_UART = 11020; + static final int RIL_UNSOL_RESPONSE_HANDOVER = 11021; + static final int RIL_UNSOL_IPV6_ADDR = 11022; + static final int RIL_UNSOL_NWK_INIT_DISC_REQUEST = 11023; + static final int RIL_UNSOL_RTS_INDICATION = 11024; + static final int RIL_UNSOL_OMADM_SEND_DATA = 11025; + static final int RIL_UNSOL_DUN = 11026; + static final int RIL_UNSOL_SYSTEM_REBOOT = 11027; + static final int RIL_UNSOL_VOICE_PRIVACY_CHANGED = 11028; + static final int RIL_UNSOL_UTS_GETSMSCOUNT = 11029; + static final int RIL_UNSOL_UTS_GETSMSMSG = 11030; + static final int RIL_UNSOL_UTS_GET_UNREAD_SMS_STATUS = 11031; + static final int RIL_UNSOL_MIP_CONNECT_STATUS = 11032; + + private Object mCatProCmdBuffer; + /* private Message mPendingGetSimStatus; */ + + public SamsungExynos4RIL(Context context, int networkMode, int cdmaSubscription, Integer instanceId) { + super(context, networkMode, cdmaSubscription, instanceId); + mQANElements = 5; + } + + static String + requestToString(int request) { + switch (request) { + case RIL_REQUEST_DIAL_EMERGENCY: return "DIAL_EMERGENCY"; + default: return RIL.requestToString(request); + } + } + + @Override + protected RILRequest processSolicited (Parcel p) { + int serial, error; + boolean found = false; + + serial = p.readInt(); + error = p.readInt(); + + RILRequest rr; + + rr = findAndRemoveRequestFromList(serial); + + if (rr == null) { + Rlog.w(RILJ_LOG_TAG, "Unexpected solicited response! sn: " + + serial + " error: " + error); + return null; + } + + Object ret = null; + + if (error == 0 || p.dataAvail() > 0) { + // either command succeeds or command fails but with data payload + try {switch (rr.mRequest) { + /* + cat libs/telephony/ril_commands.h \ + | egrep "^ *{RIL_" \ + | sed -re 's/\{([^,]+),[^,]+,([^}]+).+/case \1: ret = \2(p); break;/' + */ + case RIL_REQUEST_GET_SIM_STATUS: ret = responseIccCardStatus(p); break; + case RIL_REQUEST_ENTER_SIM_PIN: ret = responseInts(p); break; + case RIL_REQUEST_ENTER_SIM_PUK: ret = responseInts(p); break; + case RIL_REQUEST_ENTER_SIM_PIN2: ret = responseInts(p); break; + case RIL_REQUEST_ENTER_SIM_PUK2: ret = responseInts(p); break; + case RIL_REQUEST_CHANGE_SIM_PIN: ret = responseInts(p); break; + case RIL_REQUEST_CHANGE_SIM_PIN2: ret = responseInts(p); break; + case RIL_REQUEST_ENTER_NETWORK_DEPERSONALIZATION: ret = responseInts(p); break; + case RIL_REQUEST_GET_CURRENT_CALLS: ret = responseCallList(p); break; + case RIL_REQUEST_DIAL: ret = responseVoid(p); break; + case RIL_REQUEST_DIAL_EMERGENCY: ret = responseVoid(p); break; + case RIL_REQUEST_GET_IMSI: ret = responseString(p); break; + case RIL_REQUEST_HANGUP: ret = responseVoid(p); break; + case RIL_REQUEST_HANGUP_WAITING_OR_BACKGROUND: ret = responseVoid(p); break; + case RIL_REQUEST_HANGUP_FOREGROUND_RESUME_BACKGROUND: { + if (mTestingEmergencyCall.getAndSet(false)) { + if (mEmergencyCallbackModeRegistrant != null) { + riljLog("testing emergency call, notify ECM Registrants"); + mEmergencyCallbackModeRegistrant.notifyRegistrant(); + } + } + ret = responseVoid(p); + break; + } + case RIL_REQUEST_SWITCH_WAITING_OR_HOLDING_AND_ACTIVE: ret = responseVoid(p); break; + case RIL_REQUEST_CONFERENCE: ret = responseVoid(p); break; + case RIL_REQUEST_UDUB: ret = responseVoid(p); break; + case RIL_REQUEST_LAST_CALL_FAIL_CAUSE: ret = responseInts(p); break; + case RIL_REQUEST_SIGNAL_STRENGTH: ret = responseSignalStrength(p); break; + case RIL_REQUEST_VOICE_REGISTRATION_STATE: ret = responseStrings(p); break; + case RIL_REQUEST_DATA_REGISTRATION_STATE: ret = responseStrings(p); break; + case RIL_REQUEST_OPERATOR: ret = responseStrings(p); break; + case RIL_REQUEST_RADIO_POWER: ret = responseVoid(p); break; + case RIL_REQUEST_DTMF: ret = responseVoid(p); break; + case RIL_REQUEST_SEND_SMS: ret = responseSMS(p); break; + case RIL_REQUEST_SEND_SMS_EXPECT_MORE: ret = responseSMS(p); break; + case RIL_REQUEST_SETUP_DATA_CALL: ret = responseSetupDataCall(p); break; + case RIL_REQUEST_SIM_IO: ret = responseICC_IO(p); break; + case RIL_REQUEST_SEND_USSD: ret = responseVoid(p); break; + case RIL_REQUEST_CANCEL_USSD: ret = responseVoid(p); break; + case RIL_REQUEST_GET_CLIR: ret = responseInts(p); break; + case RIL_REQUEST_SET_CLIR: ret = responseVoid(p); break; + case RIL_REQUEST_QUERY_CALL_FORWARD_STATUS: ret = responseCallForward(p); break; + case RIL_REQUEST_SET_CALL_FORWARD: ret = responseVoid(p); break; + case RIL_REQUEST_QUERY_CALL_WAITING: ret = responseInts(p); break; + case RIL_REQUEST_SET_CALL_WAITING: ret = responseVoid(p); break; + case RIL_REQUEST_SMS_ACKNOWLEDGE: ret = responseVoid(p); break; + case RIL_REQUEST_GET_IMEI: ret = responseString(p); break; + case RIL_REQUEST_GET_IMEISV: ret = responseString(p); break; + case RIL_REQUEST_ANSWER: ret = responseVoid(p); break; + case RIL_REQUEST_DEACTIVATE_DATA_CALL: ret = responseVoid(p); break; + case RIL_REQUEST_QUERY_FACILITY_LOCK: ret = responseInts(p); break; + case RIL_REQUEST_SET_FACILITY_LOCK: ret = responseInts(p); break; + case RIL_REQUEST_CHANGE_BARRING_PASSWORD: ret = responseVoid(p); break; + case RIL_REQUEST_QUERY_NETWORK_SELECTION_MODE: ret = responseInts(p); break; + case RIL_REQUEST_SET_NETWORK_SELECTION_AUTOMATIC: ret = responseVoid(p); break; + case RIL_REQUEST_SET_NETWORK_SELECTION_MANUAL: ret = responseVoid(p); break; + case RIL_REQUEST_QUERY_AVAILABLE_NETWORKS : ret = responseOperatorInfos(p); break; + case RIL_REQUEST_DTMF_START: ret = responseVoid(p); break; + case RIL_REQUEST_DTMF_STOP: ret = responseVoid(p); break; + case RIL_REQUEST_BASEBAND_VERSION: ret = responseString(p); break; + case RIL_REQUEST_SEPARATE_CONNECTION: ret = responseVoid(p); break; + case RIL_REQUEST_SET_MUTE: ret = responseVoid(p); break; + case RIL_REQUEST_GET_MUTE: ret = responseInts(p); break; + case RIL_REQUEST_QUERY_CLIP: ret = responseInts(p); break; + case RIL_REQUEST_LAST_DATA_CALL_FAIL_CAUSE: ret = responseInts(p); break; + case RIL_REQUEST_DATA_CALL_LIST: ret = responseDataCallList(p); break; + case RIL_REQUEST_RESET_RADIO: ret = responseVoid(p); break; + case RIL_REQUEST_OEM_HOOK_RAW: ret = responseRaw(p); break; + case RIL_REQUEST_OEM_HOOK_STRINGS: ret = responseStrings(p); break; + case RIL_REQUEST_SCREEN_STATE: ret = responseVoid(p); break; + case RIL_REQUEST_SET_SUPP_SVC_NOTIFICATION: ret = responseVoid(p); break; + case RIL_REQUEST_WRITE_SMS_TO_SIM: ret = responseInts(p); break; + case RIL_REQUEST_DELETE_SMS_ON_SIM: ret = responseVoid(p); break; + case RIL_REQUEST_SET_BAND_MODE: ret = responseVoid(p); break; + case RIL_REQUEST_QUERY_AVAILABLE_BAND_MODE: ret = responseInts(p); break; + case RIL_REQUEST_STK_GET_PROFILE: ret = responseString(p); break; + case RIL_REQUEST_STK_SET_PROFILE: ret = responseVoid(p); break; + case RIL_REQUEST_STK_SEND_ENVELOPE_COMMAND: ret = responseString(p); break; + case RIL_REQUEST_STK_SEND_TERMINAL_RESPONSE: ret = responseVoid(p); break; + case RIL_REQUEST_STK_HANDLE_CALL_SETUP_REQUESTED_FROM_SIM: ret = responseInts(p); break; + case RIL_REQUEST_EXPLICIT_CALL_TRANSFER: ret = responseVoid(p); break; + case RIL_REQUEST_SET_PREFERRED_NETWORK_TYPE: ret = responseVoid(p); break; + case RIL_REQUEST_GET_PREFERRED_NETWORK_TYPE: ret = responseGetPreferredNetworkType(p); break; + case RIL_REQUEST_GET_NEIGHBORING_CELL_IDS: ret = responseCellList(p); break; + case RIL_REQUEST_SET_LOCATION_UPDATES: ret = responseVoid(p); break; + case RIL_REQUEST_CDMA_SET_SUBSCRIPTION_SOURCE: ret = responseVoid(p); break; + case RIL_REQUEST_CDMA_SET_ROAMING_PREFERENCE: ret = responseVoid(p); break; + case RIL_REQUEST_CDMA_QUERY_ROAMING_PREFERENCE: ret = responseInts(p); break; + case RIL_REQUEST_SET_TTY_MODE: ret = responseVoid(p); break; + case RIL_REQUEST_QUERY_TTY_MODE: ret = responseInts(p); break; + case RIL_REQUEST_CDMA_SET_PREFERRED_VOICE_PRIVACY_MODE: ret = responseVoid(p); break; + case RIL_REQUEST_CDMA_QUERY_PREFERRED_VOICE_PRIVACY_MODE: ret = responseInts(p); break; + case RIL_REQUEST_CDMA_FLASH: ret = responseVoid(p); break; + case RIL_REQUEST_CDMA_BURST_DTMF: ret = responseVoid(p); break; + case RIL_REQUEST_CDMA_SEND_SMS: ret = responseSMS(p); break; + case RIL_REQUEST_CDMA_SMS_ACKNOWLEDGE: ret = responseVoid(p); break; + case RIL_REQUEST_GSM_GET_BROADCAST_CONFIG: ret = responseGmsBroadcastConfig(p); break; + case RIL_REQUEST_GSM_SET_BROADCAST_CONFIG: ret = responseVoid(p); break; + case RIL_REQUEST_GSM_BROADCAST_ACTIVATION: ret = responseVoid(p); break; + case RIL_REQUEST_CDMA_GET_BROADCAST_CONFIG: ret = responseCdmaBroadcastConfig(p); break; + case RIL_REQUEST_CDMA_SET_BROADCAST_CONFIG: ret = responseVoid(p); break; + case RIL_REQUEST_CDMA_BROADCAST_ACTIVATION: ret = responseVoid(p); break; + case RIL_REQUEST_CDMA_VALIDATE_AND_WRITE_AKEY: ret = responseVoid(p); break; + case RIL_REQUEST_CDMA_SUBSCRIPTION: ret = responseStrings(p); break; + case RIL_REQUEST_CDMA_WRITE_SMS_TO_RUIM: ret = responseInts(p); break; + case RIL_REQUEST_CDMA_DELETE_SMS_ON_RUIM: ret = responseVoid(p); break; + case RIL_REQUEST_DEVICE_IDENTITY: ret = responseStrings(p); break; + case RIL_REQUEST_GET_SMSC_ADDRESS: ret = responseString(p); break; + case RIL_REQUEST_SET_SMSC_ADDRESS: ret = responseVoid(p); break; + case RIL_REQUEST_EXIT_EMERGENCY_CALLBACK_MODE: ret = responseVoid(p); break; + case RIL_REQUEST_REPORT_SMS_MEMORY_STATUS: ret = responseVoid(p); break; + case RIL_REQUEST_REPORT_STK_SERVICE_IS_RUNNING: ret = responseVoid(p); break; + case RIL_REQUEST_CDMA_GET_SUBSCRIPTION_SOURCE: ret = responseInts(p); break; + case RIL_REQUEST_ISIM_AUTHENTICATION: ret = responseString(p); break; + case RIL_REQUEST_ACKNOWLEDGE_INCOMING_GSM_SMS_WITH_PDU: ret = responseVoid(p); break; + case RIL_REQUEST_STK_SEND_ENVELOPE_WITH_STATUS: ret = responseICC_IO(p); break; + case RIL_REQUEST_VOICE_RADIO_TECH: ret = responseInts(p); break; + default: + throw new RuntimeException("Unrecognized solicited response: " + rr.mRequest); + //break; + }} catch (Throwable tr) { + // Exceptions here usually mean invalid RIL responses + + Rlog.w(RILJ_LOG_TAG, rr.serialString() + "< " + + requestToString(rr.mRequest) + + " exception, possible invalid RIL response", tr); + + if (rr.mResult != null) { + AsyncResult.forMessage(rr.mResult, null, tr); + rr.mResult.sendToTarget(); + } + return rr; + } + } + + // Here and below fake RIL_UNSOL_RESPONSE_SIM_STATUS_CHANGED, see b/7255789. + // This is needed otherwise we don't automatically transition to the main lock + // screen when the pin or puk is entered incorrectly. + switch (rr.mRequest) { + case RIL_REQUEST_ENTER_SIM_PUK: + case RIL_REQUEST_ENTER_SIM_PUK2: + if (mIccStatusChangedRegistrants != null) { + if (RILJ_LOGD) { + riljLog("ON enter sim puk fakeSimStatusChanged: reg count=" + + mIccStatusChangedRegistrants.size()); + } + mIccStatusChangedRegistrants.notifyRegistrants(); + } + break; + } + + if (error != 0) { + switch (rr.mRequest) { + case RIL_REQUEST_ENTER_SIM_PIN: + case RIL_REQUEST_ENTER_SIM_PIN2: + case RIL_REQUEST_CHANGE_SIM_PIN: + case RIL_REQUEST_CHANGE_SIM_PIN2: + case RIL_REQUEST_SET_FACILITY_LOCK: + if (mIccStatusChangedRegistrants != null) { + if (RILJ_LOGD) { + riljLog("ON some errors fakeSimStatusChanged: reg count=" + + mIccStatusChangedRegistrants.size()); + } + mIccStatusChangedRegistrants.notifyRegistrants(); + } + break; + } + + rr.onError(error, ret); + return rr; + } + + if (RILJ_LOGD) riljLog(rr.serialString() + "< " + requestToString(rr.mRequest) + + " " + retToString(rr.mRequest, ret)); + + if (rr.mResult != null) { + AsyncResult.forMessage(rr.mResult, ret, null); + rr.mResult.sendToTarget(); + } + + return rr; + } + + @Override + public void + dial(String address, int clirMode, UUSInfo uusInfo, Message result) { + RILRequest rr; + if (PhoneNumberUtils.isEmergencyNumber(address)) { + dialEmergencyCall(address, clirMode, result); + return; + } + + rr = RILRequest.obtain(RIL_REQUEST_DIAL, result); + rr.mParcel.writeString(address); + rr.mParcel.writeInt(clirMode); + + if (uusInfo == null) { + rr.mParcel.writeInt(0); // UUS information is absent + } else { + rr.mParcel.writeInt(1); // UUS information is present + rr.mParcel.writeInt(uusInfo.getType()); + rr.mParcel.writeInt(uusInfo.getDcs()); + rr.mParcel.writeByteArray(uusInfo.getUserData()); + } + + if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)); + + send(rr); + } + +/* @Override + public void + getIccCardStatus(Message result) { + if (mState != RadioState.RADIO_ON) { + mPendingGetSimStatus = result; + } else { + super.getIccCardStatus(result); + } + } + @Override + protected void + switchToRadioState(RadioState newState) { + super.switchToRadioState(newState); + if (newState == RadioState.RADIO_ON && mPendingGetSimStatus != null) { + super.getIccCardStatus(mPendingGetSimStatus); + mPendingGetSimStatus = null; + } + }*/ + + public void + dialEmergencyCall(String address, int clirMode, Message result) { + RILRequest rr; + Rlog.v(RILJ_LOG_TAG, "Emergency dial: " + address); + + rr = RILRequest.obtain(RIL_REQUEST_DIAL_EMERGENCY, result); + rr.mParcel.writeString(address + "/"); + rr.mParcel.writeInt(clirMode); + rr.mParcel.writeInt(0); // UUS information is absent + + if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)); + + send(rr); + } + + @Override + protected void + processUnsolicited (Parcel p) { + int dataPosition = p.dataPosition(); + int response = p.readInt(); + + switch(response) { + case RIL_UNSOL_STK_PROACTIVE_COMMAND: + Object ret = responseString(p); + if (RILJ_LOGD) unsljLogRet(response, ret); + + if (mCatProCmdRegistrant != null) { + mCatProCmdRegistrant.notifyRegistrant( + new AsyncResult (null, ret, null)); + } else { + // The RIL will send a CAT proactive command before the + // registrant is registered. Buffer it to make sure it + // does not get ignored (and breaks CatService). + mCatProCmdBuffer = ret; + } + break; + + default: + // Rewind the Parcel + p.setDataPosition(dataPosition); + + // Forward responses that we are not overriding to the super class + super.processUnsolicited(p); + return; + } + + } + + @Override + public void setOnCatProactiveCmd(Handler h, int what, Object obj) { + mCatProCmdRegistrant = new Registrant (h, what, obj); + if (mCatProCmdBuffer != null) { + mCatProCmdRegistrant.notifyRegistrant( + new AsyncResult (null, mCatProCmdBuffer, null)); + mCatProCmdBuffer = null; + } + } + + private void + constructGsmSendSmsRilRequest (RILRequest rr, String smscPDU, String pdu) { + rr.mParcel.writeInt(2); + rr.mParcel.writeString(smscPDU); + rr.mParcel.writeString(pdu); + } + + /** + * The RIL can't handle the RIL_REQUEST_SEND_SMS_EXPECT_MORE + * request properly, so we use RIL_REQUEST_SEND_SMS instead. + */ + @Override + public void + sendSMSExpectMore (String smscPDU, String pdu, Message result) { + RILRequest rr + = RILRequest.obtain(RIL_REQUEST_SEND_SMS, result); + + constructGsmSendSmsRilRequest(rr, smscPDU, pdu); + + if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)); + + send(rr); + } + +} -- cgit v1.1 From 6bbc19ed681347d9f4c271c5d874a22be36ba052 Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Thu, 26 Nov 2015 03:24:27 -0800 Subject: n7100: temporarily remove sepolicy --- BoardConfig.mk | 3 --- sepolicy/bluetooth.te | 6 ----- sepolicy/bootanim.te | 1 - sepolicy/device.te | 22 ----------------- sepolicy/file.te | 15 ------------ sepolicy/file_contexts | 60 ---------------------------------------------- sepolicy/gpsd.te | 10 -------- sepolicy/hostapd.te | 1 - sepolicy/mediaserver.te | 6 ----- sepolicy/netd.te | 3 --- sepolicy/nfc.te | 2 -- sepolicy/platform_app.te | 1 - sepolicy/radio.te | 2 -- sepolicy/rild.te | 3 --- sepolicy/service_contexts | 2 -- sepolicy/servicemanager.te | 5 ---- sepolicy/shared_relro.te | 1 - sepolicy/surfaceflinger.te | 1 - sepolicy/system_app.te | 3 --- sepolicy/system_server.te | 10 -------- sepolicy/ueventd.te | 3 --- sepolicy/untrusted_app.te | 7 ------ sepolicy/vold.te | 3 --- sepolicy/wpa.te | 2 -- sepolicy/wpa_supplicant.te | 11 --------- sepolicy/zygote.te | 1 - 26 files changed, 184 deletions(-) delete mode 100644 sepolicy/bluetooth.te delete mode 100644 sepolicy/bootanim.te delete mode 100644 sepolicy/device.te delete mode 100644 sepolicy/file.te delete mode 100644 sepolicy/file_contexts delete mode 100644 sepolicy/gpsd.te delete mode 100644 sepolicy/hostapd.te delete mode 100644 sepolicy/mediaserver.te delete mode 100644 sepolicy/netd.te delete mode 100644 sepolicy/nfc.te delete mode 100644 sepolicy/platform_app.te delete mode 100644 sepolicy/radio.te delete mode 100644 sepolicy/rild.te delete mode 100644 sepolicy/service_contexts delete mode 100644 sepolicy/servicemanager.te delete mode 100644 sepolicy/shared_relro.te delete mode 100644 sepolicy/surfaceflinger.te delete mode 100644 sepolicy/system_app.te delete mode 100644 sepolicy/system_server.te delete mode 100644 sepolicy/ueventd.te delete mode 100644 sepolicy/untrusted_app.te delete mode 100644 sepolicy/vold.te delete mode 100644 sepolicy/wpa.te delete mode 100644 sepolicy/wpa_supplicant.te delete mode 100644 sepolicy/zygote.te diff --git a/BoardConfig.mk b/BoardConfig.mk index c3f92ed..76b45ed 100644 --- a/BoardConfig.mk +++ b/BoardConfig.mk @@ -47,6 +47,3 @@ RECOVERY_FSTAB_VERSION := 2 # Compatibility with pre-kitkat Sensor HALs SENSORS_NEED_SETRATE_ON_ENABLE := true - -#Selinux -BOARD_SEPOLICY_DIRS += \device/samsung/n7100/sepolicy diff --git a/sepolicy/bluetooth.te b/sepolicy/bluetooth.te deleted file mode 100644 index d2dd05f..0000000 --- a/sepolicy/bluetooth.te +++ /dev/null @@ -1,6 +0,0 @@ -allow bluetooth firmware_exynos:dir { read open search }; -allow bluetooth firmware_exynos:file { read open }; -allow bluetooth bluetooth_efs_file:dir search; -allow bluetooth bluetooth_efs_file:file read; -allow bluetooth sysfs:file write; -allow bluetooth efs_device_file:dir search; diff --git a/sepolicy/bootanim.te b/sepolicy/bootanim.te deleted file mode 100644 index 8a18e92..0000000 --- a/sepolicy/bootanim.te +++ /dev/null @@ -1 +0,0 @@ -allow bootanim ump_device:chr_file { open read write ioctl }; diff --git a/sepolicy/device.te b/sepolicy/device.te deleted file mode 100644 index 4d1980c..0000000 --- a/sepolicy/device.te +++ /dev/null @@ -1,22 +0,0 @@ -# Secure memory -type secmem_device, dev_type; - -# Unified Memory Management -type ump_device, dev_type; - -# Efs block device -type efs_block_device, dev_type; - -# Rfkill device -type rfkill_device, dev_type; - -# MFC device -type mfc_device, dev_type; -type hpd_device, dev_type; - -# Fm radio device -type fm_radio_device, dev_type; - -# Gadget serial device -type gadget_serial_device, dev_type; - diff --git a/sepolicy/file.te b/sepolicy/file.te deleted file mode 100644 index a5fb225..0000000 --- a/sepolicy/file.te +++ /dev/null @@ -1,15 +0,0 @@ -# MFC firmware -type firmware_mfc, file_type; - -# Common Exynos firmware -type firmware_exynos, file_type; - -# Sensors data -type sensors_data_file, file_type, data_file_type; - -# Display sysfs -type sysfs_display, fs_type, sysfs_type; - -type efs_device_file, file_type; - - diff --git a/sepolicy/file_contexts b/sepolicy/file_contexts deleted file mode 100644 index 5b0abcb..0000000 --- a/sepolicy/file_contexts +++ /dev/null @@ -1,60 +0,0 @@ -# Graphics -/dev/mali u:object_r:gpu_device:s0 -/dev/ump u:object_r:ump_device:s0 -/dev/fimg2d u:object_r:video_device:s0 -/dev/s5p-smem u:object_r:secmem_device:s0 - -# RIL -/dev/umts_boot0 u:object_r:radio_device:s0 -/dev/umts_csd u:object_r:radio_device:s0 -/dev/umts_ipc0 u:object_r:radio_device:s0 -/dev/umts_loopback0 u:object_r:radio_device:s0 -/dev/umts_ramdump0 u:object_r:radio_device:s0 -/dev/umts_rfs0 u:object_r:radio_device:s0 -/dev/umts_router u:object_r:radio_device:s0 - -# Efs -/dev/block/mmcblk0p3 u:object_r:efs_block_device:s0 -/factory(/.*)? u:object_r:efs_file:s0 - -# Camera -/data/ISP_CV u:object_r:camera_data_file:s0 -/dev/exynos-mem u:object_r:video_device:s0 -/dev/s3c-mfc u:object_r:mfc_device:s0 -/dev/video[0-3]* u:object_r:camera_device:s0 - -# Bluetooth -/dev/ttySAC0 u:object_r:hci_attach_dev:s0 -/factory/bluetooth(/.*)? u:object_r:bluetooth_efs_file:s0 -/sys/class/rfkill/rfkill0/state u:object_r:sysfs_bluetooth_writable:s0 -/sys/class/rfkill/rfkill0/type u:object_r:sysfs_bluetooth_writable:s0 - -# Display -/sys/class/mdnie/mdnie/scenario u:object_r:sysfs_display:s0 -/sys/class/mdnie/mdnie/mode u:object_r:sysfs_display:s0 - -# GPS -/dev/ttySAC1 u:object_r:gps_device:s0 -/system/bin/gpsd u:object_r:gpsd_exec:s0 - -# Sensors -/dev/akm8963 u:object_r:sensors_device:s0 -/efs/gyro_cal_data u:object_r:sensors_data_file:s0 - -# Wifi -/dev/rfkill u:object_r:rfkill_device:s0 -/factory/wifi/.mac.info u:object_r:wifi_data_file:s0 - -# Firmwares -/system/vendor/firmware(/.*)? u:object_r:firmware_exynos:s0 -/system/vendor/firmware/mfc_fw.bin u:object_r:firmware_mfc:s0 -/data/cfw(/.*)? u:object_r:firmware_exynos:s0 - -# Vibrator -/dev/tspdrv u:object_r:input_device:s0 -/sys/vibrator/pwm_val u:object_r:sysfs:s0 - -# Misc -/dev/HPD u:object_r:video_device:s0 -/dev/fmradio u:object_r:fm_radio_device:s0 -/dev/ttyGS[0-9]* u:object_r:gadget_serial_device:s0 diff --git a/sepolicy/gpsd.te b/sepolicy/gpsd.te deleted file mode 100644 index 9d588f3..0000000 --- a/sepolicy/gpsd.te +++ /dev/null @@ -1,10 +0,0 @@ -allow gpsd rild:unix_stream_socket connectto; -allow gpsd system_data_file:dir { add_name write }; -#allow gpsd system_data_file:file { create write lock open }; -allow gpsd system_data_file:fifo_file { create read write open setattr }; -allow gpsd system_data_file:dir { read write setattr open add_name }; -allow gpsd sysfs_wake_lock:file { read write open }; -allow gpsd servicemanager:binder call; -allow gpsd system_server:binder call; -allow gpsd system_server:unix_stream_socket { read write }; - diff --git a/sepolicy/hostapd.te b/sepolicy/hostapd.te deleted file mode 100644 index 7e0b91b..0000000 --- a/sepolicy/hostapd.te +++ /dev/null @@ -1 +0,0 @@ -allow hostapd rfkill_device:chr_file { read open }; diff --git a/sepolicy/mediaserver.te b/sepolicy/mediaserver.te deleted file mode 100644 index 0cfdc9c..0000000 --- a/sepolicy/mediaserver.te +++ /dev/null @@ -1,6 +0,0 @@ -allow mediaserver camera_data_file:file write; -allow mediaserver mfc_device:chr_file { read write ioctl open }; -allow mediaserver ump_device:chr_file { read write ioctl open }; - -# Bluetooth audio -allow mediaserver bluetooth:unix_stream_socket { connectto }; diff --git a/sepolicy/netd.te b/sepolicy/netd.te deleted file mode 100644 index 30d6940..0000000 --- a/sepolicy/netd.te +++ /dev/null @@ -1,3 +0,0 @@ -allow netd self:capability fsetid; -allow netd init:tcp_socket { read write getopt }; -allow netd log_device:chr_file { open write }; diff --git a/sepolicy/nfc.te b/sepolicy/nfc.te deleted file mode 100644 index 99b86bd..0000000 --- a/sepolicy/nfc.te +++ /dev/null @@ -1,2 +0,0 @@ -allow nfc firmware_camera:dir search; -allow nfc log_device:chr_file { write }; diff --git a/sepolicy/platform_app.te b/sepolicy/platform_app.te deleted file mode 100644 index fd825e9..0000000 --- a/sepolicy/platform_app.te +++ /dev/null @@ -1 +0,0 @@ -allow platform_app ump_device:chr_file { read write ioctl open }; diff --git a/sepolicy/radio.te b/sepolicy/radio.te deleted file mode 100644 index c19e0cf..0000000 --- a/sepolicy/radio.te +++ /dev/null @@ -1,2 +0,0 @@ -allow radio ump_device:chr_file { read write ioctl open }; - diff --git a/sepolicy/rild.te b/sepolicy/rild.te deleted file mode 100644 index 32f520c..0000000 --- a/sepolicy/rild.te +++ /dev/null @@ -1,3 +0,0 @@ -allow rild self:process execmem; -#allow rild system_data_file:dir { write remove_name add_name setattr }; -allow rild system_data_file:file { write create unlink setattr }; diff --git a/sepolicy/service_contexts b/sepolicy/service_contexts deleted file mode 100644 index c01caa2..0000000 --- a/sepolicy/service_contexts +++ /dev/null @@ -1,2 +0,0 @@ -Exynos.HWCService u:object_r:surfaceflinger_service:s0 -Exynos.IPService u:object_r:surfaceflinger_service:s0 diff --git a/sepolicy/servicemanager.te b/sepolicy/servicemanager.te deleted file mode 100644 index 4f5475d..0000000 --- a/sepolicy/servicemanager.te +++ /dev/null @@ -1,5 +0,0 @@ -allow servicemanager gpsd:dir search; -allow servicemanager gpsd:file { read open }; -allow servicemanager gpsd:process getattr; -allow servicemanager log_device:chr_file { open write }; - diff --git a/sepolicy/shared_relro.te b/sepolicy/shared_relro.te deleted file mode 100644 index f7f75b3..0000000 --- a/sepolicy/shared_relro.te +++ /dev/null @@ -1 +0,0 @@ -allow shared_relro log_device:chr_file { write }; diff --git a/sepolicy/surfaceflinger.te b/sepolicy/surfaceflinger.te deleted file mode 100644 index a9a8d6a..0000000 --- a/sepolicy/surfaceflinger.te +++ /dev/null @@ -1 +0,0 @@ -allow surfaceflinger ump_device:chr_file { open read write ioctl }; diff --git a/sepolicy/system_app.te b/sepolicy/system_app.te deleted file mode 100644 index 2cb531f..0000000 --- a/sepolicy/system_app.te +++ /dev/null @@ -1,3 +0,0 @@ -allow system_app sysfs_display:file { write getattr open }; -allow system_app ump_device:chr_file { ioctl open read write }; - diff --git a/sepolicy/system_server.te b/sepolicy/system_server.te deleted file mode 100644 index 4b700e5..0000000 --- a/sepolicy/system_server.te +++ /dev/null @@ -1,10 +0,0 @@ -allow system_server efs_file:file { read open }; -allow system_server efs_file:dir search; -allow system_server sensors_data_file:file { read open }; -allow system_server uhid_device:chr_file { read write ioctl open }; -allow system_server ump_device:chr_file { read write ioctl open }; -allow system_server gpsd:binder transfer; -allow system_server dex2oat_exec:file { execute execute_no_trans read open }; -allow system_server system_file:file { execmod }; -allow system_server self:capability sys_module; - diff --git a/sepolicy/ueventd.te b/sepolicy/ueventd.te deleted file mode 100644 index af59995..0000000 --- a/sepolicy/ueventd.te +++ /dev/null @@ -1,3 +0,0 @@ -allow ueventd firmware_mfc:file { read getattr open }; -allow ueventd firmware_exynos:dir search; -allow ueventd firmware_exynos:file { read getattr open }; diff --git a/sepolicy/untrusted_app.te b/sepolicy/untrusted_app.te deleted file mode 100644 index a937288..0000000 --- a/sepolicy/untrusted_app.te +++ /dev/null @@ -1,7 +0,0 @@ -allow untrusted_app ump_device:chr_file { open read write ioctl }; -allow untrusted_app block_device:dir { open read search }; -allow untrusted_app kernel:system { module_request }; -allow untrusted_app firmware_camera:dir { read getattr open }; -allow untrusted_app firmware_camera:file getattr; -allow untrusted_app firmware_mfc:file getattr; - diff --git a/sepolicy/vold.te b/sepolicy/vold.te deleted file mode 100644 index 1418d7a..0000000 --- a/sepolicy/vold.te +++ /dev/null @@ -1,3 +0,0 @@ -allow vold efs_file:dir { read getattr open ioctl }; -allow vold boot_block_device:blk_file { read write open ioctl getattr }; - diff --git a/sepolicy/wpa.te b/sepolicy/wpa.te deleted file mode 100644 index b44a49c..0000000 --- a/sepolicy/wpa.te +++ /dev/null @@ -1,2 +0,0 @@ -allow wpa rfkill_device:chr_file { read open }; -allow wpa log_device:chr_file { open write }; diff --git a/sepolicy/wpa_supplicant.te b/sepolicy/wpa_supplicant.te deleted file mode 100644 index 98fdc25..0000000 --- a/sepolicy/wpa_supplicant.te +++ /dev/null @@ -1,11 +0,0 @@ -allow wpa init:unix_dgram_socket { read write }; - -# logwrapper used with wpa_supplicant -allow wpa devpts:chr_file { read write }; - -allow wpa wpa_socket:unix_dgram_socket { read write }; -allow wpa_socket system_server:unix_dgram_socket sendto; - -allow wpa_socket wifi_data_file:sock_file unlink; -allow wpa rfkill_device:chr_file rw_file_perms; -allow wpa log_device:chr_file { open }; diff --git a/sepolicy/zygote.te b/sepolicy/zygote.te deleted file mode 100644 index 05c4d7d..0000000 --- a/sepolicy/zygote.te +++ /dev/null @@ -1 +0,0 @@ -allow zygote log_device:chr_file { open }; -- cgit v1.1 From 719c94bec6f65fe1d8f560da7dced1fa0a3a9646 Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Sun, 29 Nov 2015 13:01:30 +0530 Subject: n7100: set radio access families --- overlay/frameworks/base/core/res/res/values/config.xml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/overlay/frameworks/base/core/res/res/values/config.xml b/overlay/frameworks/base/core/res/res/values/config.xml index c432e22..bc7c475 100644 --- a/overlay/frameworks/base/core/res/res/values/config.xml +++ b/overlay/frameworks/base/core/res/res/values/config.xml @@ -315,4 +315,11 @@ true + + + GPRS|EDGE|UMTS|HSDPA|HSUPA|HSPAP|GSM|WCDMA -- cgit v1.1 From e9e28e3b6176332c43b41bb802b3513c7b701faa Mon Sep 17 00:00:00 2001 From: Arne Coucheron Date: Tue, 10 Nov 2015 04:58:00 -0500 Subject: Shim library for missing symbols in Samsung blobs Change-Id: Id8caf67ee8d544fc1fab0fb8b9d13b1f2cb07204 --- libsamsung_symbols/Android.mk | 28 ++++++++++++++++++++++++++++ libsamsung_symbols/samsung_ril.cpp | 21 +++++++++++++++++++++ n7100.mk | 4 ++++ rootdir/init.target.rc | 1 + 4 files changed, 54 insertions(+) create mode 100644 libsamsung_symbols/Android.mk create mode 100644 libsamsung_symbols/samsung_ril.cpp diff --git a/libsamsung_symbols/Android.mk b/libsamsung_symbols/Android.mk new file mode 100644 index 0000000..c2e942e --- /dev/null +++ b/libsamsung_symbols/Android.mk @@ -0,0 +1,28 @@ +# Copyright (C) 2015 The CyanogenMod 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. + +LOCAL_PATH := $(call my-dir) + +include $(CLEAR_VARS) + +LOCAL_SRC_FILES := \ + samsung_ril.cpp + +LOCAL_SHARED_LIBRARIES := libbinder + +LOCAL_MODULE := libsamsung_symbols +LOCAL_MODULE_TAGS := optional +LOCAL_MODULE_CLASS := SHARED_LIBRARIES + +include $(BUILD_SHARED_LIBRARY) diff --git a/libsamsung_symbols/samsung_ril.cpp b/libsamsung_symbols/samsung_ril.cpp new file mode 100644 index 0000000..404616d --- /dev/null +++ b/libsamsung_symbols/samsung_ril.cpp @@ -0,0 +1,21 @@ +/* + * Copyright (C) 2015 The CyanogenMod 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. + */ + +/* status_t Parcel::writeString16 */ +extern "C" int _ZN7android6Parcel13writeString16EPKDsj(); +extern "C" int _ZN7android6Parcel13writeString16EPKtj() { + return _ZN7android6Parcel13writeString16EPKDsj(); +} diff --git a/n7100.mk b/n7100.mk index b216e8e..1f0e323 100644 --- a/n7100.mk +++ b/n7100.mk @@ -90,6 +90,10 @@ PRODUCT_PACKAGES += \ $(call inherit-product, vendor/cm/config/nfc_enhanced.mk) +# Samsung symbols +PRODUCT_PACKAGES += \ + libsamsung_symbols + # RIL PRODUCT_PROPERTY_OVERRIDES += \ ro.telephony.ril_class=SamsungExynos4RIL \ diff --git a/rootdir/init.target.rc b/rootdir/init.target.rc index 8636c30..fe05cea 100644 --- a/rootdir/init.target.rc +++ b/rootdir/init.target.rc @@ -1,4 +1,5 @@ on init + export LD_PRELOAD "/system/lib/libsamsung_symbols.so" # Vibetonz export VIBE_PIPE_PATH /dev/pipes mkdir /dev/pipes 0771 shell shell -- cgit v1.1 From b047db596821cbcbe33f3ca638fb78871302143f Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Wed, 2 Dec 2015 10:17:26 +0530 Subject: n7100: make ril work use ril-wrapper to stop libsec-ril from crashing (based off dmitry-ril for the Nexus S) --- n7100.mk | 4 +++ ril-wrapper/Android.mk | 9 +++++ ril-wrapper/ril-wrapper.c | 86 +++++++++++++++++++++++++++++++++++++++++++++++ rootdir/init.target.rc | 2 +- system.prop | 2 +- 5 files changed, 101 insertions(+), 2 deletions(-) create mode 100644 ril-wrapper/Android.mk create mode 100644 ril-wrapper/ril-wrapper.c diff --git a/n7100.mk b/n7100.mk index 1f0e323..5da4762 100644 --- a/n7100.mk +++ b/n7100.mk @@ -53,6 +53,10 @@ PRODUCT_PACKAGES += \ libsecril-client-sap \ SamsungServiceMode +# RIL +PRODUCT_PACKAGES += \ + ril-wrapper + # Additional apps PRODUCT_PACKAGES += \ OpenDelta diff --git a/ril-wrapper/Android.mk b/ril-wrapper/Android.mk new file mode 100644 index 0000000..698e1d3 --- /dev/null +++ b/ril-wrapper/Android.mk @@ -0,0 +1,9 @@ +LOCAL_PATH:= $(call my-dir) + +include $(CLEAR_VARS) + +LOCAL_SRC_FILES:= ril-wrapper.c +LOCAL_SHARED_LIBRARIES := liblog libbinder +LOCAL_MODULE:= ril-wrapper + +include $(BUILD_SHARED_LIBRARY) diff --git a/ril-wrapper/ril-wrapper.c b/ril-wrapper/ril-wrapper.c new file mode 100644 index 0000000..8371870 --- /dev/null +++ b/ril-wrapper/ril-wrapper.c @@ -0,0 +1,86 @@ +#define LOG_TAG "RilWrapper" +#define RIL_SHLIB +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define REAL_RIL_NAME "/system/lib/libsec-ril.so" + + +static RIL_RadioFunctions const *mRealRadioFuncs; +static const struct RIL_Env *mEnv; + +const RIL_RadioFunctions* RIL_Init(const struct RIL_Env *env, int argc, char **argv) +{ + RIL_RadioFunctions const* (*fRealRilInit)(const struct RIL_Env *env, int argc, char **argv); + static RIL_RadioFunctions rilInfo; + void *realRilLibHandle; + int i; + + + //save the env; + mEnv = env; + + //get the real RIL + realRilLibHandle = dlopen(REAL_RIL_NAME, RTLD_LOCAL); + if (!realRilLibHandle) { + RLOGE("Failed to load the real RIL '" REAL_RIL_NAME "': %s\n", dlerror()); + return NULL; + } + + //remove "-c" command line as Samsung's RIL does not understand it - it just barfs instead + for (i = 0; i < argc; i++) { + if (!strcmp(argv[i], "-c") && i != argc -1) { //found it + memcpy(argv + i, argv + i + 2, sizeof(char*[argc - i - 2])); + argc -= 2; + } + } + + //load the real RIL + fRealRilInit = dlsym(realRilLibHandle, "RIL_Init"); + if (!fRealRilInit) { + RLOGE("Failed to find the real RIL's entry point\n"); + goto out_fail; + } + + RLOGD("Calling the real RIL's entry point with %u args\n", argc); + for (i = 0; i < argc; i++) + RLOGD(" argv[%2d] = '%s'\n", i, argv[i]); + + //try to init the real ril + mRealRadioFuncs = fRealRilInit(env, argc, argv); + if (!mRealRadioFuncs) { + RLOGE("The real RIL's entry point failed\n"); + goto out_fail; + } + + //copy the real RIL's info struct, then replace the onRequest pointer with our own + rilInfo = *mRealRadioFuncs; + + RLOGD("Wrapped RIL version is '%s'\n", mRealRadioFuncs->getVersion()); + + //we're all good - return to caller + return &rilInfo; + +out_fail: + dlclose(realRilLibHandle); + return NULL; +} diff --git a/rootdir/init.target.rc b/rootdir/init.target.rc index fe05cea..3e7ba2c 100644 --- a/rootdir/init.target.rc +++ b/rootdir/init.target.rc @@ -1,5 +1,5 @@ on init - export LD_PRELOAD "/system/lib/libsamsung_symbols.so" + export LD_SHIM_LIBS /system/lib/libsec-ril.so|libsamsung_symbols.so # Vibetonz export VIBE_PIPE_PATH /dev/pipes mkdir /dev/pipes 0771 shell shell diff --git a/system.prop b/system.prop index 47d42de..db6bcfd 100644 --- a/system.prop +++ b/system.prop @@ -3,7 +3,7 @@ # dalvik.vm.dexopt-data-only=1 -rild.libpath=/system/lib/libsec-ril.so +rild.libpath=/system/lib/ril-wrapper.so rild.libargs=-d /dev/ttyS0 ro.sf.lcd_density=320 ro.lcd_min_brightness=20 -- cgit v1.1 From e852929aaab4cce31b3e7254d980892db6d35d8e Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Wed, 2 Dec 2015 10:19:04 +0530 Subject: n7100: update fstab again --- rootdir/fstab.smdk4x12 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rootdir/fstab.smdk4x12 b/rootdir/fstab.smdk4x12 index fd258bc..dcdcbd2 100644 --- a/rootdir/fstab.smdk4x12 +++ b/rootdir/fstab.smdk4x12 @@ -8,7 +8,7 @@ /dev/block/mmcblk0p13 /system ext4 ro,noatime wait /dev/block/mmcblk0p12 /cache ext4 noatime,nosuid,nodev,journal_async_commit,errors=panic wait,check /dev/block/mmcblk0p14 /preload ext4 noatime,nosuid,nodev,journal_async_commit wait -/dev/block/mmcblk0p16 /data ext4 noatime,nosuid,nodev,discard,noauto_da_alloc,journal_async_commit,errors=panic wait,check,encryptable=footer +/dev/block/mmcblk0p16 /data ext4 noatime,nosuid,nodev,noauto_da_alloc,journal_async_commit,errors=panic wait,check,encryptable=footer /devices/platform/s3c-sdhci.2/mmc_host/mmc1* auto auto defaults voldmanaged=sdcard1:auto,encryptable=userdata /devices/platform/s5p-ehci* auto auto defaults voldmanaged=usb:auto,noemulatedsd -- cgit v1.1 From 95afa16cb5b10ac443f6dfcbf0803b7389aa13ba Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Sat, 28 Nov 2015 01:29:32 +0530 Subject: n7100: Remove density from PRODUCT_AAPT_CONFIG --- n7100.mk | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/n7100.mk b/n7100.mk index 5da4762..1210c49 100644 --- a/n7100.mk +++ b/n7100.mk @@ -22,11 +22,8 @@ LOCAL_PATH := device/samsung/n7100 # Overlay DEVICE_PACKAGE_OVERLAYS += $(LOCAL_PATH)/overlay -# This device is xhdpi. However the platform doesn't -# currently contain all of the bitmaps at xhdpi density so -# we do this little trick to fall back to the hdpi version -# if the xhdpi doesn't exist. -PRODUCT_AAPT_CONFIG := normal hdpi xhdpi +# Screen density +PRODUCT_AAPT_CONFIG := normal PRODUCT_AAPT_PREF_CONFIG := xhdpi # Init files -- cgit v1.1 From 44ad5c9ac3a27e548c701e7cfafe4a7994b04661 Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Thu, 3 Dec 2015 23:14:43 +0530 Subject: n7100: enabled stk overlay --- overlay/frameworks/base/core/res/res/values/config.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/overlay/frameworks/base/core/res/res/values/config.xml b/overlay/frameworks/base/core/res/res/values/config.xml index bc7c475..2a02651 100644 --- a/overlay/frameworks/base/core/res/res/values/config.xml +++ b/overlay/frameworks/base/core/res/res/values/config.xml @@ -269,8 +269,8 @@ policy/src/com/android/internal/policy/impl/PhoneWindowManager.java --> 0 - + + true true -- cgit v1.1 From 7ec6ebccf49878c089d3f46ab1d57423490f13a0 Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Sat, 5 Dec 2015 11:20:25 +0530 Subject: n7100: disable ashmem tracking in parcels. --- BoardConfig.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/BoardConfig.mk b/BoardConfig.mk index 76b45ed..053664a 100644 --- a/BoardConfig.mk +++ b/BoardConfig.mk @@ -24,6 +24,7 @@ BOARD_PROVIDES_LIBRIL := true BOARD_MODEM_TYPE := xmm6262 BOARD_RIL_CLASS := ../../../device/samsung/n7100/ril TARGET_SPECIFIC_HEADER_PATH := device/samsung/n7100/include +COMMON_GLOBAL_CFLAGS += -DDISABLE_ASHMEM_TRACKING # Bluetooth BOARD_BLUETOOTH_BDROID_BUILDCFG_INCLUDE_DIR := device/samsung/n7100/bluetooth -- cgit v1.1 From 1da1e762bd786ce57a12fc955d30d0a63afe8653 Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Sun, 6 Dec 2015 11:02:12 +0530 Subject: Revert "n7100: added SamsungExynos4RIL to the device" This reverts commit 41701ea291c5586ec426650ecd6ff09ae1cd5d3a. reverting this commit as its already tracked in hardware_samsung --- BoardConfig.mk | 2 +- .../internal/telephony/SamsungExynos4RIL.java | 478 --------------------- 2 files changed, 1 insertion(+), 479 deletions(-) delete mode 100644 ril/telephony/java/com/android/internal/telephony/SamsungExynos4RIL.java diff --git a/BoardConfig.mk b/BoardConfig.mk index 053664a..d963d68 100644 --- a/BoardConfig.mk +++ b/BoardConfig.mk @@ -22,7 +22,7 @@ # RIL BOARD_PROVIDES_LIBRIL := true BOARD_MODEM_TYPE := xmm6262 -BOARD_RIL_CLASS := ../../../device/samsung/n7100/ril +BOARD_RIL_CLASS := ../../../hardware/samsung/ril TARGET_SPECIFIC_HEADER_PATH := device/samsung/n7100/include COMMON_GLOBAL_CFLAGS += -DDISABLE_ASHMEM_TRACKING diff --git a/ril/telephony/java/com/android/internal/telephony/SamsungExynos4RIL.java b/ril/telephony/java/com/android/internal/telephony/SamsungExynos4RIL.java deleted file mode 100644 index 7d31a69..0000000 --- a/ril/telephony/java/com/android/internal/telephony/SamsungExynos4RIL.java +++ /dev/null @@ -1,478 +0,0 @@ -/* - * Copyright (C) 2011 The CyanogenMod 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. - */ - -package com.android.internal.telephony; - -import static com.android.internal.telephony.RILConstants.*; - -import android.content.Context; -import android.os.AsyncResult; -import android.os.Handler; -import android.os.HandlerThread; -import android.os.Looper; -import android.os.Message; -import android.os.Parcel; -import android.os.Registrant; -import android.text.TextUtils; -import android.telephony.Rlog; - -import android.telephony.PhoneNumberUtils; - -import java.util.ArrayList; - -public class SamsungExynos4RIL extends RIL implements CommandsInterface { - - //SAMSUNG STATES - static final int RIL_REQUEST_GET_CELL_BROADCAST_CONFIG = 10002; - - static final int RIL_REQUEST_SEND_ENCODED_USSD = 10005; - static final int RIL_REQUEST_SET_PDA_MEMORY_STATUS = 10006; - static final int RIL_REQUEST_GET_PHONEBOOK_STORAGE_INFO = 10007; - static final int RIL_REQUEST_GET_PHONEBOOK_ENTRY = 10008; - static final int RIL_REQUEST_ACCESS_PHONEBOOK_ENTRY = 10009; - static final int RIL_REQUEST_DIAL_VIDEO_CALL = 10010; - static final int RIL_REQUEST_CALL_DEFLECTION = 10011; - static final int RIL_REQUEST_READ_SMS_FROM_SIM = 10012; - static final int RIL_REQUEST_USIM_PB_CAPA = 10013; - static final int RIL_REQUEST_LOCK_INFO = 10014; - - static final int RIL_REQUEST_DIAL_EMERGENCY = 10016; - static final int RIL_REQUEST_GET_STOREAD_MSG_COUNT = 10017; - static final int RIL_REQUEST_STK_SIM_INIT_EVENT = 10018; - static final int RIL_REQUEST_GET_LINE_ID = 10019; - static final int RIL_REQUEST_SET_LINE_ID = 10020; - static final int RIL_REQUEST_GET_SERIAL_NUMBER = 10021; - static final int RIL_REQUEST_GET_MANUFACTURE_DATE_NUMBER = 10022; - static final int RIL_REQUEST_GET_BARCODE_NUMBER = 10023; - static final int RIL_REQUEST_UICC_GBA_AUTHENTICATE_BOOTSTRAP = 10024; - static final int RIL_REQUEST_UICC_GBA_AUTHENTICATE_NAF = 10025; - static final int RIL_REQUEST_SIM_TRANSMIT_BASIC = 10026; - static final int RIL_REQUEST_SIM_OPEN_CHANNEL = 10027; - static final int RIL_REQUEST_SIM_CLOSE_CHANNEL = 10028; - static final int RIL_REQUEST_SIM_TRANSMIT_CHANNEL = 10029; - static final int RIL_REQUEST_SIM_AUTH = 10030; - static final int RIL_REQUEST_PS_ATTACH = 10031; - static final int RIL_REQUEST_PS_DETACH = 10032; - static final int RIL_REQUEST_ACTIVATE_DATA_CALL = 10033; - static final int RIL_REQUEST_CHANGE_SIM_PERSO = 10034; - static final int RIL_REQUEST_ENTER_SIM_PERSO = 10035; - static final int RIL_REQUEST_GET_TIME_INFO = 10036; - static final int RIL_REQUEST_OMADM_SETUP_SESSION = 10037; - static final int RIL_REQUEST_OMADM_SERVER_START_SESSION = 10038; - static final int RIL_REQUEST_OMADM_CLIENT_START_SESSION = 10039; - static final int RIL_REQUEST_OMADM_SEND_DATA = 10040; - static final int RIL_REQUEST_CDMA_GET_DATAPROFILE = 10041; - static final int RIL_REQUEST_CDMA_SET_DATAPROFILE = 10042; - static final int RIL_REQUEST_CDMA_GET_SYSTEMPROPERTIES = 10043; - static final int RIL_REQUEST_CDMA_SET_SYSTEMPROPERTIES = 10044; - static final int RIL_REQUEST_SEND_SMS_COUNT = 10045; - static final int RIL_REQUEST_SEND_SMS_MSG = 10046; - static final int RIL_REQUEST_SEND_SMS_MSG_READ_STATUS = 10047; - static final int RIL_REQUEST_MODEM_HANGUP = 10048; - static final int RIL_REQUEST_SET_SIM_POWER = 10049; - static final int RIL_REQUEST_SET_PREFERRED_NETWORK_LIST = 10050; - static final int RIL_REQUEST_GET_PREFERRED_NETWORK_LIST = 10051; - static final int RIL_REQUEST_HANGUP_VT = 10052; - - static final int RIL_UNSOL_RELEASE_COMPLETE_MESSAGE = 11001; - static final int RIL_UNSOL_STK_SEND_SMS_RESULT = 11002; - static final int RIL_UNSOL_STK_CALL_CONTROL_RESULT = 11003; - static final int RIL_UNSOL_DUN_CALL_STATUS = 11004; - - static final int RIL_UNSOL_O2_HOME_ZONE_INFO = 11007; - static final int RIL_UNSOL_DEVICE_READY_NOTI = 11008; - static final int RIL_UNSOL_GPS_NOTI = 11009; - static final int RIL_UNSOL_AM = 11010; - static final int RIL_UNSOL_DUN_PIN_CONTROL_SIGNAL = 11011; - static final int RIL_UNSOL_DATA_SUSPEND_RESUME = 11012; - static final int RIL_UNSOL_SAP = 11013; - - static final int RIL_UNSOL_SIM_SMS_STORAGE_AVAILALE = 11015; - static final int RIL_UNSOL_HSDPA_STATE_CHANGED = 11016; - static final int RIL_UNSOL_WB_AMR_STATE = 11017; - static final int RIL_UNSOL_TWO_MIC_STATE = 11018; - static final int RIL_UNSOL_DHA_STATE = 11019; - static final int RIL_UNSOL_UART = 11020; - static final int RIL_UNSOL_RESPONSE_HANDOVER = 11021; - static final int RIL_UNSOL_IPV6_ADDR = 11022; - static final int RIL_UNSOL_NWK_INIT_DISC_REQUEST = 11023; - static final int RIL_UNSOL_RTS_INDICATION = 11024; - static final int RIL_UNSOL_OMADM_SEND_DATA = 11025; - static final int RIL_UNSOL_DUN = 11026; - static final int RIL_UNSOL_SYSTEM_REBOOT = 11027; - static final int RIL_UNSOL_VOICE_PRIVACY_CHANGED = 11028; - static final int RIL_UNSOL_UTS_GETSMSCOUNT = 11029; - static final int RIL_UNSOL_UTS_GETSMSMSG = 11030; - static final int RIL_UNSOL_UTS_GET_UNREAD_SMS_STATUS = 11031; - static final int RIL_UNSOL_MIP_CONNECT_STATUS = 11032; - - private Object mCatProCmdBuffer; - /* private Message mPendingGetSimStatus; */ - - public SamsungExynos4RIL(Context context, int networkMode, int cdmaSubscription, Integer instanceId) { - super(context, networkMode, cdmaSubscription, instanceId); - mQANElements = 5; - } - - static String - requestToString(int request) { - switch (request) { - case RIL_REQUEST_DIAL_EMERGENCY: return "DIAL_EMERGENCY"; - default: return RIL.requestToString(request); - } - } - - @Override - protected RILRequest processSolicited (Parcel p) { - int serial, error; - boolean found = false; - - serial = p.readInt(); - error = p.readInt(); - - RILRequest rr; - - rr = findAndRemoveRequestFromList(serial); - - if (rr == null) { - Rlog.w(RILJ_LOG_TAG, "Unexpected solicited response! sn: " - + serial + " error: " + error); - return null; - } - - Object ret = null; - - if (error == 0 || p.dataAvail() > 0) { - // either command succeeds or command fails but with data payload - try {switch (rr.mRequest) { - /* - cat libs/telephony/ril_commands.h \ - | egrep "^ *{RIL_" \ - | sed -re 's/\{([^,]+),[^,]+,([^}]+).+/case \1: ret = \2(p); break;/' - */ - case RIL_REQUEST_GET_SIM_STATUS: ret = responseIccCardStatus(p); break; - case RIL_REQUEST_ENTER_SIM_PIN: ret = responseInts(p); break; - case RIL_REQUEST_ENTER_SIM_PUK: ret = responseInts(p); break; - case RIL_REQUEST_ENTER_SIM_PIN2: ret = responseInts(p); break; - case RIL_REQUEST_ENTER_SIM_PUK2: ret = responseInts(p); break; - case RIL_REQUEST_CHANGE_SIM_PIN: ret = responseInts(p); break; - case RIL_REQUEST_CHANGE_SIM_PIN2: ret = responseInts(p); break; - case RIL_REQUEST_ENTER_NETWORK_DEPERSONALIZATION: ret = responseInts(p); break; - case RIL_REQUEST_GET_CURRENT_CALLS: ret = responseCallList(p); break; - case RIL_REQUEST_DIAL: ret = responseVoid(p); break; - case RIL_REQUEST_DIAL_EMERGENCY: ret = responseVoid(p); break; - case RIL_REQUEST_GET_IMSI: ret = responseString(p); break; - case RIL_REQUEST_HANGUP: ret = responseVoid(p); break; - case RIL_REQUEST_HANGUP_WAITING_OR_BACKGROUND: ret = responseVoid(p); break; - case RIL_REQUEST_HANGUP_FOREGROUND_RESUME_BACKGROUND: { - if (mTestingEmergencyCall.getAndSet(false)) { - if (mEmergencyCallbackModeRegistrant != null) { - riljLog("testing emergency call, notify ECM Registrants"); - mEmergencyCallbackModeRegistrant.notifyRegistrant(); - } - } - ret = responseVoid(p); - break; - } - case RIL_REQUEST_SWITCH_WAITING_OR_HOLDING_AND_ACTIVE: ret = responseVoid(p); break; - case RIL_REQUEST_CONFERENCE: ret = responseVoid(p); break; - case RIL_REQUEST_UDUB: ret = responseVoid(p); break; - case RIL_REQUEST_LAST_CALL_FAIL_CAUSE: ret = responseInts(p); break; - case RIL_REQUEST_SIGNAL_STRENGTH: ret = responseSignalStrength(p); break; - case RIL_REQUEST_VOICE_REGISTRATION_STATE: ret = responseStrings(p); break; - case RIL_REQUEST_DATA_REGISTRATION_STATE: ret = responseStrings(p); break; - case RIL_REQUEST_OPERATOR: ret = responseStrings(p); break; - case RIL_REQUEST_RADIO_POWER: ret = responseVoid(p); break; - case RIL_REQUEST_DTMF: ret = responseVoid(p); break; - case RIL_REQUEST_SEND_SMS: ret = responseSMS(p); break; - case RIL_REQUEST_SEND_SMS_EXPECT_MORE: ret = responseSMS(p); break; - case RIL_REQUEST_SETUP_DATA_CALL: ret = responseSetupDataCall(p); break; - case RIL_REQUEST_SIM_IO: ret = responseICC_IO(p); break; - case RIL_REQUEST_SEND_USSD: ret = responseVoid(p); break; - case RIL_REQUEST_CANCEL_USSD: ret = responseVoid(p); break; - case RIL_REQUEST_GET_CLIR: ret = responseInts(p); break; - case RIL_REQUEST_SET_CLIR: ret = responseVoid(p); break; - case RIL_REQUEST_QUERY_CALL_FORWARD_STATUS: ret = responseCallForward(p); break; - case RIL_REQUEST_SET_CALL_FORWARD: ret = responseVoid(p); break; - case RIL_REQUEST_QUERY_CALL_WAITING: ret = responseInts(p); break; - case RIL_REQUEST_SET_CALL_WAITING: ret = responseVoid(p); break; - case RIL_REQUEST_SMS_ACKNOWLEDGE: ret = responseVoid(p); break; - case RIL_REQUEST_GET_IMEI: ret = responseString(p); break; - case RIL_REQUEST_GET_IMEISV: ret = responseString(p); break; - case RIL_REQUEST_ANSWER: ret = responseVoid(p); break; - case RIL_REQUEST_DEACTIVATE_DATA_CALL: ret = responseVoid(p); break; - case RIL_REQUEST_QUERY_FACILITY_LOCK: ret = responseInts(p); break; - case RIL_REQUEST_SET_FACILITY_LOCK: ret = responseInts(p); break; - case RIL_REQUEST_CHANGE_BARRING_PASSWORD: ret = responseVoid(p); break; - case RIL_REQUEST_QUERY_NETWORK_SELECTION_MODE: ret = responseInts(p); break; - case RIL_REQUEST_SET_NETWORK_SELECTION_AUTOMATIC: ret = responseVoid(p); break; - case RIL_REQUEST_SET_NETWORK_SELECTION_MANUAL: ret = responseVoid(p); break; - case RIL_REQUEST_QUERY_AVAILABLE_NETWORKS : ret = responseOperatorInfos(p); break; - case RIL_REQUEST_DTMF_START: ret = responseVoid(p); break; - case RIL_REQUEST_DTMF_STOP: ret = responseVoid(p); break; - case RIL_REQUEST_BASEBAND_VERSION: ret = responseString(p); break; - case RIL_REQUEST_SEPARATE_CONNECTION: ret = responseVoid(p); break; - case RIL_REQUEST_SET_MUTE: ret = responseVoid(p); break; - case RIL_REQUEST_GET_MUTE: ret = responseInts(p); break; - case RIL_REQUEST_QUERY_CLIP: ret = responseInts(p); break; - case RIL_REQUEST_LAST_DATA_CALL_FAIL_CAUSE: ret = responseInts(p); break; - case RIL_REQUEST_DATA_CALL_LIST: ret = responseDataCallList(p); break; - case RIL_REQUEST_RESET_RADIO: ret = responseVoid(p); break; - case RIL_REQUEST_OEM_HOOK_RAW: ret = responseRaw(p); break; - case RIL_REQUEST_OEM_HOOK_STRINGS: ret = responseStrings(p); break; - case RIL_REQUEST_SCREEN_STATE: ret = responseVoid(p); break; - case RIL_REQUEST_SET_SUPP_SVC_NOTIFICATION: ret = responseVoid(p); break; - case RIL_REQUEST_WRITE_SMS_TO_SIM: ret = responseInts(p); break; - case RIL_REQUEST_DELETE_SMS_ON_SIM: ret = responseVoid(p); break; - case RIL_REQUEST_SET_BAND_MODE: ret = responseVoid(p); break; - case RIL_REQUEST_QUERY_AVAILABLE_BAND_MODE: ret = responseInts(p); break; - case RIL_REQUEST_STK_GET_PROFILE: ret = responseString(p); break; - case RIL_REQUEST_STK_SET_PROFILE: ret = responseVoid(p); break; - case RIL_REQUEST_STK_SEND_ENVELOPE_COMMAND: ret = responseString(p); break; - case RIL_REQUEST_STK_SEND_TERMINAL_RESPONSE: ret = responseVoid(p); break; - case RIL_REQUEST_STK_HANDLE_CALL_SETUP_REQUESTED_FROM_SIM: ret = responseInts(p); break; - case RIL_REQUEST_EXPLICIT_CALL_TRANSFER: ret = responseVoid(p); break; - case RIL_REQUEST_SET_PREFERRED_NETWORK_TYPE: ret = responseVoid(p); break; - case RIL_REQUEST_GET_PREFERRED_NETWORK_TYPE: ret = responseGetPreferredNetworkType(p); break; - case RIL_REQUEST_GET_NEIGHBORING_CELL_IDS: ret = responseCellList(p); break; - case RIL_REQUEST_SET_LOCATION_UPDATES: ret = responseVoid(p); break; - case RIL_REQUEST_CDMA_SET_SUBSCRIPTION_SOURCE: ret = responseVoid(p); break; - case RIL_REQUEST_CDMA_SET_ROAMING_PREFERENCE: ret = responseVoid(p); break; - case RIL_REQUEST_CDMA_QUERY_ROAMING_PREFERENCE: ret = responseInts(p); break; - case RIL_REQUEST_SET_TTY_MODE: ret = responseVoid(p); break; - case RIL_REQUEST_QUERY_TTY_MODE: ret = responseInts(p); break; - case RIL_REQUEST_CDMA_SET_PREFERRED_VOICE_PRIVACY_MODE: ret = responseVoid(p); break; - case RIL_REQUEST_CDMA_QUERY_PREFERRED_VOICE_PRIVACY_MODE: ret = responseInts(p); break; - case RIL_REQUEST_CDMA_FLASH: ret = responseVoid(p); break; - case RIL_REQUEST_CDMA_BURST_DTMF: ret = responseVoid(p); break; - case RIL_REQUEST_CDMA_SEND_SMS: ret = responseSMS(p); break; - case RIL_REQUEST_CDMA_SMS_ACKNOWLEDGE: ret = responseVoid(p); break; - case RIL_REQUEST_GSM_GET_BROADCAST_CONFIG: ret = responseGmsBroadcastConfig(p); break; - case RIL_REQUEST_GSM_SET_BROADCAST_CONFIG: ret = responseVoid(p); break; - case RIL_REQUEST_GSM_BROADCAST_ACTIVATION: ret = responseVoid(p); break; - case RIL_REQUEST_CDMA_GET_BROADCAST_CONFIG: ret = responseCdmaBroadcastConfig(p); break; - case RIL_REQUEST_CDMA_SET_BROADCAST_CONFIG: ret = responseVoid(p); break; - case RIL_REQUEST_CDMA_BROADCAST_ACTIVATION: ret = responseVoid(p); break; - case RIL_REQUEST_CDMA_VALIDATE_AND_WRITE_AKEY: ret = responseVoid(p); break; - case RIL_REQUEST_CDMA_SUBSCRIPTION: ret = responseStrings(p); break; - case RIL_REQUEST_CDMA_WRITE_SMS_TO_RUIM: ret = responseInts(p); break; - case RIL_REQUEST_CDMA_DELETE_SMS_ON_RUIM: ret = responseVoid(p); break; - case RIL_REQUEST_DEVICE_IDENTITY: ret = responseStrings(p); break; - case RIL_REQUEST_GET_SMSC_ADDRESS: ret = responseString(p); break; - case RIL_REQUEST_SET_SMSC_ADDRESS: ret = responseVoid(p); break; - case RIL_REQUEST_EXIT_EMERGENCY_CALLBACK_MODE: ret = responseVoid(p); break; - case RIL_REQUEST_REPORT_SMS_MEMORY_STATUS: ret = responseVoid(p); break; - case RIL_REQUEST_REPORT_STK_SERVICE_IS_RUNNING: ret = responseVoid(p); break; - case RIL_REQUEST_CDMA_GET_SUBSCRIPTION_SOURCE: ret = responseInts(p); break; - case RIL_REQUEST_ISIM_AUTHENTICATION: ret = responseString(p); break; - case RIL_REQUEST_ACKNOWLEDGE_INCOMING_GSM_SMS_WITH_PDU: ret = responseVoid(p); break; - case RIL_REQUEST_STK_SEND_ENVELOPE_WITH_STATUS: ret = responseICC_IO(p); break; - case RIL_REQUEST_VOICE_RADIO_TECH: ret = responseInts(p); break; - default: - throw new RuntimeException("Unrecognized solicited response: " + rr.mRequest); - //break; - }} catch (Throwable tr) { - // Exceptions here usually mean invalid RIL responses - - Rlog.w(RILJ_LOG_TAG, rr.serialString() + "< " - + requestToString(rr.mRequest) - + " exception, possible invalid RIL response", tr); - - if (rr.mResult != null) { - AsyncResult.forMessage(rr.mResult, null, tr); - rr.mResult.sendToTarget(); - } - return rr; - } - } - - // Here and below fake RIL_UNSOL_RESPONSE_SIM_STATUS_CHANGED, see b/7255789. - // This is needed otherwise we don't automatically transition to the main lock - // screen when the pin or puk is entered incorrectly. - switch (rr.mRequest) { - case RIL_REQUEST_ENTER_SIM_PUK: - case RIL_REQUEST_ENTER_SIM_PUK2: - if (mIccStatusChangedRegistrants != null) { - if (RILJ_LOGD) { - riljLog("ON enter sim puk fakeSimStatusChanged: reg count=" - + mIccStatusChangedRegistrants.size()); - } - mIccStatusChangedRegistrants.notifyRegistrants(); - } - break; - } - - if (error != 0) { - switch (rr.mRequest) { - case RIL_REQUEST_ENTER_SIM_PIN: - case RIL_REQUEST_ENTER_SIM_PIN2: - case RIL_REQUEST_CHANGE_SIM_PIN: - case RIL_REQUEST_CHANGE_SIM_PIN2: - case RIL_REQUEST_SET_FACILITY_LOCK: - if (mIccStatusChangedRegistrants != null) { - if (RILJ_LOGD) { - riljLog("ON some errors fakeSimStatusChanged: reg count=" - + mIccStatusChangedRegistrants.size()); - } - mIccStatusChangedRegistrants.notifyRegistrants(); - } - break; - } - - rr.onError(error, ret); - return rr; - } - - if (RILJ_LOGD) riljLog(rr.serialString() + "< " + requestToString(rr.mRequest) - + " " + retToString(rr.mRequest, ret)); - - if (rr.mResult != null) { - AsyncResult.forMessage(rr.mResult, ret, null); - rr.mResult.sendToTarget(); - } - - return rr; - } - - @Override - public void - dial(String address, int clirMode, UUSInfo uusInfo, Message result) { - RILRequest rr; - if (PhoneNumberUtils.isEmergencyNumber(address)) { - dialEmergencyCall(address, clirMode, result); - return; - } - - rr = RILRequest.obtain(RIL_REQUEST_DIAL, result); - rr.mParcel.writeString(address); - rr.mParcel.writeInt(clirMode); - - if (uusInfo == null) { - rr.mParcel.writeInt(0); // UUS information is absent - } else { - rr.mParcel.writeInt(1); // UUS information is present - rr.mParcel.writeInt(uusInfo.getType()); - rr.mParcel.writeInt(uusInfo.getDcs()); - rr.mParcel.writeByteArray(uusInfo.getUserData()); - } - - if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)); - - send(rr); - } - -/* @Override - public void - getIccCardStatus(Message result) { - if (mState != RadioState.RADIO_ON) { - mPendingGetSimStatus = result; - } else { - super.getIccCardStatus(result); - } - } - @Override - protected void - switchToRadioState(RadioState newState) { - super.switchToRadioState(newState); - if (newState == RadioState.RADIO_ON && mPendingGetSimStatus != null) { - super.getIccCardStatus(mPendingGetSimStatus); - mPendingGetSimStatus = null; - } - }*/ - - public void - dialEmergencyCall(String address, int clirMode, Message result) { - RILRequest rr; - Rlog.v(RILJ_LOG_TAG, "Emergency dial: " + address); - - rr = RILRequest.obtain(RIL_REQUEST_DIAL_EMERGENCY, result); - rr.mParcel.writeString(address + "/"); - rr.mParcel.writeInt(clirMode); - rr.mParcel.writeInt(0); // UUS information is absent - - if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)); - - send(rr); - } - - @Override - protected void - processUnsolicited (Parcel p) { - int dataPosition = p.dataPosition(); - int response = p.readInt(); - - switch(response) { - case RIL_UNSOL_STK_PROACTIVE_COMMAND: - Object ret = responseString(p); - if (RILJ_LOGD) unsljLogRet(response, ret); - - if (mCatProCmdRegistrant != null) { - mCatProCmdRegistrant.notifyRegistrant( - new AsyncResult (null, ret, null)); - } else { - // The RIL will send a CAT proactive command before the - // registrant is registered. Buffer it to make sure it - // does not get ignored (and breaks CatService). - mCatProCmdBuffer = ret; - } - break; - - default: - // Rewind the Parcel - p.setDataPosition(dataPosition); - - // Forward responses that we are not overriding to the super class - super.processUnsolicited(p); - return; - } - - } - - @Override - public void setOnCatProactiveCmd(Handler h, int what, Object obj) { - mCatProCmdRegistrant = new Registrant (h, what, obj); - if (mCatProCmdBuffer != null) { - mCatProCmdRegistrant.notifyRegistrant( - new AsyncResult (null, mCatProCmdBuffer, null)); - mCatProCmdBuffer = null; - } - } - - private void - constructGsmSendSmsRilRequest (RILRequest rr, String smscPDU, String pdu) { - rr.mParcel.writeInt(2); - rr.mParcel.writeString(smscPDU); - rr.mParcel.writeString(pdu); - } - - /** - * The RIL can't handle the RIL_REQUEST_SEND_SMS_EXPECT_MORE - * request properly, so we use RIL_REQUEST_SEND_SMS instead. - */ - @Override - public void - sendSMSExpectMore (String smscPDU, String pdu, Message result) { - RILRequest rr - = RILRequest.obtain(RIL_REQUEST_SEND_SMS, result); - - constructGsmSendSmsRilRequest(rr, smscPDU, pdu); - - if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)); - - send(rr); - } - -} -- cgit v1.1 From 3c25dd2934efa5bcbb1d21aa6c15240807717668 Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Sun, 6 Dec 2015 12:59:12 +0530 Subject: n7100: fix fstab again --- rootdir/fstab.smdk4x12 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/rootdir/fstab.smdk4x12 b/rootdir/fstab.smdk4x12 index dcdcbd2..5f90e5d 100644 --- a/rootdir/fstab.smdk4x12 +++ b/rootdir/fstab.smdk4x12 @@ -10,8 +10,9 @@ /dev/block/mmcblk0p14 /preload ext4 noatime,nosuid,nodev,journal_async_commit wait /dev/block/mmcblk0p16 /data ext4 noatime,nosuid,nodev,noauto_da_alloc,journal_async_commit,errors=panic wait,check,encryptable=footer -/devices/platform/s3c-sdhci.2/mmc_host/mmc1* auto auto defaults voldmanaged=sdcard1:auto,encryptable=userdata -/devices/platform/s5p-ehci* auto auto defaults voldmanaged=usb:auto,noemulatedsd +# vold-managed volumes ("block device" is actually a sysfs devpath) +/devices/platform/s3c-sdhci.2/mmc_host/mmc1* /storage/sdcard1 auto defaults voldmanaged=sdcard1:auto,encryptable=userdata +/devices/platform/s5p-ehci* /storage/usbdisk0 auto defaults voldmanaged=usb:auto,noemulatedsd # recovery /dev/block/mmcblk0p8 /boot emmc defaults recoveryonly -- cgit v1.1 From 563a328793726c9b257f8b1937ee408d6357f6cd Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Thu, 10 Dec 2015 10:56:23 +0530 Subject: n7100: GPS updates credits to Ivan Meler --- configs/gps.xml | 9 ++-- include/hardware/gps.h | 113 +++++++++++++++++++++++++++++++------------------ n7100.mk | 2 - rootdir/init.target.rc | 15 ++++--- 4 files changed, 85 insertions(+), 54 deletions(-) diff --git a/configs/gps.xml b/configs/gps.xml index d482215..28a291c 100644 --- a/configs/gps.xml +++ b/configs/gps.xml @@ -6,11 +6,11 @@ lBaudRate="921600" gpioNStdbyPath="/sys/class/sec/gps/GPS_PWR_EN/value" gpioDelayMs="250" - acNvStoDir="/data/gps/" + acNvStoDir="/data/system/gps/" FactoryTestFilePath="/data/" Log="JAVA" - acLogDirectory="/sdcard/gps/broadcom/storage" + acLogDirectory="/storage/sdcard0/gps/broadcom/storage" TISEnabled="true" LPmode="false" @@ -39,9 +39,10 @@ LbsSyncLto="false" SyncLto="true" ltoFileName="lto2.dat" - acLtoDir="/data/gps/" + acLtoDir="/data/system/gps/" LbsSyncLtoThresholdDays="1" LbsTAC="10101106" + LbsCellEnable="false" ctrlPipe="/data/gps/glgpsctrl" LbsWlanEnable="false" @@ -55,7 +56,7 @@ Date: Mon, 21 Dec 2015 20:16:06 +0530 Subject: n7100: more GPS updates * picked up the fixes from the i9300 device tree. referenced the below commits * i9300: GPS modifications for use of Groupers PIE blobs [1/2] - 68ff6eba8345e3ac7c6d007fc5db720e664a5bee * i9300: Grouper blobs update for init - ddce304caa0d9e7b7d2858f409fc99252737c3e1 * i9300: use sh to run gps_daemon and fix config location - 0f6eaf519939d51b7d2c3018047b1bcabc73fa06 all credits to keepcalm444 --- configs/gps.xml | 18 +- gps_daemon.sh | 2 + include/hardware/gps.h | 1884 ------------------------------------------------ rootdir/init.target.rc | 32 +- 4 files changed, 30 insertions(+), 1906 deletions(-) create mode 100644 gps_daemon.sh delete mode 100644 include/hardware/gps.h diff --git a/configs/gps.xml b/configs/gps.xml index 28a291c..6c6124d 100644 --- a/configs/gps.xml +++ b/configs/gps.xml @@ -6,17 +6,13 @@ lBaudRate="921600" gpioNStdbyPath="/sys/class/sec/gps/GPS_PWR_EN/value" gpioDelayMs="250" - acNvStoDir="/data/system/gps/" - FactoryTestFilePath="/data/" + acNvStoDir="/data/gps/" + acNmeaOutName="/data/gps/nmea_out" + ctrlPipe="/data/gps/glgpsctrl" Log="JAVA" acLogDirectory="/storage/sdcard0/gps/broadcom/storage" - TISEnabled="true" - LPmode="false" - cp-cold-start="false" - cp-guard-time-sec="1" - arp-supl-enable="true" arp-supl-cap-msb="true" arp-supl-cap-msa="true" @@ -32,19 +28,13 @@ SuplUT3Seconds="20" SuplVersion="1" - LbsEnable="true" - LbsLocal="false" - LbsServer="BCMLS2.glpals.com" - LbsPort="7275" LbsSyncLto="false" SyncLto="true" ltoFileName="lto2.dat" - acLtoDir="/data/system/gps/" + acLtoDir="/data/gps/" LbsSyncLtoThresholdDays="1" - LbsTAC="10101106" LbsCellEnable="false" ctrlPipe="/data/gps/glgpsctrl" - LbsWlanEnable="false" IgnoreJniTime="true" AssertEnabled="false" diff --git a/gps_daemon.sh b/gps_daemon.sh new file mode 100644 index 0000000..7cd6b64 --- /dev/null +++ b/gps_daemon.sh @@ -0,0 +1,2 @@ +#shellscript as this is the only way selinux will allow this to proceed +/system/bin/glgps -c /system/etc/gps.xml diff --git a/include/hardware/gps.h b/include/hardware/gps.h deleted file mode 100644 index 361e811..0000000 --- a/include/hardware/gps.h +++ /dev/null @@ -1,1884 +0,0 @@ -/* - * Copyright (C) 2010 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. - */ - -#ifndef ANDROID_INCLUDE_HARDWARE_GPS_H -#define ANDROID_INCLUDE_HARDWARE_GPS_H - -#include -#include -#include -#include -#include -#include - -#include - -__BEGIN_DECLS - -/** - * The id of this module - */ -#define GPS_HARDWARE_MODULE_ID "gps" - - -/** Milliseconds since January 1, 1970 */ -typedef int64_t GpsUtcTime; - -/** Maximum number of SVs for gps_sv_status_callback(). */ -#define GPS_MAX_SVS 32 - -/** Maximum number of Measurements in gps_measurement_callback(). */ -#define GPS_MAX_MEASUREMENT 32 - -/** Requested operational mode for GPS operation. */ -typedef uint32_t GpsPositionMode; -// IMPORTANT: Note that the following values must match -// constants in GpsLocationProvider.java. -/** Mode for running GPS standalone (no assistance). */ -#define GPS_POSITION_MODE_STANDALONE 0 -/** AGPS MS-Based mode. */ -#define GPS_POSITION_MODE_MS_BASED 1 -/** - * AGPS MS-Assisted mode. This mode is not maintained by the platform anymore. - * It is strongly recommended to use GPS_POSITION_MODE_MS_BASE instead. - */ -#define GPS_POSITION_MODE_MS_ASSISTED 2 - -/** Requested recurrence mode for GPS operation. */ -typedef uint32_t GpsPositionRecurrence; -// IMPORTANT: Note that the following values must match -// constants in GpsLocationProvider.java. -/** Receive GPS fixes on a recurring basis at a specified period. */ -#define GPS_POSITION_RECURRENCE_PERIODIC 0 -/** Request a single shot GPS fix. */ -#define GPS_POSITION_RECURRENCE_SINGLE 1 - -/** GPS status event values. */ -typedef uint16_t GpsStatusValue; -// IMPORTANT: Note that the following values must match -// constants in GpsLocationProvider.java. -/** GPS status unknown. */ -#define GPS_STATUS_NONE 0 -/** GPS has begun navigating. */ -#define GPS_STATUS_SESSION_BEGIN 1 -/** GPS has stopped navigating. */ -#define GPS_STATUS_SESSION_END 2 -/** GPS has powered on but is not navigating. */ -#define GPS_STATUS_ENGINE_ON 3 -/** GPS is powered off. */ -#define GPS_STATUS_ENGINE_OFF 4 - -/** Flags to indicate which values are valid in a GpsLocation. */ -typedef uint16_t GpsLocationFlags; -// IMPORTANT: Note that the following values must match -// constants in GpsLocationProvider.java. -/** GpsLocation has valid latitude and longitude. */ -#define GPS_LOCATION_HAS_LAT_LONG 0x0001 -/** GpsLocation has valid altitude. */ -#define GPS_LOCATION_HAS_ALTITUDE 0x0002 -/** GpsLocation has valid speed. */ -#define GPS_LOCATION_HAS_SPEED 0x0004 -/** GpsLocation has valid bearing. */ -#define GPS_LOCATION_HAS_BEARING 0x0008 -/** GpsLocation has valid accuracy. */ -#define GPS_LOCATION_HAS_ACCURACY 0x0010 - -/** Flags for the gps_set_capabilities callback. */ - -/** GPS HAL schedules fixes for GPS_POSITION_RECURRENCE_PERIODIC mode. - If this is not set, then the framework will use 1000ms for min_interval - and will start and call start() and stop() to schedule the GPS. - */ -#define GPS_CAPABILITY_SCHEDULING 0x0000001 -/** GPS supports MS-Based AGPS mode */ -#define GPS_CAPABILITY_MSB 0x0000002 -/** GPS supports MS-Assisted AGPS mode */ -#define GPS_CAPABILITY_MSA 0x0000004 -/** GPS supports single-shot fixes */ -#define GPS_CAPABILITY_SINGLE_SHOT 0x0000008 -/** GPS supports on demand time injection */ -#define GPS_CAPABILITY_ON_DEMAND_TIME 0x0000010 -/** GPS supports Geofencing */ -#define GPS_CAPABILITY_GEOFENCING 0x0000020 -/** GPS supports Measurements */ -#define GPS_CAPABILITY_MEASUREMENTS 0x0000040 -/** GPS supports Navigation Messages */ -#define GPS_CAPABILITY_NAV_MESSAGES 0x0000080 - -/** Flags used to specify which aiding data to delete - when calling delete_aiding_data(). */ -typedef uint16_t GpsAidingData; -// IMPORTANT: Note that the following values must match -// constants in GpsLocationProvider.java. -#define GPS_DELETE_EPHEMERIS 0x0001 -#define GPS_DELETE_ALMANAC 0x0002 -#define GPS_DELETE_POSITION 0x0004 -#define GPS_DELETE_TIME 0x0008 -#define GPS_DELETE_IONO 0x0010 -#define GPS_DELETE_UTC 0x0020 -#define GPS_DELETE_HEALTH 0x0040 -#define GPS_DELETE_SVDIR 0x0080 -#define GPS_DELETE_SVSTEER 0x0100 -#define GPS_DELETE_SADATA 0x0200 -#define GPS_DELETE_RTI 0x0400 -#define GPS_DELETE_CELLDB_INFO 0x8000 -#define GPS_DELETE_ALL 0xFFFF - -/** AGPS type */ -typedef uint16_t AGpsType; -#define AGPS_TYPE_SUPL 1 -#define AGPS_TYPE_C2K 2 - -typedef uint16_t AGpsSetIDType; -#define AGPS_SETID_TYPE_NONE 0 -#define AGPS_SETID_TYPE_IMSI 1 -#define AGPS_SETID_TYPE_MSISDN 2 - -typedef uint16_t ApnIpType; -#define APN_IP_INVALID 0 -#define APN_IP_IPV4 1 -#define APN_IP_IPV6 2 -#define APN_IP_IPV4V6 3 - -/** - * String length constants - */ -#define GPS_NI_SHORT_STRING_MAXLEN 256 -#define GPS_NI_LONG_STRING_MAXLEN 2048 - -/** - * GpsNiType constants - */ -typedef uint32_t GpsNiType; -#define GPS_NI_TYPE_VOICE 1 -#define GPS_NI_TYPE_UMTS_SUPL 2 -#define GPS_NI_TYPE_UMTS_CTRL_PLANE 3 - -/** - * GpsNiNotifyFlags constants - */ -typedef uint32_t GpsNiNotifyFlags; -/** NI requires notification */ -#define GPS_NI_NEED_NOTIFY 0x0001 -/** NI requires verification */ -#define GPS_NI_NEED_VERIFY 0x0002 -/** NI requires privacy override, no notification/minimal trace */ -#define GPS_NI_PRIVACY_OVERRIDE 0x0004 - -/** - * GPS NI responses, used to define the response in - * NI structures - */ -typedef int GpsUserResponseType; -#define GPS_NI_RESPONSE_ACCEPT 1 -#define GPS_NI_RESPONSE_DENY 2 -#define GPS_NI_RESPONSE_NORESP 3 - -/** - * NI data encoding scheme - */ -typedef int GpsNiEncodingType; -#define GPS_ENC_NONE 0 -#define GPS_ENC_SUPL_GSM_DEFAULT 1 -#define GPS_ENC_SUPL_UTF8 2 -#define GPS_ENC_SUPL_UCS2 3 -#define GPS_ENC_UNKNOWN -1 - -/** AGPS status event values. */ -typedef uint16_t AGpsStatusValue; -/** GPS requests data connection for AGPS. */ -#define GPS_REQUEST_AGPS_DATA_CONN 1 -/** GPS releases the AGPS data connection. */ -#define GPS_RELEASE_AGPS_DATA_CONN 2 -/** AGPS data connection initiated */ -#define GPS_AGPS_DATA_CONNECTED 3 -/** AGPS data connection completed */ -#define GPS_AGPS_DATA_CONN_DONE 4 -/** AGPS data connection failed */ -#define GPS_AGPS_DATA_CONN_FAILED 5 - -#define AGPS_REF_LOCATION_TYPE_GSM_CELLID 1 -#define AGPS_REF_LOCATION_TYPE_UMTS_CELLID 2 -#define AGPS_REG_LOCATION_TYPE_MAC 3 - -/** Network types for update_network_state "type" parameter */ -#define AGPS_RIL_NETWORK_TYPE_MOBILE 0 -#define AGPS_RIL_NETWORK_TYPE_WIFI 1 -#define AGPS_RIL_NETWORK_TYPE_MOBILE_MMS 2 -#define AGPS_RIL_NETWORK_TYPE_MOBILE_SUPL 3 -#define AGPS_RIL_NETWORK_TTYPE_MOBILE_DUN 4 -#define AGPS_RIL_NETWORK_TTYPE_MOBILE_HIPRI 5 -#define AGPS_RIL_NETWORK_TTYPE_WIMAX 6 - -/** - * Flags to indicate what fields in GpsClock are valid. - */ -typedef uint16_t GpsClockFlags; -/** A valid 'leap second' is stored in the data structure. */ -#define GPS_CLOCK_HAS_LEAP_SECOND (1<<0) -/** A valid 'time uncertainty' is stored in the data structure. */ -#define GPS_CLOCK_HAS_TIME_UNCERTAINTY (1<<1) -/** A valid 'full bias' is stored in the data structure. */ -#define GPS_CLOCK_HAS_FULL_BIAS (1<<2) -/** A valid 'bias' is stored in the data structure. */ -#define GPS_CLOCK_HAS_BIAS (1<<3) -/** A valid 'bias uncertainty' is stored in the data structure. */ -#define GPS_CLOCK_HAS_BIAS_UNCERTAINTY (1<<4) -/** A valid 'drift' is stored in the data structure. */ -#define GPS_CLOCK_HAS_DRIFT (1<<5) -/** A valid 'drift uncertainty' is stored in the data structure. */ -#define GPS_CLOCK_HAS_DRIFT_UNCERTAINTY (1<<6) - -/** - * Enumeration of the available values for the GPS Clock type. - */ -typedef uint8_t GpsClockType; -/** The type is not available ot it is unknown. */ -#define GPS_CLOCK_TYPE_UNKNOWN 0 -/** The source of the time value reported by GPS clock is the local hardware clock. */ -#define GPS_CLOCK_TYPE_LOCAL_HW_TIME 1 -/** - * The source of the time value reported by GPS clock is the GPS time derived from satellites - * (epoch = Jan 6, 1980) - */ -#define GPS_CLOCK_TYPE_GPS_TIME 2 - -/** - * Flags to indicate what fields in GpsMeasurement are valid. - */ -typedef uint32_t GpsMeasurementFlags; -/** A valid 'snr' is stored in the data structure. */ -#define GPS_MEASUREMENT_HAS_SNR (1<<0) -/** A valid 'elevation' is stored in the data structure. */ -#define GPS_MEASUREMENT_HAS_ELEVATION (1<<1) -/** A valid 'elevation uncertainty' is stored in the data structure. */ -#define GPS_MEASUREMENT_HAS_ELEVATION_UNCERTAINTY (1<<2) -/** A valid 'azimuth' is stored in the data structure. */ -#define GPS_MEASUREMENT_HAS_AZIMUTH (1<<3) -/** A valid 'azimuth uncertainty' is stored in the data structure. */ -#define GPS_MEASUREMENT_HAS_AZIMUTH_UNCERTAINTY (1<<4) -/** A valid 'pseudorange' is stored in the data structure. */ -#define GPS_MEASUREMENT_HAS_PSEUDORANGE (1<<5) -/** A valid 'pseudorange uncertainty' is stored in the data structure. */ -#define GPS_MEASUREMENT_HAS_PSEUDORANGE_UNCERTAINTY (1<<6) -/** A valid 'code phase' is stored in the data structure. */ -#define GPS_MEASUREMENT_HAS_CODE_PHASE (1<<7) -/** A valid 'code phase uncertainty' is stored in the data structure. */ -#define GPS_MEASUREMENT_HAS_CODE_PHASE_UNCERTAINTY (1<<8) -/** A valid 'carrier frequency' is stored in the data structure. */ -#define GPS_MEASUREMENT_HAS_CARRIER_FREQUENCY (1<<9) -/** A valid 'carrier cycles' is stored in the data structure. */ -#define GPS_MEASUREMENT_HAS_CARRIER_CYCLES (1<<10) -/** A valid 'carrier phase' is stored in the data structure. */ -#define GPS_MEASUREMENT_HAS_CARRIER_PHASE (1<<11) -/** A valid 'carrier phase uncertainty' is stored in the data structure. */ -#define GPS_MEASUREMENT_HAS_CARRIER_PHASE_UNCERTAINTY (1<<12) -/** A valid 'bit number' is stored in the data structure. */ -#define GPS_MEASUREMENT_HAS_BIT_NUMBER (1<<13) -/** A valid 'time from last bit' is stored in the data structure. */ -#define GPS_MEASUREMENT_HAS_TIME_FROM_LAST_BIT (1<<14) -/** A valid 'doppler shift' is stored in the data structure. */ -#define GPS_MEASUREMENT_HAS_DOPPLER_SHIFT (1<<15) -/** A valid 'doppler shift uncertainty' is stored in the data structure. */ -#define GPS_MEASUREMENT_HAS_DOPPLER_SHIFT_UNCERTAINTY (1<<16) -/** A valid 'used in fix' flag is stored in the data structure. */ -#define GPS_MEASUREMENT_HAS_USED_IN_FIX (1<<17) -/** The value of 'pseudorange rate' is uncorrected. */ -#define GPS_MEASUREMENT_HAS_UNCORRECTED_PSEUDORANGE_RATE (1<<18) - -/** - * Enumeration of the available values for the GPS Measurement's loss of lock. - */ -typedef uint8_t GpsLossOfLock; -/** The indicator is not available or it is unknown. */ -#define GPS_LOSS_OF_LOCK_UNKNOWN 0 -/** The measurement does not present any indication of loss of lock. */ -#define GPS_LOSS_OF_LOCK_OK 1 -/** Loss of lock between previous and current observation: cycle slip possible. */ -#define GPS_LOSS_OF_LOCK_CYCLE_SLIP 2 - -/** - * Enumeration of available values for the GPS Measurement's multipath indicator. - */ -typedef uint8_t GpsMultipathIndicator; -/** The indicator is not available or unknown. */ -#define GPS_MULTIPATH_INDICATOR_UNKNOWN 0 -/** The measurement has been indicated to use multipath. */ -#define GPS_MULTIPATH_INDICATOR_DETECTED 1 -/** The measurement has been indicated Not to use multipath. */ -#define GPS_MULTIPATH_INDICATOR_NOT_USED 2 - -/** - * Flags indicating the GPS measurement state. - * The expected behavior here is for GPS HAL to set all the flags that applies. For - * example, if the state for a satellite is only C/A code locked and bit synchronized, - * and there is still millisecond ambiguity, the state should be set as: - * GPS_MEASUREMENT_STATE_CODE_LOCK|GPS_MEASUREMENT_STATE_BIT_SYNC|GPS_MEASUREMENT_STATE_MSEC_AMBIGUOUS - * If GPS is still searching for a satellite, the corresponding state should be set to - * GPS_MEASUREMENT_STATE_UNKNOWN(0). - */ -typedef uint16_t GpsMeasurementState; -#define GPS_MEASUREMENT_STATE_UNKNOWN 0 -#define GPS_MEASUREMENT_STATE_CODE_LOCK (1<<0) -#define GPS_MEASUREMENT_STATE_BIT_SYNC (1<<1) -#define GPS_MEASUREMENT_STATE_SUBFRAME_SYNC (1<<2) -#define GPS_MEASUREMENT_STATE_TOW_DECODED (1<<3) -#define GPS_MEASUREMENT_STATE_MSEC_AMBIGUOUS (1<<4) - -/** - * Flags indicating the Accumulated Delta Range's states. - */ -typedef uint16_t GpsAccumulatedDeltaRangeState; -#define GPS_ADR_STATE_UNKNOWN 0 -#define GPS_ADR_STATE_VALID (1<<0) -#define GPS_ADR_STATE_RESET (1<<1) -#define GPS_ADR_STATE_CYCLE_SLIP (1<<2) - -/** - * Enumeration of available values to indicate the available GPS Navigation message types. - */ -typedef uint8_t GpsNavigationMessageType; -/** The message type is unknown. */ -#define GPS_NAVIGATION_MESSAGE_TYPE_UNKNOWN 0 -/** L1 C/A message contained in the structure. */ -#define GPS_NAVIGATION_MESSAGE_TYPE_L1CA 1 -/** L2-CNAV message contained in the structure. */ -#define GPS_NAVIGATION_MESSAGE_TYPE_L2CNAV 2 -/** L5-CNAV message contained in the structure. */ -#define GPS_NAVIGATION_MESSAGE_TYPE_L5CNAV 3 -/** CNAV-2 message contained in the structure. */ -#define GPS_NAVIGATION_MESSAGE_TYPE_CNAV2 4 - -/** - * Status of Navigation Message - * When a message is received properly without any parity error in its navigation words, the - * status should be set to NAV_MESSAGE_STATUS_PARITY_PASSED. But if a message is received - * with words that failed parity check, but GPS is able to correct those words, the status - * should be set to NAV_MESSAGE_STATUS_PARITY_REBUILT. - * No need to send any navigation message that contains words with parity error and cannot be - * corrected. - */ -typedef uint16_t NavigationMessageStatus; -#define NAV_MESSAGE_STATUS_UNKONW 0 -#define NAV_MESSAGE_STATUS_PARITY_PASSED (1<<0) -#define NAV_MESSAGE_STATUS_PARITY_REBUILT (1<<1) - -/** - * Name for the GPS XTRA interface. - */ -#define GPS_XTRA_INTERFACE "gps-xtra" - -/** - * Name for the GPS DEBUG interface. - */ -#define GPS_DEBUG_INTERFACE "gps-debug" - -/** - * Name for the AGPS interface. - */ -#define AGPS_INTERFACE "agps" - -/** - * Name of the Supl Certificate interface. - */ -#define SUPL_CERTIFICATE_INTERFACE "supl-certificate" - -/** - * Name for NI interface - */ -#define GPS_NI_INTERFACE "gps-ni" - -/** - * Name for the AGPS-RIL interface. - */ -#define AGPS_RIL_INTERFACE "agps_ril" - -/** - * The GPS chipset can use Psc for AGPS. - */ -#define AGPS_USE_PSC - -/** - * Name for the GPS_Geofencing interface. - */ -#define GPS_GEOFENCING_INTERFACE "gps_geofencing" - -/** - * Name of the GPS Measurements interface. - */ -#define GPS_MEASUREMENT_INTERFACE "gps_measurement" - -/** - * Name of the GPS navigation message interface. - */ -#define GPS_NAVIGATION_MESSAGE_INTERFACE "gps_navigation_message" - -/** - * Name of the GNSS/GPS configuration interface. - */ -#define GNSS_CONFIGURATION_INTERFACE "gnss_configuration" - - -/** Represents a location. */ -typedef struct { - /** set to sizeof(GpsLocation) */ - size_t size; - /** Contains GpsLocationFlags bits. */ - uint16_t flags; - /** Represents latitude in degrees. */ - double latitude; - /** Represents longitude in degrees. */ - double longitude; - /** Represents altitude in meters above the WGS 84 reference - * ellipsoid. */ - double altitude; - /** Represents speed in meters per second. */ - float speed; - /** Represents heading in degrees. */ - float bearing; - /** Represents expected accuracy in meters. */ - float accuracy; - /** Timestamp for the location fix. */ - GpsUtcTime timestamp; -} GpsLocation; - -/** Represents the status. */ -typedef struct { - /** set to sizeof(GpsStatus) */ - size_t size; - GpsStatusValue status; -} GpsStatus; - -/** Represents SV information. */ -typedef struct { - /** set to sizeof(GpsSvInfo) */ - size_t size; - /** Pseudo-random number for the SV. */ - int prn; - /** Signal to noise ratio. */ - float snr; - /** Elevation of SV in degrees. */ - float elevation; - /** Azimuth of SV in degrees. */ - float azimuth; - /** Unknown field in Samsung I9100 libgps - May be an indicator for constellation type - (GPS, GLONASS, Galileo)? - Used on GT-I9100, likely also present on GT-N7000, - SGH-I717, SGH-I727 but this needs confirmation. - */ - int unknown_samsung_field; -} GpsSvInfo; - -/** Represents SV status. */ -typedef struct { - /** set to sizeof(GpsSvStatus) */ - size_t size; - - /** Number of SVs currently visible. */ - int num_svs; - - /** Contains an array of SV information. */ - GpsSvInfo sv_list[GPS_MAX_SVS]; - - /** Represents a bit mask indicating which SVs - * have ephemeris data. - */ - uint32_t ephemeris_mask; - - /** Represents a bit mask indicating which SVs - * have almanac data. - */ - uint32_t almanac_mask; - - /** - * Represents a bit mask indicating which SVs - * were used for computing the most recent position fix. - */ - uint32_t used_in_fix_mask; -} GpsSvStatus; - - -/* 2G and 3G */ -/* In 3G lac is discarded */ -typedef struct { - uint16_t type; - uint16_t mcc; - uint16_t mnc; - uint16_t lac; -#ifdef AGPS_USE_PSC - uint16_t psc; -#endif - uint32_t cid; -} AGpsRefLocationCellID; - -typedef struct { - uint8_t mac[6]; -} AGpsRefLocationMac; - -/** Represents ref locations */ -typedef struct { - uint16_t type; - union { - AGpsRefLocationCellID cellID; - AGpsRefLocationMac mac; - } u; -} AGpsRefLocation; - -/** Callback with location information. - * Can only be called from a thread created by create_thread_cb. - */ -typedef void (* gps_location_callback)(GpsLocation* location); - -/** Callback with status information. - * Can only be called from a thread created by create_thread_cb. - */ -typedef void (* gps_status_callback)(GpsStatus* status); - -/** - * Callback with SV status information. - * Can only be called from a thread created by create_thread_cb. - */ -typedef void (* gps_sv_status_callback)(GpsSvStatus* sv_info); - -/** Callback for reporting NMEA sentences. - * Can only be called from a thread created by create_thread_cb. - */ -typedef void (* gps_nmea_callback)(GpsUtcTime timestamp, const char* nmea, int length); - -/** Callback to inform framework of the GPS engine's capabilities. - * Capability parameter is a bit field of GPS_CAPABILITY_* flags. - */ -typedef void (* gps_set_capabilities)(uint32_t capabilities); - -/** Callback utility for acquiring the GPS wakelock. - * This can be used to prevent the CPU from suspending while handling GPS events. - */ -typedef void (* gps_acquire_wakelock)(); - -/** Callback utility for releasing the GPS wakelock. */ -typedef void (* gps_release_wakelock)(); - -/** Callback for requesting NTP time */ -typedef void (* gps_request_utc_time)(); - -/** Callback for creating a thread that can call into the Java framework code. - * This must be used to create any threads that report events up to the framework. - */ -typedef pthread_t (* gps_create_thread)(const char* name, void (*start)(void *), void* arg); - -/** GPS callback structure. */ -typedef struct { - /** set to sizeof(GpsCallbacks) */ - size_t size; - gps_location_callback location_cb; - gps_status_callback status_cb; - gps_sv_status_callback sv_status_cb; - gps_nmea_callback nmea_cb; - gps_set_capabilities set_capabilities_cb; - gps_acquire_wakelock acquire_wakelock_cb; - gps_release_wakelock release_wakelock_cb; - gps_create_thread create_thread_cb; - gps_request_utc_time request_utc_time_cb; -} GpsCallbacks; - - -/** Represents the standard GPS interface. */ -typedef struct { - /** set to sizeof(GpsInterface) */ - size_t size; - /** - * Opens the interface and provides the callback routines - * to the implementation of this interface. - */ - int (*init)( GpsCallbacks* callbacks ); - - /** Starts navigating. */ - int (*start)( void ); - - /** Stops navigating. */ - int (*stop)( void ); - - /** Closes the interface. */ - void (*cleanup)( void ); - - /** Injects the current time. */ - int (*inject_time)(GpsUtcTime time, int64_t timeReference, - int uncertainty); - - /** Injects current location from another location provider - * (typically cell ID). - * latitude and longitude are measured in degrees - * expected accuracy is measured in meters - */ - int (*inject_location)(double latitude, double longitude, float accuracy); - - /** - * Specifies that the next call to start will not use the - * information defined in the flags. GPS_DELETE_ALL is passed for - * a cold start. - */ - void (*delete_aiding_data)(GpsAidingData flags); - - /** - * min_interval represents the time between fixes in milliseconds. - * preferred_accuracy represents the requested fix accuracy in meters. - * preferred_time represents the requested time to first fix in milliseconds. - * - * 'mode' parameter should be one of GPS_POSITION_MODE_MS_BASE - * or GPS_POSITION_MODE_STANDALONE. - * It is allowed by the platform (and it is recommended) to fallback to - * GPS_POSITION_MODE_MS_BASE if GPS_POSITION_MODE_MS_ASSISTED is passed in, and - * GPS_POSITION_MODE_MS_BASED is supported. - */ - int (*set_position_mode)(GpsPositionMode mode, GpsPositionRecurrence recurrence, - uint32_t min_interval, uint32_t preferred_accuracy, uint32_t preferred_time); - - /** Get a pointer to extension information. */ - const void* (*get_extension)(const char* name); -} GpsInterface; - -/** Callback to request the client to download XTRA data. - * The client should download XTRA data and inject it by calling inject_xtra_data(). - * Can only be called from a thread created by create_thread_cb. - */ -typedef void (* gps_xtra_download_request)(); - -/** Callback structure for the XTRA interface. */ -typedef struct { - gps_xtra_download_request download_request_cb; - gps_create_thread create_thread_cb; -} GpsXtraCallbacks; - -/** Extended interface for XTRA support. */ -typedef struct { - /** set to sizeof(GpsXtraInterface) */ - size_t size; - /** - * Opens the XTRA interface and provides the callback routines - * to the implementation of this interface. - */ - int (*init)( GpsXtraCallbacks* callbacks ); - /** Injects XTRA data into the GPS. */ - int (*inject_xtra_data)( char* data, int length ); -} GpsXtraInterface; - -/** Extended interface for DEBUG support. */ -typedef struct { - /** set to sizeof(GpsDebugInterface) */ - size_t size; - - /** - * This function should return any information that the native - * implementation wishes to include in a bugreport. - */ - size_t (*get_internal_state)(char* buffer, size_t bufferSize); -} GpsDebugInterface; - -#pragma pack(push,4) -// We need to keep the alignment of this data structure to 4-bytes, to ensure that in 64-bit -// environments the size of this legacy definition does not collide with _v2. Implementations should -// be using _v2 and _v3, so it's OK to pay the 'unaligned' penalty in 64-bit if an old -// implementation is still in use. - -/** Represents the status of AGPS. */ -typedef struct { - /** set to sizeof(AGpsStatus_v1) */ - size_t size; - - AGpsType type; - AGpsStatusValue status; -} AGpsStatus_v1; - -#pragma pack(pop) - -/** Represents the status of AGPS augmented with a IPv4 address field. */ -typedef struct { - /** set to sizeof(AGpsStatus_v2) */ - size_t size; - - AGpsType type; - AGpsStatusValue status; - uint32_t ipaddr; -} AGpsStatus_v2; - -/* Represents the status of AGPS augmented to support IPv4 and IPv6. */ -typedef struct { - /** set to sizeof(AGpsStatus_v3) */ - size_t size; - - AGpsType type; - AGpsStatusValue status; - - /** - * Must be set to a valid IPv4 address if the field 'addr' contains an IPv4 - * address, or set to INADDR_NONE otherwise. - */ - uint32_t ipaddr; - - /** - * Must contain the IPv4 (AF_INET) or IPv6 (AF_INET6) address to report. - * Any other value of addr.ss_family will be rejected. - * */ - struct sockaddr_storage addr; -} AGpsStatus_v3; - -typedef AGpsStatus_v3 AGpsStatus; - -/** Callback with AGPS status information. - * Can only be called from a thread created by create_thread_cb. - */ -typedef void (* agps_status_callback)(AGpsStatus* status); - -/** Callback structure for the AGPS interface. */ -typedef struct { - agps_status_callback status_cb; - gps_create_thread create_thread_cb; -} AGpsCallbacks; - - -/** Extended interface for AGPS support. */ -typedef struct { - /** set to sizeof(AGpsInterface_v1) */ - size_t size; - - /** - * Opens the AGPS interface and provides the callback routines - * to the implementation of this interface. - */ - void (*init)( AGpsCallbacks* callbacks ); - /** - * Notifies that a data connection is available and sets - * the name of the APN to be used for SUPL. - */ - int (*data_conn_open)( const char* apn ); - /** - * Notifies that the AGPS data connection has been closed. - */ - int (*data_conn_closed)(); - /** - * Notifies that a data connection is not available for AGPS. - */ - int (*data_conn_failed)(); - /** - * Sets the hostname and port for the AGPS server. - */ - int (*set_server)( AGpsType type, const char* hostname, int port ); -} AGpsInterface_v1; - -/** - * Extended interface for AGPS support, it is augmented to enable to pass - * extra APN data. - */ -typedef struct { - /** set to sizeof(AGpsInterface_v2) */ - size_t size; - - /** - * Opens the AGPS interface and provides the callback routines to the - * implementation of this interface. - */ - void (*init)(AGpsCallbacks* callbacks); - /** - * Deprecated. - * If the HAL supports AGpsInterface_v2 this API will not be used, see - * data_conn_open_with_apn_ip_type for more information. - */ - int (*data_conn_open)(const char* apn); - /** - * Notifies that the AGPS data connection has been closed. - */ - int (*data_conn_closed)(); - /** - * Notifies that a data connection is not available for AGPS. - */ - int (*data_conn_failed)(); - /** - * Sets the hostname and port for the AGPS server. - */ - int (*set_server)(AGpsType type, const char* hostname, int port); - - /** - * Notifies that a data connection is available and sets the name of the - * APN, and its IP type, to be used for SUPL connections. - */ - int (*data_conn_open_with_apn_ip_type)( - const char* apn, - ApnIpType apnIpType); -} AGpsInterface_v2; - -typedef AGpsInterface_v2 AGpsInterface; - -/** Error codes associated with certificate operations */ -#define AGPS_CERTIFICATE_OPERATION_SUCCESS 0 -#define AGPS_CERTIFICATE_ERROR_GENERIC -100 -#define AGPS_CERTIFICATE_ERROR_TOO_MANY_CERTIFICATES -101 - -/** A data structure that represents an X.509 certificate using DER encoding */ -typedef struct { - size_t length; - u_char* data; -} DerEncodedCertificate; - -/** - * A type definition for SHA1 Fingerprints used to identify X.509 Certificates - * The Fingerprint is a digest of the DER Certificate that uniquely identifies it. - */ -typedef struct { - u_char data[20]; -} Sha1CertificateFingerprint; - -/** AGPS Interface to handle SUPL certificate operations */ -typedef struct { - /** set to sizeof(SuplCertificateInterface) */ - size_t size; - - /** - * Installs a set of Certificates used for SUPL connections to the AGPS server. - * If needed the HAL should find out internally any certificates that need to be removed to - * accommodate the certificates to install. - * The certificates installed represent a full set of valid certificates needed to connect to - * AGPS SUPL servers. - * The list of certificates is required, and all must be available at the same time, when trying - * to establish a connection with the AGPS Server. - * - * Parameters: - * certificates - A pointer to an array of DER encoded certificates that are need to be - * installed in the HAL. - * length - The number of certificates to install. - * Returns: - * AGPS_CERTIFICATE_OPERATION_SUCCESS if the operation is completed successfully - * AGPS_CERTIFICATE_ERROR_TOO_MANY_CERTIFICATES if the HAL cannot store the number of - * certificates attempted to be installed, the state of the certificates stored should - * remain the same as before on this error case. - * - * IMPORTANT: - * If needed the HAL should find out internally the set of certificates that need to be - * removed to accommodate the certificates to install. - */ - int (*install_certificates) ( const DerEncodedCertificate* certificates, size_t length ); - - /** - * Notifies the HAL that a list of certificates used for SUPL connections are revoked. It is - * expected that the given set of certificates is removed from the internal store of the HAL. - * - * Parameters: - * fingerprints - A pointer to an array of SHA1 Fingerprints to identify the set of - * certificates to revoke. - * length - The number of fingerprints provided. - * Returns: - * AGPS_CERTIFICATE_OPERATION_SUCCESS if the operation is completed successfully. - * - * IMPORTANT: - * If any of the certificates provided (through its fingerprint) is not known by the HAL, - * it should be ignored and continue revoking/deleting the rest of them. - */ - int (*revoke_certificates) ( const Sha1CertificateFingerprint* fingerprints, size_t length ); -} SuplCertificateInterface; - -/** Represents an NI request */ -typedef struct { - /** set to sizeof(GpsNiNotification) */ - size_t size; - - /** - * An ID generated by HAL to associate NI notifications and UI - * responses - */ - int notification_id; - - /** - * An NI type used to distinguish different categories of NI - * events, such as GPS_NI_TYPE_VOICE, GPS_NI_TYPE_UMTS_SUPL, ... - */ - GpsNiType ni_type; - - /** - * Notification/verification options, combinations of GpsNiNotifyFlags constants - */ - GpsNiNotifyFlags notify_flags; - - /** - * Timeout period to wait for user response. - * Set to 0 for no time out limit. - */ - int timeout; - - /** - * Default response when time out. - */ - GpsUserResponseType default_response; - - /** - * Requestor ID - */ - char requestor_id[GPS_NI_SHORT_STRING_MAXLEN]; - - /** - * Notification message. It can also be used to store client_id in some cases - */ - char text[GPS_NI_LONG_STRING_MAXLEN]; - - /** - * Client name decoding scheme - */ - GpsNiEncodingType requestor_id_encoding; - - /** - * Client name decoding scheme - */ - GpsNiEncodingType text_encoding; - - /** - * A pointer to extra data. Format: - * key_1 = value_1 - * key_2 = value_2 - */ - char extras[GPS_NI_LONG_STRING_MAXLEN]; - -} GpsNiNotification; - -/** Callback with NI notification. - * Can only be called from a thread created by create_thread_cb. - */ -typedef void (*gps_ni_notify_callback)(GpsNiNotification *notification); - -/** GPS NI callback structure. */ -typedef struct -{ - /** - * Sends the notification request from HAL to GPSLocationProvider. - */ - gps_ni_notify_callback notify_cb; - gps_create_thread create_thread_cb; -} GpsNiCallbacks; - -/** - * Extended interface for Network-initiated (NI) support. - */ -typedef struct -{ - /** set to sizeof(GpsNiInterface) */ - size_t size; - - /** Registers the callbacks for HAL to use. */ - void (*init) (GpsNiCallbacks *callbacks); - - /** Sends a response to HAL. */ - void (*respond) (int notif_id, GpsUserResponseType user_response); -} GpsNiInterface; - -struct gps_device_t { - struct hw_device_t common; - - /** - * Set the provided lights to the provided values. - * - * Returns: 0 on succes, error code on failure. - */ - const GpsInterface* (*get_gps_interface)(struct gps_device_t* dev); -}; - -#define AGPS_RIL_REQUEST_SETID_IMSI (1<<0L) -#define AGPS_RIL_REQUEST_SETID_MSISDN (1<<1L) - -#define AGPS_RIL_REQUEST_REFLOC_CELLID (1<<0L) -#define AGPS_RIL_REQUEST_REFLOC_MAC (1<<1L) - -typedef void (*agps_ril_request_set_id)(uint32_t flags); -typedef void (*agps_ril_request_ref_loc)(uint32_t flags); - -typedef struct { - agps_ril_request_set_id request_setid; - agps_ril_request_ref_loc request_refloc; - gps_create_thread create_thread_cb; -} AGpsRilCallbacks; - -/** Extended interface for AGPS_RIL support. */ -typedef struct { - /** set to sizeof(AGpsRilInterface) */ - size_t size; - /** - * Opens the AGPS interface and provides the callback routines - * to the implementation of this interface. - */ - void (*init)( AGpsRilCallbacks* callbacks ); - - /** - * Sets the reference location. - */ - void (*set_ref_location) (const AGpsRefLocation *agps_reflocation, size_t sz_struct); - /** - * Sets the set ID. - */ - void (*set_set_id) (AGpsSetIDType type, const char* setid); - - /** - * Send network initiated message. - */ - void (*ni_message) (uint8_t *msg, size_t len); - - /** - * Notify GPS of network status changes. - * These parameters match values in the android.net.NetworkInfo class. - */ - void (*update_network_state) (int connected, int type, int roaming, const char* extra_info); - - /** - * Notify GPS of network status changes. - * These parameters match values in the android.net.NetworkInfo class. - */ - void (*update_network_availability) (int avaiable, const char* apn); -} AGpsRilInterface; - -/** - * GPS Geofence. - * There are 3 states associated with a Geofence: Inside, Outside, Unknown. - * There are 3 transitions: ENTERED, EXITED, UNCERTAIN. - * - * An example state diagram with confidence level: 95% and Unknown time limit - * set as 30 secs is shown below. (confidence level and Unknown time limit are - * explained latter) - * ____________________________ - * | Unknown (30 secs) | - * """""""""""""""""""""""""""" - * ^ | | ^ - * UNCERTAIN| |ENTERED EXITED| |UNCERTAIN - * | v v | - * ________ EXITED _________ - * | Inside | -----------> | Outside | - * | | <----------- | | - * """""""" ENTERED """"""""" - * - * Inside state: We are 95% confident that the user is inside the geofence. - * Outside state: We are 95% confident that the user is outside the geofence - * Unknown state: Rest of the time. - * - * The Unknown state is better explained with an example: - * - * __________ - * | c| - * | ___ | _______ - * | |a| | | b | - * | """ | """"""" - * | | - * """""""""" - * In the diagram above, "a" and "b" are 2 geofences and "c" is the accuracy - * circle reported by the GPS subsystem. Now with regard to "b", the system is - * confident that the user is outside. But with regard to "a" is not confident - * whether it is inside or outside the geofence. If the accuracy remains the - * same for a sufficient period of time, the UNCERTAIN transition would be - * triggered with the state set to Unknown. If the accuracy improves later, an - * appropriate transition should be triggered. This "sufficient period of time" - * is defined by the parameter in the add_geofence_area API. - * In other words, Unknown state can be interpreted as a state in which the - * GPS subsystem isn't confident enough that the user is either inside or - * outside the Geofence. It moves to Unknown state only after the expiry of the - * timeout. - * - * The geofence callback needs to be triggered for the ENTERED and EXITED - * transitions, when the GPS system is confident that the user has entered - * (Inside state) or exited (Outside state) the Geofence. An implementation - * which uses a value of 95% as the confidence is recommended. The callback - * should be triggered only for the transitions requested by the - * add_geofence_area call. - * - * Even though the diagram and explanation talks about states and transitions, - * the callee is only interested in the transistions. The states are mentioned - * here for illustrative purposes. - * - * Startup Scenario: When the device boots up, if an application adds geofences, - * and then we get an accurate GPS location fix, it needs to trigger the - * appropriate (ENTERED or EXITED) transition for every Geofence it knows about. - * By default, all the Geofences will be in the Unknown state. - * - * When the GPS system is unavailable, gps_geofence_status_callback should be - * called to inform the upper layers of the same. Similarly, when it becomes - * available the callback should be called. This is a global state while the - * UNKNOWN transition described above is per geofence. - * - * An important aspect to note is that users of this API (framework), will use - * other subsystems like wifi, sensors, cell to handle Unknown case and - * hopefully provide a definitive state transition to the third party - * application. GPS Geofence will just be a signal indicating what the GPS - * subsystem knows about the Geofence. - * - */ -#define GPS_GEOFENCE_ENTERED (1<<0L) -#define GPS_GEOFENCE_EXITED (1<<1L) -#define GPS_GEOFENCE_UNCERTAIN (1<<2L) - -#define GPS_GEOFENCE_UNAVAILABLE (1<<0L) -#define GPS_GEOFENCE_AVAILABLE (1<<1L) - -#define GPS_GEOFENCE_OPERATION_SUCCESS 0 -#define GPS_GEOFENCE_ERROR_TOO_MANY_GEOFENCES -100 -#define GPS_GEOFENCE_ERROR_ID_EXISTS -101 -#define GPS_GEOFENCE_ERROR_ID_UNKNOWN -102 -#define GPS_GEOFENCE_ERROR_INVALID_TRANSITION -103 -#define GPS_GEOFENCE_ERROR_GENERIC -149 - -/** - * The callback associated with the geofence. - * Parameters: - * geofence_id - The id associated with the add_geofence_area. - * location - The current GPS location. - * transition - Can be one of GPS_GEOFENCE_ENTERED, GPS_GEOFENCE_EXITED, - * GPS_GEOFENCE_UNCERTAIN. - * timestamp - Timestamp when the transition was detected. - * - * The callback should only be called when the caller is interested in that - * particular transition. For instance, if the caller is interested only in - * ENTERED transition, then the callback should NOT be called with the EXITED - * transition. - * - * IMPORTANT: If a transition is triggered resulting in this callback, the GPS - * subsystem will wake up the application processor, if its in suspend state. - */ -typedef void (*gps_geofence_transition_callback) (int32_t geofence_id, GpsLocation* location, - int32_t transition, GpsUtcTime timestamp); - -/** - * The callback associated with the availability of the GPS system for geofencing - * monitoring. If the GPS system determines that it cannot monitor geofences - * because of lack of reliability or unavailability of the GPS signals, it will - * call this callback with GPS_GEOFENCE_UNAVAILABLE parameter. - * - * Parameters: - * status - GPS_GEOFENCE_UNAVAILABLE or GPS_GEOFENCE_AVAILABLE. - * last_location - Last known location. - */ -typedef void (*gps_geofence_status_callback) (int32_t status, GpsLocation* last_location); - -/** - * The callback associated with the add_geofence call. - * - * Parameter: - * geofence_id - Id of the geofence. - * status - GPS_GEOFENCE_OPERATION_SUCCESS - * GPS_GEOFENCE_ERROR_TOO_MANY_GEOFENCES - geofence limit has been reached. - * GPS_GEOFENCE_ERROR_ID_EXISTS - geofence with id already exists - * GPS_GEOFENCE_ERROR_INVALID_TRANSITION - the monitorTransition contains an - * invalid transition - * GPS_GEOFENCE_ERROR_GENERIC - for other errors. - */ -typedef void (*gps_geofence_add_callback) (int32_t geofence_id, int32_t status); - -/** - * The callback associated with the remove_geofence call. - * - * Parameter: - * geofence_id - Id of the geofence. - * status - GPS_GEOFENCE_OPERATION_SUCCESS - * GPS_GEOFENCE_ERROR_ID_UNKNOWN - for invalid id - * GPS_GEOFENCE_ERROR_GENERIC for others. - */ -typedef void (*gps_geofence_remove_callback) (int32_t geofence_id, int32_t status); - - -/** - * The callback associated with the pause_geofence call. - * - * Parameter: - * geofence_id - Id of the geofence. - * status - GPS_GEOFENCE_OPERATION_SUCCESS - * GPS_GEOFENCE_ERROR_ID_UNKNOWN - for invalid id - * GPS_GEOFENCE_ERROR_INVALID_TRANSITION - - * when monitor_transitions is invalid - * GPS_GEOFENCE_ERROR_GENERIC for others. - */ -typedef void (*gps_geofence_pause_callback) (int32_t geofence_id, int32_t status); - -/** - * The callback associated with the resume_geofence call. - * - * Parameter: - * geofence_id - Id of the geofence. - * status - GPS_GEOFENCE_OPERATION_SUCCESS - * GPS_GEOFENCE_ERROR_ID_UNKNOWN - for invalid id - * GPS_GEOFENCE_ERROR_GENERIC for others. - */ -typedef void (*gps_geofence_resume_callback) (int32_t geofence_id, int32_t status); - -typedef struct { - gps_geofence_transition_callback geofence_transition_callback; - gps_geofence_status_callback geofence_status_callback; - gps_geofence_add_callback geofence_add_callback; - gps_geofence_remove_callback geofence_remove_callback; - gps_geofence_pause_callback geofence_pause_callback; - gps_geofence_resume_callback geofence_resume_callback; - gps_create_thread create_thread_cb; -} GpsGeofenceCallbacks; - -/** Extended interface for GPS_Geofencing support */ -typedef struct { - /** set to sizeof(GpsGeofencingInterface) */ - size_t size; - - /** - * Opens the geofence interface and provides the callback routines - * to the implementation of this interface. - */ - void (*init)( GpsGeofenceCallbacks* callbacks ); - - /** - * Add a geofence area. This api currently supports circular geofences. - * Parameters: - * geofence_id - The id for the geofence. If a geofence with this id - * already exists, an error value (GPS_GEOFENCE_ERROR_ID_EXISTS) - * should be returned. - * latitude, longtitude, radius_meters - The lat, long and radius - * (in meters) for the geofence - * last_transition - The current state of the geofence. For example, if - * the system already knows that the user is inside the geofence, - * this will be set to GPS_GEOFENCE_ENTERED. In most cases, it - * will be GPS_GEOFENCE_UNCERTAIN. - * monitor_transition - Which transitions to monitor. Bitwise OR of - * GPS_GEOFENCE_ENTERED, GPS_GEOFENCE_EXITED and - * GPS_GEOFENCE_UNCERTAIN. - * notification_responsiveness_ms - Defines the best-effort description - * of how soon should the callback be called when the transition - * associated with the Geofence is triggered. For instance, if set - * to 1000 millseconds with GPS_GEOFENCE_ENTERED, the callback - * should be called 1000 milliseconds within entering the geofence. - * This parameter is defined in milliseconds. - * NOTE: This is not to be confused with the rate that the GPS is - * polled at. It is acceptable to dynamically vary the rate of - * sampling the GPS for power-saving reasons; thus the rate of - * sampling may be faster or slower than this. - * unknown_timer_ms - The time limit after which the UNCERTAIN transition - * should be triggered. This parameter is defined in milliseconds. - * See above for a detailed explanation. - */ - void (*add_geofence_area) (int32_t geofence_id, double latitude, double longitude, - double radius_meters, int last_transition, int monitor_transitions, - int notification_responsiveness_ms, int unknown_timer_ms); - - /** - * Pause monitoring a particular geofence. - * Parameters: - * geofence_id - The id for the geofence. - */ - void (*pause_geofence) (int32_t geofence_id); - - /** - * Resume monitoring a particular geofence. - * Parameters: - * geofence_id - The id for the geofence. - * monitor_transitions - Which transitions to monitor. Bitwise OR of - * GPS_GEOFENCE_ENTERED, GPS_GEOFENCE_EXITED and - * GPS_GEOFENCE_UNCERTAIN. - * This supersedes the value associated provided in the - * add_geofence_area call. - */ - void (*resume_geofence) (int32_t geofence_id, int monitor_transitions); - - /** - * Remove a geofence area. After the function returns, no notifications - * should be sent. - * Parameter: - * geofence_id - The id for the geofence. - */ - void (*remove_geofence_area) (int32_t geofence_id); -} GpsGeofencingInterface; - - -/** - * Represents an estimate of the GPS clock time. - */ -typedef struct { - /** set to sizeof(GpsClock) */ - size_t size; - - /** A set of flags indicating the validity of the fields in this data structure. */ - GpsClockFlags flags; - - /** - * Leap second data. - * The sign of the value is defined by the following equation: - * utc_time_ns = time_ns + (full_bias_ns + bias_ns) - leap_second * 1,000,000,000 - * - * If the data is available 'flags' must contain GPS_CLOCK_HAS_LEAP_SECOND. - */ - int16_t leap_second; - - /** - * Indicates the type of time reported by the 'time_ns' field. - * This is a Mandatory field. - */ - GpsClockType type; - - /** - * The GPS receiver internal clock value. This can be either the local hardware clock value - * (GPS_CLOCK_TYPE_LOCAL_HW_TIME), or the current GPS time derived inside GPS receiver - * (GPS_CLOCK_TYPE_GPS_TIME). The field 'type' defines the time reported. - * - * For local hardware clock, this value is expected to be monotonically increasing during - * the reporting session. The real GPS time can be derived by compensating the 'full bias' - * (when it is available) from this value. - * - * For GPS time, this value is expected to be the best estimation of current GPS time that GPS - * receiver can achieve. Set the 'time uncertainty' appropriately when GPS time is specified. - * - * Sub-nanosecond accuracy can be provided by means of the 'bias' field. - * The value contains the 'time uncertainty' in it. - * - * This is a Mandatory field. - */ - int64_t time_ns; - - /** - * 1-Sigma uncertainty associated with the clock's time in nanoseconds. - * The uncertainty is represented as an absolute (single sided) value. - * - * This value should be set if GPS_CLOCK_TYPE_GPS_TIME is set. - * If the data is available 'flags' must contain GPS_CLOCK_HAS_TIME_UNCERTAINTY. - */ - double time_uncertainty_ns; - - /** - * The difference between hardware clock ('time' field) inside GPS receiver and the true GPS - * time since 0000Z, January 6, 1980, in nanoseconds. - * This value is used if and only if GPS_CLOCK_TYPE_LOCAL_HW_TIME is set, and GPS receiver - * has solved the clock for GPS time. - * The caller is responsible for using the 'bias uncertainty' field for quality check. - * - * The sign of the value is defined by the following equation: - * true time (GPS time) = time_ns + (full_bias_ns + bias_ns) - * - * This value contains the 'bias uncertainty' in it. - * If the data is available 'flags' must contain GPS_CLOCK_HAS_FULL_BIAS. - */ - int64_t full_bias_ns; - - /** - * Sub-nanosecond bias. - * The value contains the 'bias uncertainty' in it. - * - * If the data is available 'flags' must contain GPS_CLOCK_HAS_BIAS. - */ - double bias_ns; - - /** - * 1-Sigma uncertainty associated with the clock's bias in nanoseconds. - * The uncertainty is represented as an absolute (single sided) value. - * - * If the data is available 'flags' must contain GPS_CLOCK_HAS_BIAS_UNCERTAINTY. - */ - double bias_uncertainty_ns; - - /** - * The clock's drift in nanoseconds (per second). - * A positive value means that the frequency is higher than the nominal frequency. - * - * The value contains the 'drift uncertainty' in it. - * If the data is available 'flags' must contain GPS_CLOCK_HAS_DRIFT. - * - * If GpsMeasurement's 'flags' field contains GPS_MEASUREMENT_HAS_UNCORRECTED_PSEUDORANGE_RATE, - * it is encouraged that this field is also provided. - */ - double drift_nsps; - - /** - * 1-Sigma uncertainty associated with the clock's drift in nanoseconds (per second). - * The uncertainty is represented as an absolute (single sided) value. - * - * If the data is available 'flags' must contain GPS_CLOCK_HAS_DRIFT_UNCERTAINTY. - */ - double drift_uncertainty_nsps; -} GpsClock; - -/** - * Represents a GPS Measurement, it contains raw and computed information. - */ -typedef struct { - /** set to sizeof(GpsMeasurement) */ - size_t size; - - /** A set of flags indicating the validity of the fields in this data structure. */ - GpsMeasurementFlags flags; - - /** - * Pseudo-random number in the range of [1, 32] - * This is a Mandatory value. - */ - int8_t prn; - - /** - * Time offset at which the measurement was taken in nanoseconds. - * The reference receiver's time is specified by GpsData::clock::time_ns and should be - * interpreted in the same way as indicated by GpsClock::type. - * - * The sign of time_offset_ns is given by the following equation: - * measurement time = GpsClock::time_ns + time_offset_ns - * - * It provides an individual time-stamp for the measurement, and allows sub-nanosecond accuracy. - * This is a Mandatory value. - */ - double time_offset_ns; - - /** - * Per satellite sync state. It represents the current sync state for the associated satellite. - * Based on the sync state, the 'received GPS tow' field should be interpreted accordingly. - * - * This is a Mandatory value. - */ - GpsMeasurementState state; - - /** - * Received GPS Time-of-Week at the measurement time, in nanoseconds. - * The value is relative to the beginning of the current GPS week. - * - * Given the highest sync state that can be achieved, per each satellite, valid range for - * this field can be: - * Searching : [ 0 ] : GPS_MEASUREMENT_STATE_UNKNOWN - * C/A code lock : [ 0 1ms ] : GPS_MEASUREMENT_STATE_CODE_LOCK is set - * Bit sync : [ 0 20ms ] : GPS_MEASUREMENT_STATE_BIT_SYNC is set - * Subframe sync : [ 0 6s ] : GPS_MEASUREMENT_STATE_SUBFRAME_SYNC is set - * TOW decoded : [ 0 1week ] : GPS_MEASUREMENT_STATE_TOW_DECODED is set - * - * However, if there is any ambiguity in integer millisecond, - * GPS_MEASUREMENT_STATE_MSEC_AMBIGUOUS should be set accordingly, in the 'state' field. - * - * This value must be populated if 'state' != GPS_MEASUREMENT_STATE_UNKNOWN. - */ - int64_t received_gps_tow_ns; - - /** - * 1-Sigma uncertainty of the Received GPS Time-of-Week in nanoseconds. - * - * This value must be populated if 'state' != GPS_MEASUREMENT_STATE_UNKNOWN. - */ - int64_t received_gps_tow_uncertainty_ns; - - /** - * Carrier-to-noise density in dB-Hz, in the range [0, 63]. - * It contains the measured C/N0 value for the signal at the antenna input. - * - * This is a Mandatory value. - */ - double c_n0_dbhz; - - /** - * Pseudorange rate at the timestamp in m/s. - * The correction of a given Pseudorange Rate value includes corrections for receiver and - * satellite clock frequency errors. - * - * If GPS_MEASUREMENT_HAS_UNCORRECTED_PSEUDORANGE_RATE is set in 'flags' field, this field must - * be populated with the 'uncorrected' reading. - * If GPS_MEASUREMENT_HAS_UNCORRECTED_PSEUDORANGE_RATE is not set in 'flags' field, this field - * must be populated with the 'corrected' reading. This is the default behavior. - * - * It is encouraged to provide the 'uncorrected' 'pseudorange rate', and provide GpsClock's - * 'drift' field as well. - * - * The value includes the 'pseudorange rate uncertainty' in it. - * A positive 'uncorrected' value indicates that the SV is moving away from the receiver. - * - * The sign of the 'uncorrected' 'pseudorange rate' and its relation to the sign of 'doppler - * shift' is given by the equation: - * pseudorange rate = -k * doppler shift (where k is a constant) - * - * This is a Mandatory value. - */ - double pseudorange_rate_mps; - - /** - * 1-Sigma uncertainty of the pseudurange rate in m/s. - * The uncertainty is represented as an absolute (single sided) value. - * - * This is a Mandatory value. - */ - double pseudorange_rate_uncertainty_mps; - - /** - * Accumulated delta range's state. It indicates whether ADR is reset or there is a cycle slip - * (indicating loss of lock). - * - * This is a Mandatory value. - */ - GpsAccumulatedDeltaRangeState accumulated_delta_range_state; - - /** - * Accumulated delta range since the last channel reset in meters. - * A positive value indicates that the SV is moving away from the receiver. - * - * The sign of the 'accumulated delta range' and its relation to the sign of 'carrier phase' - * is given by the equation: - * accumulated delta range = -k * carrier phase (where k is a constant) - * - * This value must be populated if 'accumulated delta range state' != GPS_ADR_STATE_UNKNOWN. - * However, it is expected that the data is only accurate when: - * 'accumulated delta range state' == GPS_ADR_STATE_VALID. - */ - double accumulated_delta_range_m; - - /** - * 1-Sigma uncertainty of the accumulated delta range in meters. - * This value must be populated if 'accumulated delta range state' != GPS_ADR_STATE_UNKNOWN. - */ - double accumulated_delta_range_uncertainty_m; - - /** - * Best derived Pseudorange by the chip-set, in meters. - * The value contains the 'pseudorange uncertainty' in it. - * - * If the data is available, 'flags' must contain GPS_MEASUREMENT_HAS_PSEUDORANGE. - */ - double pseudorange_m; - - /** - * 1-Sigma uncertainty of the pseudorange in meters. - * The value contains the 'pseudorange' and 'clock' uncertainty in it. - * The uncertainty is represented as an absolute (single sided) value. - * - * If the data is available, 'flags' must contain GPS_MEASUREMENT_HAS_PSEUDORANGE_UNCERTAINTY. - */ - double pseudorange_uncertainty_m; - - /** - * A fraction of the current C/A code cycle, in the range [0.0, 1023.0] - * This value contains the time (in Chip units) since the last C/A code cycle (GPS Msec epoch). - * - * The reference frequency is given by the field 'carrier_frequency_hz'. - * The value contains the 'code-phase uncertainty' in it. - * - * If the data is available, 'flags' must contain GPS_MEASUREMENT_HAS_CODE_PHASE. - */ - double code_phase_chips; - - /** - * 1-Sigma uncertainty of the code-phase, in a fraction of chips. - * The uncertainty is represented as an absolute (single sided) value. - * - * If the data is available, 'flags' must contain GPS_MEASUREMENT_HAS_CODE_PHASE_UNCERTAINTY. - */ - double code_phase_uncertainty_chips; - - /** - * Carrier frequency at which codes and messages are modulated, it can be L1 or L2. - * If the field is not set, the carrier frequency is assumed to be L1. - * - * If the data is available, 'flags' must contain GPS_MEASUREMENT_HAS_CARRIER_FREQUENCY. - */ - float carrier_frequency_hz; - - /** - * The number of full carrier cycles between the satellite and the receiver. - * The reference frequency is given by the field 'carrier_frequency_hz'. - * - * If the data is available, 'flags' must contain GPS_MEASUREMENT_HAS_CARRIER_CYCLES. - */ - int64_t carrier_cycles; - - /** - * The RF phase detected by the receiver, in the range [0.0, 1.0]. - * This is usually the fractional part of the complete carrier phase measurement. - * - * The reference frequency is given by the field 'carrier_frequency_hz'. - * The value contains the 'carrier-phase uncertainty' in it. - * - * If the data is available, 'flags' must contain GPS_MEASUREMENT_HAS_CARRIER_PHASE. - */ - double carrier_phase; - - /** - * 1-Sigma uncertainty of the carrier-phase. - * If the data is available, 'flags' must contain GPS_MEASUREMENT_HAS_CARRIER_PHASE_UNCERTAINTY. - */ - double carrier_phase_uncertainty; - - /** - * An enumeration that indicates the 'loss of lock' state of the event. - */ - GpsLossOfLock loss_of_lock; - - /** - * The number of GPS bits transmitted since Sat-Sun midnight (GPS week). - * If the data is available, 'flags' must contain GPS_MEASUREMENT_HAS_BIT_NUMBER. - */ - int32_t bit_number; - - /** - * The elapsed time since the last received bit in milliseconds, in the range [0, 20] - * If the data is available, 'flags' must contain GPS_MEASUREMENT_HAS_TIME_FROM_LAST_BIT. - */ - int16_t time_from_last_bit_ms; - - /** - * Doppler shift in Hz. - * A positive value indicates that the SV is moving toward the receiver. - * - * The reference frequency is given by the field 'carrier_frequency_hz'. - * The value contains the 'doppler shift uncertainty' in it. - * - * If the data is available, 'flags' must contain GPS_MEASUREMENT_HAS_DOPPLER_SHIFT. - */ - double doppler_shift_hz; - - /** - * 1-Sigma uncertainty of the doppler shift in Hz. - * If the data is available, 'flags' must contain GPS_MEASUREMENT_HAS_DOPPLER_SHIFT_UNCERTAINTY. - */ - double doppler_shift_uncertainty_hz; - - /** - * An enumeration that indicates the 'multipath' state of the event. - */ - GpsMultipathIndicator multipath_indicator; - - /** - * Signal-to-noise ratio in dB. - * If the data is available, 'flags' must contain GPS_MEASUREMENT_HAS_SNR. - */ - double snr_db; - - /** - * Elevation in degrees, the valid range is [-90, 90]. - * The value contains the 'elevation uncertainty' in it. - * If the data is available, 'flags' must contain GPS_MEASUREMENT_HAS_ELEVATION. - */ - double elevation_deg; - - /** - * 1-Sigma uncertainty of the elevation in degrees, the valid range is [0, 90]. - * The uncertainty is represented as the absolute (single sided) value. - * - * If the data is available, 'flags' must contain GPS_MEASUREMENT_HAS_ELEVATION_UNCERTAINTY. - */ - double elevation_uncertainty_deg; - - /** - * Azimuth in degrees, in the range [0, 360). - * The value contains the 'azimuth uncertainty' in it. - * If the data is available, 'flags' must contain GPS_MEASUREMENT_HAS_AZIMUTH. - * */ - double azimuth_deg; - - /** - * 1-Sigma uncertainty of the azimuth in degrees, the valid range is [0, 180]. - * The uncertainty is represented as an absolute (single sided) value. - * - * If the data is available, 'flags' must contain GPS_MEASUREMENT_HAS_AZIMUTH_UNCERTAINTY. - */ - double azimuth_uncertainty_deg; - - /** - * Whether the GPS represented by the measurement was used for computing the most recent fix. - * If the data is available, 'flags' must contain GPS_MEASUREMENT_HAS_USED_IN_FIX. - */ - bool used_in_fix; -} GpsMeasurement; - -/** Represents a reading of GPS measurements. */ -typedef struct { - /** set to sizeof(GpsData) */ - size_t size; - - /** Number of measurements. */ - size_t measurement_count; - - /** The array of measurements. */ - GpsMeasurement measurements[GPS_MAX_MEASUREMENT]; - - /** The GPS clock time reading. */ - GpsClock clock; -} GpsData; - -/** - * The callback for to report measurements from the HAL. - * - * Parameters: - * data - A data structure containing the measurements. - */ -typedef void (*gps_measurement_callback) (GpsData* data); - -typedef struct { - /** set to sizeof(GpsMeasurementCallbacks) */ - size_t size; - gps_measurement_callback measurement_callback; -} GpsMeasurementCallbacks; - -#define GPS_MEASUREMENT_OPERATION_SUCCESS 0 -#define GPS_MEASUREMENT_ERROR_ALREADY_INIT -100 -#define GPS_MEASUREMENT_ERROR_GENERIC -101 - -/** - * Extended interface for GPS Measurements support. - */ -typedef struct { - /** Set to sizeof(GpsMeasurementInterface) */ - size_t size; - - /** - * Initializes the interface and registers the callback routines with the HAL. - * After a successful call to 'init' the HAL must begin to provide updates at its own phase. - * - * Status: - * GPS_MEASUREMENT_OPERATION_SUCCESS - * GPS_MEASUREMENT_ERROR_ALREADY_INIT - if a callback has already been registered without a - * corresponding call to 'close' - * GPS_MEASUREMENT_ERROR_GENERIC - if any other error occurred, it is expected that the HAL - * will not generate any updates upon returning this error code. - */ - int (*init) (GpsMeasurementCallbacks* callbacks); - - /** - * Stops updates from the HAL, and unregisters the callback routines. - * After a call to stop, the previously registered callbacks must be considered invalid by the - * HAL. - * If stop is invoked without a previous 'init', this function should perform no work. - */ - void (*close) (); - -} GpsMeasurementInterface; - - -/** Represents a GPS navigation message (or a fragment of it). */ -typedef struct { - /** set to sizeof(GpsNavigationMessage) */ - size_t size; - - /** - * Pseudo-random number in the range of [1, 32] - * This is a Mandatory value. - */ - int8_t prn; - - /** - * The type of message contained in the structure. - * This is a Mandatory value. - */ - GpsNavigationMessageType type; - - /** - * The status of the received navigation message. - * No need to send any navigation message that contains words with parity error and cannot be - * corrected. - */ - NavigationMessageStatus status; - - /** - * Message identifier. - * It provides an index so the complete Navigation Message can be assembled. i.e. fo L1 C/A - * subframe 4 and 5, this value corresponds to the 'frame id' of the navigation message. - * Subframe 1, 2, 3 does not contain a 'frame id' and this value can be set to -1. - */ - int16_t message_id; - - /** - * Sub-message identifier. - * If required by the message 'type', this value contains a sub-index within the current - * message (or frame) that is being transmitted. - * i.e. for L1 C/A the submessage id corresponds to the sub-frame id of the navigation message. - */ - int16_t submessage_id; - - /** - * The length of the data (in bytes) contained in the current message. - * If this value is different from zero, 'data' must point to an array of the same size. - * e.g. for L1 C/A the size of the sub-frame will be 40 bytes (10 words, 30 bits/word). - * - * This is a Mandatory value. - */ - size_t data_length; - - /** - * The data of the reported GPS message. - * The bytes (or words) specified using big endian format (MSB first). - * - * For L1 C/A, each subframe contains 10 30-bit GPS words. Each GPS word (30 bits) should be - * fitted into the last 30 bits in a 4-byte word (skip B31 and B32), with MSB first. - */ - uint8_t* data; - -} GpsNavigationMessage; - -/** - * The callback to report an available fragment of a GPS navigation messages from the HAL. - * - * Parameters: - * message - The GPS navigation submessage/subframe representation. - */ -typedef void (*gps_navigation_message_callback) (GpsNavigationMessage* message); - -typedef struct { - /** set to sizeof(GpsNavigationMessageCallbacks) */ - size_t size; - gps_navigation_message_callback navigation_message_callback; -} GpsNavigationMessageCallbacks; - -#define GPS_NAVIGATION_MESSAGE_OPERATION_SUCCESS 0 -#define GPS_NAVIGATION_MESSAGE_ERROR_ALREADY_INIT -100 -#define GPS_NAVIGATION_MESSAGE_ERROR_GENERIC -101 - -/** - * Extended interface for GPS navigation message reporting support. - */ -typedef struct { - /** Set to sizeof(GpsNavigationMessageInterface) */ - size_t size; - - /** - * Initializes the interface and registers the callback routines with the HAL. - * After a successful call to 'init' the HAL must begin to provide updates as they become - * available. - * - * Status: - * GPS_NAVIGATION_MESSAGE_OPERATION_SUCCESS - * GPS_NAVIGATION_MESSAGE_ERROR_ALREADY_INIT - if a callback has already been registered - * without a corresponding call to 'close'. - * GPS_NAVIGATION_MESSAGE_ERROR_GENERIC - if any other error occurred, it is expected that - * the HAL will not generate any updates upon returning this error code. - */ - int (*init) (GpsNavigationMessageCallbacks* callbacks); - - /** - * Stops updates from the HAL, and unregisters the callback routines. - * After a call to stop, the previously registered callbacks must be considered invalid by the - * HAL. - * If stop is invoked without a previous 'init', this function should perform no work. - */ - void (*close) (); - -} GpsNavigationMessageInterface; - -/** - * Interface for passing GNSS configuration contents from platform to HAL. - */ -typedef struct { - /** Set to sizeof(GnssConfigurationInterface) */ - size_t size; - - /** - * Deliver GNSS configuration contents to HAL. - * Parameters: - * config_data - a pointer to a char array which holds what usually is expected from - file(/etc/gps.conf), i.e., a sequence of UTF8 strings separated by '\n'. - * length - total number of UTF8 characters in configuraiton data. - * - * IMPORTANT: - * GPS HAL should expect this function can be called multiple times. And it may be - * called even when GpsLocationProvider is already constructed and enabled. GPS HAL - * should maintain the existing requests for various callback regardless the change - * in configuration data. - */ - void (*configuration_update) (const char* config_data, int32_t length); -} GnssConfigurationInterface; - -__END_DECLS - -#endif /* ANDROID_INCLUDE_HARDWARE_GPS_H */ diff --git a/rootdir/init.target.rc b/rootdir/init.target.rc index d98fe50..a7431d2 100644 --- a/rootdir/init.target.rc +++ b/rootdir/init.target.rc @@ -4,14 +4,6 @@ on init export VIBE_PIPE_PATH /dev/pipes mkdir /dev/pipes 0771 shell shell -# GPS -service gpsd /system/bin/gpsd -c /system/etc/gps.xml - class main - socket gps seqpacket 0660 gps system - user gps - group system inet sdcard_rw gps - ioprio be 0 - on post-fs-data chown radio system /sys/devices/platform/samsung-pd.5/s3c-fimc.2/range_mode chmod 0660 /sys/devices/platform/samsung-pd.5/s3c-fimc.2/range_mode @@ -22,6 +14,21 @@ on post-fs-data # Restorecon restorecon_recursive /efs +# GPS init + mkdir /data/gps + chown gps system /data/gps + chmod 770 /data/gps + write /sys/class/sec/gps/GPS_PWR_EN/export 162 + write /sys/class/sec/gps/GPS_PWR_EN/value 0 + write /sys/class/sec/gps/GPS_PWR_EN/direction out + chown gps system /sys/class/sec/gps/GPS_PWR_EN/value + chmod 0664 /sys/class/sec/gps/GPS_PWR_EN/value + chown gps system /dev/ttySAC1 + chmod 0660 /dev/ttySAC1 + restorecon /sys/class/sec/gps/export + restorecon /sys/class/sec/gps/GPS_PWR_EN/value + restorecon /sys/class/sec/gps/GPS_PWR_EN/direction + # SensorHub chown system radio /sys/class/sensors/ssp_sensor/enable chown system radio /sys/class/sensors/ssp_sensor/mcu_rev @@ -40,3 +47,12 @@ service cpboot-daemon /sbin/cbd -d -p 10 class main user root group radio cache inet misc audio sdcard_rw log + +# Start GPS daemon +service gps-daemon /system/bin/sh /system/bin/gps_daemon.sh + class main + socket gps seqpacket 0660 gps system + user gps + group system inet sdcard_rw gps + ioprio be 0 + seclabel u:r:glgps:s0 -- cgit v1.1 From 0e7e0240eb089f9c8c5e65b61ea625861e37d56f Mon Sep 17 00:00:00 2001 From: Simon Shields Date: Sat, 12 Dec 2015 18:12:16 +1100 Subject: n7100: ril-wrapper: fake GET_RADIO_CAPABILITY response Samsung's RIL doesn't support this, but doesn't error on it either. Change-Id: I5a470c55fecf85183e9c7b4b37aef3b3cbffaf90 --- ril-wrapper/ril-wrapper.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/ril-wrapper/ril-wrapper.c b/ril-wrapper/ril-wrapper.c index 8371870..886cb34 100644 --- a/ril-wrapper/ril-wrapper.c +++ b/ril-wrapper/ril-wrapper.c @@ -28,6 +28,18 @@ static RIL_RadioFunctions const *mRealRadioFuncs; static const struct RIL_Env *mEnv; +static void rilOnRequest(int request, void *data, size_t datalen, RIL_Token t) +{ + switch (request) { + case RIL_REQUEST_GET_RADIO_CAPABILITY: + RLOGW("Returning NOT_SUPPORTED on GET_RADIO_CAPABILITY"); + mEnv->OnRequestComplete(t, RIL_E_REQUEST_NOT_SUPPORTED, NULL, 0); + break; + default: + mRealRadioFuncs->onRequest(request, data, datalen, t); + } +} + const RIL_RadioFunctions* RIL_Init(const struct RIL_Env *env, int argc, char **argv) { RIL_RadioFunctions const* (*fRealRilInit)(const struct RIL_Env *env, int argc, char **argv); @@ -74,6 +86,7 @@ const RIL_RadioFunctions* RIL_Init(const struct RIL_Env *env, int argc, char **a //copy the real RIL's info struct, then replace the onRequest pointer with our own rilInfo = *mRealRadioFuncs; + rilInfo.onRequest = rilOnRequest; RLOGD("Wrapped RIL version is '%s'\n", mRealRadioFuncs->getVersion()); -- cgit v1.1 From c44906d64a221421c303e36e1571f373984ef53a Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Mon, 21 Dec 2015 20:25:59 +0530 Subject: n7100: set mQANelements through property --- system.prop | 1 + 1 file changed, 1 insertion(+) diff --git a/system.prop b/system.prop index db6bcfd..975f696 100644 --- a/system.prop +++ b/system.prop @@ -5,5 +5,6 @@ dalvik.vm.dexopt-data-only=1 rild.libpath=/system/lib/ril-wrapper.so rild.libargs=-d /dev/ttyS0 +ro.ril.telephony.mqanelements=5 ro.sf.lcd_density=320 ro.lcd_min_brightness=20 -- cgit v1.1 From 0bf7364ac512f26be0373bf8810bd5c2cdc5c99d Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Mon, 21 Dec 2015 21:36:04 +0530 Subject: n7100: Bring in Selinux for M * commits picked up from the i9300 device repo and made a few changes for n7100 credits to keepcalm444 --- BoardConfig.mk | 4 +++ selinux/bluetooth.te | 7 +++++ selinux/cpboot-daemon.te | 25 ++++++++++++++++++ selinux/device.te | 4 +++ selinux/domain.te | 1 + selinux/file.te | 11 ++++++++ selinux/file_contexts | 65 +++++++++++++++++++++++++++++++++++++++++++++++ selinux/gpsd.te | 25 ++++++++++++++++++ selinux/init.te | 15 +++++++++++ selinux/log.te | 3 +++ selinux/macloader.te | 9 +++++++ selinux/mediaserver.te | 11 ++++++++ selinux/netd.te | 3 +++ selinux/nfc.te | 2 ++ selinux/rild.te | 20 +++++++++++++++ selinux/service_contexts | 3 +++ selinux/servicemanager.te | 3 +++ selinux/surfaceflinger.te | 1 + selinux/sysinit.te | 7 +++++ selinux/system_app.te | 2 ++ selinux/system_server.te | 33 ++++++++++++++++++++++++ selinux/tinyplay.te | 6 +++++ selinux/ueventd.te | 5 ++++ selinux/untrusted_app.te | 5 ++++ selinux/vold.te | 12 +++++++++ selinux/wpa_supplicant.te | 12 +++++++++ selinux/zygote.te | 1 + 27 files changed, 295 insertions(+) create mode 100644 selinux/bluetooth.te create mode 100644 selinux/cpboot-daemon.te create mode 100644 selinux/device.te create mode 100644 selinux/domain.te create mode 100644 selinux/file.te create mode 100644 selinux/file_contexts create mode 100644 selinux/gpsd.te create mode 100644 selinux/init.te create mode 100644 selinux/log.te create mode 100644 selinux/macloader.te create mode 100644 selinux/mediaserver.te create mode 100644 selinux/netd.te create mode 100644 selinux/nfc.te create mode 100644 selinux/rild.te create mode 100644 selinux/service_contexts create mode 100644 selinux/servicemanager.te create mode 100644 selinux/surfaceflinger.te create mode 100644 selinux/sysinit.te create mode 100644 selinux/system_app.te create mode 100644 selinux/system_server.te create mode 100644 selinux/tinyplay.te create mode 100644 selinux/ueventd.te create mode 100644 selinux/untrusted_app.te create mode 100644 selinux/vold.te create mode 100644 selinux/wpa_supplicant.te create mode 100644 selinux/zygote.te diff --git a/BoardConfig.mk b/BoardConfig.mk index d963d68..0def1df 100644 --- a/BoardConfig.mk +++ b/BoardConfig.mk @@ -48,3 +48,7 @@ RECOVERY_FSTAB_VERSION := 2 # Compatibility with pre-kitkat Sensor HALs SENSORS_NEED_SETRATE_ON_ENABLE := true + +# Selinux +BOARD_SEPOLICY_DIRS += \ + device/samsung/n7100/selinux diff --git a/selinux/bluetooth.te b/selinux/bluetooth.te new file mode 100644 index 0000000..dbfbe0e --- /dev/null +++ b/selinux/bluetooth.te @@ -0,0 +1,7 @@ +allow bluetooth bluetooth_efs_file:dir search; +allow bluetooth bluetooth_efs_file:file read; +allow bluetooth firmware_exynos:dir { open read search }; +allow bluetooth firmware_exynos:file { open read }; +allow bluetooth sysfs:file write; +allow bluetooth efs_device_file:dir search; +allow bluetooth wifi_data_file:file r_file_perms; diff --git a/selinux/cpboot-daemon.te b/selinux/cpboot-daemon.te new file mode 100644 index 0000000..9974ff2 --- /dev/null +++ b/selinux/cpboot-daemon.te @@ -0,0 +1,25 @@ +type cpboot-daemon, domain; + +permissive cpboot-daemon; + +allow cpboot-daemon cgroup:dir { create add_name }; +allow cpboot-daemon device:dir { write remove_name add_name }; +allow cpboot-daemon efs_block_device:blk_file { read open }; +allow cpboot-daemon efs_device_file:dir search; +allow cpboot-daemon efs_file:file { read write open }; +allow cpboot-daemon init:unix_stream_socket connectto; +allow cpboot-daemon log_device:chr_file { write open }; +allow cpboot-daemon log_device:dir search; +allow cpboot-daemon property_socket:sock_file write; +allow cpboot-daemon radio_device:chr_file { read write ioctl open }; +allow cpboot-daemon radio_prop:property_service set; +allow cpboot-daemon self:capability { setuid }; +allow cpboot-daemon sysfs_radio:file { read write open }; +allow cpboot-daemon usbfs:dir search; +allow cpboot-daemon self:capability dac_override; +allow cpboot-daemon cbd_device:chr_file create_file_perms; + +# FIX ME +# allow cpboot-daemon usbfs:filesystem mount; +# allow cpboot-daemon self:capability { mknod }; + diff --git a/selinux/device.te b/selinux/device.te new file mode 100644 index 0000000..854958d --- /dev/null +++ b/selinux/device.te @@ -0,0 +1,4 @@ +type rfkill_device, dev_type; +type efs_block_device, dev_type; +type hpd_device, dev_type; +type mfc_device, dev_type; diff --git a/selinux/domain.te b/selinux/domain.te new file mode 100644 index 0000000..c8d8d53 --- /dev/null +++ b/selinux/domain.te @@ -0,0 +1 @@ +dontaudit domain kernel:system module_request; diff --git a/selinux/file.te b/selinux/file.te new file mode 100644 index 0000000..12b280a --- /dev/null +++ b/selinux/file.te @@ -0,0 +1,11 @@ +type firmware_mfc, file_type; +type firmware_exynos, file_type; + +type sensors_data_file, file_type, data_file_type; +type sysfs_display, fs_type, sysfs_type; + +type efs_device_file, file_type; +type radio_data, file_type; +type sysfs_radio, fs_type, sysfs_type; +type sysfs_sensor, fs_type, sysfs_type; +type cbd_device, dev_type; diff --git a/selinux/file_contexts b/selinux/file_contexts new file mode 100644 index 0000000..988ef9a --- /dev/null +++ b/selinux/file_contexts @@ -0,0 +1,65 @@ +# GFX +/dev/mali u:object_r:gpu_device:s0 +/dev/ump u:object_r:gpu_device:s0 +/dev/fimg2d u:object_r:gpu_device:s0 + +# RIL +/dev/link_pm u:object_r:radio_device:s0 +/dev/umts_boot0 u:object_r:radio_device:s0 +/dev/umts_boot1 u:object_r:radio_device:s0 +/dev/umts_ipc0 u:object_r:radio_device:s0 +/dev/umts_ramdump0 u:object_r:radio_device:s0 +/dev/umts_rfs0 u:object_r:radio_device:s0 +/dev/__cbd_msg_ u:object_r:cbd_device:s0 + +/efs u:object_r:efs_device_file:s0 +/data/misc/radio(/.*)? u:object_r:radio_data:s0 +/sys/devices/platform/s5p-ohci/ohci_power u:object_r:sysfs_radio:s0 +/sys/devices/platform/s5p-ehci/ehci_power u:object_r:sysfs_radio:s0 + +# Partitions +/dev/block/mmcblk0(.*) u:object_r:boot_block_device:s0 +/dev/block/mmcblk0p3 u:object_r:efs_block_device:s0 +/dev/block/mmcblk0p12 u:object_r:cache_block_device:s0 +/dev/block/mmcblk0p13 u:object_r:system_block_device:s0 +/dev/block/mmcblk0p16 u:object_r:userdata_block_device:s0 + +# Camera +/data/ISP_CV u:object_r:camera_data_file:s0 +/dev/exynos-mem u:object_r:video_device:s0 +/dev/s3c-mfc u:object_r:mfc_device:s0 + +# Bluetooth +/dev/ttySAC0 u:object_r:hci_attach_dev:s0 +/efs/bluetooth(/.*)? u:object_r:bluetooth_efs_file:s0 + +# Display +/sys/class/mdnie/mdnie(/.*)? u:object_r:sysfs_display:s0 +/sys/devices/platform/samsung-pd.2/mdnie/mdnie(/.*)? u:object_r:sysfs_display:s0 + +# GPS +/dev/ttySAC1 u:object_r:gps_device:s0 +/system/bin/gps_daemon.sh u:object_r:gpsd_exec:s0 + +# Sensors +/dev/akm8963 u:object_r:sensors_device:s0 +/efs/gyro_cal_data u:object_r:sensors_data_file:s0 +/sys/class/sensors/accelerometer_sensor u:object_r:sysfs_sensor:s0 + +# Wifi +/dev/rfkill u:object_r:rfkill_device:s0 +/data/.cid.info u:object_r:wifi_data_file:s0 +/efs/wifi/.mac.info u:object_r:wifi_data_file:s0 + +# Firmwares +/system/vendor/firmware(/.*)? u:object_r:firmware_exynos:s0 +/system/vendor/firmware/mfc_fw.bin u:object_r:firmware_mfc:s0 +/data/cfw(/.*)? u:object_r:firmware_exynos:s0 + +# Vibrator +/dev/tspdrv u:object_r:input_device:s0 + +# Misc +/dev/HPD u:object_r:hpd_device:s0 +/system/bin/macloader u:object_r:macloader_exec:s0 +/system/bin/tinyplay u:object_r:tinyplay_exec:s0 diff --git a/selinux/gpsd.te b/selinux/gpsd.te new file mode 100644 index 0000000..4aa2b04 --- /dev/null +++ b/selinux/gpsd.te @@ -0,0 +1,25 @@ +type gpsd, domain; +type gpsd_exec, exec_type, file_type; + +init_daemon_domain(gpsd) + +allow gpsd shell_exec:file { rx_file_perms entrypoint }; + +#for text relocs & execution +allow gpsd system_file:file { execute_no_trans execmod }; +allow gpsd gps_device:chr_file { getattr setattr }; +allow gpsd gps_data_file:dir { search write add_name remove_name }; +allow gpsd gps_data_file:file { create rw_file_perms }; +allow gpsd gps_data_file:fifo_file { unlink create setattr getattr rw_file_perms }; + +allow gpsd node:udp_socket { node_bind name_bind }; +allow gpsd port:tcp_socket name_connect; +allow gpsd self:tcp_socket { getopt write read }; + +allow gpsd sysfs:file { setattr write }; +allow gpsd gps_device:chr_file { ioctl open read write }; +allow gpsd gpsd:udp_socket { create bind }; +allow gpsd gpsd:tcp_socket { create connect }; +allow gpsd fwmarkd_socket:sock_file write; +allow gpsd dnsproxyd_socket:sock_file write; +allow gpsd netd:unix_stream_socket connectto; diff --git a/selinux/init.te b/selinux/init.te new file mode 100644 index 0000000..b4c11fb --- /dev/null +++ b/selinux/init.te @@ -0,0 +1,15 @@ +allow init wpa_socket:unix_dgram_socket { bind create }; +allow init init:process { execmem }; +allow init init:tcp_socket { create }; + +allow init sysfs_display:lnk_file { read setattr }; + +allow init tmpfs:lnk_file create; +allow init sysfs_sensor:lnk_file { setattr read }; + +allow init rild:process noatsecure; + +domain_trans(init, rootfs, gpsd) +domain_trans(init, rootfs, cpboot-daemon) +domain_trans(init, rootfs, tinyplay) +domain_trans(init, rootfs, macloader) diff --git a/selinux/log.te b/selinux/log.te new file mode 100644 index 0000000..c3dfc80 --- /dev/null +++ b/selinux/log.te @@ -0,0 +1,3 @@ +allow domain log_device:chr_file { open write }; +allow domain log_device:dir { search }; +allow { shell debuggerd } log_device:chr_file { read }; diff --git a/selinux/macloader.te b/selinux/macloader.te new file mode 100644 index 0000000..464f201 --- /dev/null +++ b/selinux/macloader.te @@ -0,0 +1,9 @@ +type macloader, domain; +type macloader_exec, exec_type, file_type; +init_daemon_domain(macloader); + +allow macloader efs_file:dir search; +allow macloader efs_device_file:dir search; +allow macloader wifi_data_file:file { read getattr open write setattr }; +allow macloader self:capability { dac_override chown fowner fsetid }; +allow macloader system_data_file:dir w_dir_perms; diff --git a/selinux/mediaserver.te b/selinux/mediaserver.te new file mode 100644 index 0000000..cbcdcb8 --- /dev/null +++ b/selinux/mediaserver.te @@ -0,0 +1,11 @@ +allow mediaserver { firmware_exynos }:file r_file_perms; +allow mediaserver firmware_exynos:dir r_dir_perms; +allow mediaserver camera_data_file:file rw_file_perms; +allow mediaserver mfc_device:chr_file rw_file_perms; + +# Bluetooth audio +allow mediaserver bluetooth:unix_stream_socket { connectto }; + +allow mediaserver { storage_file mnt_user_file }:dir { search read }; +allow mediaserver storage_file:lnk_file read; +allow mediaserver mnt_user_file:lnk_file read; diff --git a/selinux/netd.te b/selinux/netd.te new file mode 100644 index 0000000..bce2700 --- /dev/null +++ b/selinux/netd.te @@ -0,0 +1,3 @@ +allow netd init:tcp_socket { read write getopt }; +allow netd gpsd:fd use; +allow netd gpsd:tcp_socket { read write getopt setopt }; diff --git a/selinux/nfc.te b/selinux/nfc.te new file mode 100644 index 0000000..b5afda7 --- /dev/null +++ b/selinux/nfc.te @@ -0,0 +1,2 @@ +allow nfc firmware_exynos:dir search; +allow nfc log_device:chr_file write; diff --git a/selinux/rild.te b/selinux/rild.te new file mode 100644 index 0000000..5da4924 --- /dev/null +++ b/selinux/rild.te @@ -0,0 +1,20 @@ +allow rild self:netlink_socket { create bind read write }; +allow rild self:netlink_route_socket { write }; +allow rild self:netlink_kobject_uevent_socket { create bind read write setopt }; +allow rild rild:process { execmem }; + +allow rild radio_data_file:dir setattr; +allow rild unlabeled:dir search; + +allow radio log_device:chr_file w_file_perms; +allow rild log_device:chr_file w_file_perms; +allow rild system_file:file execmod; +allow rild radio_data:file create_file_perms; +allow rild radio_data:dir create_dir_perms; + +allow rild radio_device:chr_file rw_file_perms; +allow rild efs_block_device:blk_file rw_file_perms; +allow rild efs_file:file { read open write setattr }; + +allow rild efs_device_file:dir create_dir_perms; +allow rild efs_device_file:file { setattr create create_file_perms }; diff --git a/selinux/service_contexts b/selinux/service_contexts new file mode 100644 index 0000000..fb14cf2 --- /dev/null +++ b/selinux/service_contexts @@ -0,0 +1,3 @@ +SecTVOutService u:object_r:surfaceflinger_service:s0 +Exynos.HWCService u:object_r:surfaceflinger_service:s0 +Exynos.IPService u:object_r:surfaceflinger_service:s0 diff --git a/selinux/servicemanager.te b/selinux/servicemanager.te new file mode 100644 index 0000000..40a665d --- /dev/null +++ b/selinux/servicemanager.te @@ -0,0 +1,3 @@ +allow servicemanager gpsd:dir { search read write }; +allow servicemanager gpsd:file { open read write }; +allow servicemanager gpsd:process getattr; diff --git a/selinux/surfaceflinger.te b/selinux/surfaceflinger.te new file mode 100644 index 0000000..00fa1e9 --- /dev/null +++ b/selinux/surfaceflinger.te @@ -0,0 +1 @@ +allow surfaceflinger hpd_device:chr_file rw_file_perms; diff --git a/selinux/sysinit.te b/selinux/sysinit.te new file mode 100644 index 0000000..0436ffe --- /dev/null +++ b/selinux/sysinit.te @@ -0,0 +1,7 @@ +allow sysinit firmware_exynos:dir { read search open getattr }; +allow sysinit userinit_exec:file { getattr execute execute_no_trans read open }; +allow sysinit firmware_exynos:dir { read search open getattr write remove_name add_name }; +allow sysinit firmware_exynos:file { read open write getattr setattr create unlink }; +allow sysinit sysinit:capability { dac_override chown fowner fsetid }; +allow sysinit unlabeled:dir { search }; +allow sysinit surfaceflinger_exec:file { getattr }; diff --git a/selinux/system_app.te b/selinux/system_app.te new file mode 100644 index 0000000..8542dc2 --- /dev/null +++ b/selinux/system_app.te @@ -0,0 +1,2 @@ +allow system_app sysfs_display:{ file lnk_file } { getattr open read write }; +allow system_app sysfs_display:dir { search }; diff --git a/selinux/system_server.te b/selinux/system_server.te new file mode 100644 index 0000000..31db12d --- /dev/null +++ b/selinux/system_server.te @@ -0,0 +1,33 @@ +allow system_server input_device:chr_file { read ioctl write open }; +allow system_server sensors_device:chr_file { read open }; +allow system_server sensors_data_file:file r_file_perms; +allow system_server wpa_socket:unix_dgram_socket sendto; + +allow system_server sysfs:file { read open write }; +allow system_server self:capability { sys_module }; + +allow system_server efs_file:dir search; +allow system_server efs_file:file read; +allow system_server efs_device_file:dir search; +allow system_server uhid_device:chr_file { read ioctl write open }; +allow system_server storage_stub_file:dir getattr; + + +# for sensors +allow system_server system_file:file execmod; + +# /efs/wifi/.mac.info +allow system_server wifi_data_file:file { read open }; + +allow system_server gpsd:binder transfer; +type_transition system_server system_data_file:fifo_file gps_data_file ".gps.interface.pipe.to_jni"; + +# Access .gps.interface.pipe.to_gpsd. +allow system_server gps_data_file:dir rw_dir_perms; +allow system_server gps_data_file:fifo_file { setattr rw_file_perms create }; + +# Access /data/sensors/gps* socket +allow system_server gps_data_file:sock_file create_file_perms; +allow system_server gps_data_file:dir rw_dir_perms; +allow system_server gps_data_file:file rw_file_perms; + diff --git a/selinux/tinyplay.te b/selinux/tinyplay.te new file mode 100644 index 0000000..ef7de81 --- /dev/null +++ b/selinux/tinyplay.te @@ -0,0 +1,6 @@ +type tinyplay, domain; +type tinyplay_exec, exec_type, file_type; +init_daemon_domain(tinyplay) + +allow tinyplay audio_device:chr_file { open read write ioctl }; +allow tinyplay audio_device:dir search; diff --git a/selinux/ueventd.te b/selinux/ueventd.te new file mode 100644 index 0000000..315ccb3 --- /dev/null +++ b/selinux/ueventd.te @@ -0,0 +1,5 @@ +# Firmwares +allow ueventd { firmware_mfc }:file r_file_perms; +allow ueventd { firmware_exynos }:dir search; +allow ueventd { firmware_exynos }:file { read getattr open }; +allow ueventd sysfs_display:file { write open }; diff --git a/selinux/untrusted_app.te b/selinux/untrusted_app.te new file mode 100644 index 0000000..f9c5bde --- /dev/null +++ b/selinux/untrusted_app.te @@ -0,0 +1,5 @@ +allow untrusted_app storage_stub_file:dir getattr; +allow untrusted_app log_device:chr_file { read write }; +allow untrusted_app self:udp_socket ioctl; +allow untrusted_app app_data_file:file create_file_perms; +allow untrusted_app app_data_file:dir create_dir_perms; diff --git a/selinux/vold.te b/selinux/vold.te new file mode 100644 index 0000000..ba429d6 --- /dev/null +++ b/selinux/vold.te @@ -0,0 +1,12 @@ +allow vold kernel:process setsched; +allow vold sdcardd_exec:file { read open execute execute_no_trans }; + +allow vold log_device:dir search; +allow vold storage_stub_file:dir { read open search write add_name }; +allow vold mnt_media_rw_stub_file:dir { read open }; +allow vold blkid_exec:file { getattr execute read open execute_no_trans }; + +allow vold log_device:chr_file { write open }; + +allow vold efs_device_file:dir rw_file_perms; +allow vold efs_device_file:file rw_file_perms; diff --git a/selinux/wpa_supplicant.te b/selinux/wpa_supplicant.te new file mode 100644 index 0000000..9b806e0 --- /dev/null +++ b/selinux/wpa_supplicant.te @@ -0,0 +1,12 @@ +allow wpa init:unix_dgram_socket { read write }; + +# logwrapper used with wpa_supplicant +allow wpa devpts:chr_file { read write }; +allow wpa log_device:chr_file { write }; + +allow wpa wpa_socket:unix_dgram_socket { read write }; +allow wpa_socket system_app:unix_dgram_socket sendto; + +allow wpa_socket wifi_data_file:sock_file unlink; + +allow wpa rfkill_device:chr_file rw_file_perms; diff --git a/selinux/zygote.te b/selinux/zygote.te new file mode 100644 index 0000000..4de92c2 --- /dev/null +++ b/selinux/zygote.te @@ -0,0 +1 @@ +allow zygote log_device:dir search; -- cgit v1.1 From 0e9b644abbaf2040615c78761f686ef8d39ee5ba Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Tue, 22 Dec 2015 20:06:56 +0530 Subject: Revert "n7100: set mQANelements through property" This reverts commit c44906d64a221421c303e36e1571f373984ef53a. --- system.prop | 1 - 1 file changed, 1 deletion(-) diff --git a/system.prop b/system.prop index 975f696..db6bcfd 100644 --- a/system.prop +++ b/system.prop @@ -5,6 +5,5 @@ dalvik.vm.dexopt-data-only=1 rild.libpath=/system/lib/ril-wrapper.so rild.libargs=-d /dev/ttyS0 -ro.ril.telephony.mqanelements=5 ro.sf.lcd_density=320 ro.lcd_min_brightness=20 -- cgit v1.1 From 67db5ee1bb3b3835041a90ee043e0fee868a96bd Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Tue, 22 Dec 2015 20:07:09 +0530 Subject: Revert "n7100: ril-wrapper: fake GET_RADIO_CAPABILITY response" This reverts commit 0e7e0240eb089f9c8c5e65b61ea625861e37d56f. --- ril-wrapper/ril-wrapper.c | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/ril-wrapper/ril-wrapper.c b/ril-wrapper/ril-wrapper.c index 886cb34..8371870 100644 --- a/ril-wrapper/ril-wrapper.c +++ b/ril-wrapper/ril-wrapper.c @@ -28,18 +28,6 @@ static RIL_RadioFunctions const *mRealRadioFuncs; static const struct RIL_Env *mEnv; -static void rilOnRequest(int request, void *data, size_t datalen, RIL_Token t) -{ - switch (request) { - case RIL_REQUEST_GET_RADIO_CAPABILITY: - RLOGW("Returning NOT_SUPPORTED on GET_RADIO_CAPABILITY"); - mEnv->OnRequestComplete(t, RIL_E_REQUEST_NOT_SUPPORTED, NULL, 0); - break; - default: - mRealRadioFuncs->onRequest(request, data, datalen, t); - } -} - const RIL_RadioFunctions* RIL_Init(const struct RIL_Env *env, int argc, char **argv) { RIL_RadioFunctions const* (*fRealRilInit)(const struct RIL_Env *env, int argc, char **argv); @@ -86,7 +74,6 @@ const RIL_RadioFunctions* RIL_Init(const struct RIL_Env *env, int argc, char **a //copy the real RIL's info struct, then replace the onRequest pointer with our own rilInfo = *mRealRadioFuncs; - rilInfo.onRequest = rilOnRequest; RLOGD("Wrapped RIL version is '%s'\n", mRealRadioFuncs->getVersion()); -- cgit v1.1 From 74c6b1298e9df607e7b78f25be56f334efa56c63 Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Tue, 22 Dec 2015 20:22:19 +0530 Subject: n7100: some more GPS fixes --- configs/gps.xml | 13 +- gps_daemon.sh | 2 +- include/hardware/gps.h | 1884 ++++++++++++++++++++++++++++++++++++++++++++++++ n7100.mk | 3 +- rootdir/init.target.rc | 2 +- 5 files changed, 1899 insertions(+), 5 deletions(-) create mode 100644 include/hardware/gps.h diff --git a/configs/gps.xml b/configs/gps.xml index 6c6124d..fd1eccb 100644 --- a/configs/gps.xml +++ b/configs/gps.xml @@ -7,12 +7,15 @@ gpioNStdbyPath="/sys/class/sec/gps/GPS_PWR_EN/value" gpioDelayMs="250" acNvStoDir="/data/gps/" - acNmeaOutName="/data/gps/nmea_out" - ctrlPipe="/data/gps/glgpsctrl" + FactoryTestFilePath="/data/" Log="JAVA" acLogDirectory="/storage/sdcard0/gps/broadcom/storage" + TISEnabled="true" + LPmode="false" + cp-cold-start="false" + cp-guard-time-sec="1" arp-supl-enable="true" arp-supl-cap-msb="true" arp-supl-cap-msa="true" @@ -28,13 +31,19 @@ SuplUT3Seconds="20" SuplVersion="1" + LbsEnable="true" + LbsLocal="false" + LbsServer="BCMLS2.glpals.com" + LbsPort="7275" LbsSyncLto="false" SyncLto="true" ltoFileName="lto2.dat" acLtoDir="/data/gps/" LbsSyncLtoThresholdDays="1" + LbsTAC="10101106" LbsCellEnable="false" ctrlPipe="/data/gps/glgpsctrl" + LbsWlanEnable="false" IgnoreJniTime="true" AssertEnabled="false" diff --git a/gps_daemon.sh b/gps_daemon.sh index 7cd6b64..cc83d64 100644 --- a/gps_daemon.sh +++ b/gps_daemon.sh @@ -1,2 +1,2 @@ #shellscript as this is the only way selinux will allow this to proceed -/system/bin/glgps -c /system/etc/gps.xml +/system/bin/gpsd -c /system/etc/gps.xml diff --git a/include/hardware/gps.h b/include/hardware/gps.h new file mode 100644 index 0000000..361e811 --- /dev/null +++ b/include/hardware/gps.h @@ -0,0 +1,1884 @@ +/* + * Copyright (C) 2010 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. + */ + +#ifndef ANDROID_INCLUDE_HARDWARE_GPS_H +#define ANDROID_INCLUDE_HARDWARE_GPS_H + +#include +#include +#include +#include +#include +#include + +#include + +__BEGIN_DECLS + +/** + * The id of this module + */ +#define GPS_HARDWARE_MODULE_ID "gps" + + +/** Milliseconds since January 1, 1970 */ +typedef int64_t GpsUtcTime; + +/** Maximum number of SVs for gps_sv_status_callback(). */ +#define GPS_MAX_SVS 32 + +/** Maximum number of Measurements in gps_measurement_callback(). */ +#define GPS_MAX_MEASUREMENT 32 + +/** Requested operational mode for GPS operation. */ +typedef uint32_t GpsPositionMode; +// IMPORTANT: Note that the following values must match +// constants in GpsLocationProvider.java. +/** Mode for running GPS standalone (no assistance). */ +#define GPS_POSITION_MODE_STANDALONE 0 +/** AGPS MS-Based mode. */ +#define GPS_POSITION_MODE_MS_BASED 1 +/** + * AGPS MS-Assisted mode. This mode is not maintained by the platform anymore. + * It is strongly recommended to use GPS_POSITION_MODE_MS_BASE instead. + */ +#define GPS_POSITION_MODE_MS_ASSISTED 2 + +/** Requested recurrence mode for GPS operation. */ +typedef uint32_t GpsPositionRecurrence; +// IMPORTANT: Note that the following values must match +// constants in GpsLocationProvider.java. +/** Receive GPS fixes on a recurring basis at a specified period. */ +#define GPS_POSITION_RECURRENCE_PERIODIC 0 +/** Request a single shot GPS fix. */ +#define GPS_POSITION_RECURRENCE_SINGLE 1 + +/** GPS status event values. */ +typedef uint16_t GpsStatusValue; +// IMPORTANT: Note that the following values must match +// constants in GpsLocationProvider.java. +/** GPS status unknown. */ +#define GPS_STATUS_NONE 0 +/** GPS has begun navigating. */ +#define GPS_STATUS_SESSION_BEGIN 1 +/** GPS has stopped navigating. */ +#define GPS_STATUS_SESSION_END 2 +/** GPS has powered on but is not navigating. */ +#define GPS_STATUS_ENGINE_ON 3 +/** GPS is powered off. */ +#define GPS_STATUS_ENGINE_OFF 4 + +/** Flags to indicate which values are valid in a GpsLocation. */ +typedef uint16_t GpsLocationFlags; +// IMPORTANT: Note that the following values must match +// constants in GpsLocationProvider.java. +/** GpsLocation has valid latitude and longitude. */ +#define GPS_LOCATION_HAS_LAT_LONG 0x0001 +/** GpsLocation has valid altitude. */ +#define GPS_LOCATION_HAS_ALTITUDE 0x0002 +/** GpsLocation has valid speed. */ +#define GPS_LOCATION_HAS_SPEED 0x0004 +/** GpsLocation has valid bearing. */ +#define GPS_LOCATION_HAS_BEARING 0x0008 +/** GpsLocation has valid accuracy. */ +#define GPS_LOCATION_HAS_ACCURACY 0x0010 + +/** Flags for the gps_set_capabilities callback. */ + +/** GPS HAL schedules fixes for GPS_POSITION_RECURRENCE_PERIODIC mode. + If this is not set, then the framework will use 1000ms for min_interval + and will start and call start() and stop() to schedule the GPS. + */ +#define GPS_CAPABILITY_SCHEDULING 0x0000001 +/** GPS supports MS-Based AGPS mode */ +#define GPS_CAPABILITY_MSB 0x0000002 +/** GPS supports MS-Assisted AGPS mode */ +#define GPS_CAPABILITY_MSA 0x0000004 +/** GPS supports single-shot fixes */ +#define GPS_CAPABILITY_SINGLE_SHOT 0x0000008 +/** GPS supports on demand time injection */ +#define GPS_CAPABILITY_ON_DEMAND_TIME 0x0000010 +/** GPS supports Geofencing */ +#define GPS_CAPABILITY_GEOFENCING 0x0000020 +/** GPS supports Measurements */ +#define GPS_CAPABILITY_MEASUREMENTS 0x0000040 +/** GPS supports Navigation Messages */ +#define GPS_CAPABILITY_NAV_MESSAGES 0x0000080 + +/** Flags used to specify which aiding data to delete + when calling delete_aiding_data(). */ +typedef uint16_t GpsAidingData; +// IMPORTANT: Note that the following values must match +// constants in GpsLocationProvider.java. +#define GPS_DELETE_EPHEMERIS 0x0001 +#define GPS_DELETE_ALMANAC 0x0002 +#define GPS_DELETE_POSITION 0x0004 +#define GPS_DELETE_TIME 0x0008 +#define GPS_DELETE_IONO 0x0010 +#define GPS_DELETE_UTC 0x0020 +#define GPS_DELETE_HEALTH 0x0040 +#define GPS_DELETE_SVDIR 0x0080 +#define GPS_DELETE_SVSTEER 0x0100 +#define GPS_DELETE_SADATA 0x0200 +#define GPS_DELETE_RTI 0x0400 +#define GPS_DELETE_CELLDB_INFO 0x8000 +#define GPS_DELETE_ALL 0xFFFF + +/** AGPS type */ +typedef uint16_t AGpsType; +#define AGPS_TYPE_SUPL 1 +#define AGPS_TYPE_C2K 2 + +typedef uint16_t AGpsSetIDType; +#define AGPS_SETID_TYPE_NONE 0 +#define AGPS_SETID_TYPE_IMSI 1 +#define AGPS_SETID_TYPE_MSISDN 2 + +typedef uint16_t ApnIpType; +#define APN_IP_INVALID 0 +#define APN_IP_IPV4 1 +#define APN_IP_IPV6 2 +#define APN_IP_IPV4V6 3 + +/** + * String length constants + */ +#define GPS_NI_SHORT_STRING_MAXLEN 256 +#define GPS_NI_LONG_STRING_MAXLEN 2048 + +/** + * GpsNiType constants + */ +typedef uint32_t GpsNiType; +#define GPS_NI_TYPE_VOICE 1 +#define GPS_NI_TYPE_UMTS_SUPL 2 +#define GPS_NI_TYPE_UMTS_CTRL_PLANE 3 + +/** + * GpsNiNotifyFlags constants + */ +typedef uint32_t GpsNiNotifyFlags; +/** NI requires notification */ +#define GPS_NI_NEED_NOTIFY 0x0001 +/** NI requires verification */ +#define GPS_NI_NEED_VERIFY 0x0002 +/** NI requires privacy override, no notification/minimal trace */ +#define GPS_NI_PRIVACY_OVERRIDE 0x0004 + +/** + * GPS NI responses, used to define the response in + * NI structures + */ +typedef int GpsUserResponseType; +#define GPS_NI_RESPONSE_ACCEPT 1 +#define GPS_NI_RESPONSE_DENY 2 +#define GPS_NI_RESPONSE_NORESP 3 + +/** + * NI data encoding scheme + */ +typedef int GpsNiEncodingType; +#define GPS_ENC_NONE 0 +#define GPS_ENC_SUPL_GSM_DEFAULT 1 +#define GPS_ENC_SUPL_UTF8 2 +#define GPS_ENC_SUPL_UCS2 3 +#define GPS_ENC_UNKNOWN -1 + +/** AGPS status event values. */ +typedef uint16_t AGpsStatusValue; +/** GPS requests data connection for AGPS. */ +#define GPS_REQUEST_AGPS_DATA_CONN 1 +/** GPS releases the AGPS data connection. */ +#define GPS_RELEASE_AGPS_DATA_CONN 2 +/** AGPS data connection initiated */ +#define GPS_AGPS_DATA_CONNECTED 3 +/** AGPS data connection completed */ +#define GPS_AGPS_DATA_CONN_DONE 4 +/** AGPS data connection failed */ +#define GPS_AGPS_DATA_CONN_FAILED 5 + +#define AGPS_REF_LOCATION_TYPE_GSM_CELLID 1 +#define AGPS_REF_LOCATION_TYPE_UMTS_CELLID 2 +#define AGPS_REG_LOCATION_TYPE_MAC 3 + +/** Network types for update_network_state "type" parameter */ +#define AGPS_RIL_NETWORK_TYPE_MOBILE 0 +#define AGPS_RIL_NETWORK_TYPE_WIFI 1 +#define AGPS_RIL_NETWORK_TYPE_MOBILE_MMS 2 +#define AGPS_RIL_NETWORK_TYPE_MOBILE_SUPL 3 +#define AGPS_RIL_NETWORK_TTYPE_MOBILE_DUN 4 +#define AGPS_RIL_NETWORK_TTYPE_MOBILE_HIPRI 5 +#define AGPS_RIL_NETWORK_TTYPE_WIMAX 6 + +/** + * Flags to indicate what fields in GpsClock are valid. + */ +typedef uint16_t GpsClockFlags; +/** A valid 'leap second' is stored in the data structure. */ +#define GPS_CLOCK_HAS_LEAP_SECOND (1<<0) +/** A valid 'time uncertainty' is stored in the data structure. */ +#define GPS_CLOCK_HAS_TIME_UNCERTAINTY (1<<1) +/** A valid 'full bias' is stored in the data structure. */ +#define GPS_CLOCK_HAS_FULL_BIAS (1<<2) +/** A valid 'bias' is stored in the data structure. */ +#define GPS_CLOCK_HAS_BIAS (1<<3) +/** A valid 'bias uncertainty' is stored in the data structure. */ +#define GPS_CLOCK_HAS_BIAS_UNCERTAINTY (1<<4) +/** A valid 'drift' is stored in the data structure. */ +#define GPS_CLOCK_HAS_DRIFT (1<<5) +/** A valid 'drift uncertainty' is stored in the data structure. */ +#define GPS_CLOCK_HAS_DRIFT_UNCERTAINTY (1<<6) + +/** + * Enumeration of the available values for the GPS Clock type. + */ +typedef uint8_t GpsClockType; +/** The type is not available ot it is unknown. */ +#define GPS_CLOCK_TYPE_UNKNOWN 0 +/** The source of the time value reported by GPS clock is the local hardware clock. */ +#define GPS_CLOCK_TYPE_LOCAL_HW_TIME 1 +/** + * The source of the time value reported by GPS clock is the GPS time derived from satellites + * (epoch = Jan 6, 1980) + */ +#define GPS_CLOCK_TYPE_GPS_TIME 2 + +/** + * Flags to indicate what fields in GpsMeasurement are valid. + */ +typedef uint32_t GpsMeasurementFlags; +/** A valid 'snr' is stored in the data structure. */ +#define GPS_MEASUREMENT_HAS_SNR (1<<0) +/** A valid 'elevation' is stored in the data structure. */ +#define GPS_MEASUREMENT_HAS_ELEVATION (1<<1) +/** A valid 'elevation uncertainty' is stored in the data structure. */ +#define GPS_MEASUREMENT_HAS_ELEVATION_UNCERTAINTY (1<<2) +/** A valid 'azimuth' is stored in the data structure. */ +#define GPS_MEASUREMENT_HAS_AZIMUTH (1<<3) +/** A valid 'azimuth uncertainty' is stored in the data structure. */ +#define GPS_MEASUREMENT_HAS_AZIMUTH_UNCERTAINTY (1<<4) +/** A valid 'pseudorange' is stored in the data structure. */ +#define GPS_MEASUREMENT_HAS_PSEUDORANGE (1<<5) +/** A valid 'pseudorange uncertainty' is stored in the data structure. */ +#define GPS_MEASUREMENT_HAS_PSEUDORANGE_UNCERTAINTY (1<<6) +/** A valid 'code phase' is stored in the data structure. */ +#define GPS_MEASUREMENT_HAS_CODE_PHASE (1<<7) +/** A valid 'code phase uncertainty' is stored in the data structure. */ +#define GPS_MEASUREMENT_HAS_CODE_PHASE_UNCERTAINTY (1<<8) +/** A valid 'carrier frequency' is stored in the data structure. */ +#define GPS_MEASUREMENT_HAS_CARRIER_FREQUENCY (1<<9) +/** A valid 'carrier cycles' is stored in the data structure. */ +#define GPS_MEASUREMENT_HAS_CARRIER_CYCLES (1<<10) +/** A valid 'carrier phase' is stored in the data structure. */ +#define GPS_MEASUREMENT_HAS_CARRIER_PHASE (1<<11) +/** A valid 'carrier phase uncertainty' is stored in the data structure. */ +#define GPS_MEASUREMENT_HAS_CARRIER_PHASE_UNCERTAINTY (1<<12) +/** A valid 'bit number' is stored in the data structure. */ +#define GPS_MEASUREMENT_HAS_BIT_NUMBER (1<<13) +/** A valid 'time from last bit' is stored in the data structure. */ +#define GPS_MEASUREMENT_HAS_TIME_FROM_LAST_BIT (1<<14) +/** A valid 'doppler shift' is stored in the data structure. */ +#define GPS_MEASUREMENT_HAS_DOPPLER_SHIFT (1<<15) +/** A valid 'doppler shift uncertainty' is stored in the data structure. */ +#define GPS_MEASUREMENT_HAS_DOPPLER_SHIFT_UNCERTAINTY (1<<16) +/** A valid 'used in fix' flag is stored in the data structure. */ +#define GPS_MEASUREMENT_HAS_USED_IN_FIX (1<<17) +/** The value of 'pseudorange rate' is uncorrected. */ +#define GPS_MEASUREMENT_HAS_UNCORRECTED_PSEUDORANGE_RATE (1<<18) + +/** + * Enumeration of the available values for the GPS Measurement's loss of lock. + */ +typedef uint8_t GpsLossOfLock; +/** The indicator is not available or it is unknown. */ +#define GPS_LOSS_OF_LOCK_UNKNOWN 0 +/** The measurement does not present any indication of loss of lock. */ +#define GPS_LOSS_OF_LOCK_OK 1 +/** Loss of lock between previous and current observation: cycle slip possible. */ +#define GPS_LOSS_OF_LOCK_CYCLE_SLIP 2 + +/** + * Enumeration of available values for the GPS Measurement's multipath indicator. + */ +typedef uint8_t GpsMultipathIndicator; +/** The indicator is not available or unknown. */ +#define GPS_MULTIPATH_INDICATOR_UNKNOWN 0 +/** The measurement has been indicated to use multipath. */ +#define GPS_MULTIPATH_INDICATOR_DETECTED 1 +/** The measurement has been indicated Not to use multipath. */ +#define GPS_MULTIPATH_INDICATOR_NOT_USED 2 + +/** + * Flags indicating the GPS measurement state. + * The expected behavior here is for GPS HAL to set all the flags that applies. For + * example, if the state for a satellite is only C/A code locked and bit synchronized, + * and there is still millisecond ambiguity, the state should be set as: + * GPS_MEASUREMENT_STATE_CODE_LOCK|GPS_MEASUREMENT_STATE_BIT_SYNC|GPS_MEASUREMENT_STATE_MSEC_AMBIGUOUS + * If GPS is still searching for a satellite, the corresponding state should be set to + * GPS_MEASUREMENT_STATE_UNKNOWN(0). + */ +typedef uint16_t GpsMeasurementState; +#define GPS_MEASUREMENT_STATE_UNKNOWN 0 +#define GPS_MEASUREMENT_STATE_CODE_LOCK (1<<0) +#define GPS_MEASUREMENT_STATE_BIT_SYNC (1<<1) +#define GPS_MEASUREMENT_STATE_SUBFRAME_SYNC (1<<2) +#define GPS_MEASUREMENT_STATE_TOW_DECODED (1<<3) +#define GPS_MEASUREMENT_STATE_MSEC_AMBIGUOUS (1<<4) + +/** + * Flags indicating the Accumulated Delta Range's states. + */ +typedef uint16_t GpsAccumulatedDeltaRangeState; +#define GPS_ADR_STATE_UNKNOWN 0 +#define GPS_ADR_STATE_VALID (1<<0) +#define GPS_ADR_STATE_RESET (1<<1) +#define GPS_ADR_STATE_CYCLE_SLIP (1<<2) + +/** + * Enumeration of available values to indicate the available GPS Navigation message types. + */ +typedef uint8_t GpsNavigationMessageType; +/** The message type is unknown. */ +#define GPS_NAVIGATION_MESSAGE_TYPE_UNKNOWN 0 +/** L1 C/A message contained in the structure. */ +#define GPS_NAVIGATION_MESSAGE_TYPE_L1CA 1 +/** L2-CNAV message contained in the structure. */ +#define GPS_NAVIGATION_MESSAGE_TYPE_L2CNAV 2 +/** L5-CNAV message contained in the structure. */ +#define GPS_NAVIGATION_MESSAGE_TYPE_L5CNAV 3 +/** CNAV-2 message contained in the structure. */ +#define GPS_NAVIGATION_MESSAGE_TYPE_CNAV2 4 + +/** + * Status of Navigation Message + * When a message is received properly without any parity error in its navigation words, the + * status should be set to NAV_MESSAGE_STATUS_PARITY_PASSED. But if a message is received + * with words that failed parity check, but GPS is able to correct those words, the status + * should be set to NAV_MESSAGE_STATUS_PARITY_REBUILT. + * No need to send any navigation message that contains words with parity error and cannot be + * corrected. + */ +typedef uint16_t NavigationMessageStatus; +#define NAV_MESSAGE_STATUS_UNKONW 0 +#define NAV_MESSAGE_STATUS_PARITY_PASSED (1<<0) +#define NAV_MESSAGE_STATUS_PARITY_REBUILT (1<<1) + +/** + * Name for the GPS XTRA interface. + */ +#define GPS_XTRA_INTERFACE "gps-xtra" + +/** + * Name for the GPS DEBUG interface. + */ +#define GPS_DEBUG_INTERFACE "gps-debug" + +/** + * Name for the AGPS interface. + */ +#define AGPS_INTERFACE "agps" + +/** + * Name of the Supl Certificate interface. + */ +#define SUPL_CERTIFICATE_INTERFACE "supl-certificate" + +/** + * Name for NI interface + */ +#define GPS_NI_INTERFACE "gps-ni" + +/** + * Name for the AGPS-RIL interface. + */ +#define AGPS_RIL_INTERFACE "agps_ril" + +/** + * The GPS chipset can use Psc for AGPS. + */ +#define AGPS_USE_PSC + +/** + * Name for the GPS_Geofencing interface. + */ +#define GPS_GEOFENCING_INTERFACE "gps_geofencing" + +/** + * Name of the GPS Measurements interface. + */ +#define GPS_MEASUREMENT_INTERFACE "gps_measurement" + +/** + * Name of the GPS navigation message interface. + */ +#define GPS_NAVIGATION_MESSAGE_INTERFACE "gps_navigation_message" + +/** + * Name of the GNSS/GPS configuration interface. + */ +#define GNSS_CONFIGURATION_INTERFACE "gnss_configuration" + + +/** Represents a location. */ +typedef struct { + /** set to sizeof(GpsLocation) */ + size_t size; + /** Contains GpsLocationFlags bits. */ + uint16_t flags; + /** Represents latitude in degrees. */ + double latitude; + /** Represents longitude in degrees. */ + double longitude; + /** Represents altitude in meters above the WGS 84 reference + * ellipsoid. */ + double altitude; + /** Represents speed in meters per second. */ + float speed; + /** Represents heading in degrees. */ + float bearing; + /** Represents expected accuracy in meters. */ + float accuracy; + /** Timestamp for the location fix. */ + GpsUtcTime timestamp; +} GpsLocation; + +/** Represents the status. */ +typedef struct { + /** set to sizeof(GpsStatus) */ + size_t size; + GpsStatusValue status; +} GpsStatus; + +/** Represents SV information. */ +typedef struct { + /** set to sizeof(GpsSvInfo) */ + size_t size; + /** Pseudo-random number for the SV. */ + int prn; + /** Signal to noise ratio. */ + float snr; + /** Elevation of SV in degrees. */ + float elevation; + /** Azimuth of SV in degrees. */ + float azimuth; + /** Unknown field in Samsung I9100 libgps + May be an indicator for constellation type + (GPS, GLONASS, Galileo)? + Used on GT-I9100, likely also present on GT-N7000, + SGH-I717, SGH-I727 but this needs confirmation. + */ + int unknown_samsung_field; +} GpsSvInfo; + +/** Represents SV status. */ +typedef struct { + /** set to sizeof(GpsSvStatus) */ + size_t size; + + /** Number of SVs currently visible. */ + int num_svs; + + /** Contains an array of SV information. */ + GpsSvInfo sv_list[GPS_MAX_SVS]; + + /** Represents a bit mask indicating which SVs + * have ephemeris data. + */ + uint32_t ephemeris_mask; + + /** Represents a bit mask indicating which SVs + * have almanac data. + */ + uint32_t almanac_mask; + + /** + * Represents a bit mask indicating which SVs + * were used for computing the most recent position fix. + */ + uint32_t used_in_fix_mask; +} GpsSvStatus; + + +/* 2G and 3G */ +/* In 3G lac is discarded */ +typedef struct { + uint16_t type; + uint16_t mcc; + uint16_t mnc; + uint16_t lac; +#ifdef AGPS_USE_PSC + uint16_t psc; +#endif + uint32_t cid; +} AGpsRefLocationCellID; + +typedef struct { + uint8_t mac[6]; +} AGpsRefLocationMac; + +/** Represents ref locations */ +typedef struct { + uint16_t type; + union { + AGpsRefLocationCellID cellID; + AGpsRefLocationMac mac; + } u; +} AGpsRefLocation; + +/** Callback with location information. + * Can only be called from a thread created by create_thread_cb. + */ +typedef void (* gps_location_callback)(GpsLocation* location); + +/** Callback with status information. + * Can only be called from a thread created by create_thread_cb. + */ +typedef void (* gps_status_callback)(GpsStatus* status); + +/** + * Callback with SV status information. + * Can only be called from a thread created by create_thread_cb. + */ +typedef void (* gps_sv_status_callback)(GpsSvStatus* sv_info); + +/** Callback for reporting NMEA sentences. + * Can only be called from a thread created by create_thread_cb. + */ +typedef void (* gps_nmea_callback)(GpsUtcTime timestamp, const char* nmea, int length); + +/** Callback to inform framework of the GPS engine's capabilities. + * Capability parameter is a bit field of GPS_CAPABILITY_* flags. + */ +typedef void (* gps_set_capabilities)(uint32_t capabilities); + +/** Callback utility for acquiring the GPS wakelock. + * This can be used to prevent the CPU from suspending while handling GPS events. + */ +typedef void (* gps_acquire_wakelock)(); + +/** Callback utility for releasing the GPS wakelock. */ +typedef void (* gps_release_wakelock)(); + +/** Callback for requesting NTP time */ +typedef void (* gps_request_utc_time)(); + +/** Callback for creating a thread that can call into the Java framework code. + * This must be used to create any threads that report events up to the framework. + */ +typedef pthread_t (* gps_create_thread)(const char* name, void (*start)(void *), void* arg); + +/** GPS callback structure. */ +typedef struct { + /** set to sizeof(GpsCallbacks) */ + size_t size; + gps_location_callback location_cb; + gps_status_callback status_cb; + gps_sv_status_callback sv_status_cb; + gps_nmea_callback nmea_cb; + gps_set_capabilities set_capabilities_cb; + gps_acquire_wakelock acquire_wakelock_cb; + gps_release_wakelock release_wakelock_cb; + gps_create_thread create_thread_cb; + gps_request_utc_time request_utc_time_cb; +} GpsCallbacks; + + +/** Represents the standard GPS interface. */ +typedef struct { + /** set to sizeof(GpsInterface) */ + size_t size; + /** + * Opens the interface and provides the callback routines + * to the implementation of this interface. + */ + int (*init)( GpsCallbacks* callbacks ); + + /** Starts navigating. */ + int (*start)( void ); + + /** Stops navigating. */ + int (*stop)( void ); + + /** Closes the interface. */ + void (*cleanup)( void ); + + /** Injects the current time. */ + int (*inject_time)(GpsUtcTime time, int64_t timeReference, + int uncertainty); + + /** Injects current location from another location provider + * (typically cell ID). + * latitude and longitude are measured in degrees + * expected accuracy is measured in meters + */ + int (*inject_location)(double latitude, double longitude, float accuracy); + + /** + * Specifies that the next call to start will not use the + * information defined in the flags. GPS_DELETE_ALL is passed for + * a cold start. + */ + void (*delete_aiding_data)(GpsAidingData flags); + + /** + * min_interval represents the time between fixes in milliseconds. + * preferred_accuracy represents the requested fix accuracy in meters. + * preferred_time represents the requested time to first fix in milliseconds. + * + * 'mode' parameter should be one of GPS_POSITION_MODE_MS_BASE + * or GPS_POSITION_MODE_STANDALONE. + * It is allowed by the platform (and it is recommended) to fallback to + * GPS_POSITION_MODE_MS_BASE if GPS_POSITION_MODE_MS_ASSISTED is passed in, and + * GPS_POSITION_MODE_MS_BASED is supported. + */ + int (*set_position_mode)(GpsPositionMode mode, GpsPositionRecurrence recurrence, + uint32_t min_interval, uint32_t preferred_accuracy, uint32_t preferred_time); + + /** Get a pointer to extension information. */ + const void* (*get_extension)(const char* name); +} GpsInterface; + +/** Callback to request the client to download XTRA data. + * The client should download XTRA data and inject it by calling inject_xtra_data(). + * Can only be called from a thread created by create_thread_cb. + */ +typedef void (* gps_xtra_download_request)(); + +/** Callback structure for the XTRA interface. */ +typedef struct { + gps_xtra_download_request download_request_cb; + gps_create_thread create_thread_cb; +} GpsXtraCallbacks; + +/** Extended interface for XTRA support. */ +typedef struct { + /** set to sizeof(GpsXtraInterface) */ + size_t size; + /** + * Opens the XTRA interface and provides the callback routines + * to the implementation of this interface. + */ + int (*init)( GpsXtraCallbacks* callbacks ); + /** Injects XTRA data into the GPS. */ + int (*inject_xtra_data)( char* data, int length ); +} GpsXtraInterface; + +/** Extended interface for DEBUG support. */ +typedef struct { + /** set to sizeof(GpsDebugInterface) */ + size_t size; + + /** + * This function should return any information that the native + * implementation wishes to include in a bugreport. + */ + size_t (*get_internal_state)(char* buffer, size_t bufferSize); +} GpsDebugInterface; + +#pragma pack(push,4) +// We need to keep the alignment of this data structure to 4-bytes, to ensure that in 64-bit +// environments the size of this legacy definition does not collide with _v2. Implementations should +// be using _v2 and _v3, so it's OK to pay the 'unaligned' penalty in 64-bit if an old +// implementation is still in use. + +/** Represents the status of AGPS. */ +typedef struct { + /** set to sizeof(AGpsStatus_v1) */ + size_t size; + + AGpsType type; + AGpsStatusValue status; +} AGpsStatus_v1; + +#pragma pack(pop) + +/** Represents the status of AGPS augmented with a IPv4 address field. */ +typedef struct { + /** set to sizeof(AGpsStatus_v2) */ + size_t size; + + AGpsType type; + AGpsStatusValue status; + uint32_t ipaddr; +} AGpsStatus_v2; + +/* Represents the status of AGPS augmented to support IPv4 and IPv6. */ +typedef struct { + /** set to sizeof(AGpsStatus_v3) */ + size_t size; + + AGpsType type; + AGpsStatusValue status; + + /** + * Must be set to a valid IPv4 address if the field 'addr' contains an IPv4 + * address, or set to INADDR_NONE otherwise. + */ + uint32_t ipaddr; + + /** + * Must contain the IPv4 (AF_INET) or IPv6 (AF_INET6) address to report. + * Any other value of addr.ss_family will be rejected. + * */ + struct sockaddr_storage addr; +} AGpsStatus_v3; + +typedef AGpsStatus_v3 AGpsStatus; + +/** Callback with AGPS status information. + * Can only be called from a thread created by create_thread_cb. + */ +typedef void (* agps_status_callback)(AGpsStatus* status); + +/** Callback structure for the AGPS interface. */ +typedef struct { + agps_status_callback status_cb; + gps_create_thread create_thread_cb; +} AGpsCallbacks; + + +/** Extended interface for AGPS support. */ +typedef struct { + /** set to sizeof(AGpsInterface_v1) */ + size_t size; + + /** + * Opens the AGPS interface and provides the callback routines + * to the implementation of this interface. + */ + void (*init)( AGpsCallbacks* callbacks ); + /** + * Notifies that a data connection is available and sets + * the name of the APN to be used for SUPL. + */ + int (*data_conn_open)( const char* apn ); + /** + * Notifies that the AGPS data connection has been closed. + */ + int (*data_conn_closed)(); + /** + * Notifies that a data connection is not available for AGPS. + */ + int (*data_conn_failed)(); + /** + * Sets the hostname and port for the AGPS server. + */ + int (*set_server)( AGpsType type, const char* hostname, int port ); +} AGpsInterface_v1; + +/** + * Extended interface for AGPS support, it is augmented to enable to pass + * extra APN data. + */ +typedef struct { + /** set to sizeof(AGpsInterface_v2) */ + size_t size; + + /** + * Opens the AGPS interface and provides the callback routines to the + * implementation of this interface. + */ + void (*init)(AGpsCallbacks* callbacks); + /** + * Deprecated. + * If the HAL supports AGpsInterface_v2 this API will not be used, see + * data_conn_open_with_apn_ip_type for more information. + */ + int (*data_conn_open)(const char* apn); + /** + * Notifies that the AGPS data connection has been closed. + */ + int (*data_conn_closed)(); + /** + * Notifies that a data connection is not available for AGPS. + */ + int (*data_conn_failed)(); + /** + * Sets the hostname and port for the AGPS server. + */ + int (*set_server)(AGpsType type, const char* hostname, int port); + + /** + * Notifies that a data connection is available and sets the name of the + * APN, and its IP type, to be used for SUPL connections. + */ + int (*data_conn_open_with_apn_ip_type)( + const char* apn, + ApnIpType apnIpType); +} AGpsInterface_v2; + +typedef AGpsInterface_v2 AGpsInterface; + +/** Error codes associated with certificate operations */ +#define AGPS_CERTIFICATE_OPERATION_SUCCESS 0 +#define AGPS_CERTIFICATE_ERROR_GENERIC -100 +#define AGPS_CERTIFICATE_ERROR_TOO_MANY_CERTIFICATES -101 + +/** A data structure that represents an X.509 certificate using DER encoding */ +typedef struct { + size_t length; + u_char* data; +} DerEncodedCertificate; + +/** + * A type definition for SHA1 Fingerprints used to identify X.509 Certificates + * The Fingerprint is a digest of the DER Certificate that uniquely identifies it. + */ +typedef struct { + u_char data[20]; +} Sha1CertificateFingerprint; + +/** AGPS Interface to handle SUPL certificate operations */ +typedef struct { + /** set to sizeof(SuplCertificateInterface) */ + size_t size; + + /** + * Installs a set of Certificates used for SUPL connections to the AGPS server. + * If needed the HAL should find out internally any certificates that need to be removed to + * accommodate the certificates to install. + * The certificates installed represent a full set of valid certificates needed to connect to + * AGPS SUPL servers. + * The list of certificates is required, and all must be available at the same time, when trying + * to establish a connection with the AGPS Server. + * + * Parameters: + * certificates - A pointer to an array of DER encoded certificates that are need to be + * installed in the HAL. + * length - The number of certificates to install. + * Returns: + * AGPS_CERTIFICATE_OPERATION_SUCCESS if the operation is completed successfully + * AGPS_CERTIFICATE_ERROR_TOO_MANY_CERTIFICATES if the HAL cannot store the number of + * certificates attempted to be installed, the state of the certificates stored should + * remain the same as before on this error case. + * + * IMPORTANT: + * If needed the HAL should find out internally the set of certificates that need to be + * removed to accommodate the certificates to install. + */ + int (*install_certificates) ( const DerEncodedCertificate* certificates, size_t length ); + + /** + * Notifies the HAL that a list of certificates used for SUPL connections are revoked. It is + * expected that the given set of certificates is removed from the internal store of the HAL. + * + * Parameters: + * fingerprints - A pointer to an array of SHA1 Fingerprints to identify the set of + * certificates to revoke. + * length - The number of fingerprints provided. + * Returns: + * AGPS_CERTIFICATE_OPERATION_SUCCESS if the operation is completed successfully. + * + * IMPORTANT: + * If any of the certificates provided (through its fingerprint) is not known by the HAL, + * it should be ignored and continue revoking/deleting the rest of them. + */ + int (*revoke_certificates) ( const Sha1CertificateFingerprint* fingerprints, size_t length ); +} SuplCertificateInterface; + +/** Represents an NI request */ +typedef struct { + /** set to sizeof(GpsNiNotification) */ + size_t size; + + /** + * An ID generated by HAL to associate NI notifications and UI + * responses + */ + int notification_id; + + /** + * An NI type used to distinguish different categories of NI + * events, such as GPS_NI_TYPE_VOICE, GPS_NI_TYPE_UMTS_SUPL, ... + */ + GpsNiType ni_type; + + /** + * Notification/verification options, combinations of GpsNiNotifyFlags constants + */ + GpsNiNotifyFlags notify_flags; + + /** + * Timeout period to wait for user response. + * Set to 0 for no time out limit. + */ + int timeout; + + /** + * Default response when time out. + */ + GpsUserResponseType default_response; + + /** + * Requestor ID + */ + char requestor_id[GPS_NI_SHORT_STRING_MAXLEN]; + + /** + * Notification message. It can also be used to store client_id in some cases + */ + char text[GPS_NI_LONG_STRING_MAXLEN]; + + /** + * Client name decoding scheme + */ + GpsNiEncodingType requestor_id_encoding; + + /** + * Client name decoding scheme + */ + GpsNiEncodingType text_encoding; + + /** + * A pointer to extra data. Format: + * key_1 = value_1 + * key_2 = value_2 + */ + char extras[GPS_NI_LONG_STRING_MAXLEN]; + +} GpsNiNotification; + +/** Callback with NI notification. + * Can only be called from a thread created by create_thread_cb. + */ +typedef void (*gps_ni_notify_callback)(GpsNiNotification *notification); + +/** GPS NI callback structure. */ +typedef struct +{ + /** + * Sends the notification request from HAL to GPSLocationProvider. + */ + gps_ni_notify_callback notify_cb; + gps_create_thread create_thread_cb; +} GpsNiCallbacks; + +/** + * Extended interface for Network-initiated (NI) support. + */ +typedef struct +{ + /** set to sizeof(GpsNiInterface) */ + size_t size; + + /** Registers the callbacks for HAL to use. */ + void (*init) (GpsNiCallbacks *callbacks); + + /** Sends a response to HAL. */ + void (*respond) (int notif_id, GpsUserResponseType user_response); +} GpsNiInterface; + +struct gps_device_t { + struct hw_device_t common; + + /** + * Set the provided lights to the provided values. + * + * Returns: 0 on succes, error code on failure. + */ + const GpsInterface* (*get_gps_interface)(struct gps_device_t* dev); +}; + +#define AGPS_RIL_REQUEST_SETID_IMSI (1<<0L) +#define AGPS_RIL_REQUEST_SETID_MSISDN (1<<1L) + +#define AGPS_RIL_REQUEST_REFLOC_CELLID (1<<0L) +#define AGPS_RIL_REQUEST_REFLOC_MAC (1<<1L) + +typedef void (*agps_ril_request_set_id)(uint32_t flags); +typedef void (*agps_ril_request_ref_loc)(uint32_t flags); + +typedef struct { + agps_ril_request_set_id request_setid; + agps_ril_request_ref_loc request_refloc; + gps_create_thread create_thread_cb; +} AGpsRilCallbacks; + +/** Extended interface for AGPS_RIL support. */ +typedef struct { + /** set to sizeof(AGpsRilInterface) */ + size_t size; + /** + * Opens the AGPS interface and provides the callback routines + * to the implementation of this interface. + */ + void (*init)( AGpsRilCallbacks* callbacks ); + + /** + * Sets the reference location. + */ + void (*set_ref_location) (const AGpsRefLocation *agps_reflocation, size_t sz_struct); + /** + * Sets the set ID. + */ + void (*set_set_id) (AGpsSetIDType type, const char* setid); + + /** + * Send network initiated message. + */ + void (*ni_message) (uint8_t *msg, size_t len); + + /** + * Notify GPS of network status changes. + * These parameters match values in the android.net.NetworkInfo class. + */ + void (*update_network_state) (int connected, int type, int roaming, const char* extra_info); + + /** + * Notify GPS of network status changes. + * These parameters match values in the android.net.NetworkInfo class. + */ + void (*update_network_availability) (int avaiable, const char* apn); +} AGpsRilInterface; + +/** + * GPS Geofence. + * There are 3 states associated with a Geofence: Inside, Outside, Unknown. + * There are 3 transitions: ENTERED, EXITED, UNCERTAIN. + * + * An example state diagram with confidence level: 95% and Unknown time limit + * set as 30 secs is shown below. (confidence level and Unknown time limit are + * explained latter) + * ____________________________ + * | Unknown (30 secs) | + * """""""""""""""""""""""""""" + * ^ | | ^ + * UNCERTAIN| |ENTERED EXITED| |UNCERTAIN + * | v v | + * ________ EXITED _________ + * | Inside | -----------> | Outside | + * | | <----------- | | + * """""""" ENTERED """"""""" + * + * Inside state: We are 95% confident that the user is inside the geofence. + * Outside state: We are 95% confident that the user is outside the geofence + * Unknown state: Rest of the time. + * + * The Unknown state is better explained with an example: + * + * __________ + * | c| + * | ___ | _______ + * | |a| | | b | + * | """ | """"""" + * | | + * """""""""" + * In the diagram above, "a" and "b" are 2 geofences and "c" is the accuracy + * circle reported by the GPS subsystem. Now with regard to "b", the system is + * confident that the user is outside. But with regard to "a" is not confident + * whether it is inside or outside the geofence. If the accuracy remains the + * same for a sufficient period of time, the UNCERTAIN transition would be + * triggered with the state set to Unknown. If the accuracy improves later, an + * appropriate transition should be triggered. This "sufficient period of time" + * is defined by the parameter in the add_geofence_area API. + * In other words, Unknown state can be interpreted as a state in which the + * GPS subsystem isn't confident enough that the user is either inside or + * outside the Geofence. It moves to Unknown state only after the expiry of the + * timeout. + * + * The geofence callback needs to be triggered for the ENTERED and EXITED + * transitions, when the GPS system is confident that the user has entered + * (Inside state) or exited (Outside state) the Geofence. An implementation + * which uses a value of 95% as the confidence is recommended. The callback + * should be triggered only for the transitions requested by the + * add_geofence_area call. + * + * Even though the diagram and explanation talks about states and transitions, + * the callee is only interested in the transistions. The states are mentioned + * here for illustrative purposes. + * + * Startup Scenario: When the device boots up, if an application adds geofences, + * and then we get an accurate GPS location fix, it needs to trigger the + * appropriate (ENTERED or EXITED) transition for every Geofence it knows about. + * By default, all the Geofences will be in the Unknown state. + * + * When the GPS system is unavailable, gps_geofence_status_callback should be + * called to inform the upper layers of the same. Similarly, when it becomes + * available the callback should be called. This is a global state while the + * UNKNOWN transition described above is per geofence. + * + * An important aspect to note is that users of this API (framework), will use + * other subsystems like wifi, sensors, cell to handle Unknown case and + * hopefully provide a definitive state transition to the third party + * application. GPS Geofence will just be a signal indicating what the GPS + * subsystem knows about the Geofence. + * + */ +#define GPS_GEOFENCE_ENTERED (1<<0L) +#define GPS_GEOFENCE_EXITED (1<<1L) +#define GPS_GEOFENCE_UNCERTAIN (1<<2L) + +#define GPS_GEOFENCE_UNAVAILABLE (1<<0L) +#define GPS_GEOFENCE_AVAILABLE (1<<1L) + +#define GPS_GEOFENCE_OPERATION_SUCCESS 0 +#define GPS_GEOFENCE_ERROR_TOO_MANY_GEOFENCES -100 +#define GPS_GEOFENCE_ERROR_ID_EXISTS -101 +#define GPS_GEOFENCE_ERROR_ID_UNKNOWN -102 +#define GPS_GEOFENCE_ERROR_INVALID_TRANSITION -103 +#define GPS_GEOFENCE_ERROR_GENERIC -149 + +/** + * The callback associated with the geofence. + * Parameters: + * geofence_id - The id associated with the add_geofence_area. + * location - The current GPS location. + * transition - Can be one of GPS_GEOFENCE_ENTERED, GPS_GEOFENCE_EXITED, + * GPS_GEOFENCE_UNCERTAIN. + * timestamp - Timestamp when the transition was detected. + * + * The callback should only be called when the caller is interested in that + * particular transition. For instance, if the caller is interested only in + * ENTERED transition, then the callback should NOT be called with the EXITED + * transition. + * + * IMPORTANT: If a transition is triggered resulting in this callback, the GPS + * subsystem will wake up the application processor, if its in suspend state. + */ +typedef void (*gps_geofence_transition_callback) (int32_t geofence_id, GpsLocation* location, + int32_t transition, GpsUtcTime timestamp); + +/** + * The callback associated with the availability of the GPS system for geofencing + * monitoring. If the GPS system determines that it cannot monitor geofences + * because of lack of reliability or unavailability of the GPS signals, it will + * call this callback with GPS_GEOFENCE_UNAVAILABLE parameter. + * + * Parameters: + * status - GPS_GEOFENCE_UNAVAILABLE or GPS_GEOFENCE_AVAILABLE. + * last_location - Last known location. + */ +typedef void (*gps_geofence_status_callback) (int32_t status, GpsLocation* last_location); + +/** + * The callback associated with the add_geofence call. + * + * Parameter: + * geofence_id - Id of the geofence. + * status - GPS_GEOFENCE_OPERATION_SUCCESS + * GPS_GEOFENCE_ERROR_TOO_MANY_GEOFENCES - geofence limit has been reached. + * GPS_GEOFENCE_ERROR_ID_EXISTS - geofence with id already exists + * GPS_GEOFENCE_ERROR_INVALID_TRANSITION - the monitorTransition contains an + * invalid transition + * GPS_GEOFENCE_ERROR_GENERIC - for other errors. + */ +typedef void (*gps_geofence_add_callback) (int32_t geofence_id, int32_t status); + +/** + * The callback associated with the remove_geofence call. + * + * Parameter: + * geofence_id - Id of the geofence. + * status - GPS_GEOFENCE_OPERATION_SUCCESS + * GPS_GEOFENCE_ERROR_ID_UNKNOWN - for invalid id + * GPS_GEOFENCE_ERROR_GENERIC for others. + */ +typedef void (*gps_geofence_remove_callback) (int32_t geofence_id, int32_t status); + + +/** + * The callback associated with the pause_geofence call. + * + * Parameter: + * geofence_id - Id of the geofence. + * status - GPS_GEOFENCE_OPERATION_SUCCESS + * GPS_GEOFENCE_ERROR_ID_UNKNOWN - for invalid id + * GPS_GEOFENCE_ERROR_INVALID_TRANSITION - + * when monitor_transitions is invalid + * GPS_GEOFENCE_ERROR_GENERIC for others. + */ +typedef void (*gps_geofence_pause_callback) (int32_t geofence_id, int32_t status); + +/** + * The callback associated with the resume_geofence call. + * + * Parameter: + * geofence_id - Id of the geofence. + * status - GPS_GEOFENCE_OPERATION_SUCCESS + * GPS_GEOFENCE_ERROR_ID_UNKNOWN - for invalid id + * GPS_GEOFENCE_ERROR_GENERIC for others. + */ +typedef void (*gps_geofence_resume_callback) (int32_t geofence_id, int32_t status); + +typedef struct { + gps_geofence_transition_callback geofence_transition_callback; + gps_geofence_status_callback geofence_status_callback; + gps_geofence_add_callback geofence_add_callback; + gps_geofence_remove_callback geofence_remove_callback; + gps_geofence_pause_callback geofence_pause_callback; + gps_geofence_resume_callback geofence_resume_callback; + gps_create_thread create_thread_cb; +} GpsGeofenceCallbacks; + +/** Extended interface for GPS_Geofencing support */ +typedef struct { + /** set to sizeof(GpsGeofencingInterface) */ + size_t size; + + /** + * Opens the geofence interface and provides the callback routines + * to the implementation of this interface. + */ + void (*init)( GpsGeofenceCallbacks* callbacks ); + + /** + * Add a geofence area. This api currently supports circular geofences. + * Parameters: + * geofence_id - The id for the geofence. If a geofence with this id + * already exists, an error value (GPS_GEOFENCE_ERROR_ID_EXISTS) + * should be returned. + * latitude, longtitude, radius_meters - The lat, long and radius + * (in meters) for the geofence + * last_transition - The current state of the geofence. For example, if + * the system already knows that the user is inside the geofence, + * this will be set to GPS_GEOFENCE_ENTERED. In most cases, it + * will be GPS_GEOFENCE_UNCERTAIN. + * monitor_transition - Which transitions to monitor. Bitwise OR of + * GPS_GEOFENCE_ENTERED, GPS_GEOFENCE_EXITED and + * GPS_GEOFENCE_UNCERTAIN. + * notification_responsiveness_ms - Defines the best-effort description + * of how soon should the callback be called when the transition + * associated with the Geofence is triggered. For instance, if set + * to 1000 millseconds with GPS_GEOFENCE_ENTERED, the callback + * should be called 1000 milliseconds within entering the geofence. + * This parameter is defined in milliseconds. + * NOTE: This is not to be confused with the rate that the GPS is + * polled at. It is acceptable to dynamically vary the rate of + * sampling the GPS for power-saving reasons; thus the rate of + * sampling may be faster or slower than this. + * unknown_timer_ms - The time limit after which the UNCERTAIN transition + * should be triggered. This parameter is defined in milliseconds. + * See above for a detailed explanation. + */ + void (*add_geofence_area) (int32_t geofence_id, double latitude, double longitude, + double radius_meters, int last_transition, int monitor_transitions, + int notification_responsiveness_ms, int unknown_timer_ms); + + /** + * Pause monitoring a particular geofence. + * Parameters: + * geofence_id - The id for the geofence. + */ + void (*pause_geofence) (int32_t geofence_id); + + /** + * Resume monitoring a particular geofence. + * Parameters: + * geofence_id - The id for the geofence. + * monitor_transitions - Which transitions to monitor. Bitwise OR of + * GPS_GEOFENCE_ENTERED, GPS_GEOFENCE_EXITED and + * GPS_GEOFENCE_UNCERTAIN. + * This supersedes the value associated provided in the + * add_geofence_area call. + */ + void (*resume_geofence) (int32_t geofence_id, int monitor_transitions); + + /** + * Remove a geofence area. After the function returns, no notifications + * should be sent. + * Parameter: + * geofence_id - The id for the geofence. + */ + void (*remove_geofence_area) (int32_t geofence_id); +} GpsGeofencingInterface; + + +/** + * Represents an estimate of the GPS clock time. + */ +typedef struct { + /** set to sizeof(GpsClock) */ + size_t size; + + /** A set of flags indicating the validity of the fields in this data structure. */ + GpsClockFlags flags; + + /** + * Leap second data. + * The sign of the value is defined by the following equation: + * utc_time_ns = time_ns + (full_bias_ns + bias_ns) - leap_second * 1,000,000,000 + * + * If the data is available 'flags' must contain GPS_CLOCK_HAS_LEAP_SECOND. + */ + int16_t leap_second; + + /** + * Indicates the type of time reported by the 'time_ns' field. + * This is a Mandatory field. + */ + GpsClockType type; + + /** + * The GPS receiver internal clock value. This can be either the local hardware clock value + * (GPS_CLOCK_TYPE_LOCAL_HW_TIME), or the current GPS time derived inside GPS receiver + * (GPS_CLOCK_TYPE_GPS_TIME). The field 'type' defines the time reported. + * + * For local hardware clock, this value is expected to be monotonically increasing during + * the reporting session. The real GPS time can be derived by compensating the 'full bias' + * (when it is available) from this value. + * + * For GPS time, this value is expected to be the best estimation of current GPS time that GPS + * receiver can achieve. Set the 'time uncertainty' appropriately when GPS time is specified. + * + * Sub-nanosecond accuracy can be provided by means of the 'bias' field. + * The value contains the 'time uncertainty' in it. + * + * This is a Mandatory field. + */ + int64_t time_ns; + + /** + * 1-Sigma uncertainty associated with the clock's time in nanoseconds. + * The uncertainty is represented as an absolute (single sided) value. + * + * This value should be set if GPS_CLOCK_TYPE_GPS_TIME is set. + * If the data is available 'flags' must contain GPS_CLOCK_HAS_TIME_UNCERTAINTY. + */ + double time_uncertainty_ns; + + /** + * The difference between hardware clock ('time' field) inside GPS receiver and the true GPS + * time since 0000Z, January 6, 1980, in nanoseconds. + * This value is used if and only if GPS_CLOCK_TYPE_LOCAL_HW_TIME is set, and GPS receiver + * has solved the clock for GPS time. + * The caller is responsible for using the 'bias uncertainty' field for quality check. + * + * The sign of the value is defined by the following equation: + * true time (GPS time) = time_ns + (full_bias_ns + bias_ns) + * + * This value contains the 'bias uncertainty' in it. + * If the data is available 'flags' must contain GPS_CLOCK_HAS_FULL_BIAS. + */ + int64_t full_bias_ns; + + /** + * Sub-nanosecond bias. + * The value contains the 'bias uncertainty' in it. + * + * If the data is available 'flags' must contain GPS_CLOCK_HAS_BIAS. + */ + double bias_ns; + + /** + * 1-Sigma uncertainty associated with the clock's bias in nanoseconds. + * The uncertainty is represented as an absolute (single sided) value. + * + * If the data is available 'flags' must contain GPS_CLOCK_HAS_BIAS_UNCERTAINTY. + */ + double bias_uncertainty_ns; + + /** + * The clock's drift in nanoseconds (per second). + * A positive value means that the frequency is higher than the nominal frequency. + * + * The value contains the 'drift uncertainty' in it. + * If the data is available 'flags' must contain GPS_CLOCK_HAS_DRIFT. + * + * If GpsMeasurement's 'flags' field contains GPS_MEASUREMENT_HAS_UNCORRECTED_PSEUDORANGE_RATE, + * it is encouraged that this field is also provided. + */ + double drift_nsps; + + /** + * 1-Sigma uncertainty associated with the clock's drift in nanoseconds (per second). + * The uncertainty is represented as an absolute (single sided) value. + * + * If the data is available 'flags' must contain GPS_CLOCK_HAS_DRIFT_UNCERTAINTY. + */ + double drift_uncertainty_nsps; +} GpsClock; + +/** + * Represents a GPS Measurement, it contains raw and computed information. + */ +typedef struct { + /** set to sizeof(GpsMeasurement) */ + size_t size; + + /** A set of flags indicating the validity of the fields in this data structure. */ + GpsMeasurementFlags flags; + + /** + * Pseudo-random number in the range of [1, 32] + * This is a Mandatory value. + */ + int8_t prn; + + /** + * Time offset at which the measurement was taken in nanoseconds. + * The reference receiver's time is specified by GpsData::clock::time_ns and should be + * interpreted in the same way as indicated by GpsClock::type. + * + * The sign of time_offset_ns is given by the following equation: + * measurement time = GpsClock::time_ns + time_offset_ns + * + * It provides an individual time-stamp for the measurement, and allows sub-nanosecond accuracy. + * This is a Mandatory value. + */ + double time_offset_ns; + + /** + * Per satellite sync state. It represents the current sync state for the associated satellite. + * Based on the sync state, the 'received GPS tow' field should be interpreted accordingly. + * + * This is a Mandatory value. + */ + GpsMeasurementState state; + + /** + * Received GPS Time-of-Week at the measurement time, in nanoseconds. + * The value is relative to the beginning of the current GPS week. + * + * Given the highest sync state that can be achieved, per each satellite, valid range for + * this field can be: + * Searching : [ 0 ] : GPS_MEASUREMENT_STATE_UNKNOWN + * C/A code lock : [ 0 1ms ] : GPS_MEASUREMENT_STATE_CODE_LOCK is set + * Bit sync : [ 0 20ms ] : GPS_MEASUREMENT_STATE_BIT_SYNC is set + * Subframe sync : [ 0 6s ] : GPS_MEASUREMENT_STATE_SUBFRAME_SYNC is set + * TOW decoded : [ 0 1week ] : GPS_MEASUREMENT_STATE_TOW_DECODED is set + * + * However, if there is any ambiguity in integer millisecond, + * GPS_MEASUREMENT_STATE_MSEC_AMBIGUOUS should be set accordingly, in the 'state' field. + * + * This value must be populated if 'state' != GPS_MEASUREMENT_STATE_UNKNOWN. + */ + int64_t received_gps_tow_ns; + + /** + * 1-Sigma uncertainty of the Received GPS Time-of-Week in nanoseconds. + * + * This value must be populated if 'state' != GPS_MEASUREMENT_STATE_UNKNOWN. + */ + int64_t received_gps_tow_uncertainty_ns; + + /** + * Carrier-to-noise density in dB-Hz, in the range [0, 63]. + * It contains the measured C/N0 value for the signal at the antenna input. + * + * This is a Mandatory value. + */ + double c_n0_dbhz; + + /** + * Pseudorange rate at the timestamp in m/s. + * The correction of a given Pseudorange Rate value includes corrections for receiver and + * satellite clock frequency errors. + * + * If GPS_MEASUREMENT_HAS_UNCORRECTED_PSEUDORANGE_RATE is set in 'flags' field, this field must + * be populated with the 'uncorrected' reading. + * If GPS_MEASUREMENT_HAS_UNCORRECTED_PSEUDORANGE_RATE is not set in 'flags' field, this field + * must be populated with the 'corrected' reading. This is the default behavior. + * + * It is encouraged to provide the 'uncorrected' 'pseudorange rate', and provide GpsClock's + * 'drift' field as well. + * + * The value includes the 'pseudorange rate uncertainty' in it. + * A positive 'uncorrected' value indicates that the SV is moving away from the receiver. + * + * The sign of the 'uncorrected' 'pseudorange rate' and its relation to the sign of 'doppler + * shift' is given by the equation: + * pseudorange rate = -k * doppler shift (where k is a constant) + * + * This is a Mandatory value. + */ + double pseudorange_rate_mps; + + /** + * 1-Sigma uncertainty of the pseudurange rate in m/s. + * The uncertainty is represented as an absolute (single sided) value. + * + * This is a Mandatory value. + */ + double pseudorange_rate_uncertainty_mps; + + /** + * Accumulated delta range's state. It indicates whether ADR is reset or there is a cycle slip + * (indicating loss of lock). + * + * This is a Mandatory value. + */ + GpsAccumulatedDeltaRangeState accumulated_delta_range_state; + + /** + * Accumulated delta range since the last channel reset in meters. + * A positive value indicates that the SV is moving away from the receiver. + * + * The sign of the 'accumulated delta range' and its relation to the sign of 'carrier phase' + * is given by the equation: + * accumulated delta range = -k * carrier phase (where k is a constant) + * + * This value must be populated if 'accumulated delta range state' != GPS_ADR_STATE_UNKNOWN. + * However, it is expected that the data is only accurate when: + * 'accumulated delta range state' == GPS_ADR_STATE_VALID. + */ + double accumulated_delta_range_m; + + /** + * 1-Sigma uncertainty of the accumulated delta range in meters. + * This value must be populated if 'accumulated delta range state' != GPS_ADR_STATE_UNKNOWN. + */ + double accumulated_delta_range_uncertainty_m; + + /** + * Best derived Pseudorange by the chip-set, in meters. + * The value contains the 'pseudorange uncertainty' in it. + * + * If the data is available, 'flags' must contain GPS_MEASUREMENT_HAS_PSEUDORANGE. + */ + double pseudorange_m; + + /** + * 1-Sigma uncertainty of the pseudorange in meters. + * The value contains the 'pseudorange' and 'clock' uncertainty in it. + * The uncertainty is represented as an absolute (single sided) value. + * + * If the data is available, 'flags' must contain GPS_MEASUREMENT_HAS_PSEUDORANGE_UNCERTAINTY. + */ + double pseudorange_uncertainty_m; + + /** + * A fraction of the current C/A code cycle, in the range [0.0, 1023.0] + * This value contains the time (in Chip units) since the last C/A code cycle (GPS Msec epoch). + * + * The reference frequency is given by the field 'carrier_frequency_hz'. + * The value contains the 'code-phase uncertainty' in it. + * + * If the data is available, 'flags' must contain GPS_MEASUREMENT_HAS_CODE_PHASE. + */ + double code_phase_chips; + + /** + * 1-Sigma uncertainty of the code-phase, in a fraction of chips. + * The uncertainty is represented as an absolute (single sided) value. + * + * If the data is available, 'flags' must contain GPS_MEASUREMENT_HAS_CODE_PHASE_UNCERTAINTY. + */ + double code_phase_uncertainty_chips; + + /** + * Carrier frequency at which codes and messages are modulated, it can be L1 or L2. + * If the field is not set, the carrier frequency is assumed to be L1. + * + * If the data is available, 'flags' must contain GPS_MEASUREMENT_HAS_CARRIER_FREQUENCY. + */ + float carrier_frequency_hz; + + /** + * The number of full carrier cycles between the satellite and the receiver. + * The reference frequency is given by the field 'carrier_frequency_hz'. + * + * If the data is available, 'flags' must contain GPS_MEASUREMENT_HAS_CARRIER_CYCLES. + */ + int64_t carrier_cycles; + + /** + * The RF phase detected by the receiver, in the range [0.0, 1.0]. + * This is usually the fractional part of the complete carrier phase measurement. + * + * The reference frequency is given by the field 'carrier_frequency_hz'. + * The value contains the 'carrier-phase uncertainty' in it. + * + * If the data is available, 'flags' must contain GPS_MEASUREMENT_HAS_CARRIER_PHASE. + */ + double carrier_phase; + + /** + * 1-Sigma uncertainty of the carrier-phase. + * If the data is available, 'flags' must contain GPS_MEASUREMENT_HAS_CARRIER_PHASE_UNCERTAINTY. + */ + double carrier_phase_uncertainty; + + /** + * An enumeration that indicates the 'loss of lock' state of the event. + */ + GpsLossOfLock loss_of_lock; + + /** + * The number of GPS bits transmitted since Sat-Sun midnight (GPS week). + * If the data is available, 'flags' must contain GPS_MEASUREMENT_HAS_BIT_NUMBER. + */ + int32_t bit_number; + + /** + * The elapsed time since the last received bit in milliseconds, in the range [0, 20] + * If the data is available, 'flags' must contain GPS_MEASUREMENT_HAS_TIME_FROM_LAST_BIT. + */ + int16_t time_from_last_bit_ms; + + /** + * Doppler shift in Hz. + * A positive value indicates that the SV is moving toward the receiver. + * + * The reference frequency is given by the field 'carrier_frequency_hz'. + * The value contains the 'doppler shift uncertainty' in it. + * + * If the data is available, 'flags' must contain GPS_MEASUREMENT_HAS_DOPPLER_SHIFT. + */ + double doppler_shift_hz; + + /** + * 1-Sigma uncertainty of the doppler shift in Hz. + * If the data is available, 'flags' must contain GPS_MEASUREMENT_HAS_DOPPLER_SHIFT_UNCERTAINTY. + */ + double doppler_shift_uncertainty_hz; + + /** + * An enumeration that indicates the 'multipath' state of the event. + */ + GpsMultipathIndicator multipath_indicator; + + /** + * Signal-to-noise ratio in dB. + * If the data is available, 'flags' must contain GPS_MEASUREMENT_HAS_SNR. + */ + double snr_db; + + /** + * Elevation in degrees, the valid range is [-90, 90]. + * The value contains the 'elevation uncertainty' in it. + * If the data is available, 'flags' must contain GPS_MEASUREMENT_HAS_ELEVATION. + */ + double elevation_deg; + + /** + * 1-Sigma uncertainty of the elevation in degrees, the valid range is [0, 90]. + * The uncertainty is represented as the absolute (single sided) value. + * + * If the data is available, 'flags' must contain GPS_MEASUREMENT_HAS_ELEVATION_UNCERTAINTY. + */ + double elevation_uncertainty_deg; + + /** + * Azimuth in degrees, in the range [0, 360). + * The value contains the 'azimuth uncertainty' in it. + * If the data is available, 'flags' must contain GPS_MEASUREMENT_HAS_AZIMUTH. + * */ + double azimuth_deg; + + /** + * 1-Sigma uncertainty of the azimuth in degrees, the valid range is [0, 180]. + * The uncertainty is represented as an absolute (single sided) value. + * + * If the data is available, 'flags' must contain GPS_MEASUREMENT_HAS_AZIMUTH_UNCERTAINTY. + */ + double azimuth_uncertainty_deg; + + /** + * Whether the GPS represented by the measurement was used for computing the most recent fix. + * If the data is available, 'flags' must contain GPS_MEASUREMENT_HAS_USED_IN_FIX. + */ + bool used_in_fix; +} GpsMeasurement; + +/** Represents a reading of GPS measurements. */ +typedef struct { + /** set to sizeof(GpsData) */ + size_t size; + + /** Number of measurements. */ + size_t measurement_count; + + /** The array of measurements. */ + GpsMeasurement measurements[GPS_MAX_MEASUREMENT]; + + /** The GPS clock time reading. */ + GpsClock clock; +} GpsData; + +/** + * The callback for to report measurements from the HAL. + * + * Parameters: + * data - A data structure containing the measurements. + */ +typedef void (*gps_measurement_callback) (GpsData* data); + +typedef struct { + /** set to sizeof(GpsMeasurementCallbacks) */ + size_t size; + gps_measurement_callback measurement_callback; +} GpsMeasurementCallbacks; + +#define GPS_MEASUREMENT_OPERATION_SUCCESS 0 +#define GPS_MEASUREMENT_ERROR_ALREADY_INIT -100 +#define GPS_MEASUREMENT_ERROR_GENERIC -101 + +/** + * Extended interface for GPS Measurements support. + */ +typedef struct { + /** Set to sizeof(GpsMeasurementInterface) */ + size_t size; + + /** + * Initializes the interface and registers the callback routines with the HAL. + * After a successful call to 'init' the HAL must begin to provide updates at its own phase. + * + * Status: + * GPS_MEASUREMENT_OPERATION_SUCCESS + * GPS_MEASUREMENT_ERROR_ALREADY_INIT - if a callback has already been registered without a + * corresponding call to 'close' + * GPS_MEASUREMENT_ERROR_GENERIC - if any other error occurred, it is expected that the HAL + * will not generate any updates upon returning this error code. + */ + int (*init) (GpsMeasurementCallbacks* callbacks); + + /** + * Stops updates from the HAL, and unregisters the callback routines. + * After a call to stop, the previously registered callbacks must be considered invalid by the + * HAL. + * If stop is invoked without a previous 'init', this function should perform no work. + */ + void (*close) (); + +} GpsMeasurementInterface; + + +/** Represents a GPS navigation message (or a fragment of it). */ +typedef struct { + /** set to sizeof(GpsNavigationMessage) */ + size_t size; + + /** + * Pseudo-random number in the range of [1, 32] + * This is a Mandatory value. + */ + int8_t prn; + + /** + * The type of message contained in the structure. + * This is a Mandatory value. + */ + GpsNavigationMessageType type; + + /** + * The status of the received navigation message. + * No need to send any navigation message that contains words with parity error and cannot be + * corrected. + */ + NavigationMessageStatus status; + + /** + * Message identifier. + * It provides an index so the complete Navigation Message can be assembled. i.e. fo L1 C/A + * subframe 4 and 5, this value corresponds to the 'frame id' of the navigation message. + * Subframe 1, 2, 3 does not contain a 'frame id' and this value can be set to -1. + */ + int16_t message_id; + + /** + * Sub-message identifier. + * If required by the message 'type', this value contains a sub-index within the current + * message (or frame) that is being transmitted. + * i.e. for L1 C/A the submessage id corresponds to the sub-frame id of the navigation message. + */ + int16_t submessage_id; + + /** + * The length of the data (in bytes) contained in the current message. + * If this value is different from zero, 'data' must point to an array of the same size. + * e.g. for L1 C/A the size of the sub-frame will be 40 bytes (10 words, 30 bits/word). + * + * This is a Mandatory value. + */ + size_t data_length; + + /** + * The data of the reported GPS message. + * The bytes (or words) specified using big endian format (MSB first). + * + * For L1 C/A, each subframe contains 10 30-bit GPS words. Each GPS word (30 bits) should be + * fitted into the last 30 bits in a 4-byte word (skip B31 and B32), with MSB first. + */ + uint8_t* data; + +} GpsNavigationMessage; + +/** + * The callback to report an available fragment of a GPS navigation messages from the HAL. + * + * Parameters: + * message - The GPS navigation submessage/subframe representation. + */ +typedef void (*gps_navigation_message_callback) (GpsNavigationMessage* message); + +typedef struct { + /** set to sizeof(GpsNavigationMessageCallbacks) */ + size_t size; + gps_navigation_message_callback navigation_message_callback; +} GpsNavigationMessageCallbacks; + +#define GPS_NAVIGATION_MESSAGE_OPERATION_SUCCESS 0 +#define GPS_NAVIGATION_MESSAGE_ERROR_ALREADY_INIT -100 +#define GPS_NAVIGATION_MESSAGE_ERROR_GENERIC -101 + +/** + * Extended interface for GPS navigation message reporting support. + */ +typedef struct { + /** Set to sizeof(GpsNavigationMessageInterface) */ + size_t size; + + /** + * Initializes the interface and registers the callback routines with the HAL. + * After a successful call to 'init' the HAL must begin to provide updates as they become + * available. + * + * Status: + * GPS_NAVIGATION_MESSAGE_OPERATION_SUCCESS + * GPS_NAVIGATION_MESSAGE_ERROR_ALREADY_INIT - if a callback has already been registered + * without a corresponding call to 'close'. + * GPS_NAVIGATION_MESSAGE_ERROR_GENERIC - if any other error occurred, it is expected that + * the HAL will not generate any updates upon returning this error code. + */ + int (*init) (GpsNavigationMessageCallbacks* callbacks); + + /** + * Stops updates from the HAL, and unregisters the callback routines. + * After a call to stop, the previously registered callbacks must be considered invalid by the + * HAL. + * If stop is invoked without a previous 'init', this function should perform no work. + */ + void (*close) (); + +} GpsNavigationMessageInterface; + +/** + * Interface for passing GNSS configuration contents from platform to HAL. + */ +typedef struct { + /** Set to sizeof(GnssConfigurationInterface) */ + size_t size; + + /** + * Deliver GNSS configuration contents to HAL. + * Parameters: + * config_data - a pointer to a char array which holds what usually is expected from + file(/etc/gps.conf), i.e., a sequence of UTF8 strings separated by '\n'. + * length - total number of UTF8 characters in configuraiton data. + * + * IMPORTANT: + * GPS HAL should expect this function can be called multiple times. And it may be + * called even when GpsLocationProvider is already constructed and enabled. GPS HAL + * should maintain the existing requests for various callback regardless the change + * in configuration data. + */ + void (*configuration_update) (const char* config_data, int32_t length); +} GnssConfigurationInterface; + +__END_DECLS + +#endif /* ANDROID_INCLUDE_HARDWARE_GPS_H */ diff --git a/n7100.mk b/n7100.mk index 1fdd123..e0908f6 100644 --- a/n7100.mk +++ b/n7100.mk @@ -41,7 +41,8 @@ PRODUCT_PACKAGES += \ # Gps PRODUCT_COPY_FILES += \ - $(LOCAL_PATH)/configs/gps.xml:system/etc/gps.xml + $(LOCAL_PATH)/configs/gps.xml:system/etc/gps.xml \ + $(LOCAL_PATH)/gps_daemon.sh:system/bin/gps_daemon.sh # Product specific Packages PRODUCT_PACKAGES += \ diff --git a/rootdir/init.target.rc b/rootdir/init.target.rc index a7431d2..47987e7 100644 --- a/rootdir/init.target.rc +++ b/rootdir/init.target.rc @@ -55,4 +55,4 @@ service gps-daemon /system/bin/sh /system/bin/gps_daemon.sh user gps group system inet sdcard_rw gps ioprio be 0 - seclabel u:r:glgps:s0 + seclabel u:r:gpsd:s0 -- cgit v1.1 From a1ddda15ae35cce424867e16c81190cca6bea907 Mon Sep 17 00:00:00 2001 From: Dmitry Grinberg Date: Wed, 9 Dec 2015 20:14:56 +0100 Subject: GPS "hacks" from Manta --- libdmitry/Android.mk | 26 +++++++ libdmitry/libdmitry.c | 207 ++++++++++++++++++++++++++++++++++++++++++++++++++ n7100.mk | 5 +- 3 files changed, 236 insertions(+), 2 deletions(-) create mode 100755 libdmitry/Android.mk create mode 100755 libdmitry/libdmitry.c diff --git a/libdmitry/Android.mk b/libdmitry/Android.mk new file mode 100755 index 0000000..5457c8b --- /dev/null +++ b/libdmitry/Android.mk @@ -0,0 +1,26 @@ +# Copyright (C) 2015 The Android Open Source Project +# Written by Dmitry Grinberg +# +# 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) + + +include $(CLEAR_VARS) + +LOCAL_SHARED_LIBRARIES := liblog libcutils libgui libbinder libutils +LOCAL_SRC_FILES := libdmitry.c +LOCAL_MODULE := libdmitry +LOCAL_MODULE_TAGS := optional +include $(BUILD_SHARED_LIBRARY) \ No newline at end of file diff --git a/libdmitry/libdmitry.c b/libdmitry/libdmitry.c new file mode 100755 index 0000000..6472263 --- /dev/null +++ b/libdmitry/libdmitry.c @@ -0,0 +1,207 @@ +#define LOG_TAG "libdmitry" +#include +#include +#include +#include +#include +#include +#include + +/* + * CURIOUS WHAT THE HELL IS GOING ON IN HERE? READ UP... + * + * + * Problems: + * 1. Nexus 10's GPS library was made to work with android L + * 2. Android M changed a few things around that make it not work + * a. Sensor manager API changed in a few places + * b. BoringSSL replaced OpenSSL + * 3. Due to these now-missing unresolved symbols GPS library will not load or run + * + * Curious data snippets + * Due to peculiarities of the ELF format, when a binary baz imports function foo() from libbar.so, + * nowhere in baz's ELF file does it say that foo() must from from libbar. In fact there are two + * separate records. One that says that libbar is "NEED"ed, and another that says that there is an + * import of function "foo". What that means is that if the process wer to also load libxyz, which + * also exported foo(), there is no way to be sure which foo() would get called. Why do we care? + * Well, consider out problems above. We need to provide functions and variables that existing + * libraries no longer do. How? + * + * A tricky but clever solution: INTERPOSITION library + * 1. We'll edit the GPS library and replace one of its "NEED" record with one referencing a new library + * which we'll create. Need a library name? why not "lidmitry"? + * 2. Make sure that lidmitry's NEED records include the library whose record we replaced in the GPS + * library, to make sure that the linker brings it in afterall and all symbols in it are found + * 3. Implement libdmitry such that it provides the missing things and does them in such a way that the + * GPS library is happy. + * 4. Complications exist: + * a. This would be impossible to do in C++, as the compiler would barf at us implementing random + * chunks of random classes we do not control. Luckily, the linker has no idea about C++, C, or other + * such things. C++ names get converted to special symbol names by the compiler, and thus the linker + * is neevr even aware of overloading or such things. This process is called mangling. So we'll just + * export the C++ functions we need with the proper mangled names, and code them in C. This means + * that we need to follow the proper calling conventions by hand, etc. With some dissasembling to see + * how GCC does it, we can duplicate it here, as I did. + * b. Not all missing things are functions. There are a few variables that need to be exported and are + * not present in M's code. We have to provide them. Luckily, just like with functions, as long as our + * mandled name matches, the linker will be happy to make the connection for us. + * c. Some cleanup may be needed on exit. Luckily, there is a way to register functions to be called + * upon library load and unload. I use that here to free some state that may be left over on exit. + * + * Result: GPS library works on M, with the help of libdmitry and a small binary patch to the GPS + * library itself (replacing one of the "NEED" records with a NEED record for "libdmitry" + */ + + + + + + + +//various funcs we'll need to call, in their mangled form + + //android::String8::String8(char const*) + extern void _ZN7android7String8C1EPKc(void **str8P, const char *str); + + //android::String8::~String8() + extern void _ZN7android7String8D1Ev(void **str8P); + + //android::String16::String16(char const*) + extern void _ZN7android8String16C1EPKc(void **str16P, const char *str); + + //android::String16::~String16() + extern void _ZN7android8String16D1Ev(void **str16P); + + //android::SensorManager::~SensorManager() + extern void _ZN7android13SensorManagerD1Ev(void *sensorMgr); + + //android::SensorManager::SensorManager(android::String16 const&) + extern void _ZN7android13SensorManagerC1ERKNS_8String16E(void *sensorMgr, void **str16P); + + //android::SensorManager::createEventQueue(android::String8, int) + extern void _ZN7android13SensorManager16createEventQueueENS_7String8Ei(void **retVal, void *sensorMgr, void **str8P, int mode); + + +//data exports we must provide for gps library to be happy + + /* + * DATA: android::Singleton::sLock + * USE: INTERPOSE: a mutes that GPS lib will insist on accessing + * NOTES: In L, the sensor manager exposed this lock that callers + * actually locked & unlocked when accessing it. In M this + * is no longer the case, but we still must provide it for + * the GPS library to be happy. It will lock nothnhing, but + * as long as it is a real lock and pthread_mutex_* funcs + * work on it, the GPS library will be happy. + */ + pthread_mutex_t _ZN7android9SingletonINS_13SensorManagerEE5sLockE = PTHREAD_MUTEX_INITIALIZER; + + /* + * DATA: android::Singleton::sInstance + * USE: INTERPOSE: a singleton instance of SensorManager + * NOTES: In L, the sensor manager exposed this variable, as it was + * a singleton and one could just access this directly to get + * the current already-existing instance if it happened to + * already exist. If not one would create one and store it + * there. In M this is entirely different, but the GPS library + * does not know that. So we'll init it to NULL to signify that + * no current instance exists, let it create one, and store it + * here, and upon unloading we'll clean it up, if it is not + * NULL (which is what it would be if the GPS library itself + * did the cleanup). + */ + void* _ZN7android9SingletonINS_13SensorManagerEE9sInstanceE = NULL; + + +//code exports we provide + + //android::SensorManager::SensorManager(void) + void _ZN7android13SensorManagerC1Ev(void *sensorMgr); + + //android::SensorManager::createEventQueue(void) + void _ZN7android13SensorManager16createEventQueueEv(void **retVal, void *sensorMgr); + + //this used to exist in OpenSLL, but does not in BoringSSL - for some reason GPS library uses it anyways + void *CRYPTO_malloc(uint32_t sz, const char *file, uint32_t line); + + +//library on-load and on-unload handlers (to help us set things up and tear them down) + void libEvtLoading(void) __attribute__((constructor)); + void libEvtUnloading(void) __attribute__((destructor)); + + +/* + * FUNCTION: android::SensorManager::SensorManager(void) + * USE: INTERPOSE: construct a sensor manager object + * NOTES: This constructor no longer exists in M, instead now one must pass + * in a package name as a "string16" to the consrtuctor. Since this + * lib only services GPS library, it is easy for us to just do that + * and this provide the constructor that the GPS library wants. + * The package name we use if "gps.default". Why not? + */ +void _ZN7android13SensorManagerC1Ev(void *sensorMgr) +{ + void *string; + + _ZN7android8String16C1EPKc(&string, "gps.default"); + _ZN7android13SensorManagerC1ERKNS_8String16E(sensorMgr, &string); + _ZN7android8String16D1Ev(&string); +} + +/* + * FUNCTION: android::SensorManager::createEventQueue(void) + * USE: INTERPOSE: create an event queue to receive events + * NOTES: This function no longer exists in M, instead now one must pass + * in a client name as a "string8" and an integer "mode"to it. M + * sources list default values for these params as an empty string + * and 0. So we'll craft the same call here. + */ +void _ZN7android13SensorManager16createEventQueueEv(void **retVal, void *sensorMgr) +{ + void *string; + + _ZN7android7String8C1EPKc(&string, ""); + _ZN7android13SensorManager16createEventQueueENS_7String8Ei(retVal, sensorMgr, &string, 0); + _ZN7android7String8D1Ev(&string); +} + +/* + * FUNCTION: CRYPTO_malloc(uint32_t sz, const char *file, uint32_t line) + * USE: INTERPOSE: Allocate memory + * NOTES: In OpenSSL, this just allocates memory and optionally tracks it. + * Why manta's GPS library chose to use it is a mystery, but to make + * it happy we must provide it, so we do, backing the allocation with + * a calloc()-ed memory chunk. + */ +void *CRYPTO_malloc(uint32_t sz, const char *file, uint32_t line) +{ + (void)file; + (void)line; + return calloc(sz, 1); +} + +/* + * FUNCTION: libEvtLoading() + * USE: Handle library loading + * NOTES: This is a good time to log the fact that we were loaded and plan to + * do our thing. + */ +void libEvtLoading(void) +{ + ALOGI("Nexus 10 GPS interposition library loaded. Your GPS should work in M now."); +} + +/* + * FUNCTION: libEvtUnloading() + * USE: Handle library unloading + * NOTES: This is a good time to free whatever is unfreed and say goodbye + */ +void libEvtUnloading(void) +{ + ALOGI("Nexus 10 GPS interposition library unloading. Goodbye..."); + if (_ZN7android9SingletonINS_13SensorManagerEE9sInstanceE) { + //if an instance stil exists, free it by calling the destructor, just to be throrough + _ZN7android13SensorManagerD1Ev(_ZN7android9SingletonINS_13SensorManagerEE9sInstanceE); + _ZN7android9SingletonINS_13SensorManagerEE9sInstanceE = NULL; + } +} \ No newline at end of file diff --git a/n7100.mk b/n7100.mk index e0908f6..1ba7a50 100644 --- a/n7100.mk +++ b/n7100.mk @@ -49,9 +49,10 @@ PRODUCT_PACKAGES += \ DeviceSettings \ SamsungServiceMode -# RIL +# RIL & GPS fix PRODUCT_PACKAGES += \ - ril-wrapper + ril-wrapper \ + libdmitry # Additional apps PRODUCT_PACKAGES += \ -- cgit v1.1 From 537a053eafb489042077d08b0a33e12ba6a27248 Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Wed, 23 Dec 2015 10:26:19 +0530 Subject: n7100: selinux fixes for gpsd --- selinux/gpsd.te | 8 -------- 1 file changed, 8 deletions(-) diff --git a/selinux/gpsd.te b/selinux/gpsd.te index 4aa2b04..6c54563 100644 --- a/selinux/gpsd.te +++ b/selinux/gpsd.te @@ -1,15 +1,7 @@ -type gpsd, domain; -type gpsd_exec, exec_type, file_type; - -init_daemon_domain(gpsd) - -allow gpsd shell_exec:file { rx_file_perms entrypoint }; - #for text relocs & execution allow gpsd system_file:file { execute_no_trans execmod }; allow gpsd gps_device:chr_file { getattr setattr }; allow gpsd gps_data_file:dir { search write add_name remove_name }; -allow gpsd gps_data_file:file { create rw_file_perms }; allow gpsd gps_data_file:fifo_file { unlink create setattr getattr rw_file_perms }; allow gpsd node:udp_socket { node_bind name_bind }; -- cgit v1.1 From 60bcfe87ae32193e8745884774a8d13e17b15010 Mon Sep 17 00:00:00 2001 From: Simon Shields Date: Wed, 23 Dec 2015 07:52:30 +1100 Subject: n7100: use synchronous setsurface Change-Id: I715cbce3f4387bb557a9ddd2ec23deebc1b1d7ec --- BoardConfig.mk | 3 +++ 1 file changed, 3 insertions(+) diff --git a/BoardConfig.mk b/BoardConfig.mk index 0def1df..6f8e791 100644 --- a/BoardConfig.mk +++ b/BoardConfig.mk @@ -26,6 +26,9 @@ BOARD_RIL_CLASS := ../../../hardware/samsung/ril TARGET_SPECIFIC_HEADER_PATH := device/samsung/n7100/include COMMON_GLOBAL_CFLAGS += -DDISABLE_ASHMEM_TRACKING +# Graphics +TARGET_REQUIRES_SYNCHRONOUS_SETSURFACE := true + # Bluetooth BOARD_BLUETOOTH_BDROID_BUILDCFG_INCLUDE_DIR := device/samsung/n7100/bluetooth -- cgit v1.1 From e66c789478f845e745186547283578b5a8e320a7 Mon Sep 17 00:00:00 2001 From: Simon Shields Date: Wed, 16 Dec 2015 14:08:40 +1100 Subject: n7100: enable dlmalloc Change-Id: I492e1974e0e1a1c0e70467e30190908909b60451 --- BoardConfig.mk | 3 +++ 1 file changed, 3 insertions(+) diff --git a/BoardConfig.mk b/BoardConfig.mk index 6f8e791..87b84ae 100644 --- a/BoardConfig.mk +++ b/BoardConfig.mk @@ -19,6 +19,9 @@ -include device/samsung/smdk4412-common/BoardCommonConfig.mk +# Bionic +MALLOC_IMPL := dlmalloc + # RIL BOARD_PROVIDES_LIBRIL := true BOARD_MODEM_TYPE := xmm6262 -- cgit v1.1 From f0cbeda3b75eb0e8d4aeafd977c496e0c8701275 Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Thu, 24 Dec 2015 19:37:35 +0530 Subject: n7100: add GPS interposition library --- rootdir/init.target.rc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rootdir/init.target.rc b/rootdir/init.target.rc index 47987e7..e5514c6 100644 --- a/rootdir/init.target.rc +++ b/rootdir/init.target.rc @@ -1,5 +1,5 @@ on init - export LD_SHIM_LIBS /system/lib/libsec-ril.so|libsamsung_symbols.so + export LD_SHIM_LIBS /system/lib/libsec-ril.so|libsamsung_symbols.so:/system/bin/gpsd|libdmitry.so # Vibetonz export VIBE_PIPE_PATH /dev/pipes mkdir /dev/pipes 0771 shell shell -- cgit v1.1 From cb1b372d7c1f23afeb98406192b4db349f316424 Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Thu, 24 Dec 2015 21:20:13 +0530 Subject: n7100: more gps updates --- rootdir/init.target.rc | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/rootdir/init.target.rc b/rootdir/init.target.rc index e5514c6..f346d40 100644 --- a/rootdir/init.target.rc +++ b/rootdir/init.target.rc @@ -14,21 +14,6 @@ on post-fs-data # Restorecon restorecon_recursive /efs -# GPS init - mkdir /data/gps - chown gps system /data/gps - chmod 770 /data/gps - write /sys/class/sec/gps/GPS_PWR_EN/export 162 - write /sys/class/sec/gps/GPS_PWR_EN/value 0 - write /sys/class/sec/gps/GPS_PWR_EN/direction out - chown gps system /sys/class/sec/gps/GPS_PWR_EN/value - chmod 0664 /sys/class/sec/gps/GPS_PWR_EN/value - chown gps system /dev/ttySAC1 - chmod 0660 /dev/ttySAC1 - restorecon /sys/class/sec/gps/export - restorecon /sys/class/sec/gps/GPS_PWR_EN/value - restorecon /sys/class/sec/gps/GPS_PWR_EN/direction - # SensorHub chown system radio /sys/class/sensors/ssp_sensor/enable chown system radio /sys/class/sensors/ssp_sensor/mcu_rev @@ -55,4 +40,3 @@ service gps-daemon /system/bin/sh /system/bin/gps_daemon.sh user gps group system inet sdcard_rw gps ioprio be 0 - seclabel u:r:gpsd:s0 -- cgit v1.1 From 9fbc0eaddbd1d8dfff88c88b3cd2526d4ada859f Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Mon, 28 Dec 2015 20:25:10 +0530 Subject: n7100: update proprietary files --- proprietary-files.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proprietary-files.txt b/proprietary-files.txt index 9fa7cab..dbbb5cf 100644 --- a/proprietary-files.txt +++ b/proprietary-files.txt @@ -1,5 +1,5 @@ system/bin/gpsd -system/lib/hw/gps.exynos4.so +system/lib/hw/gps.default.so system/lib/libakm.so system/lib/libsec-ril.so system/usr/idc/sec_e-pen.idc -- cgit v1.1 From 231cbe91547eba50269ef8921ecdc0356098eb1b Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Mon, 28 Dec 2015 20:27:32 +0530 Subject: n7100: clean up radio access families --- overlay/frameworks/base/core/res/res/values/config.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/overlay/frameworks/base/core/res/res/values/config.xml b/overlay/frameworks/base/core/res/res/values/config.xml index 2a02651..4ed5863 100644 --- a/overlay/frameworks/base/core/res/res/values/config.xml +++ b/overlay/frameworks/base/core/res/res/values/config.xml @@ -321,5 +321,5 @@ don't support RIL_REQUEST_GET_RADIO_CAPABILITY format is UMTS|LTE|... --> - GPRS|EDGE|UMTS|HSDPA|HSUPA|HSPAP|GSM|WCDMA + GPRS|EDGE|WCDMA -- cgit v1.1 From 559a7ad0a443510916fa676b4da04d310b74be99 Mon Sep 17 00:00:00 2001 From: Simon Shields Date: Sat, 12 Dec 2015 18:12:16 +1100 Subject: n7100: ril-wrapper: fake GET_RADIO_CAPABILITY response Samsung's RIL doesn't support this, but doesn't error on it either. Change-Id: I5a470c55fecf85183e9c7b4b37aef3b3cbffaf90 --- ril-wrapper/ril-wrapper.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/ril-wrapper/ril-wrapper.c b/ril-wrapper/ril-wrapper.c index 8371870..886cb34 100644 --- a/ril-wrapper/ril-wrapper.c +++ b/ril-wrapper/ril-wrapper.c @@ -28,6 +28,18 @@ static RIL_RadioFunctions const *mRealRadioFuncs; static const struct RIL_Env *mEnv; +static void rilOnRequest(int request, void *data, size_t datalen, RIL_Token t) +{ + switch (request) { + case RIL_REQUEST_GET_RADIO_CAPABILITY: + RLOGW("Returning NOT_SUPPORTED on GET_RADIO_CAPABILITY"); + mEnv->OnRequestComplete(t, RIL_E_REQUEST_NOT_SUPPORTED, NULL, 0); + break; + default: + mRealRadioFuncs->onRequest(request, data, datalen, t); + } +} + const RIL_RadioFunctions* RIL_Init(const struct RIL_Env *env, int argc, char **argv) { RIL_RadioFunctions const* (*fRealRilInit)(const struct RIL_Env *env, int argc, char **argv); @@ -74,6 +86,7 @@ const RIL_RadioFunctions* RIL_Init(const struct RIL_Env *env, int argc, char **a //copy the real RIL's info struct, then replace the onRequest pointer with our own rilInfo = *mRealRadioFuncs; + rilInfo.onRequest = rilOnRequest; RLOGD("Wrapped RIL version is '%s'\n", mRealRadioFuncs->getVersion()); -- cgit v1.1 From 2f50aff55cb13253b204f831adfd3ca0ddb347e0 Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Mon, 28 Dec 2015 20:39:30 +0530 Subject: n7100: use samsung power hal credits to raymanfx --- BoardConfig.mk | 3 +++ 1 file changed, 3 insertions(+) diff --git a/BoardConfig.mk b/BoardConfig.mk index 87b84ae..1ad696e 100644 --- a/BoardConfig.mk +++ b/BoardConfig.mk @@ -39,6 +39,9 @@ BOARD_BLUETOOTH_BDROID_BUILDCFG_INCLUDE_DIR := device/samsung/n7100/bluetooth TARGET_KERNEL_SOURCE := kernel/samsung/smdk4412 TARGET_KERNEL_CONFIG := cyanogenmod_n7100_defconfig +# Power HAL +TARGET_POWERHAL_VARIANT := samsung + # assert TARGET_OTA_ASSERT_DEVICE := t03g,n7100,GT-N7100 -- cgit v1.1 From 7f47f667594e473ef64de90761372dc864727d59 Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Thu, 7 Jan 2016 01:09:34 +0530 Subject: n7100: add HardWare keys overlay --- overlay/frameworks/base/core/res/res/values/config.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/overlay/frameworks/base/core/res/res/values/config.xml b/overlay/frameworks/base/core/res/res/values/config.xml index 4ed5863..0b1edc7 100644 --- a/overlay/frameworks/base/core/res/res/values/config.xml +++ b/overlay/frameworks/base/core/res/res/values/config.xml @@ -322,4 +322,7 @@ format is UMTS|LTE|... --> GPRS|EDGE|WCDMA + + + true -- cgit v1.1 From 33be51214fdc66f10a8b59bc120b3e4d8c83da87 Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Sat, 9 Jan 2016 13:04:05 +0530 Subject: n7100: add Snap camera app --- n7100.mk | 3 ++- overlay/packages/apps/Snap/res/values/config.xml | 30 ++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 overlay/packages/apps/Snap/res/values/config.xml diff --git a/n7100.mk b/n7100.mk index 1ba7a50..84ab3e6 100644 --- a/n7100.mk +++ b/n7100.mk @@ -37,7 +37,8 @@ PRODUCT_COPY_FILES += \ # Camera PRODUCT_PACKAGES += \ - camera.smdk4x12 + camera.smdk4x12 \ + Snap # Gps PRODUCT_COPY_FILES += \ diff --git a/overlay/packages/apps/Snap/res/values/config.xml b/overlay/packages/apps/Snap/res/values/config.xml new file mode 100644 index 0000000..94fbba0 --- /dev/null +++ b/overlay/packages/apps/Snap/res/values/config.xml @@ -0,0 +1,30 @@ + + + + + + + true + + + true + + + false + + + false + + -- cgit v1.1 From b1f78f793df8d1de150880aeb57c09462132ba98 Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Wed, 27 Jan 2016 10:36:51 +0530 Subject: n7100: build busybox --- n7100.mk | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/n7100.mk b/n7100.mk index 84ab3e6..046fe7b 100644 --- a/n7100.mk +++ b/n7100.mk @@ -40,6 +40,10 @@ PRODUCT_PACKAGES += \ camera.smdk4x12 \ Snap +# Busybox +PRODUCT_PACKAGES += \ + busybox + # Gps PRODUCT_COPY_FILES += \ $(LOCAL_PATH)/configs/gps.xml:system/etc/gps.xml \ -- cgit v1.1 From efd363083ba3438d4b832f64a381d915b341402e Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Mon, 8 Feb 2016 09:49:42 +0530 Subject: Bring back "n7100: set mQANelements through property" This reverts commit 0e9b644abbaf2040615c78761f686ef8d39ee5ba. --- system.prop | 1 + 1 file changed, 1 insertion(+) diff --git a/system.prop b/system.prop index db6bcfd..975f696 100644 --- a/system.prop +++ b/system.prop @@ -5,5 +5,6 @@ dalvik.vm.dexopt-data-only=1 rild.libpath=/system/lib/ril-wrapper.so rild.libargs=-d /dev/ttyS0 +ro.ril.telephony.mqanelements=5 ro.sf.lcd_density=320 ro.lcd_min_brightness=20 -- cgit v1.1 From 5aa39b897bc644c2547464062aba03fc78236050 Mon Sep 17 00:00:00 2001 From: Simon Shields Date: Thu, 11 Feb 2016 23:42:52 +1100 Subject: n7100: allow system_server access to mdnie sysfs needed for any mdnie stuff that ends up in cmhw Change-Id: I6efe58e295cae59f074abc4a1fd64258fb5d8188 --- selinux/system_server.te | 3 +++ 1 file changed, 3 insertions(+) diff --git a/selinux/system_server.te b/selinux/system_server.te index 31db12d..8990426 100644 --- a/selinux/system_server.te +++ b/selinux/system_server.te @@ -4,6 +4,9 @@ allow system_server sensors_data_file:file r_file_perms; allow system_server wpa_socket:unix_dgram_socket sendto; allow system_server sysfs:file { read open write }; +allow system_server sysfs_display:lnk_file rw_file_perms; +allow system_server sysfs_display:dir rw_dir_perms; +allow system_server sysfs_display:file rw_file_perms; allow system_server self:capability { sys_module }; allow system_server efs_file:dir search; -- cgit v1.1 From 4931fb3baaabe2a3c57969555a11e98c99977254 Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Fri, 12 Feb 2016 11:47:29 +0530 Subject: n7100: enable call recording moved to vendor/cm - true --- overlay/packages/apps/Dialer/res/values/config.xml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 overlay/packages/apps/Dialer/res/values/config.xml diff --git a/overlay/packages/apps/Dialer/res/values/config.xml b/overlay/packages/apps/Dialer/res/values/config.xml new file mode 100644 index 0000000..b1c5a94 --- /dev/null +++ b/overlay/packages/apps/Dialer/res/values/config.xml @@ -0,0 +1,16 @@ + + + + 4 + -- cgit v1.1 From 7105cb10014b1e193a6894b3b131ffbf024086ba Mon Sep 17 00:00:00 2001 From: Simon Shields Date: Tue, 9 Feb 2016 12:23:15 +1100 Subject: n7100: move macloader and tinyplay sepolicy up to -common [2/2] Change-Id: I874a9f2f6590755e5815e18bcdc5d1e0cdac4523 --- selinux/file_contexts | 2 -- selinux/init.te | 2 -- selinux/macloader.te | 9 --------- selinux/tinyplay.te | 6 ------ 4 files changed, 19 deletions(-) delete mode 100644 selinux/macloader.te delete mode 100644 selinux/tinyplay.te diff --git a/selinux/file_contexts b/selinux/file_contexts index 988ef9a..fc824b3 100644 --- a/selinux/file_contexts +++ b/selinux/file_contexts @@ -61,5 +61,3 @@ # Misc /dev/HPD u:object_r:hpd_device:s0 -/system/bin/macloader u:object_r:macloader_exec:s0 -/system/bin/tinyplay u:object_r:tinyplay_exec:s0 diff --git a/selinux/init.te b/selinux/init.te index b4c11fb..c7393a9 100644 --- a/selinux/init.te +++ b/selinux/init.te @@ -11,5 +11,3 @@ allow init rild:process noatsecure; domain_trans(init, rootfs, gpsd) domain_trans(init, rootfs, cpboot-daemon) -domain_trans(init, rootfs, tinyplay) -domain_trans(init, rootfs, macloader) diff --git a/selinux/macloader.te b/selinux/macloader.te deleted file mode 100644 index 464f201..0000000 --- a/selinux/macloader.te +++ /dev/null @@ -1,9 +0,0 @@ -type macloader, domain; -type macloader_exec, exec_type, file_type; -init_daemon_domain(macloader); - -allow macloader efs_file:dir search; -allow macloader efs_device_file:dir search; -allow macloader wifi_data_file:file { read getattr open write setattr }; -allow macloader self:capability { dac_override chown fowner fsetid }; -allow macloader system_data_file:dir w_dir_perms; diff --git a/selinux/tinyplay.te b/selinux/tinyplay.te deleted file mode 100644 index ef7de81..0000000 --- a/selinux/tinyplay.te +++ /dev/null @@ -1,6 +0,0 @@ -type tinyplay, domain; -type tinyplay_exec, exec_type, file_type; -init_daemon_domain(tinyplay) - -allow tinyplay audio_device:chr_file { open read write ioctl }; -allow tinyplay audio_device:dir search; -- cgit v1.1 From 6607c3cb9193e88ee95f56581567996bf45dfe90 Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Mon, 15 Feb 2016 11:23:56 +0530 Subject: Revert "n7100: add Snap camera app" - Move to smdk common tree This reverts commit 33be51214fdc66f10a8b59bc120b3e4d8c83da87. --- n7100.mk | 3 +-- overlay/packages/apps/Snap/res/values/config.xml | 30 ------------------------ 2 files changed, 1 insertion(+), 32 deletions(-) delete mode 100644 overlay/packages/apps/Snap/res/values/config.xml diff --git a/n7100.mk b/n7100.mk index 046fe7b..b5a58f2 100644 --- a/n7100.mk +++ b/n7100.mk @@ -37,8 +37,7 @@ PRODUCT_COPY_FILES += \ # Camera PRODUCT_PACKAGES += \ - camera.smdk4x12 \ - Snap + camera.smdk4x12 # Busybox PRODUCT_PACKAGES += \ diff --git a/overlay/packages/apps/Snap/res/values/config.xml b/overlay/packages/apps/Snap/res/values/config.xml deleted file mode 100644 index 94fbba0..0000000 --- a/overlay/packages/apps/Snap/res/values/config.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - true - - - true - - - false - - - false - - -- cgit v1.1 From 6abc9568f502202ade50834eed25fe180f4a47bf Mon Sep 17 00:00:00 2001 From: Simon Shields Date: Mon, 15 Feb 2016 23:17:39 +1100 Subject: n7100: mqanelements should actually be 4 fixes manual network selection Change-Id: I516917a816a202020d41b8621d7ea07464c73f1f --- system.prop | 1 - 1 file changed, 1 deletion(-) diff --git a/system.prop b/system.prop index 975f696..db6bcfd 100644 --- a/system.prop +++ b/system.prop @@ -5,6 +5,5 @@ dalvik.vm.dexopt-data-only=1 rild.libpath=/system/lib/ril-wrapper.so rild.libargs=-d /dev/ttyS0 -ro.ril.telephony.mqanelements=5 ro.sf.lcd_density=320 ro.lcd_min_brightness=20 -- cgit v1.1 From dd71a91945087a2f33b55cd1545a1ad1bb22b39a Mon Sep 17 00:00:00 2001 From: tilaksidduram Date: Wed, 17 Feb 2016 10:33:54 +0530 Subject: bacon: Disable doze and app standby These are poor workarounds to a deeper issue in Android. Currently, these features interfere significantly with UX and apps' abilities to provide push notifications (e.g. Gmail does not receive emails in a timely manner), so it's better to have them disabled. added a framework and setting commit(by sultanxda) to allow users to disable doze power save mode on the go. Toggle switch is under developer options. --- overlay/frameworks/base/core/res/res/values/config.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/overlay/frameworks/base/core/res/res/values/config.xml b/overlay/frameworks/base/core/res/res/values/config.xml index 0b1edc7..a7d29bc 100644 --- a/overlay/frameworks/base/core/res/res/values/config.xml +++ b/overlay/frameworks/base/core/res/res/values/config.xml @@ -313,8 +313,8 @@ false - - true + true + + + true -- cgit v1.1 From d41c859a0678da88519a27560e75983c750155c0 Mon Sep 17 00:00:00 2001 From: "Jan M. Binder" Date: Sat, 30 Jan 2016 01:38:24 +0100 Subject: Some apps like PressureNet need this permission file to work --- n7100.mk | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/n7100.mk b/n7100.mk index e1a6ab7..8dcb371 100644 --- a/n7100.mk +++ b/n7100.mk @@ -117,6 +117,10 @@ PRODUCT_COPY_FILES += \ frameworks/native/data/etc/handheld_core_hardware.xml:system/etc/permissions/handheld_core_hardware.xml \ frameworks/native/data/etc/android.hardware.telephony.gsm.xml:system/etc/permissions/android.hardware.telephony.gsm.xml +# Barometer +PRODUCT_COPY_FILES += \ + frameworks/native/data/etc/android.hardware.sensor.barometer.xml:system/etc/permissions/android.hardware.sensor.barometer.xml + # Allow tethering without provisioning app PRODUCT_PROPERTY_OVERRIDES += \ net.tethering.noprovisioning=true -- cgit v1.1