Commit Graph

58414 Commits

Author SHA1 Message Date
Jeff Sharkey
286fd5652a DO NOT MERGE. Execute "strict" queries with extra parentheses.
SQLiteQueryBuilder has a setStrict() mode which can be used to
detect SQL attacks from untrusted sources, which it does by running
each query twice: once with an extra set of parentheses, and if that
succeeds, it runs the original query verbatim.

This sadly doesn't catch inputs of the type "1=1) OR (1=1", which
creates valid statements for both tests above, but the final executed
query ends up leaking data due to SQLite operator precedence.

Instead, we need to continue compiling both variants, but we need
to execute the query with the additional parentheses to ensure
data won't be leaked.

Test: atest cts/tests/tests/database/src/android/database/sqlite/cts/SQLiteQueryBuilderTest.java
Bug: 111085900
Change-Id: I6e8746fa48f9de13adae37d2990de11c9c585381
Merged-In: I6e8746fa48f9de13adae37d2990de11c9c585381
2018-08-03 13:38:31 -06:00
Arthur Ishiguro
abe5a73a4a Resolve inconsistent parcel read in NanoAppFilter
Bug: 77599679
Test: Compile only
Change-Id: Ib417a5cb4d51744442d2fb14437cabbe5fd1c266
2018-07-06 22:54:52 +00:00
Mihai Popa
fd730b82f4 Merge "Optimise the hit test algorithm" into nyc-dev 2018-06-06 16:21:21 +00:00
Mihai Popa
71ecf5bd5c Optimise the hit test algorithm
Layout#getOffsetForHorizontal was running in O(n^2) time, where n is the
length of the current line. The method is used when a touch event
happens on a text line, to compute the cursor offset (and the character)
where it happened. Although this is not an issue in common usecases,
where the number of characters on a line is relatively small, this can
be very inefficient as a consequence of Unicode containing 0-width
(invisible) characters. Specifically, there are characters defining the
text direction (LTR or RTL), which cause our algorithm to touch the
worst case quadratic runtime. For example, a person is able to send a
message containing a few visible characters, and also a lot of these
direction changing invisible ones. When the receiver touches the message
(causing the Layout#getOffsetForHorizontal method to be called), the
receiver's application would become not responsive.

This CL optimizes the method to run in O(n) worst case. This is achieved
by computing the measurements of all line prefixes at first, which can
be done in a single pass. Then, all the prefix measurement queries will
be answered in O(1), rather than O(n) as it was happening before.

Bug: 79215201
Test: manual testing
Change-Id: Ib66ef392c19c937718e7101f6d48fac3abe51ad0
Merged-In: Ib66ef392c19c937718e7101f6d48fac3abe51ad0
2018-05-31 17:45:42 +01:00
Todd Kennedy
2263da9539 Make safe label more safe
* limit the absolute maximum size of the label to 50000 characters
[which is probably far more than necessary, but, can be dialed down]

* use a string buffer while processing the string [instead of creating
multiple string objects]

Bug: 62537081
Test: Manual. Install APK in bug and see that it can be uninstalled
Change-Id: Ibf63c2691ad7438a123e92110d95b1f50050f8b1
Merged-In: Ibf63c2691ad7438a123e92110d95b1f50050f8b1
2018-05-22 21:59:22 +00:00
Android Build Merger (Role)
9e291fe8c2 [automerger] Nullcheck to fix Autofill CTS am: 6c68a69288 am: 743abb939a am: a99414f51f am: 6b95503960
Change-Id: Ia3658c17dc890ca2de951da5c701e953ce8c969b
2018-05-09 17:19:18 +00:00
Android Build Merger (Role)
6b95503960 [automerger] Nullcheck to fix Autofill CTS am: 6c68a69288 am: 743abb939a am: a99414f51f
Change-Id: I7aaceff0646a5e738ed862c34645e548aabf62f1
2018-05-09 17:19:12 +00:00
Android Build Merger (Role)
a99414f51f [automerger] Nullcheck to fix Autofill CTS am: 6c68a69288 am: 743abb939a
Change-Id: Ia89ea1adb47be3b70f5db292677c4c19194a04db
2018-05-09 17:19:07 +00:00
Android Build Merger (Role)
743abb939a [automerger] Nullcheck to fix Autofill CTS am: 6c68a69288
Change-Id: I379d54d926e01da53b637bba6b3b1ee8577cbdbb
2018-05-09 17:19:02 +00:00
Eugene Susla
6c68a69288 Nullcheck to fix Autofill CTS
Test: presubmit
Fixes: 70506475
Bug: 69981755
Change-Id: I187bed4889a4901a7137a2995178ea651ed09186
2018-05-09 17:18:59 +00:00
Hansong Zhang
b6cde9ecc1 DO NOT MERGE Truncate newline and tab characters in BluetoothDevice name
Test: manual
Bug: 73173182
Change-Id: I3c25af233742e63351a68e8c5a279b51a94e49e2
2018-04-26 21:18:46 +00:00
Android Build Merger (Role)
365fb1c844 [automerger] DO NOT MERGE Truncate newline and tab characters in BluetoothDevice name am: 984dfe074c am: 8fbe4bce1e am: 0cd0cef08f
Change-Id: I937e2d9a676b38f6a18cda70f42d06eaa22ce051
2018-04-26 21:18:27 +00:00
Android Build Merger (Role)
0cd0cef08f [automerger] DO NOT MERGE Truncate newline and tab characters in BluetoothDevice name am: 984dfe074c am: 8fbe4bce1e
Change-Id: If7693b2ff5785a1a09920061b318aaac33f5d6b6
2018-04-26 21:18:21 +00:00
Android Build Merger (Role)
8fbe4bce1e [automerger] DO NOT MERGE Truncate newline and tab characters in BluetoothDevice name am: 984dfe074c
Change-Id: Iac403f5118d55d9919745d98eba260dd2929d56c
2018-04-26 21:18:14 +00:00
Hansong Zhang
984dfe074c DO NOT MERGE Truncate newline and tab characters in BluetoothDevice name
Test: manual
Bug: 73173182
Change-Id: I3c25af233742e63351a68e8c5a279b51a94e49e2
2018-04-26 14:17:52 -07:00
akirilov
33c37cb37c RESTRICT AUTOMERGE: Prevent reporting fake package name - framework (backport to nyc-dev)
Test: added AccessibilityEndToEndTest#testPackageNameCannotBeFaked
      cts-tradefed run cts -m CtsAccessibilityServiceTestCases
      cts-tradefed run cts -m CtsAccessibilityTestCases

Bug: 69981755
Change-Id: I187e3e9839f654cea9e06e5de93e10e4d1de3109
2018-04-09 22:24:05 +00:00
Android Build Merger (Role)
0df0b30be9 [automerger] RESTRICT AUTOMERGE: Prevent reporting fake package name - framework (backport to mnc-dev) am: de71ee469a am: d672eef559 am: 86f5488521
Change-Id: I9f6c6fedfdc987a2acf1978a71fb0bdcd034e9e0
2018-04-09 21:00:20 +00:00
Android Build Merger (Role)
86f5488521 [automerger] RESTRICT AUTOMERGE: Prevent reporting fake package name - framework (backport to mnc-dev) am: de71ee469a am: d672eef559
Change-Id: Ib50692050fd4e62ad80f24531818a378c75dfe25
2018-04-09 21:00:15 +00:00
Android Build Merger (Role)
d672eef559 [automerger] RESTRICT AUTOMERGE: Prevent reporting fake package name - framework (backport to mnc-dev) am: de71ee469a
Change-Id: I000fae45e723679ba44b378a36a85daef20ae96d
2018-04-09 21:00:08 +00:00
akirilov
de71ee469a RESTRICT AUTOMERGE: Prevent reporting fake package name - framework (backport to mnc-dev)
Test: added AccessibilityEndToEndTest#testPackageNameCannotBeFaked
      cts-tradefed run cts --package android.accessibilityservice
      cts-tradefed run cts --package android.accessibility

BUG:69981755

Change-Id: Id9990ccf1e88cea441f9b8927e849e67a059cfe4
2018-04-09 21:00:05 +00:00
Android Build Merger (Role)
9d13b0f6ca [automerger] DO NOT MERGE Rework thumbnail cleanup am: b514ce9b38 am: b8dad6c644 am: 019eec3923
Change-Id: I9f69b090824a6c91bf11dbc0929ba5988a06af52
2018-03-15 19:59:37 +00:00
Android Build Merger (Role)
019eec3923 [automerger] DO NOT MERGE Rework thumbnail cleanup am: b514ce9b38 am: b8dad6c644
Change-Id: I8539a02510ed9a61b683c66c66de7d1b319c2603
2018-03-15 19:59:32 +00:00
Android Build Merger (Role)
b8dad6c644 [automerger] DO NOT MERGE Rework thumbnail cleanup am: b514ce9b38
Change-Id: I5cb1316547ced23a1259e068d1ea34631d105608
2018-03-15 19:59:26 +00:00
Marco Nelissen
b514ce9b38 DO NOT MERGE Rework thumbnail cleanup
Bug: 63766886
Test: ran CTS tests
Change-Id: I1f92bb014e275eafe3f42aef1f8c817f187c6608
Merged-In: I1f92bb014e275eafe3f42aef1f8c817f187c6608
2018-03-15 19:58:42 +00:00
Marco Nelissen
0dc23f95a1 Rework thumbnail cleanup
Bug: 63766886
Test: ran CTS tests
Change-Id: I1f92bb014e275eafe3f42aef1f8c817f187c6608
Merged-In: I1f92bb014e275eafe3f42aef1f8c817f187c6608
2018-03-13 00:23:51 +00:00
Android Build Merger (Role)
a1ad0de1f7 [automerger] [DO NOT MERGE] Copy PermissionChecker from support lib and use in RcognitionService am: 5a28e533fe am: b91acca082 am: 26aaadd3b5
Change-Id: Icf7b82e7dfbdebeb382c56e2c1db061abd87a3e9
2018-03-09 00:35:53 +00:00
Android Build Merger (Role)
26aaadd3b5 [automerger] [DO NOT MERGE] Copy PermissionChecker from support lib and use in RcognitionService am: 5a28e533fe am: b91acca082
Change-Id: I0cbca14aed609ab81556ee1deb72ef1e0e294256
2018-03-09 00:35:48 +00:00
Android Build Merger (Role)
b91acca082 [automerger] [DO NOT MERGE] Copy PermissionChecker from support lib and use in RcognitionService am: 5a28e533fe
Change-Id: I09ac593ade4e725b560384042304f93f451b5be5
2018-03-09 00:35:42 +00:00
Eugene Susla
5a28e533fe [DO NOT MERGE] Copy PermissionChecker from support lib and use in RcognitionService
Fixes: 73511076, 73311729
Test: presubmit
Change-Id: Ie98f67ffee4744050ac85d8b229370a16a76a194
(cherry picked from commit 726b51a26e)
2018-03-09 00:35:39 +00:00
Siyamed Sinir
eaa093272e Merge "DO NOT MERGE Fix mTrustManager NPE" into mnc-dev 2018-02-15 00:14:36 +00:00
Android Build Merger (Role)
15a3e59d35 [automerger] DO NOT MERGE Fix mTrustManager NPE am: a381c4ced3 am: 30a705874a am: 85727109f0
Change-Id: I80463ee5315c2672e812659192b227c8271e9113
2018-02-15 00:05:49 +00:00
Android Build Merger (Role)
85727109f0 [automerger] DO NOT MERGE Fix mTrustManager NPE am: a381c4ced3 am: 30a705874a
Change-Id: Ic83a666bae330bea031b95233079e1493c02c9b3
2018-02-15 00:05:43 +00:00
Android Build Merger (Role)
30a705874a [automerger] DO NOT MERGE Fix mTrustManager NPE am: a381c4ced3
Change-Id: Ib622af453781a1769e820c10d6ab46c140809c57
2018-02-15 00:05:38 +00:00
Android Build Merger (Role)
bdff04aba3 [automerger] Adjust URI host parsing to stop on \ character. am: fa3afbd0e7 am: 97668ae137 am: fddbf1b6b2 am: d3c0db66b9 am: 373cfa75c0
Change-Id: Ia7b1157fb7f2066e26dc82ec703f39cd9fa69fd7
2018-01-31 11:20:28 +00:00
Android Build Merger (Role)
373cfa75c0 [automerger] Adjust URI host parsing to stop on \ character. am: fa3afbd0e7 am: 97668ae137 am: fddbf1b6b2 am: d3c0db66b9
Change-Id: If07298bb4ecf8a55391a014568a3ea264358b0e9
2018-01-31 11:20:21 +00:00
Android Build Merger (Role)
d3c0db66b9 [automerger] Adjust URI host parsing to stop on \ character. am: fa3afbd0e7 am: 97668ae137 am: fddbf1b6b2
Change-Id: I3fd20a3ee5eaa6be1c1989f13d40aed34136557e
2018-01-31 11:20:15 +00:00
Android Build Merger (Role)
fddbf1b6b2 [automerger] Adjust URI host parsing to stop on \ character. am: fa3afbd0e7 am: 97668ae137
Change-Id: Ic336b5fafebabdd4a5ad4d775a96d76739189a09
2018-01-31 11:20:08 +00:00
Android Build Merger (Role)
97668ae137 [automerger] Adjust URI host parsing to stop on \ character. am: fa3afbd0e7
Change-Id: I20336a5786e753e6941b9a784068480475415110
2018-01-31 11:19:56 +00:00
Adam Vartanian
fa3afbd0e7 Adjust URI host parsing to stop on \ character.
The WHATWG URL parsing algorithm [1] used by browsers says that for
"special" URL schemes (which is basically all commonly-used
hierarchical schemes, including http, https, ftp, and file), the host
portion ends if a \ character is seen, whereas this class previously
continued to consider characters part of the hostname.  This meant
that a malicious URL could be seen as having a "safe" host when viewed
by an app but navigate to a different host when passed to a browser.

[1] https://url.spec.whatwg.org/#host-state

Bug: 71360761
Test: vogar frameworks/base/core/tests/coretests/src/android/net/UriTest.java (on NYC branch)
Test: cts -m CtsNetTestCases (on NYC branch)
Change-Id: Id53f7054d1be8d59bbcc7e219159e59a2425106e
2018-01-31 11:14:45 +00:00
Siyamed Sinir
a381c4ced3 DO NOT MERGE Fix mTrustManager NPE
When isDeviceLocked function is called in KeyguardManager, mTrustManager
can be null. To prevent NPE during this call, moved the mTrustManager
access to a synchronized getter.

Test: run cts -c android.print.cts.PageRangeAdjustmentTest -m testWantedPagesAlreadyWrittenForPreview
Test: run cts -c android.accessibilityservice.cts.AccessibilityEndToEndTest -m testTypeViewTextChangedAccessibilityEvent
Test: run cts -c com.android.cts.appsecurity.DocumentsTest -m testCreateExisting
Test: run cts -c com.android.cts.devicepolicy.ManagedProfileTest -m testCrossProfileCopyPaste
Test: run cts -c android.text.method.cts.PasswordTransformationMethodTest

Bug: 69471788
Change-Id: I4b4a0bb3b127424fecdad85ba559ce861af165e4
2017-12-22 21:09:39 +00:00
Adam Vartanian
3ac5dabc21 Adjust Uri host parsing to use last instead of first @. am: cd6228dd37 am: 6a9c7c4814 am: 4158c9fbf3 am: eee677386e am: 49e5fca362
am: 240b55de2c

Change-Id: Ie3d378e8d9aeaff6f45838ebe988a5799f6acf3b
2017-11-07 21:56:10 +00:00
Adam Vartanian
240b55de2c Adjust Uri host parsing to use last instead of first @. am: cd6228dd37 am: 6a9c7c4814 am: 4158c9fbf3 am: eee677386e
am: 49e5fca362

Change-Id: Id6f38542623d768bebcfae7e79e8e49450329037
2017-11-07 21:41:55 +00:00
Adam Vartanian
49e5fca362 Adjust Uri host parsing to use last instead of first @. am: cd6228dd37 am: 6a9c7c4814 am: 4158c9fbf3
am: eee677386e

Change-Id: Ifd94d94c5376a6b4f1174aa7c2c8bb6d40199d89
2017-11-07 21:29:27 +00:00
Adam Vartanian
eee677386e Adjust Uri host parsing to use last instead of first @. am: cd6228dd37 am: 6a9c7c4814
am: 4158c9fbf3

Change-Id: I61bc0f5471d8f7a9a59136f320d465f2ee81b518
2017-11-07 21:02:07 +00:00
Adam Vartanian
4158c9fbf3 Adjust Uri host parsing to use last instead of first @. am: cd6228dd37
am: 6a9c7c4814

Change-Id: I80bedf58833511d336839df9f17daf65cfebfacf
2017-11-07 20:51:02 +00:00
Adam Vartanian
6a9c7c4814 Adjust Uri host parsing to use last instead of first @.
am: cd6228dd37

Change-Id: I5db66a5a2073acaffe0560999c914a78df362c51
2017-11-07 20:41:28 +00:00
Adam Vartanian
cd6228dd37 Adjust Uri host parsing to use last instead of first @.
Malformed authority segments can currently cause the parser to produce
a hostname that doesn't match the hostname produced by the WHATWG URL
parsing algorithm* used by browsers, which means that a URL could be seen
as having a "safe" host when checked by an Android app but actually visit
a different host when passed to a browser.  The WHATWG URL parsing
algorithm always produces a hostname based on the last @ in the authority
segment, so we do the same.

* https://url.spec.whatwg.org/#authority-state resets the "buffer", which
  is being used to build up the host name, each time an @ is found, so it
  has the effect of using the content between the final @ and the end
  of the authority section as the hostname.

Bug: 68341964
Test: vogar android.net.UriTest (on NYC branch)
Test: cts -m CtsNetTestCases (on NYC branch)
Change-Id: Idca79f35a886de042c94d6ab66787c2e98ac8376
2017-11-07 15:51:53 +00:00
TreeHugger Robot
039b357a46 Merge "Fix security hole in GateKeeperResponse." into mnc-dev 2017-08-15 19:30:53 +00:00
Charles He
a3c1de7e49 [automerger] Fix security hole in GateKeeperResponse. am: e74cae8f7c am: b1141b6ff0 am: 1cd9e8096f am: 6dfc8d8d4d
Change-Id: Ia5ad4b5d36d92caa26fa69951180320848c372e7
2017-08-15 17:52:57 +00:00
Charles He
6dfc8d8d4d [automerger] Fix security hole in GateKeeperResponse. am: e74cae8f7c am: b1141b6ff0 am: 1cd9e8096f
Change-Id: I2fce56d688cc0a4111668c695c9cf9b1c930faf8
2017-08-15 17:52:27 +00:00