3
0
Fork 0

galaxys2: initial L bringup

Change-Id: Ia356da8437917be3355eba59c1df3943bb33f905
This commit is contained in:
Caio Schnepper 2015-05-01 23:55:43 -03:00
parent e3591e7a64
commit ecc3d13410
35 changed files with 2566 additions and 271 deletions

View File

@ -18,7 +18,9 @@
# This variable is set first, so it can be overridden
# by BoardConfigVendor.mk
BOARD_USES_GENERIC_AUDIO := false
BOARD_USE_SAMSUNG_COLORFORMAT := true
USE_SAMSUNG_COLORFORMAT := true
BOARD_USES_LEGACY_MMAP := true
TARGET_CPU_ABI := armeabi-v7a
TARGET_CPU_ABI2 := armeabi
TARGET_CPU_SMP := true
@ -56,6 +58,9 @@ BOARD_KERNEL_PAGESIZE := 4096
BOARD_KERNEL_BASE := 0x40000000
BOARD_KERNEL_CMDLINE := console=ttySAC2,115200 consoleblank=0
# Include an expanded selection of fonts
EXTENDED_FONT_FOOTPRINT := true
# Filesystem
TARGET_USERIMAGES_USE_EXT4 := true
BOARD_BOOTIMAGE_PARTITION_SIZE := 8388608
@ -72,6 +77,9 @@ BOARD_HARDWARE_CLASS := hardware/samsung/cmhw
# Graphics
BOARD_EGL_CFG := device/samsung/galaxys2-common/configs/egl.cfg
BOARD_EGL_NEEDS_FNW := true
BOARD_EGL_SKIP_FIRST_DEQUEUE := true
BOARD_EGL_SYSTEMUI_PBSIZE_HACK := true
USE_OPENGL_RENDERER := true
COMMON_GLOBAL_CFLAGS += -DFORCE_SCREENSHOT_CPU_PATH -DWORKAROUND_BUG_10194508
@ -92,6 +100,8 @@ BOARD_NONBLOCK_MODE_PROCESS := true
BOARD_USE_STOREMETADATA := true
BOARD_USE_METADATABUFFERTYPE := true
BOARD_USES_MFC_FPS := true
BOARD_USE_S3D_SUPPORT := true
BOARD_USE_CSC_FIMC := false
# Audio
BOARD_USE_TINYALSA_AUDIO := true
@ -100,6 +110,7 @@ BOARD_USE_YAMAHA_MC1N2_AUDIO := true
# RIL
BOARD_PROVIDES_LIBRIL := true
BOARD_MODEM_TYPE := xmm6260
BOARD_RIL_CLASS := ../../../device/samsung/galaxys2-common/ril
# Camera
BOARD_USES_PROPRIETARY_LIBFIMC := true
@ -129,6 +140,7 @@ BOARD_HAVE_SAMSUNG_WIFI := true
# Bluetooth
BOARD_HAVE_BLUETOOTH := true
BOARD_HAVE_BLUETOOTH_BCM := true
BOARD_HAVE_SAMSUNG_BLUETOOTH := true
BOARD_BLUEDROID_VENDOR_CONF := device/samsung/galaxys2-common/bluetooth/vnd_smdk4210.txt
# Vold
@ -142,13 +154,19 @@ BOARD_SEPOLICY_DIRS += \
device/samsung/galaxys2-common/selinux
BOARD_SEPOLICY_UNION += \
bluetooth.te \
device.te \
drmserver.te \
ueventd.te \
domain.te \
drmserver.te \
dumpstate.te \
file.te \
file_contexts \
init.te \
mediaserver.te \
rild.te \
system_app.te \
system_server.te \
ueventd.te \
vold.te
# Recovery
@ -169,8 +187,8 @@ TARGET_SPECIFIC_HEADER_PATH := device/samsung/galaxys2-common/include
# Charging mode
BOARD_CHARGING_MODE_BOOTING_LPM := /sys/class/power_supply/battery/batt_lp_charging
BOARD_BATTERY_DEVICE_NAME := "battery"
BOARD_CHARGER_RES := device/samsung/galaxys2-common/res/charger
BOARD_CHARGER_ENABLE_SUSPEND := true
BOARD_CHARGER_SHOW_PERCENTAGE := true
BOARD_CUSTOM_BOOTIMG_MK := device/samsung/galaxys2-common/shbootimg.mk
# Override healthd HAL

View File

@ -26,6 +26,7 @@ LOCAL_SRC_FILES := \
exynos_v4l2.c
LOCAL_C_INCLUDES := \
system/media/camera/include \
hardware/samsung/exynos4/hal/include
LOCAL_SHARED_LIBRARIES := libutils libcutils liblog libcamera_client libhardware libs5pjpeg

View File

@ -80,8 +80,8 @@ struct exynos_camera_preset exynos_camera_presets_galaxys2[] = {
.video_snapshot_supported = 0,
.full_video_snap_supported = 0,
.recording_size = "720x480",
.recording_size_values = "1920x1080,1280x720,720x480,640x480",
.recording_size = "1280x720",
.recording_size_values = "1920x1080,1280x720,640x480",
.recording_format = "yuv420sp",
.focus_mode = "auto",

View File

@ -372,7 +372,7 @@ bv_ioctl:
}
int exynos_exif_write_data(void *exif_data, unsigned short tag,
unsigned short type, unsigned int count, int *offset, void *start,
unsigned short type, unsigned int count, unsigned int *offset, void *start,
void *data, int length)
{
unsigned char *pointer;
@ -421,12 +421,12 @@ int exynos_exif_create(struct exynos_camera *exynos_camera,
unsigned char user_comment_code[] = { 0x41, 0x53, 0x43, 0x49, 0x49, 0x0, 0x0, 0x0 };
unsigned char exif_ascii_prefix[] = { 0x41, 0x53, 0x43, 0x49, 0x49, 0x0, 0x0, 0x0 };
camera_memory_t *exif_data_memory;
camera_memory_t *exif_data_memory = NULL;
void *exif_data;
int exif_data_size;
int exif_size;
void *exif_ifd_data_start, *exif_ifd_start, *exif_ifd_gps, *exif_ifd_thumb;
void *exif_ifd_data_start, *exif_ifd_start, *exif_ifd_thumb, *exif_ifd_gps = NULL;
void *exif_thumb_data;
unsigned int exif_thumb_size;
@ -644,7 +644,7 @@ int exynos_exif_create(struct exynos_camera *exynos_camera,
count = exynos_exif_write_data(pointer, EXIF_TAG_GPS_IFD_POINTER,
EXIF_TYPE_LONG, 1, NULL, NULL, &offset, sizeof(offset));
pointer = exif_ifd_start + offset;
pointer = (unsigned char *) exif_ifd_start + offset;
if (exif_attributes->gps_processing_method[0] == 0)
value = NUM_0TH_IFD_GPS - 1;

View File

@ -20,7 +20,6 @@ DEVICE_PACKAGE_OVERLAYS := $(COMMON_PATH)/overlay
# Rootdir
PRODUCT_COPY_FILES := \
$(COMMON_PATH)/rootdir/fstab.smdk4210:root/fstab.smdk4210 \
$(COMMON_PATH)/rootdir/lpm.rc:root/lpm.rc \
$(COMMON_PATH)/rootdir/init.smdk4210.usb.rc:root/init.smdk4210.usb.rc \
$(COMMON_PATH)/rootdir/init.smdk4210.rc:root/init.smdk4210.rc \
$(COMMON_PATH)/rootdir/ueventd.smdk4210.rc:root/ueventd.smdk4210.rc
@ -45,7 +44,8 @@ PRODUCT_COPY_FILES += \
PRODUCT_PROPERTY_OVERRIDES += \
wifi.interface=wlan0 \
wifi.supplicant_scan_interval=15
wifi.supplicant_scan_interval=15 \
net.tethering.noprovisioning=true
$(call inherit-product-if-exists, hardware/broadcom/wlan/bcmdhd/firmware/bcm4330/device-bcm.mk)
@ -102,16 +102,17 @@ PRODUCT_PACKAGES += \
libOMX.SEC.AVC.Decoder \
libOMX.SEC.M4V.Decoder \
libOMX.SEC.WMV.Decoder \
libOMX.SEC.VP8.Decoder \
libSEC_OMX_Venc \
libOMX.SEC.AVC.Encoder \
libOMX.SEC.M4V.Encoder \
libSEC_OMX_Adec \
libOMX.SEC.MP3.Decoder
libSEC_OMX_Venc \
libOMX.SEC.M4V.Encoder
PRODUCT_COPY_FILES += \
$(COMMON_PATH)/configs/media_codecs.xml:system/etc/media_codecs.xml \
$(COMMON_PATH)/configs/media_profiles.xml:system/etc/media_profiles.xml
$(COMMON_PATH)/configs/media_profiles.xml:system/etc/media_profiles.xml \
frameworks/av/media/libstagefright/data/media_codecs_google_audio.xml:system/etc/media_codecs_google_audio.xml \
frameworks/av/media/libstagefright/data/media_codecs_google_telephony.xml:system/etc/media_codecs_google_telephony.xml \
frameworks/av/media/libstagefright/data/media_codecs_google_video.xml:system/etc/media_codecs_google_video.xml \
frameworks/av/media/libstagefright/data/media_codecs_ffmpeg.xml:system/etc/media_codecs_ffmpeg.xml
# Graphics
PRODUCT_PROPERTY_OVERRIDES += \
@ -123,7 +124,7 @@ PRODUCT_PROPERTY_OVERRIDES += \
# RIL
PRODUCT_PROPERTY_OVERRIDES += \
ro.telephony.ril_class=SamsungExynos4RIL \
mobiledata.interfaces=pdp0,wlan0,gprs,ppp0 \
mobiledata.interfaces=pdp0,gprs,ppp0,rmnet0,rmnet1 \
ro.telephony.call_ring.multiple=false \
ro.telephony.call_ring.delay=3000
@ -145,6 +146,15 @@ PRODUCT_PACKAGES += \
VisualizationWallpapers \
librs_jni
# Wifi
PRODUCT_PACKAGES += \
dhcpcd.conf \
hostapd \
libwpa_client \
macloader \
wpa_supplicant \
wpa_supplicant.conf
# These are the hardware-specific features
PRODUCT_COPY_FILES += \
frameworks/native/data/etc/android.hardware.audio.low_latency.xml:system/etc/permissions/android.hardware.audio.low_latency.xml \
@ -182,6 +192,9 @@ PRODUCT_TAGS += dalvik.gc.type-precise
PRODUCT_DEFAULT_PROPERTY_OVERRIDES += \
persist.sys.usb.config=mtp
PRODUCT_PROPERTY_OVERRIDES += \
persist.sys.isUsbOtgEnabled=true
$(call inherit-product, frameworks/native/build/phone-hdpi-512-dalvik-heap.mk)
# Include exynos4 platform specific parts

View File

@ -1,6 +1,6 @@
#!/system/bin/sh
if [ -f /data/data/com.netflix.mediaclient/shared_prefs/nfxpref.xml ]; then
grep -q nflx_player_type.*6 /data/data/com.netflix.mediaclient/shared_prefs/nfxpref.xml && exit 0
cp /data/data/com.netflix.mediaclient/shared_prefs/nfxpref.xml /data/data/com.netflix.mediaclient/shared_prefs/nfxpref.xml.orig && sed -e 's|<int name="nflx_player_type".*||g; s|</map>|<int name="nflx_player_type" value="6" />\n</map>|g' /data/data/com.netflix.mediaclient/shared_prefs/nfxpref.xml.orig > /data/data/com.netflix.mediaclient/shared_prefs/nfxpref.xml && rm /data/data/com.netflix.mediaclient/shared_prefs/nfxpref.xml.orig
grep -q nflx_player_type.*10 /data/data/com.netflix.mediaclient/shared_prefs/nfxpref.xml && exit 0
cp /data/data/com.netflix.mediaclient/shared_prefs/nfxpref.xml /data/data/com.netflix.mediaclient/shared_prefs/nfxpref.xml.orig && sed -e 's|<int name="nflx_player_type".*||g; s|</map>|<int name="nflx_player_type" value="10" />\n</map>|g' /data/data/com.netflix.mediaclient/shared_prefs/nfxpref.xml.orig > /data/data/com.netflix.mediaclient/shared_prefs/nfxpref.xml && rm /data/data/com.netflix.mediaclient/shared_prefs/nfxpref.xml.orig
fi

View File

@ -76,55 +76,20 @@ Only the three quirks included above are recognized at this point:
-->
<MediaCodecs>
<Include href="media_codecs_google_audio.xml" />
<Include href="media_codecs_google_telephony.xml" />
<Decoders>
<MediaCodec name="OMX.SEC.AVC.Decoder" type="video/avc" />
<MediaCodec name="OMX.SEC.MPEG4.Decoder" type="video/mp4v-es" />
<MediaCodec name="OMX.SEC.H263.Decoder" type="video/3gpp" />
<MediaCodec name="OMX.SEC.AVC.Decoder" type="video/avc" />
<MediaCodec name="OMX.google.mp3.decoder" type="audio/mpeg" />
<MediaCodec name="OMX.google.amrnb.decoder" type="audio/3gpp" />
<MediaCodec name="OMX.google.amrwb.decoder" type="audio/amr-wb" />
<MediaCodec name="OMX.google.aac.decoder" type="audio/mp4a-latm" />
<MediaCodec name="OMX.google.g711.alaw.decoder" type="audio/g711-alaw" />
<MediaCodec name="OMX.google.g711.mlaw.decoder" type="audio/g711-mlaw" />
<MediaCodec name="OMX.google.vorbis.decoder" type="audio/vorbis" />
<MediaCodec name="OMX.google.mpeg4.decoder" type="video/mp4v-es" />
<MediaCodec name="OMX.google.h263.decoder" type="video/3gpp" />
<MediaCodec name="OMX.google.h264.decoder" type="video/avc" />
<MediaCodec name="OMX.google.vp8.decoder" type="video/x-vnd.on2.vp8" />
<MediaCodec name="OMX.google.vp9.decoder" type="video/x-vnd.on2.vp9" />
<!-- ffmpeg audio codecs -->
<MediaCodec name="OMX.ffmpeg.ra.decoder" type="audio/vnd.rn-realaudio"/>
<MediaCodec name="OMX.ffmpeg.flac.decoder" type="audio/flac"/>
<MediaCodec name="OMX.ffmpeg.mp2.decoder" type="audio/mpeg-L2"/>
<MediaCodec name="OMX.ffmpeg.ac3.decoder" type="audio/ac3"/>
<MediaCodec name="OMX.ffmpeg.ape.decoder" type="audio/x-ape"/>
<MediaCodec name="OMX.ffmpeg.dts.decoder" type="audio/vnd.dts"/>
<MediaCodec name="OMX.ffmpeg.atrial.decoder" type="audio/ffmpeg"/>
<!-- ffmpeg video codecs -->
<MediaCodec name="OMX.ffmpeg.mpeg2v.decoder" type="video/mpeg2"/>
<MediaCodec name="OMX.ffmpeg.h263.decoder" type="video/3gpp"/>
<MediaCodec name="OMX.ffmpeg.mpeg4.decoder" type="video/mp4v-es"/>
<MediaCodec name="OMX.ffmpeg.wmv.decoder" type="video/x-ms-wmv"/>
<MediaCodec name="OMX.ffmpeg.rv.decoder" type="video/vnd.rn-realvideo"/>
<MediaCodec name="OMX.ffmpeg.h264.decoder" type="video/avc"/>
<MediaCodec name="OMX.ffmpeg.vc1.decoder" type="video/vc1"/>
<MediaCodec name="OMX.ffmpeg.flv1.decoder" type="video/x-flv"/>
<MediaCodec name="OMX.ffmpeg.divx.decoder" type="video/divx"/>
<MediaCodec name="OMX.ffmpeg.hevc.decoder" type="video/hevc"/>
<MediaCodec name="OMX.ffmpeg.vtrial.decoder" type="video/ffmpeg"/>
</Decoders>
<Encoders>
<MediaCodec name="OMX.SEC.MPEG4.Encoder" type="video/mp4v-es" />
<MediaCodec name="OMX.SEC.H263.Encoder" type="video/3gpp" />
<MediaCodec name="OMX.SEC.AVC.Encoder" type="video/avc" />
<MediaCodec name="OMX.google.amrnb.encoder" type="audio/3gpp" />
<MediaCodec name="OMX.google.amrwb.encoder" type="audio/amr-wb" />
<MediaCodec name="OMX.google.aac.encoder" type="audio/mp4a-latm" />
<MediaCodec name="OMX.google.flac.encoder" type="audio/flac" />
<MediaCodec name="OMX.google.vp8.encoder" type="video/x-vnd.on2.vp8" />
</Encoders>
<Include href="media_codecs_google_video.xml" />
<Include href="media_codecs_ffmpeg.xml" />
</MediaCodecs>

View File

@ -7,3 +7,7 @@ p2p_listen_reg_class=81
p2p_listen_channel=1
p2p_oper_reg_class=115
p2p_oper_channel=48
manufacturer=SAMSUNG_ELECTRONICS
model_name=SAMSUNG_MOBILE
model_number=2014
serial_number=19691101

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -149,22 +149,15 @@
<item>10</item>
</integer-array>
<!-- Is the device LTE capable -->
<bool name="config_lte_capable">false</bool>
<!-- The default iface on which to monitor data use -->
<string name="config_datause_iface">pdp0</string>
<!-- Allow the menu hard key to be disabled in LockScreen on some devices -->
<bool name="config_disableMenuKeyInLockScreen">true</bool>
<!-- Workaround for devices with broken keyboards -->
<bool name="config_forceDisableHardwareKeyboard">true</bool>
<!-- Boolean to enable stk functionality on Samsung phones -->
<bool name="config_samsung_stk">true</bool>
<!-- Device supports LED flashlight -->
<bool name="config_enableTorch">true</bool>
<!-- Control whether a car dock event should override the default bluetooth
audio routing, FORCE_BT_CAR_DOCK, with an analog dock, FORCE_ANALOG_DOCK. -->
<bool name="config_forceAnalogCarDock">true</bool>
</resources>

View File

@ -17,6 +17,9 @@
*/
-->
<resources>
<bool name="def_screen_brightness_automatic_mode">true</bool>
<!-- Screen timeout default = 30 seconds -->
<integer name="def_screen_off_timeout">30000</integer>
</resources>

View File

@ -22,5 +22,12 @@
<resources>
<!-- Control whether status bar should distinguish HSPA data icon form UMTS data icon on devices -->
<bool name="config_hspa_data_distinguishable">true</bool>
<!-- Whether recents should use hardware layers for its taskviews. This flag can be enabled
for devices where the java drawing of round rects may be slow -->
<bool name="config_recents_use_hardware_layers">true</bool>
<!-- Whether to use cheap, less good looking shadows for recents -->
<bool name="config_recents_fake_shadows">true</bool>
</resources>

View File

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
*
* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* * Neither the name of The Linux Foundation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<resources>
<!-- configuration for showing smsc pref -->
<bool name="config_show_smsc_pref">true</bool>
</resources>

View File

@ -20,6 +20,8 @@ import galaxys2_common as common
LOCAL_DIR = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..'))
RELEASETOOLS_DIR = os.path.abspath(os.path.join(LOCAL_DIR, '../../../build/tools/releasetools'))
TARGET_DIR = os.getenv('OUT')
# Add releasetools directory to python path
sys.path.append(RELEASETOOLS_DIR)
@ -34,10 +36,7 @@ import galaxys2_edify_generator as edify_generator
__doc__ = ota_from_target_files.__doc__
def CopyBootFiles(input_zip, output_zip):
boot_img = common.GetBootableImage("boot.img", "boot.img",
OPTIONS.input_tmp, "BOOT")
common.CheckSize(boot_img.data, "boot.img", OPTIONS.info_dict)
common.ZipWriteStr(output_zip, "boot.img", boot_img.data)
output_zip.write(os.path.join(TARGET_DIR, "boot.img"),"boot.img")
def WriteFullOTAPackage(input_zip, output_zip):
# TODO: how to determine this? We don't know what version it will
@ -62,7 +61,8 @@ def WriteFullOTAPackage(input_zip, output_zip):
metadata=metadata,
info_dict=OPTIONS.info_dict)
AppendAssertions(script, OPTIONS.info_dict)
system_items = ItemSet("system", "META/filesystem_config.txt")
AppendAssertions(script, device_specific.info_dict)
device_specific.FullOTA_Assertions()
if OPTIONS.backuptool:
script.Mount("/system")
@ -73,20 +73,20 @@ def WriteFullOTAPackage(input_zip, output_zip):
if OPTIONS.wipe_user_data:
script.FormatPartition("/data")
script.Unmount("/system")
script.FormatPartition("/system")
script.Mount("/system")
script.UnpackPackageDir("recovery", "/system")
script.UnpackPackageDir("system", "/system")
symlinks = CopySystemFiles(input_zip, output_zip)
symlinks = CopyPartitionFiles(system_items, input_zip, output_zip)
script.MakeSymlinks(symlinks)
CopyBootFiles(input_zip, output_zip)
Item.GetMetadata(input_zip)
Item.Get("system").SetPermissions(script)
system_items.GetMetadata(input_zip)
system_items.Get("system").SetPermissions(script)
script.ShowProgress(0.2, 0)
@ -95,7 +95,7 @@ def WriteFullOTAPackage(input_zip, output_zip):
script.RunBackup("restore")
script.ShowProgress(0.2, 10)
script.EMMCWriteRawImage("/dev/block/mmcblk0p5", "boot.img")
script.WriteRawImage("/boot", "boot.img")
script.ShowProgress(0.1, 0)
device_specific.FullOTA_InstallEnd()
@ -104,7 +104,7 @@ def WriteFullOTAPackage(input_zip, output_zip):
script.AppendExtra(OPTIONS.extra_script)
script.UnmountAll()
script.AddToZip(input_zip, output_zip)
script.AddToZip(input_zip, output_zip, input_path=OPTIONS.updater_binary)
WriteMetadata(metadata, output_zip)
ota_from_target_files.WriteFullOTAPackage = WriteFullOTAPackage

View File

@ -0,0 +1,482 @@
/*
* Copyright (C) 2011 The CyanogenMod Project <http://www.cyanogenmod.org>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.internal.telephony;
import static com.android.internal.telephony.RILConstants.*;
import android.content.Context;
import android.os.AsyncResult;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.Looper;
import android.os.Message;
import android.os.Parcel;
import android.os.Registrant;
import android.text.TextUtils;
import android.telephony.Rlog;
import android.telephony.PhoneNumberUtils;
import java.util.ArrayList;
public class SamsungExynos4RIL extends RIL implements CommandsInterface {
//SAMSUNG STATES
static final int RIL_REQUEST_GET_CELL_BROADCAST_CONFIG = 10002;
static final int RIL_REQUEST_SEND_ENCODED_USSD = 10005;
static final int RIL_REQUEST_SET_PDA_MEMORY_STATUS = 10006;
static final int RIL_REQUEST_GET_PHONEBOOK_STORAGE_INFO = 10007;
static final int RIL_REQUEST_GET_PHONEBOOK_ENTRY = 10008;
static final int RIL_REQUEST_ACCESS_PHONEBOOK_ENTRY = 10009;
static final int RIL_REQUEST_DIAL_VIDEO_CALL = 10010;
static final int RIL_REQUEST_CALL_DEFLECTION = 10011;
static final int RIL_REQUEST_READ_SMS_FROM_SIM = 10012;
static final int RIL_REQUEST_USIM_PB_CAPA = 10013;
static final int RIL_REQUEST_LOCK_INFO = 10014;
static final int RIL_REQUEST_DIAL_EMERGENCY = 10016;
static final int RIL_REQUEST_GET_STOREAD_MSG_COUNT = 10017;
static final int RIL_REQUEST_STK_SIM_INIT_EVENT = 10018;
static final int RIL_REQUEST_GET_LINE_ID = 10019;
static final int RIL_REQUEST_SET_LINE_ID = 10020;
static final int RIL_REQUEST_GET_SERIAL_NUMBER = 10021;
static final int RIL_REQUEST_GET_MANUFACTURE_DATE_NUMBER = 10022;
static final int RIL_REQUEST_GET_BARCODE_NUMBER = 10023;
static final int RIL_REQUEST_UICC_GBA_AUTHENTICATE_BOOTSTRAP = 10024;
static final int RIL_REQUEST_UICC_GBA_AUTHENTICATE_NAF = 10025;
static final int RIL_REQUEST_SIM_TRANSMIT_BASIC = 10026;
static final int RIL_REQUEST_SIM_OPEN_CHANNEL = 10027;
static final int RIL_REQUEST_SIM_CLOSE_CHANNEL = 10028;
static final int RIL_REQUEST_SIM_TRANSMIT_CHANNEL = 10029;
static final int RIL_REQUEST_SIM_AUTH = 10030;
static final int RIL_REQUEST_PS_ATTACH = 10031;
static final int RIL_REQUEST_PS_DETACH = 10032;
static final int RIL_REQUEST_ACTIVATE_DATA_CALL = 10033;
static final int RIL_REQUEST_CHANGE_SIM_PERSO = 10034;
static final int RIL_REQUEST_ENTER_SIM_PERSO = 10035;
static final int RIL_REQUEST_GET_TIME_INFO = 10036;
static final int RIL_REQUEST_OMADM_SETUP_SESSION = 10037;
static final int RIL_REQUEST_OMADM_SERVER_START_SESSION = 10038;
static final int RIL_REQUEST_OMADM_CLIENT_START_SESSION = 10039;
static final int RIL_REQUEST_OMADM_SEND_DATA = 10040;
static final int RIL_REQUEST_CDMA_GET_DATAPROFILE = 10041;
static final int RIL_REQUEST_CDMA_SET_DATAPROFILE = 10042;
static final int RIL_REQUEST_CDMA_GET_SYSTEMPROPERTIES = 10043;
static final int RIL_REQUEST_CDMA_SET_SYSTEMPROPERTIES = 10044;
static final int RIL_REQUEST_SEND_SMS_COUNT = 10045;
static final int RIL_REQUEST_SEND_SMS_MSG = 10046;
static final int RIL_REQUEST_SEND_SMS_MSG_READ_STATUS = 10047;
static final int RIL_REQUEST_MODEM_HANGUP = 10048;
static final int RIL_REQUEST_SET_SIM_POWER = 10049;
static final int RIL_REQUEST_SET_PREFERRED_NETWORK_LIST = 10050;
static final int RIL_REQUEST_GET_PREFERRED_NETWORK_LIST = 10051;
static final int RIL_REQUEST_HANGUP_VT = 10052;
static final int RIL_UNSOL_RELEASE_COMPLETE_MESSAGE = 11001;
static final int RIL_UNSOL_STK_SEND_SMS_RESULT = 11002;
static final int RIL_UNSOL_STK_CALL_CONTROL_RESULT = 11003;
static final int RIL_UNSOL_DUN_CALL_STATUS = 11004;
static final int RIL_UNSOL_O2_HOME_ZONE_INFO = 11007;
static final int RIL_UNSOL_DEVICE_READY_NOTI = 11008;
static final int RIL_UNSOL_GPS_NOTI = 11009;
static final int RIL_UNSOL_AM = 11010;
static final int RIL_UNSOL_DUN_PIN_CONTROL_SIGNAL = 11011;
static final int RIL_UNSOL_DATA_SUSPEND_RESUME = 11012;
static final int RIL_UNSOL_SAP = 11013;
static final int RIL_UNSOL_SIM_SMS_STORAGE_AVAILALE = 11015;
static final int RIL_UNSOL_HSDPA_STATE_CHANGED = 11016;
static final int RIL_UNSOL_WB_AMR_STATE = 11017;
static final int RIL_UNSOL_TWO_MIC_STATE = 11018;
static final int RIL_UNSOL_DHA_STATE = 11019;
static final int RIL_UNSOL_UART = 11020;
static final int RIL_UNSOL_RESPONSE_HANDOVER = 11021;
static final int RIL_UNSOL_IPV6_ADDR = 11022;
static final int RIL_UNSOL_NWK_INIT_DISC_REQUEST = 11023;
static final int RIL_UNSOL_RTS_INDICATION = 11024;
static final int RIL_UNSOL_OMADM_SEND_DATA = 11025;
static final int RIL_UNSOL_DUN = 11026;
static final int RIL_UNSOL_SYSTEM_REBOOT = 11027;
static final int RIL_UNSOL_VOICE_PRIVACY_CHANGED = 11028;
static final int RIL_UNSOL_UTS_GETSMSCOUNT = 11029;
static final int RIL_UNSOL_UTS_GETSMSMSG = 11030;
static final int RIL_UNSOL_UTS_GET_UNREAD_SMS_STATUS = 11031;
static final int RIL_UNSOL_MIP_CONNECT_STATUS = 11032;
private Object mCatProCmdBuffer;
/* private Message mPendingGetSimStatus; */
public SamsungExynos4RIL(Context context, int networkMode, int cdmaSubscription) {
super(context, networkMode, cdmaSubscription, null);
}
public SamsungExynos4RIL(Context context, int networkMode, int cdmaSubscription, Integer instanceId) {
super(context, networkMode, cdmaSubscription, instanceId);
}
static String
requestToString(int request) {
switch (request) {
case RIL_REQUEST_DIAL_EMERGENCY: return "DIAL_EMERGENCY";
default: return RIL.requestToString(request);
}
}
@Override
protected RILRequest processSolicited (Parcel p) {
int serial, error;
boolean found = false;
serial = p.readInt();
error = p.readInt();
RILRequest rr;
rr = findAndRemoveRequestFromList(serial);
if (rr == null) {
Rlog.w(RILJ_LOG_TAG, "Unexpected solicited response! sn: "
+ serial + " error: " + error);
return null;
}
Object ret = null;
if (error == 0 || p.dataAvail() > 0) {
// either command succeeds or command fails but with data payload
try {switch (rr.mRequest) {
/*
cat libs/telephony/ril_commands.h \
| egrep "^ *{RIL_" \
| sed -re 's/\{([^,]+),[^,]+,([^}]+).+/case \1: ret = \2(p); break;/'
*/
case RIL_REQUEST_GET_SIM_STATUS: ret = responseIccCardStatus(p); break;
case RIL_REQUEST_ENTER_SIM_PIN: ret = responseInts(p); break;
case RIL_REQUEST_ENTER_SIM_PUK: ret = responseInts(p); break;
case RIL_REQUEST_ENTER_SIM_PIN2: ret = responseInts(p); break;
case RIL_REQUEST_ENTER_SIM_PUK2: ret = responseInts(p); break;
case RIL_REQUEST_CHANGE_SIM_PIN: ret = responseInts(p); break;
case RIL_REQUEST_CHANGE_SIM_PIN2: ret = responseInts(p); break;
case RIL_REQUEST_ENTER_DEPERSONALIZATION_CODE: ret = responseInts(p); break;
case RIL_REQUEST_GET_CURRENT_CALLS: ret = responseCallList(p); break;
case RIL_REQUEST_DIAL: ret = responseVoid(p); break;
case RIL_REQUEST_DIAL_EMERGENCY: ret = responseVoid(p); break;
case RIL_REQUEST_GET_IMSI: ret = responseString(p); break;
case RIL_REQUEST_HANGUP: ret = responseVoid(p); break;
case RIL_REQUEST_HANGUP_WAITING_OR_BACKGROUND: ret = responseVoid(p); break;
case RIL_REQUEST_HANGUP_FOREGROUND_RESUME_BACKGROUND: {
if (mTestingEmergencyCall.getAndSet(false)) {
if (mEmergencyCallbackModeRegistrant != null) {
riljLog("testing emergency call, notify ECM Registrants");
mEmergencyCallbackModeRegistrant.notifyRegistrant();
}
}
ret = responseVoid(p);
break;
}
case RIL_REQUEST_SWITCH_WAITING_OR_HOLDING_AND_ACTIVE: ret = responseVoid(p); break;
case RIL_REQUEST_CONFERENCE: ret = responseVoid(p); break;
case RIL_REQUEST_UDUB: ret = responseVoid(p); break;
case RIL_REQUEST_LAST_CALL_FAIL_CAUSE: ret = responseInts(p); break;
case RIL_REQUEST_SIGNAL_STRENGTH: ret = responseSignalStrength(p); break;
case RIL_REQUEST_VOICE_REGISTRATION_STATE: ret = responseStrings(p); break;
case RIL_REQUEST_DATA_REGISTRATION_STATE: ret = responseStrings(p); break;
case RIL_REQUEST_OPERATOR: ret = responseStrings(p); break;
case RIL_REQUEST_RADIO_POWER: ret = responseVoid(p); break;
case RIL_REQUEST_DTMF: ret = responseVoid(p); break;
case RIL_REQUEST_SEND_SMS: ret = responseSMS(p); break;
case RIL_REQUEST_SEND_SMS_EXPECT_MORE: ret = responseSMS(p); break;
case RIL_REQUEST_SETUP_DATA_CALL: ret = responseSetupDataCall(p); break;
case RIL_REQUEST_SIM_IO: ret = responseICC_IO(p); break;
case RIL_REQUEST_SEND_USSD: ret = responseVoid(p); break;
case RIL_REQUEST_CANCEL_USSD: ret = responseVoid(p); break;
case RIL_REQUEST_GET_CLIR: ret = responseInts(p); break;
case RIL_REQUEST_SET_CLIR: ret = responseVoid(p); break;
case RIL_REQUEST_QUERY_CALL_FORWARD_STATUS: ret = responseCallForward(p); break;
case RIL_REQUEST_SET_CALL_FORWARD: ret = responseVoid(p); break;
case RIL_REQUEST_QUERY_CALL_WAITING: ret = responseInts(p); break;
case RIL_REQUEST_SET_CALL_WAITING: ret = responseVoid(p); break;
case RIL_REQUEST_SMS_ACKNOWLEDGE: ret = responseVoid(p); break;
case RIL_REQUEST_GET_IMEI: ret = responseString(p); break;
case RIL_REQUEST_GET_IMEISV: ret = responseString(p); break;
case RIL_REQUEST_ANSWER: ret = responseVoid(p); break;
case RIL_REQUEST_DEACTIVATE_DATA_CALL: ret = responseVoid(p); break;
case RIL_REQUEST_QUERY_FACILITY_LOCK: ret = responseInts(p); break;
case RIL_REQUEST_SET_FACILITY_LOCK: ret = responseInts(p); break;
case RIL_REQUEST_CHANGE_BARRING_PASSWORD: ret = responseVoid(p); break;
case RIL_REQUEST_QUERY_NETWORK_SELECTION_MODE: ret = responseInts(p); break;
case RIL_REQUEST_SET_NETWORK_SELECTION_AUTOMATIC: ret = responseVoid(p); break;
case RIL_REQUEST_SET_NETWORK_SELECTION_MANUAL: ret = responseVoid(p); break;
case RIL_REQUEST_QUERY_AVAILABLE_NETWORKS : ret = responseOperatorInfos(p); break;
case RIL_REQUEST_DTMF_START: ret = responseVoid(p); break;
case RIL_REQUEST_DTMF_STOP: ret = responseVoid(p); break;
case RIL_REQUEST_BASEBAND_VERSION: ret = responseString(p); break;
case RIL_REQUEST_SEPARATE_CONNECTION: ret = responseVoid(p); break;
case RIL_REQUEST_SET_MUTE: ret = responseVoid(p); break;
case RIL_REQUEST_GET_MUTE: ret = responseInts(p); break;
case RIL_REQUEST_QUERY_CLIP: ret = responseInts(p); break;
case RIL_REQUEST_LAST_DATA_CALL_FAIL_CAUSE: ret = responseInts(p); break;
case RIL_REQUEST_DATA_CALL_LIST: ret = responseDataCallList(p); break;
case RIL_REQUEST_RESET_RADIO: ret = responseVoid(p); break;
case RIL_REQUEST_OEM_HOOK_RAW: ret = responseRaw(p); break;
case RIL_REQUEST_OEM_HOOK_STRINGS: ret = responseStrings(p); break;
case RIL_REQUEST_SCREEN_STATE: ret = responseVoid(p); break;
case RIL_REQUEST_SET_SUPP_SVC_NOTIFICATION: ret = responseVoid(p); break;
case RIL_REQUEST_WRITE_SMS_TO_SIM: ret = responseInts(p); break;
case RIL_REQUEST_DELETE_SMS_ON_SIM: ret = responseVoid(p); break;
case RIL_REQUEST_SET_BAND_MODE: ret = responseVoid(p); break;
case RIL_REQUEST_QUERY_AVAILABLE_BAND_MODE: ret = responseInts(p); break;
case RIL_REQUEST_STK_GET_PROFILE: ret = responseString(p); break;
case RIL_REQUEST_STK_SET_PROFILE: ret = responseVoid(p); break;
case RIL_REQUEST_STK_SEND_ENVELOPE_COMMAND: ret = responseString(p); break;
case RIL_REQUEST_STK_SEND_TERMINAL_RESPONSE: ret = responseVoid(p); break;
case RIL_REQUEST_STK_HANDLE_CALL_SETUP_REQUESTED_FROM_SIM: ret = responseInts(p); break;
case RIL_REQUEST_EXPLICIT_CALL_TRANSFER: ret = responseVoid(p); break;
case RIL_REQUEST_SET_PREFERRED_NETWORK_TYPE: ret = responseVoid(p); break;
case RIL_REQUEST_GET_PREFERRED_NETWORK_TYPE: ret = responseGetPreferredNetworkType(p); break;
case RIL_REQUEST_GET_NEIGHBORING_CELL_IDS: ret = responseCellList(p); break;
case RIL_REQUEST_SET_LOCATION_UPDATES: ret = responseVoid(p); break;
case RIL_REQUEST_CDMA_SET_SUBSCRIPTION_SOURCE: ret = responseVoid(p); break;
case RIL_REQUEST_CDMA_SET_ROAMING_PREFERENCE: ret = responseVoid(p); break;
case RIL_REQUEST_CDMA_QUERY_ROAMING_PREFERENCE: ret = responseInts(p); break;
case RIL_REQUEST_SET_TTY_MODE: ret = responseVoid(p); break;
case RIL_REQUEST_QUERY_TTY_MODE: ret = responseInts(p); break;
case RIL_REQUEST_CDMA_SET_PREFERRED_VOICE_PRIVACY_MODE: ret = responseVoid(p); break;
case RIL_REQUEST_CDMA_QUERY_PREFERRED_VOICE_PRIVACY_MODE: ret = responseInts(p); break;
case RIL_REQUEST_CDMA_FLASH: ret = responseVoid(p); break;
case RIL_REQUEST_CDMA_BURST_DTMF: ret = responseVoid(p); break;
case RIL_REQUEST_CDMA_SEND_SMS: ret = responseSMS(p); break;
case RIL_REQUEST_CDMA_SMS_ACKNOWLEDGE: ret = responseVoid(p); break;
case RIL_REQUEST_GSM_GET_BROADCAST_CONFIG: ret = responseGmsBroadcastConfig(p); break;
case RIL_REQUEST_GSM_SET_BROADCAST_CONFIG: ret = responseVoid(p); break;
case RIL_REQUEST_GSM_BROADCAST_ACTIVATION: ret = responseVoid(p); break;
case RIL_REQUEST_CDMA_GET_BROADCAST_CONFIG: ret = responseCdmaBroadcastConfig(p); break;
case RIL_REQUEST_CDMA_SET_BROADCAST_CONFIG: ret = responseVoid(p); break;
case RIL_REQUEST_CDMA_BROADCAST_ACTIVATION: ret = responseVoid(p); break;
case RIL_REQUEST_CDMA_VALIDATE_AND_WRITE_AKEY: ret = responseVoid(p); break;
case RIL_REQUEST_CDMA_SUBSCRIPTION: ret = responseStrings(p); break;
case RIL_REQUEST_CDMA_WRITE_SMS_TO_RUIM: ret = responseInts(p); break;
case RIL_REQUEST_CDMA_DELETE_SMS_ON_RUIM: ret = responseVoid(p); break;
case RIL_REQUEST_DEVICE_IDENTITY: ret = responseStrings(p); break;
case RIL_REQUEST_GET_SMSC_ADDRESS: ret = responseString(p); break;
case RIL_REQUEST_SET_SMSC_ADDRESS: ret = responseVoid(p); break;
case RIL_REQUEST_EXIT_EMERGENCY_CALLBACK_MODE: ret = responseVoid(p); break;
case RIL_REQUEST_REPORT_SMS_MEMORY_STATUS: ret = responseVoid(p); break;
case RIL_REQUEST_REPORT_STK_SERVICE_IS_RUNNING: ret = responseVoid(p); break;
case RIL_REQUEST_CDMA_GET_SUBSCRIPTION_SOURCE: ret = responseInts(p); break;
case RIL_REQUEST_ISIM_AUTHENTICATION: ret = responseString(p); break;
case RIL_REQUEST_ACKNOWLEDGE_INCOMING_GSM_SMS_WITH_PDU: ret = responseVoid(p); break;
case RIL_REQUEST_STK_SEND_ENVELOPE_WITH_STATUS: ret = responseICC_IO(p); break;
case RIL_REQUEST_VOICE_RADIO_TECH: ret = responseInts(p); break;
default:
throw new RuntimeException("Unrecognized solicited response: " + rr.mRequest);
//break;
}} catch (Throwable tr) {
// Exceptions here usually mean invalid RIL responses
Rlog.w(RILJ_LOG_TAG, rr.serialString() + "< "
+ requestToString(rr.mRequest)
+ " exception, possible invalid RIL response", tr);
if (rr.mResult != null) {
AsyncResult.forMessage(rr.mResult, null, tr);
rr.mResult.sendToTarget();
}
return rr;
}
}
// Here and below fake RIL_UNSOL_RESPONSE_SIM_STATUS_CHANGED, see b/7255789.
// This is needed otherwise we don't automatically transition to the main lock
// screen when the pin or puk is entered incorrectly.
switch (rr.mRequest) {
case RIL_REQUEST_ENTER_SIM_PUK:
case RIL_REQUEST_ENTER_SIM_PUK2:
if (mIccStatusChangedRegistrants != null) {
if (RILJ_LOGD) {
riljLog("ON enter sim puk fakeSimStatusChanged: reg count="
+ mIccStatusChangedRegistrants.size());
}
mIccStatusChangedRegistrants.notifyRegistrants();
}
break;
}
if (error != 0) {
switch (rr.mRequest) {
case RIL_REQUEST_ENTER_SIM_PIN:
case RIL_REQUEST_ENTER_SIM_PIN2:
case RIL_REQUEST_CHANGE_SIM_PIN:
case RIL_REQUEST_CHANGE_SIM_PIN2:
case RIL_REQUEST_SET_FACILITY_LOCK:
if (mIccStatusChangedRegistrants != null) {
if (RILJ_LOGD) {
riljLog("ON some errors fakeSimStatusChanged: reg count="
+ mIccStatusChangedRegistrants.size());
}
mIccStatusChangedRegistrants.notifyRegistrants();
}
break;
}
rr.onError(error, ret);
return rr;
}
if (RILJ_LOGD) riljLog(rr.serialString() + "< " + requestToString(rr.mRequest)
+ " " + retToString(rr.mRequest, ret));
if (rr.mResult != null) {
AsyncResult.forMessage(rr.mResult, ret, null);
rr.mResult.sendToTarget();
}
return rr;
}
@Override
public void
dial(String address, int clirMode, UUSInfo uusInfo, Message result) {
RILRequest rr;
if (PhoneNumberUtils.isEmergencyNumber(address)) {
dialEmergencyCall(address, clirMode, result);
return;
}
rr = RILRequest.obtain(RIL_REQUEST_DIAL, result);
rr.mParcel.writeString(address);
rr.mParcel.writeInt(clirMode);
if (uusInfo == null) {
rr.mParcel.writeInt(0); // UUS information is absent
} else {
rr.mParcel.writeInt(1); // UUS information is present
rr.mParcel.writeInt(uusInfo.getType());
rr.mParcel.writeInt(uusInfo.getDcs());
rr.mParcel.writeByteArray(uusInfo.getUserData());
}
if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest));
send(rr);
}
/* @Override
public void
getIccCardStatus(Message result) {
if (mState != RadioState.RADIO_ON) {
mPendingGetSimStatus = result;
} else {
super.getIccCardStatus(result);
}
}
@Override
protected void
switchToRadioState(RadioState newState) {
super.switchToRadioState(newState);
if (newState == RadioState.RADIO_ON && mPendingGetSimStatus != null) {
super.getIccCardStatus(mPendingGetSimStatus);
mPendingGetSimStatus = null;
}
}*/
public void
dialEmergencyCall(String address, int clirMode, Message result) {
RILRequest rr;
Rlog.v(RILJ_LOG_TAG, "Emergency dial: " + address);
rr = RILRequest.obtain(RIL_REQUEST_DIAL_EMERGENCY, result);
rr.mParcel.writeString(address + "/");
rr.mParcel.writeInt(clirMode);
rr.mParcel.writeInt(0); // UUS information is absent
if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest));
send(rr);
}
@Override
protected void
processUnsolicited (Parcel p) {
int dataPosition = p.dataPosition();
int response = p.readInt();
switch(response) {
case RIL_UNSOL_STK_PROACTIVE_COMMAND:
Object ret = responseString(p);
if (RILJ_LOGD) unsljLogRet(response, ret);
if (mCatProCmdRegistrant != null) {
mCatProCmdRegistrant.notifyRegistrant(
new AsyncResult (null, ret, null));
} else {
// The RIL will send a CAT proactive command before the
// registrant is registered. Buffer it to make sure it
// does not get ignored (and breaks CatService).
mCatProCmdBuffer = ret;
}
break;
default:
// Rewind the Parcel
p.setDataPosition(dataPosition);
// Forward responses that we are not overriding to the super class
super.processUnsolicited(p);
return;
}
}
@Override
public void setOnCatProactiveCmd(Handler h, int what, Object obj) {
mCatProCmdRegistrant = new Registrant (h, what, obj);
if (mCatProCmdBuffer != null) {
mCatProCmdRegistrant.notifyRegistrant(
new AsyncResult (null, mCatProCmdBuffer, null));
mCatProCmdBuffer = null;
}
}
private void
constructGsmSendSmsRilRequest (RILRequest rr, String smscPDU, String pdu) {
rr.mParcel.writeInt(2);
rr.mParcel.writeString(smscPDU);
rr.mParcel.writeString(pdu);
}
/**
* The RIL can't handle the RIL_REQUEST_SEND_SMS_EXPECT_MORE
* request properly, so we use RIL_REQUEST_SEND_SMS instead.
*/
@Override
public void
sendSMSExpectMore (String smscPDU, String pdu, Message result) {
RILRequest rr
= RILRequest.obtain(RIL_REQUEST_SEND_SMS, result);
constructGsmSendSmsRilRequest(rr, smscPDU, pdu);
if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest));
send(rr);
}
}

View File

@ -11,9 +11,9 @@
/dev/block/mmcblk0p12 /preload ext4 noatime,nosuid,nodev,journal_async_commit wait
# vold-managed volumes ("block device" is actually a sysfs devpath)
/devices/platform/dw_mmc/mmc_host/mmc0/mmc0 auto auto defaults voldmanaged=sdcard0:11,nonremovable,noemulatedsd
/devices/platform/s3c-sdhci.2/mmc_host/mmc1 auto auto defaults voldmanaged=sdcard1:auto
/devices/platform/s3c_otghcd/usb auto auto defaults voldmanaged=usbdisk0:auto
/devices/platform/dw_mmc/mmc_host/mmc0/mmc0* auto auto defaults wait,voldmanaged=sdcard0:11,nonremovable,noemulatedsd
/devices/platform/s3c-sdhci.2/mmc_host/mmc1* auto auto defaults wait,voldmanaged=sdcard1:auto,noemulatedsd
/devices/platform/s3c_otghcd/usb* auto auto defaults voldmanaged=usbdisk0:auto
# recovery
/dev/block/mmcblk0p5 /boot emmc defaults recoveryonly

View File

@ -41,22 +41,16 @@ on fs
mkdir /data/misc/vpn/profiles 0770 system system
mkdir /data/misc/radio 0775 radio system
mkdir /data/radio 0770 radio radio
chmod 0770 /data/misc/wifi
# Restorecon
restorecon /efs/nv_data.bin
restorecon /efs/nv_data.bin.md5
restorecon /efs/.nv_core.bak
restorecon /efs/.nv_core.bak.md5
restorecon /efs/.nv_data.bak
restorecon /efs/.nv_data.bak.md5
restorecon /efs/.nv_state
restorecon /efs/bluetooth/bt_addr
restorecon /efs/FactoryApp/factorymode
restorecon /efs/FactoryApp/hw_ver
restorecon /efs/FactoryApp/keystr
restorecon /efs/FactoryApp/serial_no
restorecon /efs/imei/mps_code.dat
on charger
# CPU Frequency Governor
write /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor powersave
# EHCI runtime enable for LPA
write /sys/devices/platform/s5p-ehci/power/control auto
on post-fs-data
# insmod kernel modules
@ -117,6 +111,9 @@ on post-fs-data
chmod 0775 /efs/.files/.dm33
chmod 0775 /efs/.files/.mp301
# SELinux restore context for efs files
restorecon_recursive /efs
# MTP Device permission.
chmod 0660 /dev/usb_mtp_gadget
chown system system /dev/usb_mtp_gadget
@ -172,6 +169,7 @@ on post-fs-data
chown system radio /sys/devices/platform/sec-battery/power_supply/battery/video
chown system radio /sys/devices/platform/sec-battery/power_supply/battery/batt_lp_charging
chown system radio /sys/devices/platform/sec-battery/power_supply/battery/charging_source
chown system radio /sys/devices/platform/sec-battery/power_supply/battery/charging_enabled
chown system radio /sys/devices/platform/sec-battery/power_supply/battery/batt_temp_adc_avg
chown system radio /sys/devices/platform/sec-battery/power_supply/battery/batt_temp_adc
chown system radio /sys/devices/platform/sec-battery/power_supply/battery/batt_temp
@ -234,6 +232,8 @@ on post-fs-data
chmod 0660 /sys/class/rfkill/rfkill0/state
chown bluetooth bluetooth /sys/class/rfkill/rfkill0/state
chown bluetooth bluetooth /sys/class/rfkill/rfkill0/type
restorecon /sys/class/rfkill/rfkill0/state
restorecon /sys/class/rfkill/rfkill0/type
# Vibetonz
chmod 0660 /dev/tspdrv
@ -247,6 +247,7 @@ on post-fs-data
chown system media_rw /sys/class/lcd/panel/gamma_mode
chown system media_rw /sys/class/lcd/panel/power_reduce
chown system system /sys/class/backlight/panel/auto_brightness
restorecon /sys/class/lcd/panel/power_reduce
# Permissions for mDNIe
chown system media_rw /sys/class/mdnie/mdnie/mode
@ -255,6 +256,9 @@ on post-fs-data
chown system media_rw /sys/class/mdnie/mdnie/negative
write /sys/class/mdnie/mdnie/scenario 0
write /sys/class/mdnie/mdnie/mode 1
restorecon /sys/class/mdnie/mdnie/scenario
restorecon /sys/class/mdnie/mdnie/mode
restorecon /sys/class/mdnie/mdnie/negative
# Permissions for uart_sel and usb_sel
chown system radio /sys/class/sec/switch/uart_sel/value
@ -318,6 +322,7 @@ on post-fs-data
on boot
mount debugfs /sys/kernel/debug /sys/kernel/debug
setprop wifi.interface wlan0
# permissions for NFC
setprop ro.nfc.port "I2C"
@ -347,11 +352,18 @@ service mdnsd /system/bin/mdnsd
disabled
oneshot
service charger /sbin/healthd -c
class charger
critical
seclabel u:r:healthd:s0
service p2p_supplicant /system/bin/wpa_supplicant \
-iwlan0 -Dnl80211 -c/data/misc/wifi/wpa_supplicant.conf -N \
-iwlan0 -Dnl80211 -c/data/misc/wifi/wpa_supplicant.conf \
-I/system/etc/wifi/wpa_supplicant.conf \
-O/data/misc/wifi/sockets -N \
-ip2p0 -Dnl80211 -c/data/misc/wifi/p2p_supplicant.conf -e/data/misc/wifi/entropy.bin \
-puse_p2p_group_interface=1 \
-O/data/misc/wifi/sockets -g@android:wpa_wlan0
-g@android:wpa_wlan0
# we will start as root and wpa_supplicant will switch to user wifi
# after setting up the capabilities required for WEXT
# user wifi
@ -364,7 +376,9 @@ service p2p_supplicant /system/bin/wpa_supplicant \
service wpa_supplicant /system/bin/wpa_supplicant \
-Dnl80211 -iwlan0 -e/data/misc/wifi/entropy.bin \
-c/data/misc/wifi/wpa_supplicant.conf \
-O/data/misc/wifi/sockets -g@android:wpa_wlan0
-I/system/etc/wifi/wpa_supplicant.conf \
-O/data/misc/wifi/sockets \
-g@android:wpa_wlan0
# we will start as root and wpa_supplicant will switch to user wifi
# after setting up the capabilities required for WEXT
# user wifi
@ -404,11 +418,8 @@ service iprenew_bt-pan /system/bin/dhcpcd -n
disabled
oneshot
# bluetooth mac address
service bdaddr /system/bin/bdaddr_read
service macloader /system/bin/macloader
class main
user root
disabled
oneshot
# bugreport is triggered by holding down volume down, volume up and power

View File

@ -1,64 +0,0 @@
on early-init
start ueventd
on init
export PATH /sbin:/vendor/bin:/system/sbin:/system/bin:/system/xbin
export LD_LIBRARY_PATH /vendor/lib:/system/lib
export ANDROID_ROOT /system
export ANDROID_DATA /data
export ANDROID_CACHE /cache
export SECONDARY_STORAGE /mnt/emmc
export EXTERNAL_STORAGE /mnt/sdcard
symlink /system/etc /etc
mkdir /mnt 0775 root system
mkdir /system
mkdir /tmp
mkdir /mnt 0775 root root
on boot
# CPU Frequency Governor
write /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor powersave
ifup lo
hostname localhost
domainname localdomain
class_start default
service ueventd /sbin/ueventd
class core
critical
service console /system/bin/sh
class core
console
service adbd /sbin/adbd
disabled
service charger /charger
class default
user root
# Always start adbd on userdebug and eng builds
# In recovery, always run adbd as root.
on property:ro.debuggable=1
write /sys/class/android_usb/android0/enable 0
write /sys/class/android_usb/android0/idVendor 04e8
write /sys/class/android_usb/android0/idProduct 6860
write /sys/class/android_usb/android0/functions adb
write /sys/class/android_usb/android0/enable 1
write /sys/class/android_usb/android0/iManufacturer $ro.product.manufacturer
write /sys/class/android_usb/android0/iProduct $ro.product.model
write /sys/class/android_usb/android0/iSerial $ro.serialno
start adbd
setprop service.adb.root 1
# Restart adbd so it can run as root
on property:service.adb.root=1
write /sys/class/android_usb/android0/enable 0
restart adbd
write /sys/class/android_usb/android0/enable 1

1
selinux/bluetooth.te Normal file
View File

@ -0,0 +1 @@
allow bluetooth efs_device_file:dir search;

View File

@ -1,2 +1,4 @@
type mali_device, dev_type, mlstrustedobject;
type rfkill_device, dev_type;
type efs_block_device, dev_type;
type mfc_device, dev_type;

View File

@ -1,2 +1,5 @@
## Firmwares
allow ueventd { firmware_mfc }:file r_file_perms;
## /dev/mali, /dev/ump
allow domain mali_device:chr_file rw_file_perms;

View File

@ -1 +1,2 @@
allow drmserver sdcard_external:file open;
allow drmserver self:process execmem;

1
selinux/dumpstate.te Normal file
View File

@ -0,0 +1 @@
unix_socket_connect(dumpstate, dumpstate, init);

View File

@ -1,2 +1,4 @@
type radio_efs_file, fs_type;
type firmware_mfc, file_type;
type sysfs_display, fs_type, sysfs_type;
type efs_device_file, file_type;

View File

@ -1,7 +1,7 @@
# GFX
/dev/mali u:object_r:graphics_device:s0
/dev/ump u:object_r:graphics_device:s0
/dev/fimg2d u:object_r:graphics_device:s0
/dev/mali u:object_r:mali_device:s0
/dev/ump u:object_r:mali_device:s0
/dev/fimg2d u:object_r:mali_device:s0
# RIL
/dev/umts_boot0 u:object_r:radio_device:s0
@ -10,11 +10,17 @@
/dev/umts_ramdump0 u:object_r:radio_device:s0
/dev/umts_rfs0 u:object_r:radio_device:s0
/dev/block/mmcblk0p7 u:object_r:efs_block_device:s0
/dev/block/mmcblk0p8 u:object_r:efs_block_device:s0
/efs u:object_r:efs_device_file:s0
# Camera
/dev/s3c-mfc u:object_r:mfc_device:s0
/dev/s5p-jpeg u:object_r:video_device:s0
# Bluetooth
/dev/ttySAC0 u:object_r:hci_attach_dev:s0
/efs/bluetooth(/.*)? u:object_r:bluetooth_data_file:s0
/efs/bluetooth/bt_addr u:object_r:bluetooth_data_file:s0
/sys/class/rfkill/rfkill0/state u:object_r:sysfs_bluetooth_writable:s0
# GPS
/dev/ttySAC1 u:object_r:gps_device:s0
@ -27,3 +33,9 @@
# Firmwares
/system/vendor/firmware/mfc_fw.bin u:object_r:firmware_mfc:s0
# Display
/sys/class/lcd/panel/power_reduce u:object_r:sysfs_display:s0
/sys/class/mdnie/mdnie/scenario u:object_r:sysfs_display:s0
/sys/class/mdnie/mdnie/mode u:object_r:sysfs_display:s0
/sys/class/mdnie/mdnie/negative u:object_r:sysfs_display:s0

1
selinux/init.te Normal file
View File

@ -0,0 +1 @@
allow init self:capability sys_module;

2
selinux/mediaserver.te Normal file
View File

@ -0,0 +1,2 @@
allow mediaserver mfc_device:chr_file rw_file_perms;
allow mediaserver video_device:chr_file rw_file_perms;

View File

@ -1,7 +1,17 @@
allow rild self:netlink_socket { create bind read write };
allow rild self:netlink_route_socket { write };
allow rild self:netlink_kobject_uevent_socket { create bind read write };
allow rild self:process execmem;
allow rild radio_device:chr_file rw_file_perms;
allow rild efs_block_device:blk_file rw_file_perms;
allow rild efs_file:file { read open write setattr };
allow rild radio_data_file:dir setattr;
allow rild block_device:dir search;
allow rild efs_device_file:dir { search write };
allow rild efs_device_file:file { read write append getattr open setattr };
allow rild system_data_file:dir { write add_name };
allow rild system_data_file:file { write create setattr };
allow rild dumpstate_exec:file { read open getattr execute };
unix_socket_connect(rild, dumpstate, dumpstate)

1
selinux/system_app.te Normal file
View File

@ -0,0 +1 @@
allow system_app sysfs_display:file { getattr open read write };

5
selinux/system_server.te Normal file
View File

@ -0,0 +1,5 @@
allow system_server uhid_device:chr_file { read write ioctl open };
allow system_server sysfs_display:file { read write getattr open };
allow system_server efs_file:dir { search };
allow system_server efs_file:file { read open write };
allow system_server efs_device_file:dir search;

View File

@ -1 +1,3 @@
allow vold sdcard_external:file rw_file_perms;
allow vold efs_device_file:dir rw_file_perms;
allow vold efs_device_file:file rw_file_perms;

View File

@ -44,6 +44,7 @@ int (*_ril_set_call_volume)(void *, enum ril_sound_type, int);
int (*_ril_set_call_audio_path)(void *, enum ril_audio_path);
int (*_ril_set_call_clock_sync)(void *, enum ril_clock_state);
int (*_ril_set_call_twomic)(void *, enum ril_twomic_device, enum ril_twomic_enable);
int (*_ril_set_mic_mute)(void *, enum ril_mic_mute);
int (*_ril_register_unsolicited_handler)(void *, int, void *);
int (*_ril_get_wb_amr)(void *, void *);
@ -71,16 +72,6 @@ static int audio_ril_interface_connect_if_required(struct tinyalsa_audio_ril_int
return 0;
}
int audio_ril_interface_set_mic_mute(struct tinyalsa_audio_ril_interface *ril_interface, bool state)
{
/*
* If you look at the Replicant libaudio-ril-interface
* this function is just stubbed out there. So let's not
* bother with it
*/
return 0;
}
int audio_ril_interface_set_voice_volume(struct tinyalsa_audio_ril_interface *ril_interface,
audio_devices_t device, float volume)
@ -212,6 +203,15 @@ error:
return -1;
}
int audio_ril_interface_set_mic_mute(struct tinyalsa_audio_ril_interface *ril_interface, enum ril_mic_mute state)
{
if (audio_ril_interface_connect_if_required(ril_interface))
return 0;
return _ril_set_mic_mute(ril_interface->interface, state);
}
int audio_ril_interface_set_twomic(struct tinyalsa_audio_ril_interface *ril_interface, enum ril_twomic_enable twomic)
{
int rc;
@ -322,7 +322,7 @@ int audio_ril_interface_open(struct audio_hw_device *dev, audio_devices_t device
_ril_set_call_audio_path = dlsym(dl_handle, "SetCallAudioPath");
_ril_set_call_clock_sync = dlsym(dl_handle, "SetCallClockSync");
_ril_set_call_twomic = dlsym(dl_handle, "SetTwoMicControl");
_ril_set_mic_mute = dlsym(dl_handle, "SetMute");
_ril_register_unsolicited_handler = dlsym(dl_handle,
"RegisterUnsolicitedHandler");
/* since this function is not supported in all RILs, don't require it */
@ -330,7 +330,8 @@ int audio_ril_interface_open(struct audio_hw_device *dev, audio_devices_t device
if (!_ril_open_client || !_ril_close_client || !_ril_connect ||
!_ril_is_connected || !_ril_disconnect || !_ril_set_call_volume ||
!_ril_set_call_audio_path || !_ril_set_call_clock_sync ||
!_ril_set_call_audio_path || !_ril_set_mic_mute ||
!_ril_set_call_clock_sync ||
!_ril_register_unsolicited_handler || !_ril_set_call_twomic) {
ALOGE("Cannot get symbols from '%s'", RIL_CLIENT_LIBPATH);
dlclose(dl_handle);

View File

@ -82,7 +82,14 @@ enum ril_twomic_enable {
TWO_MIC_SOLUTION_ON
};
int audio_ril_interface_set_mic_mute(struct tinyalsa_audio_ril_interface *ril_interface, bool state);
enum ril_mic_mute {
MIC_UNMUTE,
MIC_MUTE
};
int audio_ril_interface_set_mic_mute(struct tinyalsa_audio_ril_interface *ril_interface, enum ril_mic_mute);
int audio_ril_interface_set_voice_volume(struct tinyalsa_audio_ril_interface *ril_interface, audio_devices_t device, float volume);
int audio_ril_interface_set_route(struct tinyalsa_audio_ril_interface *ril_interface, audio_devices_t device);
int audio_ril_interface_set_twomic(struct tinyalsa_audio_ril_interface *ril_interface, enum ril_twomic_enable);

View File

@ -276,7 +276,7 @@ void tinyalsa_mixer_config_start(void *data, const XML_Char *elem,
config_data->io_props.channel_mask = AUDIO_CHANNEL_OUT_STEREO;
break;
case 4:
config_data->io_props.channel_mask = AUDIO_CHANNEL_OUT_SURROUND;
config_data->io_props.channel_mask = AUDIO_CHANNEL_OUT_QUAD_SIDE;
break;
case 6:
config_data->io_props.channel_mask = AUDIO_CHANNEL_OUT_5POINT1;