[R] ModemConfig: Implement properties using sysprop

Signed-off-by: Marijn Suijten <marijns95@gmail.com>
This commit is contained in:
Marijn Suijten 2020-09-09 22:39:47 +02:00
commit e9db620081
5 changed files with 52 additions and 0 deletions

View file

@ -9,6 +9,8 @@ android_app {
required: ["privapp_whitelist_com.sony.opentelephony.modemconfig"],
libs: ["SomcModemProperties"],
sdk_version: "system_current",
}

View file

@ -28,6 +28,7 @@ import android.telephony.SubscriptionManager
import android.telephony.TelephonyManager
import android.text.TextUtils
import android.util.Log
import com.sony.opentelephony.modemconfig.SomcModemProperties
import org.xmlpull.v1.XmlPullParser
import java.nio.file.Files
import java.nio.file.Paths
@ -198,6 +199,14 @@ context.resources.getXml(R.xml.service_provider_sim_configs).use {
val name = findConfigurationName(this, tm)
val notificationText = if (name != null) {
val prop = "persist.somc.cust.modem${sub.simSlotIndex}"
Log.d(TAG, "Setting $prop to $name")
when (sub.simSlotIndex) {
0 -> SomcModemProperties.cust_modem_0(name)
1 -> SomcModemProperties.cust_modem_1(name)
else -> throw Exception("Unknown slotIdx ${sub.simSlotIndex}")
}
resources.getString(
R.string.notification_text_modem_configuration_resolved_modem_config,
name,

View file

@ -0,0 +1,9 @@
sysprop_library {
name: "SomcModemProperties",
proprietary: true,
srcs: ["SomcModemProperties.sysprop"],
property_owner: "Vendor",
api_packages: ["android.sysprop"],
}

View file

@ -0,0 +1,14 @@
### Updating sysprop files
#### Android 11 (R)
Optional when not lunched for a device:
```sh
lunch sdk # (Can use sdk-eng too)
export ALLOW_MISSING_DEPENDENCIES=true # Ignore errors about hostapd, wpa_supplicant etc missing
```
```sh
build/soong/scripts/gen-sysprop-api-files.sh "vendor/oss/opentelephony/ModemConfig/sysprop" "SomcModemProperties"
m SomcModemProperties-dump-api && rm -rf vendor/oss/opentelephony/ModemConfig/sysprop/api/SomcModemProperties-current.txt && cp -f out/soong/.intermediates/vendor/oss/opentelephony/ModemConfig/sysprop/SomcModemProperties_sysprop_library/api-dump.txt vendor/oss/opentelephony/ModemConfig/sysprop/api/SomcModemProperties-current.txt
```

View file

@ -0,0 +1,18 @@
module: "com.sony.opentelephony.modemconfig.SomcModemProperties"
owner: Vendor
prop {
api_name: "cust_modem_0"
type: String
scope: Internal
access: ReadWrite
prop_name: "vendor.somc.cust.modem0"
}
prop {
api_name: "cust_modem_1"
type: String
scope: Internal
access: ReadWrite
prop_name: "vendor.somc.cust.modem1"
}