Commit Graph

4673 Commits

Author SHA1 Message Date
Kurt Nelson
1efd46211f Merge "Plumb real stack traces through StrictMode" 2017-10-24 22:19:44 +00:00
Kurt Nelson
0918c93a3f Plumb real stack traces through StrictMode
Currently StrictMode uses a string representation of the entire stack
trace throughout. Switching to passing Throwables will allow callback
consumers to traverse an array.

It does not regress the performance test added in ag/3083879.

Test: adb shell am instrument -w -e class android.os.StrictModeTest \
    com.android.perftests.core/android.support.test.runner.AndroidJUnitRunner

timeThreadViolation_mean=332071
timeThreadViolation_median=328184
timeThreadViolation_min=311253
timeThreadViolation_standardDeviation=16106

timeCrossBinderThreadViolationNoStrictMode_mean=1843599
timeCrossBinderThreadViolationNoStrictMode_median=1824457
timeCrossBinderThreadViolationNoStrictMode_min=1810186
timeCrossBinderThreadViolationNoStrictMode_standardDeviation=43539

timeCrossBinderThreadViolation_mean=2300256
timeCrossBinderThreadViolation_median=2148796
timeCrossBinderThreadViolation_min=1792660
timeCrossBinderThreadViolation_standardDeviation=472271

timeVmViolationNoStrictMode_mean=27794864
timeVmViolationNoStrictMode_median=26617027
timeVmViolationNoStrictMode_min=23994153
timeVmViolationNoStrictMode_standardDeviation=3384362

timeVmViolation_mean=32878535
timeVmViolation_median=34775241
timeVmViolation_min=28373537
timeVmViolation_standardDeviation=3462046

timeThreadViolationNoStrictMode_mean=373863
timeThreadViolationNoStrictMode_median=388998
timeThreadViolationNoStrictMode_min=333664
timeThreadViolationNoStrictMode_standardDeviation=33219

Bug: 62458734
Change-Id: I6b3924be91f19654c502e0ec2f44cc07d6e86e3f
Test: cts-tradefed run cts-dev --module CtsOsTestCases --test
android.os.cts.StrictModeTest
2017-10-23 10:04:19 -07:00
TreeHugger Robot
b3d66a3ccd Merge "Changes pulled data to use Parcel objects." 2017-10-21 01:21:39 +00:00
David Chen
1481fe142d Changes pulled data to use Parcel objects.
Previously, pulled data was returned as a string. We instead
return the data as an array of StatsLogEventWrapper, which encodes
using the binary-encoded format liblog uses. StatsD uses the same
parsing as for pushed events to convert these. This CL also fixes
the parsing of log_msg since the strings were previously emptied
before we had a chance to read the values.

Note that the cpp-aidl can't support List of Parcelable, so we
have to return the results as an array.

Test: Manual using the new command in StatsService to print results.
Also created a new unit-test by creating a dummy pull code of -1,
but this test is deleted since it required creating a fake output in
StatsCompanionService.

Change-Id: I1cfb9ea081a59292a60e934e8527adc40982ed80
2017-10-20 16:29:59 -07:00
TreeHugger Robot
0d769d80a9 Merge "incidentd: dumping batterystats app data to proto" 2017-10-20 23:22:48 +00:00
TreeHugger Robot
fc5d6617c3 Merge changes from topic "health2_healthd_hwbinder"
* changes:
  BatteryService serves IBatteryPropertiesRegistrar.
  BatteryService: Use android.hardware.health@2.0.
2017-10-20 00:10:04 +00:00
Tom Cherry
d097e2aaf2 Merge "Allow ro. properties to have arbitrary lengths" am: 3851f132d1 am: 9fba6c2fe1 am: 918a29c88d
am: 3fb7276115

Change-Id: I7bc3e26d70267add40bfc2fb09b69b475e4daec6
2017-10-18 19:55:19 +00:00
Tom Cherry
3fb7276115 Merge "Allow ro. properties to have arbitrary lengths" am: 3851f132d1 am: 9fba6c2fe1
am: 918a29c88d

Change-Id: I29e0ca8d91d29431b498788b548fd48e85d6669b
2017-10-18 19:44:54 +00:00
Yifan Hong
1fd86f4c05 BatteryService serves IBatteryPropertiesRegistrar.
This binder service is originally served by healthd.
To allow BatteryManager to continue to work, BatteryService
implements this binder service.

Test: BatteryManagerTest
Bug: 62229583

Change-Id: I9c97b3936546740c6d63060899fe50c5c4c957bd
2017-10-18 12:35:10 -07:00
Kweku Adams
103351f9c2 incidentd: dumping batterystats app data to proto
Bug: 65750808
Test: flash device and checkout proto output against csv output
Change-Id: I2dad948d4b43dc904f01dcaef137a3ff947062c6
2017-10-18 12:32:38 -07:00
Tom Cherry
918a29c88d Merge "Allow ro. properties to have arbitrary lengths" am: 3851f132d1
am: 9fba6c2fe1

Change-Id: I17743afca87569e5ef6e17572aec0e8e8e535847
2017-10-18 18:48:55 +00:00
Tom Cherry
9fba6c2fe1 Merge "Allow ro. properties to have arbitrary lengths"
am: 3851f132d1

Change-Id: Ie9c340401786d97e469e283418cffef6fbbbb186
2017-10-18 18:39:42 +00:00
Tom Cherry
38a77c4048 Allow ro. properties to have arbitrary lengths
Bug: 23102347
Bug: 34954705
Test: build
Change-Id: I99b074633c60e95cdd2284bf8a708b9187c1e310
2017-10-18 09:25:17 -07:00
Tom Cherry
9a78e64d8f Merge "Frameworks: Remove warning for SystemProperties.get" am: c589496ce9 am: b72c0626f5 am: 16e676be4b
am: 3b01d0a09a

Change-Id: Icdc349598538e7cb2740e0829e797ec02ff0209a
2017-10-17 20:30:18 +00:00
Tom Cherry
3b01d0a09a Merge "Frameworks: Remove warning for SystemProperties.get" am: c589496ce9 am: b72c0626f5
am: 16e676be4b

Change-Id: Ie43c9ec866feba876016c8ceb4c1e5d6222f0a18
2017-10-17 20:04:51 +00:00
Tom Cherry
16e676be4b Merge "Frameworks: Remove warning for SystemProperties.get" am: c589496ce9
am: b72c0626f5

Change-Id: Ib0561d4ce3e027b2021bc6105f0be03ba6fffa99
2017-10-17 19:47:57 +00:00
Tom Cherry
b72c0626f5 Merge "Frameworks: Remove warning for SystemProperties.get"
am: c589496ce9

Change-Id: Ibef1415adec0dac324b0531b7038640c3584fdf1
2017-10-17 19:37:45 +00:00
Tom Cherry
95dd3cef21 Frameworks: Remove warning for SystemProperties.get
We now disallow non-UTF8 property values directly in property_service,
so there is no need for this warning.

This partially reverts 33aea8d40e.

Bug: 63177684
Test: make
Change-Id: I61f49f635c6095013f55b906e00925a8cbd1ea8c
2017-10-17 09:27:23 -07:00
Patrik Torstensson
23a3f240c0 Merge "Incorporate slab reclaimable into meminfo" into oc-mr1-dev am: 20fb01eb23
am: 7528452f57

Change-Id: I46c0b4b07044578fe300aaf587973a650628388b
2017-10-15 02:09:14 +00:00
Pankaj Kanwar
0e0a22e169 Merge "Merge "Cleanup of Cellular/Wifi aggregate statistics" into oc-mr1-dev am: eb98edfb83" into oc-mr1-dev-plus-aosp
am: c623db3d98

Change-Id: I5512c904eb29e2819358299df36f7a1c2c261992
2017-10-15 02:02:47 +00:00
Patrik Torstensson
7528452f57 Merge "Incorporate slab reclaimable into meminfo" into oc-mr1-dev
am: 20fb01eb23

Change-Id: Ia6afee63376c98552c3a5a0ee249fa751c3d3603
2017-10-13 07:35:04 +00:00
Patrik Torstensson
20fb01eb23 Merge "Incorporate slab reclaimable into meminfo" into oc-mr1-dev 2017-10-13 01:30:40 +00:00
Robert Benea
5e099800f8 Incorporate slab reclaimable into meminfo
Instead of using the whole slab mem for kernel usage, split the
unreclaimable to kernel and reclaimable to cache (since is freed
under mem. pressure).

Test: tested on gobo
Bug:67753120
Change-Id: I0f5a310bb88603ad7bb28e5398ea57c249c04fc2
2017-10-13 00:41:47 +00:00
Pankaj Kanwar
975c272419 Merge "Cleanup of Cellular/Wifi aggregate statistics" into oc-mr1-dev
am: eb98edfb83

Change-Id: Id45e4e83eadebbe812aa44bdfa5592831813fec9
2017-10-13 00:34:57 +00:00
Pankaj Kanwar
eb98edfb83 Merge "Cleanup of Cellular/Wifi aggregate statistics" into oc-mr1-dev 2017-10-13 00:26:11 +00:00
Yi Jin
129fc6ce19 Implement Activity Manager Broadcasts dump protos
Bug: 66729158
Test: Manually build and flash the system.img and test "activity --proto
broadcasts"
Change-Id: I3cb7474c4a3ab092f38ed6a121b4d034cadfc402
2017-10-11 18:35:14 -07:00
Siddharth Ray
3c648c4673 Cleanup of Cellular/Wifi aggregate statistics
Cleanup of Cellular/Wifi aggregate statistics in Batterystats dumpsys

Cellular
- Modification of field names to improve clarity
- Removed count "x" values
- Added power values to Rx signal strength
- Added power values to Tx power
- Added "Cellular Sleep time"
- Removed erroneous battery field (This is being fixed in b/67213886,
b/67213967)
- Removed the following fields (Mobile radio active unknown time, Mobile
radio active adjusted time, Signal scanning time)

Wifi
- Modification of field names to improve clarity
- Removed count "x" values
- Added power values to Rx signal strength
- Removed the following field (Wifi on, Wifi running)

BUG:67322291
Change-Id: I9630f154a73c7e3cb4bae4779609302f3674602f
2017-10-11 16:29:53 -07:00
TreeHugger Robot
b34b70b067 Merge "incidentd: Dumping batterystats system data to proto." 2017-10-11 17:56:34 +00:00
David Chen
de70169109 UID mapping to provide app name and version.
The UID map is updated by StatsCompanionService, which listens to broadcast
updates indicating that an app was updated/installed or removed. Also,
the entire map is updated when statsd first connects to the companion
service. Also, there is a way for metrics producers to subscribe to
updates, so that they can know when an app was upgraded.

Test: Created new unit-test for mapping and manually tested for install
and remove. Did not manually test the app upgrade.

Change-Id: I6676ae5c93b75c72d9badabb36aa9c40006db07d
2017-10-10 14:33:23 -07:00
Charles He
af60534c97 Merge "Add user restriction to suppress error dialogs." 2017-10-10 19:45:12 +00:00
Andreas Gampe
e2ce9017cd Merge "Parcel: Avoid NPE in finalization" am: b085deece9 am: cb34bdf55c am: 7934a7f828
am: 77de886b55

Change-Id: If5a797b8780765be8cc658d1e09bf4dea69dd923
2017-10-10 18:18:17 +00:00
Andreas Gampe
77de886b55 Merge "Parcel: Avoid NPE in finalization" am: b085deece9 am: cb34bdf55c
am: 7934a7f828

Change-Id: I5c2819892170855c4d009261785f9e8d26f9ad5e
2017-10-10 18:01:22 +00:00
Andreas Gampe
7934a7f828 Merge "Parcel: Avoid NPE in finalization" am: b085deece9
am: cb34bdf55c

Change-Id: Idd444cd9dfe78d4200f67a4fe6b3c4fb13767f29
2017-10-10 17:52:50 +00:00
Andreas Gampe
cb34bdf55c Merge "Parcel: Avoid NPE in finalization"
am: b085deece9

Change-Id: I646baf55627a3874a10775846458af5f1dcd5d8c
2017-10-10 17:35:55 +00:00
Andreas Gampe
009b852133 Parcel: Avoid NPE in finalization
Check whether the guard is null to avoid:

 Uncaught exception thrown by finalizer
 java.lang.NullPointerException: Attempt to invoke virtual method 'void dalvik.system.CloseGuard.close()' on a null object reference
      at android.os.ParcelFileDescriptor.closeWithStatus(ParcelFileDescriptor.java:740)
      at android.os.ParcelFileDescriptor.finalize(ParcelFileDescriptor.java:990)
      at java.lang.Daemons$FinalizerDaemon.doFinalize(Daemons.java:250)
      at java.lang.Daemons$FinalizerDaemon.runInternal(Daemons.java:237)
      at java.lang.Daemons$Daemon.run(Daemons.java:103)
      at java.lang.Thread.run(Thread.java:764)

Follow-up to commit da5a3e12f4.

Bug: 7426029
Bug: 10330121
Test: m
Change-Id: I903f1545ab784008727ff23bb95fe182bd95b62a
2017-10-10 08:06:42 -07:00
Kweku Adams
87b19ecf9b incidentd: Dumping batterystats system data to proto.
Also a little code cleanup as I was going through to understand the
dumping code.

Bug: 65750808
Test: flash device and inspect incident.proto output
Change-Id: Ib850db408c98d6a96dc028296e96c75087258904
2017-10-09 14:29:40 -07:00
TreeHugger Robot
c7b36eb77b Merge "Adding initial protos for batterystats dump." 2017-10-07 01:02:11 +00:00
Charles He
22ff6f9df0 Add user restriction to suppress error dialogs.
Bug: 66125576
Test: cts-tradefed run cts-dev --module DevicePolicyManager -t com.android.cts.devicepolicy.UserRestrictionsTest
Test: bit FrameworksServicesTests:com.android.server.pm.UserRestrictionsUtilsTest
Change-Id: I1c4cf4a107f47e9b5543607e57b76dd2e5acfba5
2017-10-07 00:23:31 +01:00
Kweku Adams
2f73ecdf52 Adding initial protos for batterystats dump.
Timer is the basic stat tracking object that's used for a lot of the
data in batterystats.
ControllerActivity data is tracked both per uid and for the entire
system, so it makes sense to define it now independently.
For the BatteryStatsHelper change: there's a small window of time after
boot where getSystemService will return null. I ran into it.

BUG: 65750808
Test: flash device and check incident proto output
Change-Id: I15e7d046a43f76d5f53d05b5138ea40f42e19d59
2017-10-06 14:52:26 -07:00
TreeHugger Robot
67e48e878c Merge "Added apis for changing the system whitelist" 2017-10-06 21:13:22 +00:00
Mike Ma
8cb8bdf657 Merge "Add AOD metrics in batterystats" into oc-mr1-dev
am: 6204a60c53

Change-Id: Ife567f987a1585cb1108725db6ad63516a8dc67a
2017-10-06 07:17:25 +00:00
Mike Ma
1ce1d3a42c Add AOD metrics in batterystats
Fixes: 64899521
Test: manual - flash build, reset batteryStats, use device > 1 hr
with alternating pattern between screen on/off/AOD. Dump stats, check
all screen related stats look normal, esp. record matches actual time
spent in each screen state. In raw bugreport:
Search "amount discharged" for % discharge;
Search "Screen on/off/doze discharge" for mAh discharge;
Search "time on battery" for up/real time in each state.

Test: Added two unit tests for note AOD screen state

Merged-In: I7193a36751124dd380818b2b665303c0f0d8c984
Change-Id: I51cead7f92abd9e4c620f7dfde393993cdad494e
2017-10-06 00:50:03 +00:00
Mike Ma
c2f518a9dd Add AOD metrics in batterystats
Fixes: 64899521
Test: manual - flash build, reset batteryStats, use device > 1 hr
with alternating pattern between screen on/off/AOD. Dump stats, check
all screen related stats look normal, esp. record matches actual time
spent in each screen state. In raw bugreport:
Search "amount discharged" for % discharge;
Search "Screen on/off/doze discharge" for mAh discharge;
Search "time on battery" for up/real time in each state.

Test: Added two unit tests for note AOD screen state
Change-Id: I7193a36751124dd380818b2b665303c0f0d8c984
2017-10-05 15:28:55 -07:00
TreeHugger Robot
e0fa2c0408 Merge changes I616184fa,Ibc1500f5
* changes:
  Move mPermissions from package settings
  Move DefaultPermissionGrantPolicy
2017-10-05 18:30:33 +00:00
Todd Kennedy
0eb9738d17 Move mPermissions from package settings
Create a settings class only for use with permissions. It's
subservient [and should only be accessed directly by] package
settings or the permission manager. The rest of the permission
related data needs to be moved to permission settings. At
which point we can start pulling the permission methods out of
the package manager service and into the permission manager.

We still have a somewhat tight relationship between package
manager and the permission manager. It's unclear how far we need
to separate them and if relying entirely on an internal
interface is sufficient.

Bug: 63539144
Test: Manual. Builds and runs
Test: cts-tradefed run commandAndExit cts-dev -m CtsAppSecurityHostTestCases -t android.appsecurity.cts.PermissionsHostTest
Test: cts-tradefed run commandAndExit cts-dev -m CtsPermissionTestCases
Test: cts-tradefed run commandAndExit cts-dev -m CtsPermission2TestCases
Test: bit FrameworksServicesTests:com.android.server.pm.PackageManagerSettingsTests
Change-Id: I616184fa2135a11687e4ce615884f861466fdebe
2017-10-05 07:18:10 -07:00
Henrik Baard
8d475ca058 Prevent WakeLock count ending up in an incorrect state
WakeLock can end up in a bad state if the following sequence
is executed:

1. mWakeLock =  mPowerManager.newWakeLock(...)
2. mWakeLock.acquire(TIMEOUT_MS);
3. timeout TIMEOUT_MS occurs before release() is called
4. release is called()

[1] mInternalCount = mExternalCount = 0
[2] mInternalCount = 1, mExternalCount = 1
[3] mInternalCount = 0, mExternalCount = 1
[4] mInternalCount = -1, mExternalCount = 0

If acquireLocked is called on the same object after this sequence,
mInternalCount is incremented to 0 which results in no wakelock
being requested from PowerManagerService.

Bug: 64676694
Test: cts-tradefed run commandAndExit cts-dev -m CtsOsTestCases -t android.os.cts.PowerManager_WakeLockTest
Change-Id: I133812aefb5d92eec2e2dde1a36f81dc9ffd7625
2017-10-03 14:45:34 -06:00
TreeHugger Robot
6214ad9f5f Merge "Statsd can pull kernel wakelock data" 2017-10-02 18:22:53 +00:00
Bookatz
c68a9d21b4 Statsd can pull kernel wakelock data
When statsd is told that it is time to poll data, it asks
StatsCompanionService to pull kernel wakelock data, receives the result
(as a string), and outputs it to screen.

Still to do:
1. don't use a string; use a parcel instead
2. don't output it to screen; do something useful instead
3. do more than just kernel wakelocks
4. pull data on demand, in addition to just on periodic pulling

Test: added setPollingAlarms to statsd.main and confirmed that kernel
wakelock information was written to screen
Change-Id: I35f5164420699dea1a00c9e530b938904f1d3055
2017-09-29 15:10:47 -07:00
Suprabh Shukla
081056475e Added apis for changing the system whitelist
We want the user to be able to remove apps that are added in the system
whitelist. The user can restore them back later if they want.

Test: cts-tradefed run cts-dev -m CtsDeviceIdleHostTestCases

Bug: 63528174
Change-Id: Ia2f908c5fac84e28772d85b303be68b70efac8ba
2017-09-28 18:04:27 -07:00
Jeff Sharkey
f8bb2445ff Finish removing ASEC.
Awhile back we explicitly blocked any new ASEC installs, with the
expectation that we'd eventually remove the logic entirely.  We've
had them disabled for about a week now without incident, so let's
rip out the remaining code.

Test: bit FrameworksCoreTests:android.content.pm.PackageHelperTests
Test: bit FrameworksCoreTests:android.content.pm.PackageManagerTests
Bug: 32913676
Change-Id: I1ecc35487420731f5c4bdf03bca5751548ce51b3
2017-09-28 11:32:57 -06:00