Commit Graph

4718 Commits

Author SHA1 Message Date
Chenjie Yu
b3dda41a5a reretry ValueMetric implementation and pulling mechanism
Note:
This is for value metric. The default operations is sum the diffs.
The test uses kernel wake lock, which also needs dimension by kernel
wake lock name.

The test is a bit cumbersome as it needs StatsCompanionService to do
the alarm, which is not exact alarm.

The internal state of a slice of bucket would look something like this:

4:ipc0000005e_727_android.hardwar
0      0
4:SensorService_wakelock
40      64
4:ipc0000005c_727_android.hardwar
...

Test: manual test on device.
Change-Id: I2ed0ac7d3c5fcba8b7611d46f38a38ffd8bdc92a
2017-11-01 15:58:45 -07:00
Narayan Kamath
63cc787fa8 Merge "Debug: Remove obsolete InstructionCount code." am: f5a8edeaf0 am: 47659c3351
am: 39343bf215

Change-Id: I79f3b2ec2a2ef449703867dea4dced63ab1b63ad
2017-11-01 21:17:51 +00:00
Narayan Kamath
39343bf215 Merge "Debug: Remove obsolete InstructionCount code." am: f5a8edeaf0
am: 47659c3351

Change-Id: I1d4b929ead3af4ef3f9d28de2a3e905d124e718c
2017-11-01 20:56:50 +00:00
Narayan Kamath
19541e84b1 Debug: Remove obsolete InstructionCount code.
Support for instruction counting has been removed from ART
and the VMDebug APIs in question throw UnsupportedOperationException
unconditionally.

Test: make

Change-Id: Ibcaa160f755a5708bc6fbef3a783acfc26f0ba90
2017-11-01 13:24:47 +00:00
Andreas Huber
21d2c3ebbd Merge "Adds APIs to extract/import arrays of primitive Java types out of/into a HwBlob." am: a546c38130 am: 33569ca480
am: 4b5806cea6

Change-Id: I202635b9b7c0800eadfe0923e29c94d2dd39dcb5
2017-11-01 01:51:25 +00:00
Steven Moreland
3014116f07 Merge "Reland "HIDL Java getService now the same as C++."" am: c1616f6820 am: 0c6f0240b2
am: be0f18fe3d

Change-Id: If15ebb8582478ebcc8d45a2ace0c8f2825932dc9
2017-11-01 01:19:01 +00:00
Andreas Huber
4b5806cea6 Merge "Adds APIs to extract/import arrays of primitive Java types out of/into a HwBlob." am: a546c38130
am: 33569ca480

Change-Id: Ic3048cf4539b112027089726b529e3c0838c40f4
2017-11-01 00:03:34 +00:00
Steven Moreland
be0f18fe3d Merge "Reland "HIDL Java getService now the same as C++."" am: c1616f6820
am: 0c6f0240b2

Change-Id: I35ee525aaa1563cc6d8fde5dac1e38e04803bb38
2017-10-31 23:40:34 +00:00
Andreas Huber
0eb37e06dc Adds APIs to extract/import arrays of primitive Java types out of/into a HwBlob.
Bug: 68654583
Test: hidl_test_java
Change-Id: I6ec799b423396f9212e4c221e41791adc9086410
2017-10-31 14:22:04 -07:00
Dianne Hackborn
ad5570f58d Merge "Fully implement "install" and "install-write" in PackageManagerShellCommand." 2017-10-31 19:55:42 +00:00
TreeHugger Robot
f30e0cfca0 Merge "Simple numbering system selector for LocalePicker." 2017-10-31 19:21:53 +00:00
Steven Moreland
ec5eb7e23d Reland "HIDL Java getService now the same as C++."
Add getService(retry) for Java for C++ feature parity.

Test: hidl_test_java, boot
Bug: 67981006

Change-Id: I4e6711f8c2d7ad0ef6994ce9c480118320e1bde8
2017-10-31 12:01:23 -07:00
Dianne Hackborn
ca3872ce36 Fully implement "install" and "install-write" in PackageManagerShellCommand.
We can use the new mechanism to ask the calling shell to open
a file in order to implement the rest of these commands, allowing
you to give the path to an apk to install.  That API is thus
extended to allow you to open readable files, not just opening
file for writing.

Doing this however means we no longer can pass a file path to
AssetManager for the apk to parse, we only have an already open
fd for that.  Extending AssetManager to allow adding apks from
fds is not that hard, however, since the underlying zip library
already supports this.

This main thing this changes is in AssetManager.cpp where we
retrieve the open zip file for a particular apk that has been
added.  This used to look up the zip file by path every time
it was needed, but that won't work anymore now that we can have
things added by fd.  Instead, we keep track of each opened zip
in the AssetManager, so we can just directly retrieve it from
the asset_path representing the item that was added.  As a
side-effect, this means for normal paths we no longer need to
look up by name, but just have the opened zip file directly
accessible.  (This is probably good, but it does mean that we
no longer run the logic of seeing if the zip file's timestamp
has changed and re-opening it if it has.  We probably shouldn't
be relying on that for an active AssetManager anyway, and maybe
it is even good that we don't allow the zip file to change
under it?)

A follow-up change will finally remove the Pm.java implementation
and turn the pm "command" into a simple shell script that runs
cmd package.

Test: manual

Change-Id: Ie103e3bdaa5b706796cc329254f2638151a3924f
2017-10-31 10:54:31 -07:00
TreeHugger Robot
0075dda825 Merge "Parcel nested stack trace elements" 2017-10-30 22:38:25 +00:00
Igor Viarheichyk
025402c5e9 Simple numbering system selector for LocalePicker.
This change introduces minimal changes needed to support selection
of locales with BCP 47 numbering system specification. Two level
selection (Language/Region) schema remains, locales with numbering
systems appear in the region selection list and are displayed as
"region (numbering system)".

Bug: 18340949
Bug: 63754513
Test: manual, experimental UI for review.

Change-Id: I42691f3714c5e5c51fd8d96c034cc3a9f6be93dc
2017-10-30 14:35:06 -07:00
Yueming Wang
5593322a2e Merge "Add DISALLOW_CONFIG_DATE_TIME user restriction." 2017-10-27 21:15:47 +00:00
Kurt Nelson
87dd8bcbc2 Parcel nested stack trace elements
The only thing printed besides the stack elements is the classname `LogStackTrace`.
This is useless.
We can improve performance by only parceling around the StackTraceElement[] instead of serializing the whole Throwable.

testCrossBinderThreadViolation is currently ~3,700,000

Test: cts-tradefed run cts-dev --module CtsOsTestCases --test
android.os.cts.StrictModeTest
Bug: 68257982
Bug: 62458734
Bug: 68383527

timeThreadViolation_mean=374405
timeThreadViolation_median=372258
timeThreadViolation_min=367266
timeThreadViolation_standardDeviation=6998

timeCrossBinderThreadViolationNoStrictMode_mean=2331746
timeCrossBinderThreadViolationNoStrictMode_median=2337964
timeCrossBinderThreadViolationNoStrictMode_min=2226280
timeCrossBinderThreadViolationNoStrictMode_standardDeviation=64135

timeCrossBinderThreadViolation_mean=2484286
timeCrossBinderThreadViolation_median=2345391
timeCrossBinderThreadViolation_min=2331061
timeCrossBinderThreadViolation_standardDeviation=251332

timeVmViolationNoStrictMode_mean=2677281
timeVmViolationNoStrictMode_median=2733943
timeVmViolationNoStrictMode_min=2319806
timeVmViolationNoStrictMode_standardDeviation=295305

timeVmViolation_mean=3718122
timeVmViolation_median=3632176
timeVmViolation_min=3557980
timeVmViolation_standardDeviation=236624

timeThreadViolationNoStrictMode_mean=414257
timeThreadViolationNoStrictMode_median=414664
timeThreadViolationNoStrictMode_min=397317
timeThreadViolationNoStrictMode_standardDeviation=12954

Change-Id: If59812d71917aed08d557936ff7495d2f4ded23b
2017-10-27 11:12:05 -07:00
Hans Boehm
c9d246f7da Merge "Don't allocate GlobalRefs for BinderProxy" am: 1455a1d0c0 am: b4210d8160
am: 1c12235c08

Change-Id: I5a17d090783a81d65903a20ba7deac3332bd404a
2017-10-27 17:50:25 +00:00
Hans Boehm
1c12235c08 Merge "Don't allocate GlobalRefs for BinderProxy" am: 1455a1d0c0
am: b4210d8160

Change-Id: Ida801a358acab13e8515db98b37165179cf5135a
2017-10-27 17:38:31 +00:00
TreeHugger Robot
bfc6a2bc36 Merge "Notification: Fix PendingIntent whitelisting" 2017-10-27 15:34:49 +00:00
Adrian Roos
fb92184ebc Notification: Fix PendingIntent whitelisting
Fixes several issues with the way PendingIntents are being whitelisted
from background check with Notifications. Most visibly, this causes the
whitelisting not to work on Notifications that use the DecoratedContentViewStyle,
but there are some conditions where the whitelisting breaks for regular
notifications too.

- After a Notification is rebuilt with Notification.Builder, the set
  of PendingIntents in the notification was not rebuilt.
  This broke the whitelisting whenever a PendingIntent is added after
  the Notification was already sent once. Workaround for broken platform
  releases: always use  a fresh Notification object, or clone before
  sending.

- Fixes PendingIntent.writePendingIntentOrNullToParcel to invoke the
  OnMarshalListener.
  This broke whitelisting for any PendingIntents attached to custom
  RemoteViews. Workaround for broken platform releases: Also attach
  the PendingIntent to the Notification's extras.

- Changes RemoteViews to keep the parcel cookies that were present
  during unparceling, such that they can be reapplied when it gets
  cloned.
  This broke whitelisting for any PendingIntents attached to a
  DecoratedContentViewStyle *even if added to extras*. Workaround
  for broken platform releases: none.

- Fixes Notification.whitelistToken mistakenly being static.
  There's an unlikely race condition where the field could be
  overriden with null by an incoming notification right as another
  notification is sent out. Workaround for broken platform releases:
  none.

Test: runtest -x core/tests/coretests/src/android/app/NotificationTest.java && runtest -x core/tests/coretests/src/android/widget/RemoteViewsTest.java
Bug: 68218899
Change-Id: I02e44040604a1d24422340611ae9e0332a611800
2017-10-27 15:46:40 +02:00
yuemingw
a9772f3602 Add DISALLOW_CONFIG_DATE_TIME user restriction.
Test: cts test for bug 67627542 in following cl
Bug: 67497909

Follow design doc: https://docs.google.com/document/d/1NV93mr2CT157S_haru1QbKo9HLeP9iPM9eMiGfVmfCM/edit#
Change-Id: Iee3c2fbf88b4958dde81330c2e4d60dfce09197f
2017-10-27 10:50:49 +01:00
Hans Boehm
1602cb58f3 Merge "Convert Binder & BinderProxy to NativeAllocationRegistry" am: bd6d3c5743 am: a177c5c9d2
am: d4fff83a65

Change-Id: I45c54ae273e33d82cfea107b31c1ca63d23d8f66
2017-10-27 04:18:40 +00:00
Hans Boehm
d4fff83a65 Merge "Convert Binder & BinderProxy to NativeAllocationRegistry" am: bd6d3c5743
am: a177c5c9d2

Change-Id: I087b9b3374fc51fa5ded63fbd999f4398f564628
2017-10-27 03:58:59 +00:00
TreeHugger Robot
4b34000a21 Merge "Add proto dump flag to services (2/2)" 2017-10-26 23:45:46 +00:00
Hans Boehm
29f388fc21 Don't allocate GlobalRefs for BinderProxy
This removes all GlobalRef allocation as part of building BinderProxys.
Previously these were used to map IBinders to the corresponding
Java object, so the Java objects could be reused. We now keep
that mapping at the Java level.

This means we often need to call into Java to look up or allocate
a BinderProxy. But this replaces a prior call to Java to dereference
a WeakReference. The Java custom Java map-to-WeakReference data
structure is probably not terribly efficient, but the original
attachement mechanism did not seem to be either. And this
avoids potentially even more catastrophic issues when the number
of GlobalRefs approaches its limit.

We decrease GC triggering frequency from 200 to 1000 allocated
references. This now only applies to other kinds of JNI References
allocated by Binder.

I saw a maximum bucket size of 16 for the ProxyMap data structure
while briefly exercising a freshly booted device. That occurred
in system_server.

Bug: 65760710

Test: Built and booted master with some debugging output. Looks sane.
Change-Id: I322c4d8e9c8e198586d591580c2cdbb094906677
2017-10-26 13:34:19 -07:00
Vishnu Nair
e78b01ad2d Add proto dump flag to services (2/2)
Adds new PROTO flag which requests services to dump sections in proto format. Modifies PriorityDumper helper class to parse proto arguments and set asProto flags. Registers WM and AM with proto dump supprt.

Bug: 67716082

Test: frameworks/base/services/tests/runtests.py -e class "com.android.server.utils.PriorityDumpTest"
Test: adb bugreport ~/tmp/bug.zip
Test: adb shell dumpsys window --proto
Test: adb shell dumpsys activity --proto

Change-Id: Icfc6857c8a9340110a43343734a27e48d0b5a229
2017-10-26 10:11:54 -07:00
Hans Boehm
5e5b13f27e Convert Binder & BinderProxy to NativeAllocationRegistry
Change the Java BinderProxy to only contain a single native pointer,
so that we can get by with a single NativeAllocationRegistry
registration. This adds some indirections and a new allocation. But it
marginally reduces the number of (expensive) JNI field lookups from
native code, and the extra allocation involves significantly less
overhead than registering each object twice. This also cleans up the
code a little by avoiding some explicit reference count adjustments.

Change BinderProxy Binder to use NativeAllocationRegistry instead of
finalize().

Change the mObject field in Binder to hold a non-reference-counted
but owning pointer to JavaBBinderHolder. Have JavaBBinderHolder no
longer inherit from RefBase.

Make it clear that neither Binder.mObject, not BinderProxy.mNativeData
can be null. Remove null checks.

Avoid checking for null returns from C++ new. It would throw
anyway, which would cause the process to abort.

Test: Booted master.

Bug: 65760710

Change-Id: I323d4bdc7e25f8c27b847b6fe2c073eac3f2efe5
2017-10-25 17:17:24 -07:00
Kurt Nelson
9bcd7e9c5d Move violation extra messages into throwable
Some violations have a separate string from the throwable. Prepending
the string to the throwable's message or using it as the message sets us
up for all violations to extend Throwable.

Bug: 62458734
Test: cts-tradefed run cts-dev --module CtsOsTestCases --test
android.os.cts.StrictModeTest
Change-Id: I6a97ee69a90fb975dc453ca37fe53ea78ebfe974
2017-10-25 17:14:38 -07:00
Kurt Nelson
826d12cf92 Merge "Use annotation instead of comment" 2017-10-26 00:09:12 +00:00
Dianne Hackborn
8de9566375 Fix issue #64224738: Document return value of IBinder.transact()
Also add appropriate @NonNull and @Nullable annotations.

Test: built

Change-Id: I22de48105ef685baf594cfc004dd3e27e2ba09e9
Merged-In: I22de48105ef685baf594cfc004dd3e27e2ba09e9
(cherry picked from commit 4cd650c008)
2017-10-25 14:21:32 -07:00
Kurt Nelson
1981f4292d Use annotation instead of comment
Test: none
Bug: none
Change-Id: I723fba865116a203147dd5f2a6343b2cb29c65a2
2017-10-25 13:53:29 -07:00
Dianne Hackborn
c81983a0c3 Start removing remaining pm code to package manager
Everything is now moved out of the pm command except for
the various install commands.  I am going to hold of on
those since they require doing some resolution with the
current implementations in the package manager to make
sure they match and behave identically to the implementations
currently in the pm command.  But other than that, everything
in pm is now just redirecting over to "cmd package".

Also fix up some of the dumpsys output of a few other sevices
when asking to print the data for a particular package, so
the "pm dump" command gives a little more sane result.

Test: manual

Change-Id: I139e06e560203b72243d7eea9543c2240db0f8f8
2017-10-25 12:19:26 -07:00
TreeHugger Robot
17e5e2e573 Merge "Add some atoms to statsd" 2017-10-25 17:04:54 +00:00
Steven Moreland
90694f7037 Merge "Revert "HIDL Java getService now the same as C++."" am: 65d1e549b6 am: 4868f5311e
am: b29739e1c9

Change-Id: I0a11131c6736f03b15e967990edbbbd47b6537ed
2017-10-25 06:19:38 +00:00
Steven Moreland
b29739e1c9 Merge "Revert "HIDL Java getService now the same as C++."" am: 65d1e549b6
am: 4868f5311e

Change-Id: I80789cb8e1cf0d49e3f85fffe29a12eb74b7726e
2017-10-25 05:56:47 +00:00
Steven Moreland
65d1e549b6 Merge "Revert "HIDL Java getService now the same as C++."" 2017-10-25 04:50:08 +00:00
Steven Moreland
cc9e67c019 Revert "HIDL Java getService now the same as C++."
Appears to be causing problems on 2017 devices.

This reverts commit c1f00f8cd8.

Change-Id: I6c1717a612bfa3fe63f08160a1db652c284f6ba4
2017-10-25 04:46:26 +00:00
Steven Moreland
8c69e67acd Merge "HIDL Java getService now the same as C++." am: 0c41ad872f am: 34b5b69de9
am: fd05e9a075

Change-Id: I6e55ca21bf55f3fe581eaceabc371dc0b85260ad
2017-10-25 02:24:45 +00:00
Steven Moreland
fd05e9a075 Merge "HIDL Java getService now the same as C++." am: 0c41ad872f
am: 34b5b69de9

Change-Id: I3d7bd6b7b352093306da5d250b518ca9b7dc0f6b
2017-10-25 02:13:39 +00:00
Treehugger Robot
0c41ad872f Merge "HIDL Java getService now the same as C++." 2017-10-25 01:53:16 +00:00
Bookatz
8c6571bde8 Add some atoms to statsd
The following atoms (events) are added:
BatteryLevelChanged
ChargingStateChanged
PluggedStateChanged
DeviceTemperatureReported
DeviceOnStatusChanged
WakeupAlarmOccurred
KernelWakeupReported

Test: manual
Change-Id: I1e7d8a842ee67b5da30f20c9e6976c5bc4e0a0ef
2017-10-24 18:18:19 -07:00
TreeHugger Robot
c3787a8a83 Merge "Adds aidl definitions and their implementations for binder transfer of statsd entries to clients. This change only includes changes on statds side and does not include java library for clients to import. Java library will be a separate change as it requires system api review." 2017-10-25 00:18:53 +00:00
yro
31eb67b349 Adds aidl definitions and their implementations for binder transfer of
statsd entries to clients. This change only includes changes on statds
side and does not include java library for clients to import. Java
library will be a separate change as it requires system api review.

Test: statsd, statsd_test
Change-Id: I306c6e9687801668cc0145b12d38406bfe634775
2017-10-24 15:25:27 -07:00
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
Steven Moreland
c1f00f8cd8 HIDL Java getService now the same as C++.
getService: wait for service if it is declared in the manifest
tryGetService: only return if the service is immediately available

Bug: 67981006
Test: hidl_test_java
Change-Id: I4485b84f0fde98851cf5f64d198a8c5410795c8c
2017-10-23 01:23:45 -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