diff options
35 files changed, 2566 insertions, 271 deletions
diff --git a/BoardCommonConfig.mk b/BoardCommonConfig.mk index 63042df..8a9b254 100644 --- a/BoardCommonConfig.mk +++ b/BoardCommonConfig.mk @@ -18,7 +18,9 @@ # This variable is set first, so it can be overridden # by BoardConfigVendor.mk BOARD_USES_GENERIC_AUDIO := false - +BOARD_USE_SAMSUNG_COLORFORMAT := true +USE_SAMSUNG_COLORFORMAT := true +BOARD_USES_LEGACY_MMAP := true TARGET_CPU_ABI := armeabi-v7a TARGET_CPU_ABI2 := armeabi TARGET_CPU_SMP := true @@ -56,6 +58,9 @@ BOARD_KERNEL_PAGESIZE := 4096 BOARD_KERNEL_BASE := 0x40000000 BOARD_KERNEL_CMDLINE := console=ttySAC2,115200 consoleblank=0 +# Include an expanded selection of fonts +EXTENDED_FONT_FOOTPRINT := true + # Filesystem TARGET_USERIMAGES_USE_EXT4 := true BOARD_BOOTIMAGE_PARTITION_SIZE := 8388608 @@ -72,6 +77,9 @@ BOARD_HARDWARE_CLASS := hardware/samsung/cmhw # Graphics BOARD_EGL_CFG := device/samsung/galaxys2-common/configs/egl.cfg +BOARD_EGL_NEEDS_FNW := true +BOARD_EGL_SKIP_FIRST_DEQUEUE := true +BOARD_EGL_SYSTEMUI_PBSIZE_HACK := true USE_OPENGL_RENDERER := true COMMON_GLOBAL_CFLAGS += -DFORCE_SCREENSHOT_CPU_PATH -DWORKAROUND_BUG_10194508 @@ -92,6 +100,8 @@ BOARD_NONBLOCK_MODE_PROCESS := true BOARD_USE_STOREMETADATA := true BOARD_USE_METADATABUFFERTYPE := true BOARD_USES_MFC_FPS := true +BOARD_USE_S3D_SUPPORT := true +BOARD_USE_CSC_FIMC := false # Audio BOARD_USE_TINYALSA_AUDIO := true @@ -100,6 +110,7 @@ BOARD_USE_YAMAHA_MC1N2_AUDIO := true # RIL BOARD_PROVIDES_LIBRIL := true BOARD_MODEM_TYPE := xmm6260 +BOARD_RIL_CLASS := ../../../device/samsung/galaxys2-common/ril # Camera BOARD_USES_PROPRIETARY_LIBFIMC := true @@ -129,6 +140,7 @@ BOARD_HAVE_SAMSUNG_WIFI := true # Bluetooth BOARD_HAVE_BLUETOOTH := true BOARD_HAVE_BLUETOOTH_BCM := true +BOARD_HAVE_SAMSUNG_BLUETOOTH := true BOARD_BLUEDROID_VENDOR_CONF := device/samsung/galaxys2-common/bluetooth/vnd_smdk4210.txt # Vold @@ -142,13 +154,19 @@ BOARD_SEPOLICY_DIRS += \ device/samsung/galaxys2-common/selinux BOARD_SEPOLICY_UNION += \ + bluetooth.te \ device.te \ - drmserver.te \ - ueventd.te \ domain.te \ + drmserver.te \ + dumpstate.te \ file.te \ file_contexts \ + init.te \ + mediaserver.te \ rild.te \ + system_app.te \ + system_server.te \ + ueventd.te \ vold.te # Recovery @@ -169,8 +187,8 @@ TARGET_SPECIFIC_HEADER_PATH := device/samsung/galaxys2-common/include # Charging mode BOARD_CHARGING_MODE_BOOTING_LPM := /sys/class/power_supply/battery/batt_lp_charging BOARD_BATTERY_DEVICE_NAME := "battery" -BOARD_CHARGER_RES := device/samsung/galaxys2-common/res/charger - +BOARD_CHARGER_ENABLE_SUSPEND := true +BOARD_CHARGER_SHOW_PERCENTAGE := true BOARD_CUSTOM_BOOTIMG_MK := device/samsung/galaxys2-common/shbootimg.mk # Override healthd HAL diff --git a/camera/Android.mk b/camera/Android.mk index 352a36d..f57758b 100644 --- a/camera/Android.mk +++ b/camera/Android.mk @@ -26,6 +26,7 @@ LOCAL_SRC_FILES := \ exynos_v4l2.c LOCAL_C_INCLUDES := \ + system/media/camera/include \ hardware/samsung/exynos4/hal/include LOCAL_SHARED_LIBRARIES := libutils libcutils liblog libcamera_client libhardware libs5pjpeg diff --git a/camera/exynos_camera.c b/camera/exynos_camera.c index df3f990..3379bab 100644 --- a/camera/exynos_camera.c +++ b/camera/exynos_camera.c @@ -80,8 +80,8 @@ struct exynos_camera_preset exynos_camera_presets_galaxys2[] = { .video_snapshot_supported = 0, .full_video_snap_supported = 0, - .recording_size = "720x480", - .recording_size_values = "1920x1080,1280x720,720x480,640x480", + .recording_size = "1280x720", + .recording_size_values = "1920x1080,1280x720,640x480", .recording_format = "yuv420sp", .focus_mode = "auto", diff --git a/camera/exynos_exif.c b/camera/exynos_exif.c index 8887e5b..b9f57ca 100644 --- a/camera/exynos_exif.c +++ b/camera/exynos_exif.c @@ -372,7 +372,7 @@ bv_ioctl: } int exynos_exif_write_data(void *exif_data, unsigned short tag, - unsigned short type, unsigned int count, int *offset, void *start, + unsigned short type, unsigned int count, unsigned int *offset, void *start, void *data, int length) { unsigned char *pointer; @@ -421,12 +421,12 @@ int exynos_exif_create(struct exynos_camera *exynos_camera, unsigned char user_comment_code[] = { 0x41, 0x53, 0x43, 0x49, 0x49, 0x0, 0x0, 0x0 }; unsigned char exif_ascii_prefix[] = { 0x41, 0x53, 0x43, 0x49, 0x49, 0x0, 0x0, 0x0 }; - camera_memory_t *exif_data_memory; + camera_memory_t *exif_data_memory = NULL; void *exif_data; int exif_data_size; int exif_size; - void *exif_ifd_data_start, *exif_ifd_start, *exif_ifd_gps, *exif_ifd_thumb; + void *exif_ifd_data_start, *exif_ifd_start, *exif_ifd_thumb, *exif_ifd_gps = NULL; void *exif_thumb_data; unsigned int exif_thumb_size; @@ -644,7 +644,7 @@ int exynos_exif_create(struct exynos_camera *exynos_camera, count = exynos_exif_write_data(pointer, EXIF_TAG_GPS_IFD_POINTER, EXIF_TYPE_LONG, 1, NULL, NULL, &offset, sizeof(offset)); - pointer = exif_ifd_start + offset; + pointer = (unsigned char *) exif_ifd_start + offset; if (exif_attributes->gps_processing_method[0] == 0) value = NUM_0TH_IFD_GPS - 1; @@ -20,7 +20,6 @@ DEVICE_PACKAGE_OVERLAYS := $(COMMON_PATH)/overlay # Rootdir PRODUCT_COPY_FILES := \ $(COMMON_PATH)/rootdir/fstab.smdk4210:root/fstab.smdk4210 \ - $(COMMON_PATH)/rootdir/lpm.rc:root/lpm.rc \ $(COMMON_PATH)/rootdir/init.smdk4210.usb.rc:root/init.smdk4210.usb.rc \ $(COMMON_PATH)/rootdir/init.smdk4210.rc:root/init.smdk4210.rc \ $(COMMON_PATH)/rootdir/ueventd.smdk4210.rc:root/ueventd.smdk4210.rc @@ -45,7 +44,8 @@ PRODUCT_COPY_FILES += \ PRODUCT_PROPERTY_OVERRIDES += \ wifi.interface=wlan0 \ - wifi.supplicant_scan_interval=15 + wifi.supplicant_scan_interval=15 \ + net.tethering.noprovisioning=true $(call inherit-product-if-exists, hardware/broadcom/wlan/bcmdhd/firmware/bcm4330/device-bcm.mk) @@ -71,7 +71,7 @@ PRODUCT_PACKAGES += \ # HAL PRODUCT_PACKAGES += \ - camera.smdk4210 \ + camera.smdk4210 \ gralloc.exynos4 \ hwcomposer.exynos4 \ libnetcmdiface \ @@ -102,16 +102,17 @@ PRODUCT_PACKAGES += \ libOMX.SEC.AVC.Decoder \ libOMX.SEC.M4V.Decoder \ libOMX.SEC.WMV.Decoder \ - libOMX.SEC.VP8.Decoder \ - libSEC_OMX_Venc \ libOMX.SEC.AVC.Encoder \ - libOMX.SEC.M4V.Encoder \ - libSEC_OMX_Adec \ - libOMX.SEC.MP3.Decoder + libSEC_OMX_Venc \ + libOMX.SEC.M4V.Encoder PRODUCT_COPY_FILES += \ $(COMMON_PATH)/configs/media_codecs.xml:system/etc/media_codecs.xml \ - $(COMMON_PATH)/configs/media_profiles.xml:system/etc/media_profiles.xml + $(COMMON_PATH)/configs/media_profiles.xml:system/etc/media_profiles.xml \ + frameworks/av/media/libstagefright/data/media_codecs_google_audio.xml:system/etc/media_codecs_google_audio.xml \ + frameworks/av/media/libstagefright/data/media_codecs_google_telephony.xml:system/etc/media_codecs_google_telephony.xml \ + frameworks/av/media/libstagefright/data/media_codecs_google_video.xml:system/etc/media_codecs_google_video.xml \ + frameworks/av/media/libstagefright/data/media_codecs_ffmpeg.xml:system/etc/media_codecs_ffmpeg.xml # Graphics PRODUCT_PROPERTY_OVERRIDES += \ @@ -123,7 +124,7 @@ PRODUCT_PROPERTY_OVERRIDES += \ # 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 @@ -145,6 +146,15 @@ PRODUCT_PACKAGES += \ VisualizationWallpapers \ librs_jni +# Wifi +PRODUCT_PACKAGES += \ + dhcpcd.conf \ + hostapd \ + libwpa_client \ + macloader \ + wpa_supplicant \ + wpa_supplicant.conf + # These are the hardware-specific features PRODUCT_COPY_FILES += \ frameworks/native/data/etc/android.hardware.audio.low_latency.xml:system/etc/permissions/android.hardware.audio.low_latency.xml \ @@ -182,6 +192,9 @@ PRODUCT_TAGS += dalvik.gc.type-precise PRODUCT_DEFAULT_PROPERTY_OVERRIDES += \ persist.sys.usb.config=mtp +PRODUCT_PROPERTY_OVERRIDES += \ + persist.sys.isUsbOtgEnabled=true + $(call inherit-product, frameworks/native/build/phone-hdpi-512-dalvik-heap.mk) # Include exynos4 platform specific parts diff --git a/configs/98netflix b/configs/98netflix index 92bf878..89bcfcd 100644 --- a/configs/98netflix +++ b/configs/98netflix @@ -1,6 +1,6 @@ #!/system/bin/sh if [ -f /data/data/com.netflix.mediaclient/shared_prefs/nfxpref.xml ]; then - grep -q nflx_player_type.*6 /data/data/com.netflix.mediaclient/shared_prefs/nfxpref.xml && exit 0 - cp /data/data/com.netflix.mediaclient/shared_prefs/nfxpref.xml /data/data/com.netflix.mediaclient/shared_prefs/nfxpref.xml.orig && sed -e 's|<int name="nflx_player_type".*||g; s|</map>|<int name="nflx_player_type" value="6" />\n</map>|g' /data/data/com.netflix.mediaclient/shared_prefs/nfxpref.xml.orig > /data/data/com.netflix.mediaclient/shared_prefs/nfxpref.xml && rm /data/data/com.netflix.mediaclient/shared_prefs/nfxpref.xml.orig + grep -q nflx_player_type.*10 /data/data/com.netflix.mediaclient/shared_prefs/nfxpref.xml && exit 0 + cp /data/data/com.netflix.mediaclient/shared_prefs/nfxpref.xml /data/data/com.netflix.mediaclient/shared_prefs/nfxpref.xml.orig && sed -e 's|<int name="nflx_player_type".*||g; s|</map>|<int name="nflx_player_type" value="10" />\n</map>|g' /data/data/com.netflix.mediaclient/shared_prefs/nfxpref.xml.orig > /data/data/com.netflix.mediaclient/shared_prefs/nfxpref.xml && rm /data/data/com.netflix.mediaclient/shared_prefs/nfxpref.xml.orig fi diff --git a/configs/media_codecs.xml b/configs/media_codecs.xml index ce39c6e..b628b68 100644 --- a/configs/media_codecs.xml +++ b/configs/media_codecs.xml @@ -76,55 +76,20 @@ Only the three quirks included above are recognized at this point: --> <MediaCodecs> + <Include href="media_codecs_google_audio.xml" /> + <Include href="media_codecs_google_telephony.xml" /> + <Decoders> - <MediaCodec name="OMX.SEC.AVC.Decoder" type="video/avc" /> <MediaCodec name="OMX.SEC.MPEG4.Decoder" type="video/mp4v-es" /> <MediaCodec name="OMX.SEC.H263.Decoder" type="video/3gpp" /> <MediaCodec name="OMX.SEC.AVC.Decoder" type="video/avc" /> - - <MediaCodec name="OMX.google.mp3.decoder" type="audio/mpeg" /> - <MediaCodec name="OMX.google.amrnb.decoder" type="audio/3gpp" /> - <MediaCodec name="OMX.google.amrwb.decoder" type="audio/amr-wb" /> - <MediaCodec name="OMX.google.aac.decoder" type="audio/mp4a-latm" /> - <MediaCodec name="OMX.google.g711.alaw.decoder" type="audio/g711-alaw" /> - <MediaCodec name="OMX.google.g711.mlaw.decoder" type="audio/g711-mlaw" /> - <MediaCodec name="OMX.google.vorbis.decoder" type="audio/vorbis" /> - <MediaCodec name="OMX.google.mpeg4.decoder" type="video/mp4v-es" /> - <MediaCodec name="OMX.google.h263.decoder" type="video/3gpp" /> - <MediaCodec name="OMX.google.h264.decoder" type="video/avc" /> - <MediaCodec name="OMX.google.vp8.decoder" type="video/x-vnd.on2.vp8" /> - <MediaCodec name="OMX.google.vp9.decoder" type="video/x-vnd.on2.vp9" /> - <!-- ffmpeg audio codecs --> - <MediaCodec name="OMX.ffmpeg.ra.decoder" type="audio/vnd.rn-realaudio"/> - <MediaCodec name="OMX.ffmpeg.flac.decoder" type="audio/flac"/> - <MediaCodec name="OMX.ffmpeg.mp2.decoder" type="audio/mpeg-L2"/> - <MediaCodec name="OMX.ffmpeg.ac3.decoder" type="audio/ac3"/> - <MediaCodec name="OMX.ffmpeg.ape.decoder" type="audio/x-ape"/> - <MediaCodec name="OMX.ffmpeg.dts.decoder" type="audio/vnd.dts"/> - <MediaCodec name="OMX.ffmpeg.atrial.decoder" type="audio/ffmpeg"/> - <!-- ffmpeg video codecs --> - <MediaCodec name="OMX.ffmpeg.mpeg2v.decoder" type="video/mpeg2"/> - <MediaCodec name="OMX.ffmpeg.h263.decoder" type="video/3gpp"/> - <MediaCodec name="OMX.ffmpeg.mpeg4.decoder" type="video/mp4v-es"/> - <MediaCodec name="OMX.ffmpeg.wmv.decoder" type="video/x-ms-wmv"/> - <MediaCodec name="OMX.ffmpeg.rv.decoder" type="video/vnd.rn-realvideo"/> - <MediaCodec name="OMX.ffmpeg.h264.decoder" type="video/avc"/> - <MediaCodec name="OMX.ffmpeg.vc1.decoder" type="video/vc1"/> - <MediaCodec name="OMX.ffmpeg.flv1.decoder" type="video/x-flv"/> - <MediaCodec name="OMX.ffmpeg.divx.decoder" type="video/divx"/> - <MediaCodec name="OMX.ffmpeg.hevc.decoder" type="video/hevc"/> - <MediaCodec name="OMX.ffmpeg.vtrial.decoder" type="video/ffmpeg"/> </Decoders> <Encoders> <MediaCodec name="OMX.SEC.MPEG4.Encoder" type="video/mp4v-es" /> <MediaCodec name="OMX.SEC.H263.Encoder" type="video/3gpp" /> <MediaCodec name="OMX.SEC.AVC.Encoder" type="video/avc" /> - - <MediaCodec name="OMX.google.amrnb.encoder" type="audio/3gpp" /> - <MediaCodec name="OMX.google.amrwb.encoder" type="audio/amr-wb" /> - <MediaCodec name="OMX.google.aac.encoder" type="audio/mp4a-latm" /> - <MediaCodec name="OMX.google.flac.encoder" type="audio/flac" /> - <MediaCodec name="OMX.google.vp8.encoder" type="video/x-vnd.on2.vp8" /> </Encoders> + <Include href="media_codecs_google_video.xml" /> + <Include href="media_codecs_ffmpeg.xml" /> </MediaCodecs> diff --git a/configs/wpa_supplicant.conf b/configs/wpa_supplicant.conf index 314897f..0e6a2e3 100644 --- a/configs/wpa_supplicant.conf +++ b/configs/wpa_supplicant.conf @@ -7,3 +7,7 @@ p2p_listen_reg_class=81 p2p_listen_channel=1 p2p_oper_reg_class=115 p2p_oper_channel=48 +manufacturer=SAMSUNG_ELECTRONICS +model_name=SAMSUNG_MOBILE +model_number=2014 +serial_number=19691101 diff --git a/include/hardware/gps.h b/include/hardware/gps.h index 4e6d0cd..a8349b2 100644 --- a/include/hardware/gps.h +++ b/include/hardware/gps.h @@ -21,6 +21,8 @@ #include <sys/cdefs.h> #include <sys/types.h> #include <pthread.h> +#include <sys/socket.h> +#include <stdbool.h> #include <hardware/hardware.h> @@ -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 @@ -105,25 +110,45 @@ typedef uint16_t GpsLocationFlags; #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; @@ -135,6 +160,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 */ @@ -206,6 +237,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" @@ -221,6 +383,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" @@ -236,10 +403,26 @@ 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" + +/** * The GPS chipset can use Psc for AGPS. */ #define AGPS_USE_PSC + /** Represents a location. */ typedef struct { /** set to sizeof(GpsLocation) */ @@ -355,8 +538,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); @@ -408,7 +592,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 ); @@ -469,7 +653,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. */ @@ -490,13 +674,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. @@ -512,16 +728,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 ); @@ -530,15 +746,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 { @@ -664,7 +989,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 ); @@ -803,7 +1128,7 @@ typedef void (*gps_geofence_transition_callback) (int32_t geofence_id, GpsLocat 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. @@ -881,7 +1206,7 @@ typedef struct { /** * Opens the geofence interface and provides the callback routines - * to the implemenation of this interface. + * to the implementation of this interface. */ void (*init)( GpsGeofenceCallbacks* callbacks ); @@ -911,14 +1236,12 @@ typedef struct { * 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. + * 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); + 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. @@ -947,7 +1270,554 @@ typedef struct { */ 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. + */ + 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 */ - diff --git a/include/telephony/ril.h b/include/telephony/ril.h index 572aa46..51c5fc0 100644 --- a/include/telephony/ril.h +++ b/include/telephony/ril.h @@ -20,6 +20,9 @@ #include <stdlib.h> #include <stdint.h> #include <telephony/ril_cdma_sms.h> +#include <telephony/ril_nv_items.h> +#include <telephony/ril_msim.h> + #ifndef FEATURE_UNIT_TEST #include <sys/time.h> #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,6 +4027,296 @@ 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 + /* SAMSUNG REQUESTS */ #define RIL_REQUEST_GET_CELL_BROADCAST_CONFIG 10002 @@ -3634,6 +4371,41 @@ typedef struct { /***********************************************************************/ +/** + * 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 + #define RIL_UNSOL_RESPONSE_BASE 1000 @@ -3768,7 +4540,6 @@ typedef struct { */ #define RIL_UNSOL_ON_USSD_REQUEST 1007 - /** * RIL_UNSOL_NITZ_TIME_RECEIVED * @@ -4137,6 +4908,135 @@ 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 + +/***********************************************************************/ + + +#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 + * + * @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); + +/** + * This function should return the current radio state synchronously + */ +typedef RIL_RadioState (*RIL_RadioStateRequest)(); + +#endif + /* SAMSUNG RESPONSE */ #define SAMSUNG_UNSOL_RESPONSE_BASE 11000 @@ -4172,27 +5072,6 @@ typedef struct { #define RIL_UNSOL_UTS_GET_UNREAD_SMS_STATUS 11031 #define RIL_UNSOL_MIP_CONNECT_STATUS 11032 -/***********************************************************************/ - - -/** - * 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); - -/** - * This function should return the current radio state synchronously - */ -typedef RIL_RadioState (*RIL_RadioStateRequest)(); - /** * This function returns "1" if the specified RIL_REQUEST code is * supported and 0 if it is not @@ -4248,6 +5127,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 +5152,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 +5219,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 +5228,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 diff --git a/overlay/frameworks/base/core/res/res/values/config.xml b/overlay/frameworks/base/core/res/res/values/config.xml index 273eff0..f7e2816 100755 --- a/overlay/frameworks/base/core/res/res/values/config.xml +++ b/overlay/frameworks/base/core/res/res/values/config.xml @@ -149,22 +149,15 @@ <item>10</item> </integer-array> + <!-- Is the device LTE capable --> + <bool name="config_lte_capable">false</bool> + <!-- The default iface on which to monitor data use --> <string name="config_datause_iface">pdp0</string> <!-- Allow the menu hard key to be disabled in LockScreen on some devices --> <bool name="config_disableMenuKeyInLockScreen">true</bool> - <!-- Workaround for devices with broken keyboards --> - <bool name="config_forceDisableHardwareKeyboard">true</bool> - <!-- Boolean to enable stk functionality on Samsung phones --> <bool name="config_samsung_stk">true</bool> - - <!-- Device supports LED flashlight --> - <bool name="config_enableTorch">true</bool> - - <!-- Control whether a car dock event should override the default bluetooth - audio routing, FORCE_BT_CAR_DOCK, with an analog dock, FORCE_ANALOG_DOCK. --> - <bool name="config_forceAnalogCarDock">true</bool> </resources> diff --git a/overlay/frameworks/base/packages/SettingsProvider/res/values/defaults.xml b/overlay/frameworks/base/packages/SettingsProvider/res/values/defaults.xml index 1e32354..4173d85 100644 --- a/overlay/frameworks/base/packages/SettingsProvider/res/values/defaults.xml +++ b/overlay/frameworks/base/packages/SettingsProvider/res/values/defaults.xml @@ -17,6 +17,9 @@ */ --> <resources> + + <bool name="def_screen_brightness_automatic_mode">true</bool> + <!-- Screen timeout default = 30 seconds --> <integer name="def_screen_off_timeout">30000</integer> </resources> diff --git a/overlay/frameworks/base/packages/SystemUI/res/values/config.xml b/overlay/frameworks/base/packages/SystemUI/res/values/config.xml index 88851f7..6dc633c 100644 --- a/overlay/frameworks/base/packages/SystemUI/res/values/config.xml +++ b/overlay/frameworks/base/packages/SystemUI/res/values/config.xml @@ -22,5 +22,12 @@ <resources> <!-- Control whether status bar should distinguish HSPA data icon form UMTS data icon on devices --> <bool name="config_hspa_data_distinguishable">true</bool> + + <!-- Whether recents should use hardware layers for its taskviews. This flag can be enabled + for devices where the java drawing of round rects may be slow --> + <bool name="config_recents_use_hardware_layers">true</bool> + + <!-- Whether to use cheap, less good looking shadows for recents --> + <bool name="config_recents_fake_shadows">true</bool> </resources> diff --git a/overlay/packages/apps/Mms/res/values/config.xml b/overlay/packages/apps/Mms/res/values/config.xml new file mode 100644 index 0000000..5454c8b --- /dev/null +++ b/overlay/packages/apps/Mms/res/values/config.xml @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * + * Copyright (c) 2013-2014, The Linux Foundation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of The Linux Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +--> + +<resources> + <!-- configuration for showing smsc pref --> + <bool name="config_show_smsc_pref">true</bool> +</resources> diff --git a/releasetools/galaxys2_ota_from_target_files b/releasetools/galaxys2_ota_from_target_files index c581b32..dbc945a 100755 --- a/releasetools/galaxys2_ota_from_target_files +++ b/releasetools/galaxys2_ota_from_target_files @@ -20,6 +20,8 @@ import galaxys2_common as common LOCAL_DIR = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..')) RELEASETOOLS_DIR = os.path.abspath(os.path.join(LOCAL_DIR, '../../../build/tools/releasetools')) +TARGET_DIR = os.getenv('OUT') + # Add releasetools directory to python path sys.path.append(RELEASETOOLS_DIR) @@ -34,10 +36,7 @@ import galaxys2_edify_generator as edify_generator __doc__ = ota_from_target_files.__doc__ def CopyBootFiles(input_zip, output_zip): - boot_img = common.GetBootableImage("boot.img", "boot.img", - OPTIONS.input_tmp, "BOOT") - common.CheckSize(boot_img.data, "boot.img", OPTIONS.info_dict) - common.ZipWriteStr(output_zip, "boot.img", boot_img.data) + output_zip.write(os.path.join(TARGET_DIR, "boot.img"),"boot.img") def WriteFullOTAPackage(input_zip, output_zip): # TODO: how to determine this? We don't know what version it will @@ -62,7 +61,8 @@ def WriteFullOTAPackage(input_zip, output_zip): metadata=metadata, info_dict=OPTIONS.info_dict) - AppendAssertions(script, OPTIONS.info_dict) + system_items = ItemSet("system", "META/filesystem_config.txt") + AppendAssertions(script, device_specific.info_dict) device_specific.FullOTA_Assertions() if OPTIONS.backuptool: script.Mount("/system") @@ -73,20 +73,20 @@ def WriteFullOTAPackage(input_zip, output_zip): if OPTIONS.wipe_user_data: script.FormatPartition("/data") + script.Unmount("/system") - script.Unmount("/system") script.FormatPartition("/system") script.Mount("/system") script.UnpackPackageDir("recovery", "/system") script.UnpackPackageDir("system", "/system") - symlinks = CopySystemFiles(input_zip, output_zip) + symlinks = CopyPartitionFiles(system_items, input_zip, output_zip) script.MakeSymlinks(symlinks) CopyBootFiles(input_zip, output_zip) - Item.GetMetadata(input_zip) - Item.Get("system").SetPermissions(script) + system_items.GetMetadata(input_zip) + system_items.Get("system").SetPermissions(script) script.ShowProgress(0.2, 0) @@ -95,7 +95,7 @@ def WriteFullOTAPackage(input_zip, output_zip): script.RunBackup("restore") script.ShowProgress(0.2, 10) - script.EMMCWriteRawImage("/dev/block/mmcblk0p5", "boot.img") + script.WriteRawImage("/boot", "boot.img") script.ShowProgress(0.1, 0) device_specific.FullOTA_InstallEnd() @@ -104,7 +104,7 @@ def WriteFullOTAPackage(input_zip, output_zip): script.AppendExtra(OPTIONS.extra_script) script.UnmountAll() - script.AddToZip(input_zip, output_zip) + script.AddToZip(input_zip, output_zip, input_path=OPTIONS.updater_binary) WriteMetadata(metadata, output_zip) ota_from_target_files.WriteFullOTAPackage = WriteFullOTAPackage 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..21a45c2 --- /dev/null +++ b/ril/telephony/java/com/android/internal/telephony/SamsungExynos4RIL.java @@ -0,0 +1,482 @@ +/* + * Copyright (C) 2011 The CyanogenMod Project <http://www.cyanogenmod.org> + * + * 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) { + super(context, networkMode, cdmaSubscription, null); + } + + public SamsungExynos4RIL(Context context, int networkMode, int cdmaSubscription, Integer instanceId) { + super(context, networkMode, cdmaSubscription, instanceId); + } + + 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_DEPERSONALIZATION_CODE: 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); + } + +} diff --git a/rootdir/fstab.smdk4210 b/rootdir/fstab.smdk4210 index cf7d043..5d8b38a 100755 --- a/rootdir/fstab.smdk4210 +++ b/rootdir/fstab.smdk4210 @@ -11,9 +11,9 @@ /dev/block/mmcblk0p12 /preload ext4 noatime,nosuid,nodev,journal_async_commit wait # vold-managed volumes ("block device" is actually a sysfs devpath) -/devices/platform/dw_mmc/mmc_host/mmc0/mmc0 auto auto defaults voldmanaged=sdcard0:11,nonremovable,noemulatedsd -/devices/platform/s3c-sdhci.2/mmc_host/mmc1 auto auto defaults voldmanaged=sdcard1:auto -/devices/platform/s3c_otghcd/usb auto auto defaults voldmanaged=usbdisk0:auto +/devices/platform/dw_mmc/mmc_host/mmc0/mmc0* auto auto defaults wait,voldmanaged=sdcard0:11,nonremovable,noemulatedsd +/devices/platform/s3c-sdhci.2/mmc_host/mmc1* auto auto defaults wait,voldmanaged=sdcard1:auto,noemulatedsd +/devices/platform/s3c_otghcd/usb* auto auto defaults voldmanaged=usbdisk0:auto # recovery /dev/block/mmcblk0p5 /boot emmc defaults recoveryonly diff --git a/rootdir/init.smdk4210.rc b/rootdir/init.smdk4210.rc index 49282aa..efabcfe 100644 --- a/rootdir/init.smdk4210.rc +++ b/rootdir/init.smdk4210.rc @@ -41,22 +41,16 @@ on fs mkdir /data/misc/vpn/profiles 0770 system system mkdir /data/misc/radio 0775 radio system + mkdir /data/radio 0770 radio radio chmod 0770 /data/misc/wifi -# 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 +on charger + +# CPU Frequency Governor + write /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor powersave + +# EHCI runtime enable for LPA + write /sys/devices/platform/s5p-ehci/power/control auto on post-fs-data # insmod kernel modules @@ -116,6 +110,9 @@ on post-fs-data chmod 0775 /efs/.files/.dx1 chmod 0775 /efs/.files/.dm33 chmod 0775 /efs/.files/.mp301 + +# SELinux restore context for efs files + restorecon_recursive /efs # MTP Device permission. chmod 0660 /dev/usb_mtp_gadget @@ -172,6 +169,7 @@ on post-fs-data chown system radio /sys/devices/platform/sec-battery/power_supply/battery/video chown system radio /sys/devices/platform/sec-battery/power_supply/battery/batt_lp_charging chown system radio /sys/devices/platform/sec-battery/power_supply/battery/charging_source + chown system radio /sys/devices/platform/sec-battery/power_supply/battery/charging_enabled chown system radio /sys/devices/platform/sec-battery/power_supply/battery/batt_temp_adc_avg chown system radio /sys/devices/platform/sec-battery/power_supply/battery/batt_temp_adc chown system radio /sys/devices/platform/sec-battery/power_supply/battery/batt_temp @@ -234,6 +232,8 @@ on post-fs-data chmod 0660 /sys/class/rfkill/rfkill0/state chown bluetooth bluetooth /sys/class/rfkill/rfkill0/state chown bluetooth bluetooth /sys/class/rfkill/rfkill0/type + restorecon /sys/class/rfkill/rfkill0/state + restorecon /sys/class/rfkill/rfkill0/type # Vibetonz chmod 0660 /dev/tspdrv @@ -247,6 +247,7 @@ on post-fs-data chown system media_rw /sys/class/lcd/panel/gamma_mode chown system media_rw /sys/class/lcd/panel/power_reduce chown system system /sys/class/backlight/panel/auto_brightness + restorecon /sys/class/lcd/panel/power_reduce # Permissions for mDNIe chown system media_rw /sys/class/mdnie/mdnie/mode @@ -255,6 +256,9 @@ on post-fs-data chown system media_rw /sys/class/mdnie/mdnie/negative write /sys/class/mdnie/mdnie/scenario 0 write /sys/class/mdnie/mdnie/mode 1 + restorecon /sys/class/mdnie/mdnie/scenario + restorecon /sys/class/mdnie/mdnie/mode + restorecon /sys/class/mdnie/mdnie/negative # Permissions for uart_sel and usb_sel chown system radio /sys/class/sec/switch/uart_sel/value @@ -318,6 +322,7 @@ on post-fs-data on boot mount debugfs /sys/kernel/debug /sys/kernel/debug + setprop wifi.interface wlan0 # permissions for NFC setprop ro.nfc.port "I2C" @@ -340,18 +345,25 @@ service cpboot-daemon /sbin/cbd -d -p 8 group radio cache inet misc audio sdcard_rw log sdcard_r service mdnsd /system/bin/mdnsd - class main + class main user mdnsr group inet net_raw socket mdnsd stream 0660 mdnsr inet disabled oneshot +service charger /sbin/healthd -c + class charger + critical + seclabel u:r:healthd:s0 + service p2p_supplicant /system/bin/wpa_supplicant \ - -iwlan0 -Dnl80211 -c/data/misc/wifi/wpa_supplicant.conf -N \ - -ip2p0 -Dnl80211 -c/data/misc/wifi/p2p_supplicant.conf -e/data/misc/wifi/entropy.bin \ - -puse_p2p_group_interface=1 \ - -O/data/misc/wifi/sockets -g@android:wpa_wlan0 + -iwlan0 -Dnl80211 -c/data/misc/wifi/wpa_supplicant.conf \ + -I/system/etc/wifi/wpa_supplicant.conf \ + -O/data/misc/wifi/sockets -N \ + -ip2p0 -Dnl80211 -c/data/misc/wifi/p2p_supplicant.conf -e/data/misc/wifi/entropy.bin \ + -puse_p2p_group_interface=1 \ + -g@android:wpa_wlan0 # we will start as root and wpa_supplicant will switch to user wifi # after setting up the capabilities required for WEXT # user wifi @@ -362,9 +374,11 @@ service p2p_supplicant /system/bin/wpa_supplicant \ oneshot service wpa_supplicant /system/bin/wpa_supplicant \ - -Dnl80211 -iwlan0 -e/data/misc/wifi/entropy.bin \ - -c/data/misc/wifi/wpa_supplicant.conf \ - -O/data/misc/wifi/sockets -g@android:wpa_wlan0 + -Dnl80211 -iwlan0 -e/data/misc/wifi/entropy.bin \ + -c/data/misc/wifi/wpa_supplicant.conf \ + -I/system/etc/wifi/wpa_supplicant.conf \ + -O/data/misc/wifi/sockets \ + -g@android:wpa_wlan0 # we will start as root and wpa_supplicant will switch to user wifi # after setting up the capabilities required for WEXT # user wifi @@ -404,11 +418,8 @@ service iprenew_bt-pan /system/bin/dhcpcd -n disabled oneshot -# bluetooth mac address -service bdaddr /system/bin/bdaddr_read +service macloader /system/bin/macloader class main - user root - disabled oneshot # bugreport is triggered by holding down volume down, volume up and power diff --git a/rootdir/lpm.rc b/rootdir/lpm.rc deleted file mode 100644 index 755fd2a..0000000 --- a/rootdir/lpm.rc +++ /dev/null @@ -1,64 +0,0 @@ -on early-init - start ueventd - -on init - export PATH /sbin:/vendor/bin:/system/sbin:/system/bin:/system/xbin - export LD_LIBRARY_PATH /vendor/lib:/system/lib - export ANDROID_ROOT /system - export ANDROID_DATA /data - export ANDROID_CACHE /cache - export SECONDARY_STORAGE /mnt/emmc - export EXTERNAL_STORAGE /mnt/sdcard - - symlink /system/etc /etc - mkdir /mnt 0775 root system - - mkdir /system - mkdir /tmp - mkdir /mnt 0775 root root - - -on boot -# CPU Frequency Governor - write /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor powersave - - ifup lo - hostname localhost - domainname localdomain - - class_start default - -service ueventd /sbin/ueventd - class core - critical - -service console /system/bin/sh - class core - console - -service adbd /sbin/adbd - disabled - -service charger /charger - class default - user root - -# Always start adbd on userdebug and eng builds -# In recovery, always run adbd as root. -on property:ro.debuggable=1 - write /sys/class/android_usb/android0/enable 0 - write /sys/class/android_usb/android0/idVendor 04e8 - write /sys/class/android_usb/android0/idProduct 6860 - write /sys/class/android_usb/android0/functions adb - write /sys/class/android_usb/android0/enable 1 - write /sys/class/android_usb/android0/iManufacturer $ro.product.manufacturer - write /sys/class/android_usb/android0/iProduct $ro.product.model - write /sys/class/android_usb/android0/iSerial $ro.serialno - start adbd - setprop service.adb.root 1 - -# Restart adbd so it can run as root -on property:service.adb.root=1 - write /sys/class/android_usb/android0/enable 0 - restart adbd - write /sys/class/android_usb/android0/enable 1 diff --git a/selinux/bluetooth.te b/selinux/bluetooth.te new file mode 100644 index 0000000..d31e1df --- /dev/null +++ b/selinux/bluetooth.te @@ -0,0 +1 @@ +allow bluetooth efs_device_file:dir search; diff --git a/selinux/device.te b/selinux/device.te index 6de8078..a12b98c 100644 --- a/selinux/device.te +++ b/selinux/device.te @@ -1,2 +1,4 @@ +type mali_device, dev_type, mlstrustedobject; type rfkill_device, dev_type; type efs_block_device, dev_type; +type mfc_device, dev_type; diff --git a/selinux/domain.te b/selinux/domain.te index bafc37d..fd893cc 100644 --- a/selinux/domain.te +++ b/selinux/domain.te @@ -1,2 +1,5 @@ ## Firmwares allow ueventd { firmware_mfc }:file r_file_perms; + +## /dev/mali, /dev/ump +allow domain mali_device:chr_file rw_file_perms; diff --git a/selinux/drmserver.te b/selinux/drmserver.te index a456bbf..fea10e4 100644 --- a/selinux/drmserver.te +++ b/selinux/drmserver.te @@ -1 +1,2 @@ allow drmserver sdcard_external:file open; +allow drmserver self:process execmem; diff --git a/selinux/dumpstate.te b/selinux/dumpstate.te new file mode 100644 index 0000000..1eb992e --- /dev/null +++ b/selinux/dumpstate.te @@ -0,0 +1 @@ +unix_socket_connect(dumpstate, dumpstate, init); diff --git a/selinux/file.te b/selinux/file.te index 51cf771..b8c9390 100644 --- a/selinux/file.te +++ b/selinux/file.te @@ -1,2 +1,4 @@ type radio_efs_file, fs_type; type firmware_mfc, file_type; +type sysfs_display, fs_type, sysfs_type; +type efs_device_file, file_type; diff --git a/selinux/file_contexts b/selinux/file_contexts index 3dc49e7..0e01fb0 100644 --- a/selinux/file_contexts +++ b/selinux/file_contexts @@ -1,7 +1,7 @@ # GFX -/dev/mali u:object_r:graphics_device:s0 -/dev/ump u:object_r:graphics_device:s0 -/dev/fimg2d u:object_r:graphics_device:s0 +/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 @@ -10,11 +10,17 @@ /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/mmcblk0p8 u:object_r:efs_block_device:s0 +/efs u:object_r:efs_device_file:s0 + +# Camera +/dev/s3c-mfc u:object_r:mfc_device:s0 +/dev/s5p-jpeg u:object_r:video_device:s0 # Bluetooth /dev/ttySAC0 u:object_r:hci_attach_dev:s0 -/efs/bluetooth(/.*)? u:object_r:bluetooth_data_file:s0 +/efs/bluetooth/bt_addr u:object_r:bluetooth_data_file:s0 +/sys/class/rfkill/rfkill0/state u:object_r:sysfs_bluetooth_writable:s0 # GPS /dev/ttySAC1 u:object_r:gps_device:s0 @@ -27,3 +33,9 @@ # Firmwares /system/vendor/firmware/mfc_fw.bin u:object_r:firmware_mfc:s0 + +# Display +/sys/class/lcd/panel/power_reduce u:object_r:sysfs_display:s0 +/sys/class/mdnie/mdnie/scenario u:object_r:sysfs_display:s0 +/sys/class/mdnie/mdnie/mode u:object_r:sysfs_display:s0 +/sys/class/mdnie/mdnie/negative u:object_r:sysfs_display:s0 diff --git a/selinux/init.te b/selinux/init.te new file mode 100644 index 0000000..74b1400 --- /dev/null +++ b/selinux/init.te @@ -0,0 +1 @@ +allow init self:capability sys_module; diff --git a/selinux/mediaserver.te b/selinux/mediaserver.te new file mode 100644 index 0000000..2697346 --- /dev/null +++ b/selinux/mediaserver.te @@ -0,0 +1,2 @@ +allow mediaserver mfc_device:chr_file rw_file_perms; +allow mediaserver video_device:chr_file rw_file_perms; diff --git a/selinux/rild.te b/selinux/rild.te index 40406e3..3c8040a 100644 --- a/selinux/rild.te +++ b/selinux/rild.te @@ -1,7 +1,17 @@ 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 }; +allow rild self:process execmem; 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 radio_data_file:dir setattr; +allow rild block_device:dir search; +allow rild efs_device_file:dir { search write }; +allow rild efs_device_file:file { read write append getattr open setattr }; +allow rild system_data_file:dir { write add_name }; +allow rild system_data_file:file { write create setattr }; + +allow rild dumpstate_exec:file { read open getattr execute }; +unix_socket_connect(rild, dumpstate, dumpstate) diff --git a/selinux/system_app.te b/selinux/system_app.te new file mode 100644 index 0000000..bc716f2 --- /dev/null +++ b/selinux/system_app.te @@ -0,0 +1 @@ +allow system_app sysfs_display:file { getattr open read write }; diff --git a/selinux/system_server.te b/selinux/system_server.te new file mode 100644 index 0000000..970da27 --- /dev/null +++ b/selinux/system_server.te @@ -0,0 +1,5 @@ +allow system_server uhid_device:chr_file { read write ioctl open }; +allow system_server sysfs_display:file { read write getattr open }; +allow system_server efs_file:dir { search }; +allow system_server efs_file:file { read open write }; +allow system_server efs_device_file:dir search; diff --git a/selinux/vold.te b/selinux/vold.te index d179865..7bf2310 100644 --- a/selinux/vold.te +++ b/selinux/vold.te @@ -1 +1,3 @@ allow vold sdcard_external:file rw_file_perms; +allow vold efs_device_file:dir rw_file_perms; +allow vold efs_device_file:file rw_file_perms; diff --git a/tinyalsa_audio/audio_ril_interface.c b/tinyalsa_audio/audio_ril_interface.c index 2fc14c5..2f88d14 100644 --- a/tinyalsa_audio/audio_ril_interface.c +++ b/tinyalsa_audio/audio_ril_interface.c @@ -44,6 +44,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_call_twomic)(void *, enum ril_twomic_device, enum ril_twomic_enable); +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 *); @@ -71,16 +72,6 @@ static int audio_ril_interface_connect_if_required(struct tinyalsa_audio_ril_int return 0; } -int audio_ril_interface_set_mic_mute(struct tinyalsa_audio_ril_interface *ril_interface, bool state) -{ - /* - * If you look at the Replicant libaudio-ril-interface - * this function is just stubbed out there. So let's not - * bother with it - */ - return 0; - -} int audio_ril_interface_set_voice_volume(struct tinyalsa_audio_ril_interface *ril_interface, audio_devices_t device, float volume) @@ -212,6 +203,15 @@ error: return -1; } +int audio_ril_interface_set_mic_mute(struct tinyalsa_audio_ril_interface *ril_interface, enum ril_mic_mute state) +{ + if (audio_ril_interface_connect_if_required(ril_interface)) + return 0; + + return _ril_set_mic_mute(ril_interface->interface, state); +} + + int audio_ril_interface_set_twomic(struct tinyalsa_audio_ril_interface *ril_interface, enum ril_twomic_enable twomic) { int rc; @@ -322,7 +322,7 @@ int audio_ril_interface_open(struct audio_hw_device *dev, audio_devices_t device _ril_set_call_audio_path = dlsym(dl_handle, "SetCallAudioPath"); _ril_set_call_clock_sync = dlsym(dl_handle, "SetCallClockSync"); _ril_set_call_twomic = dlsym(dl_handle, "SetTwoMicControl"); - + _ril_set_mic_mute = dlsym(dl_handle, "SetMute"); _ril_register_unsolicited_handler = dlsym(dl_handle, "RegisterUnsolicitedHandler"); /* since this function is not supported in all RILs, don't require it */ @@ -330,7 +330,8 @@ int audio_ril_interface_open(struct audio_hw_device *dev, audio_devices_t device 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_call_clock_sync || + !_ril_set_call_audio_path || !_ril_set_mic_mute || + !_ril_set_call_clock_sync || !_ril_register_unsolicited_handler || !_ril_set_call_twomic) { ALOGE("Cannot get symbols from '%s'", RIL_CLIENT_LIBPATH); dlclose(dl_handle); diff --git a/tinyalsa_audio/audio_ril_interface.h b/tinyalsa_audio/audio_ril_interface.h index 59eb967..66d806f 100644 --- a/tinyalsa_audio/audio_ril_interface.h +++ b/tinyalsa_audio/audio_ril_interface.h @@ -82,7 +82,14 @@ enum ril_twomic_enable { TWO_MIC_SOLUTION_ON }; -int audio_ril_interface_set_mic_mute(struct tinyalsa_audio_ril_interface *ril_interface, bool state); + +enum ril_mic_mute { + MIC_UNMUTE, + MIC_MUTE +}; + + +int audio_ril_interface_set_mic_mute(struct tinyalsa_audio_ril_interface *ril_interface, enum ril_mic_mute); int audio_ril_interface_set_voice_volume(struct tinyalsa_audio_ril_interface *ril_interface, audio_devices_t device, float volume); int audio_ril_interface_set_route(struct tinyalsa_audio_ril_interface *ril_interface, audio_devices_t device); int audio_ril_interface_set_twomic(struct tinyalsa_audio_ril_interface *ril_interface, enum ril_twomic_enable); diff --git a/tinyalsa_audio/mixer.c b/tinyalsa_audio/mixer.c index a125e31..cda890e 100644 --- a/tinyalsa_audio/mixer.c +++ b/tinyalsa_audio/mixer.c @@ -276,7 +276,7 @@ void tinyalsa_mixer_config_start(void *data, const XML_Char *elem, config_data->io_props.channel_mask = AUDIO_CHANNEL_OUT_STEREO; break; case 4: - config_data->io_props.channel_mask = AUDIO_CHANNEL_OUT_SURROUND; + config_data->io_props.channel_mask = AUDIO_CHANNEL_OUT_QUAD_SIDE; break; case 6: config_data->io_props.channel_mask = AUDIO_CHANNEL_OUT_5POINT1; |