Commit Graph

6203 Commits

Author SHA1 Message Date
Ryan Mitchell
d86ea58bdd AAPT2: Encode 4-byte strings in Modified UTF-8
Codepoints that are encoded to 4 bytes in UTF-8 are not allowed in
Modified UTF-8. They instead should be encoded as surrogate pairs in the
same way that CESU-8 allows for surrogate pairs. This will also cause 4
byte UTF-8 codes to be represented in 6 bytes.

Bug: 37140916
Test: aapt2_tests
Change-Id: I155dc24f166139d1d36a16bac088dcfcd59eb321
2018-07-02 14:14:33 -07:00
TreeHugger Robot
87230dceac Merge "Add kernel version to incident report" 2018-06-26 21:15:05 +00:00
Ryan Mitchell
d6ace01c5a Merge "AAPT2: Fix unrecognized CDATA" 2018-06-25 16:10:59 +00:00
Yi Jin
908c02f5c1 Add kernel version to incident report
Bug: 110230810
Test: atest incidentd_test
Change-Id: I502b34f23d61a7346d79ff0dc378add8461d2d27
2018-06-22 16:51:40 -07:00
Ryan Mitchell
cb76d734fe AAPT2: Fix unrecognized CDATA
This change adds support for resources that have CDATA blocks within
their values. The blocks should allow any character to occur without
being escaped. It also should not effect the current state of quote
processing.

Bug: 80326349
Test: Created tests in aapt2_tests
Change-Id: Ie1a00e50cffc877e2eb5f788f8d7a1bda839c0cf
2018-06-22 14:06:02 -07:00
Colin Cross
fdc40f52d8 Merge "Fix ManifestMerger issues" into stage-aosp-master am: 669c4d7ae7
am: fae24f5aa2

Change-Id: I66e9b74a7db9ae9a0c4040e37a3f2807b24aa391
2018-06-18 13:38:11 -07:00
Colin Cross
ff311dd893 Fix ManifestMerger issues
Set LOCAL_MIN_SDK_VERSION in aapt2 integration test libraries so that
the build system doesn't raise the minSdkVersion value specified in
the manifest, which causes ManifestMerger to error when trying to
merge it into a package that specifies a lower minSdkVersion.

Bug: 78447299
Test: m java
Change-Id: If5d4f97bb2d8a503bd3c20f2ea8aea2519c51e85
2018-06-15 23:03:46 +00:00
TreeHugger Robot
859df82843 Merge "Treating all FileSection files as device specific." 2018-06-14 17:37:29 +00:00
Kweku Adams
e04ef777c1 Treating all FileSection files as device specific.
Arc++ devices don't have the /d/wakeup_sources file. There's a chance
other device won't have it either, and there may be other files that we
thought were standard but are actually not, so it's safer to just assume
that not every file will be available on every device and not treat a
missing file as an error.

Bug: 110109543
Test: atest incidentd_test
Change-Id: Ief09427f08d18aee611d057ddafdb9a3466744db
2018-06-13 12:46:12 -07:00
Ryan Mitchell
1b327db1af Merge "AAPT2: Fix raw string parsing" 2018-06-12 20:51:33 +00:00
Ryan Mitchell
633d796623 AAPT2: Fix raw string parsing
Trim whitespace of raw strings when parsing xml values. This change
trims the whitespace of style items. For example:

<item name="viewInflaterClass">com.helloworld.Inflater
</item>

This will be trimmed to not include a trailing whitespace.

Bug: 109666819
Test: aapt2_tests
Change-Id: I0c1fbb3abdc7e609316c92e59ccaf0573b07e5a7
2018-06-11 15:57:23 -07:00
Jake Wharton
3001f0311d Only keep methods with correct signature for view/menu click
For View's onClick attribute the method must have a single argument of type android.view.View. For a MenuItem's onClick attribute the method must have a single argument of type android.view.MenuItem. Since these rules match all types and any return type, matching by signature is the only available specificity that can be added.

Bug: 37123156
Test: make aapt2_tests
Change-Id: I4b82f5ef9e62a8ecffaab424e269df627825709e
2018-06-11 17:21:28 -04:00
Jake Wharton
420785e6d0 Improve tests for ProGuard rules, add transition tests
Test: make aapt2_tests
Change-Id: If3300a9f82ad90189b74aab03c0d7f649e74e3f3
2018-06-11 15:57:59 -04:00
Jake Wharton
ab660a7fde Only keep default constructor of manifest items
Reflection-based instantiation of manifest-declared types is only done on the default (aka no-argument) constructor. While these types are unlikely to have alternate constructors (unlike the others listed in the bug), there's no reason to generate overly keep-y rules for them.

Bug: 37123156
Test: make aapt2_tests
Change-Id: Ic83a2671a54ea5dd558bfcacf033a60e9568ab8c
2018-06-11 11:33:17 -04:00
Yao Chen
a11cbf368b Merge "Disable statsd and make StatsLog no-op if ro.statsd.enable=false" into pi-dev am: 38b92986df
am: 39c8fe12e4

Change-Id: Ie27a0d43da9fa0eb0c751cafa3f04220a5f8f18a
2018-06-07 15:50:46 -07:00
Yao Chen
39c8fe12e4 Merge "Disable statsd and make StatsLog no-op if ro.statsd.enable=false" into pi-dev
am: 38b92986df

Change-Id: Ia90bed14900a2c944165aefe00661d3979c08aed
2018-06-07 14:53:43 -07:00
Yao Chen
38b92986df Merge "Disable statsd and make StatsLog no-op if ro.statsd.enable=false" into pi-dev 2018-06-07 21:10:16 +00:00
TreeHugger Robot
3b027f9d41 Merge "Extend lint script to emit API statistics." 2018-06-07 17:05:32 +00:00
Yao Chen
cf3829a696 Disable statsd and make StatsLog no-op if ro.statsd.enable=false
Bug: 79324611
Test: manually tested on marlin_svelte
Change-Id: Ic7fbf86d7c295cb6b2f20e7f9a957d1ed74c42c0
2018-06-06 17:25:08 -07:00
Jeff Sharkey
daa7cf3a36 Extend lint script to emit API statistics.
Bug: 77588754
Test: manual
Change-Id: I240dba5fae1a8635a4265a1af903517f00dec54c
2018-06-06 16:12:39 -06:00
TreeHugger Robot
da2432bbee Merge "More string lint checks." 2018-06-06 16:50:30 +00:00
Jeff Sharkey
47c792435e More string lint checks.
Expand strings into samples that are representative of what'll be
shown in UI, and warn if they're longer than defined CHAR LIMIT.

Guide all-caps strings towards android:textAllCaps if actions.

Warn when strings mention "phone" without defining product-specific
variants.

Bug: 76097999
Test: manual
Change-Id: I08046ecf531b2d616cb357639e804b73d6a12bea
2018-06-06 09:51:01 -06:00
George Burgess IV
5b732ef475 Merge "Fix a 'memory leak'" am: 38e7338d92 am: bc49cb8460
am: 02bf04ac01

Change-Id: I9113510f9fb0b46bf481a08009bd0c8a4080bc65
2018-06-05 20:23:59 -07:00
George Burgess IV
02bf04ac01 Merge "Fix a 'memory leak'" am: 38e7338d92
am: bc49cb8460

Change-Id: I3ecf0ecdf20bb61bda76fff547f920040ded47d6
2018-06-05 19:56:22 -07:00
Treehugger Robot
38e7338d92 Merge "Fix a 'memory leak'" 2018-06-05 23:29:10 +00:00
Bookatz
0bd972083a Wean statsd off batterystats: workchain (cp)
Modified cherry pick from master:
(cherry picked from commit d888df2ba9)
covering ag/4210168 and ag/4230692.

The tool that generates StatsLogInternal.java now includes the following
type of code, to accomodate WorkSources automatically.

    public static void write(int code, WorkSource ws, int arg2) {
        for (int i = 0; i < ws.size(); ++i) {
            write_non_chained(code, ws.get(i), ws.getName(i), arg2);
        }
        ArrayList<WorkSource.WorkChain> workChains = ws.getWorkChains();
        if (workChains != null) {
            for (WorkSource.WorkChain wc : workChains) {
                write(code, wc.getUids(), wc.getTags(), arg2);
            }
        }
    }

This will reduce a lot of code repitition for the StatsLog.write calls
in BatteryStats. Consequently, doing so will make it easier to remove
these StatsLog.write calls out of BatteryStats.

Bug: 80308558
Bug: 80314737
Test: manual verification
Test: com.android.internal.os.BatteryStatsTests
Change-Id: Ied537a6195121f16ef49b6bccf58c8c31964909c
Merged-In: Ibd28297345f4ab926dec01a89de0f1bfff9f8871
2018-06-05 19:46:23 +00:00
Bookatz
ced516b805 StatsLog.write javadoc comment improvements
When attribution is present, log lines should use the
StatsLog.write(WorkSource) variation, so the javadoc comments are
updated accordingly.

Bug: 80308558
Bug: 80314737
Test: manual verification of output's comments
Change-Id: I1d1a7972a68ce98b1dbfd62a829a73edfb605684
2018-06-05 19:39:57 +00:00
Bookatz
d888df2ba9 Wean statsd off batterystats: workchain, longPW
The tool that generates StatsLogInternal.java now includes the following
type of code, to accomodate WorkSources automatically.

    public static void write(int code, WorkSource ws, int arg2) {
        for (int i = 0; i < ws.size(); ++i) {
            write_non_chained(code, ws.get(i), ws.getName(i), arg2);
        }
        ArrayList<WorkSource.WorkChain> workChains = ws.getWorkChains();
        if (workChains != null) {
            for (WorkSource.WorkChain wc : workChains) {
                write(code, wc.getUids(), wc.getTags(), arg2);
            }
        }
    }

This will reduce a lot of code repitition for the StatsLog.write calls
in BatteryStats. Consequently, doing so will make it easier to remove
these StatsLog.write calls out of BatteryStats. We start in this cl with
LongPartialWakelock (as proof of principle).

Bug: 80308558
Bug: 80314737
Test: manual verification
Test: com.android.internal.os.BatteryStatsTests
Change-Id: Ibd28297345f4ab926dec01a89de0f1bfff9f8871
2018-06-01 11:12:41 -07:00
Ryan Mitchell
40c95320fd Merge "AAPT2: Add Proguard rules for nav fragments" 2018-05-31 21:32:39 +00:00
Colin Cross
da02feaca2 Add support for --replace-version to aapt2
Implement --replace-version to match aapt1.

Bug: 79755007
Test: aapt2_tests
Change-Id: Iee2bd9a3981c7d4681509f18b735c6e9e6c1a336
Merged-In: Iee2bd9a3981c7d4681509f18b735c6e9e6c1a336
(cherry picked from commit dcd58c4207)
2018-05-30 23:25:21 +00:00
Colin Cross
f7ae76d845 Add support for --replace-version to aapt2
Implement --replace-version to match aapt1.

Bug: 79755007
Test: aapt2_tests
Change-Id: Iee2bd9a3981c7d4681509f18b735c6e9e6c1a336
Merged-In: Iee2bd9a3981c7d4681509f18b735c6e9e6c1a336
(cherry picked from commit dcd58c4207)
2018-05-30 15:40:06 -07:00
Colin Cross
dcd58c4207 Add support for --replace-version to aapt2
Implement --replace-version to match aapt1.

Bug: 79755007
Test: aapt2_tests
Change-Id: Iee2bd9a3981c7d4681509f18b735c6e9e6c1a336
2018-05-30 14:48:52 -07:00
Ryan Mitchell
9a2f6e60c6 AAPT2: Add Proguard rules for nav fragments
Adds generation of proguard rules for fragments in res/navigation. All
android:name attributes have keep rules generated for the classes they
reference.

Bug: 69929974
Test: aapt2_tests
Change-Id: I05a87484ab357ea5629b73caad8488182f474e1f
2018-05-24 09:58:27 -07:00
Ryan Mitchell
a593605dfa AAPT2: Accept density config as default
When a resource does not have a default config value defined, and the
resource only has config values defined for language translations, that
resource should be removed; however, if the resource also contains a
density specific config value, the resource should not be removed.

This is because a density specific value should have the same content as
what the default value would have, just higher or lower quality.

Bug: 76413048
Test: aapt2_tests
Change-Id: I52fe37a7aa3aefb694d3af6c8adfd6269fa26f54
2018-05-24 09:46:33 -07:00
Izabela Orlowska
533c09b01b AAPT2: treat manifest validation errors as warnings when asked
Bug: 65670329
Test: updated
Change-Id: Ic554cc20134fce66aa9ddf8d16ddffe0131c50e9
Merged-In: Ic554cc20134fce66aa9ddf8d16ddffe0131c50e9
(cherry picked from commit ad9e1324ff)
2018-05-21 19:51:50 +00:00
Adam Lesinski
b2b20f26db AAPT2: Better error messages for ManifestFixer
AAPT2 will now print the XML hierarchy where it found an unexpected
element.

Test: make aapt2_tests
Change-Id: Iac7918b2f344fab874f0a3e7aa9c6936ecde8913
Merged-In: Iac7918b2f344fab874f0a3e7aa9c6936ecde8913
(cherry picked from commit ed37f4842a)
2018-05-21 19:51:42 +00:00
Adam Lesinski
ef506c73bb AAPT2: Differentiate between Android and Java package names
Android package names are more strict (ASCII only) than Java package names.
Also fixed an issue where trailing underscores were disallowed in Android
package names.

(cherry picked from commit 96ea08f1e7)

Also includes part of I357fb84941bfbb3892a8c46feb47f55b865b6649 to remove
usage of FindNonAlphaNumericAndNotInSet.

Bug: 79481102
Test: make aapt2_tests
Change-Id: I1052e9e82b6617db6065ce448d9bf7972bb68d59
Merged-In: I1052e9e82b6617db6065ce448d9bf7972bb68d59
2018-05-21 19:48:36 +00:00
Adam Lesinski
89794158a1 Change ownership of AAPT2 and libandroidfw
toddke@ is now the new owner of these projects.

Exempt-From-Owner-Approval: setting new owners
Test: none
Change-Id: Ie92b020e0ba063f48ce8a76ebaef768fe0d554f1
Merged-In: Ie92b020e0ba063f48ce8a76ebaef768fe0d554f1
(cherry picked from commit a95e841846)
2018-05-17 22:13:11 -07:00
Seigo Nonaka
29f208b483 Merge "Update font chain linter to match latest font file" into pi-dev am: 31c4a48267
am: df8ed7a446

Change-Id: Idb7374c2e71b2124ed50a8d6b3d6c3f4e363bb9d
2018-05-16 15:58:13 -07:00
Seigo Nonaka
df8ed7a446 Merge "Update font chain linter to match latest font file" into pi-dev
am: 31c4a48267

Change-Id: Ia5f7799fcb43b59adfc672a9d7af0f6a8c583f09
2018-05-16 15:38:26 -07:00
TreeHugger Robot
31c4a48267 Merge "Update font chain linter to match latest font file" into pi-dev 2018-05-16 22:11:17 +00:00
George Burgess IV
9fb8177ca5 Fix a 'memory leak'
Realistically, this memory will be reclaimed by the OS when we return
here. Regardless, we do a similar cleanup above if an exec() function
fails, and having the free here makes our tooling slightly happier.

Complained about by the static analyzer

Bug: None
Test: Ran the analyzer. It no longer complains about this leak.
Change-Id: Ia7107c585cc38fef8bd7c59d85ff896b04e93658
2018-05-15 18:03:00 -07:00
Yi Jin
287e14bb20 Merge "The argument type is bool, the current bug passes a "true" or "false" string." into pi-dev am: 0a3815958a
am: 6ef148ce5c

Change-Id: Ie5ca5fe0df06c14b8c72108ef53313b41b4acac4
2018-05-15 12:23:53 -07:00
Yi Jin
6ef148ce5c Merge "The argument type is bool, the current bug passes a "true" or "false" string." into pi-dev
am: 0a3815958a

Change-Id: Iadf8a52e65ba7930f419eacbaac9816992715506
2018-05-15 11:27:13 -07:00
Seigo Nonaka
c18086310b Update font chain linter to match latest font file
- FAMILY emoji now has own gender neutral emoji
- Some flags are newly supported
- Some regions may have the same flags.

Bug: 77148691
Test: m fontchain_lint
Change-Id: If1a69974230f025d35503eb49bea105923593e87
2018-05-15 16:09:48 +00:00
Yi Jin
480a956521 The argument type is bool, the current bug passes a "true" or "false"
string.

Bug: 79710844
Test: atest incidentd_test
Change-Id: I66fc086e4a194e68638311ccdc305a495ecf8da4
2018-05-14 18:04:29 -07:00
Pirama Arumuga Nainar
8b83f5c401 Merge "For Win32, don't cast ssize_t while printing" am: aaf8d7aa2e am: 466ada94fe
am: ea5cf9f31c

Change-Id: I77ee34cf56d68614b2f6e315c7f4797494f89c55
2018-05-14 11:32:16 -07:00
Pirama Arumuga Nainar
ea5cf9f31c Merge "For Win32, don't cast ssize_t while printing" am: aaf8d7aa2e
am: 466ada94fe

Change-Id: I39b73406a41ecc5396c39648f8e05e8a88e7aaee
2018-05-14 11:22:57 -07:00
Pirama Arumuga Nainar
dc36bb6dea For Win32, don't cast ssize_t while printing
Bug: http://b/69933068

This is a partial revert of
https://android-review.googlesource.com/c/platform/frameworks/base/+/109433
so we can use Clang for windows cross compilation.

Clang does not allow a cast to 'signed size_t' and both Clang and
current MinGW accept a ssize_t to the '%zd' format specifier.

Test: m native-host, m native-host-cross with both MinGW and Clang
Change-Id: I5366622b91be1433f6c533c55a9ae429b57c7a27
2018-05-11 23:22:10 +00:00
Ryan Mitchell
3a20be789f Merge "AAPT2: Insert platformBuild information" into pi-dev am: 91d2f87d0e
am: 78e0e6aa2e

Change-Id: I6fb1af5b521c5a887ee494c745b83592e48228de
2018-05-11 08:41:00 -07:00