Class: AppInfo::APK
Overview
Constant Summary
Helper::HumanFileSize::FILE_SIZE_UNITS
Instance Attribute Summary
Attributes inherited from File
#file, #logger
Instance Method Summary
collapse
Methods inherited from Android
#automotive?, #certificates, #contents, #device, #manufacturer, #platform, #signatures, #signs, #size, #tablet?, #television?, #watch?
#file_to_human_size, #number_to_human_size
Methods inherited from File
#device, #format, #initialize, #manufacturer, #not_implemented_error!, #platform, #size
Constructor Details
This class inherits a constructor from AppInfo::File
Instance Method Details
#activities ⇒ String
58
59
60
|
# File 'lib/app_info/apk.rb', line 58
def activities
components.select { |c| c.type == 'activity' }
end
|
#apk ⇒ ::Android::Apk
71
72
73
|
# File 'lib/app_info/apk.rb', line 71
def apk
@apk ||= ::Android::Apk.new(@file)
end
|
#clear! ⇒ Object
134
135
136
137
138
139
140
141
142
143
144
|
# File 'lib/app_info/apk.rb', line 134
def clear!
return unless @contents
FileUtils.rm_rf(@contents)
@apk = nil
@contents = nil
@icons = nil
@app_path = nil
@info = nil
end
|
#components ⇒ Object
34
35
36
|
# File 'lib/app_info/apk.rb', line 34
def_delegators :manifest, :version_name, :package_name, :target_sdk_version,
:components, :services, :use_permissions, :use_features,
:deep_links, :schemes
|
#deep_links ⇒ Object
34
35
36
|
# File 'lib/app_info/apk.rb', line 34
def_delegators :manifest, :version_name, :package_name, :target_sdk_version,
:components, :services, :use_permissions, :use_features,
:deep_links, :schemes
|
#dex ⇒ Object
14
|
# File 'lib/app_info/apk.rb', line 14
def_delegators :apk, :manifest, :resource, :dex
|
#icons(exclude: nil) ⇒ Array<Hash{Symbol => String, Array<Integer>}>
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
|
# File 'lib/app_info/apk.rb', line 116
def icons(exclude: nil)
@icons ||= apk.icon.each_with_object([]) do |(path, data), obj|
icon_name = ::File.basename(path)
icon_path = ::File.join(contents, ::File.dirname(path))
icon_file = ::File.join(icon_path, icon_name)
FileUtils.mkdir_p icon_path
::File.write(icon_file, data, encoding: Encoding::BINARY)
obj << {
name: icon_name,
file: icon_file,
dimensions: ImageSize.path(icon_file).size
}
end
(@icons, exclude: exclude)
end
|
#manifest ⇒ Object
14
|
# File 'lib/app_info/apk.rb', line 14
def_delegators :apk, :manifest, :resource, :dex
|
#min_sdk_version ⇒ String
Also known as:
min_os_version
52
53
54
|
# File 'lib/app_info/apk.rb', line 52
def min_sdk_version
manifest.min_sdk_ver
end
|
#name ⇒ Object
47
48
49
|
# File 'lib/app_info/apk.rb', line 47
def name
manifest.label || resource.find('@string/app_name')
end
|
#native_codes ⇒ Array<String>
63
64
65
66
67
68
|
# File 'lib/app_info/apk.rb', line 63
def native_codes
@native_codes ||= zip.glob('lib/**/*').each_with_object([]) do |entry, obj|
lib = entry.name.split('/')[1]
obj << lib unless obj.include?(lib)
end
end
|
#package_name ⇒ Object
Also known as:
identifier, bundle_id
34
35
36
|
# File 'lib/app_info/apk.rb', line 34
def_delegators :manifest, :version_name, :package_name, :target_sdk_version,
:components, :services, :use_permissions, :use_features,
:deep_links, :schemes
|
#resource ⇒ Object
14
|
# File 'lib/app_info/apk.rb', line 14
def_delegators :apk, :manifest, :resource, :dex
|
#schemes ⇒ Object
34
35
36
|
# File 'lib/app_info/apk.rb', line 34
def_delegators :manifest, :version_name, :package_name, :target_sdk_version,
:components, :services, :use_permissions, :use_features,
:deep_links, :schemes
|
#services ⇒ Object
34
35
36
|
# File 'lib/app_info/apk.rb', line 34
def_delegators :manifest, :version_name, :package_name, :target_sdk_version,
:components, :services, :use_permissions, :use_features,
:deep_links, :schemes
|
#target_sdk_versionx ⇒ Object
34
35
36
|
# File 'lib/app_info/apk.rb', line 34
def_delegators :manifest, :version_name, :package_name, :target_sdk_version,
:components, :services, :use_permissions, :use_features,
:deep_links, :schemes
|
#use_features ⇒ Object
34
35
36
|
# File 'lib/app_info/apk.rb', line 34
def_delegators :manifest, :version_name, :package_name, :target_sdk_version,
:components, :services, :use_permissions, :use_features,
:deep_links, :schemes
|
#use_permissions ⇒ Object
34
35
36
|
# File 'lib/app_info/apk.rb', line 34
def_delegators :manifest, :version_name, :package_name, :target_sdk_version,
:components, :services, :use_permissions, :use_features,
:deep_links, :schemes
|
#version_code ⇒ Object
Also known as:
build_version
42
43
44
|
# File 'lib/app_info/apk.rb', line 42
def version_code
manifest.version_code.to_s
end
|
#version_name ⇒ Object
Also known as:
release_version
34
35
36
|
# File 'lib/app_info/apk.rb', line 34
def_delegators :manifest, :version_name, :package_name, :target_sdk_version,
:components, :services, :use_permissions, :use_features,
:deep_links, :schemes
|
#zip ⇒ Zip::File
76
77
78
|
# File 'lib/app_info/apk.rb', line 76
def zip
@zip ||= apk.instance_variable_get(:@zip)
end
|