1748 Commits

Author SHA1 Message Date
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
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
TreeHugger Robot
3e2bfbd135 Merge changes Ic98e3bcb,Idb0c55fc,Ia8649061,I5e7e5a87 into nyc-mr1-dev
* changes:
  Give WakeupMessage the ability to transport an object as well.
  Don't treat the lingerExpired broadcast specially.
  Add a test for mobile data always on.
  Add a FakeSettingsProvider and use it in ConnectivityServiceTest.
2016-06-08 06:35:32 +00:00
Lorenzo Colitti
eab17da588 Give WakeupMessage the ability to transport an object as well.
Bug: 23113288
Change-Id: Ic98e3bcb3ea8b0b28a309bd647fb4178311c46a3
2016-06-08 14:11:52 +09:00
Sharvil Nanavati
957abc8318 Fix build break by adding missing parenthesis.
Change-Id: Ia9a47e24b25e3093f19aeea297a86964c8f00722
2016-06-07 16:41:16 -07:00
Sharvil Nanavati
f6aebbe4bd Fix flaky discoverable stress test.
Bug: 28980767
Change-Id: I6858456f58118a3385b05d42361a5c9223ebbdc4
2016-06-07 15:01:49 -07:00
Sharvil Nanavati
6570340f71 Clean up Bluetooth test code.
Change-Id: I502b03df842c628c7b504e2a32a17bce6d25b4f8
2016-05-25 15:27:41 -07:00
Adam Lesinski
b61e405397 Improve performance of LocaleList with Resources
We allow each individual Resources object to select the best
Locale for the given APK. This allows one update to the configuration
instead of multiple updates, once the locale is chosen.

The Java locale is selected from the app context's locale.

Bug:28625993
Bug:27325465
Change-Id: I99e1e53f522e560f3b80bbd1e1c605f552dbdff0
2016-05-24 12:54:48 -07:00
Adam Lesinski
6f0d399214 Merge "Fix parsing of kernel wakelocks" into nyc-dev 2016-05-20 17:23:08 +00:00
Adam Lesinski
d84ad30ee6 Fix parsing of kernel wakelocks
We handled stale wakelocks (wakelocks that disappear from /d/wakeup_sources)
differently in previous version of Android. They would be set stale, but still be
updated with their previous counts (they would never disappear).

The method setStale has been replaced with endSample(), which is semantically different.
Once a SamplingTimer has endSample() called, it expects any future calls to update() to
be a new sample, meaning the entire amount passed to update() is included in the kernel
wakelock's total. Since stale wakelocks were never removed from the list, this would
increase by large amounts when nothing had actually changed.

This was exacerbated by the fact that there was a bug where the last wakelock in
/d/wakeup_sources was never parsed, so if the order ever changed, this "stale" wakelock
would suddenly re-appear and the entire amount reported would be charged to the wakelock,
instead of just the difference since the last update.

All this was exposed when we added support to handle wakelocks that would disappear and
reappear with smaller values, meaning the kernel had pruned them from its accounting and
reset them.

Bug:28601080
Change-Id: Ic96027f7d580dac5e20aa73d67e5cedac4ccabeb
2016-05-19 17:21:10 -07:00
Yohei Yukawa
23cbe85610 Move LocaleList to avoid layering violation.
Since LocaleList needs to depend on android.os.Parcelable, we cannot let
that class belong to "android.util" package, which causes layering
violation.

Bug: 28819696
Change-Id: Ia8de2ee9df3dd0a42b1fe84574439519b680fe18
2016-05-17 16:42:58 -07:00
Svetoslav Ganov
04df738bcb Make settings cahches generation mechanism robust.
Settings is using a MemoryIntArray to communicate the settings table
version enabling apps to have up-to-date local caches. However, ashmem
allows an arbitrary process with a handle to the fd (even in read only
mode) to unpin the memory which can then be garbage collected. Here we
make this mechanism fault tolerant against bad apps unpinning the ashmem
region. First, we no longer unpin the ashmem on the client side and if
the ashmem region is purged and cannot be pinned we recreate it and
hook up again with the local app caches. The change also adds a test
that clients can only read while owner can read/write.

bug:28764789

Change-Id: I1ef79b4b21e976124b268c9126a55d614157059b
2016-05-13 15:14:14 -07:00
Felipe Leme
46c4fc357c Refactored NetworkPolicyManagerService mUidRules.
NetworkPolicyManagerService (NMPS) keeps an internal list of uid
rules (mUidRules) for network restrictions, and when these rules
changes it needs to notify external listeners (such as
ConnectivityService / CS).

Prior to Android N, both Data Saver mode (the feature previously known
as "Restrict Baground Data") and Battery Save mode used the same set of
firewall rules to implement their restrictions: when Battery Saver mode
NPMS would mark all networks as metered and set the proper firewall
rules externally.

Recently, these 2 modes were split in 2 distinct firewall rules and
NMPS.updateRuleForRestrictBackgroundLocked() was changed to update
the mUidRules logic based on the Data Saver firewall (since the Battery
Saver firewall changes are handled externally, on
updateRuleForRestrictPowerLocked()). As such, CS was not notified when
the power-related changes were made, which would cause apps to get a
state of CONNECTED / CONNECTED when querying its active connection.

This change refactores the mUidRules to use bitmasks, in preparation for
another change that will fix the issue.

It also fixes a minor bug that was preventing removed packages to be
removed from the whitelist.

BUG: 28521946
Change-Id: I9f0e1509a6192cad403f740c1cd76a6b7dab7d26
2016-05-06 17:58:40 +00:00
Svetoslav Ganov
f71d7feef2 Merge "Ensure local settings caches are not stale" into nyc-dev 2016-04-26 18:36:28 +00:00
Svet Ganov
53a441ca8e Ensure local settings caches are not stale
We used the system proterties as a shared memory mechanism
to propagate information to local settings caches when the
content has changed and the cache should be cleared. The
system properties are unfortunately updated asynchronously
leading to cases where clients may read stale data.

This change adds a simple int array data structure backed
by shared memory which guarantees individual values are
atomically read and updated without memory tear. Multi-
index opearations are not synchronized between each other.

The settings provider is using the new data structure to
propagate the settings generation which drives when caches
are purged.

We have a single memory array keeping the generation for
different settings tables per user. Since memory array is
not a compact data structure and the user space exceeds
the memory array size we use an in-memory map from keys
to indices in the memory array where the generation id of
a key is stored. A key is derived by the setting type in
the 4 most significant bits and the user id in the 28 least
significant bits.

The mapping from a key to an index is cleared if the user is
removed and the corresponding index in the memory arry is
reset to make it available for other users. The size of the
memory array is derived from the max user count that can be
created at the same time.

bug:18826179

Change-Id: I64009cc5105309ef9aa83aba90b82afc8ad8c659
2016-04-26 11:31:55 -07:00
Adam Lesinski
757c6eacc8 BatteryStats: Fix up semantics of SamplingTimer
SamplingTimer has been losing some data, as well as not correctly handling
entries that have gone away and come back with less data (reset).

This change correctly ends a SamplingTimer sample by adding the accumulated amount
to the total, then reseting the running counter to accept new values.

This is also triggered automatically when the incoming data is less than what is currently
recorded.

Bug:25695597
Change-Id: I6b540906e6be527578d1003485384a75ba211b52
2016-04-22 14:48:18 -07:00
Adam Lesinski
752434a0ff Merge "Record in progress count when parceling Timer" into nyc-dev 2016-04-20 01:22:37 +00:00
Adam Lesinski
98f0d4692c Record in progress count when parceling Timer
The total time is computed before parceling, but the total count is not.

Bug:27747854
Change-Id: If3afdca9605f74d96a54fb9df17f6df761b99e55
2016-04-19 17:21:40 -07:00
Raph Levien
7ecd7671b7 Merge "Delete emojis before and after ZWJ at the same time." into nyc-dev 2016-04-19 18:31:05 +00:00
Seigo Nonaka
3675d3cd84 Delete emojis before and after ZWJ at the same time.
Vendor may want to introduce their own ZWJ emoji sequence. To delete
them by one back space as the same behavior of Unicode emoji sequence,
use all emoji as the zwj emoji.

Bug: 28248662
Change-Id: I572dad42ee108476962d4b3fe9f3a6019cb50098
2016-04-19 18:54:50 +09:00
Jeff Sharkey
84a4c971c4 Unlock should always wait for pending PRE_BOOT.
While processing an unlock request, we might go async to handle
long-running operations like dispatching PRE_BOOT_COMPLETED.  This
change ensures that all unlock requests for a particular user wait
in line behind any pending async operations.

Without this CL, any subsequent unlock requests would immediately
return successful, even though PRE_BOOT_COMPLETED events were still
being processed.

Bug: 28240584
Change-Id: I307d6aaebfb8f38028f3666a2e19e4399b7cf3a7
2016-04-18 15:38:35 -06:00
Narayan Kamath
a09b4d2a61 Remove unnecessary allocation+unboxing of objects.
Transforming String->int can be done with 0 allocations
using Integer.parseInt.

bug: 28078871
Change-Id: I8d9f322d7154728849dde61ef282046032858d60
2016-04-18 09:55:59 +01:00
Joe Onorato
65adfeecd2 Add some tests for procstats, and fix some bugs that the tests uncovered.
Bug: 27045736
Change-Id: Ia910730c5a3a899c89aa63dd7ab48be62cf9cfef
2016-04-12 13:13:41 -07:00
Siyamed Sinir
4b92594857 Merge "Exclude unicode space characters from autoLink URL patterns" into nyc-dev 2016-04-12 00:35:29 +00:00
Yohei Yukawa
d39ae85482 Shift+Meta+Space should reverse-rotate subtypes.
This is a follow up CL to my previous CL [1], which added a new key
binding Meta+Space to rotate enabled IME subtypes.  With this CL,
Shift+Meta+Space starts reverse-rotating enabled IME subtypes as
originally planed.

 [1]: I4005692215edfcf8bed3e86b1e07000148f986f5
      ae61f7118a92e097e854c840d5726c0920f5db0e

Bug: 25753404
Bug: 28103839
Change-Id: I3694edd80be6dfe18b90360e24ae4d451b331928
2016-04-10 20:28:40 -07:00
Bennie Ouyang
fc90ffe392 Merge "Added Notification Stress Tests" into nyc-dev 2016-04-08 16:58:21 +00:00
Bennie Ouyang
a6b8e9c313 Added Notification Stress Tests
Change-Id: I956ec68bf752becfedb3eca2483ae5c212166dd2
2016-04-07 16:15:50 -07:00
Adam Lesinski
41c1bb8f4a Merge "Remove tests that have been moved to CTS" into nyc-dev 2016-04-07 17:04:13 +00:00
Keisuke Kuroyanagi
d119ab94c0 Merge "Rewrite SuggestionsPopupWindowTest using espresso." into nyc-dev 2016-04-07 04:33:11 +00:00
Adam Lesinski
04518f8e9f Remove tests that have been moved to CTS
ag/906284

Change-Id: I9e5da9239a62dbc85a1b22f8fe8876da65675d9a
2016-04-06 17:47:10 -07:00
Keisuke Kuroyanagi
31eb74fb2b Rewrite SuggestionsPopupWindowTest using espresso.
- Rewrite existing test about text appearance.
- Add new tests for suggestions popup.

Bug: 25904136
Bug: 27765262
Change-Id: I12e522436a83fa264cd22176d054877eec411708
2016-04-06 19:37:46 +09:00
Makoto Onuki
ca94f29366 Merge "Make FastXmlSerializer more suitable to persist arbitrary strings" into nyc-dev 2016-04-06 00:36:52 +00:00
Siyamed Sinir
911c2694e2 Exclude unicode space characters from autoLink URL patterns
Excludes the following space characters from autoLink URL patterns:
\u00A0: no-break space
\u2000: en quad
\u2001: em quad
\u2002: en space
\u2003: em space
\u2004: three-per-em space
\u2005: four-per-em space
\u2006: six-per-em space
\u2007: figure space
\u2008: punctuation space
\u2009: thin space
\u200A: hair space
\u2028: line separator
\u2029: paragraph separator
\u202F: narrow no-break space
\u3000: ideographic space

Bug: 28020781
Change-Id: Ie6df818dc4d33dfee6ee54432a2231cca51ec423
2016-04-05 16:33:58 -07:00
Makoto Onuki
3ae3557ea3 Make FastXmlSerializer more suitable to persist arbitrary strings
- Encode '\u000' - '\u001F', so KXmlParser can read them properly.
Otherwise KXmlParser will ignore CRs/LFs in attributes, and CRs
in text.

- Originally FastXmlSerializer would throw if a string contains
dangling surrogate pairs.  Now we REPLACE them with.

Bug 27792649

Change-Id: I10c547dad2475b68f60e9e8208d9a3eae8e20063
2016-04-05 16:12:07 -07:00
Jeremy Joslin
b770ed1328 Merge "Have the NetworkScoreService bind to the scorer." into nyc-dev 2016-04-05 22:27:11 +00:00