Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/blobs/carrier-db-overrides.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { CarrierConfig_Config } from '../proto-ts/packages/apps/CarrierConfig2/src/com/google/carrier/carrier_settings'

export interface CarrierDbOverride {
name: string
carrier_id: number
Expand All @@ -20,3 +22,9 @@ export const CARRIER_DB_OVERRIDES: CarrierDbOverride[] = [
gid2: '%',
},
]

// Per-carrier CarrierSettings config overrides applied after extraction/download.
export const CARRIER_SETTINGS_PATCHES: Record<string, CarrierConfig_Config[]> = {
cape_us: [{ key: 'carrier_volte_available_bool', boolValue: true }],
cape_ca: [{ key: 'carrier_volte_available_bool', boolValue: true }],
}
27 changes: 27 additions & 0 deletions src/blobs/carrier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { SmartBuffer } from 'smart-buffer'
import { promises as stream } from 'stream'
import { DeviceConfig } from '../config/device'
import { CARRIER_SETTINGS_DIR, getHostBinPath, OS_CHECKOUT_DIR } from '../config/paths'
import { CARRIER_SETTINGS_PATCHES } from './carrier-db-overrides'
import { CarrierList } from '../proto-ts/packages/apps/CarrierConfig2/src/com/google/carrier/carrier_list'
import {
CarrierSettings,
Expand Down Expand Up @@ -248,3 +249,29 @@ export async function getVersionsMap(dir: string): Promise<Map<string, number>>
export function getCarrierSettingsUpdatesDir(config: DeviceConfig) {
return path.join(CARRIER_SETTINGS_DIR, config.device.vendor, config.device.name)
}

export async function patchCarrierSettings(csDir: string) {
for (const [carrierName, patches] of Object.entries(CARRIER_SETTINGS_PATCHES)) {
const pbFile = path.join(csDir, `${carrierName}.pb`)
if (!(await exists(pbFile))) {
continue
}
const data = await fs.readFile(pbFile)
const settings = CarrierSettings.decode(data)
if (!settings.configs) {
settings.configs = { config: [] }
}
for (const entry of patches) {
const i = settings.configs.config.findIndex(c => c.key === entry.key)
if (i >= 0) {
settings.configs.config[i] = entry
} else {
settings.configs.config.push(entry)
}
}
const encoded = CarrierSettings.encode(settings).finish()
await fs.chmod(pbFile, 0o644)
await fs.writeFile(pbFile, encoded)
log(`Patched carrier settings: ${carrierName}`)
}
}
2 changes: 2 additions & 0 deletions src/commands/generate-all.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
fetchUpdateConfig,
getCarrierSettingsUpdatesDir,
getVersionsMap,
patchCarrierSettings,
} from '../blobs/carrier'
import { copyBlobs } from '../blobs/copy'
import { BlobEntry } from '../blobs/entry'
Expand Down Expand Up @@ -299,6 +300,7 @@ export default class GenerateFull extends Command {
await fs.copyFile(file, destFile)
}
}
await patchCarrierSettings(dstCsDir)
}

if (flags.updateSpec) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
canonical_name: "cape_ca"
version: 75000000001
configs {
config {
key: "carrier_volte_available_bool"
bool_value: true
}
}
last_updated {
seconds: 1762942384
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
canonical_name: "cape_us"
version: 75000000001
configs {
config {
key: "carrier_volte_available_bool"
bool_value: true
}
}
last_updated {
seconds: 1762942384
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
canonical_name: "cape_ca"
version: 75000000001
configs {
config {
key: "carrier_volte_available_bool"
bool_value: true
}
}
last_updated {
seconds: 1762942431
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
canonical_name: "cape_us"
version: 75000000001
configs {
config {
key: "carrier_volte_available_bool"
bool_value: true
}
}
last_updated {
seconds: 1762942431
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
canonical_name: "cape_ca"
version: 75000000001
configs {
config {
key: "carrier_volte_available_bool"
bool_value: true
}
}
last_updated {
seconds: 1762942302
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
canonical_name: "cape_us"
version: 75000000001
configs {
config {
key: "carrier_volte_available_bool"
bool_value: true
}
}
last_updated {
seconds: 1762942302
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
canonical_name: "cape_ca"
version: 75000000001
configs {
config {
key: "carrier_volte_available_bool"
bool_value: true
}
}
last_updated {
seconds: 1762942401
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
canonical_name: "cape_us"
version: 75000000001
configs {
config {
key: "carrier_volte_available_bool"
bool_value: true
}
}
last_updated {
seconds: 1762942401
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
canonical_name: "cape_ca"
version: 75000000001
configs {
config {
key: "carrier_volte_available_bool"
bool_value: true
}
}
last_updated {
seconds: 1762942317
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
canonical_name: "cape_us"
version: 75000000001
configs {
config {
key: "carrier_volte_available_bool"
bool_value: true
}
}
last_updated {
seconds: 1762942317
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
canonical_name: "cape_ca"
version: 75000000001
configs {
config {
key: "carrier_volte_available_bool"
bool_value: true
}
}
last_updated {
seconds: 1762942401
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
canonical_name: "cape_us"
version: 75000000001
configs {
config {
key: "carrier_volte_available_bool"
bool_value: true
}
}
last_updated {
seconds: 1762942401
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
canonical_name: "cape_ca"
version: 75000000001
configs {
config {
key: "carrier_volte_available_bool"
bool_value: true
}
}
last_updated {
seconds: 1762942333
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
canonical_name: "cape_us"
version: 75000000001
configs {
config {
key: "carrier_volte_available_bool"
bool_value: true
}
}
last_updated {
seconds: 1762942333
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
canonical_name: "cape_ca"
version: 75000000001
configs {
config {
key: "carrier_volte_available_bool"
bool_value: true
}
}
last_updated {
seconds: 1762942431
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
canonical_name: "cape_us"
version: 75000000001
configs {
config {
key: "carrier_volte_available_bool"
bool_value: true
}
}
last_updated {
seconds: 1762942431
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
canonical_name: "cape_ca"
version: 75000000001
configs {
config {
key: "carrier_volte_available_bool"
bool_value: true
}
}
last_updated {
seconds: 1762942367
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
canonical_name: "cape_us"
version: 75000000001
configs {
config {
key: "carrier_volte_available_bool"
bool_value: true
}
}
last_updated {
seconds: 1762942367
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
canonical_name: "cape_ca"
version: 75000000001
configs {
config {
key: "carrier_volte_available_bool"
bool_value: true
}
}
last_updated {
seconds: 1762942401
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
canonical_name: "cape_us"
version: 75000000001
configs {
config {
key: "carrier_volte_available_bool"
bool_value: true
}
}
last_updated {
seconds: 1762942401
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
canonical_name: "cape_ca"
version: 75000000001
configs {
config {
key: "carrier_volte_available_bool"
bool_value: true
}
}
last_updated {
seconds: 1762942351
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
canonical_name: "cape_us"
version: 75000000001
configs {
config {
key: "carrier_volte_available_bool"
bool_value: true
}
}
last_updated {
seconds: 1762942351
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
canonical_name: "cape_ca"
version: 75000000001
configs {
config {
key: "carrier_volte_available_bool"
bool_value: true
}
}
last_updated {
seconds: 1762942431
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
canonical_name: "cape_us"
version: 75000000001
configs {
config {
key: "carrier_volte_available_bool"
bool_value: true
}
}
last_updated {
seconds: 1762942431
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
canonical_name: "cape_ca"
version: 75000000001
configs {
config {
key: "carrier_volte_available_bool"
bool_value: true
}
}
last_updated {
seconds: 1762942285
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
canonical_name: "cape_us"
version: 75000000001
configs {
config {
key: "carrier_volte_available_bool"
bool_value: true
}
}
last_updated {
seconds: 1762942285
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
canonical_name: "cape_ca"
version: 75000000001
configs {
config {
key: "carrier_volte_available_bool"
bool_value: true
}
}
last_updated {
seconds: 1762942317
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
canonical_name: "cape_us"
version: 75000000001
configs {
config {
key: "carrier_volte_available_bool"
bool_value: true
}
}
last_updated {
seconds: 1762942317
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
canonical_name: "cape_ca"
version: 75000000001
configs {
config {
key: "carrier_volte_available_bool"
bool_value: true
}
}
last_updated {
seconds: 1762942431
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
canonical_name: "cape_us"
version: 75000000001
configs {
config {
key: "carrier_volte_available_bool"
bool_value: true
}
}
last_updated {
seconds: 1762942431
Expand Down
Loading