TWRP 2 Theme Reference Guide
TWRP 2 Theme Reference Guide:
Below is a list of all system variables for the XML engine in twrp2:
- tw_battery – current battery percentage
- tw_time – current time based on user selected time zone
- tw_busy – indicates that an operation is currently underway – use this to prevent buttons from working (e.g. home button), 0 is not busy and 1 is busy
- tw_operation_state – similar to tw_busy, but used to indicate when the operation is completed, 0 means operation underway and 1 means no operation
- tw_operation_status – used to indicate if an operation completed successfully or failed (0 indicates success and 1 is a failure)
- mounted – use in conjuction with a partition name or path to check if a partition is mounted or not, 0 for not mounted and 1 for mounted
- tw_boot_is_mountable – indicates if boot can be mounted as not all devices have a boot partition that is mountable, 0 for not mountable, 1 for can be mounted
- fileexists – use to see if a file or folder exists on the device, 0 means not exist, 1 means exists
- tw_sp1_name, tw_sp2_name, tw_sp3_name – names of special partitions that may be present on some devices (e.g. wimax, pds, efs), empty if not defined
- tw_backups_folder – folder location used for selecting a backup, string value
- tw_restore – used to indicate that the user has selected a backup folder
- tw_operation – name of the operation currently taking place (e.g. wipe, backup, restore)
- tw_partition – partition currently being operated on(e.g. system, data, boot), usually used in conjunction with tw_operation to say backup system
- tw_backup_system, tw_backup_data, tw_backup_boot, tw_backup_recovery, tw_backup_cache, tw_backup_andsec, tw_backup_sdext, tw_backup_sp1, tw_backup_sp2, tw_backup_sp3 – used to select which partitions to back up, 0 for not selected and 1 for selected
- tw_use_compression – used to select compression for backup, 0 for not selected and 1 for selected
- tw_skip_md5_generate – used select whether to generate a MD5 for each partition during backup, 0 for not selected and 1 for skip MD5 generation
- tw_restore_system, tw_restore_data, tw_restore_boot, tw_restore_recovery, tw_restore_cache, tw_restore_andsec, tw_restore_sdext, tw_restore_sp1, tw_restore_sp2, tw_restore_sp3 – used to indicate both if a partition is available for restoring and whether the user has chosen to restore that partition
- tw_skip_md5_check – used to skip MD5 checking during a restore, 0 for not selected and 1 for skipping MD5 checking
- tw_allow_partition_sdcard – used to indicate if the sdcard on this device can be partitioned (some devices do not have an actual sdcard slot and thus the “sdcard” should not be partitioned as this may damage the device), 1 means allow partitioning and 0 disallows partitioning
- tw_signed_zip_verify – zip signature checking, 0 disables, 1 enables
- tw_force_md5_check – forces a MD5 check on all zips before installing, 0 disables, 1 forces the check
- tw_rm_rf – uses rm –rf instead of formatting system and data partitions, this option is used to prevent changes to the file system settings such as file system type, block size, etc. that occur during a format, 0 uses normal formatting and 1 uses rm –rf (note that this does not prevent formatting via an install zip method)
- tw_time_zone_guisel – used to store the time zone and dst zone during time zone selection and separated by a semicolon (e.g. CST6;CDT)
- tw_time_zone_guidst – used to indicate whether the user’s time zone observes daylight savings time (DST), 0 for no DST and 1 for DST
- tw_time_zone_guioffset – number value of the time zone offset, usually 0, possible values are 0, 15, 30, and 45
- tw_time_zone – this is the current time zone (e.g. CST6CDT, note that the other values for time zone are used to stage or create this value, but changes to the other values don’t affect this value until they are committed with an action call to setguitimezone)
- tw_sdext_size – specifies the size of the sd-ext partition for sdcard partitioning, 0 means no sd-ext partition will be created
- tw_swap_size – specifies the size of the swap partition for sdcard partitioning, 0 means no swap partition will be created
- tw_sdpart_file_system – specifies the type of sd-ext partition to create – only ext3 and ext4 are officially supported, but other values may work
- tw_simulate_actions - indicates that simulation mode is active. Most actions like backup, restore, install zip, wipe, partition sdcard, etc will be simulated. Simulation mode is intended to make it easy for you to make a new theme without wearing out your device.
- tw_simulate_fail - indicates whether simulations should end in success or failure for theme testing.
- tw_has_recovery_partition - indicates if a recovery partition is present.
- tw_has_android_secure - indicates if android_secure is present.
- tw_has_sdext_partition - indicates if a sd-ext partition is present.
- tw_has_usb_storage - indicates if USB storage is available.
- tw_no_battery_percent - indicates if this device has a working battery meter.
- tw_has_dual_storage - indicates if this device has more than one storage location available.
- tw_use_external_storage - indicates whether to use internal or external storage for backup, restore, and zip installs.
- tw_reboot_system - indicates if reboot system is available.
- tw_reboot_recovery - indicates if reboot recovery is available.
- tw_reboot_poweroff - indicates if power off is available.
- tw_reboot_bootloader - indicates if reboot bootloader is available.
- tw_zip_index - used for zip queuing - which file number is currently being installed.
- tw_zip_queue_count - used for zip queuing - indicates the total number of zips that are queued.
- tw_ignore_image_size - used during backup - indicates whether to stop backup and display an error if the backup image does not match the partition size. (Some devices have bad blocks in boot or recovery which may prevent the backup size from matching - usually only on MTD devices)
Below is a list of all of the actions available in twrp 2’s XML engine:
- key – values can be home or back and tell the engine to go to the main page or go back to the page specified on the current page (if no action is speficied, then nothing will happen)
- page – specify a page name to switch pages
- wipe – specify a partition name to wipe that partition (e.g. /system)
- reboot – specify a reboot option to reboot (system, poweroff, recovery, bootloader)
- mount – specify a partition name to mount that partition (e.g. /system)
- umount – specify a partition name to unmount that partition (e.g. /system)
- nandroid – specify backup or restore to perform that operation
- readBackup –tells the system to check the tw_backups_folder that is currently selected and populate all of the tw_restore_ variables depending on what partitions are available
- restoredefaultsettings – restores all settings to their defaults
- set – specify variable name = value (e.g. tw_time_zone_guisel=CUT0;GDT) to change the value of a variable
- setguitimezone – commits a time zone change and updates the clock
- copylog – copies the recovery log to the sdcard as /sdcard/recovery.log
- partitionsd – partitions the sdcard
- fixpermissions – runs fix permissions script
- reload – reloads the theme from the sdcard
- compute (addsubtract) – allows you to add or subtract from a variable and is usually used for setting the partition sizes for sdcard partitioning (note that subtract won’t let you go below 0)
- queuezip - adds a new zip to the zip queue so long as a new zip queue slot is available (max of 10)
- cancelzip - removes the most recently added zip from the queue
- queueclear - clears the entire zip queue
- flash - flashes the zip queue
- sleep - sleeps for the specified time in microseconds
- refreshsizes - refreshes the backup sizes and free space for all partitions
- installhtcdumlock - installs HTC Dumlock to the current ROM (system)
- htcdumlockrestoreboot - restores the backup of boot made by HTC Dumlock
- htcdumlockreflashrecovery - reflashes recovery to boot
- cmd - runs a command line command
Actions should be run like this:
Note that not all actions require a value to be specified.