Commit Graph

3763 Commits

Author SHA1 Message Date
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
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
Hidenari Koshimae
9997fcc72c Merge "CountDownTimer: not skip onTick()"
am: 224d9e48fa

Change-Id: I7ade5d057e73f53867747c00fcfc5882a57a2f4c
2016-11-16 08:10:54 +00:00
Treehugger Robot
224d9e48fa Merge "CountDownTimer: not skip onTick()" 2016-11-16 07:55:27 +00:00
Sudheer Shanka
2250d56a0b Rename MountService to StorageManagerService.
Bug: 30977067
Test: Existing tests pass
Change-Id: Ieac0f11c2b249dcd60441b14c1f391e6f8131d42
2016-11-15 12:43:37 -08:00
Garfield Tan
368d703d7d Merge "Add internal support to convert a file system path to document URI." 2016-11-14 23:37:12 +00:00
Sudheer Shanka
dc589ac82b Update usage of ActivityManagerNative.
- Remove references to ActivityManagerProxy.
- Add isSystemReady to ActivityManager.

Bug: 30977067
Test: cts/hostsidetests/services/activityandwindowmanager/util/run-test android.server.cts
      adb shell am instrument -e class com.android.server.am.ActivityManagerTest,com.android.server.am.TaskStackChangedListenerTest \
          -w com.android.frameworks.servicestests/android.support.test.runner.AndroidJUnitRunner
Change-Id: I07390b6124fb1515821f5c0b37baf6ae74adc8fa
2016-11-14 11:27:12 -08:00
TreeHugger Robot
d43d705735 Merge "Revert "Add Build.isAtLeastO"" 2016-11-14 15:46:17 +00:00
TreeHugger Robot
40d0e338a1 Merge "health: import android.hardware.health@1.0 constants into BatteryManager" 2016-11-11 18:57:47 +00:00
Clara Bayarri
7eda644785 Revert "Add Build.isAtLeastO"
This reverts commit 3b8b07c8f4.

Bug: 32668621
Test: this is a revert, no original tests
Change-Id: I893025f32423aed3fe15a64c22753d24aafc4e65
2016-11-11 01:56:32 +00:00
Garfield Tan
92b96ba8fc Add internal support to convert a file system path to document URI.
Test: Manual tested with a new sample app in development/samples.

Bug: 30261615
Change-Id: I498a22b248fbc55b33d3efb4aa3183207cfb7bab
2016-11-10 15:51:39 -08:00
Sandeep Patil
a21c42769f health: import android.hardware.health@1.0 constants into BatteryManager
Test: make
Bug: b/32724915

Change-Id: I7ca7507b7be54442dc3250b02db3e4f7e95f0685
Signed-off-by: Sandeep Patil <sspatil@google.com>
2016-11-10 14:02:45 -08:00
Jeff Sharkey
d0ac9d3bac Merge "Detect non-oneway calls leaving system_server." 2016-11-09 16:51:41 +00:00
Dianne Hackborn
80361c9ea7 Merge "Move code for handling uid obs "cutoff" to activity manager" 2016-11-08 23:03:21 +00:00
Steven Moreland
78c6b4cfa5 Merge "Update for namespaced services in hwservicemanager." am: 605df82c9e am: 3dcee9882d am: 1a384933df
am: 97186e09ae

Change-Id: Idc856de883500636be54f91d7529a1cc82c7313e
2016-11-08 21:48:59 +00:00
Steven Moreland
3dcee9882d Merge "Update for namespaced services in hwservicemanager."
am: 605df82c9e

Change-Id: I38d861ca107665f1f865f19eebd1be368a8c77a4
2016-11-08 21:20:57 +00:00
Dianne Hackborn
5614bf5a1a Move code for handling uid obs "cutoff" to activity manager
To do this, I had to fix the PROCESS_STATE_NONEXISTENT constant
to be the last value (instead of the special magical -1 value)
so it semantically matches the public importance constants.  I
think this is better anyway.

Also this fixes a big problem in the implementation, where we
weren't keeping track of the last proc state per uid...!  Duh.

Test: manually ran testUidImportanceListener
Change-Id: Ie3008f824446089840f896885e6033472abb065e
2016-11-08 11:38:04 -08:00
Steven Moreland
f3c53496c0 Update for namespaced services in hwservicemanager.
Test: end to end, hidl_test_java
Bug: 31861268
Change-Id: I3e91cf8a87f9345d4ae0650e521414407c7fc780
2016-11-08 08:53:16 -08:00
Jeff Sharkey
0a17db1cc5 Detect non-oneway calls leaving system_server.
To protect system stability, any Binder calls leaving the
system_server must carefully be performed using FLAG_ONEWAY (or
the 'oneway' verb in AIDL) which prevents the call from blocking
indefinitely on the remote process.

In this CL, the system_server uses the new Binder.setWarnOnBlocking()
method to enable detection by default for all remote Binder
interfaces.  It can also use Binder.allowBlocking() to allow
blocking calls on certain remote interfaces that have been
determined to be safe.

This CL adds the 'oneway' verb to several interfaces and methods
where it should have been added, and marks a handful of system
ContentProviders as being safe to call into.  Also, we assume that
any services obtained from ServiceManager are part of the core
OS, and are okay to make blocking calls to.

Test: builds, boots, runs with minimal logs triggered
Bug: 32715088
Change-Id: Ide476e120cb40436a94b7faf7615c943d691f4c0
2016-11-07 17:03:37 -07:00
TreeHugger Robot
1e1fd76a67 Merge "thermal: add usage of IThermal." 2016-11-07 19:41:07 +00:00
Polina Bondarenko
71cb0c5b6a thermal: add usage of IThermal.
HardwarePropertiesManagerService native impl uses IThermal instead of
thermal_module.

Bug:32022261
Test: CTS
Change-Id: I85e5c5bedb1cb6762207ccfa3e3a7dd4c00ee30a
2016-11-07 16:07:05 +01:00
TreeHugger Robot
3e8431f1f2 Merge "Move IActivityManager to aidl." 2016-11-04 22:24:12 +00:00
Sudheer Shanka
6e9dedaa74 Merge "Fix IMountService transaction ids." 2016-11-04 19:38:09 +00:00
Sudheer Shanka
fc46e9b643 Move IActivityManager to aidl.
Bug: 30977067
Test: Existing tests are passing, dump commands still working.
Change-Id: I9cf81c4d381ebce14a6c701e409cbb269f2ff1fb
2016-11-04 10:43:25 -07:00
TreeHugger Robot
f34231523e Merge "Add traces to systrace when binder tracing is enabled" 2016-11-03 03:26:52 +00:00
Jorim Jaggi
25ee0bc6d1 Add traces to systrace when binder tracing is enabled
If binder tracing is enabled, we also output the class/method name
to systrace. This is the first step toward a system in which we could
show the full stack trace in systrace.

Test:
adb shell am trace-ipc start
python systrace.py
adb shell am trace-ipc stop

Change-Id: I6d0354c9560c4518c84fb3fdb66219b460e69f67
2016-11-02 16:10:14 -07:00
TreeHugger Robot
9c1202be95 Merge "Add VERSION_CODES.O" 2016-11-02 20:27:15 +00:00
Makoto Onuki
864f4bd9ed Add VERSION_CODES.O
So that the framework can do "targetSdk >= O".

Test: Additional hidden constant only. "m"
Change-Id: I6cde68869c3b8bdc8e8b06b7d63f164714fbd2b0
2016-11-02 11:30:14 -07:00
Sudheer Shanka
34b33887a1 Fix IMountService transaction ids.
- (IBinder.FIRST_CALL_TRANSACTION=1) is added to the specified
  transaction codes during binder generation. Correct the
  IMountService transaction ids taking this into account.
- Update interface descriptors in MountService related native code.
- Add proxy implementations for IMountServiceListener and
  IMountShutdownObserver.

Bug: 30977067
Test: Verified that calls from native code to IMountService system
      service are working and listeners in native code can get the
      callbacks correctly.
Change-Id: I9bef9a8113e92d8b36e963bd961ac858acac3f2a
2016-11-01 23:29:33 -07:00