7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
# File 'lib/aapt.rb', line 7
def self.dump_badging(apk)
attrs = {}
info = self.exec('dump badging', apk)
package = info.match(/package:\s*(.*)/)[1] rescue nil
application = info.match(/application:\s*(.*)/)[1] rescue nil
attrs[:package] = package.match(/name='([^']*)'/)[1] rescue nil
attrs[:version_code] = package.match(/versionCode='([^']*)'/)[1] rescue nil
attrs[:version_name] = package.match(/versionName='([^']*)'/)[1] rescue nil
attrs[:label] = info.scan(/application-label-zh:\s*'([^']*)'/)[0]
if not attrs[:label] or attrs[:label].length == 0
m = info.scan(/label='([^']*)'/)
attrs[:label] = self.parse(m)
end
attrs[:icon] = application.match(/icon='([^']*)'/)[1] rescue nil
attrs[:api_level] = info.match(/sdkVersion:\s*'(.*)'/)[1] rescue nil
attrs
end
|