Skip to content

Commit

Permalink
Pinephone: initial RIL + GPS support
Browse files Browse the repository at this point in the history
Needs much more work + cleanups to get it fully working and not break
other glodrod devices

    Make and receive calls are working
    Audio/mic in call are not working
    SMS/MMS are not working
    Mobile data is not working
    GPS fix will need ~20 min
  • Loading branch information
bauner committed Sep 17, 2020
1 parent df54294 commit 91e328f
Show file tree
Hide file tree
Showing 23 changed files with 274 additions and 28 deletions.
21 changes: 0 additions & 21 deletions common/Android.mk
Original file line number Diff line number Diff line change
@@ -1,27 +1,6 @@
include device/generic/goldfish/gatekeeper/Android.mk
include device/linaro/hikey/libmemtrack/Android.mk


include $(CLEAR_VARS)
LOCAL_MODULE := remove-BlockedNumberProvider
EXECUTABLES.remove-BlockedNumberProvider.OVERRIDES := BlockedNumberProvider
include $(BUILD_PHONY_PACKAGE)

include $(CLEAR_VARS)
LOCAL_MODULE := remove-TeleService
EXECUTABLES.remove-TeleService.OVERRIDES := TeleService
include $(BUILD_PHONY_PACKAGE)

include $(CLEAR_VARS)
LOCAL_MODULE := remove-MmsService
EXECUTABLES.remove-MmsService.OVERRIDES := MmsService
include $(BUILD_PHONY_PACKAGE)

include $(CLEAR_VARS)
LOCAL_MODULE := remove-Telecom
EXECUTABLES.remove-Telecom.OVERRIDES := Telecom
include $(BUILD_PHONY_PACKAGE)

include $(CLEAR_VARS)
LOCAL_MODULE := remove-Bluetooth
EXECUTABLES.remove-Bluetooth.OVERRIDES := Bluetooth
Expand Down
4 changes: 2 additions & 2 deletions common/boardconfig-common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ BOARD_USES_PRODUCTIMAGE := true
BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE := ext4

# Enable dex-preoptimization to speed up first boot sequence
DEX_PREOPT_DEFAULT := nostripping
WITH_DEXPREOPT := true
WITH_DEXPREOPT_BOOT_IMG_AND_SYSTEM_SERVER_ONLY := true
DONT_DEXPREOPT_PREBUILTS = true
ART_USE_HSPACE_COMPACT := true

DEVICE_MANIFEST_FILE := device/glodroid/common/manifest.xml
Expand Down
8 changes: 3 additions & 5 deletions common/device-common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ endif
PRODUCT_SHIPPING_API_LEVEL := 29

# Set custom settings
DEVICE_PACKAGE_OVERLAYS := device/linaro/hikey/overlay
## -> remove non phone overlay
#DEVICE_PACKAGE_OVERLAYS := device/linaro/hikey/overlay
## <-
ifneq (,$(filter $(DEVICE_TYPE),tv))
# Set TV Custom Settings
DEVICE_PACKAGE_OVERLAYS += device/google/atv/overlay
Expand Down Expand Up @@ -79,10 +81,6 @@ PRODUCT_PACKAGES += \
# Remove phone packages that added by default product configuration
PRODUCT_PACKAGES += \
remove-android.hardware.configstore@1.1-service \
remove-BlockedNumberProvider \
remove-Telecom \
remove-TeleService \
remove-MmsService \

PRODUCT_PACKAGES += libGLES_android

Expand Down
8 changes: 8 additions & 0 deletions common/init.common.rc
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ on early-init
chmod 0660 /sys/class/rfkill/rfkill0/state
chown bluetooth net_bt /sys/class/rfkill/rfkill0/device/extldo
chmod 0660 /sys/class/rfkill/rfkill0/device/extldo
chmod 0777 /proc/cmdline
write /sys/class/modem-power/modem-power/device/powered 1


on fs
mount_all /vendor/etc/fstab.${ro.hardware} --early
Expand Down Expand Up @@ -65,6 +68,11 @@ service wpa_supplicant /vendor/bin/hw/wpa_supplicant \
disabled
oneshot

service ril-daemon /vendor/bin/hw/rild -l /vendor/lib64/libquectel-ril.so
class main
user root
group radio cache inet misc audio sdcard_rw log

service bugreport /system/bin/dumpstate -d -p -B -z \
-o /data/user_de/0/com.android.shell/files/bugreports/bugreport
class main
Expand Down
3 changes: 3 additions & 0 deletions common/ueventd.common.rc
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ modalias_handling enabled
/dev/tee0 0660 system keystore
/dev/teepriv0 0660 system keystore
/dev/ttyUSB0 0666 system system
/dev/ttyUSB1 0666 system system
/dev/ttyUSB2 0666 system system
/dev/ttyUSB3 0666 system system
/dev/block/platform/soc/1c0f000.mmc/by-name/vendor 0600 system system
/dev/block/platform/soc/1c0f000.mmc/by-name/userdata 0600 system system
/dev/rfkill 0660 bluetooth net_bt
Expand Down
2 changes: 2 additions & 0 deletions pinephone/BoardConfig.mk
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,7 @@ TARGET_2ND_CPU_VARIANT := cortex-a15

TARGET_BOARD_INFO_FILE := device/glodroid/pinephone/board-info.txt

BOARD_KERNEL_CMDLINE += androidboot.selinux=permissive

DEVICE_MANIFEST_FILE += device/glodroid/pinephone/manifest.xml
BOARD_VENDOR_SEPOLICY_DIRS += device/glodroid/pinephone/sepolicy/vendor
65 changes: 65 additions & 0 deletions pinephone/device.mk
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,39 @@
# Copyright (C) 2020 Roman Stratiienko (r.stratiienko@gmail.com)

$(call inherit-product, $(SRC_TARGET_DIR)/product/core_64_bit.mk)
$(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_base_telephony.mk)
$(call inherit-product, device/glodroid/common/device-common.mk)
$(call inherit-product, device/glodroid/common/device-common-sunxi.mk)
$(call inherit-product, device/glodroid/common/bluetooth/bluetooth.mk)

PRODUCT_PROPERTY_OVERRIDES += qemu.sf.lcd_density=269

# Phone
IS_PHONE := true
PRODUCT_PROPERTY_OVERRIDES += \
qemu.sf.lcd_density=269 \
hw.nophone=no \
ro.boot.noril=no \
ro.radio.noril=no \
ro.telephony.default_network=10 \
keyguard.no_require_sim=true \
ril.function.dataonly=0 \
persist.telephony.support.ipv6=1 \
persists.telephony.support.ipv4=1 \
telephony.lteOnGsmDevice=1 \
telephony.lteOnCdmaDevice=0 \
ro.telephony.call_ring.delay=0 \
ro.ril.enable.amr.wideband=1 \
ring.delay=0 \
ro.config.vc_call_steps=20 \
persist.cust.tel.eons=1 \
ro.config.hw_fast_dormancy=1 \
ro.radio.networkmode=enable \
persist.audio.fluence.voicecall=false \
ro.com.android.dataroaming=false
ro.telephony.get_imsi_from_sim=true \
ro.telephony.ril.config=simactivation

# Firmware
PRODUCT_COPY_FILES += \
kernel/firmware/rtlbt/rtl8723cs_xx_fw:$(TARGET_COPY_OUT_VENDOR)/etc/firmware/rtl_bt/rtl8723cs_xx_fw.bin \
Expand All @@ -20,6 +47,41 @@ PRODUCT_COPY_FILES += \
$(LOCAL_PATH)/vibrator.pinephone.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/vibrator.pinephone.rc \
$(LOCAL_PATH)/sensors.pinephone.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/sensors.pinephone.rc \

# RIL
PRODUCT_COPY_FILES += \
$(LOCAL_PATH)/ril/chat:$(TARGET_COPY_OUT_SYSTEM)/bin/chat \
$(LOCAL_PATH)/ril/ip-down:$(TARGET_COPY_OUT_SYSTEM)/etc/ppp/ip-down \
$(LOCAL_PATH)/ril/ip-up:$(TARGET_COPY_OUT_SYSTEM)/etc/ppp/ip-up \
$(LOCAL_PATH)/ril/libquectel-ril.so:$(TARGET_COPY_OUT_VENDOR)/lib64/libquectel-ril.so \
$(LOCAL_PATH)/ril/ql-ril.conf:$(TARGET_COPY_OUT_SYSTEM)/etc/ql-ril.conf \
$(LOCAL_PATH)/ril/QAndroidLog:$(TARGET_COPY_OUT_SYSTEM)/bin/QAndroidLog \
$(LOCAL_PATH)/ril/QFirehose:$(TARGET_COPY_OUT_SYSTEM)/bin/QFirehose \
frameworks/native/data/etc/handheld_core_hardware.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/handheld_core_hardware.xml \
frameworks/native/data/etc/android.hardware.audio.low_latency.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.audio.low_latency.xml \
frameworks/native/data/etc/android.hardware.telephony.gsm.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.telephony.gsm.xml \
frameworks/native/data/etc/android.hardware.telephony.cdma.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.telephony.cdma.xml \
frameworks/native/data/etc/android.software.sip.voip.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.sip.voip.xml \
frameworks/av/media/libstagefright/data/media_codecs_google_telephony.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_codecs_google_telephony.xml \
device/sample/etc/apns-full-conf.xml:$(TARGET_COPY_OUT_SYSTEM)/etc/apns-conf.xml \

#GPS
PRODUCT_PACKAGES += \
android.hardware.gnss@1.0-impl \
android.hardware.gnss@1.0-service

PRODUCT_COPY_FILES += \
$(LOCAL_PATH)/gps/gps.default.so:$(TARGET_COPY_OUT_VENDOR)/lib64/hw/gps.default.so \
$(LOCAL_PATH)/gps/libstdc++.so:$(TARGET_COPY_OUT_VENDOR)/lib64/libstdc++.so \
$(LOCAL_PATH)/gps/gps_cfg.inf:$(TARGET_COPY_OUT_SYSTEM)/etc/gps_cfg.inf \
$(LOCAL_PATH)/gps/gps.cfg:$(TARGET_COPY_OUT_SYSTEM)etc/gps.cfg \
frameworks/native/data/etc/android.hardware.location.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.location.xml \
frameworks/native/data/etc/android.hardware.location.gps.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.location.gps.xml

PRODUCT_PROPERTY_OVERRIDES += \
ro.kernel.android.gps=ttyUSB1 \
ro.kernel.android.gps.speed=115200 \
ro.kernel.android.gps.max_rate=1

PRODUCT_COPY_FILES += \
device/glodroid/pinephone/audio.pinephone.xml:$(TARGET_COPY_OUT_VENDOR)/etc/audio.pinephone.xml \

Expand All @@ -28,6 +90,9 @@ PRODUCT_PACKAGES += \
android.hardware.light@2.0-impl:64 \
android.hardware.light@2.0-service

PRODUCT_PACKAGES += \
gpstest

PRODUCT_PACKAGES += \
sensors.iio \
android.hardware.sensors@1.0-impl:64 \
Expand Down
54 changes: 54 additions & 0 deletions pinephone/gps/gps.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
NTP_SERVER=0.de.pool.ntp.org
NTP_SERVER=1.de.pool.ntp.org
NTP_SERVER=2.de.pool.ntp.org
NTP_SERVER=3.de.pool.ntp.org
NTP_SERVER=0.europe.pool.ntp.org
NTP_SERVER=1.europe.pool.ntp.org
NTP_SERVER=2.europ.pool.ntp.org
NTP_SERVER=3.europe.pool.ntp.org
NTP_SERVER=de.pool.ntp.org <-This is changed from the top line to here. It may works better if we put it here.

XTRA_SERVER_1=http://xtra1.gpsonextra.net/xtra.bin
XTRA_SERVER_2=http://xtra2.gpsonextra.net/xtra.bin
XTRA_SERVER_3=http://xtra3.gpsonextra.net/xtra.bin

# DEBUG LEVELS: 0 - none, 1 - Error, 2 - Warning, 3 - Info
# 4 - Debug, 5 - Verbose
DEBUG_LEVEL =0

# Intermediate position report, 1=enable, 0=disable
INTERMEDIATE_POS=0

# Accuracy threshold for intermediate positions
# less accurate positions are ignored, 0 for passing all positions
ACCURACY_THRES=0

# Report supl ref location as position, 1=enable, 0=disable
REPORT_POSITION_USE_SUPL_REFLOC=1

# Wiper (wifi positioning), 1=enable, 0=disable
ENABLE_WIPER=1

################################
##### AGPS server settings #####
################################

# FOR SUPL SUPPORT, set the following
SUPL_HOST=supl.google.com
SUPL_PORT=7276
SUPL_NO_SECURE_PORT=3425
SUPL_SECURE_PORT=7275
SUPL_TLS_HOST=FQDN
SUPL_TLS_CERT=/etc/SuplRootCert

# FOR C2K PDE SUPPORT, set the following
C2K_HOST=c2k.pde.com
C2K_PORT=1234

CURRENT_CARRIER=common
DEFAULT_AGPS_ENABLE=TRUE
DEFAULT_SSL_ENABLE=FALSE

# TRUE for "User Plane", FALSE for "Control Plane"
DEFAULT_USER_PLANE=TRUE

Binary file added pinephone/gps/gps.default.so
Binary file not shown.
20 changes: 20 additions & 0 deletions pinephone/gps/gps_cfg.inf
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#you can modify this config file to adapt your demand.
#the line start with ';' means not support
#the line start with '#' means use default config

NMEA_PORT_PATH=rild-nmea
;RMC_HZ=1
;NMEA_PORT_PATH=/dev/ttyO1
;BAUD_RATE=9600
;DATA_BITS=8
;STOP_BITS=1
;PARITY_TYPE=N
;FLOW_CONTROL=N
;LOG_LEVEL=LOG_DEBUG

;LOG_TYPE=
;LOG_PATH=
;FUNC_NMEA=
;FUNC_XTRA=
;FUNC_AGPS
;I2C_ADDR=
Binary file added pinephone/gps/libstdc++.so
Binary file not shown.
21 changes: 21 additions & 0 deletions pinephone/gpstest/Android.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)

LOCAL_MODULE_TAGS := optional

LOCAL_MODULE := gpstest

LOCAL_SRC_FILES := $(LOCAL_MODULE).apk

LOCAL_MODULE_CLASS := APPS

LOCAL_CERTIFICATE := platform

LOCAL_PRIVILEGED_MODULE := true

LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX)

# TODO: Move to /vendor partition
LOCAL_MODULE_PATH := $(TARGET_OUT)/priv-app

include $(BUILD_PREBUILT)
Binary file added pinephone/gpstest/gpstest.apk
Binary file not shown.
36 changes: 36 additions & 0 deletions pinephone/manifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,40 @@
<instance>default</instance>
</interface>
</hal>
<hal format="hidl">
<name>android.hardware.broadcastradio</name>
<transport>hwbinder</transport>
<version>1.0</version>
<interface>
<name>IBroadcastRadioFactory</name>
<instance>default</instance>
</interface>
</hal>
<hal format="hidl">
<name>android.hardware.radio.deprecated</name>
<transport>hwbinder</transport>
<version>1.0</version>
<interface>
<name>IOemHook</name>
<instance>slot1</instance>
</interface>
</hal>
<hal format="hidl">
<name>android.hardware.radio</name>
<transport>hwbinder</transport>
<version>1.0</version>
<interface>
<name>IRadio</name>
<instance>slot1</instance>
</interface>
</hal>
<hal format="hidl">
<name>android.hardware.gnss</name>
<transport>hwbinder</transport>
<version>1.0</version>
<interface>
<name>IGnss</name>
<instance>default</instance>
</interface>
</hal>
</manifest>
20 changes: 20 additions & 0 deletions pinephone/overlay/frameworks/base/core/res/res/values/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,24 @@
Sleep is buggy, set to 10 hours on pinephone as a temporary workaround.
-->
<integer name="config_minimumScreenOffTimeout">36000000</integer>

<!-- Boolean indicating if restoring network selection should be skipped -->
<!-- The restoring is handled by modem if it is true -->
<bool translatable="false" name="skip_restoring_network_selection">true</bool>

<!-- This device is not "voice capable"; it's data-only. -->
<bool name="config_voice_capable">true</bool>

<!-- This device does not allow sms service. -->
<bool name="config_sms_capable">true</bool>

<bool name="config_showNavigationBar">true</bool>


<string-array translatable="false" name="networkAttributes">
<item>"wifi,1,1,1,-1,true"</item>
<item>"mobile,0,0,1,-1,true"</item>
<item>"ethernet,9,9,2,-1,true"</item>
</string-array>

</resources>
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2017 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.
-->

<!-- Phone app resources that may need to be customized
for different hardware or product builds. -->
<resources>
<!-- Show enabled lte option for lte device -->
<bool name="config_enabled_lte" translatable="false">true</bool>

</resources>
Binary file added pinephone/ril/QAndroidLog
Binary file not shown.
Binary file added pinephone/ril/QFirehose
Binary file not shown.
Binary file added pinephone/ril/chat
Binary file not shown.
Binary file added pinephone/ril/ip-down
Binary file not shown.
Binary file added pinephone/ril/ip-up
Binary file not shown.
Binary file added pinephone/ril/libquectel-ril.so
Binary file not shown.
17 changes: 17 additions & 0 deletions pinephone/ril/ql-ril.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#This file is in a state of unavailability.
#In most cases, there is no need to open any option.
#In special cases, please use it under the guidance of FAE.

#LTE_SignalStrength=-1
#LTE_Is_Report_SignalStrength=1
#At_Cmds_For_Customer_Initialize=at+csq;at+cgreg?;at+cops?;at+qcfg="nwscanmodeex"
#Icc_Constants=EF_ICCID
#support_CDMPhone=1
#URC_delay_mseconds=2000
#Query_Available_Networks=1
#Sim_Hot_Plugging=1 #0-not support; 1-support low level; 2-support high level
#Recovery_App=
#ATT_Test=1
#need_switch_CMT_to_CMTI=1
#RevokeClientIDIndication=1
#PS_ONLY=1

0 comments on commit 91e328f

Please sign in to comment.