Compare commits
26 Commits
lineage-19
...
lineage-20
Author | SHA1 | Date | |
---|---|---|---|
69931dbcf0 | |||
82523dcb34 | |||
0c11fd4153 | |||
fb8a1929cb | |||
336f143be9 | |||
|
a2c1c7fb20 | ||
|
75f3e69631 | ||
24fedfac2a | |||
852519a4e9 | |||
ae0eb756ee | |||
3431b3798f | |||
e817ccd476 | |||
c7f3de6465 | |||
25b53ebb61 | |||
1238d5b4d0 | |||
1a305b52c1 | |||
c1c2ca26da | |||
5d18b27d50 | |||
6850a3ff78 | |||
4e8c9b2b08 | |||
fdb0013418 | |||
a55aeeba2a | |||
82f4e68e0d | |||
824be3531e | |||
53afcdf3eb | |||
becaedc12d |
@ -47,31 +47,12 @@ MALLOC_SVELTE_FOR_LIBC32 := true
|
||||
BOARD_BATTERY_DEVICE_NAME := "battery"
|
||||
BOARD_CHARGING_CMDLINE_NAME := "androidboot.bootchg"
|
||||
BOARD_CHARGING_CMDLINE_VALUE := "true"
|
||||
WITH_LINEAGE_CHARGER := false
|
||||
|
||||
# Dexpreopt
|
||||
ifeq ($(HOST_OS),linux)
|
||||
ifneq ($(TARGET_BUILD_VARIANT),eng)
|
||||
WITH_DEXPREOPT_BOOT_IMG_AND_SYSTEM_SERVER_ONLY ?= false
|
||||
WITH_DEXPREOPT := true
|
||||
endif
|
||||
endif
|
||||
|
||||
# Display
|
||||
TARGET_ADDITIONAL_GRALLOC_10_USAGE_BITS := 0x02000000U
|
||||
TARGET_DISABLE_POSTRENDER_CLEANUP := true
|
||||
TARGET_FORCE_HWC_FOR_VIRTUAL_DISPLAYS := true
|
||||
|
||||
# Shader cache config options
|
||||
# Maximum size of the GLES Shaders that can be cached for reuse.
|
||||
# Increase the size if shaders of size greater than 12KB are used.
|
||||
MAX_EGL_CACHE_KEY_SIZE := 12*1024
|
||||
|
||||
# Maximum GLES shader cache size for each app to store the compiled shader
|
||||
# binaries. Decrease the size if RAM or Flash Storage size is a limitation
|
||||
# of the device.
|
||||
MAX_EGL_CACHE_SIZE := 2048*1024
|
||||
|
||||
# Filesystem
|
||||
TARGET_FS_CONFIG_GEN := device/samsung/msm8974-common/config.fs
|
||||
|
||||
@ -85,8 +66,8 @@ TARGET_HAS_MEMFD_BACKPORT := true
|
||||
# SELinux
|
||||
include device/samsung/msm8974-common/sepolicy/sepolicy.mk
|
||||
|
||||
# Netd
|
||||
TARGET_NEEDS_NETD_DIRECT_CONNECT_RULE := true
|
||||
# SOONG
|
||||
PRODUCT_SOONG_NAMESPACES += hardware/samsung
|
||||
|
||||
# Power
|
||||
TARGET_USES_INTERACTION_BOOST := true
|
||||
@ -100,8 +81,5 @@ TARGET_SYSTEM_PROP += device/samsung/msm8974-common/system.prop
|
||||
# Recovery
|
||||
TARGET_RECOVERY_DEVICE_DIRS += device/samsung/msm8974-common
|
||||
|
||||
# Time services
|
||||
BOARD_USES_QC_TIME_SERVICES := true
|
||||
|
||||
# inherit from the proprietary version
|
||||
include vendor/samsung/msm8974-common/BoardConfigVendor.mk
|
||||
|
33
audio_service/Android.bp
Normal file
33
audio_service/Android.bp
Normal file
@ -0,0 +1,33 @@
|
||||
//
|
||||
// Copyright (C) 2022 The LineageOS-UL Project
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
cc_binary {
|
||||
name: "android.hardware.audio.service.samsung8974",
|
||||
|
||||
init_rc: ["android.hardware.audio.service.samsung8974.rc"],
|
||||
relative_install_path: "hw",
|
||||
vendor: true,
|
||||
|
||||
srcs: ["service.cpp"],
|
||||
|
||||
cflags: [
|
||||
"-Wall",
|
||||
"-Wextra",
|
||||
"-Werror",
|
||||
],
|
||||
|
||||
shared_libs: [
|
||||
"libcutils",
|
||||
"libbinder",
|
||||
"libhidlbase",
|
||||
"liblog",
|
||||
"libutils",
|
||||
"libhardware",
|
||||
],
|
||||
|
||||
defaults: [
|
||||
"android_hardware_audio_config_defaults",
|
||||
],
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
service vendor.audio-hal /vendor/bin/hw/android.hardware.audio.service.samsung8974
|
||||
class hal
|
||||
user audioserver
|
||||
# media gid needed for /dev/fm (radio) and for /data/misc/media (tee)
|
||||
group audio camera drmrpc inet media mediadrm net_bt net_bt_admin net_bw_acct wakelock context_hub
|
||||
capabilities BLOCK_SUSPEND
|
||||
ioprio rt 4
|
||||
task_profiles ProcessCapacityHigh HighPerformance
|
||||
onrestart restart audioserver
|
122
audio_service/service.cpp
Normal file
122
audio_service/service.cpp
Normal file
@ -0,0 +1,122 @@
|
||||
/*
|
||||
* Copyright (C) 2016 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#define LOG_TAG "audiohalservice"
|
||||
|
||||
#include <signal.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <binder/ProcessState.h>
|
||||
#include <cutils/properties.h>
|
||||
#include <hidl/HidlTransportSupport.h>
|
||||
#include <hidl/LegacySupport.h>
|
||||
#include <hwbinder/ProcessState.h>
|
||||
|
||||
using namespace android::hardware;
|
||||
using android::OK;
|
||||
|
||||
using InterfacesList = std::vector<std::string>;
|
||||
|
||||
/** Try to register the provided factories in the provided order.
|
||||
* If any registers successfully, do not register any other and return true.
|
||||
* If all fail, return false.
|
||||
*/
|
||||
template <class Iter>
|
||||
static bool registerPassthroughServiceImplementations(Iter first, Iter last) {
|
||||
for (; first != last; ++first) {
|
||||
if (registerPassthroughServiceImplementation(*first) == OK) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
int main(int /* argc */, char* /* argv */ []) {
|
||||
signal(SIGPIPE, SIG_IGN);
|
||||
|
||||
::android::ProcessState::initWithDriver("/dev/vndbinder");
|
||||
// start a threadpool for vndbinder interactions
|
||||
::android::ProcessState::self()->startThreadPool();
|
||||
|
||||
const int32_t defaultValue = -1;
|
||||
int32_t value =
|
||||
property_get_int32("persist.vendor.audio.service.hwbinder.size_kbyte", defaultValue);
|
||||
if (value != defaultValue) {
|
||||
ALOGD("Configuring hwbinder with mmap size %d KBytes", value);
|
||||
ProcessState::initWithMmapSize(static_cast<size_t>(value) * 1024);
|
||||
}
|
||||
configureRpcThreadpool(16, true /*callerWillJoin*/);
|
||||
|
||||
// Automatic formatting tries to compact the lines, making them less readable
|
||||
// clang-format off
|
||||
const std::vector<InterfacesList> mandatoryInterfaces = {
|
||||
{
|
||||
"Audio Core API",
|
||||
"android.hardware.audio@7.1::IDevicesFactory",
|
||||
"android.hardware.audio@7.0::IDevicesFactory",
|
||||
"android.hardware.audio@6.0::IDevicesFactory",
|
||||
"android.hardware.audio@5.0::IDevicesFactory",
|
||||
"android.hardware.audio@4.0::IDevicesFactory",
|
||||
},
|
||||
{
|
||||
"Audio Effect API",
|
||||
"android.hardware.audio.effect@7.0::IEffectsFactory",
|
||||
"android.hardware.audio.effect@6.0::IEffectsFactory",
|
||||
"android.hardware.audio.effect@5.0::IEffectsFactory",
|
||||
"android.hardware.audio.effect@4.0::IEffectsFactory",
|
||||
}
|
||||
};
|
||||
|
||||
const std::vector<InterfacesList> optionalInterfaces = {
|
||||
{
|
||||
"Soundtrigger API",
|
||||
"android.hardware.soundtrigger@2.3::ISoundTriggerHw",
|
||||
"android.hardware.soundtrigger@2.2::ISoundTriggerHw",
|
||||
"android.hardware.soundtrigger@2.1::ISoundTriggerHw",
|
||||
"android.hardware.soundtrigger@2.0::ISoundTriggerHw",
|
||||
},
|
||||
{
|
||||
"Bluetooth Audio API",
|
||||
"android.hardware.bluetooth.audio@2.2::IBluetoothAudioProvidersFactory",
|
||||
"android.hardware.bluetooth.audio@2.1::IBluetoothAudioProvidersFactory",
|
||||
"android.hardware.bluetooth.audio@2.0::IBluetoothAudioProvidersFactory",
|
||||
},
|
||||
// remove the old HIDL when Bluetooth Audio Hal V2 has offloading supported
|
||||
{
|
||||
"Bluetooth Audio Offload API",
|
||||
"android.hardware.bluetooth.a2dp@1.0::IBluetoothAudioOffload"
|
||||
}
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
for (const auto& listIter : mandatoryInterfaces) {
|
||||
auto iter = listIter.begin();
|
||||
const std::string& interfaceFamilyName = *iter++;
|
||||
LOG_ALWAYS_FATAL_IF(!registerPassthroughServiceImplementations(iter, listIter.end()),
|
||||
"Could not register %s", interfaceFamilyName.c_str());
|
||||
}
|
||||
|
||||
for (const auto& listIter : optionalInterfaces) {
|
||||
auto iter = listIter.begin();
|
||||
const std::string& interfaceFamilyName = *iter++;
|
||||
ALOGW_IF(!registerPassthroughServiceImplementations(iter, listIter.end()),
|
||||
"Could not register %s", interfaceFamilyName.c_str());
|
||||
}
|
||||
|
||||
joinRpcThreadpool();
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
<compatibility-matrix version="1.0" type="device">
|
||||
<compatibility-matrix version="2.0" type="device">
|
||||
<hal format="hidl" optional="false">
|
||||
<name>android.frameworks.schedulerservice</name>
|
||||
<version>1.0</version>
|
||||
|
@ -108,9 +108,9 @@ static const loc_param_s_type gps_conf_table[] =
|
||||
{"NMEA_PROVIDER", &gps_conf.NMEA_PROVIDER, NULL, 'n'},
|
||||
{"CAPABILITIES", &gps_conf.CAPABILITIES, NULL, 'n'},
|
||||
{"XTRA_VERSION_CHECK", &gps_conf.XTRA_VERSION_CHECK, NULL, 'n'},
|
||||
{"XTRA_SERVER_1", &gps_conf.XTRA_SERVER_1, NULL, 's'},
|
||||
{"XTRA_SERVER_2", &gps_conf.XTRA_SERVER_2, NULL, 's'},
|
||||
{"XTRA_SERVER_3", &gps_conf.XTRA_SERVER_3, NULL, 's'},
|
||||
{"LONGTERM_PSDS_SERVER_1", &gps_conf.LONGTERM_PSDS_SERVER_1, NULL, 's'},
|
||||
{"LONGTERM_PSDS_SERVER_2", &gps_conf.LONGTERM_PSDS_SERVER_2, NULL, 's'},
|
||||
{"LONGTERM_PSDS_SERVER_3", &gps_conf.LONGTERM_PSDS_SERVER_3, NULL, 's'},
|
||||
{"USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL", &gps_conf.USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL, NULL, 'n'},
|
||||
};
|
||||
|
||||
@ -928,14 +928,14 @@ LocEngReportXtraServer::LocEngReportXtraServer(void* locEng,
|
||||
memset(mServers, 0, 3*(mMaxLen+1));
|
||||
|
||||
// Override modem URLs with uncommented gps.conf urls
|
||||
if( gps_conf.XTRA_SERVER_1[0] != '\0' ) {
|
||||
url1 = &gps_conf.XTRA_SERVER_1[0];
|
||||
if( gps_conf.LONGTERM_PSDS_SERVER_1[0] != '\0' ) {
|
||||
url1 = &gps_conf.LONGTERM_PSDS_SERVER_1[0];
|
||||
}
|
||||
if( gps_conf.XTRA_SERVER_2[0] != '\0' ) {
|
||||
url2 = &gps_conf.XTRA_SERVER_2[0];
|
||||
if( gps_conf.LONGTERM_PSDS_SERVER_2[0] != '\0' ) {
|
||||
url2 = &gps_conf.LONGTERM_PSDS_SERVER_2[0];
|
||||
}
|
||||
if( gps_conf.XTRA_SERVER_3[0] != '\0' ) {
|
||||
url3 = &gps_conf.XTRA_SERVER_3[0];
|
||||
if( gps_conf.LONGTERM_PSDS_SERVER_3[0] != '\0' ) {
|
||||
url3 = &gps_conf.LONGTERM_PSDS_SERVER_3[0];
|
||||
}
|
||||
// copy non xtra1.gpsonextra.net URLs into the forwarding buffer.
|
||||
if( NULL == strcasestr(url1, XTRA1_GPSONEXTRA) ) {
|
||||
|
@ -154,9 +154,9 @@ typedef struct loc_gps_cfg_s
|
||||
uint32_t CAPABILITIES;
|
||||
uint32_t LPP_PROFILE;
|
||||
uint32_t XTRA_VERSION_CHECK;
|
||||
char XTRA_SERVER_1[MAX_XTRA_SERVER_URL_LENGTH];
|
||||
char XTRA_SERVER_2[MAX_XTRA_SERVER_URL_LENGTH];
|
||||
char XTRA_SERVER_3[MAX_XTRA_SERVER_URL_LENGTH];
|
||||
char LONGTERM_PSDS_SERVER_1[MAX_XTRA_SERVER_URL_LENGTH];
|
||||
char LONGTERM_PSDS_SERVER_2[MAX_XTRA_SERVER_URL_LENGTH];
|
||||
char LONGTERM_PSDS_SERVER_3[MAX_XTRA_SERVER_URL_LENGTH];
|
||||
uint32_t USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL;
|
||||
uint32_t NMEA_PROVIDER;
|
||||
uint32_t GPS_LOCK;
|
||||
|
@ -1,10 +0,0 @@
|
||||
[
|
||||
{
|
||||
"repository": "android_device_samsung_qcom-common",
|
||||
"target_path": "device/samsung/qcom-common"
|
||||
},
|
||||
{
|
||||
"repository": "android_hardware_sony_timekeep",
|
||||
"target_path": "hardware/sony/timekeep"
|
||||
}
|
||||
]
|
15
manifest.xml
15
manifest.xml
@ -1,8 +1,8 @@
|
||||
<manifest version="1.0" type="device" target-level="legacy">
|
||||
<manifest version="1.0" type="device" target-level="3">
|
||||
<hal format="hidl">
|
||||
<name>android.hardware.audio</name>
|
||||
<transport arch="32">passthrough</transport>
|
||||
<version>5.0</version>
|
||||
<transport>hwbinder</transport>
|
||||
<version>7.1</version>
|
||||
<interface>
|
||||
<name>IDevicesFactory</name>
|
||||
<instance>default</instance>
|
||||
@ -10,8 +10,8 @@
|
||||
</hal>
|
||||
<hal format="hidl">
|
||||
<name>android.hardware.audio.effect</name>
|
||||
<transport arch="32">passthrough</transport>
|
||||
<version>5.0</version>
|
||||
<transport>hwbinder</transport>
|
||||
<version>7.0</version>
|
||||
<interface>
|
||||
<name>IEffectsFactory</name>
|
||||
<instance>default</instance>
|
||||
@ -26,6 +26,11 @@
|
||||
<instance>default</instance>
|
||||
</interface>
|
||||
</hal>
|
||||
<hal format="hidl">
|
||||
<name>android.hardware.bluetooth.audio</name>
|
||||
<transport>hwbinder</transport>
|
||||
<fqname>@2.0::IBluetoothAudioProvidersFactory/default</fqname>
|
||||
</hal>
|
||||
<hal format="hidl">
|
||||
<name>android.hardware.camera.provider</name>
|
||||
<transport arch="32">passthrough</transport>
|
||||
|
34
msm8974.mk
34
msm8974.mk
@ -47,9 +47,10 @@ PRODUCT_COPY_FILES += \
|
||||
|
||||
# Audio
|
||||
PRODUCT_PACKAGES += \
|
||||
android.hardware.audio@5.0-impl \
|
||||
android.hardware.audio.effect@5.0-impl \
|
||||
audio.a2dp.default \
|
||||
android.hardware.audio.service.samsung8974 \
|
||||
android.hardware.audio@7.1-impl:32 \
|
||||
android.hardware.audio.effect@7.0-impl:32 \
|
||||
audio.bluetooth.default \
|
||||
audio.primary.msm8974 \
|
||||
audio.r_submix.default \
|
||||
audio.usb.default \
|
||||
@ -60,6 +61,8 @@ PRODUCT_PACKAGES += \
|
||||
|
||||
# Bluetooth
|
||||
PRODUCT_PACKAGES += \
|
||||
audio.bluetooth.default \
|
||||
android.hardware.bluetooth.audio@2.0-impl \
|
||||
android.hardware.bluetooth@1.0-impl \
|
||||
android.hardware.bluetooth@1.0-service \
|
||||
libbt-vendor
|
||||
@ -85,8 +88,11 @@ PRODUCT_PACKAGES += \
|
||||
android.hardware.camera.provider@2.4-impl \
|
||||
camera.device@1.0-impl \
|
||||
camera.msm8974 \
|
||||
libxml2 \
|
||||
Snap
|
||||
libxml2
|
||||
|
||||
# Charger
|
||||
PRODUCT_PACKAGES += \
|
||||
charger_res_images_vendor
|
||||
|
||||
# DRM
|
||||
PRODUCT_PACKAGES += \
|
||||
@ -115,8 +121,8 @@ PRODUCT_COPY_FILES += \
|
||||
|
||||
# Health
|
||||
PRODUCT_PACKAGES += \
|
||||
android.hardware.health@2.1-impl \
|
||||
android.hardware.health@2.1-service
|
||||
android.hardware.health-service.samsung \
|
||||
android.hardware.health-service.samsung-recovery
|
||||
|
||||
# HIDL
|
||||
PRODUCT_ENFORCE_VINTF_MANIFEST_OVERRIDE := true
|
||||
@ -133,6 +139,11 @@ PRODUCT_COPY_FILES += \
|
||||
PRODUCT_PACKAGES += \
|
||||
android.hardware.keymaster@4.1-service
|
||||
|
||||
# libprocessgroup
|
||||
PRODUCT_COPY_FILES += \
|
||||
system/core/libprocessgroup/profiles/cgroups_28.json:$(TARGET_COPY_OUT_VENDOR)/etc/cgroups.json \
|
||||
system/core/libprocessgroup/profiles/task_profiles_28.json:$(TARGET_COPY_OUT_VENDOR)/etc/task_profiles.json
|
||||
|
||||
# Lights
|
||||
PRODUCT_PACKAGES += \
|
||||
android.hardware.light-service.samsung
|
||||
@ -162,7 +173,8 @@ PRODUCT_PACKAGES += \
|
||||
|
||||
# Power HAL
|
||||
PRODUCT_PACKAGES += \
|
||||
android.hardware.power-service-qti
|
||||
android.hardware.power-service-qti \
|
||||
android.hardware.power.stats@1.0-service.mock
|
||||
|
||||
# RenderScript HAL
|
||||
PRODUCT_PACKAGES += \
|
||||
@ -177,6 +189,12 @@ PRODUCT_PACKAGES += \
|
||||
android.hardware.sensors@1.0-impl.samsung8974 \
|
||||
android.hardware.sensors@1.0-service.samsung8974
|
||||
|
||||
# Speed profile services and wifi-service to reduce RAM and storage
|
||||
PRODUCT_SYSTEM_SERVER_COMPILER_FILTER := speed-profile
|
||||
PRODUCT_ALWAYS_PREOPT_EXTRACTED_APK := true
|
||||
PRODUCT_USE_PROFILE_FOR_BOOT_IMAGE := true
|
||||
PRODUCT_DEX_PREOPT_BOOT_IMAGE_PROFILE_LOCATION := frameworks/base/config/boot-image-profile.txt
|
||||
|
||||
# TimeKeep
|
||||
PRODUCT_PACKAGES += \
|
||||
timekeep \
|
||||
|
@ -25,4 +25,7 @@
|
||||
|
||||
<!-- AOSP WFD -->
|
||||
<bool name="config_enableWifiDisplay">true</bool>
|
||||
|
||||
<!-- Determines whether the shell features all run on another thread. -->
|
||||
<bool name="config_enableShellMainThread">true</bool>
|
||||
</resources>
|
||||
|
@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2021 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>
|
||||
<string-array name="configs_base">
|
||||
<!-- ART heap compaction for cached apps -->
|
||||
<item>activity_manager/use_compaction=true</item>
|
||||
</string-array>
|
||||
</resources>
|
@ -1,17 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2018 The LineageOS Project
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
include $(call first-makefiles-under,$(call my-dir))
|
@ -1,49 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2014 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef RIL_EX_H_INCLUDED
|
||||
#define RIL_EX_H_INCLUDED
|
||||
|
||||
#include <telephony/ril.h>
|
||||
#include <telephony/record_stream.h>
|
||||
|
||||
#define NUM_ELEMS_SOCKET(a) (sizeof (a) / sizeof (a)[0])
|
||||
|
||||
struct ril_event;
|
||||
|
||||
void rilEventAddWakeup_helper(struct ril_event *ev);
|
||||
int blockingWrite_helper(int fd, void* data, size_t len);
|
||||
|
||||
enum SocketWakeType {DONT_WAKE, WAKE_PARTIAL};
|
||||
|
||||
typedef enum {
|
||||
RIL_TELEPHONY_SOCKET,
|
||||
RIL_SAP_SOCKET
|
||||
} RIL_SOCKET_TYPE;
|
||||
|
||||
typedef struct SocketListenParam {
|
||||
RIL_SOCKET_ID socket_id;
|
||||
int fdListen;
|
||||
int fdCommand;
|
||||
const char* processName;
|
||||
struct ril_event* commands_event;
|
||||
struct ril_event* listen_event;
|
||||
void (*processCommandsCallback)(int fd, short flags, void *param);
|
||||
RecordStream *p_rs;
|
||||
RIL_SOCKET_TYPE type;
|
||||
} SocketListenParam;
|
||||
|
||||
#endif
|
@ -1,19 +0,0 @@
|
||||
/*
|
||||
**
|
||||
** Copyright 2018, The LineageOS 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.
|
||||
*/
|
||||
|
||||
static inline void remapUnsol(int *unsol __unused) {
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -1,806 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2006 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* ISSUES:
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* TODO
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef ANDROID_RIL_CDMA_SMS_H
|
||||
#define ANDROID_RIL_CDMA_SMS_H 1
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Used by RIL_REQUEST_CDMA_SEND_SMS and RIL_UNSOL_RESPONSE_CDMA_NEW_SMS */
|
||||
|
||||
#define RIL_CDMA_SMS_ADDRESS_MAX 36
|
||||
#define RIL_CDMA_SMS_SUBADDRESS_MAX 36
|
||||
#define RIL_CDMA_SMS_BEARER_DATA_MAX 255
|
||||
|
||||
typedef enum {
|
||||
RIL_CDMA_SMS_DIGIT_MODE_4_BIT = 0, /* DTMF digits */
|
||||
RIL_CDMA_SMS_DIGIT_MODE_8_BIT = 1,
|
||||
RIL_CDMA_SMS_DIGIT_MODE_MAX32 = 0x10000000 /* Force constant ENUM size in structures */
|
||||
} RIL_CDMA_SMS_DigitMode;
|
||||
|
||||
typedef enum {
|
||||
RIL_CDMA_SMS_NUMBER_MODE_NOT_DATA_NETWORK = 0,
|
||||
RIL_CDMA_SMS_NUMBER_MODE_DATA_NETWORK = 1,
|
||||
RIL_CDMA_SMS_NUMBER_MODE_MAX32 = 0x10000000 /* Force constant ENUM size in structures */
|
||||
} RIL_CDMA_SMS_NumberMode;
|
||||
|
||||
typedef enum {
|
||||
RIL_CDMA_SMS_NUMBER_TYPE_UNKNOWN = 0,
|
||||
RIL_CDMA_SMS_NUMBER_TYPE_INTERNATIONAL_OR_DATA_IP = 1,
|
||||
/* INTERNATIONAL is used when number mode is not data network address.
|
||||
* DATA_IP is used when the number mode is data network address
|
||||
*/
|
||||
RIL_CDMA_SMS_NUMBER_TYPE_NATIONAL_OR_INTERNET_MAIL = 2,
|
||||
/* NATIONAL is used when the number mode is not data network address.
|
||||
* INTERNET_MAIL is used when the number mode is data network address.
|
||||
* For INTERNET_MAIL, in the address data "digits", each byte contains
|
||||
* an ASCII character. Examples are "x@y.com,a@b.com - ref TIA/EIA-637A 3.4.3.3
|
||||
*/
|
||||
RIL_CDMA_SMS_NUMBER_TYPE_NETWORK = 3,
|
||||
RIL_CDMA_SMS_NUMBER_TYPE_SUBSCRIBER = 4,
|
||||
RIL_CDMA_SMS_NUMBER_TYPE_ALPHANUMERIC = 5,
|
||||
/* GSM SMS: address value is GSM 7-bit chars */
|
||||
RIL_CDMA_SMS_NUMBER_TYPE_ABBREVIATED = 6,
|
||||
RIL_CDMA_SMS_NUMBER_TYPE_RESERVED_7 = 7,
|
||||
RIL_CDMA_SMS_NUMBER_TYPE_MAX32 = 0x10000000 /* Force constant ENUM size in structures */
|
||||
} RIL_CDMA_SMS_NumberType;
|
||||
|
||||
typedef enum {
|
||||
RIL_CDMA_SMS_NUMBER_PLAN_UNKNOWN = 0,
|
||||
RIL_CDMA_SMS_NUMBER_PLAN_TELEPHONY = 1, /* CCITT E.164 and E.163, including ISDN plan */
|
||||
RIL_CDMA_SMS_NUMBER_PLAN_RESERVED_2 = 2,
|
||||
RIL_CDMA_SMS_NUMBER_PLAN_DATA = 3, /* CCITT X.121 */
|
||||
RIL_CDMA_SMS_NUMBER_PLAN_TELEX = 4, /* CCITT F.69 */
|
||||
RIL_CDMA_SMS_NUMBER_PLAN_RESERVED_5 = 5,
|
||||
RIL_CDMA_SMS_NUMBER_PLAN_RESERVED_6 = 6,
|
||||
RIL_CDMA_SMS_NUMBER_PLAN_RESERVED_7 = 7,
|
||||
RIL_CDMA_SMS_NUMBER_PLAN_RESERVED_8 = 8,
|
||||
RIL_CDMA_SMS_NUMBER_PLAN_PRIVATE = 9,
|
||||
RIL_CDMA_SMS_NUMBER_PLAN_RESERVED_10 = 10,
|
||||
RIL_CDMA_SMS_NUMBER_PLAN_RESERVED_11 = 11,
|
||||
RIL_CDMA_SMS_NUMBER_PLAN_RESERVED_12 = 12,
|
||||
RIL_CDMA_SMS_NUMBER_PLAN_RESERVED_13 = 13,
|
||||
RIL_CDMA_SMS_NUMBER_PLAN_RESERVED_14 = 14,
|
||||
RIL_CDMA_SMS_NUMBER_PLAN_RESERVED_15 = 15,
|
||||
RIL_CDMA_SMS_NUMBER_PLAN_MAX32 = 0x10000000 /* Force constant ENUM size in structures */
|
||||
} RIL_CDMA_SMS_NumberPlan;
|
||||
|
||||
typedef struct {
|
||||
RIL_CDMA_SMS_DigitMode digit_mode;
|
||||
/* Indicates 4-bit or 8-bit */
|
||||
RIL_CDMA_SMS_NumberMode number_mode;
|
||||
/* Used only when digitMode is 8-bit */
|
||||
RIL_CDMA_SMS_NumberType number_type;
|
||||
/* Used only when digitMode is 8-bit.
|
||||
* To specify an international address, use the following:
|
||||
* digitMode = RIL_CDMA_SMS_DIGIT_MODE_8_BIT
|
||||
* numberMode = RIL_CDMA_SMS_NOT_DATA_NETWORK
|
||||
* numberType = RIL_CDMA_SMS_NUMBER_TYPE_INTERNATIONAL_OR_DATA_IP
|
||||
* numberPlan = RIL_CDMA_SMS_NUMBER_PLAN_TELEPHONY
|
||||
* numberOfDigits = number of digits
|
||||
* digits = ASCII digits, e.g. '1', '2', '3'3, '4', and '5'
|
||||
*/
|
||||
RIL_CDMA_SMS_NumberPlan number_plan;
|
||||
/* Used only when digitMode is 8-bit */
|
||||
unsigned char number_of_digits;
|
||||
unsigned char digits[ RIL_CDMA_SMS_ADDRESS_MAX ];
|
||||
/* Each byte in this array represnts a 4-bit or 8-bit digit of address data */
|
||||
} RIL_CDMA_SMS_Address;
|
||||
|
||||
typedef enum {
|
||||
RIL_CDMA_SMS_SUBADDRESS_TYPE_NSAP = 0, /* CCITT X.213 or ISO 8348 AD2 */
|
||||
RIL_CDMA_SMS_SUBADDRESS_TYPE_USER_SPECIFIED = 1, /* e.g. X.25 */
|
||||
RIL_CDMA_SMS_SUBADDRESS_TYPE_MAX32 = 0x10000000 /* Force constant ENUM size in structures */
|
||||
} RIL_CDMA_SMS_SubaddressType;
|
||||
|
||||
typedef struct {
|
||||
RIL_CDMA_SMS_SubaddressType subaddressType;
|
||||
/* 1 means the last byte's lower 4 bits should be ignored */
|
||||
unsigned char odd;
|
||||
unsigned char number_of_digits;
|
||||
/* Each byte respresents a 8-bit digit of subaddress data */
|
||||
unsigned char digits[ RIL_CDMA_SMS_SUBADDRESS_MAX ];
|
||||
} RIL_CDMA_SMS_Subaddress;
|
||||
|
||||
typedef struct {
|
||||
int uTeleserviceID;
|
||||
unsigned char bIsServicePresent;
|
||||
int uServicecategory;
|
||||
RIL_CDMA_SMS_Address sAddress;
|
||||
RIL_CDMA_SMS_Subaddress sSubAddress;
|
||||
int uBearerDataLen;
|
||||
unsigned char aBearerData[ RIL_CDMA_SMS_BEARER_DATA_MAX ];
|
||||
} RIL_CDMA_SMS_Message;
|
||||
|
||||
/* Used by RIL_REQUEST_CDMA_SMS_ACKNOWLEDGE */
|
||||
|
||||
typedef enum {
|
||||
RIL_CDMA_SMS_NO_ERROR = 0,
|
||||
RIL_CDMA_SMS_ERROR = 1,
|
||||
RIL_CDMA_SMS_ERROR_MAX32 = 0x10000000 /* Force constant ENUM size in structures */
|
||||
} RIL_CDMA_SMS_ErrorClass;
|
||||
|
||||
typedef struct {
|
||||
RIL_CDMA_SMS_ErrorClass uErrorClass;
|
||||
int uSMSCauseCode; /* As defined in N.S00005, 6.5.2.125.
|
||||
Currently, only 35 (resource shortage) and
|
||||
39 (other terminal problem) are reported. */
|
||||
} RIL_CDMA_SMS_Ack;
|
||||
|
||||
/* Used by RIL_REQUEST_CDMA_SMS_GET_BROADCAST_CONFIG and
|
||||
RIL_REQUEST_CDMA_SMS_SET_BROADCAST_CONFIG */
|
||||
|
||||
typedef struct {
|
||||
int service_category;
|
||||
int language;
|
||||
unsigned char selected;
|
||||
} RIL_CDMA_BroadcastSmsConfigInfo;
|
||||
|
||||
/* Used by RIL_REQUEST_CDMA_WRITE_SMS_TO_RUIM */
|
||||
|
||||
typedef struct {
|
||||
int status; /* Status of message. See TS 27.005 3.1, "<stat>": */
|
||||
/* 0 = "REC UNREAD" */
|
||||
/* 1 = "REC READ" */
|
||||
/* 2 = "STO UNSENT" */
|
||||
/* 3 = "STO SENT" */
|
||||
|
||||
RIL_CDMA_SMS_Message message;
|
||||
} RIL_CDMA_SMS_WriteArgs;
|
||||
|
||||
|
||||
/* Used by RIL_REQUEST_ENCODE_CDMA_SMS and RIL_REQUEST_DECODE_CDMA_SMS*/
|
||||
|
||||
#define RIL_CDMA_SMS_UDH_MAX_SND_SIZE 128
|
||||
#define RIL_CDMA_SMS_UDH_EO_DATA_SEGMENT_MAX 131 /* 140 - 3 - 6 */
|
||||
#define RIL_CDMA_SMS_MAX_UD_HEADERS 7
|
||||
#define RIL_CDMA_SMS_USER_DATA_MAX 229
|
||||
#define RIL_CDMA_SMS_ADDRESS_MAX 36
|
||||
#define RIL_CDMA_SMS_UDH_LARGE_PIC_SIZE 128
|
||||
#define RIL_CDMA_SMS_UDH_SMALL_PIC_SIZE 32
|
||||
#define RIL_CDMA_SMS_UDH_VAR_PIC_SIZE 134
|
||||
#define RIL_CDMA_SMS_UDH_ANIM_NUM_BITMAPS 4
|
||||
#define RIL_CDMA_SMS_UDH_LARGE_BITMAP_SIZE 32
|
||||
#define RIL_CDMA_SMS_UDH_SMALL_BITMAP_SIZE 8
|
||||
#define RIL_CDMA_SMS_UDH_OTHER_SIZE 226
|
||||
#define RIL_CDMA_SMS_IP_ADDRESS_SIZE 4
|
||||
|
||||
/* ------------------- */
|
||||
/* ---- User Data ---- */
|
||||
/* ------------------- */
|
||||
typedef enum {
|
||||
RIL_CDMA_SMS_UDH_CONCAT_8 = 0x00,
|
||||
RIL_CDMA_SMS_UDH_SPECIAL_SM,
|
||||
/* 02 - 03 Reserved */
|
||||
RIL_CDMA_SMS_UDH_PORT_8 = 0x04,
|
||||
RIL_CDMA_SMS_UDH_PORT_16,
|
||||
RIL_CDMA_SMS_UDH_SMSC_CONTROL,
|
||||
RIL_CDMA_SMS_UDH_SOURCE,
|
||||
RIL_CDMA_SMS_UDH_CONCAT_16,
|
||||
RIL_CDMA_SMS_UDH_WCMP,
|
||||
RIL_CDMA_SMS_UDH_TEXT_FORMATING,
|
||||
RIL_CDMA_SMS_UDH_PRE_DEF_SOUND,
|
||||
RIL_CDMA_SMS_UDH_USER_DEF_SOUND,
|
||||
RIL_CDMA_SMS_UDH_PRE_DEF_ANIM,
|
||||
RIL_CDMA_SMS_UDH_LARGE_ANIM,
|
||||
RIL_CDMA_SMS_UDH_SMALL_ANIM,
|
||||
RIL_CDMA_SMS_UDH_LARGE_PICTURE,
|
||||
RIL_CDMA_SMS_UDH_SMALL_PICTURE,
|
||||
RIL_CDMA_SMS_UDH_VAR_PICTURE,
|
||||
|
||||
RIL_CDMA_SMS_UDH_USER_PROMPT = 0x13,
|
||||
RIL_CDMA_SMS_UDH_EXTENDED_OBJECT = 0x14,
|
||||
|
||||
/* 15 - 1F Reserved for future EMS */
|
||||
|
||||
RIL_CDMA_SMS_UDH_RFC822 = 0x20,
|
||||
|
||||
/* 21 - 6F Reserved for future use */
|
||||
/* 70 - 7f Reserved for (U)SIM Toolkit Security Headers */
|
||||
/* 80 - 9F SME to SME specific use */
|
||||
/* A0 - BF Reserved for future use */
|
||||
/* C0 - DF SC specific use */
|
||||
/* E0 - FF Reserved for future use */
|
||||
|
||||
RIL_CDMA_SMS_UDH_OTHER = 0xFFFF, /* For unsupported or proprietary headers */
|
||||
RIL_CDMA_SMS_UDH_ID_MAX32 = 0x10000000 /* Force constant ENUM size in structures */
|
||||
|
||||
} RIL_CDMA_SMS_UdhId;
|
||||
|
||||
typedef struct {
|
||||
/*indicates the reference number for a particular concatenated short message. */
|
||||
/*it is constant for every short message which makes up a particular concatenated short message*/
|
||||
unsigned char msg_ref;
|
||||
|
||||
/*indicates the total number of short messages within the concatenated short message.
|
||||
The value shall start at 1 and remain constant for every
|
||||
short message which makes up the concatenated short message.
|
||||
if it is 0 then the receiving entity shall ignore the whole Information Element*/
|
||||
unsigned char total_sm;
|
||||
|
||||
/*
|
||||
* it indicates the sequence number of a particular short message within the concatenated short
|
||||
* message. The value shall start at 1 and increment by one for every short message sent
|
||||
* within the concatenated short message. If the value is zero or the value is
|
||||
* greater than the value in octet 2 then the receiving
|
||||
* entity shall ignore the whole Information Element.
|
||||
*/
|
||||
unsigned char seq_num;
|
||||
} RIL_CDMA_SMS_UdhConcat8;
|
||||
|
||||
/* GW message waiting actions
|
||||
*/
|
||||
typedef enum {
|
||||
RIL_CDMA_SMS_GW_MSG_WAITING_NONE,
|
||||
RIL_CDMA_SMS_GW_MSG_WAITING_DISCARD,
|
||||
RIL_CDMA_SMS_GW_MSG_WAITING_STORE,
|
||||
RIL_CDMA_SMS_GW_MSG_WAITING_NONE_1111,
|
||||
RIL_CDMA_SMS_GW_MSG_WAITING_MAX32 = 0x10000000 /* Force constant ENUM size in structures */
|
||||
} RIL_CDMA_SMS_GWMsgWaiting;
|
||||
|
||||
/* GW message waiting types
|
||||
*/
|
||||
typedef enum {
|
||||
RIL_CDMA_SMS_GW_MSG_WAITING_VOICEMAIL,
|
||||
RIL_CDMA_SMS_GW_MSG_WAITING_FAX,
|
||||
RIL_CDMA_SMS_GW_MSG_WAITING_EMAIL,
|
||||
RIL_CDMA_SMS_GW_MSG_WAITING_OTHER,
|
||||
RIL_CDMA_SMS_GW_MSG_WAITING_KIND_MAX32 = 0x10000000 /* Force constant ENUM size in structures */
|
||||
} RIL_CDMA_SMS_GWMsgWaitingKind;
|
||||
|
||||
typedef struct {
|
||||
RIL_CDMA_SMS_GWMsgWaiting msg_waiting;
|
||||
RIL_CDMA_SMS_GWMsgWaitingKind msg_waiting_kind;
|
||||
|
||||
/*it indicates the number of messages of the type specified in Octet 1 waiting.*/
|
||||
unsigned char message_count;
|
||||
} RIL_CDMA_SMS_UdhSpecialSM;
|
||||
|
||||
typedef struct {
|
||||
unsigned char dest_port;
|
||||
unsigned char orig_port;
|
||||
} RIL_CDMA_SMS_UdhWap8;
|
||||
|
||||
typedef struct {
|
||||
unsigned short dest_port;
|
||||
unsigned short orig_port;
|
||||
} RIL_CDMA_SMS_UdhWap16;
|
||||
|
||||
typedef struct {
|
||||
unsigned short msg_ref;
|
||||
unsigned char total_sm;
|
||||
unsigned char seq_num;
|
||||
|
||||
} RIL_CDMA_SMS_UdhConcat16;
|
||||
|
||||
typedef enum {
|
||||
RIL_CDMA_SMS_UDH_LEFT_ALIGNMENT = 0,
|
||||
RIL_CDMA_SMS_UDH_CENTER_ALIGNMENT,
|
||||
RIL_CDMA_SMS_UDH_RIGHT_ALIGNMENT,
|
||||
RIL_CDMA_SMS_UDH_DEFAULT_ALIGNMENT,
|
||||
RIL_CDMA_SMS_UDH_MAX_ALIGNMENT,
|
||||
RIL_CDMA_SMS_UDH_ALIGNMENT_MAX32 = 0x10000000 /* Force constant ENUM size in structures */
|
||||
} RIL_CDMA_SMS_UdhAlignment;
|
||||
|
||||
typedef enum {
|
||||
RIL_CDMA_SMS_UDH_FONT_NORMAL = 0,
|
||||
RIL_CDMA_SMS_UDH_FONT_LARGE,
|
||||
RIL_CDMA_SMS_UDH_FONT_SMALL,
|
||||
RIL_CDMA_SMS_UDH_FONT_RESERVED,
|
||||
RIL_CDMA_SMS_UDH_FONT_MAX,
|
||||
RIL_CDMA_SMS_UDH_FONT_MAX32 = 0x10000000 /* Force constant ENUM size in structures */
|
||||
} RIL_CDMA_SMS_UdhFontSize;
|
||||
|
||||
typedef enum {
|
||||
RIL_CDMA_SMS_UDH_TEXT_COLOR_BLACK = 0x0,
|
||||
RIL_CDMA_SMS_UDH_TEXT_COLOR_DARK_GREY = 0x1,
|
||||
RIL_CDMA_SMS_UDH_TEXT_COLOR_DARK_RED = 0x2,
|
||||
RIL_CDMA_SMS_UDH_TEXT_COLOR_DARK_YELLOW = 0x3,
|
||||
RIL_CDMA_SMS_UDH_TEXT_COLOR_DARK_GREEN = 0x4,
|
||||
RIL_CDMA_SMS_UDH_TEXT_COLOR_DARK_CYAN = 0x5,
|
||||
RIL_CDMA_SMS_UDH_TEXT_COLOR_DARK_BLUE = 0x6,
|
||||
RIL_CDMA_SMS_UDH_TEXT_COLOR_DARK_MAGENTA = 0x7,
|
||||
RIL_CDMA_SMS_UDH_TEXT_COLOR_GREY = 0x8,
|
||||
RIL_CDMA_SMS_UDH_TEXT_COLOR_WHITE = 0x9,
|
||||
RIL_CDMA_SMS_UDH_TEXT_COLOR_BRIGHT_RED = 0xA,
|
||||
RIL_CDMA_SMS_UDH_TEXT_COLOR_BRIGHT_YELLOW = 0xB,
|
||||
RIL_CDMA_SMS_UDH_TEXT_COLOR_BRIGHT_GREEN = 0xC,
|
||||
RIL_CDMA_SMS_UDH_TEXT_COLOR_BRIGHT_CYAN = 0xD,
|
||||
RIL_CDMA_SMS_UDH_TEXT_COLOR_BRIGHT_BLUE = 0xE,
|
||||
RIL_CDMA_SMS_UDH_TEXT_COLOR_BRIGHT_MAGENTA = 0xF,
|
||||
RIL_CDMA_SMS_UDH_TEXT_COLOR_MAX32 = 0x10000000 /* Force constant ENUM size in structures */
|
||||
} RIL_CDMA_SMS_UdhTextColor;
|
||||
|
||||
typedef struct {
|
||||
unsigned char start_position;
|
||||
unsigned char text_formatting_length;
|
||||
RIL_CDMA_SMS_UdhAlignment alignment_type ; /*bit 0 and bit 1*/
|
||||
RIL_CDMA_SMS_UdhFontSize font_size ; /*bit 3 and bit 2*/
|
||||
unsigned char style_bold; /*bit 4 */
|
||||
unsigned char style_italic; /*bit 5 */
|
||||
unsigned char style_underlined; /*bit 6 */
|
||||
unsigned char style_strikethrough; /*bit 7 */
|
||||
|
||||
/* if FALSE, ignore the following color information */
|
||||
unsigned char is_color_present;
|
||||
RIL_CDMA_SMS_UdhTextColor text_color_foreground;
|
||||
RIL_CDMA_SMS_UdhTextColor text_color_background;
|
||||
|
||||
} RIL_CDMA_SMS_UdhTextFormating;
|
||||
|
||||
/* Predefined sound
|
||||
*/
|
||||
typedef struct {
|
||||
unsigned char position;
|
||||
unsigned char snd_number;
|
||||
} RIL_CDMA_SMS_UdhPreDefSound;
|
||||
|
||||
/* User Defined sound
|
||||
*/
|
||||
typedef struct {
|
||||
unsigned char data_length;
|
||||
unsigned char position;
|
||||
unsigned char user_def_sound[RIL_CDMA_SMS_UDH_MAX_SND_SIZE];
|
||||
} RIL_CDMA_SMS_UdhUserDefSound;
|
||||
|
||||
/* Large picture
|
||||
*/
|
||||
typedef struct {
|
||||
unsigned char position;
|
||||
unsigned char data[RIL_CDMA_SMS_UDH_LARGE_PIC_SIZE];
|
||||
} RIL_CDMA_SMS_UdhLargePictureData;
|
||||
|
||||
/* Small picture
|
||||
*/
|
||||
typedef struct {
|
||||
unsigned char position;
|
||||
unsigned char data[RIL_CDMA_SMS_UDH_SMALL_PIC_SIZE];
|
||||
} RIL_CDMA_SMS_UdhSmallPictureData;
|
||||
|
||||
/* Variable length picture
|
||||
*/
|
||||
typedef struct {
|
||||
unsigned char position;
|
||||
unsigned char width; /* Number of pixels - Should be a mutliple of 8 */
|
||||
unsigned char height;
|
||||
unsigned char data[RIL_CDMA_SMS_UDH_VAR_PIC_SIZE];
|
||||
} RIL_CDMA_SMS_UdhVarPicture;
|
||||
|
||||
/* Predefined animation
|
||||
*/
|
||||
typedef struct {
|
||||
unsigned char position;
|
||||
unsigned char animation_number;
|
||||
} RIL_CDMA_SMS_UdhPreDefAnim;
|
||||
|
||||
/* Large animation
|
||||
*/
|
||||
typedef struct {
|
||||
unsigned char position;
|
||||
unsigned char data[RIL_CDMA_SMS_UDH_ANIM_NUM_BITMAPS][RIL_CDMA_SMS_UDH_LARGE_BITMAP_SIZE];
|
||||
} RIL_CDMA_SMS_UdhLargeAnim;
|
||||
|
||||
/* Small animation
|
||||
*/
|
||||
typedef struct {
|
||||
unsigned char position;
|
||||
unsigned char data[RIL_CDMA_SMS_UDH_ANIM_NUM_BITMAPS][RIL_CDMA_SMS_UDH_SMALL_BITMAP_SIZE];
|
||||
} RIL_CDMA_SMS_UdhSmallAnim;
|
||||
|
||||
/* User Prompt Indicator UDH
|
||||
*/
|
||||
typedef struct {
|
||||
unsigned char number_of_objects;
|
||||
/* Number of objects of the same kind that follow this header which will
|
||||
** be stitched together by the applications. For example, 5 small pictures
|
||||
** are to be stitched together horizontally, or 6 iMelody tones are to be
|
||||
** connected together with intermediate iMelody header and footer ignored.
|
||||
** Allowed objects to be stitched:
|
||||
** - Images (small, large, variable)
|
||||
** - User defined sounds
|
||||
*/
|
||||
} RIL_CDMA_SMS_UdhUserPrompt;
|
||||
|
||||
typedef struct {
|
||||
unsigned char length;
|
||||
|
||||
unsigned char data[RIL_CDMA_SMS_UDH_EO_DATA_SEGMENT_MAX];
|
||||
/* RIL_CDMA_SMS_UDH_EO_VCARD: See http://www.imc.org/pdi/vcard-21.doc for payload */
|
||||
/* RIL_CDMA_SMS_UDH_EO_VCALENDAR: See http://www.imc.org/pdi/vcal-10.doc */
|
||||
/* Or: Unsupported/proprietary extended objects */
|
||||
|
||||
} RIL_CDMA_SMS_UdhEoContent;
|
||||
|
||||
/* Extended Object UDH
|
||||
*/
|
||||
/* Extended Object IDs/types
|
||||
*/
|
||||
typedef enum {
|
||||
RIL_CDMA_SMS_UDH_EO_VCARD = 0x09,
|
||||
RIL_CDMA_SMS_UDH_EO_VCALENDAR = 0x0A,
|
||||
RIL_CDMA_SMS_UDH_EO_MAX32 = 0x10000000 /* Force constant ENUM size in structures */
|
||||
} RIL_CDMA_SMS_UdhEoId;
|
||||
|
||||
typedef struct {
|
||||
/* Extended objects are to be used together with 16-bit concatenation
|
||||
** UDH. The max number of segments supported for E.O. is 8 at least.
|
||||
*/
|
||||
RIL_CDMA_SMS_UdhEoContent content;
|
||||
|
||||
unsigned char first_segment;
|
||||
/* The following fields are only present in the first segment of a
|
||||
** concatenated SMS message.
|
||||
*/
|
||||
unsigned char reference;
|
||||
/* Identify those extended object segments which should be linked together
|
||||
*/
|
||||
unsigned short length;
|
||||
/* Length of the whole extended object data
|
||||
*/
|
||||
unsigned char control;
|
||||
RIL_CDMA_SMS_UdhEoId type;
|
||||
unsigned short position;
|
||||
/* Absolute position of the E.O. in the whole text after concatenation,
|
||||
** starting from 1.
|
||||
*/
|
||||
} RIL_CDMA_SMS_UdhEo;
|
||||
|
||||
typedef struct {
|
||||
RIL_CDMA_SMS_UdhId header_id;
|
||||
unsigned char header_length;
|
||||
unsigned char data[RIL_CDMA_SMS_UDH_OTHER_SIZE];
|
||||
} RIL_CDMA_SMS_UdhOther;
|
||||
|
||||
typedef struct {
|
||||
unsigned char header_length;
|
||||
} RIL_CDMA_SMS_UdhRfc822;
|
||||
|
||||
typedef struct {
|
||||
RIL_CDMA_SMS_UdhId header_id;
|
||||
|
||||
union {
|
||||
RIL_CDMA_SMS_UdhConcat8 concat_8; // 00
|
||||
|
||||
RIL_CDMA_SMS_UdhSpecialSM special_sm; // 01
|
||||
RIL_CDMA_SMS_UdhWap8 wap_8; // 04
|
||||
RIL_CDMA_SMS_UdhWap16 wap_16; // 05
|
||||
RIL_CDMA_SMS_UdhConcat16 concat_16; // 08
|
||||
RIL_CDMA_SMS_UdhTextFormating text_formating; // 0a
|
||||
RIL_CDMA_SMS_UdhPreDefSound pre_def_sound; // 0b
|
||||
RIL_CDMA_SMS_UdhUserDefSound user_def_sound; // 0c
|
||||
RIL_CDMA_SMS_UdhPreDefAnim pre_def_anim; // 0d
|
||||
RIL_CDMA_SMS_UdhLargeAnim large_anim; // 0e
|
||||
RIL_CDMA_SMS_UdhSmallAnim small_anim; // 0f
|
||||
RIL_CDMA_SMS_UdhLargePictureData large_picture; // 10
|
||||
RIL_CDMA_SMS_UdhSmallPictureData small_picture; // 11
|
||||
RIL_CDMA_SMS_UdhVarPicture var_picture; // 12
|
||||
|
||||
RIL_CDMA_SMS_UdhUserPrompt user_prompt; // 13
|
||||
RIL_CDMA_SMS_UdhEo eo; // 14
|
||||
|
||||
RIL_CDMA_SMS_UdhRfc822 rfc822; // 20
|
||||
RIL_CDMA_SMS_UdhOther other;
|
||||
|
||||
}u;
|
||||
} RIL_CDMA_SMS_Udh;
|
||||
|
||||
/* ----------------------------- */
|
||||
/* -- User data encoding type -- */
|
||||
/* ----------------------------- */
|
||||
typedef enum {
|
||||
RIL_CDMA_SMS_ENCODING_OCTET = 0, /* 8-bit */
|
||||
RIL_CDMA_SMS_ENCODING_IS91EP, /* varies */
|
||||
RIL_CDMA_SMS_ENCODING_ASCII, /* 7-bit */
|
||||
RIL_CDMA_SMS_ENCODING_IA5, /* 7-bit */
|
||||
RIL_CDMA_SMS_ENCODING_UNICODE, /* 16-bit */
|
||||
RIL_CDMA_SMS_ENCODING_SHIFT_JIS, /* 8 or 16-bit */
|
||||
RIL_CDMA_SMS_ENCODING_KOREAN, /* 8 or 16-bit */
|
||||
RIL_CDMA_SMS_ENCODING_LATIN_HEBREW, /* 8-bit */
|
||||
RIL_CDMA_SMS_ENCODING_LATIN, /* 8-bit */
|
||||
RIL_CDMA_SMS_ENCODING_GSM_7_BIT_DEFAULT, /* 7-bit */
|
||||
RIL_CDMA_SMS_ENCODING_MAX32 = 0x10000000
|
||||
|
||||
} RIL_CDMA_SMS_UserDataEncoding;
|
||||
|
||||
/* ------------------------ */
|
||||
/* -- IS-91 EP data type -- */
|
||||
/* ------------------------ */
|
||||
typedef enum {
|
||||
RIL_CDMA_SMS_IS91EP_VOICE_MAIL = 0x82,
|
||||
RIL_CDMA_SMS_IS91EP_SHORT_MESSAGE_FULL = 0x83,
|
||||
RIL_CDMA_SMS_IS91EP_CLI_ORDER = 0x84,
|
||||
RIL_CDMA_SMS_IS91EP_SHORT_MESSAGE = 0x85,
|
||||
RIL_CDMA_SMS_IS91EP_MAX32 = 0x10000000
|
||||
|
||||
} RIL_CDMA_SMS_IS91EPType;
|
||||
|
||||
typedef struct {
|
||||
/* NOTE: If message_id.udh_present == TRUE:
|
||||
** 'num_headers' is the number of User Data Headers (UDHs),
|
||||
** and 'headers' include all those headers.
|
||||
*/
|
||||
unsigned char num_headers;
|
||||
RIL_CDMA_SMS_Udh headers[RIL_CDMA_SMS_MAX_UD_HEADERS];
|
||||
|
||||
RIL_CDMA_SMS_UserDataEncoding encoding;
|
||||
RIL_CDMA_SMS_IS91EPType is91ep_type;
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
'data_len' indicates the valid number of bytes in the 'data' array.
|
||||
|
||||
'padding_bits' (0-7) indicates how many bits in the last byte of 'data'
|
||||
are invalid bits. This parameter is only used for Mobile-Originated
|
||||
messages. There is no way for the API to tell how many padding bits
|
||||
exist in the received message. Instead, the application can find out how
|
||||
many padding bits exist in the user data when decoding the user data.
|
||||
|
||||
'data' has the raw bits of the user data field of the SMS message.
|
||||
The client software should decode the raw user data according to its
|
||||
supported encoding types and languages.
|
||||
|
||||
EXCEPTION 1: CMT-91 user data raw bits are first translated into BD fields
|
||||
(e.g. num_messages, callback, etc.) The translated user data field in
|
||||
VMN and Short Message is in the form of ASCII characters, each occupying
|
||||
a byte in the resulted 'data'.
|
||||
|
||||
EXCEPTION 2: GSM 7-bit Default characters are decoded so that each byte
|
||||
has one 7-bit GSM character.
|
||||
|
||||
'number_of_digits' is the number of digits/characters (7, 8, 16, or
|
||||
whatever bits) in the raw user data, which can be used by the client
|
||||
when decoding the user data according to the encoding type and language.
|
||||
-------------------------------------------------------------------------*/
|
||||
unsigned char data_len;
|
||||
unsigned char padding_bits;
|
||||
unsigned char data[ RIL_CDMA_SMS_USER_DATA_MAX ];
|
||||
unsigned char number_of_digits;
|
||||
|
||||
} RIL_CDMA_SMS_CdmaUserData;
|
||||
|
||||
/* -------------------- */
|
||||
/* ---- Message Id ---- */
|
||||
/* -------------------- */
|
||||
typedef enum {
|
||||
RIL_CDMA_SMS_BD_TYPE_RESERVED_0 = 0,
|
||||
RIL_CDMA_SMS_BD_TYPE_DELIVER, /* MT only */
|
||||
RIL_CDMA_SMS_BD_TYPE_SUBMIT, /* MO only */
|
||||
RIL_CDMA_SMS_BD_TYPE_CANCELLATION, /* MO only */
|
||||
RIL_CDMA_SMS_BD_TYPE_DELIVERY_ACK, /* MT only */
|
||||
RIL_CDMA_SMS_BD_TYPE_USER_ACK, /* MT & MO */
|
||||
RIL_CDMA_SMS_BD_TYPE_READ_ACK, /* MT & MO */
|
||||
RIL_CDMA_SMS_BD_TYPE_MAX32 = 0x10000000
|
||||
|
||||
} RIL_CDMA_SMS_BdMessageType;
|
||||
|
||||
typedef unsigned int RIL_CDMA_SMS_MessageNumber;
|
||||
|
||||
typedef struct {
|
||||
RIL_CDMA_SMS_BdMessageType type;
|
||||
RIL_CDMA_SMS_MessageNumber id_number;
|
||||
unsigned char udh_present;
|
||||
/* NOTE: if FEATURE_SMS_UDH is not defined,
|
||||
** udh_present should be ignored.
|
||||
*/
|
||||
} RIL_CDMA_SMS_MessageId;
|
||||
|
||||
typedef unsigned char RIL_CDMA_SMS_UserResponse;
|
||||
|
||||
/* ------------------- */
|
||||
/* ---- Timestamp ---- */
|
||||
/* ------------------- */
|
||||
typedef struct {
|
||||
/* If 'year' is between 96 and 99, the actual year is 1900 + 'year';
|
||||
if 'year' is between 00 and 95, the actual year is 2000 + 'year'.
|
||||
NOTE: Each field has two BCD digits and byte arrangement is <MSB, ... ,LSB>
|
||||
*/
|
||||
unsigned char year; /* 0x00-0x99 */
|
||||
unsigned char month; /* 0x01-0x12 */
|
||||
unsigned char day; /* 0x01-0x31 */
|
||||
unsigned char hour; /* 0x00-0x23 */
|
||||
unsigned char minute; /* 0x00-0x59 */
|
||||
unsigned char second; /* 0x00-0x59 */
|
||||
signed char timezone; /* +/-, [-48,+48] number of 15 minutes - GW only */
|
||||
} RIL_CDMA_SMS_Timestamp;
|
||||
|
||||
/* ------------------ */
|
||||
/* ---- Priority ---- */
|
||||
/* ------------------ */
|
||||
typedef enum {
|
||||
RIL_CDMA_SMS_PRIORITY_NORMAL = 0,
|
||||
RIL_CDMA_SMS_PRIORITY_INTERACTIVE,
|
||||
RIL_CDMA_SMS_PRIORITY_URGENT,
|
||||
RIL_CDMA_SMS_PRIORITY_EMERGENCY,
|
||||
RIL_CDMA_SMS_PRIORITY_MAX32 = 0x10000000
|
||||
|
||||
} RIL_CDMA_SMS_Priority;
|
||||
|
||||
/* ----------------- */
|
||||
/* ---- Privacy ---- */
|
||||
/* ----------------- */
|
||||
typedef enum {
|
||||
RIL_CDMA_SMS_PRIVACY_NORMAL = 0,
|
||||
RIL_CDMA_SMS_PRIVACY_RESTRICTED,
|
||||
RIL_CDMA_SMS_PRIVACY_CONFIDENTIAL,
|
||||
RIL_CDMA_SMS_PRIVACY_SECRET,
|
||||
RIL_CDMA_SMS_PRIVACY_MAX32 = 0x10000000
|
||||
|
||||
} RIL_CDMA_SMS_Privacy;
|
||||
|
||||
/* ---------------------- */
|
||||
/* ---- Reply option ---- */
|
||||
/* ---------------------- */
|
||||
typedef struct {
|
||||
/* whether user ack is requested
|
||||
*/
|
||||
unsigned char user_ack_requested;
|
||||
|
||||
/* whether delivery ack is requested.
|
||||
Should be FALSE for incoming messages.
|
||||
*/
|
||||
unsigned char delivery_ack_requested;
|
||||
|
||||
/* Message originator requests the receiving phone to send back a READ_ACK
|
||||
** message automatically when the user reads the received message.
|
||||
*/
|
||||
unsigned char read_ack_requested;
|
||||
|
||||
} RIL_CDMA_SMS_ReplyOption;
|
||||
|
||||
typedef enum {
|
||||
RIL_CDMA_SMS_ALERT_MODE_DEFAULT = 0,
|
||||
RIL_CDMA_SMS_ALERT_MODE_LOW_PRIORITY = 1,
|
||||
RIL_CDMA_SMS_ALERT_MODE_MEDIUM_PRIORITY = 2,
|
||||
RIL_CDMA_SMS_ALERT_MODE_HIGH_PRIORITY = 3,
|
||||
|
||||
/* For pre-IS637A implementations, alert_mode only has values of True/False:
|
||||
*/
|
||||
RIL_CDMA_SMS_ALERT_MODE_OFF = 0,
|
||||
RIL_CDMA_SMS_ALERT_MODE_ON = 1
|
||||
|
||||
} RIL_CDMA_SMS_AlertMode;
|
||||
|
||||
/* ------------------ */
|
||||
/* ---- Language ---- */
|
||||
/* ------------------ */
|
||||
typedef enum {
|
||||
RIL_CDMA_SMS_LANGUAGE_UNSPECIFIED = 0,
|
||||
RIL_CDMA_SMS_LANGUAGE_ENGLISH,
|
||||
RIL_CDMA_SMS_LANGUAGE_FRENCH,
|
||||
RIL_CDMA_SMS_LANGUAGE_SPANISH,
|
||||
RIL_CDMA_SMS_LANGUAGE_JAPANESE,
|
||||
RIL_CDMA_SMS_LANGUAGE_KOREAN,
|
||||
RIL_CDMA_SMS_LANGUAGE_CHINESE,
|
||||
RIL_CDMA_SMS_LANGUAGE_HEBREW,
|
||||
RIL_CDMA_SMS_LANGUAGE_MAX32 = 0x10000000
|
||||
|
||||
} RIL_CDMA_SMS_Language;
|
||||
|
||||
/* ---------------------------------- */
|
||||
/* ---------- Display Mode ---------- */
|
||||
/* ---------------------------------- */
|
||||
typedef enum {
|
||||
RIL_CDMA_SMS_DISPLAY_MODE_IMMEDIATE = 0,
|
||||
RIL_CDMA_SMS_DISPLAY_MODE_DEFAULT = 1,
|
||||
RIL_CDMA_SMS_DISPLAY_MODE_USER_INVOKE = 2,
|
||||
RIL_CDMA_SMS_DISPLAY_MODE_RESERVED = 3
|
||||
} RIL_CDMA_SMS_DisplayMode;
|
||||
|
||||
/* IS-637B parameters/fields
|
||||
*/
|
||||
|
||||
/* ---------------------------------- */
|
||||
/* ---------- Delivery Status ------- */
|
||||
/* ---------------------------------- */
|
||||
typedef enum {
|
||||
RIL_CDMA_SMS_DELIVERY_STATUS_ACCEPTED = 0, /* ERROR_CLASS_NONE */
|
||||
RIL_CDMA_SMS_DELIVERY_STATUS_DEPOSITED_TO_INTERNET = 1, /* ERROR_CLASS_NONE */
|
||||
RIL_CDMA_SMS_DELIVERY_STATUS_DELIVERED = 2, /* ERROR_CLASS_NONE */
|
||||
RIL_CDMA_SMS_DELIVERY_STATUS_CANCELLED = 3, /* ERROR_CLASS_NONE */
|
||||
|
||||
RIL_CDMA_SMS_DELIVERY_STATUS_NETWORK_CONGESTION = 4, /* ERROR_CLASS_TEMP & PERM */
|
||||
RIL_CDMA_SMS_DELIVERY_STATUS_NETWORK_ERROR = 5, /* ERROR_CLASS_TEMP & PERM */
|
||||
RIL_CDMA_SMS_DELIVERY_STATUS_CANCEL_FAILED = 6, /* ERROR_CLASS_PERM */
|
||||
RIL_CDMA_SMS_DELIVERY_STATUS_BLOCKED_DESTINATION = 7, /* ERROR_CLASS_PERM */
|
||||
RIL_CDMA_SMS_DELIVERY_STATUS_TEXT_TOO_LONG = 8, /* ERROR_CLASS_PERM */
|
||||
RIL_CDMA_SMS_DELIVERY_STATUS_DUPLICATE_MESSAGE = 9, /* ERROR_CLASS_PERM */
|
||||
RIL_CDMA_SMS_DELIVERY_STATUS_INVALID_DESTINATION = 10, /* ERROR_CLASS_PERM */
|
||||
RIL_CDMA_SMS_DELIVERY_STATUS_MESSAGE_EXPIRED = 13, /* ERROR_CLASS_PERM */
|
||||
|
||||
RIL_CDMA_SMS_DELIVERY_STATUS_UNKNOWN_ERROR = 0x1F /* ERROR_CLASS_PERM */
|
||||
|
||||
/* All the other values are reserved */
|
||||
|
||||
} RIL_CDMA_SMS_DeliveryStatusE;
|
||||
|
||||
typedef struct {
|
||||
RIL_CDMA_SMS_ErrorClass error_class;
|
||||
RIL_CDMA_SMS_DeliveryStatusE status;
|
||||
} RIL_CDMA_SMS_DeliveryStatus;
|
||||
|
||||
typedef struct {
|
||||
unsigned char address[RIL_CDMA_SMS_IP_ADDRESS_SIZE];
|
||||
unsigned char is_valid;
|
||||
} RIL_CDMA_SMS_IpAddress;
|
||||
|
||||
/* This special parameter captures any unrecognized/proprietary parameters
|
||||
*/
|
||||
typedef struct {
|
||||
unsigned char input_other_len;
|
||||
unsigned char desired_other_len; /* used during decoding */
|
||||
unsigned char * other_data;
|
||||
} RIL_CDMA_SMS_OtherParm;
|
||||
|
||||
typedef struct {
|
||||
/* the mask indicates which fields are present in this message */
|
||||
unsigned int mask;
|
||||
|
||||
RIL_CDMA_SMS_MessageId message_id;
|
||||
RIL_CDMA_SMS_CdmaUserData user_data;
|
||||
RIL_CDMA_SMS_UserResponse user_response;
|
||||
RIL_CDMA_SMS_Timestamp mc_time;
|
||||
RIL_CDMA_SMS_Timestamp validity_absolute;
|
||||
RIL_CDMA_SMS_Timestamp validity_relative;
|
||||
RIL_CDMA_SMS_Timestamp deferred_absolute;
|
||||
RIL_CDMA_SMS_Timestamp deferred_relative;
|
||||
RIL_CDMA_SMS_Priority priority;
|
||||
RIL_CDMA_SMS_Privacy privacy;
|
||||
RIL_CDMA_SMS_ReplyOption reply_option;
|
||||
unsigned char num_messages; /* the actual value; not BCDs */
|
||||
RIL_CDMA_SMS_AlertMode alert_mode;
|
||||
/* For pre-IS-637A implementations, alert_mode is either Off or On. */
|
||||
RIL_CDMA_SMS_Language language;
|
||||
RIL_CDMA_SMS_Address callback;
|
||||
RIL_CDMA_SMS_DisplayMode display_mode;
|
||||
|
||||
RIL_CDMA_SMS_DeliveryStatus delivery_status;
|
||||
unsigned int deposit_index;
|
||||
|
||||
RIL_CDMA_SMS_IpAddress ip_address;
|
||||
unsigned char rsn_no_notify;
|
||||
|
||||
/* See function comments of wms_ts_decode() and
|
||||
** wms_ts_decode_cdma_bd_with_other() for details regarding 'other' parameters
|
||||
*/
|
||||
RIL_CDMA_SMS_OtherParm other;
|
||||
|
||||
} RIL_CDMA_SMS_ClientBd;
|
||||
|
||||
typedef struct {
|
||||
unsigned char length; /* length, in bytes, of the encoded SMS message */
|
||||
unsigned char * data; /* the encoded SMS message (max 255 bytes) */
|
||||
} RIL_CDMA_Encoded_SMS;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /*ANDROID_RIL_CDMA_SMS_H*/
|
@ -1,71 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2019 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef RIL_MCC_H
|
||||
#define RIL_MCC_H
|
||||
|
||||
#include <climits>
|
||||
#include <cstdio>
|
||||
#include <string>
|
||||
|
||||
namespace ril {
|
||||
namespace util {
|
||||
namespace mcc {
|
||||
|
||||
/**
|
||||
* Decode an integer mcc and encode as 3 digit string
|
||||
*
|
||||
* @param an integer mcc, its range should be in 0 to 999.
|
||||
*
|
||||
* @return string representation of an encoded MCC or an empty string
|
||||
* if the MCC is not a valid MCC value.
|
||||
*/
|
||||
static inline std::string decode(int mcc) {
|
||||
char mccStr[4] = {0};
|
||||
if (mcc > 999 || mcc < 0) return "";
|
||||
|
||||
snprintf(mccStr, sizeof(mccStr), "%03d", mcc);
|
||||
return mccStr;
|
||||
}
|
||||
|
||||
// echo -e "#include \"hardware/ril/include/telephony/ril_mcc.h\"\nint main()"\
|
||||
// "{ return ril::util::mcc::test(); }" > ril_test.cpp \
|
||||
// && g++ -o /tmp/ril_test -DTEST_RIL_MCC ril_test.cpp; \
|
||||
// rm ril_test.cpp; /tmp/ril_test && [ $? ] && echo "passed"
|
||||
#ifdef TEST_RIL_MCC
|
||||
static int test() {
|
||||
const struct mcc_ints { const int in; const char * out; } legacy_mccs[] = {
|
||||
{INT_MAX, ""},
|
||||
{1, "001"},
|
||||
{11, "011"},
|
||||
{111, "111"},
|
||||
{0, "000"},
|
||||
{9999, ""},
|
||||
{-12, ""},
|
||||
};
|
||||
|
||||
for (int i=0; i < sizeof(legacy_mccs) / sizeof(struct mcc_ints); i++) {
|
||||
if (decode(legacy_mccs[i].in).compare(legacy_mccs[i].out)) return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif /* !defined(RIL_MCC_H) */
|
@ -1,149 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2018 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef RIL_MNC_H
|
||||
#define RIL_MNC_H
|
||||
|
||||
#include <climits>
|
||||
#include <cstdio>
|
||||
#include <string>
|
||||
|
||||
namespace ril {
|
||||
namespace util {
|
||||
namespace mnc {
|
||||
|
||||
/**
|
||||
* Decode an MNC with an optional length indicator provided in the most-significant nibble.
|
||||
*
|
||||
* @param mnc an encoded MNC value; if no encoding is provided, then the string is returned
|
||||
* as a minimum length string representing the provided integer.
|
||||
*
|
||||
* @return string representation of an encoded MNC or an empty string if the MNC is not a valid
|
||||
* MNC value.
|
||||
*/
|
||||
static inline std::string decode(int mnc) {
|
||||
if (mnc == INT_MAX || mnc < 0) return "";
|
||||
unsigned umnc = mnc;
|
||||
char mncNumDigits = (umnc >> (sizeof(int) * 8 - 4)) & 0xF;
|
||||
|
||||
umnc = (umnc << 4) >> 4;
|
||||
if (umnc > 999) return "";
|
||||
|
||||
char mncStr[4] = {0};
|
||||
switch (mncNumDigits) {
|
||||
case 0:
|
||||
// Legacy MNC report hasn't set the number of digits; preserve current
|
||||
// behavior and make a string of the minimum number of required digits.
|
||||
return std::to_string(umnc);
|
||||
|
||||
case 2:
|
||||
snprintf(mncStr, sizeof(mncStr), "%03.3u", umnc);
|
||||
return mncStr + 1;
|
||||
|
||||
case 3:
|
||||
snprintf(mncStr, sizeof(mncStr), "%03.3u", umnc);
|
||||
return mncStr;
|
||||
|
||||
default:
|
||||
// Error case
|
||||
return "";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Encode an MNC of the given value and a given number of digits
|
||||
*
|
||||
* @param mnc an MNC value 0-999 or INT_MAX if unknown
|
||||
* @param numDigits the number of MNC digits {2, 3} or 0 if unknown
|
||||
*
|
||||
* @return an encoded MNC with embedded length information
|
||||
*/
|
||||
static inline int encode(int mnc, int numDigits) {
|
||||
if (mnc > 999 || mnc < 0) return INT_MAX;
|
||||
switch (numDigits) {
|
||||
case 0: // fall through
|
||||
case 2: // fall through
|
||||
case 3:
|
||||
break;
|
||||
|
||||
default:
|
||||
return INT_MAX;
|
||||
};
|
||||
|
||||
return (numDigits << (sizeof(int) * 8 - 4)) | mnc;
|
||||
}
|
||||
|
||||
/**
|
||||
* Encode an MNC of the given value
|
||||
*
|
||||
* @param mnc the string representation of the MNC, with the length equal to the length of the
|
||||
* provided string.
|
||||
*
|
||||
* @return an encoded MNC with embedded length information
|
||||
*/
|
||||
static inline int encode(const std::string & mnc) {
|
||||
return encode(std::stoi(mnc), mnc.length());
|
||||
}
|
||||
|
||||
// echo -e "#include \"hardware/ril/include/telephony/ril_mnc.h\"\nint main()"\
|
||||
// "{ return ril::util::mnc::test(); }" > ril_test.cpp \
|
||||
// && g++ -o /tmp/ril_test -DTEST_RIL_MNC ril_test.cpp; \
|
||||
// rm ril_test.cpp; /tmp/ril_test && [ $? ] && echo "passed"
|
||||
#ifdef TEST_RIL_MNC
|
||||
static int test() {
|
||||
const struct mnc_strings { const char * in; const char * out; } mncs[] = {
|
||||
{"0001",""},
|
||||
{"9999",""},
|
||||
{"0",""},
|
||||
{"9",""},
|
||||
{"123","123"},
|
||||
{"000","000"},
|
||||
{"001","001"},
|
||||
{"011","011"},
|
||||
{"111","111"},
|
||||
{"00","00"},
|
||||
{"01","01"},
|
||||
{"11","11"},
|
||||
{"09","09"},
|
||||
{"099","099"},
|
||||
{"999", "999"}};
|
||||
|
||||
for (int i=0; i< sizeof(mncs) / sizeof(struct mnc_strings); i++) {
|
||||
if (decode(encode(mncs[i].in)).compare(mncs[i].out)) return 1;
|
||||
}
|
||||
|
||||
const struct mnc_ints { const int in; const char * out; } legacy_mncs[] = {
|
||||
{INT_MAX, ""},
|
||||
{1, "1"},
|
||||
{11, "11"},
|
||||
{111, "111"},
|
||||
{0, "0"},
|
||||
{9999, ""},
|
||||
};
|
||||
|
||||
for (int i=0; i < sizeof(legacy_mncs) / sizeof(struct mnc_ints); i++) {
|
||||
if (decode(legacy_mncs[i].in).compare(legacy_mncs[i].out)) return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif /* !defined(RIL_MNC_H) */
|
@ -1,53 +0,0 @@
|
||||
# Copyright 2006 The Android Open Source Project
|
||||
# Copyright 2018 The LineageOS Project
|
||||
|
||||
ifeq ($(BOARD_PROVIDES_LIBRIL),true)
|
||||
|
||||
LOCAL_PATH:= $(call my-dir)
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_VENDOR_MODULE := true
|
||||
|
||||
LOCAL_SRC_FILES:= \
|
||||
ril.cpp \
|
||||
ril_event.cpp\
|
||||
RilSapSocket.cpp \
|
||||
ril_service.cpp \
|
||||
sap_service.cpp
|
||||
|
||||
LOCAL_SHARED_LIBRARIES := \
|
||||
liblog \
|
||||
libutils \
|
||||
libcutils \
|
||||
libhardware_legacy \
|
||||
librilutils \
|
||||
android.hardware.radio@1.0 \
|
||||
android.hardware.radio@1.1 \
|
||||
android.hardware.radio.deprecated@1.0 \
|
||||
libhidlbase
|
||||
|
||||
LOCAL_STATIC_LIBRARIES := \
|
||||
libprotobuf-c-nano-enable_malloc-32bit \
|
||||
|
||||
LOCAL_CFLAGS += -Wall -Wextra -Wno-unused-parameter -Werror
|
||||
LOCAL_CFLAGS += -DPB_FIELD_32BIT
|
||||
|
||||
ifeq ($(SIM_COUNT), 2)
|
||||
LOCAL_CFLAGS += -DANDROID_MULTI_SIM -DDSDA_RILD1
|
||||
LOCAL_CFLAGS += -DANDROID_SIM_COUNT_2
|
||||
endif
|
||||
|
||||
ifneq ($(DISABLE_RILD_OEM_HOOK),)
|
||||
LOCAL_CFLAGS += -DOEM_HOOK_DISABLED
|
||||
endif
|
||||
|
||||
LOCAL_C_INCLUDES += external/nanopb-c
|
||||
LOCAL_C_INCLUDES += $(LOCAL_PATH)/../include
|
||||
LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/../include
|
||||
|
||||
LOCAL_MODULE:= libril
|
||||
LOCAL_SANITIZE := integer
|
||||
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
|
||||
endif # BOARD_PROVIDES_LIBRIL
|
@ -1,190 +0,0 @@
|
||||
|
||||
Copyright (c) 2005-2008, The Android Open Source Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
|
||||
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.
|
||||
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
@ -1,295 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2014 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#define __STDC_LIMIT_MACROS
|
||||
#include <stdint.h>
|
||||
#define RIL_SHLIB
|
||||
#include "telephony/ril.h"
|
||||
#include "RilSapSocket.h"
|
||||
#include "pb_decode.h"
|
||||
#include "pb_encode.h"
|
||||
#undef LOG_TAG
|
||||
#define LOG_TAG "RIL_UIM_SOCKET"
|
||||
#include <utils/Log.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <errno.h>
|
||||
#include <sap_service.h>
|
||||
|
||||
static RilSapSocket::RilSapSocketList *head = NULL;
|
||||
|
||||
extern "C" void
|
||||
RIL_requestTimedCallback (RIL_TimedCallback callback, void *param,
|
||||
const struct timeval *relativeTime);
|
||||
|
||||
struct RIL_Env RilSapSocket::uimRilEnv = {
|
||||
.OnRequestComplete = RilSapSocket::sOnRequestComplete,
|
||||
.OnUnsolicitedResponse = RilSapSocket::sOnUnsolicitedResponse,
|
||||
.RequestTimedCallback = RIL_requestTimedCallback
|
||||
};
|
||||
|
||||
void RilSapSocket::sOnRequestComplete (RIL_Token t,
|
||||
RIL_Errno e,
|
||||
void *response,
|
||||
size_t responselen) {
|
||||
RilSapSocket *sap_socket;
|
||||
SapSocketRequest *request = (SapSocketRequest*) t;
|
||||
|
||||
RLOGD("Socket id:%d", request->socketId);
|
||||
|
||||
sap_socket = getSocketById(request->socketId);
|
||||
|
||||
if (sap_socket) {
|
||||
sap_socket->onRequestComplete(t,e,response,responselen);
|
||||
} else {
|
||||
RLOGE("Invalid socket id");
|
||||
if (request->curr) {
|
||||
free(request->curr);
|
||||
}
|
||||
free(request);
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(ANDROID_MULTI_SIM)
|
||||
void RilSapSocket::sOnUnsolicitedResponse(int unsolResponse,
|
||||
const void *data,
|
||||
size_t datalen,
|
||||
RIL_SOCKET_ID socketId) {
|
||||
RilSapSocket *sap_socket = getSocketById(socketId);
|
||||
if (sap_socket) {
|
||||
sap_socket->onUnsolicitedResponse(unsolResponse, (void *)data, datalen);
|
||||
}
|
||||
}
|
||||
#else
|
||||
void RilSapSocket::sOnUnsolicitedResponse(int unsolResponse,
|
||||
const void *data,
|
||||
size_t datalen) {
|
||||
RilSapSocket *sap_socket = getSocketById(RIL_SOCKET_1);
|
||||
if(sap_socket){
|
||||
sap_socket->onUnsolicitedResponse(unsolResponse, (void *)data, datalen);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void RilSapSocket::printList() {
|
||||
RilSapSocketList *current = head;
|
||||
RLOGD("Printing socket list");
|
||||
while(NULL != current) {
|
||||
RLOGD("SocketName:%s",current->socket->name);
|
||||
RLOGD("Socket id:%d",current->socket->id);
|
||||
current = current->next;
|
||||
}
|
||||
}
|
||||
|
||||
RilSapSocket *RilSapSocket::getSocketById(RIL_SOCKET_ID socketId) {
|
||||
RilSapSocket *sap_socket;
|
||||
RilSapSocketList *current = head;
|
||||
|
||||
RLOGD("Entered getSocketById");
|
||||
printList();
|
||||
|
||||
while(NULL != current) {
|
||||
if(socketId == current->socket->id) {
|
||||
sap_socket = current->socket;
|
||||
return sap_socket;
|
||||
}
|
||||
current = current->next;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void RilSapSocket::initSapSocket(const char *socketName,
|
||||
const RIL_RadioFunctions *uimFuncs) {
|
||||
|
||||
if (strcmp(socketName, RIL1_SERVICE_NAME) == 0) {
|
||||
if(!SocketExists(socketName)) {
|
||||
addSocketToList(socketName, RIL_SOCKET_1, uimFuncs);
|
||||
}
|
||||
}
|
||||
|
||||
#if (SIM_COUNT >= 2)
|
||||
if (strcmp(socketName, RIL2_SERVICE_NAME) == 0) {
|
||||
if(!SocketExists(socketName)) {
|
||||
addSocketToList(socketName, RIL_SOCKET_2, uimFuncs);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if (SIM_COUNT >= 3)
|
||||
if (strcmp(socketName, RIL3_SERVICE_NAME) == 0) {
|
||||
if(!SocketExists(socketName)) {
|
||||
addSocketToList(socketName, RIL_SOCKET_3, uimFuncs);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if (SIM_COUNT >= 4)
|
||||
if (strcmp(socketName, RIL4_SERVICE_NAME) == 0) {
|
||||
if(!SocketExists(socketName)) {
|
||||
addSocketToList(socketName, RIL_SOCKET_4, uimFuncs);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void RilSapSocket::addSocketToList(const char *socketName, RIL_SOCKET_ID socketid,
|
||||
const RIL_RadioFunctions *uimFuncs) {
|
||||
RilSapSocket* socket = NULL;
|
||||
RilSapSocketList *current;
|
||||
|
||||
if(!SocketExists(socketName)) {
|
||||
socket = new RilSapSocket(socketName, socketid, uimFuncs);
|
||||
RilSapSocketList* listItem = (RilSapSocketList*)malloc(sizeof(RilSapSocketList));
|
||||
if (!listItem) {
|
||||
RLOGE("addSocketToList: OOM");
|
||||
delete socket;
|
||||
return;
|
||||
}
|
||||
listItem->socket = socket;
|
||||
listItem->next = NULL;
|
||||
|
||||
RLOGD("Adding socket with id: %d", socket->id);
|
||||
|
||||
if(NULL == head) {
|
||||
head = listItem;
|
||||
head->next = NULL;
|
||||
}
|
||||
else {
|
||||
current = head;
|
||||
while(NULL != current->next) {
|
||||
current = current->next;
|
||||
}
|
||||
current->next = listItem;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool RilSapSocket::SocketExists(const char *socketName) {
|
||||
RilSapSocketList* current = head;
|
||||
|
||||
while(NULL != current) {
|
||||
if(strcmp(current->socket->name, socketName) == 0) {
|
||||
return true;
|
||||
}
|
||||
current = current->next;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
RilSapSocket::RilSapSocket(const char *socketName,
|
||||
RIL_SOCKET_ID socketId,
|
||||
const RIL_RadioFunctions *inputUimFuncs):
|
||||
RilSocket(socketName, socketId) {
|
||||
if (inputUimFuncs) {
|
||||
uimFuncs = inputUimFuncs;
|
||||
}
|
||||
}
|
||||
|
||||
void RilSapSocket::dispatchRequest(MsgHeader *req) {
|
||||
// SapSocketRequest will be deallocated in onRequestComplete()
|
||||
SapSocketRequest* currRequest=(SapSocketRequest*)malloc(sizeof(SapSocketRequest));
|
||||
if (!currRequest) {
|
||||
RLOGE("dispatchRequest: OOM");
|
||||
// Free MsgHeader allocated in pushRecord()
|
||||
free(req);
|
||||
return;
|
||||
}
|
||||
currRequest->token = req->token;
|
||||
currRequest->curr = req;
|
||||
currRequest->p_next = NULL;
|
||||
currRequest->socketId = id;
|
||||
|
||||
pendingResponseQueue.enqueue(currRequest);
|
||||
|
||||
if (uimFuncs) {
|
||||
RLOGI("RilSapSocket::dispatchRequest [%d] > SAP REQUEST type: %d. id: %d. error: %d, \
|
||||
token 0x%p",
|
||||
req->token,
|
||||
req->type,
|
||||
req->id,
|
||||
req->error,
|
||||
currRequest );
|
||||
|
||||
#if defined(ANDROID_MULTI_SIM)
|
||||
uimFuncs->onRequest(req->id, req->payload->bytes, req->payload->size, currRequest, id);
|
||||
#else
|
||||
uimFuncs->onRequest(req->id, req->payload->bytes, req->payload->size, currRequest);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void RilSapSocket::onRequestComplete(RIL_Token t, RIL_Errno e, void *response,
|
||||
size_t response_len) {
|
||||
SapSocketRequest* request= (SapSocketRequest*)t;
|
||||
|
||||
if (!request || !request->curr) {
|
||||
RLOGE("RilSapSocket::onRequestComplete: request/request->curr is NULL");
|
||||
return;
|
||||
}
|
||||
|
||||
MsgHeader *hdr = request->curr;
|
||||
|
||||
MsgHeader rsp;
|
||||
rsp.token = request->curr->token;
|
||||
rsp.type = MsgType_RESPONSE;
|
||||
rsp.id = request->curr->id;
|
||||
rsp.error = (Error)e;
|
||||
rsp.payload = (pb_bytes_array_t *)calloc(1, sizeof(pb_bytes_array_t) + response_len);
|
||||
if (!rsp.payload) {
|
||||
RLOGE("onRequestComplete: OOM");
|
||||
} else {
|
||||
if (response && response_len > 0) {
|
||||
memcpy(rsp.payload->bytes, response, response_len);
|
||||
rsp.payload->size = response_len;
|
||||
} else {
|
||||
rsp.payload->size = 0;
|
||||
}
|
||||
|
||||
RLOGE("RilSapSocket::onRequestComplete: Token:%d, MessageId:%d ril token 0x%p",
|
||||
hdr->token, hdr->id, t);
|
||||
|
||||
sap::processResponse(&rsp, this);
|
||||
free(rsp.payload);
|
||||
}
|
||||
|
||||
// Deallocate SapSocketRequest
|
||||
if(!pendingResponseQueue.checkAndDequeue(hdr->id, hdr->token)) {
|
||||
RLOGE("Token:%d, MessageId:%d", hdr->token, hdr->id);
|
||||
RLOGE ("RilSapSocket::onRequestComplete: invalid Token or Message Id");
|
||||
}
|
||||
|
||||
// Deallocate MsgHeader
|
||||
free(hdr);
|
||||
}
|
||||
|
||||
void RilSapSocket::onUnsolicitedResponse(int unsolResponse, void *data, size_t datalen) {
|
||||
if (data && datalen > 0) {
|
||||
pb_bytes_array_t *payload = (pb_bytes_array_t *)calloc(1,
|
||||
sizeof(pb_bytes_array_t) + datalen);
|
||||
if (!payload) {
|
||||
RLOGE("onUnsolicitedResponse: OOM");
|
||||
return;
|
||||
}
|
||||
memcpy(payload->bytes, data, datalen);
|
||||
payload->size = datalen;
|
||||
MsgHeader rsp;
|
||||
rsp.payload = payload;
|
||||
rsp.type = MsgType_UNSOL_RESPONSE;
|
||||
rsp.id = (MsgId)unsolResponse;
|
||||
rsp.error = Error_RIL_E_SUCCESS;
|
||||
sap::processUnsolResponse(&rsp, this);
|
||||
free(payload);
|
||||
}
|
||||
}
|
@ -1,200 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2014 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef RIL_UIM_SOCKET_H_INCLUDED
|
||||
#define RIL_UIM_SOCKET_H_INCLUDED
|
||||
#define RIL_SHLIB
|
||||
#include "telephony/ril.h"
|
||||
#include "RilSocket.h"
|
||||
#include <hardware/ril/librilutils/proto/sap-api.pb.h>
|
||||
|
||||
/**
|
||||
* RilSapSocket is a derived class, derived from the RilSocket abstract
|
||||
* class, representing sockets for communication between bluetooth SAP module and
|
||||
* the ril daemon.
|
||||
* <p>
|
||||
* This class performs the following functions :
|
||||
* <ul>
|
||||
* <li>Initialize the socket.
|
||||
* <li>Process the requests coming on the socket.
|
||||
* <li>Provide handlers for Unsolicited and request responses.
|
||||
* <li>Request and pending response queue handling.
|
||||
* </ul>
|
||||
*/
|
||||
class RilSapSocket : public RilSocket {
|
||||
/**
|
||||
* Place holder for the radio functions returned by the initialization
|
||||
* function. Currenty only onRequest handler is being used.
|
||||
*/
|
||||
const RIL_RadioFunctions* uimFuncs;
|
||||
|
||||
/**
|
||||
* Wrapper struct for handling the requests in the queue.
|
||||
*/
|
||||
typedef struct SapSocketRequest {
|
||||
int token;
|
||||
MsgHeader* curr;
|
||||
struct SapSocketRequest* p_next;
|
||||
RIL_SOCKET_ID socketId;
|
||||
} SapSocketRequest;
|
||||
|
||||
/**
|
||||
* Queue for requests that are pending dispatch.
|
||||
*/
|
||||
Ril_queue<SapSocketRequest> dispatchQueue;
|
||||
|
||||
/**
|
||||
* Queue for requests that are dispatched but are pending response
|
||||
*/
|
||||
Ril_queue<SapSocketRequest> pendingResponseQueue;
|
||||
|
||||
public:
|
||||
/**
|
||||
* Initialize the socket and add the socket to the list.
|
||||
*
|
||||
* @param Name of the socket.
|
||||
* @param Radio functions to be used by the socket.
|
||||
*/
|
||||
static void initSapSocket(const char *socketName,
|
||||
const RIL_RadioFunctions *uimFuncs);
|
||||
|
||||
/**
|
||||
* Ril envoronment variable that holds the request and
|
||||
* unsol response handlers.
|
||||
*/
|
||||
static struct RIL_Env uimRilEnv;
|
||||
|
||||
/**
|
||||
* Function to print the socket list.
|
||||
*/
|
||||
static void printList();
|
||||
|
||||
/**
|
||||
* Dispatches the request to the lower layers.
|
||||
* It calls the on request function.
|
||||
*
|
||||
* @param request The request message.
|
||||
*/
|
||||
void dispatchRequest(MsgHeader *request);
|
||||
|
||||
/**
|
||||
* Class method to get the socket from the socket list.
|
||||
*
|
||||
* @param socketId Socket id.
|
||||
* @return the sap socket.
|
||||
*/
|
||||
static RilSapSocket* getSocketById(RIL_SOCKET_ID socketId);
|
||||
|
||||
/**
|
||||
* Datatype to handle the socket list.
|
||||
*/
|
||||
typedef struct RilSapSocketList {
|
||||
RilSapSocket* socket;
|
||||
RilSapSocketList *next;
|
||||
} RilSapSocketList;
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Socket handler to be called when a request has
|
||||
* been completed.
|
||||
*
|
||||
* @param Token associated with the request.
|
||||
* @param Error, if any, while processing the request.
|
||||
* @param The response payload.
|
||||
* @param Response payload length.
|
||||
*/
|
||||
void onRequestComplete(RIL_Token t,RIL_Errno e,
|
||||
void *response, size_t response_len);
|
||||
|
||||
/**
|
||||
* Socket handler to be called when there is an
|
||||
* unsolicited response.
|
||||
*
|
||||
* @param Message id.
|
||||
* @param Response data.
|
||||
* @param Response data length.
|
||||
*/
|
||||
void onUnsolicitedResponse(int unsolResponse,
|
||||
void *data, size_t datalen);
|
||||
|
||||
/**
|
||||
* Class method to add the sap socket to the list of sockets.
|
||||
* Does nothing if the socket is already present in the list.
|
||||
* Otherwise, calls the constructor of the parent class(To startlistening)
|
||||
* and add socket to the socket list.
|
||||
*/
|
||||
static void addSocketToList(const char *socketName, RIL_SOCKET_ID socketid,
|
||||
const RIL_RadioFunctions *uimFuncs);
|
||||
|
||||
/**
|
||||
* Check if a socket of the given name exists in the socket list.
|
||||
*
|
||||
* @param Socket name.
|
||||
* @return true if exists, false otherwise.
|
||||
*/
|
||||
static bool SocketExists(const char *socketName);
|
||||
|
||||
private:
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param Socket name.
|
||||
* @param Socket id.
|
||||
* @param Radio functions.
|
||||
*/
|
||||
RilSapSocket(const char *socketName,
|
||||
RIL_SOCKET_ID socketId,
|
||||
const RIL_RadioFunctions *inputUimFuncs);
|
||||
|
||||
/**
|
||||
* Class method that selects the socket on which the onRequestComplete
|
||||
* is called.
|
||||
*
|
||||
* @param Token associated with the request.
|
||||
* @param Error, if any, while processing the request.
|
||||
* @param The response payload.
|
||||
* @param Response payload length.
|
||||
*/
|
||||
static void sOnRequestComplete(RIL_Token t,
|
||||
RIL_Errno e, void *response, size_t responselen);
|
||||
|
||||
#if defined(ANDROID_MULTI_SIM)
|
||||
/**
|
||||
* Class method that selects the socket on which the onUnsolicitedResponse
|
||||
* is called.
|
||||
*
|
||||
* @param Message id.
|
||||
* @param Response data.
|
||||
* @param Response data length.
|
||||
* @param Socket id.
|
||||
*/
|
||||
static void sOnUnsolicitedResponse(int unsolResponse, const void *data,
|
||||
size_t datalen, RIL_SOCKET_ID socket_id);
|
||||
#else
|
||||
/**
|
||||
* Class method that selects the socket on which the onUnsolicitedResponse
|
||||
* is called.
|
||||
*
|
||||
* @param Message id.
|
||||
* @param Response data.
|
||||
* @param Response data length.
|
||||
*/
|
||||
static void sOnUnsolicitedResponse(int unsolResponse, const void *data,
|
||||
size_t datalen);
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif /*RIL_UIM_SOCKET_H_INCLUDED*/
|
@ -1,70 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2014 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef RIL_SOCKET_H_INCLUDED
|
||||
#define RIL_SOCKET_H_INCLUDED
|
||||
#include <libril/ril_ex.h>
|
||||
#include "rilSocketQueue.h"
|
||||
#include <ril_event.h>
|
||||
|
||||
/**
|
||||
* Abstract socket class representing sockets in rild.
|
||||
* <p>
|
||||
* This class performs the following functions :
|
||||
* <ul>
|
||||
* <li> Start socket listen.
|
||||
* <li> Handle socket listen and command callbacks.
|
||||
* </ul>
|
||||
*/
|
||||
class RilSocket {
|
||||
protected:
|
||||
|
||||
/**
|
||||
* Socket name.
|
||||
*/
|
||||
const char* name;
|
||||
|
||||
/**
|
||||
* Socket id.
|
||||
*/
|
||||
RIL_SOCKET_ID id;
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param Socket name.
|
||||
* @param Socket id.
|
||||
*/
|
||||
RilSocket(const char* socketName, RIL_SOCKET_ID socketId) {
|
||||
name = socketName;
|
||||
id = socketId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get socket id.
|
||||
*
|
||||
* @return RIL_SOCKET_ID socket id.
|
||||
*/
|
||||
RIL_SOCKET_ID getSocketId(void) {
|
||||
return id;
|
||||
}
|
||||
|
||||
virtual ~RilSocket(){}
|
||||
};
|
||||
|
||||
#endif
|
1258
ril/libril/ril.cpp
1258
ril/libril/ril.cpp
File diff suppressed because it is too large
Load Diff
@ -1,167 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2014 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "pb_decode.h"
|
||||
#include <pthread.h>
|
||||
#include <hardware/ril/librilutils/proto/sap-api.pb.h>
|
||||
#include <utils/Log.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
/**
|
||||
* Template queue class to handling requests for a rild socket.
|
||||
* <p>
|
||||
* This class performs the following functions :
|
||||
* <ul>
|
||||
* <li>Enqueue.
|
||||
* <li>Dequeue.
|
||||
* <li>Check and dequeue.
|
||||
* </ul>
|
||||
*/
|
||||
|
||||
template <typename T>
|
||||
class Ril_queue {
|
||||
|
||||
/**
|
||||
* Mutex attribute used in queue mutex initialization.
|
||||
*/
|
||||
pthread_mutexattr_t attr;
|
||||
|
||||
/**
|
||||
* Queue mutex variable for synchronized queue access.
|
||||
*/
|
||||
pthread_mutex_t mutex_instance;
|
||||
|
||||
/**
|
||||
* Condition to be waited on for dequeuing.
|
||||
*/
|
||||
pthread_cond_t cond;
|
||||
|
||||
/**
|
||||
* Front of the queue.
|
||||
*/
|
||||
T *front;
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* Remove the first element of the queue.
|
||||
*
|
||||
* @return first element of the queue.
|
||||
*/
|
||||
T* dequeue(void);
|
||||
|
||||
/**
|
||||
* Add a request to the front of the queue.
|
||||
*
|
||||
* @param Request to be added.
|
||||
*/
|
||||
void enqueue(T* request);
|
||||
|
||||
/**
|
||||
* Check if the queue is empty.
|
||||
*/
|
||||
int empty(void);
|
||||
|
||||
/**
|
||||
* Check and remove an element with a particular message id and token.
|
||||
*
|
||||
* @param Request message id.
|
||||
* @param Request token.
|
||||
*/
|
||||
int checkAndDequeue( MsgId id, int token);
|
||||
|
||||
/**
|
||||
* Queue constructor.
|
||||
*/
|
||||
Ril_queue(void);
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
Ril_queue<T>::Ril_queue(void) {
|
||||
pthread_mutexattr_init(&attr);
|
||||
pthread_mutex_init(&mutex_instance, &attr);
|
||||
cond = PTHREAD_COND_INITIALIZER;
|
||||
front = NULL;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
T* Ril_queue<T>::dequeue(void) {
|
||||
T* temp = NULL;
|
||||
|
||||
pthread_mutex_lock(&mutex_instance);
|
||||
while(empty()) {
|
||||
pthread_cond_wait(&cond, &mutex_instance);
|
||||
}
|
||||
temp = this->front;
|
||||
if(NULL != this->front->p_next) {
|
||||
this->front = this->front->p_next;
|
||||
} else {
|
||||
this->front = NULL;
|
||||
}
|
||||
pthread_mutex_unlock(&mutex_instance);
|
||||
|
||||
return temp;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void Ril_queue<T>::enqueue(T* request) {
|
||||
|
||||
pthread_mutex_lock(&mutex_instance);
|
||||
|
||||
if(NULL == this->front) {
|
||||
this->front = request;
|
||||
request->p_next = NULL;
|
||||
} else {
|
||||
request->p_next = this->front;
|
||||
this->front = request;
|
||||
}
|
||||
pthread_cond_broadcast(&cond);
|
||||
pthread_mutex_unlock(&mutex_instance);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
int Ril_queue<T>::checkAndDequeue(MsgId id, int token) {
|
||||
int ret = 0;
|
||||
T* temp;
|
||||
|
||||
pthread_mutex_lock(&mutex_instance);
|
||||
|
||||
for(T **ppCur = &(this->front); *ppCur != NULL; ppCur = &((*ppCur)->p_next)) {
|
||||
if (token == (*ppCur)->token && id == (*ppCur)->curr->id) {
|
||||
ret = 1;
|
||||
temp = *ppCur;
|
||||
*ppCur = (*ppCur)->p_next;
|
||||
free(temp);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
pthread_mutex_unlock(&mutex_instance);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
template <typename T>
|
||||
int Ril_queue<T>::empty(void) {
|
||||
|
||||
if(this->front == NULL) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
@ -1,162 +0,0 @@
|
||||
/* //device/libs/telephony/ril_commands.h
|
||||
**
|
||||
** Copyright 2006, The Android Open Source Project
|
||||
**
|
||||
** Licensed under the Apache License, Version 2.0 (the "License");
|
||||
** you may not use this file except in compliance with the License.
|
||||
** You may obtain a copy of the License at
|
||||
**
|
||||
** http://www.apache.org/licenses/LICENSE-2.0
|
||||
**
|
||||
** Unless required by applicable law or agreed to in writing, software
|
||||
** distributed under the License is distributed on an "AS IS" BASIS,
|
||||
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
** See the License for the specific language governing permissions and
|
||||
** limitations under the License.
|
||||
*/
|
||||
{0, NULL}, //none
|
||||
{RIL_REQUEST_GET_SIM_STATUS, radio::getIccCardStatusResponse},
|
||||
{RIL_REQUEST_ENTER_SIM_PIN, radio::supplyIccPinForAppResponse},
|
||||
{RIL_REQUEST_ENTER_SIM_PUK, radio::supplyIccPukForAppResponse},
|
||||
{RIL_REQUEST_ENTER_SIM_PIN2, radio::supplyIccPin2ForAppResponse},
|
||||
{RIL_REQUEST_ENTER_SIM_PUK2, radio::supplyIccPuk2ForAppResponse},
|
||||
{RIL_REQUEST_CHANGE_SIM_PIN, radio::changeIccPinForAppResponse},
|
||||
{RIL_REQUEST_CHANGE_SIM_PIN2, radio::changeIccPin2ForAppResponse},
|
||||
{RIL_REQUEST_ENTER_NETWORK_DEPERSONALIZATION, radio::supplyNetworkDepersonalizationResponse},
|
||||
{RIL_REQUEST_GET_CURRENT_CALLS, radio::getCurrentCallsResponse},
|
||||
{RIL_REQUEST_DIAL, radio::dialResponse},
|
||||
{RIL_REQUEST_GET_IMSI, radio::getIMSIForAppResponse},
|
||||
{RIL_REQUEST_HANGUP, radio::hangupConnectionResponse},
|
||||
{RIL_REQUEST_HANGUP_WAITING_OR_BACKGROUND, radio::hangupWaitingOrBackgroundResponse},
|
||||
{RIL_REQUEST_HANGUP_FOREGROUND_RESUME_BACKGROUND, radio::hangupForegroundResumeBackgroundResponse},
|
||||
{RIL_REQUEST_SWITCH_WAITING_OR_HOLDING_AND_ACTIVE, radio::switchWaitingOrHoldingAndActiveResponse},
|
||||
{RIL_REQUEST_CONFERENCE, radio::conferenceResponse},
|
||||
{RIL_REQUEST_UDUB, radio::rejectCallResponse},
|
||||
{RIL_REQUEST_LAST_CALL_FAIL_CAUSE, radio::getLastCallFailCauseResponse},
|
||||
{RIL_REQUEST_SIGNAL_STRENGTH, radio::getSignalStrengthResponse},
|
||||
{RIL_REQUEST_VOICE_REGISTRATION_STATE, radio::getVoiceRegistrationStateResponse},
|
||||
{RIL_REQUEST_DATA_REGISTRATION_STATE, radio::getDataRegistrationStateResponse},
|
||||
{RIL_REQUEST_OPERATOR, radio::getOperatorResponse},
|
||||
{RIL_REQUEST_RADIO_POWER, radio::setRadioPowerResponse},
|
||||
{RIL_REQUEST_DTMF, radio::sendDtmfResponse},
|
||||
{RIL_REQUEST_SEND_SMS, radio::sendSmsResponse},
|
||||
{RIL_REQUEST_SEND_SMS_EXPECT_MORE, radio::sendSMSExpectMoreResponse},
|
||||
{RIL_REQUEST_SETUP_DATA_CALL, radio::setupDataCallResponse},
|
||||
{RIL_REQUEST_SIM_IO, radio::iccIOForAppResponse},
|
||||
{RIL_REQUEST_SEND_USSD, radio::sendUssdResponse},
|
||||
{RIL_REQUEST_CANCEL_USSD, radio::cancelPendingUssdResponse},
|
||||
{RIL_REQUEST_GET_CLIR, radio::getClirResponse},
|
||||
{RIL_REQUEST_SET_CLIR, radio::setClirResponse},
|
||||
{RIL_REQUEST_QUERY_CALL_FORWARD_STATUS, radio::getCallForwardStatusResponse},
|
||||
{RIL_REQUEST_SET_CALL_FORWARD, radio::setCallForwardResponse},
|
||||
{RIL_REQUEST_QUERY_CALL_WAITING, radio::getCallWaitingResponse},
|
||||
{RIL_REQUEST_SET_CALL_WAITING, radio::setCallWaitingResponse},
|
||||
{RIL_REQUEST_SMS_ACKNOWLEDGE, radio::acknowledgeLastIncomingGsmSmsResponse},
|
||||
{RIL_REQUEST_GET_IMEI, NULL},
|
||||
{RIL_REQUEST_GET_IMEISV, NULL},
|
||||
{RIL_REQUEST_ANSWER, radio::acceptCallResponse},
|
||||
{RIL_REQUEST_DEACTIVATE_DATA_CALL, radio::deactivateDataCallResponse},
|
||||
{RIL_REQUEST_QUERY_FACILITY_LOCK, radio::getFacilityLockForAppResponse},
|
||||
{RIL_REQUEST_SET_FACILITY_LOCK, radio::setFacilityLockForAppResponse},
|
||||
{RIL_REQUEST_CHANGE_BARRING_PASSWORD, radio::setBarringPasswordResponse},
|
||||
{RIL_REQUEST_QUERY_NETWORK_SELECTION_MODE, radio::getNetworkSelectionModeResponse},
|
||||
{RIL_REQUEST_SET_NETWORK_SELECTION_AUTOMATIC, radio::setNetworkSelectionModeAutomaticResponse},
|
||||
{RIL_REQUEST_SET_NETWORK_SELECTION_MANUAL, radio::setNetworkSelectionModeManualResponse},
|
||||
{RIL_REQUEST_QUERY_AVAILABLE_NETWORKS , radio::getAvailableNetworksResponse},
|
||||
{RIL_REQUEST_DTMF_START, radio::startDtmfResponse},
|
||||
{RIL_REQUEST_DTMF_STOP, radio::stopDtmfResponse},
|
||||
{RIL_REQUEST_BASEBAND_VERSION, radio::getBasebandVersionResponse},
|
||||
{RIL_REQUEST_SEPARATE_CONNECTION, radio::separateConnectionResponse},
|
||||
{RIL_REQUEST_SET_MUTE, radio::setMuteResponse},
|
||||
{RIL_REQUEST_GET_MUTE, radio::getMuteResponse},
|
||||
{RIL_REQUEST_QUERY_CLIP, radio::getClipResponse},
|
||||
{RIL_REQUEST_LAST_DATA_CALL_FAIL_CAUSE, NULL},
|
||||
{RIL_REQUEST_DATA_CALL_LIST, radio::getDataCallListResponse},
|
||||
{RIL_REQUEST_RESET_RADIO, NULL},
|
||||
{RIL_REQUEST_OEM_HOOK_RAW, radio::sendRequestRawResponse},
|
||||
{RIL_REQUEST_OEM_HOOK_STRINGS, radio::sendRequestStringsResponse},
|
||||
{RIL_REQUEST_SCREEN_STATE, radio::sendDeviceStateResponse}, // Note the response function is different.
|
||||
{RIL_REQUEST_SET_SUPP_SVC_NOTIFICATION, radio::setSuppServiceNotificationsResponse},
|
||||
{RIL_REQUEST_WRITE_SMS_TO_SIM, radio::writeSmsToSimResponse},
|
||||
{RIL_REQUEST_DELETE_SMS_ON_SIM, radio::deleteSmsOnSimResponse},
|
||||
{RIL_REQUEST_SET_BAND_MODE, radio::setBandModeResponse},
|
||||
{RIL_REQUEST_QUERY_AVAILABLE_BAND_MODE, radio::getAvailableBandModesResponse},
|
||||
{RIL_REQUEST_STK_GET_PROFILE, NULL},
|
||||
{RIL_REQUEST_STK_SET_PROFILE, NULL},
|
||||
{RIL_REQUEST_STK_SEND_ENVELOPE_COMMAND, radio::sendEnvelopeResponse},
|
||||
{RIL_REQUEST_STK_SEND_TERMINAL_RESPONSE, radio::sendTerminalResponseToSimResponse},
|
||||
{RIL_REQUEST_STK_HANDLE_CALL_SETUP_REQUESTED_FROM_SIM, radio::handleStkCallSetupRequestFromSimResponse},
|
||||
{RIL_REQUEST_EXPLICIT_CALL_TRANSFER, radio::explicitCallTransferResponse},
|
||||
{RIL_REQUEST_SET_PREFERRED_NETWORK_TYPE, radio::setPreferredNetworkTypeResponse},
|
||||
{RIL_REQUEST_GET_PREFERRED_NETWORK_TYPE, radio::getPreferredNetworkTypeResponse},
|
||||
{RIL_REQUEST_GET_NEIGHBORING_CELL_IDS, radio::getNeighboringCidsResponse},
|
||||
{RIL_REQUEST_SET_LOCATION_UPDATES, radio::setLocationUpdatesResponse},
|
||||
{RIL_REQUEST_CDMA_SET_SUBSCRIPTION_SOURCE, radio::setCdmaSubscriptionSourceResponse},
|
||||
{RIL_REQUEST_CDMA_SET_ROAMING_PREFERENCE, radio::setCdmaRoamingPreferenceResponse},
|
||||
{RIL_REQUEST_CDMA_QUERY_ROAMING_PREFERENCE, radio::getCdmaRoamingPreferenceResponse},
|
||||
{RIL_REQUEST_SET_TTY_MODE, radio::setTTYModeResponse},
|
||||
{RIL_REQUEST_QUERY_TTY_MODE, radio::getTTYModeResponse},
|
||||
{RIL_REQUEST_CDMA_SET_PREFERRED_VOICE_PRIVACY_MODE, radio::setPreferredVoicePrivacyResponse},
|
||||
{RIL_REQUEST_CDMA_QUERY_PREFERRED_VOICE_PRIVACY_MODE, radio::getPreferredVoicePrivacyResponse},
|
||||
{RIL_REQUEST_CDMA_FLASH, radio::sendCDMAFeatureCodeResponse},
|
||||
{RIL_REQUEST_CDMA_BURST_DTMF, radio::sendBurstDtmfResponse},
|
||||
{RIL_REQUEST_CDMA_VALIDATE_AND_WRITE_AKEY, NULL},
|
||||
{RIL_REQUEST_CDMA_SEND_SMS, radio::sendCdmaSmsResponse},
|
||||
{RIL_REQUEST_CDMA_SMS_ACKNOWLEDGE, radio::acknowledgeLastIncomingCdmaSmsResponse},
|
||||
{RIL_REQUEST_GSM_GET_BROADCAST_SMS_CONFIG, radio::getGsmBroadcastConfigResponse},
|
||||
{RIL_REQUEST_GSM_SET_BROADCAST_SMS_CONFIG, radio::setGsmBroadcastConfigResponse},
|
||||
{RIL_REQUEST_GSM_SMS_BROADCAST_ACTIVATION, radio::setGsmBroadcastActivationResponse},
|
||||
{RIL_REQUEST_CDMA_GET_BROADCAST_SMS_CONFIG, radio::getCdmaBroadcastConfigResponse},
|
||||
{RIL_REQUEST_CDMA_SET_BROADCAST_SMS_CONFIG, radio::setCdmaBroadcastConfigResponse},
|
||||
{RIL_REQUEST_CDMA_SMS_BROADCAST_ACTIVATION, radio::setCdmaBroadcastActivationResponse},
|
||||
{RIL_REQUEST_CDMA_SUBSCRIPTION, radio::getCDMASubscriptionResponse},
|
||||
{RIL_REQUEST_CDMA_WRITE_SMS_TO_RUIM, radio::writeSmsToRuimResponse},
|
||||
{RIL_REQUEST_CDMA_DELETE_SMS_ON_RUIM, radio::deleteSmsOnRuimResponse},
|
||||
{RIL_REQUEST_DEVICE_IDENTITY, radio::getDeviceIdentityResponse},
|
||||
{RIL_REQUEST_EXIT_EMERGENCY_CALLBACK_MODE, radio::exitEmergencyCallbackModeResponse},
|
||||
{RIL_REQUEST_GET_SMSC_ADDRESS, radio::getSmscAddressResponse},
|
||||
{RIL_REQUEST_SET_SMSC_ADDRESS, radio::setSmscAddressResponse},
|
||||
{RIL_REQUEST_REPORT_SMS_MEMORY_STATUS, radio::reportSmsMemoryStatusResponse},
|
||||
{RIL_REQUEST_REPORT_STK_SERVICE_IS_RUNNING, radio::reportStkServiceIsRunningResponse},
|
||||
{RIL_REQUEST_CDMA_GET_SUBSCRIPTION_SOURCE, radio::getCdmaSubscriptionSourceResponse},
|
||||
{RIL_REQUEST_ISIM_AUTHENTICATION, radio::requestIsimAuthenticationResponse},
|
||||
{RIL_REQUEST_ACKNOWLEDGE_INCOMING_GSM_SMS_WITH_PDU, radio::acknowledgeIncomingGsmSmsWithPduResponse},
|
||||
{RIL_REQUEST_STK_SEND_ENVELOPE_WITH_STATUS, radio::sendEnvelopeWithStatusResponse},
|
||||
{RIL_REQUEST_VOICE_RADIO_TECH, radio::getVoiceRadioTechnologyResponse},
|
||||
{RIL_REQUEST_GET_CELL_INFO_LIST, radio::getCellInfoListResponse},
|
||||
{RIL_REQUEST_SET_UNSOL_CELL_INFO_LIST_RATE, radio::setCellInfoListRateResponse},
|
||||
{RIL_REQUEST_SET_INITIAL_ATTACH_APN, radio::setInitialAttachApnResponse},
|
||||
{RIL_REQUEST_IMS_REGISTRATION_STATE, radio::getImsRegistrationStateResponse},
|
||||
{RIL_REQUEST_IMS_SEND_SMS, radio::sendImsSmsResponse},
|
||||
{RIL_REQUEST_SIM_TRANSMIT_APDU_BASIC, radio::iccTransmitApduBasicChannelResponse},
|
||||
{RIL_REQUEST_SIM_OPEN_CHANNEL, radio::iccOpenLogicalChannelResponse},
|
||||
{RIL_REQUEST_SIM_CLOSE_CHANNEL, radio::iccCloseLogicalChannelResponse},
|
||||
{RIL_REQUEST_SIM_TRANSMIT_APDU_CHANNEL, radio::iccTransmitApduLogicalChannelResponse},
|
||||
{RIL_REQUEST_NV_READ_ITEM, radio::nvReadItemResponse},
|
||||
{RIL_REQUEST_NV_WRITE_ITEM, radio::nvWriteItemResponse},
|
||||
{RIL_REQUEST_NV_WRITE_CDMA_PRL, radio::nvWriteCdmaPrlResponse},
|
||||
{RIL_REQUEST_NV_RESET_CONFIG, radio::nvResetConfigResponse},
|
||||
{RIL_REQUEST_SET_UICC_SUBSCRIPTION, radio::setUiccSubscriptionResponse},
|
||||
{RIL_REQUEST_ALLOW_DATA, radio::setDataAllowedResponse},
|
||||
{RIL_REQUEST_GET_HARDWARE_CONFIG, radio::getHardwareConfigResponse},
|
||||
{RIL_REQUEST_SIM_AUTHENTICATION, radio::requestIccSimAuthenticationResponse},
|
||||
{RIL_REQUEST_GET_DC_RT_INFO, NULL},
|
||||
{RIL_REQUEST_SET_DC_RT_INFO_RATE, NULL},
|
||||
{RIL_REQUEST_SET_DATA_PROFILE, radio::setDataProfileResponse},
|
||||
{RIL_REQUEST_SHUTDOWN, radio::requestShutdownResponse},
|
||||
{RIL_REQUEST_GET_RADIO_CAPABILITY, radio::getRadioCapabilityResponse},
|
||||
{RIL_REQUEST_SET_RADIO_CAPABILITY, radio::setRadioCapabilityResponse},
|
||||
{RIL_REQUEST_START_LCE, radio::startLceServiceResponse},
|
||||
{RIL_REQUEST_STOP_LCE, radio::stopLceServiceResponse},
|
||||
{RIL_REQUEST_PULL_LCEDATA, radio::pullLceDataResponse},
|
||||
{RIL_REQUEST_GET_ACTIVITY_INFO, radio::getModemActivityInfoResponse},
|
||||
{RIL_REQUEST_SET_CARRIER_RESTRICTIONS, radio::setAllowedCarriersResponse},
|
||||
{RIL_REQUEST_GET_CARRIER_RESTRICTIONS, radio::getAllowedCarriersResponse},
|
||||
{RIL_REQUEST_SEND_DEVICE_STATE, radio::sendDeviceStateResponse},
|
||||
{RIL_REQUEST_SET_UNSOLICITED_RESPONSE_FILTER, radio::setIndicationFilterResponse},
|
||||
{RIL_REQUEST_SET_SIM_CARD_POWER, radio::setSimCardPowerResponse},
|
||||
{RIL_REQUEST_SET_CARRIER_INFO_IMSI_ENCRYPTION, radio::setCarrierInfoForImsiEncryptionResponse},
|
||||
{RIL_REQUEST_START_NETWORK_SCAN, radio::startNetworkScanResponse},
|
||||
{RIL_REQUEST_STOP_NETWORK_SCAN, radio::stopNetworkScanResponse},
|
||||
{RIL_REQUEST_START_KEEPALIVE, radio::startKeepaliveResponse},
|
||||
{RIL_REQUEST_STOP_KEEPALIVE, radio::stopKeepaliveResponse},
|
@ -1,384 +0,0 @@
|
||||
/* //device/libs/telephony/ril_event.cpp
|
||||
**
|
||||
** Copyright 2008, The Android Open Source Project
|
||||
**
|
||||
** Licensed under the Apache License, Version 2.0 (the "License");
|
||||
** you may not use this file except in compliance with the License.
|
||||
** You may obtain a copy of the License at
|
||||
**
|
||||
** http://www.apache.org/licenses/LICENSE-2.0
|
||||
**
|
||||
** Unless required by applicable law or agreed to in writing, software
|
||||
** distributed under the License is distributed on an "AS IS" BASIS,
|
||||
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
** See the License for the specific language governing permissions and
|
||||
** limitations under the License.
|
||||
*/
|
||||
|
||||
#define LOG_TAG "RILC"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <utils/Log.h>
|
||||
#include <ril_event.h>
|
||||
#include <string.h>
|
||||
#include <sys/time.h>
|
||||
#include <time.h>
|
||||
|
||||
#include <pthread.h>
|
||||
static pthread_mutex_t listMutex;
|
||||
#define MUTEX_ACQUIRE() pthread_mutex_lock(&listMutex)
|
||||
#define MUTEX_RELEASE() pthread_mutex_unlock(&listMutex)
|
||||
#define MUTEX_INIT() pthread_mutex_init(&listMutex, NULL)
|
||||
#define MUTEX_DESTROY() pthread_mutex_destroy(&listMutex)
|
||||
|
||||
#ifndef timeradd
|
||||
#define timeradd(tvp, uvp, vvp) \
|
||||
do { \
|
||||
(vvp)->tv_sec = (tvp)->tv_sec + (uvp)->tv_sec; \
|
||||
(vvp)->tv_usec = (tvp)->tv_usec + (uvp)->tv_usec; \
|
||||
if ((vvp)->tv_usec >= 1000000) { \
|
||||
(vvp)->tv_sec++; \
|
||||
(vvp)->tv_usec -= 1000000; \
|
||||
} \
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
#ifndef timercmp
|
||||
#define timercmp(a, b, op) \
|
||||
((a)->tv_sec == (b)->tv_sec \
|
||||
? (a)->tv_usec op (b)->tv_usec \
|
||||
: (a)->tv_sec op (b)->tv_sec)
|
||||
#endif
|
||||
|
||||
#ifndef timersub
|
||||
#define timersub(a, b, res) \
|
||||
do { \
|
||||
(res)->tv_sec = (a)->tv_sec - (b)->tv_sec; \
|
||||
(res)->tv_usec = (a)->tv_usec - (b)->tv_usec; \
|
||||
if ((res)->tv_usec < 0) { \
|
||||
(res)->tv_usec += 1000000; \
|
||||
(res)->tv_sec -= 1; \
|
||||
} \
|
||||
} while(0);
|
||||
#endif
|
||||
|
||||
static fd_set readFds;
|
||||
static int nfds = 0;
|
||||
|
||||
static struct ril_event * watch_table[MAX_FD_EVENTS];
|
||||
static struct ril_event timer_list;
|
||||
static struct ril_event pending_list;
|
||||
|
||||
#define DEBUG 0
|
||||
|
||||
#if DEBUG
|
||||
#define dlog(x...) RLOGD( x )
|
||||
static void dump_event(struct ril_event * ev)
|
||||
{
|
||||
dlog("~~~~ Event %x ~~~~", (unsigned int)ev);
|
||||
dlog(" next = %x", (unsigned int)ev->next);
|
||||
dlog(" prev = %x", (unsigned int)ev->prev);
|
||||
dlog(" fd = %d", ev->fd);
|
||||
dlog(" pers = %d", ev->persist);
|
||||
dlog(" timeout = %ds + %dus", (int)ev->timeout.tv_sec, (int)ev->timeout.tv_usec);
|
||||
dlog(" func = %x", (unsigned int)ev->func);
|
||||
dlog(" param = %x", (unsigned int)ev->param);
|
||||
dlog("~~~~~~~~~~~~~~~~~~");
|
||||
}
|
||||
#else
|
||||
#define dlog(x...) do {} while(0)
|
||||
#define dump_event(x) do {} while(0)
|
||||
#endif
|
||||
|
||||
static void getNow(struct timeval * tv)
|
||||
{
|
||||
struct timespec ts;
|
||||
clock_gettime(CLOCK_MONOTONIC, &ts);
|
||||
tv->tv_sec = ts.tv_sec;
|
||||
tv->tv_usec = ts.tv_nsec/1000;
|
||||
}
|
||||
|
||||
static void init_list(struct ril_event * list)
|
||||
{
|
||||
memset(list, 0, sizeof(struct ril_event));
|
||||
list->next = list;
|
||||
list->prev = list;
|
||||
list->fd = -1;
|
||||
}
|
||||
|
||||
static void addToList(struct ril_event * ev, struct ril_event * list)
|
||||
{
|
||||
ev->next = list;
|
||||
ev->prev = list->prev;
|
||||
ev->prev->next = ev;
|
||||
list->prev = ev;
|
||||
dump_event(ev);
|
||||
}
|
||||
|
||||
static void removeFromList(struct ril_event * ev)
|
||||
{
|
||||
dlog("~~~~ +removeFromList ~~~~");
|
||||
dump_event(ev);
|
||||
|
||||
ev->next->prev = ev->prev;
|
||||
ev->prev->next = ev->next;
|
||||
ev->next = NULL;
|
||||
ev->prev = NULL;
|
||||
dlog("~~~~ -removeFromList ~~~~");
|
||||
}
|
||||
|
||||
|
||||
static void removeWatch(struct ril_event * ev, int index)
|
||||
{
|
||||
dlog("~~~~ +removeWatch ~~~~");
|
||||
watch_table[index] = NULL;
|
||||
ev->index = -1;
|
||||
|
||||
FD_CLR(ev->fd, &readFds);
|
||||
|
||||
if (ev->fd+1 == nfds) {
|
||||
int n = 0;
|
||||
|
||||
for (int i = 0; i < MAX_FD_EVENTS; i++) {
|
||||
struct ril_event * rev = watch_table[i];
|
||||
|
||||
if ((rev != NULL) && (rev->fd > n)) {
|
||||
n = rev->fd;
|
||||
}
|
||||
}
|
||||
nfds = n + 1;
|
||||
dlog("~~~~ nfds = %d ~~~~", nfds);
|
||||
}
|
||||
dlog("~~~~ -removeWatch ~~~~");
|
||||
}
|
||||
|
||||
static void processTimeouts()
|
||||
{
|
||||
dlog("~~~~ +processTimeouts ~~~~");
|
||||
MUTEX_ACQUIRE();
|
||||
struct timeval now;
|
||||
struct ril_event * tev = timer_list.next;
|
||||
struct ril_event * next;
|
||||
|
||||
getNow(&now);
|
||||
// walk list, see if now >= ev->timeout for any events
|
||||
|
||||
dlog("~~~~ Looking for timers <= %ds + %dus ~~~~", (int)now.tv_sec, (int)now.tv_usec);
|
||||
while ((tev != &timer_list) && (timercmp(&now, &tev->timeout, >))) {
|
||||
// Timer expired
|
||||
dlog("~~~~ firing timer ~~~~");
|
||||
next = tev->next;
|
||||
removeFromList(tev);
|
||||
addToList(tev, &pending_list);
|
||||
tev = next;
|
||||
}
|
||||
MUTEX_RELEASE();
|
||||
dlog("~~~~ -processTimeouts ~~~~");
|
||||
}
|
||||
|
||||
static void processReadReadies(fd_set * rfds, int n)
|
||||
{
|
||||
dlog("~~~~ +processReadReadies (%d) ~~~~", n);
|
||||
MUTEX_ACQUIRE();
|
||||
|
||||
for (int i = 0; (i < MAX_FD_EVENTS) && (n > 0); i++) {
|
||||
struct ril_event * rev = watch_table[i];
|
||||
if (rev != NULL && FD_ISSET(rev->fd, rfds)) {
|
||||
addToList(rev, &pending_list);
|
||||
if (rev->persist == false) {
|
||||
removeWatch(rev, i);
|
||||
}
|
||||
n--;
|
||||
}
|
||||
}
|
||||
|
||||
MUTEX_RELEASE();
|
||||
dlog("~~~~ -processReadReadies (%d) ~~~~", n);
|
||||
}
|
||||
|
||||
static void firePending()
|
||||
{
|
||||
dlog("~~~~ +firePending ~~~~");
|
||||
struct ril_event * ev = pending_list.next;
|
||||
while (ev != &pending_list) {
|
||||
struct ril_event * next = ev->next;
|
||||
removeFromList(ev);
|
||||
ev->func(ev->fd, 0, ev->param);
|
||||
ev = next;
|
||||
}
|
||||
dlog("~~~~ -firePending ~~~~");
|
||||
}
|
||||
|
||||
static int calcNextTimeout(struct timeval * tv)
|
||||
{
|
||||
struct ril_event * tev = timer_list.next;
|
||||
struct timeval now;
|
||||
|
||||
getNow(&now);
|
||||
|
||||
// Sorted list, so calc based on first node
|
||||
if (tev == &timer_list) {
|
||||
// no pending timers
|
||||
return -1;
|
||||
}
|
||||
|
||||
dlog("~~~~ now = %ds + %dus ~~~~", (int)now.tv_sec, (int)now.tv_usec);
|
||||
dlog("~~~~ next = %ds + %dus ~~~~",
|
||||
(int)tev->timeout.tv_sec, (int)tev->timeout.tv_usec);
|
||||
if (timercmp(&tev->timeout, &now, >)) {
|
||||
timersub(&tev->timeout, &now, tv);
|
||||
} else {
|
||||
// timer already expired.
|
||||
tv->tv_sec = tv->tv_usec = 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Initialize internal data structs
|
||||
void ril_event_init()
|
||||
{
|
||||
MUTEX_INIT();
|
||||
|
||||
FD_ZERO(&readFds);
|
||||
init_list(&timer_list);
|
||||
init_list(&pending_list);
|
||||
memset(watch_table, 0, sizeof(watch_table));
|
||||
}
|
||||
|
||||
// Initialize an event
|
||||
void ril_event_set(struct ril_event * ev, int fd, bool persist, ril_event_cb func, void * param)
|
||||
{
|
||||
dlog("~~~~ ril_event_set %x ~~~~", (unsigned int)ev);
|
||||
memset(ev, 0, sizeof(struct ril_event));
|
||||
ev->fd = fd;
|
||||
ev->index = -1;
|
||||
ev->persist = persist;
|
||||
ev->func = func;
|
||||
ev->param = param;
|
||||
fcntl(fd, F_SETFL, O_NONBLOCK);
|
||||
}
|
||||
|
||||
// Add event to watch list
|
||||
void ril_event_add(struct ril_event * ev)
|
||||
{
|
||||
dlog("~~~~ +ril_event_add ~~~~");
|
||||
MUTEX_ACQUIRE();
|
||||
for (int i = 0; i < MAX_FD_EVENTS; i++) {
|
||||
if (watch_table[i] == NULL) {
|
||||
watch_table[i] = ev;
|
||||
ev->index = i;
|
||||
dlog("~~~~ added at %d ~~~~", i);
|
||||
dump_event(ev);
|
||||
FD_SET(ev->fd, &readFds);
|
||||
if (ev->fd >= nfds) nfds = ev->fd+1;
|
||||
dlog("~~~~ nfds = %d ~~~~", nfds);
|
||||
break;
|
||||
}
|
||||
}
|
||||
MUTEX_RELEASE();
|
||||
dlog("~~~~ -ril_event_add ~~~~");
|
||||
}
|
||||
|
||||
// Add timer event
|
||||
void ril_timer_add(struct ril_event * ev, struct timeval * tv)
|
||||
{
|
||||
dlog("~~~~ +ril_timer_add ~~~~");
|
||||
MUTEX_ACQUIRE();
|
||||
|
||||
struct ril_event * list;
|
||||
if (tv != NULL) {
|
||||
// add to timer list
|
||||
list = timer_list.next;
|
||||
ev->fd = -1; // make sure fd is invalid
|
||||
|
||||
struct timeval now;
|
||||
getNow(&now);
|
||||
timeradd(&now, tv, &ev->timeout);
|
||||
|
||||
// keep list sorted
|
||||
while (timercmp(&list->timeout, &ev->timeout, < )
|
||||
&& (list != &timer_list)) {
|
||||
list = list->next;
|
||||
}
|
||||
// list now points to the first event older than ev
|
||||
addToList(ev, list);
|
||||
}
|
||||
|
||||
MUTEX_RELEASE();
|
||||
dlog("~~~~ -ril_timer_add ~~~~");
|
||||
}
|
||||
|
||||
// Remove event from watch or timer list
|
||||
void ril_event_del(struct ril_event * ev)
|
||||
{
|
||||
dlog("~~~~ +ril_event_del ~~~~");
|
||||
MUTEX_ACQUIRE();
|
||||
|
||||
if (ev->index < 0 || ev->index >= MAX_FD_EVENTS) {
|
||||
MUTEX_RELEASE();
|
||||
return;
|
||||
}
|
||||
|
||||
removeWatch(ev, ev->index);
|
||||
|
||||
MUTEX_RELEASE();
|
||||
dlog("~~~~ -ril_event_del ~~~~");
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
static void printReadies(fd_set * rfds)
|
||||
{
|
||||
for (int i = 0; (i < MAX_FD_EVENTS); i++) {
|
||||
struct ril_event * rev = watch_table[i];
|
||||
if (rev != NULL && FD_ISSET(rev->fd, rfds)) {
|
||||
dlog("DON: fd=%d is ready", rev->fd);
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
#define printReadies(rfds) do {} while(0)
|
||||
#endif
|
||||
|
||||
void ril_event_loop()
|
||||
{
|
||||
int n;
|
||||
fd_set rfds;
|
||||
struct timeval tv;
|
||||
struct timeval * ptv;
|
||||
|
||||
|
||||
for (;;) {
|
||||
|
||||
// make local copy of read fd_set
|
||||
memcpy(&rfds, &readFds, sizeof(fd_set));
|
||||
if (-1 == calcNextTimeout(&tv)) {
|
||||
// no pending timers; block indefinitely
|
||||
dlog("~~~~ no timers; blocking indefinitely ~~~~");
|
||||
ptv = NULL;
|
||||
} else {
|
||||
dlog("~~~~ blocking for %ds + %dus ~~~~", (int)tv.tv_sec, (int)tv.tv_usec);
|
||||
ptv = &tv;
|
||||
}
|
||||
printReadies(&rfds);
|
||||
n = select(nfds, &rfds, NULL, NULL, ptv);
|
||||
printReadies(&rfds);
|
||||
dlog("~~~~ %d events fired ~~~~", n);
|
||||
if (n < 0) {
|
||||
if (errno == EINTR) continue;
|
||||
|
||||
RLOGE("ril_event: select error (%d)", errno);
|
||||
// bail?
|
||||
return;
|
||||
}
|
||||
|
||||
// Check for timeouts
|
||||
processTimeouts();
|
||||
// Check for read-ready
|
||||
processReadReadies(&rfds, n);
|
||||
// Fire away
|
||||
firePending();
|
||||
}
|
||||
}
|
@ -1,52 +0,0 @@
|
||||
/* //device/libs/telephony/ril_event.h
|
||||
**
|
||||
** Copyright 2008, The Android Open Source Project
|
||||
**
|
||||
** Licensed under the Apache License, Version 2.0 (the "License");
|
||||
** you may not use this file except in compliance with the License.
|
||||
** You may obtain a copy of the License at
|
||||
**
|
||||
** http://www.apache.org/licenses/LICENSE-2.0
|
||||
**
|
||||
** Unless required by applicable law or agreed to in writing, software
|
||||
** distributed under the License is distributed on an "AS IS" BASIS,
|
||||
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
** See the License for the specific language governing permissions and
|
||||
** limitations under the License.
|
||||
*/
|
||||
|
||||
// Max number of fd's we watch at any one time. Increase if necessary.
|
||||
#define MAX_FD_EVENTS 8
|
||||
|
||||
typedef void (*ril_event_cb)(int fd, short events, void *userdata);
|
||||
|
||||
struct ril_event {
|
||||
struct ril_event *next;
|
||||
struct ril_event *prev;
|
||||
|
||||
int fd;
|
||||
int index;
|
||||
bool persist;
|
||||
struct timeval timeout;
|
||||
ril_event_cb func;
|
||||
void *param;
|
||||
};
|
||||
|
||||
// Initialize internal data structs
|
||||
void ril_event_init();
|
||||
|
||||
// Initialize an event
|
||||
void ril_event_set(struct ril_event * ev, int fd, bool persist, ril_event_cb func, void * param);
|
||||
|
||||
// Add event to watch list
|
||||
void ril_event_add(struct ril_event * ev);
|
||||
|
||||
// Add timer event
|
||||
void ril_timer_add(struct ril_event * ev, struct timeval * tv);
|
||||
|
||||
// Remove event from watch list
|
||||
void ril_event_del(struct ril_event * ev);
|
||||
|
||||
// Event loop
|
||||
void ril_event_loop();
|
||||
|
@ -1,98 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2016 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef ANDROID_RIL_INTERNAL_H
|
||||
#define ANDROID_RIL_INTERNAL_H
|
||||
|
||||
namespace android {
|
||||
|
||||
#define RIL_SERVICE_NAME_BASE "slot"
|
||||
#define RIL1_SERVICE_NAME "slot1"
|
||||
#define RIL2_SERVICE_NAME "slot2"
|
||||
#define RIL3_SERVICE_NAME "slot3"
|
||||
#define RIL4_SERVICE_NAME "slot4"
|
||||
|
||||
/* Constants for response types */
|
||||
#define RESPONSE_SOLICITED 0
|
||||
#define RESPONSE_UNSOLICITED 1
|
||||
#define RESPONSE_SOLICITED_ACK 2
|
||||
#define RESPONSE_SOLICITED_ACK_EXP 3
|
||||
#define RESPONSE_UNSOLICITED_ACK_EXP 4
|
||||
|
||||
// Enable verbose logging
|
||||
#define VDBG 0
|
||||
|
||||
#define MIN(a,b) ((a)<(b) ? (a) : (b))
|
||||
|
||||
// Enable RILC log
|
||||
#define RILC_LOG 0
|
||||
|
||||
#if RILC_LOG
|
||||
#define startRequest sprintf(printBuf, "(")
|
||||
#define closeRequest sprintf(printBuf, "%s)", printBuf)
|
||||
#define printRequest(token, req) \
|
||||
RLOGD("[%04d]> %s %s", token, requestToString(req), printBuf)
|
||||
|
||||
#define startResponse sprintf(printBuf, "%s {", printBuf)
|
||||
#define closeResponse sprintf(printBuf, "%s}", printBuf)
|
||||
#define printResponse RLOGD("%s", printBuf)
|
||||
|
||||
#define clearPrintBuf printBuf[0] = 0
|
||||
#define removeLastChar printBuf[strlen(printBuf)-1] = 0
|
||||
#define appendPrintBuf(x...) snprintf(printBuf, PRINTBUF_SIZE, x)
|
||||
#else
|
||||
#define startRequest
|
||||
#define closeRequest
|
||||
#define printRequest(token, req)
|
||||
#define startResponse
|
||||
#define closeResponse
|
||||
#define printResponse
|
||||
#define clearPrintBuf
|
||||
#define removeLastChar
|
||||
#define appendPrintBuf(x...)
|
||||
#endif
|
||||
|
||||
typedef struct CommandInfo CommandInfo;
|
||||
|
||||
extern "C" const char * requestToString(int request);
|
||||
|
||||
typedef struct RequestInfo {
|
||||
int32_t token; //this is not RIL_Token
|
||||
CommandInfo *pCI;
|
||||
struct RequestInfo *p_next;
|
||||
char cancelled;
|
||||
char local; // responses to local commands do not go back to command process
|
||||
RIL_SOCKET_ID socket_id;
|
||||
int wasAckSent; // Indicates whether an ack was sent earlier
|
||||
} RequestInfo;
|
||||
|
||||
typedef struct CommandInfo {
|
||||
int requestNumber;
|
||||
int(*responseFunction) (int slotId, int responseType, int token,
|
||||
RIL_Errno e, void *response, size_t responselen);
|
||||
} CommandInfo;
|
||||
|
||||
RequestInfo * addRequestToList(int serial, int slotId, int request);
|
||||
|
||||
char * RIL_getServiceName();
|
||||
|
||||
void releaseWakeLock();
|
||||
|
||||
void onNewCommandConnect(RIL_SOCKET_ID socket_id);
|
||||
|
||||
} // namespace android
|
||||
|
||||
#endif //ANDROID_RIL_INTERNAL_H
|
File diff suppressed because it is too large
Load Diff
@ -1,750 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2016 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef RIL_SERVICE_H
|
||||
#define RIL_SERVICE_H
|
||||
|
||||
#include <telephony/ril.h>
|
||||
#include <ril_internal.h>
|
||||
|
||||
namespace radio {
|
||||
void registerService(RIL_RadioFunctions *callbacks, android::CommandInfo *commands);
|
||||
|
||||
int getIccCardStatusResponse(int slotId, int responseType,
|
||||
int token, RIL_Errno e, void *response, size_t responselen);
|
||||
|
||||
int supplyIccPinForAppResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e, void *response,
|
||||
size_t responselen);
|
||||
|
||||
int supplyIccPukForAppResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e, void *response,
|
||||
size_t responselen);
|
||||
|
||||
int supplyIccPin2ForAppResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e, void *response,
|
||||
size_t responselen);
|
||||
|
||||
int supplyIccPuk2ForAppResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e, void *response,
|
||||
size_t responselen);
|
||||
|
||||
int changeIccPinForAppResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e, void *response,
|
||||
size_t responselen);
|
||||
|
||||
int changeIccPin2ForAppResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e, void *response,
|
||||
size_t responselen);
|
||||
|
||||
int supplyNetworkDepersonalizationResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e,
|
||||
void *response, size_t responselen);
|
||||
|
||||
int getCurrentCallsResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e, void *response,
|
||||
size_t responselen);
|
||||
|
||||
int dialResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e, void *response, size_t responselen);
|
||||
|
||||
int getIMSIForAppResponse(int slotId, int responseType,
|
||||
int serial, RIL_Errno e, void *response, size_t responselen);
|
||||
|
||||
int hangupConnectionResponse(int slotId, int responseType,
|
||||
int serial, RIL_Errno e, void *response, size_t responselen);
|
||||
|
||||
int hangupWaitingOrBackgroundResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e, void *response,
|
||||
size_t responselen);
|
||||
|
||||
int hangupForegroundResumeBackgroundResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e,
|
||||
void *response, size_t responselen);
|
||||
|
||||
int switchWaitingOrHoldingAndActiveResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e,
|
||||
void *response, size_t responselen);
|
||||
|
||||
int conferenceResponse(int slotId, int responseType,
|
||||
int serial, RIL_Errno e, void *response, size_t responselen);
|
||||
|
||||
int rejectCallResponse(int slotId, int responseType,
|
||||
int serial, RIL_Errno e, void *response, size_t responselen);
|
||||
|
||||
int getLastCallFailCauseResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e, void *response,
|
||||
size_t responselen);
|
||||
|
||||
int getSignalStrengthResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e,
|
||||
void *response, size_t responseLen);
|
||||
|
||||
int getVoiceRegistrationStateResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e, void *response,
|
||||
size_t responselen);
|
||||
|
||||
int getDataRegistrationStateResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e, void *response,
|
||||
size_t responselen);
|
||||
|
||||
int getOperatorResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e, void *response,
|
||||
size_t responselen);
|
||||
|
||||
int setRadioPowerResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e, void *response,
|
||||
size_t responselen);
|
||||
|
||||
int sendDtmfResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e, void *response,
|
||||
size_t responselen);
|
||||
|
||||
int sendSmsResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e, void *response,
|
||||
size_t responselen);
|
||||
|
||||
int sendSMSExpectMoreResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e, void *response,
|
||||
size_t responselen);
|
||||
|
||||
int setupDataCallResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e, void *response,
|
||||
size_t responseLen);
|
||||
|
||||
int iccIOForAppResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e, void *response,
|
||||
size_t responselen);
|
||||
|
||||
int sendUssdResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e, void *response,
|
||||
size_t responselen);
|
||||
|
||||
int cancelPendingUssdResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e, void *response,
|
||||
size_t responselen);
|
||||
|
||||
int getClirResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e, void *response, size_t responselen);
|
||||
|
||||
int setClirResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e, void *response, size_t responselen);
|
||||
|
||||
int getCallForwardStatusResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e, void *response,
|
||||
size_t responselen);
|
||||
|
||||
int setCallForwardResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e, void *response,
|
||||
size_t responselen);
|
||||
|
||||
int getCallWaitingResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e, void *response,
|
||||
size_t responselen);
|
||||
|
||||
int setCallWaitingResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e, void *response,
|
||||
size_t responselen);
|
||||
|
||||
int acknowledgeLastIncomingGsmSmsResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e, void *response,
|
||||
size_t responselen);
|
||||
|
||||
int acceptCallResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e, void *response,
|
||||
size_t responselen);
|
||||
|
||||
int deactivateDataCallResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e, void *response,
|
||||
size_t responselen);
|
||||
|
||||
int getFacilityLockForAppResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e, void *response,
|
||||
size_t responselen);
|
||||
|
||||
int setFacilityLockForAppResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e, void *response,
|
||||
size_t responselen);
|
||||
|
||||
int setBarringPasswordResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e, void *response,
|
||||
size_t responselen);
|
||||
|
||||
int getNetworkSelectionModeResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e, void *response,
|
||||
size_t responselen);
|
||||
|
||||
int setNetworkSelectionModeAutomaticResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e,
|
||||
void *response, size_t responselen);
|
||||
|
||||
int setNetworkSelectionModeManualResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e, void *response,
|
||||
size_t responselen);
|
||||
|
||||
int getAvailableNetworksResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e, void *response,
|
||||
size_t responselen);
|
||||
|
||||
int startNetworkScanResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e, void *response,
|
||||
size_t responselen);
|
||||
|
||||
int stopNetworkScanResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e, void *response,
|
||||
size_t responselen);
|
||||
|
||||
int startDtmfResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e, void *response,
|
||||
size_t responselen);
|
||||
|
||||
int stopDtmfResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e, void *response,
|
||||
size_t responselen);
|
||||
|
||||
int getBasebandVersionResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e, void *response,
|
||||
size_t responselen);
|
||||
|
||||
int separateConnectionResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e, void *response,
|
||||
size_t responselen);
|
||||
|
||||
int setMuteResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e, void *response,
|
||||
size_t responselen);
|
||||
|
||||
int getMuteResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e, void *response,
|
||||
size_t responselen);
|
||||
|
||||
int getClipResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e, void *response,
|
||||
size_t responselen);
|
||||
|
||||
int getDataCallListResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e,
|
||||
void *response, size_t responseLen);
|
||||
|
||||
int setSuppServiceNotificationsResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e, void *response,
|
||||
size_t responselen);
|
||||
|
||||
int writeSmsToSimResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e, void *response,
|
||||
size_t responselen);
|
||||
|
||||
int deleteSmsOnSimResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e, void *response,
|
||||
size_t responselen);
|
||||
|
||||
int setBandModeResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e, void *response,
|
||||
size_t responselen);
|
||||
|
||||
int getAvailableBandModesResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e, void *response,
|
||||
size_t responselen);
|
||||
|
||||
int sendEnvelopeResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e, void *response,
|
||||
size_t responselen);
|
||||
|
||||
int sendTerminalResponseToSimResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e, void *response,
|
||||
size_t responselen);
|
||||
|
||||
int handleStkCallSetupRequestFromSimResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e,
|
||||
void *response, size_t responselen);
|
||||
|
||||
int explicitCallTransferResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e, void *response,
|
||||
size_t responselen);
|
||||
|
||||
int setPreferredNetworkTypeResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e, void *response,
|
||||
size_t responselen);
|
||||
|
||||
int getPreferredNetworkTypeResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e, void *response,
|
||||
size_t responselen);
|
||||
|
||||
int getNeighboringCidsResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e, void *response,
|
||||
size_t responselen);
|
||||
|
||||
int setLocationUpdatesResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e, void *response,
|
||||
size_t responselen);
|
||||
|
||||
int setCdmaSubscriptionSourceResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e, void *response,
|
||||
size_t responselen);
|
||||
|
||||
int setCdmaRoamingPreferenceResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e, void *response,
|
||||
size_t responselen);
|
||||
|
||||
int getCdmaRoamingPreferenceResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e, void *response,
|
||||
size_t responselen);
|
||||
|
||||
int setTTYModeResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e, void *response,
|
||||
size_t responselen);
|
||||
|
||||
int getTTYModeResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e, void *response,
|
||||
size_t responselen);
|
||||
|
||||
int setPreferredVoicePrivacyResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e, void *response,
|
||||
size_t responselen);
|
||||
|
||||
int getPreferredVoicePrivacyResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e, void *response,
|
||||
size_t responselen);
|
||||
|
||||
int sendCDMAFeatureCodeResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e,
|
||||
void *response, size_t responselen);
|
||||
|
||||
int sendBurstDtmfResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e, void *response,
|
||||
size_t responselen);
|
||||
|
||||
int sendCdmaSmsResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e, void *response,
|
||||
size_t responselen);
|
||||
|
||||
int acknowledgeLastIncomingCdmaSmsResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e, void *response,
|
||||
size_t responselen);
|
||||
|
||||
int getGsmBroadcastConfigResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e, void *response,
|
||||
size_t responselen);
|
||||
|
||||
int setGsmBroadcastConfigResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e, void *response,
|
||||
size_t responselen);
|
||||
|
||||
int setGsmBroadcastActivationResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e, void *response,
|
||||
size_t responselen);
|
||||
|
||||
int getCdmaBroadcastConfigResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e, void *response,
|
||||
size_t responselen);
|
||||
|
||||
int setCdmaBroadcastConfigResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e, void *response,
|
||||
size_t responselen);
|
||||
|
||||
int setCdmaBroadcastActivationResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e,
|
||||
void *response, size_t responselen);
|
||||
|
||||
int getCDMASubscriptionResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e, void *response,
|
||||
size_t responselen);
|
||||
|
||||
int writeSmsToRuimResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e, void *response,
|
||||
size_t responselen);
|
||||
|
||||
int deleteSmsOnRuimResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e, void *response,
|
||||
size_t responselen);
|
||||
|
||||
int getDeviceIdentityResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e, void *response,
|
||||
size_t responselen);
|
||||
|
||||
int exitEmergencyCallbackModeResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e, void *response,
|
||||
size_t responselen);
|
||||
|
||||
int getSmscAddressResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e, void *response,
|
||||
size_t responselen);
|
||||
|
||||
int setCdmaBroadcastActivationResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e,
|
||||
void *response, size_t responselen);
|
||||
|
||||
int setSmscAddressResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e,
|
||||
void *response, size_t responselen);
|
||||
|
||||
int reportSmsMemoryStatusResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e,
|
||||
void *response, size_t responselen);
|
||||
|
||||
int reportStkServiceIsRunningResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e,
|
||||
void *response, size_t responseLen);
|
||||
|
||||
int getCdmaSubscriptionSourceResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e, void *response,
|
||||
size_t responselen);
|
||||
|
||||
int requestIsimAuthenticationResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e, void *response,
|
||||
size_t responselen);
|
||||
|
||||
int acknowledgeIncomingGsmSmsWithPduResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e,
|
||||
void *response, size_t responselen);
|
||||
|
||||
int sendEnvelopeWithStatusResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e, void *response,
|
||||
size_t responselen);
|
||||
|
||||
int getVoiceRadioTechnologyResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e,
|
||||
void *response, size_t responselen);
|
||||
|
||||
int getCellInfoListResponse(int slotId,
|
||||
int responseType,
|
||||
int serial, RIL_Errno e, void *response,
|
||||
size_t responseLen);
|
||||
|
||||
int setCellInfoListRateResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e,
|
||||
void *response, size_t responselen);
|
||||
|
||||
int setInitialAttachApnResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e,
|
||||
void *response, size_t responselen);
|
||||
|
||||
int getImsRegistrationStateResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e,
|
||||
void *response, size_t responselen);
|
||||
|
||||
int sendImsSmsResponse(int slotId, int responseType,
|
||||
int serial, RIL_Errno e, void *response, size_t responselen);
|
||||
|
||||
int iccTransmitApduBasicChannelResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e,
|
||||
void *response, size_t responselen);
|
||||
|
||||
int iccOpenLogicalChannelResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e, void *response,
|
||||
size_t responselen);
|
||||
|
||||
|
||||
int iccCloseLogicalChannelResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e,
|
||||
void *response, size_t responselen);
|
||||
|
||||
int iccTransmitApduLogicalChannelResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e,
|
||||
void *response, size_t responselen);
|
||||
|
||||
int nvReadItemResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e,
|
||||
void *response, size_t responselen);
|
||||
|
||||
|
||||
int nvWriteItemResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e,
|
||||
void *response, size_t responselen);
|
||||
|
||||
int nvWriteCdmaPrlResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e,
|
||||
void *response, size_t responselen);
|
||||
|
||||
int nvResetConfigResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e,
|
||||
void *response, size_t responselen);
|
||||
|
||||
int setUiccSubscriptionResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e,
|
||||
void *response, size_t responselen);
|
||||
|
||||
int setDataAllowedResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e,
|
||||
void *response, size_t responselen);
|
||||
|
||||
int getHardwareConfigResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e,
|
||||
void *response, size_t responseLen);
|
||||
|
||||
int requestIccSimAuthenticationResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e,
|
||||
void *response, size_t responselen);
|
||||
|
||||
int setDataProfileResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e,
|
||||
void *response, size_t responselen);
|
||||
|
||||
int requestShutdownResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e,
|
||||
void *response, size_t responselen);
|
||||
|
||||
int getRadioCapabilityResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e,
|
||||
void *response, size_t responseLen);
|
||||
|
||||
int setRadioCapabilityResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e,
|
||||
void *response, size_t responseLen);
|
||||
|
||||
int startLceServiceResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e,
|
||||
void *response, size_t responselen);
|
||||
|
||||
int stopLceServiceResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e,
|
||||
void *response, size_t responselen);
|
||||
|
||||
int pullLceDataResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e,
|
||||
void *response, size_t responseLen);
|
||||
|
||||
int getModemActivityInfoResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e,
|
||||
void *response, size_t responselen);
|
||||
|
||||
int setAllowedCarriersResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e,
|
||||
void *response, size_t responselen);
|
||||
|
||||
int getAllowedCarriersResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e,
|
||||
void *response, size_t responselen);
|
||||
|
||||
int sendDeviceStateResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e,
|
||||
void *response, size_t responselen);
|
||||
|
||||
int setIndicationFilterResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e,
|
||||
void *response, size_t responselen);
|
||||
|
||||
int setSimCardPowerResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e,
|
||||
void *response, size_t responselen);
|
||||
|
||||
int startKeepaliveResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e,
|
||||
void *response, size_t responselen);
|
||||
|
||||
int stopKeepaliveResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e,
|
||||
void *response, size_t responselen);
|
||||
|
||||
void acknowledgeRequest(int slotId, int serial);
|
||||
|
||||
int radioStateChangedInd(int slotId,
|
||||
int indicationType, int token, RIL_Errno e, void *response,
|
||||
size_t responseLen);
|
||||
|
||||
int callStateChangedInd(int slotId, int indType, int token,
|
||||
RIL_Errno e, void *response, size_t responselen);
|
||||
|
||||
int networkStateChangedInd(int slotId, int indType,
|
||||
int token, RIL_Errno e, void *response, size_t responselen);
|
||||
|
||||
int newSmsInd(int slotId, int indicationType,
|
||||
int token, RIL_Errno e, void *response, size_t responselen);
|
||||
|
||||
int newSmsStatusReportInd(int slotId, int indicationType,
|
||||
int token, RIL_Errno e, void *response, size_t responselen);
|
||||
|
||||
int newSmsOnSimInd(int slotId, int indicationType,
|
||||
int token, RIL_Errno e, void *response, size_t responselen);
|
||||
|
||||
int onUssdInd(int slotId, int indicationType,
|
||||
int token, RIL_Errno e, void *response, size_t responselen);
|
||||
|
||||
int nitzTimeReceivedInd(int slotId, int indicationType,
|
||||
int token, RIL_Errno e, void *response, size_t responselen);
|
||||
|
||||
int currentSignalStrengthInd(int slotId,
|
||||
int indicationType, int token, RIL_Errno e,
|
||||
void *response, size_t responselen);
|
||||
|
||||
int dataCallListChangedInd(int slotId, int indicationType,
|
||||
int token, RIL_Errno e, void *response, size_t responselen);
|
||||
|
||||
int suppSvcNotifyInd(int slotId, int indicationType,
|
||||
int token, RIL_Errno e, void *response, size_t responselen);
|
||||
|
||||
int stkSessionEndInd(int slotId, int indicationType,
|
||||
int token, RIL_Errno e, void *response, size_t responselen);
|
||||
|
||||
int stkProactiveCommandInd(int slotId, int indicationType,
|
||||
int token, RIL_Errno e, void *response, size_t responselen);
|
||||
|
||||
int stkEventNotifyInd(int slotId, int indicationType,
|
||||
int token, RIL_Errno e, void *response, size_t responselen);
|
||||
|
||||
int stkCallSetupInd(int slotId, int indicationType,
|
||||
int token, RIL_Errno e, void *response, size_t responselen);
|
||||
|
||||
int simSmsStorageFullInd(int slotId, int indicationType,
|
||||
int token, RIL_Errno e, void *response, size_t responselen);
|
||||
|
||||
int simRefreshInd(int slotId, int indicationType,
|
||||
int token, RIL_Errno e, void *response, size_t responselen);
|
||||
|
||||
int callRingInd(int slotId, int indicationType,
|
||||
int token, RIL_Errno e, void *response, size_t responselen);
|
||||
|
||||
int simStatusChangedInd(int slotId, int indicationType,
|
||||
int token, RIL_Errno e, void *response, size_t responselen);
|
||||
|
||||
int cdmaNewSmsInd(int slotId, int indicationType,
|
||||
int token, RIL_Errno e, void *response, size_t responselen);
|
||||
|
||||
int newBroadcastSmsInd(int slotId,
|
||||
int indicationType, int token, RIL_Errno e, void *response,
|
||||
size_t responselen);
|
||||
|
||||
int cdmaRuimSmsStorageFullInd(int slotId,
|
||||
int indicationType, int token, RIL_Errno e, void *response,
|
||||
size_t responselen);
|
||||
|
||||
int restrictedStateChangedInd(int slotId,
|
||||
int indicationType, int token, RIL_Errno e, void *response,
|
||||
size_t responselen);
|
||||
|
||||
int enterEmergencyCallbackModeInd(int slotId,
|
||||
int indicationType, int token, RIL_Errno e, void *response,
|
||||
size_t responselen);
|
||||
|
||||
int cdmaCallWaitingInd(int slotId,
|
||||
int indicationType, int token, RIL_Errno e, void *response,
|
||||
size_t responselen);
|
||||
|
||||
int cdmaOtaProvisionStatusInd(int slotId,
|
||||
int indicationType, int token, RIL_Errno e, void *response,
|
||||
size_t responselen);
|
||||
|
||||
int cdmaInfoRecInd(int slotId,
|
||||
int indicationType, int token, RIL_Errno e, void *response,
|
||||
size_t responselen);
|
||||
|
||||
int oemHookRawInd(int slotId,
|
||||
int indicationType, int token, RIL_Errno e, void *response,
|
||||
size_t responselen);
|
||||
|
||||
int indicateRingbackToneInd(int slotId,
|
||||
int indicationType, int token, RIL_Errno e, void *response,
|
||||
size_t responselen);
|
||||
|
||||
int resendIncallMuteInd(int slotId,
|
||||
int indicationType, int token, RIL_Errno e, void *response,
|
||||
size_t responselen);
|
||||
|
||||
int cdmaSubscriptionSourceChangedInd(int slotId,
|
||||
int indicationType, int token, RIL_Errno e,
|
||||
void *response, size_t responselen);
|
||||
|
||||
int cdmaPrlChangedInd(int slotId,
|
||||
int indicationType, int token, RIL_Errno e, void *response,
|
||||
size_t responselen);
|
||||
|
||||
int exitEmergencyCallbackModeInd(int slotId,
|
||||
int indicationType, int token, RIL_Errno e, void *response,
|
||||
size_t responselen);
|
||||
|
||||
int rilConnectedInd(int slotId,
|
||||
int indicationType, int token, RIL_Errno e, void *response,
|
||||
size_t responselen);
|
||||
|
||||
int voiceRadioTechChangedInd(int slotId,
|
||||
int indicationType, int token, RIL_Errno e, void *response,
|
||||
size_t responselen);
|
||||
|
||||
int cellInfoListInd(int slotId,
|
||||
int indicationType, int token, RIL_Errno e, void *response,
|
||||
size_t responselen);
|
||||
|
||||
int imsNetworkStateChangedInd(int slotId,
|
||||
int indicationType, int token, RIL_Errno e, void *response,
|
||||
size_t responselen);
|
||||
|
||||
int subscriptionStatusChangedInd(int slotId,
|
||||
int indicationType, int token, RIL_Errno e, void *response,
|
||||
size_t responselen);
|
||||
|
||||
int srvccStateNotifyInd(int slotId,
|
||||
int indicationType, int token, RIL_Errno e, void *response,
|
||||
size_t responselen);
|
||||
|
||||
int hardwareConfigChangedInd(int slotId,
|
||||
int indicationType, int token, RIL_Errno e, void *response,
|
||||
size_t responselen);
|
||||
|
||||
int radioCapabilityIndicationInd(int slotId,
|
||||
int indicationType, int token, RIL_Errno e, void *response,
|
||||
size_t responselen);
|
||||
|
||||
int onSupplementaryServiceIndicationInd(int slotId,
|
||||
int indicationType, int token, RIL_Errno e,
|
||||
void *response, size_t responselen);
|
||||
|
||||
int stkCallControlAlphaNotifyInd(int slotId,
|
||||
int indicationType, int token, RIL_Errno e, void *response,
|
||||
size_t responselen);
|
||||
|
||||
int lceDataInd(int slotId,
|
||||
int indicationType, int token, RIL_Errno e, void *response,
|
||||
size_t responselen);
|
||||
|
||||
int pcoDataInd(int slotId,
|
||||
int indicationType, int token, RIL_Errno e, void *response,
|
||||
size_t responselen);
|
||||
|
||||
int modemResetInd(int slotId,
|
||||
int indicationType, int token, RIL_Errno e, void *response,
|
||||
size_t responselen);
|
||||
|
||||
int networkScanResultInd(int slotId,
|
||||
int indicationType, int token, RIL_Errno e, void *response,
|
||||
size_t responselen);
|
||||
|
||||
int keepaliveStatusInd(int slotId,
|
||||
int indicationType, int token, RIL_Errno e, void *response,
|
||||
size_t responselen);
|
||||
|
||||
int sendRequestRawResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e,
|
||||
void *response, size_t responseLen);
|
||||
|
||||
int sendRequestStringsResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e,
|
||||
void *response, size_t responseLen);
|
||||
|
||||
int setCarrierInfoForImsiEncryptionResponse(int slotId,
|
||||
int responseType, int serial, RIL_Errno e,
|
||||
void *response, size_t responseLen);
|
||||
|
||||
int carrierInfoForImsiEncryption(int slotId,
|
||||
int responseType, int serial, RIL_Errno e,
|
||||
void *response, size_t responseLen);
|
||||
|
||||
pthread_rwlock_t * getRadioServiceRwlock(int slotId);
|
||||
|
||||
void setNitzTimeReceived(int slotId, long timeReceived);
|
||||
|
||||
} // namespace radio
|
||||
|
||||
#endif // RIL_SERVICE_H
|
@ -1,67 +0,0 @@
|
||||
/* //device/libs/telephony/ril_unsol_commands.h
|
||||
**
|
||||
** Copyright 2006, The Android Open Source Project
|
||||
**
|
||||
** Licensed under the Apache License, Version 2.0 (the "License");
|
||||
** you may not use this file except in compliance with the License.
|
||||
** You may obtain a copy of the License at
|
||||
**
|
||||
** http://www.apache.org/licenses/LICENSE-2.0
|
||||
**
|
||||
** Unless required by applicable law or agreed to in writing, software
|
||||
** distributed under the License is distributed on an "AS IS" BASIS,
|
||||
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
** See the License for the specific language governing permissions and
|
||||
** limitations under the License.
|
||||
*/
|
||||
{RIL_UNSOL_RESPONSE_RADIO_STATE_CHANGED, radio::radioStateChangedInd, WAKE_PARTIAL},
|
||||
{RIL_UNSOL_RESPONSE_CALL_STATE_CHANGED, radio::callStateChangedInd, WAKE_PARTIAL},
|
||||
{RIL_UNSOL_RESPONSE_VOICE_NETWORK_STATE_CHANGED, radio::networkStateChangedInd, WAKE_PARTIAL},
|
||||
{RIL_UNSOL_RESPONSE_NEW_SMS, radio::newSmsInd, WAKE_PARTIAL},
|
||||
{RIL_UNSOL_RESPONSE_NEW_SMS_STATUS_REPORT, radio::newSmsStatusReportInd, WAKE_PARTIAL},
|
||||
{RIL_UNSOL_RESPONSE_NEW_SMS_ON_SIM, radio::newSmsOnSimInd, WAKE_PARTIAL},
|
||||
{RIL_UNSOL_ON_USSD, radio::onUssdInd, WAKE_PARTIAL},
|
||||
{RIL_UNSOL_ON_USSD_REQUEST, radio::onUssdInd, DONT_WAKE},
|
||||
{RIL_UNSOL_NITZ_TIME_RECEIVED, radio::nitzTimeReceivedInd, WAKE_PARTIAL},
|
||||
{RIL_UNSOL_SIGNAL_STRENGTH, radio::currentSignalStrengthInd, DONT_WAKE},
|
||||
{RIL_UNSOL_DATA_CALL_LIST_CHANGED, radio::dataCallListChangedInd, WAKE_PARTIAL},
|
||||
{RIL_UNSOL_SUPP_SVC_NOTIFICATION, radio::suppSvcNotifyInd, WAKE_PARTIAL},
|
||||
{RIL_UNSOL_STK_SESSION_END, radio::stkSessionEndInd, WAKE_PARTIAL},
|
||||
{RIL_UNSOL_STK_PROACTIVE_COMMAND, radio::stkProactiveCommandInd, WAKE_PARTIAL},
|
||||
{RIL_UNSOL_STK_EVENT_NOTIFY, radio::stkEventNotifyInd, WAKE_PARTIAL},
|
||||
{RIL_UNSOL_STK_CALL_SETUP, radio::stkCallSetupInd, WAKE_PARTIAL},
|
||||
{RIL_UNSOL_SIM_SMS_STORAGE_FULL, radio::simSmsStorageFullInd, WAKE_PARTIAL},
|
||||
{RIL_UNSOL_SIM_REFRESH, radio::simRefreshInd, WAKE_PARTIAL},
|
||||
{RIL_UNSOL_CALL_RING, radio::callRingInd, WAKE_PARTIAL},
|
||||
{RIL_UNSOL_RESPONSE_SIM_STATUS_CHANGED, radio::simStatusChangedInd, WAKE_PARTIAL},
|
||||
{RIL_UNSOL_RESPONSE_CDMA_NEW_SMS, radio::cdmaNewSmsInd, WAKE_PARTIAL},
|
||||
{RIL_UNSOL_RESPONSE_NEW_BROADCAST_SMS, radio::newBroadcastSmsInd, WAKE_PARTIAL},
|
||||
{RIL_UNSOL_CDMA_RUIM_SMS_STORAGE_FULL, radio::cdmaRuimSmsStorageFullInd, WAKE_PARTIAL},
|
||||
{RIL_UNSOL_RESTRICTED_STATE_CHANGED, radio::restrictedStateChangedInd, WAKE_PARTIAL},
|
||||
{RIL_UNSOL_ENTER_EMERGENCY_CALLBACK_MODE, radio::enterEmergencyCallbackModeInd, WAKE_PARTIAL},
|
||||
{RIL_UNSOL_CDMA_CALL_WAITING, radio::cdmaCallWaitingInd, WAKE_PARTIAL},
|
||||
{RIL_UNSOL_CDMA_OTA_PROVISION_STATUS, radio::cdmaOtaProvisionStatusInd, WAKE_PARTIAL},
|
||||
{RIL_UNSOL_CDMA_INFO_REC, radio::cdmaInfoRecInd, WAKE_PARTIAL},
|
||||
{RIL_UNSOL_OEM_HOOK_RAW, radio::oemHookRawInd, WAKE_PARTIAL},
|
||||
{RIL_UNSOL_RINGBACK_TONE, radio::indicateRingbackToneInd, WAKE_PARTIAL},
|
||||
{RIL_UNSOL_RESEND_INCALL_MUTE, radio::resendIncallMuteInd, WAKE_PARTIAL},
|
||||
{RIL_UNSOL_CDMA_SUBSCRIPTION_SOURCE_CHANGED, radio::cdmaSubscriptionSourceChangedInd, WAKE_PARTIAL},
|
||||
{RIL_UNSOL_CDMA_PRL_CHANGED, radio::cdmaPrlChangedInd, WAKE_PARTIAL},
|
||||
{RIL_UNSOL_EXIT_EMERGENCY_CALLBACK_MODE, radio::exitEmergencyCallbackModeInd, WAKE_PARTIAL},
|
||||
{RIL_UNSOL_RIL_CONNECTED, radio::rilConnectedInd, WAKE_PARTIAL},
|
||||
{RIL_UNSOL_VOICE_RADIO_TECH_CHANGED, radio::voiceRadioTechChangedInd, WAKE_PARTIAL},
|
||||
{RIL_UNSOL_CELL_INFO_LIST, radio::cellInfoListInd, WAKE_PARTIAL},
|
||||
{RIL_UNSOL_RESPONSE_IMS_NETWORK_STATE_CHANGED, radio::imsNetworkStateChangedInd, WAKE_PARTIAL},
|
||||
{RIL_UNSOL_UICC_SUBSCRIPTION_STATUS_CHANGED, radio::subscriptionStatusChangedInd, WAKE_PARTIAL},
|
||||
{RIL_UNSOL_SRVCC_STATE_NOTIFY, radio::srvccStateNotifyInd, WAKE_PARTIAL},
|
||||
{RIL_UNSOL_HARDWARE_CONFIG_CHANGED, radio::hardwareConfigChangedInd, WAKE_PARTIAL},
|
||||
{RIL_UNSOL_DC_RT_INFO_CHANGED, NULL, WAKE_PARTIAL},
|
||||
{RIL_UNSOL_RADIO_CAPABILITY, radio::radioCapabilityIndicationInd, WAKE_PARTIAL},
|
||||
{RIL_UNSOL_ON_SS, radio::onSupplementaryServiceIndicationInd, WAKE_PARTIAL},
|
||||
{RIL_UNSOL_STK_CC_ALPHA_NOTIFY, radio::stkCallControlAlphaNotifyInd, WAKE_PARTIAL},
|
||||
{RIL_UNSOL_LCEDATA_RECV, radio::lceDataInd, WAKE_PARTIAL},
|
||||
{RIL_UNSOL_PCO_DATA, radio::pcoDataInd, WAKE_PARTIAL},
|
||||
{RIL_UNSOL_MODEM_RESTART, radio::modemResetInd, WAKE_PARTIAL},
|
||||
{RIL_UNSOL_CARRIER_INFO_IMSI_ENCRYPTION, radio::carrierInfoForImsiEncryption, WAKE_PARTIAL},
|
||||
{RIL_UNSOL_NETWORK_SCAN_RESULT, radio::networkScanResultInd, WAKE_PARTIAL},
|
||||
{RIL_UNSOL_KEEPALIVE_STATUS, radio::keepaliveStatusInd, WAKE_PARTIAL},
|
@ -1,966 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2016 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#define LOG_TAG "RIL_SAP"
|
||||
|
||||
#include <android/hardware/radio/1.1/ISap.h>
|
||||
|
||||
#include <hwbinder/IPCThreadState.h>
|
||||
#include <hwbinder/ProcessState.h>
|
||||
#include <sap_service.h>
|
||||
#include "pb_decode.h"
|
||||
#include "pb_encode.h"
|
||||
|
||||
using namespace android::hardware::radio::V1_0;
|
||||
using ::android::hardware::Return;
|
||||
using ::android::hardware::hidl_vec;
|
||||
using ::android::hardware::hidl_array;
|
||||
using ::android::hardware::Void;
|
||||
using android::CommandInfo;
|
||||
using android::RequestInfo;
|
||||
using android::requestToString;
|
||||
using android::sp;
|
||||
|
||||
struct SapImpl;
|
||||
|
||||
#if (SIM_COUNT >= 2)
|
||||
sp<SapImpl> sapService[SIM_COUNT];
|
||||
#else
|
||||
sp<SapImpl> sapService[1];
|
||||
#endif
|
||||
|
||||
struct SapImpl : public android::hardware::radio::V1_1::ISap {
|
||||
int32_t slotId;
|
||||
sp<ISapCallback> sapCallback;
|
||||
RIL_SOCKET_ID rilSocketId;
|
||||
|
||||
Return<void> setCallback(const ::android::sp<ISapCallback>& sapCallbackParam);
|
||||
|
||||
Return<void> connectReq(int32_t token, int32_t maxMsgSize);
|
||||
|
||||
Return<void> disconnectReq(int32_t token);
|
||||
|
||||
Return<void> apduReq(int32_t token, SapApduType type, const hidl_vec<uint8_t>& command);
|
||||
|
||||
Return<void> transferAtrReq(int32_t token);
|
||||
|
||||
Return<void> powerReq(int32_t token, bool state);
|
||||
|
||||
Return<void> resetSimReq(int32_t token);
|
||||
|
||||
Return<void> transferCardReaderStatusReq(int32_t token);
|
||||
|
||||
Return<void> setTransferProtocolReq(int32_t token, SapTransferProtocol transferProtocol);
|
||||
|
||||
MsgHeader* createMsgHeader(MsgId msgId, int32_t token);
|
||||
|
||||
Return<void> addPayloadAndDispatchRequest(MsgHeader *msg, uint16_t reqLen, uint8_t *reqPtr);
|
||||
|
||||
void sendFailedResponse(MsgId msgId, int32_t token, int numPointers, ...);
|
||||
|
||||
void checkReturnStatus(Return<void>& ret);
|
||||
};
|
||||
|
||||
void SapImpl::checkReturnStatus(Return<void>& ret) {
|
||||
if (ret.isOk() == false) {
|
||||
RLOGE("checkReturnStatus: unable to call response/indication callback: %s",
|
||||
ret.description().c_str());
|
||||
// Remote process (SapRilReceiver.java) hosting the callback must be dead. Reset the
|
||||
// callback object; there's no other recovery to be done here. When the client process is
|
||||
// back up, it will call setCallback()
|
||||
sapCallback = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
Return<void> SapImpl::setCallback(const ::android::sp<ISapCallback>& sapCallbackParam) {
|
||||
RLOGD("SapImpl::setCallback for slotId %d", slotId);
|
||||
sapCallback = sapCallbackParam;
|
||||
return Void();
|
||||
}
|
||||
|
||||
MsgHeader* SapImpl::createMsgHeader(MsgId msgId, int32_t token) {
|
||||
// Memory for msg will be freed by RilSapSocket::onRequestComplete()
|
||||
MsgHeader *msg = (MsgHeader *)calloc(1, sizeof(MsgHeader));
|
||||
if (msg == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
msg->token = token;
|
||||
msg->type = MsgType_REQUEST;
|
||||
msg->id = msgId;
|
||||
msg->error = Error_RIL_E_SUCCESS;
|
||||
return msg;
|
||||
}
|
||||
|
||||
Return<void> SapImpl::addPayloadAndDispatchRequest(MsgHeader *msg, uint16_t reqLen,
|
||||
uint8_t *reqPtr) {
|
||||
pb_bytes_array_t *payload = (pb_bytes_array_t *) malloc(sizeof(pb_bytes_array_t) - 1 + reqLen);
|
||||
if (payload == NULL) {
|
||||
sendFailedResponse(msg->id, msg->token, 2, reqPtr, msg);
|
||||
return Void();
|
||||
}
|
||||
|
||||
msg->payload = payload;
|
||||
msg->payload->size = reqLen;
|
||||
memcpy(msg->payload->bytes, reqPtr, reqLen);
|
||||
|
||||
RilSapSocket *sapSocket = RilSapSocket::getSocketById(rilSocketId);
|
||||
if (sapSocket) {
|
||||
RLOGD("SapImpl::addPayloadAndDispatchRequest: calling dispatchRequest");
|
||||
sapSocket->dispatchRequest(msg);
|
||||
} else {
|
||||
RLOGE("SapImpl::addPayloadAndDispatchRequest: sapSocket is null");
|
||||
sendFailedResponse(msg->id, msg->token, 3, payload, reqPtr, msg);
|
||||
return Void();
|
||||
}
|
||||
free(payload);
|
||||
free(reqPtr);
|
||||
return Void();
|
||||
}
|
||||
|
||||
void SapImpl::sendFailedResponse(MsgId msgId, int32_t token, int numPointers, ...) {
|
||||
va_list ap;
|
||||
va_start(ap, numPointers);
|
||||
for (int i = 0; i < numPointers; i++) {
|
||||
void *ptr = va_arg(ap, void *);
|
||||
if (ptr) free(ptr);
|
||||
}
|
||||
va_end(ap);
|
||||
Return<void> retStatus;
|
||||
switch(msgId) {
|
||||
case MsgId_RIL_SIM_SAP_CONNECT:
|
||||
retStatus = sapCallback->connectResponse(token, SapConnectRsp::CONNECT_FAILURE, 0);
|
||||
break;
|
||||
|
||||
case MsgId_RIL_SIM_SAP_DISCONNECT:
|
||||
retStatus = sapCallback->disconnectResponse(token);
|
||||
break;
|
||||
|
||||
case MsgId_RIL_SIM_SAP_APDU: {
|
||||
hidl_vec<uint8_t> apduRsp;
|
||||
retStatus = sapCallback->apduResponse(token, SapResultCode::GENERIC_FAILURE, apduRsp);
|
||||
break;
|
||||
}
|
||||
|
||||
case MsgId_RIL_SIM_SAP_TRANSFER_ATR: {
|
||||
hidl_vec<uint8_t> atr;
|
||||
retStatus = sapCallback->transferAtrResponse(token, SapResultCode::GENERIC_FAILURE,
|
||||
atr);
|
||||
break;
|
||||
}
|
||||
|
||||
case MsgId_RIL_SIM_SAP_POWER:
|
||||
retStatus = sapCallback->powerResponse(token, SapResultCode::GENERIC_FAILURE);
|
||||
break;
|
||||
|
||||
case MsgId_RIL_SIM_SAP_RESET_SIM:
|
||||
retStatus = sapCallback->resetSimResponse(token, SapResultCode::GENERIC_FAILURE);
|
||||
break;
|
||||
|
||||
case MsgId_RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS:
|
||||
retStatus = sapCallback->transferCardReaderStatusResponse(token,
|
||||
SapResultCode::GENERIC_FAILURE, 0);
|
||||
break;
|
||||
|
||||
case MsgId_RIL_SIM_SAP_SET_TRANSFER_PROTOCOL:
|
||||
retStatus = sapCallback->transferProtocolResponse(token, SapResultCode::NOT_SUPPORTED);
|
||||
break;
|
||||
|
||||
default:
|
||||
return;
|
||||
}
|
||||
sapService[slotId]->checkReturnStatus(retStatus);
|
||||
}
|
||||
|
||||
Return<void> SapImpl::connectReq(int32_t token, int32_t maxMsgSize) {
|
||||
RLOGD("SapImpl::connectReq");
|
||||
MsgHeader *msg = createMsgHeader(MsgId_RIL_SIM_SAP_CONNECT, token);
|
||||
if (msg == NULL) {
|
||||
RLOGE("SapImpl::connectReq: Error allocating memory for msg");
|
||||
sendFailedResponse(MsgId_RIL_SIM_SAP_CONNECT, token, 0);
|
||||
return Void();
|
||||
}
|
||||
|
||||
/***** Encode RIL_SIM_SAP_CONNECT_REQ *****/
|
||||
RIL_SIM_SAP_CONNECT_REQ req;
|
||||
memset(&req, 0, sizeof(RIL_SIM_SAP_CONNECT_REQ));
|
||||
req.max_message_size = maxMsgSize;
|
||||
|
||||
size_t encodedSize = 0;
|
||||
if (!pb_get_encoded_size(&encodedSize, RIL_SIM_SAP_CONNECT_REQ_fields, &req)) {
|
||||
RLOGE("SapImpl::connectReq: Error getting encoded size for RIL_SIM_SAP_CONNECT_REQ");
|
||||
sendFailedResponse(MsgId_RIL_SIM_SAP_CONNECT, token, 1, msg);
|
||||
return Void();
|
||||
}
|
||||
|
||||
uint8_t *buffer = (uint8_t *)calloc(1, encodedSize);
|
||||
if (buffer == NULL) {
|
||||
RLOGE("SapImpl::connectReq: Error allocating memory for buffer");
|
||||
sendFailedResponse(MsgId_RIL_SIM_SAP_CONNECT, token, 1, msg);
|
||||
return Void();
|
||||
}
|
||||
pb_ostream_t stream = pb_ostream_from_buffer(buffer, encodedSize);
|
||||
|
||||
RLOGD("SapImpl::connectReq calling pb_encode");
|
||||
if (!pb_encode(&stream, RIL_SIM_SAP_CONNECT_REQ_fields, &req)) {
|
||||
RLOGE("SapImpl::connectReq: Error encoding RIL_SIM_SAP_CONNECT_REQ");
|
||||
sendFailedResponse(MsgId_RIL_SIM_SAP_CONNECT, token, 2, buffer, msg);
|
||||
return Void();
|
||||
}
|
||||
/***** Encode RIL_SIM_SAP_CONNECT_REQ done *****/
|
||||
|
||||
/* encoded req is payload */
|
||||
return addPayloadAndDispatchRequest(msg, stream.bytes_written, buffer);
|
||||
}
|
||||
|
||||
Return<void> SapImpl::disconnectReq(int32_t token) {
|
||||
RLOGD("SapImpl::disconnectReq");
|
||||
MsgHeader *msg = createMsgHeader(MsgId_RIL_SIM_SAP_DISCONNECT, token);
|
||||
if (msg == NULL) {
|
||||
RLOGE("SapImpl::disconnectReq: Error allocating memory for msg");
|
||||
sendFailedResponse(MsgId_RIL_SIM_SAP_DISCONNECT, token, 0);
|
||||
return Void();
|
||||
}
|
||||
|
||||
/***** Encode RIL_SIM_SAP_DISCONNECT_REQ *****/
|
||||
RIL_SIM_SAP_DISCONNECT_REQ req;
|
||||
memset(&req, 0, sizeof(RIL_SIM_SAP_DISCONNECT_REQ));
|
||||
|
||||
size_t encodedSize = 0;
|
||||
if (!pb_get_encoded_size(&encodedSize, RIL_SIM_SAP_DISCONNECT_REQ_fields, &req)) {
|
||||
RLOGE("SapImpl::disconnectReq: Error getting encoded size for RIL_SIM_SAP_DISCONNECT_REQ");
|
||||
sendFailedResponse(MsgId_RIL_SIM_SAP_DISCONNECT, token, 1, msg);
|
||||
return Void();
|
||||
}
|
||||
|
||||
uint8_t *buffer = (uint8_t *)calloc(1, encodedSize);
|
||||
if (buffer == NULL) {
|
||||
RLOGE("SapImpl::disconnectReq: Error allocating memory for buffer");
|
||||
sendFailedResponse(MsgId_RIL_SIM_SAP_DISCONNECT, token, 1, msg);
|
||||
return Void();
|
||||
}
|
||||
|
||||
pb_ostream_t stream = pb_ostream_from_buffer(buffer, encodedSize);
|
||||
|
||||
RLOGD("SapImpl::disconnectReq calling pb_encode");
|
||||
if (!pb_encode(&stream, RIL_SIM_SAP_DISCONNECT_REQ_fields, &req)) {
|
||||
RLOGE("SapImpl::disconnectReq: Error encoding RIL_SIM_SAP_DISCONNECT_REQ");
|
||||
sendFailedResponse(MsgId_RIL_SIM_SAP_DISCONNECT, token, 2, buffer, msg);
|
||||
return Void();
|
||||
}
|
||||
/***** Encode RIL_SIM_SAP_DISCONNECT_REQ done *****/
|
||||
|
||||
/* encoded req is payload */
|
||||
return addPayloadAndDispatchRequest(msg, stream.bytes_written, buffer);
|
||||
}
|
||||
|
||||
Return<void> SapImpl::apduReq(int32_t token, SapApduType type, const hidl_vec<uint8_t>& command) {
|
||||
RLOGD("SapImpl::apduReq");
|
||||
MsgHeader *msg = createMsgHeader(MsgId_RIL_SIM_SAP_APDU, token);
|
||||
if (msg == NULL) {
|
||||
RLOGE("SapImpl::apduReq: Error allocating memory for msg");
|
||||
sendFailedResponse(MsgId_RIL_SIM_SAP_APDU, token, 0);
|
||||
return Void();
|
||||
}
|
||||
|
||||
/***** Encode RIL_SIM_SAP_APDU_REQ *****/
|
||||
RIL_SIM_SAP_APDU_REQ req;
|
||||
memset(&req, 0, sizeof(RIL_SIM_SAP_APDU_REQ));
|
||||
req.type = (RIL_SIM_SAP_APDU_REQ_Type)type;
|
||||
|
||||
if (command.size() > 0) {
|
||||
req.command = (pb_bytes_array_t *)malloc(sizeof(pb_bytes_array_t) - 1 + command.size());
|
||||
if (req.command == NULL) {
|
||||
RLOGE("SapImpl::apduReq: Error allocating memory for req.command");
|
||||
sendFailedResponse(MsgId_RIL_SIM_SAP_APDU, token, 1, msg);
|
||||
return Void();
|
||||
}
|
||||
req.command->size = command.size();
|
||||
memcpy(req.command->bytes, command.data(), command.size());
|
||||
}
|
||||
|
||||
size_t encodedSize = 0;
|
||||
if (!pb_get_encoded_size(&encodedSize, RIL_SIM_SAP_APDU_REQ_fields, &req)) {
|
||||
RLOGE("SapImpl::apduReq: Error getting encoded size for RIL_SIM_SAP_APDU_REQ");
|
||||
sendFailedResponse(MsgId_RIL_SIM_SAP_APDU, token, 2, req.command, msg);
|
||||
return Void();
|
||||
}
|
||||
|
||||
uint8_t *buffer = (uint8_t *)calloc(1, encodedSize);
|
||||
if (buffer == NULL) {
|
||||
RLOGE("SapImpl::apduReq: Error allocating memory for buffer");
|
||||
sendFailedResponse(MsgId_RIL_SIM_SAP_APDU, token, 2, req.command, msg);
|
||||
return Void();
|
||||
}
|
||||
|
||||
pb_ostream_t stream = pb_ostream_from_buffer(buffer, encodedSize);
|
||||
|
||||
RLOGD("SapImpl::apduReq calling pb_encode");
|
||||
if (!pb_encode(&stream, RIL_SIM_SAP_APDU_REQ_fields, &req)) {
|
||||
RLOGE("SapImpl::apduReq: Error encoding RIL_SIM_SAP_APDU_REQ");
|
||||
sendFailedResponse(MsgId_RIL_SIM_SAP_APDU, token, 3, req.command, buffer, msg);
|
||||
return Void();
|
||||
}
|
||||
/***** Encode RIL_SIM_SAP_APDU_REQ done *****/
|
||||
|
||||
/* encoded req is payload */
|
||||
return addPayloadAndDispatchRequest(msg, stream.bytes_written, buffer);
|
||||
}
|
||||
|
||||
Return<void> SapImpl::transferAtrReq(int32_t token) {
|
||||
RLOGD("SapImpl::transferAtrReq");
|
||||
MsgHeader *msg = createMsgHeader(MsgId_RIL_SIM_SAP_TRANSFER_ATR, token);
|
||||
if (msg == NULL) {
|
||||
RLOGE("SapImpl::transferAtrReq: Error allocating memory for msg");
|
||||
sendFailedResponse(MsgId_RIL_SIM_SAP_TRANSFER_ATR, token, 0);
|
||||
return Void();
|
||||
}
|
||||
|
||||
/***** Encode RIL_SIM_SAP_TRANSFER_ATR_REQ *****/
|
||||
RIL_SIM_SAP_TRANSFER_ATR_REQ req;
|
||||
memset(&req, 0, sizeof(RIL_SIM_SAP_TRANSFER_ATR_REQ));
|
||||
|
||||
size_t encodedSize = 0;
|
||||
if (!pb_get_encoded_size(&encodedSize, RIL_SIM_SAP_TRANSFER_ATR_REQ_fields, &req)) {
|
||||
RLOGE("SapImpl::transferAtrReq: Error getting encoded size for "
|
||||
"RIL_SIM_SAP_TRANSFER_ATR_REQ");
|
||||
sendFailedResponse(MsgId_RIL_SIM_SAP_TRANSFER_ATR, token, 1, msg);
|
||||
return Void();
|
||||
}
|
||||
|
||||
uint8_t *buffer = (uint8_t *)calloc(1, encodedSize);
|
||||
if (buffer == NULL) {
|
||||
RLOGE("SapImpl::transferAtrReq: Error allocating memory for buffer");
|
||||
sendFailedResponse(MsgId_RIL_SIM_SAP_TRANSFER_ATR, token, 1, msg);
|
||||
return Void();
|
||||
}
|
||||
|
||||
pb_ostream_t stream = pb_ostream_from_buffer(buffer, encodedSize);
|
||||
|
||||
RLOGD("SapImpl::transferAtrReq calling pb_encode");
|
||||
if (!pb_encode(&stream, RIL_SIM_SAP_TRANSFER_ATR_REQ_fields, &req)) {
|
||||
RLOGE("SapImpl::transferAtrReq: Error encoding RIL_SIM_SAP_TRANSFER_ATR_REQ");
|
||||
sendFailedResponse(MsgId_RIL_SIM_SAP_TRANSFER_ATR, token, 2, buffer, msg);
|
||||
return Void();
|
||||
}
|
||||
/***** Encode RIL_SIM_SAP_TRANSFER_ATR_REQ done *****/
|
||||
|
||||
/* encoded req is payload */
|
||||
return addPayloadAndDispatchRequest(msg, stream.bytes_written, buffer);
|
||||
}
|
||||
|
||||
Return<void> SapImpl::powerReq(int32_t token, bool state) {
|
||||
RLOGD("SapImpl::powerReq");
|
||||
MsgHeader *msg = createMsgHeader(MsgId_RIL_SIM_SAP_POWER, token);
|
||||
if (msg == NULL) {
|
||||
RLOGE("SapImpl::powerReq: Error allocating memory for msg");
|
||||
sendFailedResponse(MsgId_RIL_SIM_SAP_POWER, token, 0);
|
||||
return Void();
|
||||
}
|
||||
|
||||
/***** Encode RIL_SIM_SAP_POWER_REQ *****/
|
||||
RIL_SIM_SAP_POWER_REQ req;
|
||||
memset(&req, 0, sizeof(RIL_SIM_SAP_POWER_REQ));
|
||||
req.state = state;
|
||||
|
||||
size_t encodedSize = 0;
|
||||
if (!pb_get_encoded_size(&encodedSize, RIL_SIM_SAP_POWER_REQ_fields, &req)) {
|
||||
RLOGE("SapImpl::powerReq: Error getting encoded size for RIL_SIM_SAP_POWER_REQ");
|
||||
sendFailedResponse(MsgId_RIL_SIM_SAP_POWER, token, 1, msg);
|
||||
return Void();
|
||||
}
|
||||
|
||||
uint8_t *buffer = (uint8_t *)calloc(1, encodedSize);
|
||||
if (buffer == NULL) {
|
||||
RLOGE("SapImpl::powerReq: Error allocating memory for buffer");
|
||||
sendFailedResponse(MsgId_RIL_SIM_SAP_POWER, token, 1, msg);
|
||||
return Void();
|
||||
}
|
||||
|
||||
pb_ostream_t stream = pb_ostream_from_buffer(buffer, encodedSize);
|
||||
|
||||
RLOGD("SapImpl::powerReq calling pb_encode");
|
||||
if (!pb_encode(&stream, RIL_SIM_SAP_POWER_REQ_fields, &req)) {
|
||||
RLOGE("SapImpl::powerReq: Error encoding RIL_SIM_SAP_POWER_REQ");
|
||||
sendFailedResponse(MsgId_RIL_SIM_SAP_POWER, token, 2, buffer, msg);
|
||||
return Void();
|
||||
}
|
||||
/***** Encode RIL_SIM_SAP_POWER_REQ done *****/
|
||||
|
||||
/* encoded req is payload */
|
||||
return addPayloadAndDispatchRequest(msg, stream.bytes_written, buffer);
|
||||
}
|
||||
|
||||
Return<void> SapImpl::resetSimReq(int32_t token) {
|
||||
RLOGD("SapImpl::resetSimReq");
|
||||
MsgHeader *msg = createMsgHeader(MsgId_RIL_SIM_SAP_RESET_SIM, token);
|
||||
if (msg == NULL) {
|
||||
RLOGE("SapImpl::resetSimReq: Error allocating memory for msg");
|
||||
sendFailedResponse(MsgId_RIL_SIM_SAP_RESET_SIM, token, 0);
|
||||
return Void();
|
||||
}
|
||||
|
||||
/***** Encode RIL_SIM_SAP_RESET_SIM_REQ *****/
|
||||
RIL_SIM_SAP_RESET_SIM_REQ req;
|
||||
memset(&req, 0, sizeof(RIL_SIM_SAP_RESET_SIM_REQ));
|
||||
|
||||
size_t encodedSize = 0;
|
||||
if (!pb_get_encoded_size(&encodedSize, RIL_SIM_SAP_RESET_SIM_REQ_fields, &req)) {
|
||||
RLOGE("SapImpl::resetSimReq: Error getting encoded size for RIL_SIM_SAP_RESET_SIM_REQ");
|
||||
sendFailedResponse(MsgId_RIL_SIM_SAP_RESET_SIM, token, 1, msg);
|
||||
return Void();
|
||||
}
|
||||
|
||||
uint8_t *buffer = (uint8_t *)calloc(1, encodedSize);
|
||||
if (buffer == NULL) {
|
||||
RLOGE("SapImpl::resetSimReq: Error allocating memory for buffer");
|
||||
sendFailedResponse(MsgId_RIL_SIM_SAP_RESET_SIM, token, 1, msg);
|
||||
return Void();
|
||||
}
|
||||
|
||||
pb_ostream_t stream = pb_ostream_from_buffer(buffer, encodedSize);
|
||||
|
||||
RLOGD("SapImpl::resetSimReq calling pb_encode");
|
||||
if (!pb_encode(&stream, RIL_SIM_SAP_RESET_SIM_REQ_fields, &req)) {
|
||||
RLOGE("SapImpl::resetSimReq: Error encoding RIL_SIM_SAP_RESET_SIM_REQ");
|
||||
sendFailedResponse(MsgId_RIL_SIM_SAP_RESET_SIM, token, 2, buffer, msg);
|
||||
return Void();
|
||||
}
|
||||
/***** Encode RIL_SIM_SAP_RESET_SIM_REQ done *****/
|
||||
|
||||
/* encoded req is payload */
|
||||
return addPayloadAndDispatchRequest(msg, stream.bytes_written, buffer);
|
||||
}
|
||||
|
||||
Return<void> SapImpl::transferCardReaderStatusReq(int32_t token) {
|
||||
RLOGD("SapImpl::transferCardReaderStatusReq");
|
||||
MsgHeader *msg = createMsgHeader(MsgId_RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS, token);
|
||||
if (msg == NULL) {
|
||||
RLOGE("SapImpl::transferCardReaderStatusReq: Error allocating memory for msg");
|
||||
sendFailedResponse(MsgId_RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS, token, 0);
|
||||
return Void();
|
||||
}
|
||||
|
||||
/***** Encode RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS_REQ *****/
|
||||
RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS_REQ req;
|
||||
memset(&req, 0, sizeof(RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS_REQ));
|
||||
|
||||
size_t encodedSize = 0;
|
||||
if (!pb_get_encoded_size(&encodedSize, RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS_REQ_fields,
|
||||
&req)) {
|
||||
RLOGE("SapImpl::transferCardReaderStatusReq: Error getting encoded size for "
|
||||
"RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS_REQ");
|
||||
sendFailedResponse(MsgId_RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS, token, 1, msg);
|
||||
return Void();
|
||||
}
|
||||
|
||||
uint8_t *buffer = (uint8_t *)calloc(1, encodedSize);
|
||||
if (buffer == NULL) {
|
||||
RLOGE("SapImpl::transferCardReaderStatusReq: Error allocating memory for buffer");
|
||||
sendFailedResponse(MsgId_RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS, token, 1, msg);
|
||||
return Void();
|
||||
}
|
||||
|
||||
pb_ostream_t stream = pb_ostream_from_buffer(buffer, encodedSize);
|
||||
|
||||
RLOGD("SapImpl::transferCardReaderStatusReq calling pb_encode");
|
||||
if (!pb_encode(&stream, RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS_REQ_fields, &req)) {
|
||||
RLOGE("SapImpl::transferCardReaderStatusReq: Error encoding "
|
||||
"RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS_REQ");
|
||||
sendFailedResponse(MsgId_RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS, token, 2, buffer, msg);
|
||||
return Void();
|
||||
}
|
||||
/***** Encode RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS_REQ done *****/
|
||||
|
||||
/* encoded req is payload */
|
||||
return addPayloadAndDispatchRequest(msg, stream.bytes_written, buffer);
|
||||
}
|
||||
|
||||
Return<void> SapImpl::setTransferProtocolReq(int32_t token, SapTransferProtocol transferProtocol) {
|
||||
RLOGD("SapImpl::setTransferProtocolReq");
|
||||
MsgHeader *msg = createMsgHeader(MsgId_RIL_SIM_SAP_SET_TRANSFER_PROTOCOL, token);
|
||||
if (msg == NULL) {
|
||||
RLOGE("SapImpl::setTransferProtocolReq: Error allocating memory for msg");
|
||||
sendFailedResponse(MsgId_RIL_SIM_SAP_SET_TRANSFER_PROTOCOL, token, 0);
|
||||
return Void();
|
||||
}
|
||||
|
||||
/***** Encode RIL_SIM_SAP_SET_TRANSFER_PROTOCOL_REQ *****/
|
||||
RIL_SIM_SAP_SET_TRANSFER_PROTOCOL_REQ req;
|
||||
memset(&req, 0, sizeof(RIL_SIM_SAP_SET_TRANSFER_PROTOCOL_REQ));
|
||||
req.protocol = (RIL_SIM_SAP_SET_TRANSFER_PROTOCOL_REQ_Protocol)transferProtocol;
|
||||
|
||||
size_t encodedSize = 0;
|
||||
if (!pb_get_encoded_size(&encodedSize, RIL_SIM_SAP_SET_TRANSFER_PROTOCOL_REQ_fields, &req)) {
|
||||
RLOGE("SapImpl::setTransferProtocolReq: Error getting encoded size for "
|
||||
"RIL_SIM_SAP_SET_TRANSFER_PROTOCOL_REQ");
|
||||
sendFailedResponse(MsgId_RIL_SIM_SAP_SET_TRANSFER_PROTOCOL, token, 1, msg);
|
||||
return Void();
|
||||
}
|
||||
|
||||
uint8_t *buffer = (uint8_t *)calloc(1, encodedSize);
|
||||
if (buffer == NULL) {
|
||||
RLOGE("SapImpl::setTransferProtocolReq: Error allocating memory for buffer");
|
||||
sendFailedResponse(MsgId_RIL_SIM_SAP_SET_TRANSFER_PROTOCOL, token, 1, msg);
|
||||
return Void();
|
||||
}
|
||||
|
||||
pb_ostream_t stream = pb_ostream_from_buffer(buffer, encodedSize);
|
||||
|
||||
RLOGD("SapImpl::setTransferProtocolReq calling pb_encode");
|
||||
if (!pb_encode(&stream, RIL_SIM_SAP_SET_TRANSFER_PROTOCOL_REQ_fields, &req)) {
|
||||
RLOGE("SapImpl::setTransferProtocolReq: Error encoding "
|
||||
"RIL_SIM_SAP_SET_TRANSFER_PROTOCOL_REQ");
|
||||
sendFailedResponse(MsgId_RIL_SIM_SAP_SET_TRANSFER_PROTOCOL, token, 2, buffer, msg);
|
||||
return Void();
|
||||
}
|
||||
/***** Encode RIL_SIM_SAP_SET_TRANSFER_PROTOCOL_REQ done *****/
|
||||
|
||||
/* encoded req is payload */
|
||||
return addPayloadAndDispatchRequest(msg, stream.bytes_written, buffer);
|
||||
}
|
||||
|
||||
void *sapDecodeMessage(MsgId msgId, MsgType msgType, uint8_t *payloadPtr, size_t payloadLen) {
|
||||
void *responsePtr = NULL;
|
||||
pb_istream_t stream;
|
||||
|
||||
/* Create the stream */
|
||||
stream = pb_istream_from_buffer((uint8_t *)payloadPtr, payloadLen);
|
||||
|
||||
/* Decode based on the message id */
|
||||
switch (msgId)
|
||||
{
|
||||
case MsgId_RIL_SIM_SAP_CONNECT:
|
||||
responsePtr = malloc(sizeof(RIL_SIM_SAP_CONNECT_RSP));
|
||||
if (responsePtr) {
|
||||
if (!pb_decode(&stream, RIL_SIM_SAP_CONNECT_RSP_fields, responsePtr)) {
|
||||
RLOGE("Error decoding RIL_SIM_SAP_CONNECT_RSP");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case MsgId_RIL_SIM_SAP_DISCONNECT:
|
||||
if (msgType == MsgType_RESPONSE) {
|
||||
responsePtr = malloc(sizeof(RIL_SIM_SAP_DISCONNECT_RSP));
|
||||
if (responsePtr) {
|
||||
if (!pb_decode(&stream, RIL_SIM_SAP_DISCONNECT_RSP_fields, responsePtr)) {
|
||||
RLOGE("Error decoding RIL_SIM_SAP_DISCONNECT_RSP");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
responsePtr = malloc(sizeof(RIL_SIM_SAP_DISCONNECT_IND));
|
||||
if (responsePtr) {
|
||||
if (!pb_decode(&stream, RIL_SIM_SAP_DISCONNECT_IND_fields, responsePtr)) {
|
||||
RLOGE("Error decoding RIL_SIM_SAP_DISCONNECT_IND");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case MsgId_RIL_SIM_SAP_APDU:
|
||||
responsePtr = malloc(sizeof(RIL_SIM_SAP_APDU_RSP));
|
||||
if (responsePtr) {
|
||||
if (!pb_decode(&stream, RIL_SIM_SAP_APDU_RSP_fields, responsePtr)) {
|
||||
RLOGE("Error decoding RIL_SIM_SAP_APDU_RSP");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case MsgId_RIL_SIM_SAP_TRANSFER_ATR:
|
||||
responsePtr = malloc(sizeof(RIL_SIM_SAP_TRANSFER_ATR_RSP));
|
||||
if (responsePtr) {
|
||||
if (!pb_decode(&stream, RIL_SIM_SAP_TRANSFER_ATR_RSP_fields, responsePtr)) {
|
||||
RLOGE("Error decoding RIL_SIM_SAP_TRANSFER_ATR_RSP");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case MsgId_RIL_SIM_SAP_POWER:
|
||||
responsePtr = malloc(sizeof(RIL_SIM_SAP_POWER_RSP));
|
||||
if (responsePtr) {
|
||||
if (!pb_decode(&stream, RIL_SIM_SAP_POWER_RSP_fields, responsePtr)) {
|
||||
RLOGE("Error decoding RIL_SIM_SAP_POWER_RSP");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case MsgId_RIL_SIM_SAP_RESET_SIM:
|
||||
responsePtr = malloc(sizeof(RIL_SIM_SAP_RESET_SIM_RSP));
|
||||
if (responsePtr) {
|
||||
if (!pb_decode(&stream, RIL_SIM_SAP_RESET_SIM_RSP_fields, responsePtr)) {
|
||||
RLOGE("Error decoding RIL_SIM_SAP_RESET_SIM_RSP");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case MsgId_RIL_SIM_SAP_STATUS:
|
||||
responsePtr = malloc(sizeof(RIL_SIM_SAP_STATUS_IND));
|
||||
if (responsePtr) {
|
||||
if (!pb_decode(&stream, RIL_SIM_SAP_STATUS_IND_fields, responsePtr)) {
|
||||
RLOGE("Error decoding RIL_SIM_SAP_STATUS_IND");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case MsgId_RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS:
|
||||
responsePtr = malloc(sizeof(RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS_RSP));
|
||||
if (responsePtr) {
|
||||
if (!pb_decode(&stream, RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS_RSP_fields,
|
||||
responsePtr)) {
|
||||
RLOGE("Error decoding RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS_RSP");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case MsgId_RIL_SIM_SAP_ERROR_RESP:
|
||||
responsePtr = malloc(sizeof(RIL_SIM_SAP_ERROR_RSP));
|
||||
if (responsePtr) {
|
||||
if (!pb_decode(&stream, RIL_SIM_SAP_ERROR_RSP_fields, responsePtr)) {
|
||||
RLOGE("Error decoding RIL_SIM_SAP_ERROR_RSP");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case MsgId_RIL_SIM_SAP_SET_TRANSFER_PROTOCOL:
|
||||
responsePtr = malloc(sizeof(RIL_SIM_SAP_SET_TRANSFER_PROTOCOL_RSP));
|
||||
if (responsePtr) {
|
||||
if (!pb_decode(&stream, RIL_SIM_SAP_SET_TRANSFER_PROTOCOL_RSP_fields,
|
||||
responsePtr)) {
|
||||
RLOGE("Error decoding RIL_SIM_SAP_SET_TRANSFER_PROTOCOL_RSP");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return responsePtr;
|
||||
} /* sapDecodeMessage */
|
||||
|
||||
sp<SapImpl> getSapImpl(RilSapSocket *sapSocket) {
|
||||
switch (sapSocket->getSocketId()) {
|
||||
case RIL_SOCKET_1:
|
||||
RLOGD("getSapImpl: returning sapService[0]");
|
||||
return sapService[0];
|
||||
#if (SIM_COUNT >= 2)
|
||||
case RIL_SOCKET_2:
|
||||
return sapService[1];
|
||||
#if (SIM_COUNT >= 3)
|
||||
case RIL_SOCKET_3:
|
||||
return sapService[2];
|
||||
#if (SIM_COUNT >= 4)
|
||||
case RIL_SOCKET_4:
|
||||
return sapService[3];
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
SapResultCode convertApduResponseProtoToHal(RIL_SIM_SAP_APDU_RSP_Response responseProto) {
|
||||
switch(responseProto) {
|
||||
case RIL_SIM_SAP_APDU_RSP_Response_RIL_E_SUCCESS:
|
||||
return SapResultCode::SUCCESS;
|
||||
case RIL_SIM_SAP_APDU_RSP_Response_RIL_E_GENERIC_FAILURE:
|
||||
return SapResultCode::GENERIC_FAILURE;
|
||||
case RIL_SIM_SAP_APDU_RSP_Response_RIL_E_SIM_NOT_READY:
|
||||
return SapResultCode::CARD_NOT_ACCESSSIBLE;
|
||||
case RIL_SIM_SAP_APDU_RSP_Response_RIL_E_SIM_ALREADY_POWERED_OFF:
|
||||
return SapResultCode::CARD_ALREADY_POWERED_OFF;
|
||||
case RIL_SIM_SAP_APDU_RSP_Response_RIL_E_SIM_ABSENT:
|
||||
return SapResultCode::CARD_REMOVED;
|
||||
default:
|
||||
return SapResultCode::GENERIC_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
SapResultCode convertTransferAtrResponseProtoToHal(
|
||||
RIL_SIM_SAP_TRANSFER_ATR_RSP_Response responseProto) {
|
||||
switch(responseProto) {
|
||||
case RIL_SIM_SAP_TRANSFER_ATR_RSP_Response_RIL_E_SUCCESS:
|
||||
return SapResultCode::SUCCESS;
|
||||
case RIL_SIM_SAP_TRANSFER_ATR_RSP_Response_RIL_E_GENERIC_FAILURE:
|
||||
return SapResultCode::GENERIC_FAILURE;
|
||||
case RIL_SIM_SAP_TRANSFER_ATR_RSP_Response_RIL_E_SIM_ALREADY_POWERED_OFF:
|
||||
return SapResultCode::CARD_ALREADY_POWERED_OFF;
|
||||
case RIL_SIM_SAP_TRANSFER_ATR_RSP_Response_RIL_E_SIM_ABSENT:
|
||||
return SapResultCode::CARD_REMOVED;
|
||||
case RIL_SIM_SAP_TRANSFER_ATR_RSP_Response_RIL_E_SIM_DATA_NOT_AVAILABLE:
|
||||
return SapResultCode::DATA_NOT_AVAILABLE;
|
||||
default:
|
||||
return SapResultCode::GENERIC_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
SapResultCode convertPowerResponseProtoToHal(RIL_SIM_SAP_POWER_RSP_Response responseProto) {
|
||||
switch(responseProto) {
|
||||
case RIL_SIM_SAP_POWER_RSP_Response_RIL_E_SUCCESS:
|
||||
return SapResultCode::SUCCESS;
|
||||
case RIL_SIM_SAP_POWER_RSP_Response_RIL_E_GENERIC_FAILURE:
|
||||
return SapResultCode::GENERIC_FAILURE;
|
||||
case RIL_SIM_SAP_POWER_RSP_Response_RIL_E_SIM_ABSENT:
|
||||
return SapResultCode::CARD_REMOVED;
|
||||
case RIL_SIM_SAP_POWER_RSP_Response_RIL_E_SIM_ALREADY_POWERED_OFF:
|
||||
return SapResultCode::CARD_ALREADY_POWERED_OFF;
|
||||
case RIL_SIM_SAP_POWER_RSP_Response_RIL_E_SIM_ALREADY_POWERED_ON:
|
||||
return SapResultCode::CARD_ALREADY_POWERED_ON;
|
||||
default:
|
||||
return SapResultCode::GENERIC_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
SapResultCode convertResetSimResponseProtoToHal(RIL_SIM_SAP_RESET_SIM_RSP_Response responseProto) {
|
||||
switch(responseProto) {
|
||||
case RIL_SIM_SAP_RESET_SIM_RSP_Response_RIL_E_SUCCESS:
|
||||
return SapResultCode::SUCCESS;
|
||||
case RIL_SIM_SAP_RESET_SIM_RSP_Response_RIL_E_GENERIC_FAILURE:
|
||||
return SapResultCode::GENERIC_FAILURE;
|
||||
case RIL_SIM_SAP_RESET_SIM_RSP_Response_RIL_E_SIM_ABSENT:
|
||||
return SapResultCode::CARD_REMOVED;
|
||||
case RIL_SIM_SAP_RESET_SIM_RSP_Response_RIL_E_SIM_NOT_READY:
|
||||
return SapResultCode::CARD_NOT_ACCESSSIBLE;
|
||||
case RIL_SIM_SAP_RESET_SIM_RSP_Response_RIL_E_SIM_ALREADY_POWERED_OFF:
|
||||
return SapResultCode::CARD_ALREADY_POWERED_OFF;
|
||||
}
|
||||
return SapResultCode::GENERIC_FAILURE;
|
||||
}
|
||||
|
||||
SapResultCode convertTransferCardReaderStatusResponseProtoToHal(
|
||||
RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS_RSP_Response responseProto) {
|
||||
switch(responseProto) {
|
||||
case RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS_RSP_Response_RIL_E_SUCCESS:
|
||||
return SapResultCode::SUCCESS;
|
||||
case RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS_RSP_Response_RIL_E_GENERIC_FAILURE:
|
||||
return SapResultCode::GENERIC_FAILURE;
|
||||
case RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS_RSP_Response_RIL_E_SIM_DATA_NOT_AVAILABLE:
|
||||
return SapResultCode::DATA_NOT_AVAILABLE;
|
||||
}
|
||||
return SapResultCode::GENERIC_FAILURE;
|
||||
}
|
||||
|
||||
void processResponse(MsgHeader *rsp, RilSapSocket *sapSocket, MsgType msgType) {
|
||||
MsgId msgId = rsp->id;
|
||||
uint8_t *data = rsp->payload->bytes;
|
||||
size_t dataLen = rsp->payload->size;
|
||||
|
||||
void *messagePtr = sapDecodeMessage(msgId, msgType, data, dataLen);
|
||||
|
||||
sp<SapImpl> sapImpl = getSapImpl(sapSocket);
|
||||
if (sapImpl->sapCallback == NULL) {
|
||||
RLOGE("processResponse: sapCallback == NULL; msgId = %d; msgType = %d",
|
||||
msgId, msgType);
|
||||
return;
|
||||
}
|
||||
|
||||
if (messagePtr == NULL) {
|
||||
RLOGE("processResponse: *messagePtr == NULL; msgId = %d; msgType = %d",
|
||||
msgId, msgType);
|
||||
sapImpl->sendFailedResponse(msgId, rsp->token, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
RLOGD("processResponse: sapCallback != NULL; msgId = %d; msgType = %d",
|
||||
msgId, msgType);
|
||||
|
||||
Return<void> retStatus;
|
||||
switch (msgId) {
|
||||
case MsgId_RIL_SIM_SAP_CONNECT: {
|
||||
RIL_SIM_SAP_CONNECT_RSP *connectRsp = (RIL_SIM_SAP_CONNECT_RSP *)messagePtr;
|
||||
RLOGD("processResponse: calling sapCallback->connectResponse %d %d %d",
|
||||
rsp->token,
|
||||
connectRsp->response,
|
||||
connectRsp->max_message_size);
|
||||
retStatus = sapImpl->sapCallback->connectResponse(rsp->token,
|
||||
(SapConnectRsp)connectRsp->response,
|
||||
connectRsp->max_message_size);
|
||||
break;
|
||||
}
|
||||
|
||||
case MsgId_RIL_SIM_SAP_DISCONNECT:
|
||||
if (msgType == MsgType_RESPONSE) {
|
||||
RLOGD("processResponse: calling sapCallback->disconnectResponse %d", rsp->token);
|
||||
retStatus = sapImpl->sapCallback->disconnectResponse(rsp->token);
|
||||
} else {
|
||||
RIL_SIM_SAP_DISCONNECT_IND *disconnectInd =
|
||||
(RIL_SIM_SAP_DISCONNECT_IND *)messagePtr;
|
||||
RLOGD("processResponse: calling sapCallback->disconnectIndication %d %d",
|
||||
rsp->token, disconnectInd->disconnectType);
|
||||
retStatus = sapImpl->sapCallback->disconnectIndication(rsp->token,
|
||||
(SapDisconnectType)disconnectInd->disconnectType);
|
||||
}
|
||||
break;
|
||||
|
||||
case MsgId_RIL_SIM_SAP_APDU: {
|
||||
RIL_SIM_SAP_APDU_RSP *apduRsp = (RIL_SIM_SAP_APDU_RSP *)messagePtr;
|
||||
SapResultCode apduResponse = convertApduResponseProtoToHal(apduRsp->response);
|
||||
RLOGD("processResponse: calling sapCallback->apduResponse %d %d",
|
||||
rsp->token, apduResponse);
|
||||
hidl_vec<uint8_t> apduRspVec;
|
||||
if (apduRsp->apduResponse != NULL && apduRsp->apduResponse->size > 0) {
|
||||
apduRspVec.setToExternal(apduRsp->apduResponse->bytes, apduRsp->apduResponse->size);
|
||||
}
|
||||
retStatus = sapImpl->sapCallback->apduResponse(rsp->token, apduResponse, apduRspVec);
|
||||
break;
|
||||
}
|
||||
|
||||
case MsgId_RIL_SIM_SAP_TRANSFER_ATR: {
|
||||
RIL_SIM_SAP_TRANSFER_ATR_RSP *transferAtrRsp =
|
||||
(RIL_SIM_SAP_TRANSFER_ATR_RSP *)messagePtr;
|
||||
SapResultCode transferAtrResponse =
|
||||
convertTransferAtrResponseProtoToHal(transferAtrRsp->response);
|
||||
RLOGD("processResponse: calling sapCallback->transferAtrResponse %d %d",
|
||||
rsp->token, transferAtrResponse);
|
||||
hidl_vec<uint8_t> transferAtrRspVec;
|
||||
if (transferAtrRsp->atr != NULL && transferAtrRsp->atr->size > 0) {
|
||||
transferAtrRspVec.setToExternal(transferAtrRsp->atr->bytes,
|
||||
transferAtrRsp->atr->size);
|
||||
}
|
||||
retStatus = sapImpl->sapCallback->transferAtrResponse(rsp->token, transferAtrResponse,
|
||||
transferAtrRspVec);
|
||||
break;
|
||||
}
|
||||
|
||||
case MsgId_RIL_SIM_SAP_POWER: {
|
||||
SapResultCode powerResponse = convertPowerResponseProtoToHal(
|
||||
((RIL_SIM_SAP_POWER_RSP *)messagePtr)->response);
|
||||
RLOGD("processResponse: calling sapCallback->powerResponse %d %d",
|
||||
rsp->token, powerResponse);
|
||||
retStatus = sapImpl->sapCallback->powerResponse(rsp->token, powerResponse);
|
||||
break;
|
||||
}
|
||||
|
||||
case MsgId_RIL_SIM_SAP_RESET_SIM: {
|
||||
SapResultCode resetSimResponse = convertResetSimResponseProtoToHal(
|
||||
((RIL_SIM_SAP_RESET_SIM_RSP *)messagePtr)->response);
|
||||
RLOGD("processResponse: calling sapCallback->resetSimResponse %d %d",
|
||||
rsp->token, resetSimResponse);
|
||||
retStatus = sapImpl->sapCallback->resetSimResponse(rsp->token, resetSimResponse);
|
||||
break;
|
||||
}
|
||||
|
||||
case MsgId_RIL_SIM_SAP_STATUS: {
|
||||
RIL_SIM_SAP_STATUS_IND *statusInd = (RIL_SIM_SAP_STATUS_IND *)messagePtr;
|
||||
RLOGD("processResponse: calling sapCallback->statusIndication %d %d",
|
||||
rsp->token, statusInd->statusChange);
|
||||
retStatus = sapImpl->sapCallback->statusIndication(rsp->token,
|
||||
(SapStatus)statusInd->statusChange);
|
||||
break;
|
||||
}
|
||||
|
||||
case MsgId_RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS: {
|
||||
RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS_RSP *transferStatusRsp =
|
||||
(RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS_RSP *)messagePtr;
|
||||
SapResultCode transferCardReaderStatusResponse =
|
||||
convertTransferCardReaderStatusResponseProtoToHal(
|
||||
transferStatusRsp->response);
|
||||
RLOGD("processResponse: calling sapCallback->transferCardReaderStatusResponse %d %d %d",
|
||||
rsp->token,
|
||||
transferCardReaderStatusResponse,
|
||||
transferStatusRsp->CardReaderStatus);
|
||||
retStatus = sapImpl->sapCallback->transferCardReaderStatusResponse(rsp->token,
|
||||
transferCardReaderStatusResponse,
|
||||
transferStatusRsp->CardReaderStatus);
|
||||
break;
|
||||
}
|
||||
|
||||
case MsgId_RIL_SIM_SAP_ERROR_RESP: {
|
||||
RLOGD("processResponse: calling sapCallback->errorResponse %d", rsp->token);
|
||||
retStatus = sapImpl->sapCallback->errorResponse(rsp->token);
|
||||
break;
|
||||
}
|
||||
|
||||
case MsgId_RIL_SIM_SAP_SET_TRANSFER_PROTOCOL: {
|
||||
SapResultCode setTransferProtocolResponse;
|
||||
if (((RIL_SIM_SAP_SET_TRANSFER_PROTOCOL_RSP *)messagePtr)->response ==
|
||||
RIL_SIM_SAP_SET_TRANSFER_PROTOCOL_RSP_Response_RIL_E_SUCCESS) {
|
||||
setTransferProtocolResponse = SapResultCode::SUCCESS;
|
||||
} else {
|
||||
setTransferProtocolResponse = SapResultCode::NOT_SUPPORTED;
|
||||
}
|
||||
RLOGD("processResponse: calling sapCallback->transferProtocolResponse %d %d",
|
||||
rsp->token, setTransferProtocolResponse);
|
||||
retStatus = sapImpl->sapCallback->transferProtocolResponse(rsp->token,
|
||||
setTransferProtocolResponse);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
return;
|
||||
}
|
||||
sapImpl->checkReturnStatus(retStatus);
|
||||
}
|
||||
|
||||
void sap::processResponse(MsgHeader *rsp, RilSapSocket *sapSocket) {
|
||||
processResponse(rsp, sapSocket, MsgType_RESPONSE);
|
||||
}
|
||||
|
||||
void sap::processUnsolResponse(MsgHeader *rsp, RilSapSocket *sapSocket) {
|
||||
processResponse(rsp, sapSocket, MsgType_UNSOL_RESPONSE);
|
||||
}
|
||||
|
||||
void sap::registerService(const RIL_RadioFunctions *callbacks) {
|
||||
using namespace android::hardware;
|
||||
int simCount = 1;
|
||||
const char *serviceNames[] = {
|
||||
android::RIL_getServiceName()
|
||||
#if (SIM_COUNT >= 2)
|
||||
, RIL2_SERVICE_NAME
|
||||
#if (SIM_COUNT >= 3)
|
||||
, RIL3_SERVICE_NAME
|
||||
#if (SIM_COUNT >= 4)
|
||||
, RIL4_SERVICE_NAME
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
};
|
||||
|
||||
RIL_SOCKET_ID socketIds[] = {
|
||||
RIL_SOCKET_1
|
||||
#if (SIM_COUNT >= 2)
|
||||
, RIL_SOCKET_2
|
||||
#if (SIM_COUNT >= 3)
|
||||
, RIL_SOCKET_3
|
||||
#if (SIM_COUNT >= 4)
|
||||
, RIL_SOCKET_4
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
};
|
||||
#if (SIM_COUNT >= 2)
|
||||
simCount = SIM_COUNT;
|
||||
#endif
|
||||
|
||||
for (int i = 0; i < simCount; i++) {
|
||||
sapService[i] = new SapImpl;
|
||||
sapService[i]->slotId = i;
|
||||
sapService[i]->rilSocketId = socketIds[i];
|
||||
RLOGD("registerService: starting ISap %s for slotId %d", serviceNames[i], i);
|
||||
android::status_t status = sapService[i]->registerAsService(serviceNames[i]);
|
||||
RLOGD("registerService: started ISap %s status %d", serviceNames[i], status);
|
||||
}
|
||||
}
|
@ -1,33 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2016 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef SAP_SERVICE_H
|
||||
#define SAP_SERVICE_H
|
||||
|
||||
#include <telephony/ril.h>
|
||||
#include <ril_internal.h>
|
||||
#include <RilSapSocket.h>
|
||||
#include <hardware/ril/librilutils/proto/sap-api.pb.h>
|
||||
|
||||
namespace sap {
|
||||
|
||||
void registerService(const RIL_RadioFunctions *callbacks);
|
||||
void processResponse(MsgHeader *rsp, RilSapSocket *sapSocket);
|
||||
void processUnsolResponse(MsgHeader *rsp, RilSapSocket *sapSocket);
|
||||
|
||||
} // namespace android
|
||||
|
||||
#endif // RIL_SERVICE_H
|
3
sepolicy/common/charger_vendor.te
Normal file
3
sepolicy/common/charger_vendor.te
Normal file
@ -0,0 +1,3 @@
|
||||
allow charger_vendor device:dir r_file_perms;
|
||||
allow charger_vendor sysfs_battery:file r_file_perms;
|
||||
allow charger_vendor sysfs_battery_writable:file r_file_perms;
|
@ -3,7 +3,10 @@ type alarm_device, dev_type, mlstrustedobject;
|
||||
type proc_bt_sleep, fs_type, proc_type;
|
||||
type proc_last_kmsg, fs_type, proc_type;
|
||||
|
||||
type sysfs_battery, sysfs_type, fs_type;
|
||||
type sysfs_battery_writable, sysfs_type, fs_type;
|
||||
type sysfs_camera, fs_type, sysfs_type;
|
||||
type sysfs_hal_health_service, sysfs_type, fs_type;
|
||||
type sysfs_hal_pwr, fs_type, sysfs_type;
|
||||
type sysfs_iio, fs_type, sysfs_type;
|
||||
type sysfs_input, fs_type, sysfs_type;
|
||||
@ -22,5 +25,6 @@ type sysfs_usb_otg, fs_type, sysfs_type;
|
||||
type sysfs_wifi_writeable, fs_type, sysfs_type;
|
||||
|
||||
type bt_fw_file, file_type;
|
||||
type netlink_kobject_uevent_socket, file_type;
|
||||
type nfc_fw_file, file_type;
|
||||
type wifi_efs_file, file_type;
|
||||
|
@ -23,9 +23,12 @@
|
||||
|
||||
# executeables
|
||||
/system/vendor/bin/macloader u:object_r:macloader_exec:s0
|
||||
/(vendor|system/vendor)/bin/hw/android\.hardware\.audio\.service\.samsung8974 u:object_r:hal_audio_default_exec:s0
|
||||
/(vendor|system/vendor)/bin/hw/android\.hardware\.gatekeeper@1\.0-service\.software u:object_r:hal_gatekeeper_default_exec:s0
|
||||
/(vendor|system/vendor)/bin/hw/android\.hardware\.ir@1\.0-service\.samsung u:object_r:hal_ir_default_exec:s0
|
||||
/(vendor|system/vendor)/bin/hw/android\.hardware\.health-service\.samsung u:object_r:hal_health_default_exec:s0
|
||||
/(vendor|system/vendor)/bin/hw/android\.hardware\.light@2\.0-service\.samsung u:object_r:hal_light_default_exec:s0
|
||||
/(vendor|system/vendor)/bin/hw/android\.hardware\.power\.stats@1\.0-service\.mock u:object_r:hal_power_stats_default_exec:s0
|
||||
/(vendor|system/vendor)/bin/hw/android\.hardware\.sensors@1\.0-service.samsung8974 u:object_r:hal_sensors_default_exec:s0
|
||||
/(vendor|system/vendor)/bin/hw/vendor\.lineage\.livedisplay@2\.0-service\.samsung-qcom u:object_r:hal_lineage_livedisplay_sysfs_exec:s0
|
||||
/(vendor|system/vendor)/bin/hw/vendor\.lineage\.touch@1\.0-service\.samsung u:object_r:hal_lineage_touch_default_exec:s0
|
||||
|
2
sepolicy/common/hal_audio_default.te
Normal file
2
sepolicy/common/hal_audio_default.te
Normal file
@ -0,0 +1,2 @@
|
||||
get_prop(hal_audio_default, audio_prop)
|
||||
allow hal_audio_default default_android_vndservice:service_manager { find };
|
@ -1 +1,4 @@
|
||||
allow hal_power_default sysfs_hal_pwr:file w_file_perms;
|
||||
allow hal_power_stats_default sysfs_iio:dir { search open r_dir_perms };
|
||||
allow hal_power_stats_default sysfs_iio:lnk_file r_file_perms;
|
||||
allow hal_power_stats_default sysfs_iio:file r_file_perms;
|
||||
|
@ -1,2 +1,10 @@
|
||||
binder_call(init, servicemanager)
|
||||
binder_call(init, system_server)
|
||||
|
||||
allow init init:capability2 { block_suspend };
|
||||
allow init efs_file:dir mounton;
|
||||
allow init hal_health_service:service_manager { add };
|
||||
allow init proc_last_kmsg:file { r_file_perms setattr };
|
||||
allow init init:netlink_kobject_uevent_socket { create setopt getopt bind read };
|
||||
allow init sysfs:file w_file_perms;
|
||||
allow init sysfs_batteryinfo:file { open };
|
1
sepolicy/common/surfaceflinger.te
Normal file
1
sepolicy/common/surfaceflinger.te
Normal file
@ -0,0 +1 @@
|
||||
get_prop(surfaceflinger, vendor_default_prop)
|
@ -9,6 +9,7 @@ allow system_server {
|
||||
}:file r_file_perms;
|
||||
|
||||
allow system_server proc_last_kmsg:file r_file_perms;
|
||||
allow system_server system_file:file { ioctl };
|
||||
|
||||
get_prop(system_server, exported_camera_prop);
|
||||
get_prop(system_server, userspace_reboot_config_prop);
|
||||
|
@ -1 +1,2 @@
|
||||
get_prop(ueventd, proc)
|
||||
allow ueventd self:capability sys_nice;
|
||||
|
@ -11,7 +11,6 @@ allow vold {
|
||||
system_block_device
|
||||
}:blk_file getattr;
|
||||
|
||||
allowxperm vold vold_device:blk_file ioctl 0x1271;
|
||||
allowxperm vold vold_device:blk_file ioctl BLKROGET;
|
||||
allowxperm vold vold_device:blk_file ioctl { BLKDISCARD BLKGETSIZE };
|
||||
|
||||
dontaudit vold hal_bootctl_hwservice:hwservice_manager find;
|
||||
|
1
sepolicy/private/blkid.te
Normal file
1
sepolicy/private/blkid.te
Normal file
@ -0,0 +1 @@
|
||||
allow vold blkid_exec:file rx_file_perms;
|
28
system.prop
28
system.prop
@ -1,7 +1,9 @@
|
||||
## Adoptable Storage
|
||||
ro.crypto.volume.options=aes-256-xts
|
||||
|
||||
# Audio
|
||||
audio.offload.buffer.size.kb=32
|
||||
audio.offload.gapless.enabled=false
|
||||
av.offload.enable=true
|
||||
|
||||
# Bluetooth
|
||||
bluetooth.enable_timeout_ms=12000
|
||||
@ -13,33 +15,19 @@ ro.fastbootd.available=true
|
||||
ro.opengles.version=196608
|
||||
|
||||
# Display
|
||||
ro.hdcp2.rx=tz
|
||||
ro.qualcomm.cabl=1
|
||||
ro.secwvk=144
|
||||
debug.hwui.use_buffer_age=false
|
||||
debug.sf.disable_backpressure=1
|
||||
debug.sf.disable_client_composition_cache=1
|
||||
debug.sf.predict_hwc_composition_strategy=0
|
||||
debug.sf.enable_transaction_tracing=false
|
||||
debug.sf.latch_unsignaled=1
|
||||
|
||||
# Graphics
|
||||
debug.renderengine.backend=threaded
|
||||
|
||||
# Memory optimizations
|
||||
ro.vendor.qti.sys.fw.bservice_enable=true
|
||||
|
||||
# RIL
|
||||
persist.rild.nitz_plmn=""
|
||||
persist.rild.nitz_long_ons_0=""
|
||||
persist.rild.nitz_long_ons_1=""
|
||||
persist.rild.nitz_long_ons_2=""
|
||||
persist.rild.nitz_long_ons_3=""
|
||||
persist.rild.nitz_short_ons_0=""
|
||||
persist.rild.nitz_short_ons_1=""
|
||||
persist.rild.nitz_short_ons_2=""
|
||||
persist.rild.nitz_short_ons_3=""
|
||||
|
||||
# System
|
||||
persist.sys.binary_xml=false
|
||||
ro.vndk.version=current
|
||||
|
||||
# Time
|
||||
persist.timed.enable=true
|
||||
# Zygote
|
||||
zygote.critical_window.minute=10
|
||||
|
Loading…
Reference in New Issue
Block a user