Commit Graph

3790 Commits

Author SHA1 Message Date
Tamas Berghammer
f4b0962cac Enable logwrapper functionality on user builds am: 0ca16fa584 am: db05d4b4ed am: ed8757a761
am: f00963c71f

Change-Id: I10b9a367a1c2477683dbb404ebb8bfdd41d92263
2016-12-16 20:03:36 +00:00
Tamas Berghammer
a5a598c969 Zygote: Add invoke-with to zygote protocol am: b8f7c351b9 am: 45c2fffc52 am: d71bb300e6
am: b8d0e4d9fc

Change-Id: I7d962109d6fae5e0a359cb3fe04b1fc191e545de
2016-12-16 20:02:41 +00:00
Tamas Berghammer
f00963c71f Enable logwrapper functionality on user builds am: 0ca16fa584 am: db05d4b4ed
am: ed8757a761

Change-Id: I0f27f6aeb58690addb1c5f7978047ccb8d73ab84
2016-12-16 19:54:58 +00:00
Tamas Berghammer
b8d0e4d9fc Zygote: Add invoke-with to zygote protocol am: b8f7c351b9 am: 45c2fffc52
am: d71bb300e6

Change-Id: Ied54640c44ade52abd6a905526ba7789be14a332
2016-12-16 19:54:11 +00:00
Joe Onorato
10e237e5c8 Merge changes from topic 'incident_1'
* changes:
  First checkin of incident reporting.
  Add a native class to interact with DropBoxManager.
2016-12-16 18:19:50 +00:00
Tamas Berghammer
0ca16fa584 Enable logwrapper functionality on user builds
When an app is debuggable, check whether a script called "wrap.sh" exists
in the app's native library directory. If so, start the app using the
invoke-with functionality over the script. Weaken the invoke-with check
on the zygote side to allow the functionality for debuggable apps.

The goal of the functionality is to make malloc debug, strace and other
similar tools available for NDK based application developers.

Bug: 33668201
Test: manual - debug malloc can be enabled using the new feature
Change-Id: Ia4bec0854cf4dc08446f1671494200f54ef366ee
2016-12-16 09:03:06 -08:00
Tamas Berghammer
b8f7c351b9 Zygote: Add invoke-with to zygote protocol
Add "--invoke-with" to the zygote connection protocol. It was
already understood as an argument by the zygote.

Bug: 33668201
Test: m
Change-Id: I59095f2ac542aadff78a7ff1dded86cf5f192707
2016-12-16 09:03:01 -08:00
Felipe Leme
c23397a647 Includes key/value on exception thrown when they're too large.
Bug: 33662416

Test: manual verification
Change-Id: I11436a8454cef5f63b0fb58919f2f02de6234f6b
2016-12-15 12:25:51 -08:00
Joe Onorato
1754d744a7 First checkin of incident reporting.
There are a few major pieces here:

incidentd
---------
This daemon (started by init) runs and accepts incoming requests to take
incident reports.  When prompted, it calls into various system services
and fills in an IncidentProto data structure, and then writes the report
into dropbox.

The next steps for incidentd:
    - Security review of SELinux policies. These will be a subset of
      the dumpstate permissions.  Until this is done, incidentd is
      not started at boot time.

incident
--------
This shell command calls into incidentd, and can initiate an incident
report and either capture the output or leave for dropbox.

incident_report
---------------
This host side tool can call adb shell with the correct parameters
and also format the incident report as text.  This formatting code
was left of the device on purpose.  Right now it's pretty small, but
as the number of fields increases, the metadata and code to do the
formatting will start to grow.

The incident_report command also contains a workaround to let it
work before incidentd is turned on by default.  Right now, it is
implemented to call adb shell dumpsys <service> --proto directly,
whereas in the future it will go through the full incidentd flow.

incident_section_gen
--------------------
A build-time tool that generates a stripped down set of information
about the fields that are available.

libincident
-----------
This library contains the code to connect to incidentd, and the
meta proto definitions that are used by the framework protos.
The basics are here now, but they are not fully fleshed out yet.
The privacy.proto file contains annotations that can go in the
proto file that we will later use to filter which fields are
uploaded, and which are used by local sources.  For example, a
device in a test lab is safe to upload much much more information
than a real user.  These will share the same mechanism, but the
user's output will be filtered according to these annotations.

frameworks/core/proto
---------------------
These .proto files contain the definitions of the system's
output.  There is one master android.os.IncidentProto file that
is the top level of an incident report, but some other services
(notification, fingerprint, batterystats, etc) will have others
that are used directly by the logging mechanism.

Other files which are shared by several of the services also go
here, such as ComponentName, Locale, Configuration, etc.  There
will be many more.

There is also a first iplementation of a dump method handling
--proto in the fingerprint service.

IncidentManager
---------------
The java API to trigger an incident report.

Test: Not written yet
Change-Id: I59568b115ac7fcf73af70c946c95752bf33ae67f
2016-12-15 11:23:05 -08:00
Joe Onorato
de5b027d2c Add a native class to interact with DropBoxManager.
Test: Not written yet
Change-Id: I63ed888bd76f75c78a244a1bffae2d26f3b5f055
2016-12-15 11:23:05 -08:00
Esteban Talavera
06fd71abdf Merge "Create DISALLOW_{ADD,REMOVE}_MANAGED_PROFILE user restrictions" 2016-12-14 19:16:26 +00:00
Kweku Adams
47db5a8bf7 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
2016-12-13 19:17:44 +00:00
Esteban Talavera
6c9116a643 Create DISALLOW_{ADD,REMOVE}_MANAGED_PROFILE user restrictions
Bug: 31952368

Test: runtest -c com.android.server.devicepolicy.DevicePolicyManagerTest    frameworks-services
Test: runtest -c com.android.server.pm.UserManagerTest frameworks-services
Test: cts-tradefed run cts --module DevicePolicyManager --test com.android.cts.devicepolicy.UserRestrictionsTest

Change-Id: I240ab99c2409bbabffbc574bef202f2457026905
2016-12-13 18:14:19 +00:00
Lenka Trochtova
12b0496944 Make UserManager#DISALLOW_OEM_UNLOCK a system API.
This is needed for unbundling of OobConfig app.

Test: gts-tradefed run gts -m GtsGmscoreHostTestCases --test com.google.android.gts.devicepolicy.DeviceOwnerUserRestrictionTest#testDisallowOemUnlock_canSetWithSystemApi
Test: gts-tradefed run gts -m GtsGmscoreHostTestCases --test com.google.android.gts.devicepolicy.DeviceOwnerUserRestrictionTest#testDisallowOemUnlock_doCannotSet

BUG: 32974379

Change-Id: I7710df96006821a5d0eddfe0b411dd3efa0e10f0
2016-12-13 15:10:38 +01:00
Josh Gao
bf249c1357 Merge "Add trace category for adb." am: 6968d90dc5 am: 15dc5951e6 am: 96446b5bd3
am: 19c4422c7c

Change-Id: I33a39902df365cf60cd5976d7977e18d36c09bc0
2016-12-13 01:10:22 +00:00
Josh Gao
19c4422c7c Merge "Add trace category for adb." am: 6968d90dc5 am: 15dc5951e6
am: 96446b5bd3

Change-Id: I1d354df518f19d61eaa17e03fd696193464b6f7b
2016-12-13 00:55:32 +00:00
Dmitri Plotnikov
190495a690 Merge "Adding "quiescent" reboot mechanism to support STB operators" 2016-12-12 21:37:33 +00:00
Josh Gao
552d86b520 Add trace category for adb.
Bug: http://b/31289465
Test: systrace
Change-Id: I765c55c264329227556ff25655e3f00c5c3e8b54
2016-12-12 12:32:57 -08:00
Jeff Sharkey
5348393ac2 Merge "Catch all exceptions from installd, log codes." am: 9a10ca3f4c am: 6f7b136b40 am: 5226bbb5a6
am: 8ad8c65c62

Change-Id: I4cc68172dcb4a737b5fe683271797b0d4909a82f
2016-12-12 20:01:26 +00:00
Jeff Sharkey
8ad8c65c62 Merge "Catch all exceptions from installd, log codes." am: 9a10ca3f4c am: 6f7b136b40
am: 5226bbb5a6

Change-Id: I3a3903c4dfb9113bf9549504a1d9859fb6ee5687
2016-12-12 19:55:17 +00:00
Jeff Sharkey
447a3ac16b Catch all exceptions from installd, log codes.
Now that installd is throwing both SecurityException and
IllegalArgumentException, it's time that we turned all these
into InstallerException.

Also extend ServiceSpecificException to include the contained
errorCode value when printing.

Test: builds, boots, apps install/uninstall fine
Bug: 13758960, 30944031
Change-Id: Ic9c1e99ae87f4442402ef528bf352c7978572c85
2016-12-12 10:16:32 -07:00
Fyodor Kupolov
ea3345d6a6 [DO NOT MERGE] Switch to using UMS.mUserStates
am: 7a1e682794

Change-Id: I666e7fe9602198b450c324b36d1ecebde8f1aedb
2016-12-12 17:15:44 +00:00
Fyodor Kupolov
7a1e682794 [DO NOT MERGE] Switch to using UMS.mUserStates
UserManager.isUserUnlocked/isUserRunning/isUserUnlockingOrUnlocked now
return state from UMS.mUserStates that is pushed from ActivityManager.

Test: create managed profile using TestDPC and check Launcher3
Test: manually create unstarted managed profile and check launchers
Bug: 33232933
Change-Id: I6b619ba1880188eabdd6e3e4cc7eb60d3a22a977
2016-12-09 21:23:57 +00:00
Dmitri Plotnikov
a8d2c6457f Adding "quiescent" reboot mechanism to support STB operators
Bug: 31681185
Change-Id: Iada4dd4624f0221e5b59440da2718da980742720
Test: with SampleLeanbackDeviceAdmin.  CTS test forthcoming
2016-12-08 10:49:24 -08:00
Jeff Sharkey
1804995d7e Fix two StrictMode stack collection bugs.
am: 20db11cfda

Change-Id: Ie68764c9864e1c26f43c9d70c5697fe12d00e665
2016-12-07 18:44:28 +00:00
Jeff Sharkey
20db11cfda Fix two StrictMode stack collection bugs.
When Binder calls are nested, we can quickly end up with a snowball
of stacktraces that can cause the original transaction to fail.  This
CL makes two specific changes to alleviate this pressure:

-- Consider a nested Binder call from PID A -> B -> C.  If both B and
C encounter dozens of StrictMode violations, then gatheredViolations
in B will end up with 10 ViolationInfo (5 from B and 5 from C).  This
problem only grows with each successive nested call.  To solve this,
always limit ourselves to only ever write out 3 ViolationInfo from
any given process.

-- CrashInfo already nicely truncates any large stack traces to 20kB,
but readAndHandleBinderCallViolations() blindly appends the entire
local trace, and never considers truncating again.  Similar to the
first problem above, nested calls can quickly cause the stackTrace
value to explode in size.  To solve this, we always re-truncate the
stackTrace value after appending our local stack.

Also fix some NPE bugs when missing crashInfo.

(cherry-picked from commit 58f27b5033)

Test: builds, boots
Bug: 32575987
Change-Id: Ie8373ca277296f920f2b1c564d419c702a8ee0f2
2016-12-07 08:58:38 -08:00
Jeff Sharkey
58f27b5033 Fix two StrictMode stack collection bugs.
When Binder calls are nested, we can quickly end up with a snowball
of stacktraces that can cause the original transaction to fail.  This
CL makes two specific changes to alleviate this pressure:

-- Consider a nested Binder call from PID A -> B -> C.  If both B and
C encounter dozens of StrictMode violations, then gatheredViolations
in B will end up with 10 ViolationInfo (5 from B and 5 from C).  This
problem only grows with each successive nested call.  To solve this,
always limit ourselves to only ever write out 3 ViolationInfo from
any given process.

-- CrashInfo already nicely truncates any large stack traces to 20kB,
but readAndHandleBinderCallViolations() blindly appends the entire
local trace, and never considers truncating again.  Similar to the
first problem above, nested calls can quickly cause the stackTrace
value to explode in size.  To solve this, we always re-truncate the
stackTrace value after appending our local stack.

Also fix some NPE bugs when missing crashInfo.

Test: builds, boots
Bug: 32575987
Change-Id: Ie8373ca277296f920f2b1c564d419c702a8ee0f2
2016-12-07 06:31:50 +00:00
Lenka Trochtova
63d5e4a749 Introduce a new user restriction for disallowing Bluetooth.
Only the device owner will be able to set the restriction
and the restriction will prevent usage of Bluetooth on the
entire device - i.e. in all the users.

Test: cts-tradefed run cts -m CtsDevicePolicyManagerTestCases --test com.android.cts.devicepolicy.UserRestrictionsTest
Test: cts-tradefed run cts -m CtsDevicePolicyManagerTestCases --test com.android.cts.devicepolicy.DeviceOwnerTest#testBluetoothRestriction

Bug: 32895300

Change-Id: I2875cf178cb16eca1965d0ba965d1cd3d8db2ad5
2016-12-05 13:08:06 +01:00
Narayan Kamath
d291683d9f Merge "Parcel: Add support for reading/writing lists of Parcelables." 2016-12-05 11:01:58 +00:00
Lenka Trochtova
13a0519394 Introduce a new user restriction for disallowing Bluetooth.
Only the device owner will be able to set the restriction
and the restriction will prevent usage of Bluetooth on the
entire device - i.e. in all the users.

Test: cts-tradefed run cts -m CtsDevicePolicyManagerTestCases --test com.android.cts.devicepolicy.UserRestrictionsTest
Test: cts-tradefed run cts -m CtsDevicePolicyManagerTestCases --test com.android.cts.devicepolicy.DeviceOwnerTest#testBluetoothRestriction

Bug: 32895300

Merged-In: I2875cf178cb16eca1965d0ba965d1cd3d8db2ad5

Change-Id: I2875cf178cb16eca1965d0ba965d1cd3d8db2ad5
2016-12-05 11:53:34 +01:00
Fyodor Kupolov
98a942d14d Merge "Switch isUserUnlocked/isUserRunning to use UMS.mUserStates" 2016-12-02 21:28:11 +00:00
Fyodor Kupolov
2e7e09685a Switch isUserUnlocked/isUserRunning to use UMS.mUserStates
UserManager.isUserUnlocked/isUserRunning now returns state from
UMS.mUserStates that is pushed from ActivityManager.

Test: manual
Bug: 33232933
Bug: 28957340
Change-Id: Ic5f56d7d577bc336acd2bf44fab7f74feac4f7b3
2016-12-02 10:54:31 -08:00
Narayan Kamath
bea4871fc8 Parcel: Add support for reading/writing lists of Parcelables.
Follows the same marshalling scheme as other list types, such
as lists of Strings etc.

Bug: 30792387
Test: ParcelTest
Change-Id: I2003f4fcf4de5a1bee060f3c2723cfb155105b14
2016-12-02 12:01:12 +00:00
TreeHugger Robot
66bb266ce8 Merge changes I8b9b4fea,Ic6054b1d
* changes:
  Grant Uri permissions for new screenshots.
  Detect content:// leaving apps without grants.
2016-12-02 01:50:52 +00:00
Jeff Sharkey
3f39991889 Merge "Add 'fstrim' command for use from shell." 2016-12-01 22:03:08 +00:00
Jeff Sharkey
fb833f38a0 Detect content:// leaving apps without grants.
Developers regularly put content:// Uris into Intents, but they can
easily forget to add FLAG_GRANT_READ_URI_PERMISSION to actually
extend a permission grant to the receiving app.

Also fix NPE when path is missing.

Test: builds, boots, common actions work without triggering
Bug: 32447617, 31900890
Change-Id: Ic6054b1d73de50967cf7fe66abc293c60a41b97e
2016-12-01 15:01:19 -07:00
TreeHugger Robot
0199070c3c Merge "Adding FUSE loop thread in app side." 2016-12-01 05:45:33 +00:00
Daichi Hirono
878e86f38f Adding FUSE loop thread in app side.
The CL adds FuseAppLoop internal class to the framework. It parses FUSE commands
from the proxy in the system service and invokes a callback provided by
application.

Bug: 29970149
Test: None, will be tested with CTS for StorageManager#openProxyFileDescriptor.
Change-Id: I10b2add4c2743fb91eae3cb194f55843a74fb668
2016-12-01 13:16:14 +09:00
Kenny Guy
02c8990bd6 Allow overriding max profile in debugable builds.
Support a system property on debugable builds to
override the max number of managed profiles to
allow easier dogfooding of multiple profiles.
Support 3 different badge colours for managed profiles.

Bug: 30473760
Test: runtest -c com.android.server.pm.UserManagerServiceCreateProfileTest frameworks-services
Test: runtest -c com.android.server.pm.UserManagerServiceUserInfoTest frameworks-services
Test: manual - attempting to create 2 profiles with adb fails, passes once I set the property.
Change-Id: Ie7fb19048a04a01572666f229283152254d0ffc3
2016-11-29 14:09:37 +00:00
Narayan Kamath
683ed6c356 Merge "PackageManager: Avoid creating encoders for appIds being written /config/sdcardfs" 2016-11-23 10:23:09 +00:00
Narayan Kamath
6d051fc68d PackageManager: Avoid creating encoders for appIds being written /config/sdcardfs
We know they will be ASCII, so use String.getBytes(US-ASCII) which is
much faster than creating a new ICU based CharsetEncoder for UTF-8 every time
we write one of these files (there will be a lot of them).

Test: make + manual.
Change-Id: I8eb62862ea1083e194d3f23ac68bb40aaae5efd5
2016-11-23 10:13:03 +00:00
Martijn Coenen
94c1ead8bb Merge "Add SystemProperties.reportSyspropChanged()." am: 45c0c6939f am: 8c05ff96fb am: 201cf4fb27
am: d42b1d01ca

Change-Id: I05410af5c0e9fe0807d6198aa5c6bdc2eb745ff8
2016-11-22 17:55:47 +00:00
Martijn Coenen
8c05ff96fb Merge "Add SystemProperties.reportSyspropChanged()."
am: 45c0c6939f

Change-Id: I83890872ba76161cf2f9a35b23861ab21b452a0f
2016-11-22 09:49:15 +00:00
Treehugger Robot
45c0c6939f Merge "Add SystemProperties.reportSyspropChanged()." 2016-11-22 09:43:23 +00:00
Jeff Sharkey
31d0b7043d Add 'fstrim' command for use from shell.
Test: builds, boots, new command works
Bug: 20948199
Change-Id: If7b122a6c98a4ce2a2f38e545015a22decd1b516
2016-11-21 15:05:09 -07:00
Jeff Sharkey
313456c975 Merge "Stub Binder API."
am: 4db1632b3a

Change-Id: I00e7f39d525a1d6af9a07b192294060113a2f7c2
2016-11-21 20:21:25 +00:00
Jeff Sharkey
4db1632b3a Merge "Stub Binder API." 2016-11-21 20:10:29 +00:00
Jeff Sharkey
1324531355 Stub Binder API.
Provide a stub API for AOSP code to call.

Test: builds
Bug: 32715088
Change-Id: Iab74d269e795a722e82fd3fa304200d57d152f57
2016-11-21 18:11:25 +00:00
Martijn Coenen
0754b27b56 Add SystemProperties.reportSyspropChanged().
To support notifying libutils of system property
changes.

Bug: 31262344
Test: builds
Change-Id: Iea77532eaa84d00f7d640edd1e3a1da66afdadc5
2016-11-21 17:57:13 +00:00
Hidenari Koshimae
5731460c4c Merge "CountDownTimer: not skip onTick()" am: 224d9e48fa am: 9997fcc72c am: 9f0cc266ce
am: 2b08faf2cc

Change-Id: I4fdd59a4530dea9375e5c38a9ce2337281b65e3c
2016-11-16 08:33:33 +00:00