Documentation ¶
Index ¶
- Constants
- func IsResID(s string) bool
- type ActivityAction
- type ActivityCategory
- type ActivityIntentFilter
- type Apk
- type AppActivity
- type AppActivityAlias
- type Application
- type ChunkType
- type DataType
- type Flags
- type InputFlags
- type Instrumentation
- type Manifest
- type ResChunkHeader
- type ResID
- type ResStringPool
- type ResStringPoolHeader
- type ResStringPoolRef
- type ResStringPoolSpan
- type ResTableConfig
- func (c *ResTableConfig) IsBetterThan(o *ResTableConfig, r *ResTableConfig) bool
- func (c *ResTableConfig) IsLocaleBetterThan(o *ResTableConfig, r *ResTableConfig) bool
- func (c *ResTableConfig) IsLocaleMoreSpecificThan(o *ResTableConfig) int
- func (c *ResTableConfig) IsMoreSpecificThan(o *ResTableConfig) bool
- func (c *ResTableConfig) Locale() string
- func (c *ResTableConfig) Match(settings *ResTableConfig) bool
- type ResTableEntry
- type ResTableHeader
- type ResTablePackage
- type ResTableType
- type ResTableTypeSpec
- type ResValue
- type ResXMLTreeAttrExt
- type ResXMLTreeAttribute
- type ResXMLTreeEndElementExt
- type ResXMLTreeNamespaceExt
- type ResXMLTreeNode
- type ScreenLayout
- type TableEntry
- type TableFile
- type TablePackage
- type TableType
- type UIMode
- type UsesSDK
- type XMLFile
Constants ¶
const NilResStringPoolRef = ResStringPoolRef(0xFFFFFFFF)
NilResStringPoolRef is nil reference for string pool.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ActivityAction ¶
type ActivityAction struct {
Name string `xml:"name,attr"`
}
ActivityAction is an action of an activity.
type ActivityCategory ¶
type ActivityCategory struct {
Name string `xml:"name,attr"`
}
ActivityCategory is a category of an activity.
type ActivityIntentFilter ¶
type ActivityIntentFilter struct { Action ActivityAction `xml:"action"` Category ActivityCategory `xml:"category"` }
ActivityIntentFilter is an intent filter of an activity.
type Apk ¶
type Apk struct {
// contains filtered or unexported fields
}
Apk is an application package file for android.
func OpenZipReader ¶
OpenZipReader has same arguments like zip.NewReader
func (*Apk) Icon ¶
func (k *Apk) Icon(resConfig *ResTableConfig) (image.Image, error)
Icon returns the icon image of the APK.
func (*Apk) Label ¶
func (k *Apk) Label(resConfig *ResTableConfig) (s string, err error)
Label returns the label of the APK.
func (*Apk) MainActivity ¶
MainActivty returns the name of the main activity.
func (*Apk) PackageName ¶
PackageName returns the package name of the APK.
type AppActivity ¶
type AppActivity struct { Theme string `xml:"theme,attr"` Name string `xml:"name,attr"` Label string `xml:"label,attr"` IntentFilters []ActivityIntentFilter `xml:"intent-filter"` }
AppActivity is an activity in an application.
type AppActivityAlias ¶
type AppActivityAlias struct { Name string `xml:"name,attr"` Label string `xml:"label,attr"` TargetActivity string `xml:"targetActivity,attr"` IntentFilters []ActivityIntentFilter `xml:"intent-filter"` }
AppActivityAlias https://developer.android.com/guide/topics/manifest/activity-alias-element
type Application ¶
type Application struct { AllowTaskReparenting bool `xml:"allowTaskReparenting,attr"` AllowBackup bool `xml:"allowBackup,attr"` BackupAgent string `xml:"backupAgent,attr"` Debuggable bool `xml:"debuggable,attr"` Description string `xml:"description,attr"` Enabled bool `xml:"enabled,attr"` HasCode bool `xml:"hasCode,attr"` HardwareAccelerated bool `xml:"hardwareAccelerated,attr"` Icon string `xml:"icon,attr"` KillAfterRestore bool `xml:"killAfterRestore,attr"` LargeHeap bool `xml:"largeHeap,attr"` Label string `xml:"label,attr"` Logo string `xml:"logo,attr"` ManageSpaceActivity string `xml:"manageSpaceActivity,attr"` Name string `xml:"name,attr"` Permission string `xml:"permission,attr"` Persistent bool `xml:"persistent,attr"` Process string `xml:"process,attr"` RestoreAnyVersion bool `xml:"restoreAnyVersion,attr"` RequiredAccountType string `xml:"requiredAccountType,attr"` RestrictedAccountType string `xml:"restrictedAccountType,attr"` SupportsRtl bool `xml:"supportsRtl,attr"` TaskAffinity string `xml:"taskAffinity,attr"` TestOnly bool `xml:"testOnly,attr"` Theme string `xml:"theme,attr"` UIOptions string `xml:"uiOptions,attr"` VMSafeMode bool `xml:"vmSafeMode,attr"` Activities []AppActivity `xml:"activity"` ActivityAliases []AppActivityAlias `xml:"activity-alias"` }
Application is an application in an APK.
type ChunkType ¶
type ChunkType uint16
ChunkType is a type of a resource chunk.
const ( ResNullChunkType ChunkType = 0x0000 ResStringPoolChunkType ChunkType = 0x0001 ResTableChunkType ChunkType = 0x0002 ResXMLChunkType ChunkType = 0x0003 // Chunk types in RES_XML_TYPE ResXMLFirstChunkType ChunkType = 0x0100 ResXMLStartNamespaceType ChunkType = 0x0100 ResXMLEndNamespaceType ChunkType = 0x0101 ResXMLStartElementType ChunkType = 0x0102 ResXMLEndElementType ChunkType = 0x0103 ResXMLCDataType ChunkType = 0x0104 ResXMLLastChunkType ChunkType = 0x017f // This contains a uint32_t array mapping strings in the string // pool back to resource identifiers. It is optional. ResXMLResourceMapType ChunkType = 0x0180 // Chunk types in RES_TABLE_TYPE ResTablePackageType ChunkType = 0x0200 ResTableTypeType ChunkType = 0x0201 ResTableTypeSpecType ChunkType = 0x0202 )
Chunk types.
type DataType ¶
type DataType uint8
DataType is a type of the data value.
const ( TypeNull DataType = 0x00 TypeReference DataType = 0x01 TypeAttribute DataType = 0x02 TypeString DataType = 0x03 TypeFloat DataType = 0x04 TypeDemention DataType = 0x05 TypeFraction DataType = 0x06 TypeFirstInt DataType = 0x10 TypeIntDec DataType = 0x10 TypeIntHex DataType = 0x11 TypeIntBoolean DataType = 0x12 TypeFirstColorInt DataType = 0x1c TypeIntColorARGB8 DataType = 0x1c TypeIntColorRGB8 DataType = 0x1d TypeIntColorARGB4 DataType = 0x1e TypeIntColorRGB4 DataType = 0x1f TypeLastColorInt DataType = 0x1f TypeLastInt DataType = 0x1f )
The constants for DataType
type InputFlags ¶
type InputFlags uint8
InputFlags are input flags.
const ( MaskKeysHidden InputFlags = 0x03 KeysHiddenAny InputFlags = 0x00 KeysHiddenNo InputFlags = 0x01 KeysHiddenYes InputFlags = 0x02 KeysHiddenSoft InputFlags = 0x03 )
input flags
type Instrumentation ¶
type Instrumentation struct { Name string `xml:"name,attr"` Target string `xml:"targetPackage,attr"` HandleProfiling bool `xml:"handleProfiling,attr"` FunctionalTest bool `xml:"functionalTest,attr"` }
Instrumentation is an application instrumentation code.
type Manifest ¶
type Manifest struct { Package string `xml:"package,attr"` VersionCode int `xml:"versionCode,attr"` VersionName string `xml:"versionName,attr"` App Application `xml:"application"` Instrument Instrumentation `xml:"instrumentation"` SDK UsesSDK `xml:"uses-sdk"` }
Manifest is a manifest of an APK.
type ResChunkHeader ¶
ResChunkHeader is a header of a resource chunk.
type ResStringPool ¶
type ResStringPool struct { Header ResStringPoolHeader Strings []string Styles []ResStringPoolSpan }
ResStringPool is a string pool resrouce.
func (*ResStringPool) GetString ¶
func (pool *ResStringPool) GetString(ref ResStringPoolRef) string
GetString returns a string referenced by ref.
type ResStringPoolHeader ¶
type ResStringPoolHeader struct { Header ResChunkHeader StringCount uint32 StyleCount uint32 Flags Flags StringStart uint32 StylesStart uint32 }
ResStringPoolHeader is a chunk header of string pool.
type ResStringPoolRef ¶
type ResStringPoolRef uint32
ResStringPoolRef is a type representing a reference to a string.
type ResStringPoolSpan ¶
type ResStringPoolSpan struct {
FirstChar, LastChar uint32
}
ResStringPoolSpan is a span of style information associated with a string in the pool.
type ResTableConfig ¶
type ResTableConfig struct { Size uint32 // imsi Mcc uint16 Mnc uint16 // locale Language [2]uint8 Country [2]uint8 // screen type Orientation uint8 Touchscreen uint8 Density uint16 // inout Keyboard uint8 InputFlags InputFlags InputPad0 uint8 // screen size ScreenWidth uint16 ScreenHeight uint16 // version SDKVersion uint16 MinorVersion uint16 // screen config ScreenLayout ScreenLayout UIMode UIMode SmallestScreenWidthDp uint16 // screen size dp ScreenWidthDp uint16 ScreenHeightDp uint16 }
ResTableConfig is a configuration of a table.
func (*ResTableConfig) IsBetterThan ¶
func (c *ResTableConfig) IsBetterThan(o *ResTableConfig, r *ResTableConfig) bool
IsBetterThan returns true if c is better than o for the r configuration.
func (*ResTableConfig) IsLocaleBetterThan ¶
func (c *ResTableConfig) IsLocaleBetterThan(o *ResTableConfig, r *ResTableConfig) bool
IsLocaleBetterThan returns true if c is a better locale match than o for the r configuration.
func (*ResTableConfig) IsLocaleMoreSpecificThan ¶
func (c *ResTableConfig) IsLocaleMoreSpecificThan(o *ResTableConfig) int
IsLocaleMoreSpecificThan a positive integer if this config is more specific than o, a negative integer if |o| is more specific and 0 if they're equally specific.
func (*ResTableConfig) IsMoreSpecificThan ¶
func (c *ResTableConfig) IsMoreSpecificThan(o *ResTableConfig) bool
IsMoreSpecificThan returns true if c is more specific than o.
func (*ResTableConfig) Locale ¶
func (c *ResTableConfig) Locale() string
Locale returns the locale of the configuration.
func (*ResTableConfig) Match ¶
func (c *ResTableConfig) Match(settings *ResTableConfig) bool
Match returns true if c can be considered a match for the parameters in settings.
type ResTableEntry ¶
type ResTableEntry struct { Size uint16 Flags uint16 Key ResStringPoolRef }
ResTableEntry is the beginning of information about an entry in the resource table.
type ResTableHeader ¶
type ResTableHeader struct { Header ResChunkHeader PackageCount uint32 }
ResTableHeader is a header of TableFile.
type ResTablePackage ¶
type ResTablePackage struct { Header ResChunkHeader ID uint32 Name [128]uint16 TypeStrings uint32 LastPublicType uint32 KeyStrings uint32 LastPublicKey uint32 }
ResTablePackage is a header of table packages.
type ResTableType ¶
type ResTableType struct { Header ResChunkHeader ID uint8 Res0 uint8 Res1 uint16 EntryCount uint32 EntriesStart uint32 Config ResTableConfig }
ResTableType is a type of a table.
type ResTableTypeSpec ¶
type ResTableTypeSpec struct { Header ResChunkHeader ID uint8 Res0 uint8 Res1 uint16 EntryCount uint32 }
ResTableTypeSpec is specification of the resources defined by a particular type.
type ResXMLTreeAttrExt ¶
type ResXMLTreeAttrExt struct { NS ResStringPoolRef Name ResStringPoolRef AttributeStart uint16 AttributeSize uint16 AttributeCount uint16 IDIndex uint16 ClassIndex uint16 StyleIndex uint16 }
ResXMLTreeAttrExt is extended XML tree node for start tags -- includes attribute.
type ResXMLTreeAttribute ¶
type ResXMLTreeAttribute struct { NS ResStringPoolRef Name ResStringPoolRef RawValue ResStringPoolRef TypedValue ResValue }
ResXMLTreeAttribute is an attribute of start tags.
type ResXMLTreeEndElementExt ¶
type ResXMLTreeEndElementExt struct { NS ResStringPoolRef Name ResStringPoolRef }
ResXMLTreeEndElementExt is extended XML tree node for element start/end nodes.
type ResXMLTreeNamespaceExt ¶
type ResXMLTreeNamespaceExt struct { Prefix ResStringPoolRef URI ResStringPoolRef }
ResXMLTreeNamespaceExt is extended XML tree node for namespace start/end nodes.
type ResXMLTreeNode ¶
type ResXMLTreeNode struct { Header ResChunkHeader LineNumber uint32 Comment ResStringPoolRef }
ResXMLTreeNode is basic XML tree node.
type ScreenLayout ¶
type ScreenLayout uint8
ScreenLayout describes screen layout.
const ( MaskScreenSize ScreenLayout = 0x0f ScreenSizeAny ScreenLayout = 0x01 ScreenSizeSmall ScreenLayout = 0x02 ScreenSizeNormal ScreenLayout = 0x03 ScreenSizeLarge ScreenLayout = 0x04 ScreenSizeXLarge ScreenLayout = 0x05 MaskScreenLong ScreenLayout = 0x30 ShiftScreenLong = 4 ScreenLongAny ScreenLayout = 0x00 ScreenLongNo ScreenLayout = 0x10 ScreenLongYes ScreenLayout = 0x20 MaskLayoutDir ScreenLayout = 0xC0 ShiftLayoutDir = 6 LayoutDirAny ScreenLayout = 0x00 LayoutDirLTR ScreenLayout = 0x40 LayoutDirRTL ScreenLayout = 0x80 )
ScreenLayout bits
type TableEntry ¶
type TableEntry struct { Key *ResTableEntry Value *ResValue Flags uint32 }
TableEntry is a entry in a recource table.
type TableFile ¶
type TableFile struct {
// contains filtered or unexported fields
}
TableFile is a resrouce table file.
func NewTableFile ¶
NewTableFile returns new TableFile.
func (*TableFile) GetResource ¶
func (f *TableFile) GetResource(id ResID, config *ResTableConfig) (interface{}, error)
GetResource returns a resrouce referenced by id.
func (*TableFile) GetString ¶
func (f *TableFile) GetString(ref ResStringPoolRef) string
GetString returns a string referenced by ref.
type TablePackage ¶
type TablePackage struct { Header ResTablePackage TypeStrings *ResStringPool KeyStrings *ResStringPool TableTypes []*TableType }
TablePackage is a table package.
type TableType ¶
type TableType struct { Header *ResTableType Entries []TableEntry }
TableType is a collection of resource entries for a particular resource data type.
type UIMode ¶
type UIMode uint8
UIMode describes UI mode.
const ( MaskUIModeType UIMode = 0x0f UIModeTypeAny UIMode = 0x01 UIModeTypeNormal UIMode = 0x02 UIModeTypeDesk UIMode = 0x03 UIModeTypeCar UIMode = 0x04 MaskUIModeNight UIMode = 0x30 ShiftUIModeNight = 4 UIModeNightAny UIMode = 0x00 UIModeNightNo UIMode = 0x10 UIModeNightYes UIMode = 0x20 )
UIMode bits
type UsesSDK ¶
type UsesSDK struct { Min int `xml:"minSdkVersion,attr"` Target int `xml:"targetSdkVersion,attr"` Max int `xml:"maxSdkVersion,attr"` }
UsesSDK is target SDK version.
type XMLFile ¶
type XMLFile struct {
// contains filtered or unexported fields
}
XMLFile is an XML file expressed in binary format.
func NewXMLFile ¶
NewXMLFile returns a new XMLFile.
func (*XMLFile) GetString ¶
func (f *XMLFile) GetString(ref ResStringPoolRef) string
GetString returns a string referenced by ref.