1781 Commits

Author SHA1 Message Date
Adrian Roos
4749930c37 MessagingStyle: Fix buggy measure in MessagingLinearLayout
Fixes a bug in MessagingLinearLayout where we would not
recompute the height of it after applying the computed
insets to the text views, leading to incorrect padding
and in rare cases a cut off message at the bottom.

Change-Id: If87a527555158e94e501832e9f49e380cc7da2bb
Test: runtest -x core/tests/coretests/src/com/android/internal/widget/MessagingLinearLayoutTest.java
Fixes: 31463075
(cherry picked from commit 4ac8f40d96196a2a36d7bda7d92eee9bbd4ee7e7)
2017-01-24 20:00:52 +00:00
Santos Cordon
d6a5660a2c Add Brightness setting for VR Mode.
This change saves and loads a different brightness setting when the user
goes in and out of VR Mode.

Bug: 30984614
Change-Id: If3c3e81b592e0c6fd037e5783559683e5cb58379
2017-01-09 17:33:14 -08:00
Kweku Adams
c6bd4243a4 Fixing issue in current and max duration calculations.
It looks like one operation was done out of order and some of the times used in
the calculations were leading to incorrect results.

BUG: 31023263
Test: bit FrameworksCoreTests:com.android.internal.os.BatteryStatsDurationTimerTest

Change-Id: I417cc28c5a55748067b6c7f682a66fe3dbc09f09
(cherry picked from commit 47db5a8bf74a77306b811d14e3c052cdf86ef704)
2016-12-14 21:54:48 +00:00
Hugo Benichi
97d10ffcad DO NOT MERGE IpConnectivityMetrics: rate limit ApfProgramEvents
This patch uses the previously introduced TokenBucket to rate limit
ApfProgramEvents, still allowing for burst of ApfProgramEvents when a
new interface is set up (due to ipv4 provisioning, multicast lock, ipv6 RAs
triggering new APF program events in short amounts of time).

Test: new test in IpConnectivityMetricsTest
Bug: 1550402

(cherry picked from commit e1c173d2240a8eedf7685c9371087dc047a6931f)

Change-Id: Ibe41e9a76db36ea502697a5f19fc0d91c40a3087
2016-12-13 10:20:03 +09:00
Hugo Benichi
f6fdb4a552 DO NOT MERGE TokenBucket for rate-limiting and throttling
This patch adds a TokenBucket class that can accumulate and distribute
tokens over time.

Test: comes with unit tests.
Bug: 32198637

(cherry picked from commit 998493f0ee39ae0e9ffdea27f48f1b11b0807fcb)

Change-Id: Iaf477c7bb14f8ddb293b7a907e2ab0cf76d09e07
2016-12-13 10:20:03 +09:00
Svetoslav Ganov
ff112f6ad2 Fix vulnerability in MemoryIntArray am: 1181f448c1 am: d08cf2b071
am: 385277305e

Change-Id: Ie90f6504f26526256671b057dfbb0c93e8c193c5
2016-12-09 01:52:48 +00:00
Svetoslav Ganov
d08cf2b071 Fix vulnerability in MemoryIntArray
am: 1181f448c1

Change-Id: I4217066be49bb9525e945f110c22eb864ec6c212
2016-12-09 01:43:52 +00:00
Svetoslav Ganov
1181f448c1 Fix vulnerability in MemoryIntArray
MemoryIntArray was using the size of the undelying
ashmem region to mmap the data but the ashmem size
can be changed until the former is memory mapped.
Since we use the ashmem region size for boundary
checking and memory unmapping if it does not match
the size used while mapping an attacker can force
the system to unmap memory or to access undefined
memory and crash.

Also we were passing the memory address where the
ashmem region is mapped in the owner process to
support cases where the client can pass back the
MemoryIntArray instance. This allows an attacker
to put invalid address and cause arbitrary memory
to be freed.

Now we no longer support passing back the instance
to the owner process (the passed back instance is
read only), so no need to pass the memory adress
of the owner's mapping, thus not allowing freeing
arbitrary memory.

Further, we now check the memory mapped size against
the size of the underlying ashmem region after we do
the memory mapping (to fix the ahsmem size) and if
an attacker changed the size under us we throw.

Tests: Updated the tests and they pass.

bug:33039926
bug:33042690

Change-Id: Ibf56827209a9b791aa83ae679219baf829ffc2ac
2016-12-09 00:08:33 +00:00
Bill Napier
31f2e91892 Revert "Fix vulnerability in MemoryIntArray am: a97171ec49" am: 43966dafb3 am: 498547ec6c
am: ef435f6780

Change-Id: Ib5c8b17acafa4a2c55666c2dbc1591bbbeac51a7
2016-12-08 22:40:05 +00:00
Bill Napier
498547ec6c Revert "Fix vulnerability in MemoryIntArray am: a97171ec49"
am: 43966dafb3

Change-Id: I01bc83edd411dc39cb696e64ea35b5d4a8497fbf
2016-12-08 22:30:02 +00:00
Bill Napier
43966dafb3 Revert "Fix vulnerability in MemoryIntArray am: a97171ec49"
This reverts commit fb12dd509f8e106d034f67c2e404845128128994.

Change-Id: I9e1b22b8df0e754095541a758096cba279a81ab1
2016-12-08 22:22:38 +00:00
Svetoslav Ganov
49e3ce4800 Fix vulnerability in MemoryIntArray am: a97171ec49 am: fb12dd509f am: a5ee109029
am: 5250d90637

Change-Id: I08c3a670598d8d26694b7d282d0bd18ffb4faf9b
2016-12-08 21:51:00 +00:00
Svetoslav Ganov
a5ee109029 Fix vulnerability in MemoryIntArray am: a97171ec49
am: fb12dd509f

Change-Id: I269ec7d61ebdc9f485d759d1398d5fa4eacf868f
2016-12-08 21:42:05 +00:00
Svetoslav Ganov
fb12dd509f Fix vulnerability in MemoryIntArray
am: a97171ec49

Change-Id: Ifa2221a9b8ca705ef0239d61772938ac11761ce2
2016-12-08 21:37:33 +00:00
Svetoslav Ganov
a97171ec49 Fix vulnerability in MemoryIntArray
MemoryIntArray was using the size of the undelying
ashmem region to mmap the data but the ashmem size
can be changed until the former is memory mapped.
Since we use the ashmem region size for boundary
checking and memory unmapping if it does not match
the size used while mapping an attacker can force
the system to unmap memory or to access undefined
memory and crash.

Also we were passing the memory address where the
ashmem region is mapped in the owner process to
support cases where the client can pass back the
MemoryIntArray instance. This allows an attacker
to put invalid address and cause arbitrary memory
to be freed.

Now we no longer support passing back the instance
to the owner process (the passed back instance is
read only), so no need to pass the memory adress
of the owner's mapping, thus not allowing freeing
arbitrary memory.

 Further, we now check the memory mapped size against
 the size of the underlying ashmem region after we do
 the memory mapping (to fix the ahsmem size) and if
 an attacker changed the size under us we throw.

 Tests: Updated the tests and they pass.

 bug:33039926
 bug:33042690

Change-Id: I1004579181ff7a223ef659e85c46100c47ab2409
2016-12-08 11:51:26 -08:00
Svetoslav Ganov
061d2b6cad Revert "Fix vulnerability in MemoryIntArray" am: 1f06508bc6 am: 64b5725900 am: 60357eb6bd
am: 590b77da13

Change-Id: Ic676846ed4e671535ed79cbec39ab33ad52c97f1
2016-12-08 02:40:55 +00:00
Svetoslav Ganov
60357eb6bd Revert "Fix vulnerability in MemoryIntArray" am: 1f06508bc6
am: 64b5725900

Change-Id: Id7021fb02059cfb3bb9184ef24f417c0be7f55b9
2016-12-08 02:33:00 +00:00
Svetoslav Ganov
64b5725900 Revert "Fix vulnerability in MemoryIntArray"
am: 1f06508bc6

Change-Id: Id387817495b1857f304203c8487da3db49bdd0e4
2016-12-08 02:29:00 +00:00
Svetoslav Ganov
1f06508bc6 Revert "Fix vulnerability in MemoryIntArray"
This reverts commit 4694cad51122c20880d00389ef95833d7a14b358.

Change-Id: I235ea3c4bd86d90bf97bc1a2d023f4780251e570
2016-12-08 02:17:40 +00:00
Svetoslav Ganov
6023fd1800 Fix vulnerability in MemoryIntArray am: 4694cad511 am: ec40a70ffb am: 138a541eaa
am: 557858b9c0

Change-Id: Ia6b6b59be28f938f4c3a7c4aecb035fd4c6607f6
2016-12-08 02:08:23 +00:00
Aart Bik
116a4e883d Revert "Fix vulnerability in MemoryIntArray" am: 29139a8ae5 am: 86699f980f am: 65cf055ad9
am: 278cad4793

Change-Id: I545ba917e74f34716fe773250468e06b1dfd8312
2016-12-08 02:00:56 +00:00
Svetoslav Ganov
138a541eaa Fix vulnerability in MemoryIntArray am: 4694cad511
am: ec40a70ffb

Change-Id: I5d03aaa04fe13b3af20bcc61e9bb925b471ab825
2016-12-08 01:56:24 +00:00
Svetoslav Ganov
ec40a70ffb Fix vulnerability in MemoryIntArray
am: 4694cad511

Change-Id: I64257a851c06e4a333056ee132ff8a2ea29aef5c
2016-12-08 01:49:21 +00:00
Aart Bik
65cf055ad9 Revert "Fix vulnerability in MemoryIntArray" am: 29139a8ae5
am: 86699f980f

Change-Id: I7876874ba0d6815920f21021a47e3fe1b3e1c42f
2016-12-08 01:44:54 +00:00
Aart Bik
86699f980f Revert "Fix vulnerability in MemoryIntArray"
am: 29139a8ae5

Change-Id: I3975cfc51bd03a65855c113dfdb827d24471e0ba
2016-12-08 01:36:50 +00:00
Svetoslav Ganov
4694cad511 Fix vulnerability in MemoryIntArray
MemoryIntArray was using the size of the undelying
ashmem region to mmap the data but the ashmem size
can be changed until the former is memory mapped.
Since we use the ashmem region size for boundary
checking and memory unmapping if it does not match
the size used while mapping an attacker can force
the system to unmap memory or to access undefined
memory and crash.

Also we were passing the memory address where the
ashmem region is mapped in the owner process to
support cases where the client can pass back the
MemoryIntArray instance. This allows an attacker
to put invalid address and cause arbitrary memory
to be freed.

Now we no longer support passing back the instance
to the owner process (the passed back instance is
read only), so no need to pass the memory adress
of the owner's mapping, thus not allowing freeing
arbitrary memory.

Further, we now check the memory mapped size against
the size of the underlying ashmem region after we do
the memory mapping (to fix the ahsmem size) and if
an attacker changed the size under us we throw.

Tests: Updated the tests and they pass.

bug:33039926
bug:33042690

Change-Id: Id7f0e8a4c861b0b9fa796767e0c22d96633b14d1
2016-12-08 01:35:08 +00:00
Aart Bik
29139a8ae5 Revert "Fix vulnerability in MemoryIntArray"
This reverts commit 86dfa094de773670743d41c3e3156eace8e403a3.


BROKE BUILD (as shown in some treehugger builds)

frameworks/base/core/java/android/util/MemoryIntArray.java:84: error: cannot find symbol
        mCloseGuard.open("close");
        ^
        
       
bug:33039926
bug:33042690

Change-Id: Ief875e543ec849fe55c747fb1ed5253f0cd9a122
2016-12-08 01:12:48 +00:00
Svetoslav Ganov
9aed2f6f53 Fix vulnerability in MemoryIntArray am: 86dfa094de am: 367023218e am: e123f41553
am: b317e60014

Change-Id: I550293e05ce1d1039e3f22f72002e69df919f735
2016-12-08 01:04:48 +00:00
Svetoslav Ganov
e123f41553 Fix vulnerability in MemoryIntArray am: 86dfa094de
am: 367023218e

Change-Id: I38d3f7089b9678210772f79215b44198b262e922
2016-12-08 00:49:48 +00:00
Svetoslav Ganov
367023218e Fix vulnerability in MemoryIntArray
am: 86dfa094de

Change-Id: I664782bea6e2b941ba94e51c65afd7e9b0f95f8d
2016-12-08 00:42:18 +00:00
Svetoslav Ganov
86dfa094de Fix vulnerability in MemoryIntArray
MemoryIntArray was using the size of the undelying
ashmem region to mmap the data but the ashmem size
can be changed until the former is memory mapped.
Since we use the ashmem region size for boundary
checking and memory unmapping if it does not match
the size used while mapping an attacker can force
the system to unmap memory or to access undefined
memory and crash.

Also we were passing the memory address where the
ashmem region is mapped in the owner process to
support cases where the client can pass back the
MemoryIntArray instance. This allows an attacker
to put invalid address and cause arbitrary memory
to be freed.

Now we no longer support passing back the instance
to the owner process (the passed back instance is
read only), so no need to pass the memory adress
of the owner's mapping, thus not allowing freeing
arbitrary memory.

Further, we now check the memory mapped size against
the size of the underlying ashmem region after we do
the memory mapping (to fix the ahsmem size) and if
an attacker changed the size under us we throw.

Tests: Updated the tests and they pass.

bug:33039926
bug:33042690

Change-Id: Ie267646eb88014034fbd048d7a9bc273420c7eff
2016-12-07 15:19:13 -08:00
Adrian Roos
62be439d26 Notifications: Fix bad layout for long texts
Fixes a bug where the max lines restriction was not properly
passed to ImageFloatingTextView's layout, causing the TextView
to improperly apply bottom padding.

Change-Id: Ibe07515866a4599047712a0482332ed4430c9056
Test: runtest -x core/tests/coretests/src/com/android/internal/widget/ImageFloatingTextViewTest.java
Fixes: 32658499
Bug: 32658499
2016-12-06 14:17:06 -08:00
Jeremy Joslin
3f0d75afe8 VPN network stat accounting changes.
Properly account for VPN apps that make heavy use of the tun
interface. Prior to this change a VPN app could be incorrectly charged
for more data than it actually used if it sent more traffic through
the tun interface than the underlying interface.

This change excludes VPN app traffic on the tun interface from the
adjustment pool and doesn't redistribute traffic to the VPN app.
Instead all of the redistributed traffic is deducted from the VPN app
which effectively represents any overhead incurred by the VPN app.

BUG: 30557871
Change-Id: I62a75a0c0c0111e052b7903baa9f5d6d94ef57fd
2016-10-21 18:47:57 +09:00
Adam Powell
100ba76d7a Null check for restoring LoaderManagers
Bug 31671195
Test: core/tests/coretests/src/android/app/LoaderLifecycleTest.java

Change-Id: Ib553f7611814cc6759488aec505fd126ee664a9d
2016-09-22 10:53:45 -07:00
TreeHugger Robot
33c9713bdd Merge "Don't hold old host callback for fragments on the back stack" into nyc-mr1-dev 2016-09-22 00:50:00 +00:00
Jeff Sharkey
2c89a4c170 Rename should behave like create: avoid conflict.
When we create a file that already exists, we try attaching a suffix
like "(1)" to the filename to avoid the conflict.  The newly added
rename method should do the same, since developers may not have
access to delete the conflicting file.

Test: boots, rename via UI, new unit tests
Bug: 31545404
Change-Id: Ie397eebb0fbf98cf079eee3bbbb6c6b7ca627d91
2016-09-21 23:01:25 +00:00
Adam Powell
180202f221 Don't hold old host callback for fragments on the back stack
LoaderManagers configure their host callback lazily as their
associated fragment is brought up through its lifecycle states. In the
case of fragments on the fragment back stack this could happen very
late, if at all. As a LoaderManager's host callback references the
host Activity, this means that a LoaderManager could keep a destroyed
Activity reference alive.

Update the host callbacks of all LoaderManagers eagerly during the
restore non-configuration instance phase.

Bug: 30653222
Test: core/tests/coretests/src/android/app/LoaderLifecycleTest.java
Change-Id: I5d2b81daae5e7cae429fcf4934e64b3ce281140c
2016-09-21 15:47:06 -07:00
Patrick Baumann
2baf095ca9 Adding advanced pattern support to PatternMatcher
This change adds a new pathMatch attribute to the intent-filter tag
that supports a subset of regular expression syntax. Supported
tokens include dot (.) and set ([]) and supported modifiers include
zero-or-more (*), one-or-more(+) and ranges ({}).

Change-Id: I2ec3bc8a9eb3e94d21caf34a1ed0f3fd3fb33a35
Bug: 30805203
2016-09-15 11:17:54 -07:00
Adam Lesinski
9edd6be542 SamplingTimer: Fix issue with summary recording too much
The summary is supposed to just hold enough data to continue counting
once the device has reset. Since kernel stats reset when the device
resets, and the first update is ignored to account for soft resets where the
kernel continues running, SamplingTimer should not be recording the last value
it saw from /proc/wakelocks in the summary.

Bug:30575302
Change-Id: Ic193bc5af9a0ede514e3abc8146523d7316c47d3
2016-08-12 15:49:44 -07:00
Joe Onorato
adbee556a9 Have BatteryStats track and report the running wakelocks.
The times reported are in the screen off / on battery time base.

Bug: 29546924
Change-Id: I025b2959becb256a26cf531e944786d4e9a59149
2016-08-05 16:10:13 -07:00
Adrian Roos
f86d855125 Merge "Add ApplicationErrorReport tests" into nyc-mr1-dev 2016-07-15 18:24:28 +00:00
Raph Levien
c0ab2e83ac Merge "Treat U+2695, U+2640, U+2642 as emoji characters." into nyc-mr1-dev 2016-07-14 22:25:40 +00:00
Adrian Roos
a4f9ec94ba Add ApplicationErrorReport tests
Tests that long stack traces and exception messages are
truncated to a reasonable size when a CrashReport is generated.

Bug: 29918978
Change-Id: I4d8202ddca850a72e0853e4064d5690965ff371c
2016-07-13 15:08:20 -07:00
Seigo Nonaka
3c7a0a0af4 Treat U+2695, U+2640, U+2642 as emoji characters.
Bug: 29885295
Change-Id: If187a08574b86ab775b0a4594d21bc9e26f84e2f
(cherry picked from commit beb21afc2e3aedd17a3fbcb044a7fa44c0daf69d)
2016-07-13 21:10:56 +00:00
Seigo Nonaka
f20ca2cb15 Delete gender-balanced emoji sequence by one backspace key event.
The gender-balanced emojis are made with ZWJ sequence and emoji
modifiers.  For example, U+1F469 U+1F3FD U+200D U+1F4BC should be
deleted at the same time by single backsapce key event.  Here, U+1F469
is WOMAN, U+1F3FD is EMOJI MODIFIER FITZPATRICK TYPE-4, U+200D is ZERO
WIDTH JOINER, U+1F4BC is BRIEFCASE.

This CL also renames the state name from STATE_BEFORE_ZWJ_EMOJI to
STATE_BEFORE_EMOJI since now all emoji can be a part of ZWJ sequence
after I572dad42ee108476962d4b3fe9f3a6019cb50098

BUG: 29728397
Change-Id: Ib114295db45c6592f1c65a0773ab236f8bf35209
(cherry picked from commit bba8d97c369f02a9d1988217324724a24842079f)
2016-07-13 21:08:10 +00:00
Adam Lesinski
ac3e0e590a Update DisplayMetrics when resizing
Previously the DisplayMetrics passed to a new ResourcesImpl
object would be generated from the default DisplayAdjustments.
We now use the correct DisplayAdjustments for the ResourcesImpl
and make sure to update them for things like rotation changes.

Bug:29619314
Change-Id: If2ba0d7670a4554dcd3fde9766e2337f20a191fd
(cherry picked from commit 8e8d23214a71d8813ebd3676b192924c530cb913)
2016-06-24 22:11:27 +00:00
Adam Lesinski
8e8d23214a Update DisplayMetrics when resizing
Previously the DisplayMetrics passed to a new ResourcesImpl
object would be generated from the default DisplayAdjustments.
We now use the correct DisplayAdjustments for the ResourcesImpl
and make sure to update them for things like rotation changes.

Bug:29619314
Change-Id: If2ba0d7670a4554dcd3fde9766e2337f20a191fd
2016-06-24 13:13:19 -07:00
Bennie Ouyang
26eed32de7 Merge \"Fixed notificaiton Stress Test\" into nyc-dev
am: 2f59ee10b2

Change-Id: I7d52973c6d2d85b3aef692b7447d7ab77034d939
2016-06-21 23:35:06 +00:00
Bennie Ouyang
4316180061 Fixed notificaiton Stress Test
Bug: 29506953
Change-Id: I8f8e7b2f0b03b48665b524472a8e81aef6a7a708
2016-06-21 09:59:53 -07:00
Yuchao Zhou
571a4a97cd Update enable/disable code to reduce flakiness
Change-Id: I9d3f69ca583b365bb5f89cfe16adcd6e604614c6
2016-06-08 14:14:37 -07:00