diff options
author | codeworkx <codeworkx@cyanogenmod.org> | 2016-04-30 20:56:15 +0200 |
---|---|---|
committer | codeworkx <codeworkx@cyanogenmod.org> | 2016-04-30 20:56:15 +0200 |
commit | 732bf7a24e16add354c45704e237cb2357d2683c (patch) | |
tree | b25b62ef6c1715638ab3e0b7b40961d13bf32ad1 | |
parent | 3dd3324a32a32cf6295e56b0bf7ef697d7d58bdd (diff) | |
parent | d41c859a0678da88519a27560e75983c750155c0 (diff) | |
download | device_samsung_n7100-732bf7a24e16add354c45704e237cb2357d2683c.zip device_samsung_n7100-732bf7a24e16add354c45704e237cb2357d2683c.tar.gz device_samsung_n7100-732bf7a24e16add354c45704e237cb2357d2683c.tar.bz2 |
Merge branch 'cm-13.0' of github.com:tilaksidduram/android_device_samsung_n7100 into HEAD
Change-Id: I492f715515d6cf681a5f6d2bc59f6929f92b7b47
76 files changed, 2481 insertions, 844 deletions
diff --git a/BoardConfig.mk b/BoardConfig.mk index 945d86d..abbfe29 100644 --- a/BoardConfig.mk +++ b/BoardConfig.mk @@ -19,10 +19,18 @@ -include device/samsung/smdk4412-common/BoardCommonConfig.mk +# Bionic +MALLOC_IMPL := dlmalloc + # RIL BOARD_PROVIDES_LIBRIL := true BOARD_MODEM_TYPE := xmm6262 +BOARD_RIL_CLASS := ../../../hardware/samsung/ril TARGET_SPECIFIC_HEADER_PATH := device/samsung/n7100/include +COMMON_GLOBAL_CFLAGS += -DDISABLE_ASHMEM_TRACKING + +# Graphics +TARGET_REQUIRES_SYNCHRONOUS_SETSURFACE := true # Bluetooth BOARD_BLUETOOTH_BDROID_BUILDCFG_INCLUDE_DIR := device/samsung/n7100/bluetooth @@ -30,27 +38,9 @@ BOARD_BLUETOOTH_BDROID_BUILDCFG_INCLUDE_DIR := device/samsung/n7100/bluetooth # Kernel TARGET_KERNEL_SOURCE := kernel/samsung/smdk4412 TARGET_KERNEL_CONFIG := cyanogenmod_n7100_defconfig -BOARD_KERNEL_CMDLINE := console=ttySAC2,115200 androidboot.selinux=permissive - -# ril -BOARD_RIL_CLASS := ../../../device/samsung/n7100/ril/telephony/java -# Selinux -#BOARD_SEPOLICY_DIRS := \ - device/samsung/n7100/selinux - -#BOARD_SEPOLICY_UNION := \ - device.te \ - domain.te \ - file.te \ - file_contexts \ - init.te \ - mediaserver.te \ - rild.te \ - system.te \ - ueventd.te \ - vold.te \ - wpa_supplicant.te +# Power HAL +TARGET_POWERHAL_VARIANT := samsung # assert TARGET_OTA_ASSERT_DEVICE := t03g,n7100,GT-N7100 @@ -58,12 +48,17 @@ TARGET_OTA_ASSERT_DEVICE := t03g,n7100,GT-N7100 # inherit from the proprietary version -include vendor/samsung/n7100/BoardConfigVendor.mk -# Blobs -COMMON_GLOBAL_CFLAGS += -DNEEDS_VECTORIMPL_SYMBOLS +# External apps on SD +TARGET_EXTERNAL_APPS = sdcard1 # Recovery TARGET_RECOVERY_FSTAB := device/samsung/n7100/rootdir/fstab.smdk4x12 +TARGET_USERIMAGES_USE_F2FS := true RECOVERY_FSTAB_VERSION := 2 -# Camera wrapper -TARGET_PROVIDES_CAMERA_HAL := true +# Compatibility with pre-kitkat Sensor HALs +SENSORS_NEED_SETRATE_ON_ENABLE := true + +# Selinux +BOARD_SEPOLICY_DIRS += \ + device/samsung/n7100/selinux diff --git a/audio/audio_hw.c b/audio/audio_hw.c index ef13114..f266c35 100644 --- a/audio/audio_hw.c +++ b/audio/audio_hw.c @@ -200,6 +200,7 @@ struct m0_dev_cfg { static void select_output_device(struct m0_audio_device *adev); static void select_input_device(struct m0_audio_device *adev); +static void set_noise_supression(struct m0_audio_device *adev, int enable); static int adev_set_voice_volume(struct audio_hw_device *dev, float volume); static int do_input_standby(struct m0_stream_in *in); static int do_output_standby(struct m0_stream_out *out); @@ -593,6 +594,7 @@ static void select_mode(struct m0_audio_device *adev) set_bigroute_by_array(adev->mixer, voicecall_default_disable, 1); ALOGD("%s: set voicecall route: default_input_disable", __func__); set_bigroute_by_array(adev->mixer, default_input_disable, 1); + set_noise_supression(adev, 0); ALOGD("%s: set voicecall route: headset_input_disable", __func__); set_bigroute_by_array(adev->mixer, headset_input_disable, 1); ALOGD("%s: set voicecall route: bt_disable", __func__); @@ -671,9 +673,11 @@ static void select_output_device(struct m0_audio_device *adev) if (speaker_on || earpiece_on || headphone_on) { ALOGD("%s: set voicecall route: default_input", __func__); set_bigroute_by_array(adev->mixer, default_input, 1); + set_noise_supression(adev, 1); } else { ALOGD("%s: set voicecall route: default_input_disable", __func__); set_bigroute_by_array(adev->mixer, default_input_disable, 1); + set_noise_supression(adev, 0); } if (headset_on) { @@ -693,6 +697,9 @@ static void select_output_device(struct m0_audio_device *adev) ALOGD("%s: set voicecall route: bt_disable", __func__); set_bigroute_by_array(adev->mixer, bt_disable, 1); } + // this is needed to mute the current device when output devices are switched, but mute is set + adev->hw_device.set_mic_mute(&adev->hw_device, adev->mic_mute); + set_incall_device(adev); } } @@ -723,6 +730,21 @@ static void select_input_device(struct m0_audio_device *adev) select_devices(adev); } +static void set_noise_supression(struct m0_audio_device *adev, int enable) +{ + if (enable) { + // Enable Noise suppression for builtin microphone + ALOGE("%s: enabling two mic control", __func__); + ril_set_two_mic_control(&adev->ril, AUDIENCE, TWO_MIC_SOLUTION_ON); + set_bigroute_by_array(adev->mixer, noise_suppression, 1); + } else { + // Disable Noise suppression for builtin microphone + ALOGE("%s: disabling two mic control", __func__); + ril_set_two_mic_control(&adev->ril, AUDIENCE, TWO_MIC_SOLUTION_OFF); + set_bigroute_by_array(adev->mixer, noise_suppression_disable, 1); + } +} + /* must be called with hw device and output stream mutexes locked */ static int start_output_stream_low_latency(struct m0_stream_out *out) { @@ -2540,21 +2562,6 @@ static int adev_set_parameters(struct audio_hw_device *dev, const char *kvpairs) adev->screen_off = true; } - ret = str_parms_get_str(parms, "noise_suppression", value, sizeof(value)); - if (ret >= 0) { - if (strcmp(value, "on") == 0) { - ALOGE("%s: enabling two mic control", __func__); - ril_set_two_mic_control(&adev->ril, AUDIENCE, TWO_MIC_SOLUTION_ON); - /* sub mic */ - set_bigroute_by_array(adev->mixer, noise_suppression, 1); - } else { - ALOGE("%s: disabling two mic control", __func__); - ril_set_two_mic_control(&adev->ril, AUDIENCE, TWO_MIC_SOLUTION_OFF); - /* sub mic */ - set_bigroute_by_array(adev->mixer, noise_suppression_disable, 1); - } - } - str_parms_destroy(parms); return ret; } @@ -2605,6 +2612,9 @@ static int adev_set_mic_mute(struct audio_hw_device *dev, bool state) { struct m0_audio_device *adev = (struct m0_audio_device *)dev; + if (adev->mode == AUDIO_MODE_IN_CALL) + ril_set_mic_mute(&adev->ril, state); + adev->mic_mute = state; return 0; diff --git a/audio/ril_interface.c b/audio/ril_interface.c index a77efc0..493e438 100644 --- a/audio/ril_interface.c +++ b/audio/ril_interface.c @@ -38,6 +38,7 @@ int (*_ril_set_call_volume)(void *, enum ril_sound_type, int); int (*_ril_set_call_audio_path)(void *, enum ril_audio_path); int (*_ril_set_call_clock_sync)(void *, enum ril_clock_state); int (*_ril_set_two_mic_control)(void *, enum ril_two_mic_device, enum ril_two_mic_state); +int (*_ril_set_mic_mute)(void *, enum ril_mic_mute); int (*_ril_register_unsolicited_handler)(void *, int, void *); int (*_ril_get_wb_amr)(void *, void *); @@ -108,6 +109,7 @@ int ril_open(struct ril_handle *ril) _ril_set_call_audio_path = dlsym(ril->handle, "SetCallAudioPath"); _ril_set_call_clock_sync = dlsym(ril->handle, "SetCallClockSync"); _ril_set_two_mic_control = dlsym(ril->handle, "SetTwoMicControl"); + _ril_set_mic_mute = dlsym(ril->handle, "SetMute"); _ril_register_unsolicited_handler = dlsym(ril->handle, "RegisterUnsolicitedHandler"); /* since this function is not supported in all RILs, don't require it */ @@ -115,8 +117,8 @@ int ril_open(struct ril_handle *ril) if (!_ril_open_client || !_ril_close_client || !_ril_connect || !_ril_is_connected || !_ril_disconnect || !_ril_set_call_volume || - !_ril_set_call_audio_path || !_ril_set_two_mic_control || !_ril_set_call_clock_sync || - !_ril_register_unsolicited_handler) { + !_ril_set_call_audio_path || !_ril_set_two_mic_control || !_ril_set_mic_mute || + !_ril_set_call_clock_sync || !_ril_register_unsolicited_handler) { ALOGE("Cannot get symbols from '%s'", RIL_CLIENT_LIBPATH); dlclose(ril->handle); return -1; @@ -191,3 +193,11 @@ int ril_set_two_mic_control(struct ril_handle *ril, enum ril_two_mic_device devi return _ril_set_two_mic_control(ril->client, device, state); } + +int ril_set_mic_mute(struct ril_handle *ril, enum ril_mic_mute state) +{ + if (ril_connect_if_required(ril)) + return 0; + + return _ril_set_mic_mute(ril->client, state); +} diff --git a/audio/ril_interface.h b/audio/ril_interface.h index 4b401aa..7d4b87e 100644 --- a/audio/ril_interface.h +++ b/audio/ril_interface.h @@ -70,6 +70,11 @@ enum ril_two_mic_state { TWO_MIC_SOLUTION_ON }; +enum ril_mic_mute { + MIC_UNMUTE, + MIC_MUTE +}; + /* Function prototypes */ int ril_open(struct ril_handle *ril); int ril_close(struct ril_handle *ril); @@ -79,5 +84,6 @@ int ril_set_call_audio_path(struct ril_handle *ril, enum ril_audio_path path); int ril_set_call_clock_sync(struct ril_handle *ril, enum ril_clock_state state); void ril_register_set_wb_amr_callback(void *function, void *data); int ril_set_two_mic_control(struct ril_handle *ril, enum ril_two_mic_device device, enum ril_two_mic_state state); +int ril_set_mic_mute(struct ril_handle *ril, enum ril_mic_mute state); #endif diff --git a/bluetooth/bdroid_buildcfg.h b/bluetooth/bdroid_buildcfg.h index cdf37f3..93c924c 100644 --- a/bluetooth/bdroid_buildcfg.h +++ b/bluetooth/bdroid_buildcfg.h @@ -19,5 +19,7 @@ #define _BDROID_BUILDCFG_H #define BTM_DEF_LOCAL_NAME "GT-N7100" - +#define BLE_INCLUDED TRUE +#define BTA_GATT_INCLUDED TRUE +#define SMP_INCLUDED TRUE #endif diff --git a/cm.dependencies b/cm.dependencies index a78a94f..4969689 100644 --- a/cm.dependencies +++ b/cm.dependencies @@ -14,5 +14,9 @@ { "repository": "android_hardware_samsung", "target_path": "hardware/samsung" + }, + { + "repository": "android_external_stlport", + "target_path": "external/stlport" } ] @@ -1,3 +1,29 @@ +# Inherit device configuration +$(call inherit-product, device/samsung/n7100/full_n7100.mk) + +# Copyright (C) 2012 The CyanogenMod Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# +# This file is the build configuration for a full Android +# build for toro hardware. This cleanly combines a set of +# device-specific aspects (drivers) with a device-agnostic +# product configuration (apps). Except for a few implementation +# details, it only fundamentally contains two inherit-product +# lines, full and toro, hence its name. +# + # Release name PRODUCT_RELEASE_NAME := n7100 @@ -19,8 +45,4 @@ PRODUCT_MODEL := GT-N7100 PRODUCT_MANUFACTURER := samsung # Set build fingerprint / ID / Product Name ect. -PRODUCT_BUILD_PROP_OVERRIDES += \ - PRODUCT_NAME=t03gxx \ - TARGET_DEVICE=t03g \ - PRIVATE_BUILD_DESC="t03gxx-user 4.3 JSS15J N7100XXUENB2 release-keys" \ - BUILD_FINGERPRINT="samsung/t03gxx/t03g:4.3/JSS15J/N7100XXUENB2:user/release-keys" +PRODUCT_BUILD_PROP_OVERRIDES += PRODUCT_NAME=t03gxx TARGET_DEVICE=t03g BUILD_FINGERPRINT="samsung/t03gxx/t03g:4.3/JSS15J/N7100XXUEMK4:user/release-keys" PRIVATE_BUILD_DESC="t03gxx-user 4.3 JSS15J N7100XXUEMK4 release-keys" diff --git a/configs/gps.xml b/configs/gps.xml index d482215..fd1eccb 100644 --- a/configs/gps.xml +++ b/configs/gps.xml @@ -10,13 +10,12 @@ FactoryTestFilePath="/data/" Log="JAVA" - acLogDirectory="/sdcard/gps/broadcom/storage" + acLogDirectory="/storage/sdcard0/gps/broadcom/storage" TISEnabled="true" LPmode="false" cp-cold-start="false" cp-guard-time-sec="1" - arp-supl-enable="true" arp-supl-cap-msb="true" arp-supl-cap-msa="true" @@ -42,6 +41,7 @@ acLtoDir="/data/gps/" LbsSyncLtoThresholdDays="1" LbsTAC="10101106" + LbsCellEnable="false" ctrlPipe="/data/gps/glgpsctrl" LbsWlanEnable="false" @@ -55,7 +55,7 @@ <gll LogPriMask="LOG_INFO" - LogFacMask="LOG_RAWDATA | LOG_DEVKF | LOG_GLLAPI | LOG_NMEA" + LogFacMask="LOG_GLLIO | LOG_RAWDATA | LOG_DEVKF | LOG_GLLAPI | LOG_NMEA" FrqPlan="FRQ_PLAN_26MHZ_2PPM_26MHZ_300PPB" RfType="GL_RF_4752_BRCM_EXT_LNA" WarmStandbyTimeout1Seconds="10" diff --git a/configs/tiny_hw.xml b/configs/tiny_hw.xml index 88f3651..5df1aab 100644 --- a/configs/tiny_hw.xml +++ b/configs/tiny_hw.xml @@ -132,16 +132,16 @@ We are able to have most of our routing static so do that <device name="speaker"> <path name="on"> <ctl name="SPK Switch" val="1"/> - <ctl name="AIF1DAC1 Volume" val="96"/> + <ctl name="AIF1DAC1 Volume" val="98"/> <ctl name="AIF1 Boost Volume" val="0"/> - <ctl name="DAC1 Volume" val="96"/> + <ctl name="DAC1 Volume" val="98"/> <ctl name="Left Output Mixer DAC Volume" val="7"/> <ctl name="Right Output Mixer DAC Volume" val="7"/> <ctl name="SPKL DAC1 Volume" val="1"/> <ctl name="SPKR DAC1 Volume" val="1"/> <ctl name="Speaker Mixer Volume" val="3"/> <ctl name="Speaker Boost Volume" val="4"/> - <ctl name="Speaker Volume" val="57"/> + <ctl name="Speaker Volume" val="59"/> </path> <path name="off"> <ctl name="SPK Switch" val="0"/> @@ -158,16 +158,19 @@ We are able to have most of our routing static so do that <ctl name="AIF2ADC HPF Switch" val="1"/> <ctl name="AIF1DAC1 Volume" val="96"/> <ctl name="AIF2DAC Volume" val="96"/> - <ctl name="AIF1 Boost Volume" val="0"/> - <ctl name="AIF2 Boost Volume" val="0"/> + <ctl name="AIF1 Boost Volume" val="1"/> + <ctl name="AIF2 Boost Volume" val="1"/> <ctl name="DAC1 Volume" val="96"/> <ctl name="Left Output Mixer DAC Volume" val="7"/> <ctl name="Right Output Mixer DAC Volume" val="7"/> - <ctl name="Output Volume" val="57"/> + <ctl name="Output Volume" val="60"/> <ctl name="Earpiece Volume" val="1"/> </path> <path name="off"> <ctl name="RCV Switch" val="0"/> + <ctl name="AIF1 Boost Volume" val="0"/> + <ctl name="AIF2 Boost Volume" val="0"/> + <ctl name="Output Volume" val="57"/> </path> </device> <device name="headphone"> @@ -261,12 +264,11 @@ We are able to have most of our routing static so do that <path name="on"> <ctl name="Main Mic Switch" val="1"/> <ctl name="MainMicBias Mode" val="1"/> - <ctl name="IN2L Volume" val="28"/> + <ctl name="IN2L Volume" val="22"/> <ctl name="MIXINL IN2L Switch" val="1"/> <ctl name="MIXINL IN2L Volume" val="1"/> <ctl name="AIF1ADCL Source" val="Left"/> <ctl name="AIF1ADCR Source" val="Left"/> - <ctl name="AIF1ADC2L Mixer ADC/DMIC Switch" val="1"/> <ctl name="AIF1ADC1R Mixer ADC/DMIC Switch" val="1"/> <ctl name="AIF1ADC1 HPF Mode" val="1"/> <ctl name="AIF1ADC1 HPF Switch" val="1"/> @@ -282,7 +284,7 @@ We are able to have most of our routing static so do that <path name="on"> <ctl name="Sub Mic Switch" val="1"/> <ctl name="SubMicBias Mode" val="1"/> - <ctl name="IN1R Volume" val="28"/> + <ctl name="IN1R Volume" val="22"/> <ctl name="MIXINR IN1R Switch" val="1"/> <ctl name="MIXINR IN1R Volume" val="1"/> <ctl name="AIF1ADCR Source" val="1"/> @@ -307,11 +309,9 @@ We are able to have most of our routing static so do that <ctl name="AIF2ADCL Source" val="0"/> <ctl name="AIF1ADCL Source" val="Left"/> <ctl name="AIF1ADCL Source" val="Right"/> - <ctl name="AIF1ADC2L Mixer ADC/DMIC Switch" val="1"/> - <ctl name="AIF1ADC2L Mixer ADC/DMIC Switch" val="1"/> - <ctl name="IN1L Volume" val="18"/> + <ctl name="IN1L Volume" val="22"/> <ctl name="MIXINL IN1L Switch" val="1"/> - <ctl name="MIXINL IN1L Volume" val="0"/> + <ctl name="MIXINL IN1L Volume" val="1"/> <ctl name="AIF1ADC1 HPF Mode" val="1"/> <ctl name="AIF1ADC1 HPF Switch" val="1"/> <ctl name="AIF1ADC1 Volume" val="96"/> diff --git a/gps_daemon.sh b/gps_daemon.sh new file mode 100644 index 0000000..cc83d64 --- /dev/null +++ b/gps_daemon.sh @@ -0,0 +1,2 @@ +#shellscript as this is the only way selinux will allow this to proceed +/system/bin/gpsd -c /system/etc/gps.xml diff --git a/include/camera/CameraParametersExtra.h b/include/camera/CameraParametersExtra.h deleted file mode 100644 index 25ea36b..0000000 --- a/include/camera/CameraParametersExtra.h +++ /dev/null @@ -1,8 +0,0 @@ -#define CAMERA_PARAMETERS_EXTRA_C \ -const char CameraParameters::KEY_ISO_MODE[] = "iso";\ -const char CameraParameters::KEY_SUPPORTED_ISO_MODES[] = "iso-values"; - -#define CAMERA_PARAMETERS_EXTRA_H \ - static const char KEY_SUPPORTED_ISO_MODES[];\ - static const char KEY_ISO_MODE[]; - diff --git a/include/hardware/gps.h b/include/hardware/gps.h index a8349b2..361e811 100644 --- a/include/hardware/gps.h +++ b/include/hardware/gps.h @@ -51,7 +51,10 @@ typedef uint32_t GpsPositionMode; #define GPS_POSITION_MODE_STANDALONE 0 /** AGPS MS-Based mode. */ #define GPS_POSITION_MODE_MS_BASED 1 -/** AGPS MS-Assisted mode. */ +/** + * AGPS MS-Assisted mode. This mode is not maintained by the platform anymore. + * It is strongly recommended to use GPS_POSITION_MODE_MS_BASE instead. + */ #define GPS_POSITION_MODE_MS_ASSISTED 2 /** Requested recurrence mode for GPS operation. */ @@ -117,38 +120,22 @@ typedef uint16_t GpsLocationFlags; /** Flags used to specify which aiding data to delete when calling delete_aiding_data(). */ -typedef uint32_t GpsAidingData; +typedef uint16_t GpsAidingData; // IMPORTANT: Note that the following values must match // constants in GpsLocationProvider.java. -#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 +#define GPS_DELETE_EPHEMERIS 0x0001 +#define GPS_DELETE_ALMANAC 0x0002 +#define GPS_DELETE_POSITION 0x0004 +#define GPS_DELETE_TIME 0x0008 +#define GPS_DELETE_IONO 0x0010 +#define GPS_DELETE_UTC 0x0020 +#define GPS_DELETE_HEALTH 0x0040 +#define GPS_DELETE_SVDIR 0x0080 +#define GPS_DELETE_SVSTEER 0x0100 +#define GPS_DELETE_SADATA 0x0200 +#define GPS_DELETE_RTI 0x0400 +#define GPS_DELETE_CELLDB_INFO 0x8000 +#define GPS_DELETE_ALL 0xFFFF /** AGPS type */ typedef uint16_t AGpsType; @@ -309,6 +296,8 @@ typedef uint32_t GpsMeasurementFlags; #define GPS_MEASUREMENT_HAS_DOPPLER_SHIFT_UNCERTAINTY (1<<16) /** A valid 'used in fix' flag is stored in the data structure. */ #define GPS_MEASUREMENT_HAS_USED_IN_FIX (1<<17) +/** The value of 'pseudorange rate' is uncorrected. */ +#define GPS_MEASUREMENT_HAS_UNCORRECTED_PSEUDORANGE_RATE (1<<18) /** * Enumeration of the available values for the GPS Measurement's loss of lock. @@ -334,6 +323,12 @@ typedef uint8_t GpsMultipathIndicator; /** * Flags indicating the GPS measurement state. + * The expected behavior here is for GPS HAL to set all the flags that applies. For + * example, if the state for a satellite is only C/A code locked and bit synchronized, + * and there is still millisecond ambiguity, the state should be set as: + * GPS_MEASUREMENT_STATE_CODE_LOCK|GPS_MEASUREMENT_STATE_BIT_SYNC|GPS_MEASUREMENT_STATE_MSEC_AMBIGUOUS + * If GPS is still searching for a satellite, the corresponding state should be set to + * GPS_MEASUREMENT_STATE_UNKNOWN(0). */ typedef uint16_t GpsMeasurementState; #define GPS_MEASUREMENT_STATE_UNKNOWN 0 @@ -341,6 +336,7 @@ typedef uint16_t GpsMeasurementState; #define GPS_MEASUREMENT_STATE_BIT_SYNC (1<<1) #define GPS_MEASUREMENT_STATE_SUBFRAME_SYNC (1<<2) #define GPS_MEASUREMENT_STATE_TOW_DECODED (1<<3) +#define GPS_MEASUREMENT_STATE_MSEC_AMBIGUOUS (1<<4) /** * Flags indicating the Accumulated Delta Range's states. @@ -352,7 +348,7 @@ typedef uint16_t GpsAccumulatedDeltaRangeState; #define GPS_ADR_STATE_CYCLE_SLIP (1<<2) /** - * Enumeration of available values to indicate the available GPS Natigation message types. + * Enumeration of available values to indicate the available GPS Navigation message types. */ typedef uint8_t GpsNavigationMessageType; /** The message type is unknown. */ @@ -366,6 +362,19 @@ typedef uint8_t GpsNavigationMessageType; /** CNAV-2 message contained in the structure. */ #define GPS_NAVIGATION_MESSAGE_TYPE_CNAV2 4 +/** + * Status of Navigation Message + * When a message is received properly without any parity error in its navigation words, the + * status should be set to NAV_MESSAGE_STATUS_PARITY_PASSED. But if a message is received + * with words that failed parity check, but GPS is able to correct those words, the status + * should be set to NAV_MESSAGE_STATUS_PARITY_REBUILT. + * No need to send any navigation message that contains words with parity error and cannot be + * corrected. + */ +typedef uint16_t NavigationMessageStatus; +#define NAV_MESSAGE_STATUS_UNKONW 0 +#define NAV_MESSAGE_STATUS_PARITY_PASSED (1<<0) +#define NAV_MESSAGE_STATUS_PARITY_REBUILT (1<<1) /** * Name for the GPS XTRA interface. @@ -398,6 +407,11 @@ typedef uint8_t GpsNavigationMessageType; #define AGPS_RIL_INTERFACE "agps_ril" /** + * The GPS chipset can use Psc for AGPS. + */ +#define AGPS_USE_PSC + +/** * Name for the GPS_Geofencing interface. */ #define GPS_GEOFENCING_INTERFACE "gps_geofencing" @@ -417,11 +431,6 @@ typedef uint8_t GpsNavigationMessageType; */ #define GNSS_CONFIGURATION_INTERFACE "gnss_configuration" -/** - * The GPS chipset can use Psc for AGPS. - */ -#define AGPS_USE_PSC - /** Represents a location. */ typedef struct { @@ -502,6 +511,7 @@ typedef struct { uint32_t used_in_fix_mask; } GpsSvStatus; + /* 2G and 3G */ /* In 3G lac is discarded */ typedef struct { @@ -627,6 +637,12 @@ typedef struct { * min_interval represents the time between fixes in milliseconds. * preferred_accuracy represents the requested fix accuracy in meters. * preferred_time represents the requested time to first fix in milliseconds. + * + * 'mode' parameter should be one of GPS_POSITION_MODE_MS_BASE + * or GPS_POSITION_MODE_STANDALONE. + * It is allowed by the platform (and it is recommended) to fallback to + * GPS_POSITION_MODE_MS_BASE if GPS_POSITION_MODE_MS_ASSISTED is passed in, and + * GPS_POSITION_MODE_MS_BASED is supported. */ int (*set_position_mode)(GpsPositionMode mode, GpsPositionRecurrence recurrence, uint32_t min_interval, uint32_t preferred_accuracy, uint32_t preferred_time); @@ -672,6 +688,12 @@ typedef struct { size_t (*get_internal_state)(char* buffer, size_t bufferSize); } GpsDebugInterface; +#pragma pack(push,4) +// We need to keep the alignment of this data structure to 4-bytes, to ensure that in 64-bit +// environments the size of this legacy definition does not collide with _v2. Implementations should +// be using _v2 and _v3, so it's OK to pay the 'unaligned' penalty in 64-bit if an old +// implementation is still in use. + /** Represents the status of AGPS. */ typedef struct { /** set to sizeof(AGpsStatus_v1) */ @@ -681,6 +703,8 @@ typedef struct { AGpsStatusValue status; } AGpsStatus_v1; +#pragma pack(pop) + /** Represents the status of AGPS augmented with a IPv4 address field. */ typedef struct { /** set to sizeof(AGpsStatus_v2) */ @@ -1337,7 +1361,6 @@ typedef struct { * * 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; @@ -1363,6 +1386,9 @@ typedef struct { * * The value contains the 'drift uncertainty' in it. * If the data is available 'flags' must contain GPS_CLOCK_HAS_DRIFT. + * + * If GpsMeasurement's 'flags' field contains GPS_MEASUREMENT_HAS_UNCORRECTED_PSEUDORANGE_RATE, + * it is encouraged that this field is also provided. */ double drift_nsps; @@ -1416,17 +1442,25 @@ typedef struct { * Received GPS Time-of-Week at the measurement time, in nanoseconds. * The value is relative to the beginning of the current GPS week. * - * Given the sync state of GPS receiver, per each satellite, valid range for this field can be: - * Searching : [ 0 ] : GPS_MEASUREMENT_STATE_UNKNOWN - * Ranging code lock : [ 0 1ms ] : GPS_MEASUREMENT_STATE_CODE_LOCK is set - * Bit sync : [ 0 20ms ] : GPS_MEASUREMENT_STATE_BIT_SYNC is set - * Subframe sync : [ 0 6ms ] : GPS_MEASUREMENT_STATE_SUBFRAME_SYNC is set - * TOW decoded : [ 0 1week ] : GPS_MEASUREMENT_STATE_TOW_DECODED is set + * Given the highest sync state that can be achieved, per each satellite, valid range for + * this field can be: + * Searching : [ 0 ] : GPS_MEASUREMENT_STATE_UNKNOWN + * C/A code lock : [ 0 1ms ] : GPS_MEASUREMENT_STATE_CODE_LOCK is set + * Bit sync : [ 0 20ms ] : GPS_MEASUREMENT_STATE_BIT_SYNC is set + * Subframe sync : [ 0 6s ] : GPS_MEASUREMENT_STATE_SUBFRAME_SYNC is set + * TOW decoded : [ 0 1week ] : GPS_MEASUREMENT_STATE_TOW_DECODED is set + * + * However, if there is any ambiguity in integer millisecond, + * GPS_MEASUREMENT_STATE_MSEC_AMBIGUOUS should be set accordingly, in the 'state' field. + * + * This value must be populated if 'state' != GPS_MEASUREMENT_STATE_UNKNOWN. */ int64_t received_gps_tow_ns; /** * 1-Sigma uncertainty of the Received GPS Time-of-Week in nanoseconds. + * + * This value must be populated if 'state' != GPS_MEASUREMENT_STATE_UNKNOWN. */ int64_t received_gps_tow_uncertainty_ns; @@ -1440,11 +1474,23 @@ typedef struct { /** * 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 correction of a given Pseudorange Rate value includes corrections for receiver and + * satellite clock frequency errors. + * + * If GPS_MEASUREMENT_HAS_UNCORRECTED_PSEUDORANGE_RATE is set in 'flags' field, this field must + * be populated with the 'uncorrected' reading. + * If GPS_MEASUREMENT_HAS_UNCORRECTED_PSEUDORANGE_RATE is not set in 'flags' field, this field + * must be populated with the 'corrected' reading. This is the default behavior. + * + * It is encouraged to provide the 'uncorrected' 'pseudorange rate', and provide GpsClock's + * 'drift' field as well. * * The value includes the 'pseudorange rate uncertainty' in it. - * A positive value indicates that the pseudorange is getting larger. + * A positive 'uncorrected' value indicates that the SV is moving away from the receiver. + * + * The sign of the 'uncorrected' 'pseudorange rate' and its relation to the sign of 'doppler + * shift' is given by the equation: + * pseudorange rate = -k * doppler shift (where k is a constant) * * This is a Mandatory value. */ @@ -1468,13 +1514,21 @@ typedef struct { /** * Accumulated delta range since the last channel reset in meters. - * The data is available if 'accumulated delta range state' != GPS_ADR_STATE_UNKNOWN. + * A positive value indicates that the SV is moving away from the receiver. + * + * The sign of the 'accumulated delta range' and its relation to the sign of 'carrier phase' + * is given by the equation: + * accumulated delta range = -k * carrier phase (where k is a constant) + * + * This value must be populated if 'accumulated delta range state' != GPS_ADR_STATE_UNKNOWN. + * However, it is expected that the data is only accurate when: + * 'accumulated delta range state' == GPS_ADR_STATE_VALID. */ double accumulated_delta_range_m; /** * 1-Sigma uncertainty of the accumulated delta range in meters. - * The data is available if 'accumulated delta range state' != GPS_ADR_STATE_UNKNOWN. + * This value must be populated if 'accumulated delta range state' != GPS_ADR_STATE_UNKNOWN. */ double accumulated_delta_range_uncertainty_m; @@ -1711,6 +1765,13 @@ typedef struct { GpsNavigationMessageType type; /** + * The status of the received navigation message. + * No need to send any navigation message that contains words with parity error and cannot be + * corrected. + */ + NavigationMessageStatus status; + + /** * Message identifier. * It provides an index so the complete Navigation Message can be assembled. i.e. fo L1 C/A * subframe 4 and 5, this value corresponds to the 'frame id' of the navigation message. diff --git a/include/telephony/ril.h b/include/telephony/ril.h index 572aa46..1b0374a 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,25 @@ 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_E_LCE_NOT_SUPPORTED = 36 /* LCE service not supported(36 in RILConstants.java) */ + + } RIL_Errno; typedef enum { @@ -109,9 +163,66 @@ 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, + RADIO_TECH_IWLAN = 18 } 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 +321,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 +328,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 +350,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 +505,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 */ @@ -372,6 +567,27 @@ typedef struct { */ } RIL_NeighboringCell; +typedef struct { + char lce_status; /* LCE service status: + * -1 = not supported; + * 0 = stopped; + * 1 = active. + */ + unsigned int actual_interval_ms; /* actual LCE reporting interval, + * meaningful only if LCEStatus = 1. + */ +} RIL_LceStatusInfo; + +typedef struct { + unsigned int last_hop_capacity_kbps; /* last-hop cellular capacity: kilobits/second. */ + unsigned char confidence_level; /* capacity estimate confidence: 0-100 */ + unsigned char lce_suspended; /* LCE report going to be suspended? (e.g., radio + * moves to inactive state or network type change) + * 1 = suspended; + * 0 = not suspended. + */ +} RIL_LceDataInfo; + /* See RIL_REQUEST_LAST_CALL_FAIL_CAUSE */ typedef enum { CALL_FAIL_UNOBTAINABLE_NUMBER = 1, @@ -383,6 +599,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, @@ -397,6 +616,11 @@ typedef enum { CALL_FAIL_ERROR_UNSPECIFIED = 0xffff } RIL_LastCallFailCause; +typedef struct { + RIL_LastCallFailCause cause_code; + char * vendor_cause; +} RIL_LastCallFailCauseInfo; + /* See RIL_REQUEST_LAST_DATA_CALL_FAIL_CAUSE */ typedef enum { PDP_FAIL_NONE = 0, /* No error, connection ok */ @@ -418,7 +642,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 +670,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 +978,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 +1006,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 +1056,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 +1090,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 +1124,7 @@ typedef struct { RIL_CellInfoCdma cdma; RIL_CellInfoLte lte; RIL_CellInfoWcdma wcdma; + RIL_CellInfoTdscdma tdscdma; } CellInfo; } RIL_CellInfo; @@ -981,6 +1242,203 @@ 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; + +/* Tx Power Levels */ +#define RIL_NUM_TX_POWER_LEVELS 5 + +typedef struct { + + /* period (in ms) when modem is power collapsed */ + uint32_t sleep_mode_time_ms; + + /* period (in ms) when modem is awake and in idle mode*/ + uint32_t idle_mode_time_ms; + + /* period (in ms) for which Tx is active */ + uint32_t tx_mode_time_ms[RIL_NUM_TX_POWER_LEVELS]; + + /* period (in ms) for which Rx is active */ + uint32_t rx_mode_time_ms; +} RIL_ActivityStatsInfo; + /** * RIL_REQUEST_GET_SIM_STATUS * @@ -1017,7 +1475,6 @@ typedef struct { #define RIL_REQUEST_ENTER_SIM_PIN 2 - /** * RIL_REQUEST_ENTER_SIM_PUK * @@ -1195,6 +1652,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 +2190,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 +2258,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 +2296,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 +2314,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 +2340,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 +2359,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 +2388,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 +2410,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 +2555,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 +2587,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 +2612,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 +2835,9 @@ typedef struct { * Valid errors: * SUCCESS * RADIO_NOT_AVAILABLE (radio resetting) + * SS_MODIFIED_TO_DIAL + * SS_MODIFIED_TO_USSD + * SS_MODIFIED_TO_SS * GENERIC_FAILURE */ @@ -3580,7 +4073,402 @@ 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 + * + * The request is DEPRECATED, use RIL_REQUEST_GET_ACTIVITY_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 + * + * The request is DEPRECATED + * This is the minimum number of milliseconds between successive + * RIL_UNSOL_DC_RT_INFO_CHANGED messages and defines the highest rate + * at which RIL_UNSOL_DC_RT_INFO_CHANGED's will be sent. A value of + * 0 means send as fast as possible. + * + * "data" The number of milliseconds as an int + * + * "response" is null + * + * Valid errors: + * SUCCESS must not fail + */ +#define RIL_REQUEST_SET_DC_RT_INFO_RATE 127 + +/** + * RIL_REQUEST_SET_DATA_PROFILE + * + * Set data profile in modem + * Modem should erase existed profiles from framework, and apply new profiles + * "data" is an const RIL_DataProfileInfo ** + * "datalen" is count * sizeof(const RIL_DataProfileInfo *) + * "response" is NULL + * + * Valid errors: + * SUCCESS + * RADIO_NOT_AVAILABLE (radio resetting) + * GENERIC_FAILURE + * SUBSCRIPTION_NOT_AVAILABLE + */ +#define RIL_REQUEST_SET_DATA_PROFILE 128 + +/** + * RIL_REQUEST_SHUTDOWN + * + * Device is shutting down. All further commands are ignored + * and RADIO_NOT_AVAILABLE must be returned. + * + * "data" is null + * "response" is NULL + * + * Valid errors: + * SUCCESS + * RADIO_NOT_AVAILABLE + * GENERIC_FAILURE + */ +#define RIL_REQUEST_SHUTDOWN 129 + +/** + * RIL_REQUEST_GET_RADIO_CAPABILITY + * + * Used to get phone radio capablility. + * + * "data" is the RIL_RadioCapability structure + * + * 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 + +/** + * RIL_REQUEST_START_LCE + * + * Start Link Capacity Estimate (LCE) service if supported by the radio. + * + * "data" is const int * + * ((const int*)data)[0] specifies the desired reporting interval (ms). + * ((const int*)data)[1] specifies the LCE service mode. 1: PULL; 0: PUSH. + * + * "response" is the RIL_LceStatusInfo. + * + * Valid errors: + * SUCCESS + * RADIO_NOT_AVAILABLE + * LCE_NOT_SUPPORTED + */ +#define RIL_REQUEST_START_LCE 132 + +/** + * RIL_REQUEST_STOP_LCE + * + * Stop Link Capacity Estimate (LCE) service, the STOP operation should be + * idempotent for the radio modem. + * + * "response" is the RIL_LceStatusInfo. + * + * Valid errors: + * SUCCESS + * RADIO_NOT_AVAILABLE + * LCE_NOT_SUPPORTED + */ +#define RIL_REQUEST_STOP_LCE 133 + +/** + * RIL_REQUEST_PULL_LCEDATA + * + * Pull LCE service for capacity information. + * + * "response" is the RIL_LceDataInfo. + * + * Valid errors: + * SUCCESS + * RADIO_NOT_AVAILABLE + * LCE_NOT_SUPPORTED + */ +#define RIL_REQUEST_PULL_LCEDATA 134 + +/** + * RIL_REQUEST_GET_ACTIVITY_INFO + * + * Get modem activity statisitics info. + * + * There can be multiple RIL_REQUEST_GET_ACTIVITY_INFO calls to modem. + * Once the response for the request is sent modem will clear + * current statistics information. + * + * "data" is null + * "response" is const RIL_ActivityStatsInfo * + * + * Valid errors: + * + * SUCCESS + * RADIO_NOT_AVAILABLE (radio resetting) + * GENERIC_FAILURE + */ +#define RIL_REQUEST_GET_ACTIVITY_INFO 135 + /* SAMSUNG REQUESTS */ +#undef RIL_REQUEST_SIM_OPEN_CHANNEL +#undef RIL_REQUEST_SIM_CLOSE_CHANNEL + #define RIL_REQUEST_GET_CELL_BROADCAST_CONFIG 10002 #define RIL_REQUEST_SEND_ENCODED_USSD 10005 @@ -3768,7 +4656,6 @@ typedef struct { */ #define RIL_UNSOL_ON_USSD_REQUEST 1007 - /** * RIL_UNSOL_NITZ_TIME_RECEIVED * @@ -4137,6 +5024,101 @@ 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 + * + * The message is DEPRECATED, use RIL_REQUEST_GET_ACTIVITY_INFO + * Sent when the DC_RT_STATE changes but the time + * between these messages must not be less than the + * value set by RIL_REQUEST_SET_DC_RT_RATE. + * + * "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 + +/** + * RIL_UNSOL_LCEDATA_RECV + * + * Called when there is an incoming Link Capacity Estimate (LCE) info report. + * + * "data" is the RIL_LceDataInfo structure. + * + */ +#define RIL_UNSOL_LCEDATA_RECV 1045 + /* SAMSUNG RESPONSE */ #define SAMSUNG_UNSOL_RESPONSE_BASE 11000 @@ -4175,6 +5157,28 @@ typedef struct { /***********************************************************************/ +#if defined(ANDROID_MULTI_SIM) +/** + * RIL_Request Function pointer + * + * @param request is one of RIL_REQUEST_* + * @param data is pointer to data defined for that RIL_REQUEST_* + * data is owned by caller, and should not be modified or freed by callee + * @param t should be used in subsequent call to RIL_onResponse + * @param datalen the length of data + * + */ +typedef void (*RIL_RequestFunc) (int request, void *data, + size_t datalen, RIL_Token t, RIL_SOCKET_ID socket_id); + +/** + * This function should return the current radio state synchronously + */ +typedef RIL_RadioState (*RIL_RadioStateRequest)(RIL_SOCKET_ID socket_id); + +#else +/* Backward compatible */ + /** * RIL_Request Function pointer * @@ -4193,6 +5197,9 @@ typedef void (*RIL_RequestFunc) (int request, void *data, */ typedef RIL_RadioState (*RIL_RadioStateRequest)(); +#endif + + /** * This function returns "1" if the specified RIL_REQUEST code is * supported and 0 if it is not @@ -4248,6 +5255,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 +5280,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 +5347,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 +5356,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/libdmitry/Android.mk b/libdmitry/Android.mk new file mode 100755 index 0000000..5457c8b --- /dev/null +++ b/libdmitry/Android.mk @@ -0,0 +1,26 @@ +# Copyright (C) 2015 The Android Open Source Project
+# Written by Dmitry Grinberg
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+
+LOCAL_PATH := $(call my-dir)
+
+
+include $(CLEAR_VARS)
+
+LOCAL_SHARED_LIBRARIES := liblog libcutils libgui libbinder libutils
+LOCAL_SRC_FILES := libdmitry.c
+LOCAL_MODULE := libdmitry
+LOCAL_MODULE_TAGS := optional
+include $(BUILD_SHARED_LIBRARY)
\ No newline at end of file diff --git a/libdmitry/libdmitry.c b/libdmitry/libdmitry.c new file mode 100755 index 0000000..6472263 --- /dev/null +++ b/libdmitry/libdmitry.c @@ -0,0 +1,207 @@ +#define LOG_TAG "libdmitry"
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <pthread.h>
+#include <utils/Log.h>
+#include <hardware/power.h>
+#include <hardware/hardware.h>
+
+/*
+ * CURIOUS WHAT THE HELL IS GOING ON IN HERE? READ UP...
+ *
+ *
+ * Problems:
+ * 1. Nexus 10's GPS library was made to work with android L
+ * 2. Android M changed a few things around that make it not work
+ * a. Sensor manager API changed in a few places
+ * b. BoringSSL replaced OpenSSL
+ * 3. Due to these now-missing unresolved symbols GPS library will not load or run
+ *
+ * Curious data snippets
+ * Due to peculiarities of the ELF format, when a binary baz imports function foo() from libbar.so,
+ * nowhere in baz's ELF file does it say that foo() must from from libbar. In fact there are two
+ * separate records. One that says that libbar is "NEED"ed, and another that says that there is an
+ * import of function "foo". What that means is that if the process wer to also load libxyz, which
+ * also exported foo(), there is no way to be sure which foo() would get called. Why do we care?
+ * Well, consider out problems above. We need to provide functions and variables that existing
+ * libraries no longer do. How?
+ *
+ * A tricky but clever solution: INTERPOSITION library
+ * 1. We'll edit the GPS library and replace one of its "NEED" record with one referencing a new library
+ * which we'll create. Need a library name? why not "lidmitry"?
+ * 2. Make sure that lidmitry's NEED records include the library whose record we replaced in the GPS
+ * library, to make sure that the linker brings it in afterall and all symbols in it are found
+ * 3. Implement libdmitry such that it provides the missing things and does them in such a way that the
+ * GPS library is happy.
+ * 4. Complications exist:
+ * a. This would be impossible to do in C++, as the compiler would barf at us implementing random
+ * chunks of random classes we do not control. Luckily, the linker has no idea about C++, C, or other
+ * such things. C++ names get converted to special symbol names by the compiler, and thus the linker
+ * is neevr even aware of overloading or such things. This process is called mangling. So we'll just
+ * export the C++ functions we need with the proper mangled names, and code them in C. This means
+ * that we need to follow the proper calling conventions by hand, etc. With some dissasembling to see
+ * how GCC does it, we can duplicate it here, as I did.
+ * b. Not all missing things are functions. There are a few variables that need to be exported and are
+ * not present in M's code. We have to provide them. Luckily, just like with functions, as long as our
+ * mandled name matches, the linker will be happy to make the connection for us.
+ * c. Some cleanup may be needed on exit. Luckily, there is a way to register functions to be called
+ * upon library load and unload. I use that here to free some state that may be left over on exit.
+ *
+ * Result: GPS library works on M, with the help of libdmitry and a small binary patch to the GPS
+ * library itself (replacing one of the "NEED" records with a NEED record for "libdmitry"
+ */
+
+
+
+
+
+
+
+//various funcs we'll need to call, in their mangled form
+
+ //android::String8::String8(char const*)
+ extern void _ZN7android7String8C1EPKc(void **str8P, const char *str);
+
+ //android::String8::~String8()
+ extern void _ZN7android7String8D1Ev(void **str8P);
+
+ //android::String16::String16(char const*)
+ extern void _ZN7android8String16C1EPKc(void **str16P, const char *str);
+
+ //android::String16::~String16()
+ extern void _ZN7android8String16D1Ev(void **str16P);
+
+ //android::SensorManager::~SensorManager()
+ extern void _ZN7android13SensorManagerD1Ev(void *sensorMgr);
+
+ //android::SensorManager::SensorManager(android::String16 const&)
+ extern void _ZN7android13SensorManagerC1ERKNS_8String16E(void *sensorMgr, void **str16P);
+
+ //android::SensorManager::createEventQueue(android::String8, int)
+ extern void _ZN7android13SensorManager16createEventQueueENS_7String8Ei(void **retVal, void *sensorMgr, void **str8P, int mode);
+
+
+//data exports we must provide for gps library to be happy
+
+ /*
+ * DATA: android::Singleton<android::SensorManager>::sLock
+ * USE: INTERPOSE: a mutes that GPS lib will insist on accessing
+ * NOTES: In L, the sensor manager exposed this lock that callers
+ * actually locked & unlocked when accessing it. In M this
+ * is no longer the case, but we still must provide it for
+ * the GPS library to be happy. It will lock nothnhing, but
+ * as long as it is a real lock and pthread_mutex_* funcs
+ * work on it, the GPS library will be happy.
+ */
+ pthread_mutex_t _ZN7android9SingletonINS_13SensorManagerEE5sLockE = PTHREAD_MUTEX_INITIALIZER;
+
+ /*
+ * DATA: android::Singleton<android::SensorManager>::sInstance
+ * USE: INTERPOSE: a singleton instance of SensorManager
+ * NOTES: In L, the sensor manager exposed this variable, as it was
+ * a singleton and one could just access this directly to get
+ * the current already-existing instance if it happened to
+ * already exist. If not one would create one and store it
+ * there. In M this is entirely different, but the GPS library
+ * does not know that. So we'll init it to NULL to signify that
+ * no current instance exists, let it create one, and store it
+ * here, and upon unloading we'll clean it up, if it is not
+ * NULL (which is what it would be if the GPS library itself
+ * did the cleanup).
+ */
+ void* _ZN7android9SingletonINS_13SensorManagerEE9sInstanceE = NULL;
+
+
+//code exports we provide
+
+ //android::SensorManager::SensorManager(void)
+ void _ZN7android13SensorManagerC1Ev(void *sensorMgr);
+
+ //android::SensorManager::createEventQueue(void)
+ void _ZN7android13SensorManager16createEventQueueEv(void **retVal, void *sensorMgr);
+
+ //this used to exist in OpenSLL, but does not in BoringSSL - for some reason GPS library uses it anyways
+ void *CRYPTO_malloc(uint32_t sz, const char *file, uint32_t line);
+
+
+//library on-load and on-unload handlers (to help us set things up and tear them down)
+ void libEvtLoading(void) __attribute__((constructor));
+ void libEvtUnloading(void) __attribute__((destructor));
+
+
+/*
+ * FUNCTION: android::SensorManager::SensorManager(void)
+ * USE: INTERPOSE: construct a sensor manager object
+ * NOTES: This constructor no longer exists in M, instead now one must pass
+ * in a package name as a "string16" to the consrtuctor. Since this
+ * lib only services GPS library, it is easy for us to just do that
+ * and this provide the constructor that the GPS library wants.
+ * The package name we use if "gps.default". Why not?
+ */
+void _ZN7android13SensorManagerC1Ev(void *sensorMgr)
+{
+ void *string;
+
+ _ZN7android8String16C1EPKc(&string, "gps.default");
+ _ZN7android13SensorManagerC1ERKNS_8String16E(sensorMgr, &string);
+ _ZN7android8String16D1Ev(&string);
+}
+
+/*
+ * FUNCTION: android::SensorManager::createEventQueue(void)
+ * USE: INTERPOSE: create an event queue to receive events
+ * NOTES: This function no longer exists in M, instead now one must pass
+ * in a client name as a "string8" and an integer "mode"to it. M
+ * sources list default values for these params as an empty string
+ * and 0. So we'll craft the same call here.
+ */
+void _ZN7android13SensorManager16createEventQueueEv(void **retVal, void *sensorMgr)
+{
+ void *string;
+
+ _ZN7android7String8C1EPKc(&string, "");
+ _ZN7android13SensorManager16createEventQueueENS_7String8Ei(retVal, sensorMgr, &string, 0);
+ _ZN7android7String8D1Ev(&string);
+}
+
+/*
+ * FUNCTION: CRYPTO_malloc(uint32_t sz, const char *file, uint32_t line)
+ * USE: INTERPOSE: Allocate memory
+ * NOTES: In OpenSSL, this just allocates memory and optionally tracks it.
+ * Why manta's GPS library chose to use it is a mystery, but to make
+ * it happy we must provide it, so we do, backing the allocation with
+ * a calloc()-ed memory chunk.
+ */
+void *CRYPTO_malloc(uint32_t sz, const char *file, uint32_t line)
+{
+ (void)file;
+ (void)line;
+ return calloc(sz, 1);
+}
+
+/*
+ * FUNCTION: libEvtLoading()
+ * USE: Handle library loading
+ * NOTES: This is a good time to log the fact that we were loaded and plan to
+ * do our thing.
+ */
+void libEvtLoading(void)
+{
+ ALOGI("Nexus 10 GPS interposition library loaded. Your GPS should work in M now.");
+}
+
+/*
+ * FUNCTION: libEvtUnloading()
+ * USE: Handle library unloading
+ * NOTES: This is a good time to free whatever is unfreed and say goodbye
+ */
+void libEvtUnloading(void)
+{
+ ALOGI("Nexus 10 GPS interposition library unloading. Goodbye...");
+ if (_ZN7android9SingletonINS_13SensorManagerEE9sInstanceE) {
+ //if an instance stil exists, free it by calling the destructor, just to be throrough
+ _ZN7android13SensorManagerD1Ev(_ZN7android9SingletonINS_13SensorManagerEE9sInstanceE);
+ _ZN7android9SingletonINS_13SensorManagerEE9sInstanceE = NULL;
+ }
+}
\ No newline at end of file diff --git a/libsamsung_symbols/Android.mk b/libsamsung_symbols/Android.mk new file mode 100644 index 0000000..c2e942e --- /dev/null +++ b/libsamsung_symbols/Android.mk @@ -0,0 +1,28 @@ +# Copyright (C) 2015 The CyanogenMod Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +LOCAL_PATH := $(call my-dir) + +include $(CLEAR_VARS) + +LOCAL_SRC_FILES := \ + samsung_ril.cpp + +LOCAL_SHARED_LIBRARIES := libbinder + +LOCAL_MODULE := libsamsung_symbols +LOCAL_MODULE_TAGS := optional +LOCAL_MODULE_CLASS := SHARED_LIBRARIES + +include $(BUILD_SHARED_LIBRARY) diff --git a/libsamsung_symbols/samsung_ril.cpp b/libsamsung_symbols/samsung_ril.cpp new file mode 100644 index 0000000..404616d --- /dev/null +++ b/libsamsung_symbols/samsung_ril.cpp @@ -0,0 +1,21 @@ +/* + * Copyright (C) 2015 The CyanogenMod Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* status_t Parcel::writeString16 */ +extern "C" int _ZN7android6Parcel13writeString16EPKDsj(); +extern "C" int _ZN7android6Parcel13writeString16EPKtj() { + return _ZN7android6Parcel13writeString16EPKDsj(); +} diff --git a/libsensors/AccelSensor.cpp b/libsensors/AccelSensor.cpp index 72334be..7b6ba67 100644 --- a/libsensors/AccelSensor.cpp +++ b/libsensors/AccelSensor.cpp @@ -21,7 +21,8 @@ #include <unistd.h> #include <dirent.h> #include <sys/select.h> -#include <utils/Log.h> +#include <cutils/log.h> +#include <cstring> #include "AccelSensor.h" @@ -31,6 +32,7 @@ AccelSensor::AccelSensor() : SensorBase(NULL, "accelerometer_sensor"), mEnabled(0), + mInputReader(4), mHasPendingEvent(false) { @@ -49,7 +51,7 @@ AccelSensor::AccelSensor() AccelSensor::~AccelSensor() { - ALOGD("AccelSensor::~AccelSensor()"); + // ALOGD("AccelSensor::~AccelSensor()"); if (mEnabled) { enable(0, 0); } @@ -61,11 +63,12 @@ int AccelSensor::setInitialState() } int AccelSensor::enable(int32_t handle, int en) { + int flags = en ? 1 : 0; int err; - if (en != mEnabled) { + if (flags != mEnabled) { err = sspEnable(LOGTAG, SSP_ACCEL, en); if(err >= 0){ - mEnabled = en; + mEnabled = flags; setInitialState(); return 0; @@ -88,17 +91,19 @@ int AccelSensor::setDelay(int32_t handle, int64_t ns) { int fd; - strcpy(&input_sysfs_path[input_sysfs_path_len], "acc_poll_delay"); + if (ns < 10000000) { + ns = 10000000; // Minimum on stock + } + + strcpy(&input_sysfs_path[input_sysfs_path_len], "poll_delay"); fd = open(input_sysfs_path, O_RDWR); if (fd >= 0) { char buf[80]; - sprintf(buf, "%lld", ns); // Some flooring to match stock value + sprintf(buf, "%lld", ns); write(fd, buf, strlen(buf)+1); close(fd); return 0; } - - ALOGD("AccelSensor: fail to set delay through %s.", input_sysfs_path); return -1; } @@ -146,6 +151,6 @@ int AccelSensor::readEvents(sensors_event_t* data, int count) mInputReader.next(); } - return numEventReceived; + return numEventReceived++; } diff --git a/libsensors/AkmSensor.cpp b/libsensors/AkmSensor.cpp index 8a87f65..d82e6f8 100644 --- a/libsensors/AkmSensor.cpp +++ b/libsensors/AkmSensor.cpp @@ -22,8 +22,11 @@ #include <dirent.h> #include <sys/select.h> #include <dlfcn.h> +#include <cstring> -#include <utils/Log.h> +#include "ak8973b.h" + +#include <cutils/log.h> #include "AkmSensor.h" #define LOGTAG "AkmSensor" @@ -78,6 +81,11 @@ AkmSensor::AkmSensor() memset(mPendingEvents, 0, sizeof(mPendingEvents)); + mPendingEvents[Accelerometer].version = sizeof(sensors_event_t); + mPendingEvents[Accelerometer].sensor = ID_A; + mPendingEvents[Accelerometer].type = SENSOR_TYPE_ACCELEROMETER; + mPendingEvents[Accelerometer].acceleration.status = SENSOR_STATUS_UNRELIABLE; + mPendingEvents[MagneticField].version = sizeof(sensors_event_t); mPendingEvents[MagneticField].sensor = ID_M; mPendingEvents[MagneticField].type = SENSOR_TYPE_MAGNETIC_FIELD; @@ -86,6 +94,19 @@ AkmSensor::AkmSensor() // read the actual value of all sensors if they're enabled already struct input_absinfo absinfo; short flags = 0; + + if (akm_is_sensor_enabled(SENSOR_TYPE_ACCELEROMETER)) { + mEnabled |= 1<<Accelerometer; + if (!ioctl(data_fd, EVIOCGABS(EVENT_TYPE_ACCEL_X), &absinfo)) { + mPendingEvents[Accelerometer].acceleration.x = absinfo.value * CONVERT_A_X; + } + if (!ioctl(data_fd, EVIOCGABS(EVENT_TYPE_ACCEL_Y), &absinfo)) { + mPendingEvents[Accelerometer].acceleration.y = absinfo.value * CONVERT_A_Y; + } + if (!ioctl(data_fd, EVIOCGABS(EVENT_TYPE_ACCEL_Z), &absinfo)) { + mPendingEvents[Accelerometer].acceleration.z = absinfo.value * CONVERT_A_Z; + } + } if (akm_is_sensor_enabled(SENSOR_TYPE_MAGNETIC_FIELD)) { mEnabled |= 1<<MagneticField; if (!ioctl(data_fd, EVIOCGABS(EVENT_TYPE_MAGV_X), &absinfo)) { @@ -117,6 +138,7 @@ int AkmSensor::enable(int32_t handle, int en) int what = -1; switch (handle) { + case ID_A: what = Accelerometer; break; case ID_M: what = MagneticField; break; case ID_O: what = Orientation; break; } @@ -163,6 +185,7 @@ int AkmSensor::setDelay(int32_t handle, int64_t ns) return -EINVAL; switch (handle) { + case ID_A: sensor_type = SENSOR_TYPE_ACCELEROMETER; break; case ID_M: sensor_type = SENSOR_TYPE_MAGNETIC_FIELD; break; } @@ -186,6 +209,24 @@ int AkmSensor::setDelay(int32_t handle, int64_t ns) } mDelays[what] = ns; + return update_delay(); +} + +int AkmSensor::update_delay() +{ + if (mEnabled) { + uint64_t wanted = -1LLU; + for (int i=0 ; i<numSensors ; i++) { + if (mEnabled & (1<<i)) { + uint64_t ns = mDelays[i]; + wanted = wanted < ns ? wanted : ns; + } + } + short delay = int64_t(wanted) / 1000000; + if (ioctl(dev_fd, ECS_IOCTL_APP_SET_DELAY, &delay)) { + return -errno; + } + } return 0; } @@ -270,5 +311,12 @@ void AkmSensor::processEvent(int code, int value) mPendingMask |= 1<<MagneticField; mPendingEvents[MagneticField].magnetic.z = value * CONVERT_M_Z; break; + case EVENT_TYPE_MAGV_ACC: + ALOGV("AkmSensor: MAGV_ACC=>%d", value); + mPendingMask |= 1<<MagneticField; + mPendingEvents[MagneticField].magnetic.status = value; + default: + ALOGV("AkmSensor: unkown REL event code=%d, value=%d", code, value); + break; } } diff --git a/libsensors/Android.mk b/libsensors/Android.mk index 1b8e721..47a90e5 100644 --- a/libsensors/Android.mk +++ b/libsensors/Android.mk @@ -27,8 +27,7 @@ LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw LOCAL_MODULE_TAGS := optional -LOCAL_CFLAGS := -DLOG_TAG=\"Sensors\" - +LOCAL_CFLAGS := -DALOG_TAG=\"Sensors\" LOCAL_SRC_FILES := \ sensors.cpp \ SensorBase.cpp \ diff --git a/libsensors/GyroSensor.cpp b/libsensors/GyroSensor.cpp index 5bccbc8..75a24ca 100644 --- a/libsensors/GyroSensor.cpp +++ b/libsensors/GyroSensor.cpp @@ -22,6 +22,7 @@ #include <dirent.h> #include <sys/select.h> #include <cutils/log.h> +#include <cstring> #include "GyroSensor.h" @@ -48,6 +49,7 @@ GyroSensor::GyroSensor() strcat(input_sysfs_path, input_name); strcat(input_sysfs_path, "/device/"); input_sysfs_path_len = strlen(input_sysfs_path); + enable(0, 1); } } @@ -77,11 +79,12 @@ int GyroSensor::setInitialState() { } int GyroSensor::enable(int32_t handle, int en) { + int flags = en ? 1 : 0; int err; - if (en != mEnabled) { + if (flags != mEnabled) { err = sspEnable(LOGTAG, SSP_GYRO, en); if(err >= 0){ - mEnabled = en; + mEnabled = flags; setInitialState(); return 0; @@ -99,7 +102,7 @@ int GyroSensor::setDelay(int32_t handle, int64_t ns) { int fd; - strcpy(&input_sysfs_path[input_sysfs_path_len], "gyro_poll_delay"); + strcpy(&input_sysfs_path[input_sysfs_path_len], "poll_delay"); fd = open(input_sysfs_path, O_RDWR); if (fd >= 0) { char buf[80]; diff --git a/libsensors/InputEventReader.cpp b/libsensors/InputEventReader.cpp index d5c2349..ab23a22 100644 --- a/libsensors/InputEventReader.cpp +++ b/libsensors/InputEventReader.cpp @@ -21,10 +21,11 @@ #include <sys/cdefs.h> #include <sys/types.h> +#include <cstring> #include <linux/input.h> -#include <utils/Log.h> +#include <cutils/log.h> #include "InputEventReader.h" diff --git a/libsensors/LightSensor.cpp b/libsensors/LightSensor.cpp index 4f2fad9..4423412 100644 --- a/libsensors/LightSensor.cpp +++ b/libsensors/LightSensor.cpp @@ -21,8 +21,9 @@ #include <unistd.h> #include <dirent.h> #include <sys/select.h> +#include <cstring> -#include <utils/Log.h> +#include <cutils/log.h> #include "LightSensor.h" @@ -48,6 +49,7 @@ LightSensor::LightSensor() strcat(input_sysfs_path, input_name); strcat(input_sysfs_path, "/device/"); input_sysfs_path_len = strlen(input_sysfs_path); + enable(0, 1); } } @@ -71,7 +73,7 @@ int LightSensor::setDelay(int32_t handle, int64_t ns) { int fd; - strcpy(&input_sysfs_path[input_sysfs_path_len], "light_poll_delay"); + strcpy(&input_sysfs_path[input_sysfs_path_len], "poll_delay"); fd = open(input_sysfs_path, O_RDWR); if (fd >= 0) { char buf[80]; @@ -85,11 +87,12 @@ int LightSensor::setDelay(int32_t handle, int64_t ns) int LightSensor::enable(int32_t handle, int en) { + int flags = en ? 1 : 0; int err; - if (en != mEnabled) { + if (flags != mEnabled) { err = sspEnable(LOGTAG, SSP_LIGHT, en); if(err >= 0){ - mEnabled = en; + mEnabled = flags; setInitialState(); return 0; diff --git a/libsensors/PressureSensor.cpp b/libsensors/PressureSensor.cpp index 93423a8..e77ee79 100644 --- a/libsensors/PressureSensor.cpp +++ b/libsensors/PressureSensor.cpp @@ -21,8 +21,9 @@ #include <unistd.h> #include <dirent.h> #include <sys/select.h> +#include <cstring> -#include <utils/Log.h> +#include <cutils/log.h> #include "PressureSensor.h" @@ -52,6 +53,7 @@ PressureSensor::PressureSensor() strcat(input_sysfs_path, input_name); strcat(input_sysfs_path, "/device/"); input_sysfs_path_len = strlen(input_sysfs_path); + enable(0, 1); } } @@ -95,7 +97,7 @@ int PressureSensor::setDelay(int32_t handle, int64_t ns) { int fd; - strcpy(&input_sysfs_path[input_sysfs_path_len], "pressure_poll_delay"); + strcpy(&input_sysfs_path[input_sysfs_path_len], "poll_delay"); fd = open(input_sysfs_path, O_RDWR); if (fd >= 0) { char buf[80]; diff --git a/libsensors/ProximitySensor.cpp b/libsensors/ProximitySensor.cpp index d06501e..ab7db13 100644 --- a/libsensors/ProximitySensor.cpp +++ b/libsensors/ProximitySensor.cpp @@ -22,8 +22,9 @@ #include <dirent.h> #include <sys/select.h> #include <stdio.h> +#include <cstring> -#include <utils/Log.h> +#include <cutils/log.h> #include "ProximitySensor.h" #include "SensorBase.h" @@ -48,6 +49,7 @@ ProximitySensor::ProximitySensor() strcat(input_sysfs_path, input_name); strcat(input_sysfs_path, "/device/"); input_sysfs_path_len = strlen(input_sysfs_path); + enable(0, 1); } } @@ -71,7 +73,7 @@ int ProximitySensor::setDelay(int32_t handle, int64_t ns) { int fd; - strcpy(&input_sysfs_path[input_sysfs_path_len], "prox_poll_delay"); + strcpy(&input_sysfs_path[input_sysfs_path_len], "poll_delay"); fd = open(input_sysfs_path, O_RDWR); if (fd >= 0) { char buf[80]; diff --git a/libsensors/SensorBase.cpp b/libsensors/SensorBase.cpp index 5c5b52d..5742ed2 100644 --- a/libsensors/SensorBase.cpp +++ b/libsensors/SensorBase.cpp @@ -21,8 +21,10 @@ #include <unistd.h> #include <dirent.h> #include <sys/select.h> +#include <pthread.h> +#include <cstring> -#include <utils/Log.h> +#include <cutils/log.h> #include <linux/input.h> @@ -30,6 +32,8 @@ /*****************************************************************************/ +static pthread_mutex_t sspEnableLock = PTHREAD_MUTEX_INITIALIZER; + SensorBase::SensorBase( const char* dev_name, const char* data_name) @@ -39,11 +43,6 @@ SensorBase::SensorBase( if (data_name) { data_fd = openInput(data_name); } - - if (!data_fd) - { - ALOGE("open device %s failed", dev_name); - } } SensorBase::~SensorBase() { @@ -89,7 +88,7 @@ bool SensorBase::hasPendingEvents() const { int64_t SensorBase::getTimestamp() { struct timespec t; t.tv_sec = t.tv_nsec = 0; - clock_gettime(CLOCK_MONOTONIC, &t); + clock_gettime(CLOCK_BOOTTIME, &t); return int64_t(t.tv_sec)*1000000000LL + t.tv_nsec; } @@ -146,30 +145,29 @@ int SensorBase::flush(int handle) int SensorBase::sspEnable(const char* sensorname, int sensorvalue, int en) { FILE* sspfile; - int oldvalue = 0; - int reset = 0; - int newvalue; - int fd; + int sspValue = 0; - sspfile = fopen(SSP_DEVICE_ENABLE, "r"); - fscanf(sspfile, "%d", &oldvalue); + pthread_mutex_lock(&sspEnableLock); + + sspfile = fopen(SSP_DEVICE_ENABLE, "r+"); + fscanf(sspfile, "%d", &sspValue); fclose(sspfile); - if(en) { - newvalue = oldvalue | sensorvalue; - } else { - newvalue = oldvalue & (~sensorvalue); - } - ALOGI("%s: name: %s sensor: %i old value: %x new value: %x ", __func__, sensorname, sensorvalue, oldvalue, newvalue); - if (sspWrite(newvalue)) - return -1; + if (en) + sspValue |= sensorvalue; else - return 0; + sspValue &= ~sensorvalue; + + sspWrite(sspValue); + + pthread_mutex_unlock(&sspEnableLock); + + return 0; } int SensorBase::sspWrite(int sensorvalue) { - char buf[10]; + char buf[12]; int fd, ret, err; sprintf(buf, "%d", sensorvalue); diff --git a/libsensors/SensorBase.h b/libsensors/SensorBase.h index 4476be0..aeac510 100644 --- a/libsensors/SensorBase.h +++ b/libsensors/SensorBase.h @@ -60,12 +60,11 @@ public: virtual int getFd() const; virtual int setDelay(int32_t handle, int64_t ns); virtual int enable(int32_t handle, int enabled) = 0; - static int sspEnable(const char* sensorname, int sensorvalue, int en); + int sspEnable(const char* sensorname, int sensorvalue, int en); + int sspWrite(int sensorvalue); virtual int batch(int handle, int flags, int64_t period_ns, int64_t timeout); virtual int flush(int handle); -private: - static int sspWrite(int sensorvalue); }; /*****************************************************************************/ diff --git a/libsensors/ak8973b.h b/libsensors/ak8973b.h new file mode 100644 index 0000000..9b7ab60 --- /dev/null +++ b/libsensors/ak8973b.h @@ -0,0 +1,51 @@ +/* + * Definitions for akm8973 compass chip. + */ +#ifndef AKM8973_H +#define AKM8973_H + +#include <linux/ioctl.h> + +#define AKM8973_I2C_NAME "ak8973b" + +#define AKMIO 0xA1 + +/* IOCTLs for AKM library */ +#define ECS_IOCTL_WRITE _IOW(AKMIO, 0x01, char*) +#define ECS_IOCTL_READ _IOWR(AKMIO, 0x02, char*) +#define ECS_IOCTL_RESET _IO(AKMIO, 0x03) +#define ECS_IOCTL_SET_MODE _IOW(AKMIO, 0x04, short) +#define ECS_IOCTL_GETDATA _IOR(AKMIO, 0x05, char[SENSOR_DATA_SIZE]) +#define ECS_IOCTL_SET_YPR _IOW(AKMIO, 0x06, short[12]) +#define ECS_IOCTL_GET_OPEN_STATUS _IOR(AKMIO, 0x07, int) +#define ECS_IOCTL_GET_CLOSE_STATUS _IOR(AKMIO, 0x08, int) +#define ECS_IOCTL_GET_DELAY _IOR(AKMIO, 0x30, int64_t) +#define ECS_IOCTL_GET_PROJECT_NAME _IOR(AKMIO, 0x0D, char[64]) +#define ECS_IOCTL_GET_MATRIX _IOR(AKMIO, 0x0E, short [4][3][3]) + +/* IOCTLs for APPs */ +#define ECS_IOCTL_APP_SET_MODE _IOW(AKMIO, 0x10, short) +#define ECS_IOCTL_APP_SET_MFLAG _IOW(AKMIO, 0x11, short) +#define ECS_IOCTL_APP_GET_MFLAG _IOW(AKMIO, 0x12, short) +#define ECS_IOCTL_APP_SET_AFLAG _IOW(AKMIO, 0x13, short) +#define ECS_IOCTL_APP_GET_AFLAG _IOR(AKMIO, 0x14, short) +#define ECS_IOCTL_APP_SET_TFLAG _IOR(AKMIO, 0x15, short) +#define ECS_IOCTL_APP_GET_TFLAG _IOR(AKMIO, 0x16, short) +#define ECS_IOCTL_APP_RESET_PEDOMETER _IO(AKMIO, 0x17) +#define ECS_IOCTL_APP_SET_DELAY _IOW(AKMIO, 0x18, int64_t) +#define ECS_IOCTL_APP_GET_DELAY ECS_IOCTL_GET_DELAY + +/* Set raw magnetic vector flag */ +#define ECS_IOCTL_APP_SET_MVFLAG _IOW(AKMIO, 0x19, short) + +/* Get raw magnetic vector flag */ +#define ECS_IOCTL_APP_GET_MVFLAG _IOR(AKMIO, 0x1A, short) + +struct akm8973_platform_data { + short layouts[4][3][3]; + char project_name[64]; + int gpio_RST; + int gpio_INT; +}; + +#endif diff --git a/libsensors/sensors.cpp b/libsensors/sensors.cpp index d5ee60c..e7e48ec 100644 --- a/libsensors/sensors.cpp +++ b/libsensors/sensors.cpp @@ -14,6 +14,8 @@ * limitations under the License. */ +#define ALOG_TAG "Sensors" + #include <hardware/sensors.h> #include <fcntl.h> #include <errno.h> @@ -22,6 +24,7 @@ #include <poll.h> #include <pthread.h> #include <stdlib.h> +#include <cstring> #include <linux/input.h> @@ -71,38 +74,38 @@ static const struct sensor_t sSensorList[] = { { "LSM330DLC Acceleration Sensor", "STMicroelectronics", 1, SENSORS_ACCELERATION_HANDLE, - SENSOR_TYPE_ACCELEROMETER, RANGE_A, CONVERT_A, 0.23f, 20000, 0, 0, - SENSOR_STRING_TYPE_ACCELEROMETER, 0, 0, SENSOR_FLAG_CONTINUOUS_MODE, { } }, + SENSOR_TYPE_ACCELEROMETER, RANGE_A, CONVERT_A, 0.23f, 20000, 0, 0, + SENSOR_STRING_TYPE_ACCELEROMETER, "", 0, SENSOR_FLAG_CONTINUOUS_MODE, { } }, { "AK8963C Magnetic field Sensor", "Asahi Kasei Microdevices", 1, SENSORS_MAGNETIC_FIELD_HANDLE, - SENSOR_TYPE_MAGNETIC_FIELD, 2000.0f, CONVERT_M, 6.8f, 16667, 0, 0, - SENSOR_STRING_TYPE_MAGNETIC_FIELD, 0, 0, SENSOR_FLAG_CONTINUOUS_MODE, { } }, + SENSOR_TYPE_MAGNETIC_FIELD, 2000.0f, CONVERT_M, 6.8f, 16667, 0, 0, + SENSOR_STRING_TYPE_MAGNETIC_FIELD, "", 0, SENSOR_FLAG_CONTINUOUS_MODE, { } }, { "AK8963C Orientation Sensor", "Asahi Kasei Microdevices", 1, SENSORS_ORIENTATION_HANDLE, - SENSOR_TYPE_ORIENTATION, 360.0f, CONVERT_O, 7.8f, 16667, 0, 0, - SENSOR_STRING_TYPE_ORIENTATION, 0, 200, SENSOR_FLAG_CONTINUOUS_MODE, { } }, + SENSOR_TYPE_ORIENTATION, 360.0f, CONVERT_O, 7.8f, 16667, 0, 0, + SENSOR_STRING_TYPE_ORIENTATION, "", 0, SENSOR_FLAG_CONTINUOUS_MODE, { } }, { "LSM330DLC Gyroscope Sensor", "STMicroelectronics", 1, SENSORS_GYROSCOPE_HANDLE, - SENSOR_TYPE_GYROSCOPE, RANGE_GYRO, CONVERT_GYRO, 6.1f, 1190, 0, 0, - SENSOR_STRING_TYPE_GYROSCOPE, 0, 200, SENSOR_FLAG_CONTINUOUS_MODE, { } }, + SENSOR_TYPE_GYROSCOPE, RANGE_GYRO, CONVERT_GYRO, 6.1f, 1190, 0, 0, + SENSOR_STRING_TYPE_GYROSCOPE, "", 0, SENSOR_FLAG_CONTINUOUS_MODE, { } }, { "BMP182 Pressure sensor", "Bosch", 1, SENSORS_PRESSURE_HANDLE, SENSOR_TYPE_PRESSURE, 1100.0f, 0.01f, 0.06f, 50000, 0, 0, - SENSOR_STRING_TYPE_PRESSURE, 0, 200, SENSOR_FLAG_CONTINUOUS_MODE, { } }, + SENSOR_STRING_TYPE_PRESSURE, "", 0, SENSOR_FLAG_CONTINUOUS_MODE, { } }, { "CM36651 Proximity Sensor", "Capella Microsystems", 1, SENSORS_PROXIMITY_HANDLE, SENSOR_TYPE_PROXIMITY, 5.0f, 5.0f, 0.75f, 0, 0, 0, - SENSOR_STRING_TYPE_PROXIMITY, 0, 0, SENSOR_FLAG_WAKE_UP | SENSOR_FLAG_ON_CHANGE_MODE, { } }, + SENSOR_STRING_TYPE_PROXIMITY, "", 0, SENSOR_FLAG_WAKE_UP, { } }, { "CM36651 Light Sensor", "Capella Microsystems", 1, SENSORS_LIGHT_HANDLE, - SENSOR_TYPE_LIGHT, 10240.0f, 1.0f, 0.75f, 0, 0, 0, - SENSOR_STRING_TYPE_LIGHT, 0, 0, SENSOR_FLAG_ON_CHANGE_MODE, { } }, + SENSOR_TYPE_LIGHT, 10240.0f, 1.0f, 0.75f, 0, 0, 0, + SENSOR_STRING_TYPE_LIGHT, "", 0, SENSOR_FLAG_CONTINUOUS_MODE, { } }, }; @@ -184,7 +187,7 @@ private: case ID_PR: return pressure; } - return -1; + return -EINVAL; } }; @@ -245,12 +248,10 @@ sensors_poll_context_t::~sensors_poll_context_t() { } int sensors_poll_context_t::activate(int handle, int enabled) { - if (!mInitialized) - return -EINVAL; + if (!mInitialized) return -EINVAL; int index = handleToDriver(handle); - ALOGI("Sensors: enable(%d) handle: %i (index:%i)", enabled, handle, index); - if (index < 0) - return -EINVAL; + //ALOGI("Sensors: handle: %i", handle); + if (index < 0) return index; int err = mSensors[index]->enable(handle, enabled); if (enabled && !err) { const char wakeMessage(WAKE_MESSAGE); diff --git a/libsensors/sensors.h b/libsensors/sensors.h index 5ad1b80..a415253 100644 --- a/libsensors/sensors.h +++ b/libsensors/sensors.h @@ -84,6 +84,7 @@ const int ssp_sensors[] = { #define EVENT_TYPE_MAGV_X ABS_RX // 3 #define EVENT_TYPE_MAGV_Y ABS_RY // 4 #define EVENT_TYPE_MAGV_Z ABS_RZ // 5 +#define EVENT_TYPE_MAGV_ACC ABS_WHEEL // 8 #define EVENT_TYPE_TEMPERATURE ABS_THROTTLE #define EVENT_TYPE_STEP_COUNT ABS_GAS @@ -22,11 +22,8 @@ LOCAL_PATH := device/samsung/n7100 # Overlay DEVICE_PACKAGE_OVERLAYS += $(LOCAL_PATH)/overlay -# This device is xhdpi. However the platform doesn't -# currently contain all of the bitmaps at xhdpi density so -# we do this little trick to fall back to the hdpi version -# if the xhdpi doesn't exist. -PRODUCT_AAPT_CONFIG := normal hdpi xhdpi +# Screen density +PRODUCT_AAPT_CONFIG := normal PRODUCT_AAPT_PREF_CONFIG := xhdpi # Init files @@ -38,26 +35,43 @@ PRODUCT_COPY_FILES += \ PRODUCT_COPY_FILES += \ $(LOCAL_PATH)/configs/tiny_hw.xml:system/etc/sound/t03g -# Camera Wrapper +# Camera PRODUCT_PACKAGES += \ - camera.smdk4x12 \ - libcameraservice + camera.smdk4x12 -# Sensors +# f2fs PRODUCT_PACKAGES += \ - sensorservice \ - sensors.smdk4x12 + fibmap.f2fs \ + fsck.f2fs \ + mkfs.f2fs + +# Busybox +PRODUCT_PACKAGES += \ + busybox # Gps PRODUCT_COPY_FILES += \ - $(LOCAL_PATH)/configs/gps.xml:system/etc/gps.xml + $(LOCAL_PATH)/configs/gps.xml:system/etc/gps.xml \ + $(LOCAL_PATH)/gps_daemon.sh:system/bin/gps_daemon.sh # Product specific Packages PRODUCT_PACKAGES += \ - libsecril-client \ - libsecril-client-sap \ + DeviceSettings \ SamsungServiceMode +# RIL & GPS fix +PRODUCT_PACKAGES += \ + ril-wrapper \ + libdmitry + +# Additional apps +PRODUCT_PACKAGES += \ + OpenDelta + +# Sensors +PRODUCT_PACKAGES += \ + sensors.smdk4x12 + # NFC PRODUCT_PACKAGES += \ nfc.exynos4 \ @@ -82,14 +96,19 @@ PRODUCT_COPY_FILES += \ $(NFCEE_ACCESS_PATH):system/etc/nfcee_access.xml PRODUCT_PACKAGES += \ - com.android.nfc_extras + com.android.nfc_extras \ + Stk $(call inherit-product, vendor/cm/config/nfc_enhanced.mk) +# Samsung symbols +PRODUCT_PACKAGES += \ + libsamsung_symbols + # 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 @@ -98,5 +117,12 @@ PRODUCT_COPY_FILES += \ frameworks/native/data/etc/handheld_core_hardware.xml:system/etc/permissions/handheld_core_hardware.xml \ frameworks/native/data/etc/android.hardware.telephony.gsm.xml:system/etc/permissions/android.hardware.telephony.gsm.xml +# Barometer +PRODUCT_COPY_FILES += \ + frameworks/native/data/etc/android.hardware.sensor.barometer.xml:system/etc/permissions/android.hardware.sensor.barometer.xml + +# Allow tethering without provisioning app +PRODUCT_PROPERTY_OVERRIDES += \ + net.tethering.noprovisioning=true $(call inherit-product-if-exists, vendor/samsung/n7100/n7100-vendor.mk) diff --git a/overlay/frameworks/base/Keyguard/res/values/config.xml b/overlay/frameworks/base/Keyguard/res/values/config.xml new file mode 100644 index 0000000..cf956e1 --- /dev/null +++ b/overlay/frameworks/base/Keyguard/res/values/config.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** Copyright 2009, The Android Open Source Project +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +*/ +--> + +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + + <!-- Disable Lockscreen Notifications dynamic width by default --> + <bool name="config_lnDynamicWidth">true</bool> + + <!-- Allow the menu hard key to be disabled in LockScreen on some devices --> + <bool name="config_disableMenuKeyInLockScreen">true</bool> + +</resources> diff --git a/overlay/frameworks/base/core/res/res/values/config.xml b/overlay/frameworks/base/core/res/res/values/config.xml index c5403cc..63c00c1 100644 --- a/overlay/frameworks/base/core/res/res/values/config.xml +++ b/overlay/frameworks/base/core/res/res/values/config.xml @@ -20,6 +20,119 @@ <!-- These resources are around just to allow their values to be customized for different hardware and product builds. Do not translate. --> <resources> + <!-- Whether a software navigation bar should be shown. NOTE: in the future this may be + autodetected from the Configuration. --> + <bool name="config_showNavigationBar">false</bool> + + <!-- Array of light sensor LUX values to define our levels for auto backlight brightness support. + The N entries of this array define N + 1 zones as follows: + + Zone 0: 0 <= LUX < array[0] + Zone 1: array[0] <= LUX < array[1] + ... + Zone N: array[N - 1] <= LUX < array[N] + Zone N + 1: array[N] <= LUX < infinity + + Must be overridden in platform specific overlays + --> + <integer-array name="config_autoBrightnessLevels"> + <item>150</item> + <item>300</item> + <item>600</item> + <item>1000</item> + <item>3000</item> + <item>8000</item> + <item>15000</item> + <item>28000</item> + <item>41000</item> + <item>54000</item> + <item>67000</item> + <item>80000</item> + <item>100000</item> + <item>150000</item> + <item>200000</item> + </integer-array> + + <!-- Array of output values for LCD backlight corresponding to the LUX values + in the config_autoBrightnessLevels array. This array should have size one greater + than the size of the config_autoBrightnessLevels array. + --> + <integer-array name="config_autoBrightnessLcdBacklightValues"> + <item>20</item> + <item>30</item> + <item>40</item> + <item>50</item> + <item>60</item> + <item>70</item> + <item>80</item> + <item>100</item> + <item>120</item> + <item>140</item> + <item>160</item> + <item>180</item> + <item>200</item> + <item>220</item> + <item>240</item> + <item>255</item> + </integer-array> + + <!-- Array of output values for button backlight corresponding to the LUX values + in the config_autoBrightnessLevels array. This array should have size one greater + than the size of the config_autoBrightnessLevels array. + --> + <integer-array name="config_autoBrightnessButtonBacklightValues"> + <item>0</item> + <item>0</item> + <item>0</item> + <item>0</item> + <item>0</item> + <item>0</item> + <item>0</item> + <item>0</item> + <item>0</item> + <item>0</item> + <item>0</item> + <item>0</item> + <item>0</item> + <item>0</item> + <item>0</item> + <item>0</item> + <item>0</item> + <item>0</item> + <item>0</item> + <item>0</item> + <item>0</item> + </integer-array> + + <!-- Array of output values for keyboard backlight corresponding to the LUX values + in the config_autoBrightnessLevels array. This array should have size one greater + than the size of the config_autoBrightnessLevels array. + n7100 has no keyboard so all values are zero. + --> + <integer-array name="config_autoBrightnessKeyboardBacklightValues"> + <item>0</item> + <item>0</item> + <item>0</item> + <item>0</item> + <item>0</item> + <item>0</item> + <item>0</item> + <item>0</item> + <item>0</item> + <item>0</item> + <item>0</item> + <item>0</item> + <item>0</item> + <item>0</item> + <item>0</item> + <item>0</item> + <item>0</item> + <item>0</item> + <item>0</item> + <item>0</item> + <item>0</item> + </integer-array> + <!-- XXXXX NOTE THE FOLLOWING RESOURCES USE THE WRONG NAMING CONVENTION. Please don't copy them, copy anything else. --> @@ -80,18 +193,27 @@ <!-- Is the notification LED intrusive? Used to decide if there should be a disable option --> <bool name="config_intrusiveNotificationLed">true</bool> + <!-- Does the notification LED support multiple colors? Used to decide if the user can change the colors --> + <bool name="config_multiColorNotificationLed">true</bool> + <!-- Is the battery LED intrusive? Used to decide if there should be a disable option --> <bool name="config_intrusiveBatteryLed">true</bool> <!-- Does the battery LED support multiple colors? Used to decide if the user can change the colors --> <bool name="config_multiColorBatteryLed">true</bool> + <!-- Default color for notification LED is white. --> + <color name="config_defaultNotificationColor">#ffffffff</color> + <!-- Default LED on time for notification LED in milliseconds. --> <integer name="config_defaultNotificationLedOn">1000</integer> <!-- Default LED off time for notification LED in milliseconds. --> <integer name="config_defaultNotificationLedOff">9000</integer> + <!-- Workaround for devices with broken keyboards + <bool name="config_forceDisableHardwareKeyboard">true</bool> --> + <!-- Allow the menu hard key to be disabled in LockScreen on some devices --> <bool name="config_disableMenuKeyInLockScreen">true</bool> @@ -106,7 +228,7 @@ 32 - Camera 64 - Volume rocker For example, a device with Home, Back and Menu keys would set this - config to 7. --> + config to 7. --> <integer name="config_deviceHardwareKeys">71</integer> <!-- Hardware keys present on the device with the ability to wake, stored as a bit field. @@ -123,15 +245,88 @@ config to 7. --> <integer name="config_deviceHardwareWakeKeys">65</integer> - <!-- Workaround for devices with broken keyboards --> - <bool name="config_forceDisableHardwareKeyboard">true</bool> + <!-- Control the behavior when the user long presses the home button. + 0 - Nothing + 1 - Menu key + 2 - Recent apps view in SystemUI + 3 - Launch assist intent + 4 - Voice Search + 5 - In-app Search + This needs to match the constants in + policy/src/com/android/internal/policy/impl/PhoneWindowManager.java --> + <integer name="config_longPressOnHomeBehavior">3</integer> + + <integer name="config_longPressOnMenuBehavior">2</integer> + + <!-- Control the behavior when the user double-taps the home button. + 0 - Nothing + 1 - Menu + 2 - Recent apps view in SystemUI + 3 - Launch assist intent + 4 - Voice Search + 5 - In-app Search + This needs to match the constants in + policy/src/com/android/internal/policy/impl/PhoneWindowManager.java --> + <integer name="config_doubleTapOnHomeBehavior">0</integer> <!-- Boolean to enable stk functionality on Samsung phones --> <bool name="config_samsung_stk">true</bool> - <!-- Boolean to enable stylus gestures --> - <!-- <bool name="config_stylusGestures">true</bool> --> + <!-- Boolean to enable stylus gestures --> + <bool name="config_stylusGestures">true</bool> + + <!-- Doze mode --> + <string name="config_dozeComponent">com.android.systemui/com.android.systemui.doze.DozeService</string> + <integer name="config_screenBrightnessDoze">20</integer> + <bool name="config_dozeAfterScreenOff">true</bool> + <bool name="config_powerDecoupleInteractiveModeFromDisplay">true</bool> + + <!-- Maximum number of supported users --> + <integer name="config_multiuserMaximumUsers">4</integer> + + <!-- Whether UI for multi user should be shown --> + <bool name="config_enableMultiUserUI">true</bool> + + <!-- Whether WiFi display is supported by this device. + There are many prerequisites for this feature to work correctly. + Here are a few of them: + * The WiFi radio must support WiFi P2P. + * The WiFi radio must support concurrent connections to the WiFi display and + to an access point. + * The Audio Flinger audio_policy.conf file must specify a rule for the "r_submix" + remote submix module. This module is used to record and stream system + audio output to the WiFi display encoder in the media server. + * The remote submix module "audio.r_submix.default" must be installed on the device. + * The device must be provisioned with HDCP keys (for protected content). + --> + <bool name="config_enableWifiDisplay">true</bool> + + <!-- Specifies whether the dreams feature should be supported. + When true, the system will allow the user to configure dreams (screensavers) + to launch when a user activity timeout occurs or the system is told to nap. + When false, the dreams feature will be disabled (this does not affect dozing). + Consider setting this resource to false or disabling dreams by default when a + doze component is specified below since dreaming will supercede dozing and + will prevent the system from entering a low power state until the dream ends. --> + <bool name="config_dreamsSupported">true</bool> + + <!-- If supported, are dreams enabled? (by default) --> + <bool name="config_dreamsEnabledByDefault">false</bool> + + <!-- Enable doze powersaving + <bool name="config_enableAutoPowerModes">true</bool> --> + + <!-- The RadioAccessFamilies supported by the device. + Empty is viewed as "all". Only used on devices which + don't support RIL_REQUEST_GET_RADIO_CAPABILITY + format is UMTS|LTE|... + --> + <string translatable="false" name="config_radio_access_family">GPRS|EDGE|WCDMA</string> + + <!-- Hardware keys on/off option --> + <bool name="config_hwKeysPref">true</bool> - <!-- Workaround for devices with broken keyboards --> - <bool name="config_forceDisableHardwareKeyboard">true</bool> + <!-- Older rotation sensors are not setting event.timestamp correctly. Setting to + true will use SystemClock.elapsedRealtimeNanos() to set timestamp. --> + <bool name="config_useSystemClockforRotationSensor">true</bool> </resources> diff --git a/overlay/frameworks/base/core/res/res/values/pa_config.xml b/overlay/frameworks/base/core/res/res/values/pa_config.xml new file mode 100644 index 0000000..63eba10 --- /dev/null +++ b/overlay/frameworks/base/core/res/res/values/pa_config.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** Copyright (C) 2014 ParanoidAndroid Project +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +*/ +--> + +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <!-- Camera flash + <bool name="config_device_has_camera_flash">true</bool> --> +</resources> diff --git a/overlay/frameworks/base/core/res/res/xml/storage_list.xml b/overlay/frameworks/base/core/res/res/xml/storage_list.xml deleted file mode 100644 index f98fbb0..0000000 --- a/overlay/frameworks/base/core/res/res/xml/storage_list.xml +++ /dev/null @@ -1,52 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- -** -** Copyright 2011, The Android Open Source Project -** -** Licensed under the Apache License, Version 2.0 (the "License") -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ ---> - -<!-- The <device> element should contain one or more <storage> elements. - Exactly one of these should have the attribute primary="true". - This storage will be the primary external storage and should have mountPoint="/mnt/sdcard". - Each storage should have both a mountPoint and storageDescription attribute. - The following attributes are optional: - - primary: (boolean) this storage is the primary external storage - removable: (boolean) this is removable storage (for example, a real SD card) - emulated: (boolean) the storage is emulated via the FUSE sdcard daemon - mtpReserve: (integer) number of megabytes of storage MTP should reserve for free storage - (used for emulated storage that is shared with system's data partition) - - A storage should not have both emulated and removable set to true ---> - -<StorageList xmlns:android="http://schemas.android.com/apk/res/android"> - <storage android:mountPoint="/storage/sdcard0" - android:storageDescription="@string/storage_internal" - android:primary="true" - android:emulated="true" - android:mtpReserve="100" /> - - <storage android:mountPoint="/storage/sdcard1" - android:storageDescription="@string/storage_sd_card" - android:primary="false" - android:removable="true" - android:allowMassStorage="true" /> - - <storage android:mountPoint="/storage/usbdisk0" - android:storageDescription="@string/storage_usb" - android:primary="false" - android:removable="true" /> -</StorageList>
\ No newline at end of file diff --git a/overlay/frameworks/base/packages/SystemUI/res/values/config.xml b/overlay/frameworks/base/packages/SystemUI/res/values/config.xml index 88851f7..49b1c81 100644 --- a/overlay/frameworks/base/packages/SystemUI/res/values/config.xml +++ b/overlay/frameworks/base/packages/SystemUI/res/values/config.xml @@ -22,5 +22,11 @@ <resources> <!-- Control whether status bar should distinguish HSPA data icon form UMTS data icon on devices --> <bool name="config_hspa_data_distinguishable">true</bool> + + <!-- Doze: does this device support STATE_DOZE and STATE_DOZE_SUSPEND? --> + <bool name="doze_display_state_supported">true</bool> + + <!-- Doze: should the pickup sensor be used as a pulse signal? --> + <bool name="doze_pulse_on_pick_up">true</bool> </resources> diff --git a/overlay/packages/services/Telephony/res/values/config.xml b/overlay/packages/apps/Camera2/res/values/config.xml index 230794e..b98eb58 100644 --- a/overlay/packages/services/Telephony/res/values/config.xml +++ b/overlay/packages/apps/Camera2/res/values/config.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- Copyright (C) 2009 The Android Open Source Project +<!-- Copyright (C) 2012 The Android Open Source Project Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -14,9 +14,9 @@ limitations under the License. --> -<!-- Phone app resources that may need to be customized +<!-- Camera app resources that may need to be customized for different hardware or product builds. --> <resources> - <!-- Determines if device implements a noise suppression device for in call audio--> - <bool name="has_in_call_noise_suppression">true</bool> + <!-- Use ZSL mode for Qualcomm cameras --> + <bool name="enableZSL">true</bool> </resources> diff --git a/overlay/packages/apps/Dialer/res/values/config.xml b/overlay/packages/apps/Dialer/res/values/config.xml new file mode 100644 index 0000000..b1c5a94 --- /dev/null +++ b/overlay/packages/apps/Dialer/res/values/config.xml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Copyright (C) 2014 The CyanogenMod Project + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<resources> + <integer name="call_recording_audio_source">4</integer> +</resources> diff --git a/overlay/packages/apps/Lightbulb/res/values/config.xml b/overlay/packages/apps/Lightbulb/res/values/config.xml new file mode 100644 index 0000000..1315b79 --- /dev/null +++ b/overlay/packages/apps/Lightbulb/res/values/config.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Copyright (C) 2014 ParanoidAndroid Project + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +--> +<resources> + <!-- Camera flash (App) --> + <bool name="camera_has_flash">true</bool> +</resources> diff --git a/overlay/packages/apps/Settings/res/values/bools.xml b/overlay/packages/apps/Settings/res/values/bools.xml new file mode 100644 index 0000000..88338eb --- /dev/null +++ b/overlay/packages/apps/Settings/res/values/bools.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Copyright (C) 2012 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. +--> + +<resources xmlns:xliff="urnasis:names:tc:xliff:document:1.2 "> + <!-- Whether or not the dock settings are to be displayed for this device when docked --> + <bool name="has_dock_settings">true</bool> +</resources> diff --git a/overlay/packages/apps/Settings/res/values/config.xml b/overlay/packages/apps/Settings/res/values/config.xml new file mode 100644 index 0000000..f10ae89 --- /dev/null +++ b/overlay/packages/apps/Settings/res/values/config.xml @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Copyright (C) 2012 The CyanogenMod Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<resources xmlns:xliff="urnasis:names:tc:xliff:document:1.2 "> + <!-- Home button wake support --> + <bool name="config_show_homeWake">true</bool> + + <!-- Volume Rocker Wake Support. Some devices do not support (PMU) this. + Setting to false will disable Volume Rocker Wake support --> + <bool name="config_show_volumeRockerWake">true</bool> + + <!-- Whether device has hardware buttons + <bool name="config_has_hardware_buttons">true</bool> --> + + <!-- Button settings enabled or disabled + <bool name="config_device_has_button_settings" translatable="false">true</bool> --> +</resources> diff --git a/overlay/packages/apps/Torch/res/values/config.xml b/overlay/packages/apps/Torch/res/values/config.xml deleted file mode 100644 index 98c882b..0000000 --- a/overlay/packages/apps/Torch/res/values/config.xml +++ /dev/null @@ -1,47 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - Copyright (C) 2013 The CyanogenMod Project - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - version 3 as published by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, - MA 02110-1301, USA. ---> - -<!-- These resources are around just to allow their values to be customized - for different hardware and product builds. --> -<resources> - <!-- If there is no sysfs-based control mechanism, enable this --> - <bool name="useCameraInterface">false</bool> - - <!-- Full path to the sysfs toggle --> - <string name="flashDevice">/sys/class/camera/flash/rear_flash</string> - <!-- Full path to the sysfs luminosity --> - <string name="flashDeviceLuminosity">/sys/class/camera/flash/rear_flash</string> - <!-- Full path to the 2nd sysfs luminosity, leave empty if doesn't exist --> - <string name="flashDeviceLuminosity2"></string> - - <!-- Off setting --> - <integer name="valueOff">0</integer> - <!-- On setting --> - <integer name="valueOn">1</integer> - - <!-- Low setting --> - <integer name="valueLow">32</integer> - <!-- Middle setting --> - <integer name="valueHigh">128</integer> - <!-- Highest setting, leave -1 if it doesn't exist --> - <integer name="valueDeathRay">-1</integer> - - <!-- If the device supports high brightness mode, enable this --> - <bool name="hasHighBrightness">false</bool> -</resources> diff --git a/proprietary-files.txt b/proprietary-files.txt index 9fa7cab..dbbb5cf 100644 --- a/proprietary-files.txt +++ b/proprietary-files.txt @@ -1,5 +1,5 @@ system/bin/gpsd -system/lib/hw/gps.exynos4.so +system/lib/hw/gps.default.so system/lib/libakm.so system/lib/libsec-ril.so system/usr/idc/sec_e-pen.idc diff --git a/recovery.fstab b/recovery.fstab new file mode 100644 index 0000000..47d1496 --- /dev/null +++ b/recovery.fstab @@ -0,0 +1,13 @@ +# mount point fstype device +/efs ext4 /dev/block/mmcblk0p3 +/boot emmc /dev/block/mmcblk0p8 +/recovery emmc /dev/block/mmcblk0p9 +/cache ext4 /dev/block/mmcblk0p12 +/system ext4 /dev/block/mmcblk0p13 +/data ext4 /dev/block/mmcblk0p16 length=-16384 +/preload ext4 /dev/block/mmcblk0p14 +/modem emmc /dev/block/mmcblk0p10 + +/sdcard datamedia /dev/null +/external_sd auto /dev/block/mmcblk1p1 /dev/block/mmcblk1 + diff --git a/ril-wrapper/Android.mk b/ril-wrapper/Android.mk new file mode 100644 index 0000000..698e1d3 --- /dev/null +++ b/ril-wrapper/Android.mk @@ -0,0 +1,9 @@ +LOCAL_PATH:= $(call my-dir) + +include $(CLEAR_VARS) + +LOCAL_SRC_FILES:= ril-wrapper.c +LOCAL_SHARED_LIBRARIES := liblog libbinder +LOCAL_MODULE:= ril-wrapper + +include $(BUILD_SHARED_LIBRARY) diff --git a/ril-wrapper/ril-wrapper.c b/ril-wrapper/ril-wrapper.c new file mode 100644 index 0000000..886cb34 --- /dev/null +++ b/ril-wrapper/ril-wrapper.c @@ -0,0 +1,99 @@ +#define LOG_TAG "RilWrapper" +#define RIL_SHLIB +#include <telephony/ril_cdma_sms.h> +#include <sys/system_properties.h> +#include <telephony/librilutils.h> +#include <cutils/sockets.h> +#include <telephony/ril.h> +#include <sys/socket.h> +#include <sys/types.h> +#include <sys/cdefs.h> +#include <utils/Log.h> +#include <sys/stat.h> +#include <pthread.h> +#include <termios.h> +#include <alloca.h> +#include <assert.h> +#include <getopt.h> +#include <string.h> +#include <unistd.h> +#include <dlfcn.h> +#include <errno.h> +#include <fcntl.h> +#include <stdio.h> + +#define REAL_RIL_NAME "/system/lib/libsec-ril.so" + + +static RIL_RadioFunctions const *mRealRadioFuncs; +static const struct RIL_Env *mEnv; + +static void rilOnRequest(int request, void *data, size_t datalen, RIL_Token t) +{ + switch (request) { + case RIL_REQUEST_GET_RADIO_CAPABILITY: + RLOGW("Returning NOT_SUPPORTED on GET_RADIO_CAPABILITY"); + mEnv->OnRequestComplete(t, RIL_E_REQUEST_NOT_SUPPORTED, NULL, 0); + break; + default: + mRealRadioFuncs->onRequest(request, data, datalen, t); + } +} + +const RIL_RadioFunctions* RIL_Init(const struct RIL_Env *env, int argc, char **argv) +{ + RIL_RadioFunctions const* (*fRealRilInit)(const struct RIL_Env *env, int argc, char **argv); + static RIL_RadioFunctions rilInfo; + void *realRilLibHandle; + int i; + + + //save the env; + mEnv = env; + + //get the real RIL + realRilLibHandle = dlopen(REAL_RIL_NAME, RTLD_LOCAL); + if (!realRilLibHandle) { + RLOGE("Failed to load the real RIL '" REAL_RIL_NAME "': %s\n", dlerror()); + return NULL; + } + + //remove "-c" command line as Samsung's RIL does not understand it - it just barfs instead + for (i = 0; i < argc; i++) { + if (!strcmp(argv[i], "-c") && i != argc -1) { //found it + memcpy(argv + i, argv + i + 2, sizeof(char*[argc - i - 2])); + argc -= 2; + } + } + + //load the real RIL + fRealRilInit = dlsym(realRilLibHandle, "RIL_Init"); + if (!fRealRilInit) { + RLOGE("Failed to find the real RIL's entry point\n"); + goto out_fail; + } + + RLOGD("Calling the real RIL's entry point with %u args\n", argc); + for (i = 0; i < argc; i++) + RLOGD(" argv[%2d] = '%s'\n", i, argv[i]); + + //try to init the real ril + mRealRadioFuncs = fRealRilInit(env, argc, argv); + if (!mRealRadioFuncs) { + RLOGE("The real RIL's entry point failed\n"); + goto out_fail; + } + + //copy the real RIL's info struct, then replace the onRequest pointer with our own + rilInfo = *mRealRadioFuncs; + rilInfo.onRequest = rilOnRequest; + + RLOGD("Wrapped RIL version is '%s'\n", mRealRadioFuncs->getVersion()); + + //we're all good - return to caller + return &rilInfo; + +out_fail: + dlclose(realRilLibHandle); + return NULL; +} diff --git a/ril/telephony/java/com/android/internal/telephony/SamsungExynos4RIL.java b/ril/telephony/java/com/android/internal/telephony/SamsungExynos4RIL.java deleted file mode 100644 index 6213528..0000000 --- a/ril/telephony/java/com/android/internal/telephony/SamsungExynos4RIL.java +++ /dev/null @@ -1,433 +0,0 @@ -/* - * 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; - - public SamsungExynos4RIL(Context context, int networkMode, int cdmaSubscription, Integer instanceid) { - super(context, networkMode, cdmaSubscription); - } - - 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); - } - - 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; - } - } - -} diff --git a/rootdir/fstab.smdk4x12 b/rootdir/fstab.smdk4x12 index 561c855..d2ea48c 100644 --- a/rootdir/fstab.smdk4x12 +++ b/rootdir/fstab.smdk4x12 @@ -6,12 +6,15 @@ /dev/block/mmcblk0p3 /efs ext4 noatime,nosuid,nodev,journal_async_commit,errors=panic wait /dev/block/mmcblk0p13 /system ext4 ro,noatime wait +/dev/block/mmcblk0p12 /cache f2fs noatime,discard,inline_xattr,inline_data,nosuid,nodev wait /dev/block/mmcblk0p12 /cache ext4 noatime,nosuid,nodev,journal_async_commit,errors=panic wait,check /dev/block/mmcblk0p14 /preload ext4 noatime,nosuid,nodev,journal_async_commit wait -/dev/block/mmcblk0p16 /data ext4 noatime,nosuid,nodev,discard,noauto_da_alloc,journal_async_commit,errors=panic wait,check,encryptable=footer +/dev/block/mmcblk0p16 /data f2fs noatime,discard,inline_xattr,inline_data,nosuid,nodev wait,check,encryptable=footer +/dev/block/mmcblk0p16 /data ext4 noatime,nosuid,nodev,noauto_da_alloc,journal_async_commit,errors=panic wait,check,encryptable=footer -/devices/platform/s3c-sdhci.2/mmc_host/mmc1 auto auto defaults voldmanaged=sdcard1:auto -/devices/platform/s5p-ehci auto auto defaults voldmanaged=usbdisk0:auto +# vold-managed volumes ("block device" is actually a sysfs devpath) +/devices/platform/s3c-sdhci.2/mmc_host/mmc1* /storage/sdcard1 auto defaults voldmanaged=sdcard1:auto,encryptable=userdata +/devices/platform/s5p-ehci* /storage/usbdisk0 auto defaults voldmanaged=usb:auto,noemulatedsd # recovery /dev/block/mmcblk0p8 /boot emmc defaults recoveryonly diff --git a/rootdir/init.target.rc b/rootdir/init.target.rc index a1e4a08..f346d40 100644 --- a/rootdir/init.target.rc +++ b/rootdir/init.target.rc @@ -1,4 +1,5 @@ on init + export LD_SHIM_LIBS /system/lib/libsec-ril.so|libsamsung_symbols.so:/system/bin/gpsd|libdmitry.so # Vibetonz export VIBE_PIPE_PATH /dev/pipes mkdir /dev/pipes 0771 shell shell @@ -11,21 +12,7 @@ on post-fs-data symlink /dev/block/mmcblk0p7 /dev/block/param # Restorecon - restorecon /efs/nv_data.bin - restorecon /efs/nv_data.bin.md5 - restorecon /efs/.nv_core.bak - restorecon /efs/.nv_core.bak.md5 - restorecon /efs/.nv_data.bak - restorecon /efs/.nv_data.bak.md5 - restorecon /efs/.nv_state - restorecon /efs/bluetooth/bt_addr - restorecon /efs/FactoryApp/factorymode - restorecon /efs/FactoryApp/hw_ver - restorecon /efs/FactoryApp/keystr - restorecon /efs/FactoryApp/serial_no - restorecon /efs/imei/mps_code.dat - restorecon /efs/gyro_cal_data - restorecon /efs/wifi/.mac.info + restorecon_recursive /efs # SensorHub chown system radio /sys/class/sensors/ssp_sensor/enable @@ -40,33 +27,16 @@ on post-fs-data on boot -# icd -service icd /system/bin/icd - class main - user system - group system log - onrestart exec icd_check - # cbd service cpboot-daemon /sbin/cbd -d -p 10 class main user root group radio cache inet misc audio sdcard_rw log -# sensorhub -service sensorhubservice /system/bin/sensorhubservice - class main - user system - group input - -# GPS -service gpsd /system/bin/gpsd -c /system/etc/gps.xml +# Start GPS daemon +service gps-daemon /system/bin/sh /system/bin/gps_daemon.sh class main socket gps seqpacket 0660 gps system user gps - group system inet sdcard_rw - -service dmb /system/bin/dmbserver - class main - user system - group radio inet misc audio camera graphics net_bt net_bt_admin sdcard_rw + group system inet sdcard_rw gps + ioprio be 0 diff --git a/selinux/bluetooth.te b/selinux/bluetooth.te new file mode 100644 index 0000000..dbfbe0e --- /dev/null +++ b/selinux/bluetooth.te @@ -0,0 +1,7 @@ +allow bluetooth bluetooth_efs_file:dir search; +allow bluetooth bluetooth_efs_file:file read; +allow bluetooth firmware_exynos:dir { open read search }; +allow bluetooth firmware_exynos:file { open read }; +allow bluetooth sysfs:file write; +allow bluetooth efs_device_file:dir search; +allow bluetooth wifi_data_file:file r_file_perms; diff --git a/selinux/cpboot-daemon.te b/selinux/cpboot-daemon.te new file mode 100644 index 0000000..9974ff2 --- /dev/null +++ b/selinux/cpboot-daemon.te @@ -0,0 +1,25 @@ +type cpboot-daemon, domain; + +permissive cpboot-daemon; + +allow cpboot-daemon cgroup:dir { create add_name }; +allow cpboot-daemon device:dir { write remove_name add_name }; +allow cpboot-daemon efs_block_device:blk_file { read open }; +allow cpboot-daemon efs_device_file:dir search; +allow cpboot-daemon efs_file:file { read write open }; +allow cpboot-daemon init:unix_stream_socket connectto; +allow cpboot-daemon log_device:chr_file { write open }; +allow cpboot-daemon log_device:dir search; +allow cpboot-daemon property_socket:sock_file write; +allow cpboot-daemon radio_device:chr_file { read write ioctl open }; +allow cpboot-daemon radio_prop:property_service set; +allow cpboot-daemon self:capability { setuid }; +allow cpboot-daemon sysfs_radio:file { read write open }; +allow cpboot-daemon usbfs:dir search; +allow cpboot-daemon self:capability dac_override; +allow cpboot-daemon cbd_device:chr_file create_file_perms; + +# FIX ME +# allow cpboot-daemon usbfs:filesystem mount; +# allow cpboot-daemon self:capability { mknod }; + diff --git a/selinux/device.te b/selinux/device.te index cca8ee1..854958d 100644 --- a/selinux/device.te +++ b/selinux/device.te @@ -1,3 +1,4 @@ -type mali_device, dev_type, mlstrustedobject; type rfkill_device, dev_type; type efs_block_device, dev_type; +type hpd_device, dev_type; +type mfc_device, dev_type; diff --git a/selinux/domain.te b/selinux/domain.te index 26e8033..c8d8d53 100644 --- a/selinux/domain.te +++ b/selinux/domain.te @@ -1,2 +1 @@ -## /dev/mali, /dev/ump -allow domain mali_device:chr_file rw_file_perms; +dontaudit domain kernel:system module_request; diff --git a/selinux/file.te b/selinux/file.te index facc492..12b280a 100644 --- a/selinux/file.te +++ b/selinux/file.te @@ -1,5 +1,11 @@ type firmware_mfc, file_type; -type firmware_camera, file_type; +type firmware_exynos, file_type; type sensors_data_file, file_type, data_file_type; -type volume_data_file, file_type, data_file_type; +type sysfs_display, fs_type, sysfs_type; + +type efs_device_file, file_type; +type radio_data, file_type; +type sysfs_radio, fs_type, sysfs_type; +type sysfs_sensor, fs_type, sysfs_type; +type cbd_device, dev_type; diff --git a/selinux/file_contexts b/selinux/file_contexts index a5ce2c5..fc824b3 100644 --- a/selinux/file_contexts +++ b/selinux/file_contexts @@ -1,42 +1,63 @@ # GFX -/dev/mali u:object_r:mali_device:s0 -/dev/ump u:object_r:mali_device:s0 -/dev/fimg2d u:object_r:mali_device:s0 +/dev/mali u:object_r:gpu_device:s0 +/dev/ump u:object_r:gpu_device:s0 +/dev/fimg2d u:object_r:gpu_device:s0 # RIL +/dev/link_pm u:object_r:radio_device:s0 /dev/umts_boot0 u:object_r:radio_device:s0 -/dev/umts_csd u:object_r:radio_device:s0 +/dev/umts_boot1 u:object_r:radio_device:s0 /dev/umts_ipc0 u:object_r:radio_device:s0 -/dev/umts_loopback0 u:object_r:radio_device:s0 /dev/umts_ramdump0 u:object_r:radio_device:s0 /dev/umts_rfs0 u:object_r:radio_device:s0 -/dev/umts_router u:object_r:radio_device:s0 +/dev/__cbd_msg_ u:object_r:cbd_device:s0 -/dev/block/mmcblk0p10 u:object_r:efs_block_device:s0 +/efs u:object_r:efs_device_file:s0 +/data/misc/radio(/.*)? u:object_r:radio_data:s0 +/sys/devices/platform/s5p-ohci/ohci_power u:object_r:sysfs_radio:s0 +/sys/devices/platform/s5p-ehci/ehci_power u:object_r:sysfs_radio:s0 + +# Partitions +/dev/block/mmcblk0(.*) u:object_r:boot_block_device:s0 +/dev/block/mmcblk0p3 u:object_r:efs_block_device:s0 +/dev/block/mmcblk0p12 u:object_r:cache_block_device:s0 +/dev/block/mmcblk0p13 u:object_r:system_block_device:s0 +/dev/block/mmcblk0p16 u:object_r:userdata_block_device:s0 # Camera /data/ISP_CV u:object_r:camera_data_file:s0 /dev/exynos-mem u:object_r:video_device:s0 +/dev/s3c-mfc u:object_r:mfc_device:s0 # Bluetooth /dev/ttySAC0 u:object_r:hci_attach_dev:s0 -/efs/bluetooth/(/.*)? u:object_r:bluetooth_efs_file:s0 +/efs/bluetooth(/.*)? u:object_r:bluetooth_efs_file:s0 + +# Display +/sys/class/mdnie/mdnie(/.*)? u:object_r:sysfs_display:s0 +/sys/devices/platform/samsung-pd.2/mdnie/mdnie(/.*)? u:object_r:sysfs_display:s0 # GPS /dev/ttySAC1 u:object_r:gps_device:s0 +/system/bin/gps_daemon.sh u:object_r:gpsd_exec:s0 # Sensors /dev/akm8963 u:object_r:sensors_device:s0 /efs/gyro_cal_data u:object_r:sensors_data_file:s0 +/sys/class/sensors/accelerometer_sensor u:object_r:sysfs_sensor:s0 # Wifi /dev/rfkill u:object_r:rfkill_device:s0 +/data/.cid.info u:object_r:wifi_data_file:s0 /efs/wifi/.mac.info u:object_r:wifi_data_file:s0 # Firmwares -/system/vendor/firmware(/.*)? u:object_r:firmware_camera:s0 +/system/vendor/firmware(/.*)? u:object_r:firmware_exynos:s0 /system/vendor/firmware/mfc_fw.bin u:object_r:firmware_mfc:s0 -/data/cfw(/.*)? u:object_r:firmware_camera:s0 +/data/cfw(/.*)? u:object_r:firmware_exynos:s0 # Vibrator /dev/tspdrv u:object_r:input_device:s0 + +# Misc +/dev/HPD u:object_r:hpd_device:s0 diff --git a/selinux/gpsd.te b/selinux/gpsd.te new file mode 100644 index 0000000..6c54563 --- /dev/null +++ b/selinux/gpsd.te @@ -0,0 +1,17 @@ +#for text relocs & execution +allow gpsd system_file:file { execute_no_trans execmod }; +allow gpsd gps_device:chr_file { getattr setattr }; +allow gpsd gps_data_file:dir { search write add_name remove_name }; +allow gpsd gps_data_file:fifo_file { unlink create setattr getattr rw_file_perms }; + +allow gpsd node:udp_socket { node_bind name_bind }; +allow gpsd port:tcp_socket name_connect; +allow gpsd self:tcp_socket { getopt write read }; + +allow gpsd sysfs:file { setattr write }; +allow gpsd gps_device:chr_file { ioctl open read write }; +allow gpsd gpsd:udp_socket { create bind }; +allow gpsd gpsd:tcp_socket { create connect }; +allow gpsd fwmarkd_socket:sock_file write; +allow gpsd dnsproxyd_socket:sock_file write; +allow gpsd netd:unix_stream_socket connectto; diff --git a/selinux/init.te b/selinux/init.te index 3f11893..c7393a9 100644 --- a/selinux/init.te +++ b/selinux/init.te @@ -1 +1,13 @@ allow init wpa_socket:unix_dgram_socket { bind create }; +allow init init:process { execmem }; +allow init init:tcp_socket { create }; + +allow init sysfs_display:lnk_file { read setattr }; + +allow init tmpfs:lnk_file create; +allow init sysfs_sensor:lnk_file { setattr read }; + +allow init rild:process noatsecure; + +domain_trans(init, rootfs, gpsd) +domain_trans(init, rootfs, cpboot-daemon) diff --git a/selinux/log.te b/selinux/log.te new file mode 100644 index 0000000..c3dfc80 --- /dev/null +++ b/selinux/log.te @@ -0,0 +1,3 @@ +allow domain log_device:chr_file { open write }; +allow domain log_device:dir { search }; +allow { shell debuggerd } log_device:chr_file { read }; diff --git a/selinux/mediaserver.te b/selinux/mediaserver.te index 7cc911c..cbcdcb8 100644 --- a/selinux/mediaserver.te +++ b/selinux/mediaserver.te @@ -1,8 +1,11 @@ -allow mediaserver { firmware_camera }:file r_file_perms; -allow mediaserver firmware_camera:dir r_dir_perms; +allow mediaserver { firmware_exynos }:file r_file_perms; +allow mediaserver firmware_exynos:dir r_dir_perms; allow mediaserver camera_data_file:file rw_file_perms; -allow mediaserver volume_data_file:file create_file_perms; -allow mediaserver volume_data_file:dir create_dir_perms; +allow mediaserver mfc_device:chr_file rw_file_perms; # Bluetooth audio allow mediaserver bluetooth:unix_stream_socket { connectto }; + +allow mediaserver { storage_file mnt_user_file }:dir { search read }; +allow mediaserver storage_file:lnk_file read; +allow mediaserver mnt_user_file:lnk_file read; diff --git a/selinux/netd.te b/selinux/netd.te new file mode 100644 index 0000000..bce2700 --- /dev/null +++ b/selinux/netd.te @@ -0,0 +1,3 @@ +allow netd init:tcp_socket { read write getopt }; +allow netd gpsd:fd use; +allow netd gpsd:tcp_socket { read write getopt setopt }; diff --git a/selinux/nfc.te b/selinux/nfc.te new file mode 100644 index 0000000..b5afda7 --- /dev/null +++ b/selinux/nfc.te @@ -0,0 +1,2 @@ +allow nfc firmware_exynos:dir search; +allow nfc log_device:chr_file write; diff --git a/selinux/rild.te b/selinux/rild.te index 7f817d0..5da4924 100644 --- a/selinux/rild.te +++ b/selinux/rild.te @@ -1,7 +1,20 @@ allow rild self:netlink_socket { create bind read write }; allow rild self:netlink_route_socket { write }; allow rild self:netlink_kobject_uevent_socket { create bind read write setopt }; +allow rild rild:process { execmem }; + +allow rild radio_data_file:dir setattr; +allow rild unlabeled:dir search; + +allow radio log_device:chr_file w_file_perms; +allow rild log_device:chr_file w_file_perms; +allow rild system_file:file execmod; +allow rild radio_data:file create_file_perms; +allow rild radio_data:dir create_dir_perms; allow rild radio_device:chr_file rw_file_perms; allow rild efs_block_device:blk_file rw_file_perms; allow rild efs_file:file { read open write setattr }; + +allow rild efs_device_file:dir create_dir_perms; +allow rild efs_device_file:file { setattr create create_file_perms }; diff --git a/selinux/service_contexts b/selinux/service_contexts new file mode 100644 index 0000000..fb14cf2 --- /dev/null +++ b/selinux/service_contexts @@ -0,0 +1,3 @@ +SecTVOutService u:object_r:surfaceflinger_service:s0 +Exynos.HWCService u:object_r:surfaceflinger_service:s0 +Exynos.IPService u:object_r:surfaceflinger_service:s0 diff --git a/selinux/servicemanager.te b/selinux/servicemanager.te new file mode 100644 index 0000000..40a665d --- /dev/null +++ b/selinux/servicemanager.te @@ -0,0 +1,3 @@ +allow servicemanager gpsd:dir { search read write }; +allow servicemanager gpsd:file { open read write }; +allow servicemanager gpsd:process getattr; diff --git a/selinux/surfaceflinger.te b/selinux/surfaceflinger.te new file mode 100644 index 0000000..00fa1e9 --- /dev/null +++ b/selinux/surfaceflinger.te @@ -0,0 +1 @@ +allow surfaceflinger hpd_device:chr_file rw_file_perms; diff --git a/selinux/sysinit.te b/selinux/sysinit.te new file mode 100644 index 0000000..0436ffe --- /dev/null +++ b/selinux/sysinit.te @@ -0,0 +1,7 @@ +allow sysinit firmware_exynos:dir { read search open getattr }; +allow sysinit userinit_exec:file { getattr execute execute_no_trans read open }; +allow sysinit firmware_exynos:dir { read search open getattr write remove_name add_name }; +allow sysinit firmware_exynos:file { read open write getattr setattr create unlink }; +allow sysinit sysinit:capability { dac_override chown fowner fsetid }; +allow sysinit unlabeled:dir { search }; +allow sysinit surfaceflinger_exec:file { getattr }; diff --git a/selinux/system.te b/selinux/system.te deleted file mode 100644 index df7b6fc..0000000 --- a/selinux/system.te +++ /dev/null @@ -1,11 +0,0 @@ -allow system input_device:chr_file { read ioctl write open }; -allow system sensors_device:chr_file { read open }; -allow system sensors_data_file:file r_file_perms; -allow system wpa_socket:unix_dgram_socket sendto; -allow system_app volume_data_file:file { read write open getattr }; - -allow system sysfs:file { read open write }; -allow system self:capability { sys_module }; - -# /efs/wifi/.mac.info -allow system wifi_data_file:file { read open }; diff --git a/selinux/system_app.te b/selinux/system_app.te new file mode 100644 index 0000000..8542dc2 --- /dev/null +++ b/selinux/system_app.te @@ -0,0 +1,2 @@ +allow system_app sysfs_display:{ file lnk_file } { getattr open read write }; +allow system_app sysfs_display:dir { search }; diff --git a/selinux/system_server.te b/selinux/system_server.te new file mode 100644 index 0000000..789d734 --- /dev/null +++ b/selinux/system_server.te @@ -0,0 +1,38 @@ +allow system_server input_device:chr_file { read ioctl write open }; +allow system_server sensors_device:chr_file { read open }; +allow system_server sensors_data_file:file r_file_perms; +allow system_server wpa_socket:unix_dgram_socket sendto; + +allow system_server sysfs:file { read open write }; +allow system_server sysfs_display:lnk_file rw_file_perms; +allow system_server sysfs_display:dir rw_dir_perms; +allow system_server sysfs_display:file rw_file_perms; +allow system_server self:capability { sys_module }; + +allow system_server efs_file:dir search; +allow system_server efs_file:file read; +allow system_server efs_device_file:dir search; +allow system_server uhid_device:chr_file { read ioctl write open }; +allow system_server storage_stub_file:dir getattr; + + +# for sensors +allow system_server system_file:file execmod; + +# /efs/wifi/.mac.info +allow system_server wifi_data_file:file { read open }; + +allow system_server radio_data:dir r_dir_perms; + +allow system_server gpsd:binder transfer; +type_transition system_server system_data_file:fifo_file gps_data_file ".gps.interface.pipe.to_jni"; + +# Access .gps.interface.pipe.to_gpsd. +allow system_server gps_data_file:dir rw_dir_perms; +allow system_server gps_data_file:fifo_file { setattr rw_file_perms create }; + +# Access /data/sensors/gps* socket +allow system_server gps_data_file:sock_file create_file_perms; +allow system_server gps_data_file:dir rw_dir_perms; +allow system_server gps_data_file:file rw_file_perms; + diff --git a/selinux/ueventd.te b/selinux/ueventd.te index 1ed58dc..315ccb3 100644 --- a/selinux/ueventd.te +++ b/selinux/ueventd.te @@ -1,6 +1,5 @@ -# MFC firmware +# Firmwares allow ueventd { firmware_mfc }:file r_file_perms; - -# Camera related firmwares -allow ueventd { firmware_camera }:dir search; -allow ueventd { firmware_camera }:file r_file_perms; +allow ueventd { firmware_exynos }:dir search; +allow ueventd { firmware_exynos }:file { read getattr open }; +allow ueventd sysfs_display:file { write open }; diff --git a/selinux/untrusted_app.te b/selinux/untrusted_app.te new file mode 100644 index 0000000..f9c5bde --- /dev/null +++ b/selinux/untrusted_app.te @@ -0,0 +1,5 @@ +allow untrusted_app storage_stub_file:dir getattr; +allow untrusted_app log_device:chr_file { read write }; +allow untrusted_app self:udp_socket ioctl; +allow untrusted_app app_data_file:file create_file_perms; +allow untrusted_app app_data_file:dir create_dir_perms; diff --git a/selinux/vold.te b/selinux/vold.te index 9452abf..ba429d6 100644 --- a/selinux/vold.te +++ b/selinux/vold.te @@ -1,2 +1,12 @@ allow vold kernel:process setsched; allow vold sdcardd_exec:file { read open execute execute_no_trans }; + +allow vold log_device:dir search; +allow vold storage_stub_file:dir { read open search write add_name }; +allow vold mnt_media_rw_stub_file:dir { read open }; +allow vold blkid_exec:file { getattr execute read open execute_no_trans }; + +allow vold log_device:chr_file { write open }; + +allow vold efs_device_file:dir rw_file_perms; +allow vold efs_device_file:file rw_file_perms; diff --git a/selinux/wpa_supplicant.te b/selinux/wpa_supplicant.te index bbe679b..9b806e0 100755..100644 --- a/selinux/wpa_supplicant.te +++ b/selinux/wpa_supplicant.te @@ -2,8 +2,11 @@ allow wpa init:unix_dgram_socket { read write }; # logwrapper used with wpa_supplicant allow wpa devpts:chr_file { read write }; +allow wpa log_device:chr_file { write }; allow wpa wpa_socket:unix_dgram_socket { read write }; -allow wpa_socket system:unix_dgram_socket sendto; +allow wpa_socket system_app:unix_dgram_socket sendto; allow wpa_socket wifi_data_file:sock_file unlink; + +allow wpa rfkill_device:chr_file rw_file_perms; diff --git a/selinux/zygote.te b/selinux/zygote.te new file mode 100644 index 0000000..4de92c2 --- /dev/null +++ b/selinux/zygote.te @@ -0,0 +1 @@ +allow zygote log_device:dir search; diff --git a/system.prop b/system.prop index 4039ba3..db6bcfd 100644 --- a/system.prop +++ b/system.prop @@ -1,9 +1,9 @@ # -# system.prop for n7100 +# system.prop for smdk4x12 # dalvik.vm.dexopt-data-only=1 -rild.libpath=/system/lib/libsec-ril.so +rild.libpath=/system/lib/ril-wrapper.so rild.libargs=-d /dev/ttyS0 ro.sf.lcd_density=320 ro.lcd_min_brightness=20 diff --git a/vendorsetup.sh b/vendorsetup.sh new file mode 100644 index 0000000..ec8ca52 --- /dev/null +++ b/vendorsetup.sh @@ -0,0 +1,2 @@ +add_lunch_combo cm_n7100-userdebug +add_lunch_combo cm_n7100-eng |