Mulai 27 Maret 2025, sebaiknya gunakan android-latest-release, bukan aosp-main, untuk mem-build dan berkontribusi pada AOSP. Untuk mengetahui informasi selengkapnya, lihat Perubahan pada AOSP.
Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
AOSP menawarkan opsi berikut untuk menyimpan informasi konfigurasi di
perangkat:
Properti sistem
Properti hardware abstraction layer (HAL)
File XML konfigurasi sistem
Overlay resource (statis dan runtime)
Properti sistem
Properti sistem adalah pasangan nilai kunci string yang disimpan dalam kamus global
build.prop. Properti sistem adalah resource seluruh sistem yang mudah
digunakan dan memiliki overhead performa yang rendah. Saat menggunakan properti sistem, Anda tidak
perlu menggunakan komunikasi antarproses (IPC) meskipun properti sistem dibagikan
di beberapa proses. Namun, properti sistem mirip dengan variabel
global dan dapat berbahaya jika disalahgunakan. Penyalahgunaan properti sistem dapat
menyebabkan masalah seperti kerentanan keamanan dan aplikasi menjadi tidak dapat diakses
oleh pengguna. Sebelum menggunakan properti sistem untuk menyimpan informasi konfigurasi,
pertimbangkan opsi konfigurasi lainnya.
Jika sumber tepercaya untuk konfigurasi berasal dari komponen hardware di
perangkat, HAL untuk hardware harus memberikan informasi untuk
komponen tersebut. Tentukan metode HAL baru di HAL yang ada untuk mengakses
konfigurasi. Untuk informasi lebih lanjut tentang cara mengembangkan HAL, lihat
AIDL untuk HAL.
File XML konfigurasi sistem
Jika data konfigurasi bersifat statis tetapi rumit (terstruktur), pertimbangkan untuk menggunakan XML atau format serupa lainnya untuk data konfigurasi. Pastikan
skema file tetap stabil. Untuk file XML, Anda dapat menggunakan
xsd_config
agar skema tetap stabil, dan untuk memanfaatkan parser XML
yang dibuat secara otomatis.
Overlay resource
Anda dapat menggunakan overlay resource untuk menyesuaikan produk. Ada dua jenis
overlay resource:
Overlay resource standar yang digunakan untuk menyesuaikan produk pada waktu build. Untuk mengetahui informasi
tentang overlay resource standar, lihat
Menyesuaikan build dengan overlay resource.
Overlay resource runtime (RRO) digunakan untuk mengubah nilai resource
paket target saat runtime. Misalnya, aplikasi yang diinstal pada image
sistem dapat mengubah perilakunya berdasarkan nilai resource. Daripada
melakukan hardcoding nilai resource pada waktu build, RRO yang diinstal di
partisi lain dapat mengubah nilai resource aplikasi saat runtime. Untuk mengetahui informasi
selengkapnya tentang RRO, lihat
Mengubah nilai resource aplikasi saat runtime.
Konten dan contoh kode di halaman ini tunduk kepada lisensi yang dijelaskan dalam Lisensi Konten. Java dan OpenJDK adalah merek dagang atau merek dagang terdaftar dari Oracle dan/atau afiliasinya.
Terakhir diperbarui pada 2025-07-27 UTC.
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Informasi yang saya butuhkan tidak ada","missingTheInformationINeed","thumb-down"],["Terlalu rumit/langkahnya terlalu banyak","tooComplicatedTooManySteps","thumb-down"],["Sudah usang","outOfDate","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Masalah kode / contoh","samplesCodeIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 2025-07-27 UTC."],[],[],null,["# Configuration overview\n\nAOSP offers the following options for storing configuration information on a\ndevice:\n\n- System properties\n- Hardware abstraction layer (HAL) properties\n- System config XML files\n- Resource overlays (static and runtime)\n\nSystem properties\n-----------------\n\n*System properties* are string key/value pairs stored in the `build.prop`\nglobal dictionary. System properties are system-wide resources that are easy to\nuse and have a low performance overhead. When using system properties, you don't\nneed to use interprocess communication (IPC) even if a system property is shared\nacross multiple processes. However, system properties are similar to global\nvariables and can be harmful when misused. The misuse of system properties can\nresult in issues such as security vulnerabilities and apps becoming inaccessible\nto users. Before using system properties to store configuration information,\nconsider the other configuration options.\n\nFor further information on system properties, see\n[Add system properties](/docs/core/architecture/configuration/add-system-properties)\n| **Note:** Previous to Android 10, AOSP used a ConfigStore HAL to store system properties. ConfigStore HAL is deprecated and should no longer be used. For information on the ConfigStore HAL, refer to [ConfigStore HAL](/docs/core/architecture/configuration/archive).\n\nHAL properties\n--------------\n\nWhen the source of truth for a configuration is from a hardware component on a\ndevice, the HAL for the hardware must provide the information for that\ncomponent. Define a new HAL method in the existing HAL for accessing the\nconfiguration. For further information on developing a HAL, see\n[AIDL for HALs](/docs/core/architecture/aidl/aidl-hals).\n| **Note:** Don't configure the HAL to use system properties as a side-channel communication mechanism for HALs.\n\nSystem config XML files\n-----------------------\n\nWhen the configuration data is static but complicated (structured), consider\nusing XML or other such formats for the configuration data. Ensure that the\nfile schema remains stable. For XML files, you can use\n[`xsd_config`](/docs/core/architecture/config-file-schema-api#config-build-rule)\nto keep the schema stable, and to take advantage of an autogenerated XML\nparser.\n\nResource overlay\n----------------\n\nYou can use resource overlays to customize a product. There are two types of\nresource overlays:\n\n- *Standard resource overlay* used to customize a product at build time. Foris\n information on standard resource overlays, see\n [Customizing the build with resource overlays](/docs/setup/create/new-device#use-resource-overlays).\n\n- *Runtime resource overlay (RRO)* is used to change the resource values\n of a target package at runtime. For example, an app installed on the system\n image might change its behavior based upon the value of a resource. Rather than\n hardcoding the resource value at build time, an RRO installed on a different\n partition can change the values of the app's resources at runtime. For more\n information on RROs, see\n [Change the value of an app's resources at runtime](/docs/core/runtime/rros)."]]