Commit Graph

5723 Commits

Author SHA1 Message Date
Olivier Gaillard
33c7610814 Merge "Add @CriticalNative to a few Binder methods." 2018-11-01 16:05:10 +00:00
Jeff Sharkey
b8affbd14f Merge "Converge towards consistent modes API." 2018-10-30 16:56:35 +00:00
Misha Wagner
566903ab47 Add class to read per-thread CPU usage from proc filesystem
Reads all thread CPU usage for the current process. This traverses
"/proc/self/task/*/time_in_state" to gather the thread ID and CPU usage
of each child thread. Process name, thread name, and UID are also read from
"/proc" for interpretable data.

Bug: 111534779
Test: Unit test in CpuThreadProcReaderTest

Change-Id: I6c71dde1dfcc9bbb87d95baf0886f9da7a782299
2018-10-30 10:48:27 +00:00
Olivier Gaillard
78ecd34d29 Merge changes I02e88c93,Id0a2f52c
* changes:
  Use the BinderProxy#TransactListener to propagate the UID.
  Adds a mechanism to listen to proxy transact method calls.
2018-10-30 10:27:23 +00:00
Jeff Sharkey
92e9caf7ef Converge towards consistent modes API.
Bug: 111268862
Test: manual
Change-Id: I52e015685cfb424c15fd0266d9f19fd3bfdab971
2018-10-29 18:35:32 -06:00
Jeff Sharkey
669e6b1178 Force apps to request permissions for teamfooding.
To support teamfooding of the new storage privacy features coming
in Q, we need apps to request new AUDIO/VIDEO/IMAGES permissions, but
most of those apps are prebuilts that won't land updates until
several months in the future.

So add system properties so teamfooders can "force" apps to request
these permissions, making them work on Q builds.  Only takes effect
when isolated feature is enabled, and guarded with STOPSHIP to ensure
we remove it.

Here's a typical set of commands to use with this CL:

    adb shell setprop persist.fw.force_legacy 1
    - or -
    adb shell setprop persist.fw.force_audio com.google.android.music
    adb shell setprop persist.fw.force_video com.google.android.apps.photos
    adb shell setprop persist.fw.force_images com.google.android.apps.photos,com.google.android.apps.messaging
    - then -
    adb shell setprop persist.sys.isolated_storage 1
    adb reboot

Bug: 118504670
Test: manual
Change-Id: I631819648334994255256b6046bb4c8aec07ce3a
2018-10-29 15:03:28 -06:00
Olivier Gaillard
def1b90dec Use the BinderProxy#TransactListener to propagate the UID.
PropagateWorkSourceTransactListener intercepts outgoing calls and calls
Binde#setThreadWorkSource.

Also install the listener to system server to propagate the worksource
through binder calls.

Test: manual
Change-Id: I02e88c93eebdf200691dd72b79aa7648f4d85bcb
2018-10-29 17:19:31 +00:00
Olivier Gaillard
510cdfc32c Adds a mechanism to listen to proxy transact method calls.
There are multiple use cases for it:

1) Make it easy for another process to set the worksource. The
worksource can be propagated in a thread local - this is how gmscore and soon
system server works -  the worksource can then be set for all binder
calls using

Object transactStarted() {
    Binder.setWorkSource(ThreadLocalWorkSourceUid.get());
    return null;  // No token needed.
}

void transactEnded() {
    Binder.setWorkSource(null);
}

This will be used by system process and gmscore.

2) SystemUI team was interested in detecting binder calls done from the
main thread in dogfood/tests. This listener will make it easy to figure
out which thread is used.

Performance impact of transact method:
    - With current code: 45ns per call
    - With this code: 57ns per call
This is not significant compared to the total binder call time which is
10-100s of microseconds.

Test: unit test
Change-Id: Id0a2f52cba33b390ff83f703284b79471cc80b1c
2018-10-29 17:19:31 +00:00
Varun Shah
59a1ff3ee7 Merge "Exposes user type related hidden APIs in UserManager." 2018-10-27 02:07:56 +00:00
Jeff Sharkey
5f97b7ee27 Merge "Magic to keep "_data" paths working." 2018-10-26 19:31:08 +00:00
Jeff Sharkey
bc2ae00878 Magic to keep "_data" paths working.
As part of the storage changes in Q, we're removing the ability for
apps to directly access storage devices like /sdcard/.  (Instead,
they'll need to go through ContentResolver.openFileDescriptor() to
gain access.)  However, in several places we're returning raw
filesystem paths in the "_data" column.  An initial attempt to simply
redact these with "/dev/null" shows that many popular apps are
depending on these paths, and become non-functional.

So we need to somehow return "_data" paths that apps can manually
open.  We explored tricks like /proc/self/fd/ and FUSE, but neither
of those are feasible.  Instead, we've created a cursor that returns
paths of this form:

/mnt/content/media/audio/12

And we then hook Libcore.os to intercept open() syscalls made by
Java code and redirect these to CR.openFileDescriptor() with Uris
like this:

content://media/audio/12

This appears to be enough to keep most popular apps working!  Note
that it doesn't support apps that try opening the returned paths
from native code, which we'll hopefully be solving via direct
developer outreach.

Since this feature is a bit risky, it's guarded with a feature flag
that's disabled by default; a future CL will actually enable it,
offering a simple CL to revert in the case of trouble.

Bug: 111268862, 111960973
Test: atest cts/tests/tests/provider/src/android/provider/cts/MediaStore*
Change-Id: Ied15e62b46852aef73725f63d7648da390c4e03e
2018-10-26 09:32:29 -06:00
Sudheer Shanka
2ac25a96e7 Update StorageManagerService handling of packages info.
Instead of maintaining local copy of all appIds and sandboxIds,
StorageManagerService will just get required packages info
from PackageManagerService when an user starts and passes it
to vold.

Bug: 117988901
Test: manual
Change-Id: Ib7411645bd0c5e2801bc998d92fda00bceb9c258
2018-10-25 17:42:20 -07:00
Olivier Gaillard
d8c3df56be Add @CriticalNative to a few Binder methods.
Test: manual
Change-Id: Iea27a6b3c95eb043ff195aefb1bd2a809d9af48d
2018-10-25 18:11:56 +01:00
Misha Wagner
cc065fb95e Modify Process::readProcFile to read in variable size file
The original Process::readProcFile could only read files smaller than 256 bytes.
This change allows the function to read in larger files. For files smaller than
256 bytes, the added cost is only an extra read call, which returns zero.

Documentation has also been added to Process::readProcFile.

Test: Used in change 5168194

Change-Id: I82f27355276e08f96bdb5fe7da49514a87afb429
2018-10-25 10:51:40 +01:00
Olivier Gaillard
35ab42f7a4 Merge "Add WorkSource support to Binder.java." 2018-10-24 07:37:57 +00:00
Varun Shah
e142e33613 Exposes user type related hidden APIs in UserManager.
UserManager#isAdminUser, UserManager#isPrimaryUser,
UserManager#isGuestUser, and UserManager#isRestrictedProfile
are now exposed as System APIs for SUW. All of them require the
MANAGE_USERS permission.

Bug: 115270753
Test: manual (run setup wizard)
Change-Id: I5b9685d486738c3d5a7f5cfa6748adb6efef91bb
2018-10-23 16:23:24 -07:00
Kweku Adams
9b882d88ee Merge "Ability to enter deep Doze immediately in Battery saver." 2018-10-23 17:35:26 +00:00
Kweku Adams
b396ccf969 Ability to enter deep Doze immediately in Battery saver.
This is disabled by default and leaves time (1 min) for processes to
finish running only if there are processes currently running, otherwise,
it goes into deep doze immediately.

Bug: 79955941
Bug: 109934270
Test: Turn on Battery Saver, enable quick doze feature, turn off screen
also run `atest BatterySaverPolicyTest`
also run `atest com.android.server.DeviceIdleControllerTest`
Change-Id: Iec0c8436134e18debfa4c71a8322a6c9cdb10846
2018-10-23 10:32:54 -07:00
Olivier Gaillard
e4ff397f08 Add WorkSource support to Binder.java.
Test: unit test
Change-Id: I6f3507b51a89c35943cc34299d7e364aab337e98
2018-10-23 14:27:34 +01:00
TreeHugger Robot
b3b140770e Merge "Update unknown sources restriction API documentation to clarify device-widedness." 2018-10-22 08:58:46 +00:00
Jeff Sharkey
d2b64d7018 Add ContentProvider.clearCallingIdentity().
ContentProvider has a getCallingPackage() method, which verifies
the remote package name against the current Binder identity.  When a
provider wants to clear that IPC identity, they need to clear both
the Binder state and the ContentProvider.getCallingPackage() state
together, so add methods to facilitate that.

Also fix subtle bug so we don't try translating relative paths.

Bug: 117627072
Test: atest cts/tests/tests/provider/src/android/provider/cts/MediaStore*
Change-Id: Ifa3e1f745334abf625fdcc314b308a047c49ce73
2018-10-20 15:14:22 -06:00
Irina Dumitrescu
0501eeec33 Update unknown sources restriction API documentation to clarify device-widedness.
Test: none.
Bug: 117831202
Change-Id: I2106bb25ce32ade89abb909e0332f1b6d7f1eb58
2018-10-19 23:52:42 +01:00
Michael Groover
3ce26d00f7 Merge "Require READ_PHONE_STATE for DO/PO dev ID access" 2018-10-19 19:15:01 +00:00
Cody Northrop
fdd0229da8 Merge "Find and load ANGLE rules, pass to libEGL" 2018-10-18 21:01:24 +00:00
Cody Northrop
7fd4421f7f Find and load ANGLE rules, pass to libEGL
In order to load a text file from an APK, it must be present
in the assets folder and be uncompressed. The AssetManager can
find assets from any application, so we point it at ANGLE. We
then pass the file descriptor, offset, and size, down to the loader
so it can parse json from the asset.

Bug: 80239516
Test: Manual build, ensure we can inspect rules from modified APK
Test: cts-tradefed run singleCommand cts -m CtsAngleIntegrationHostTestCases
Change-Id: Ib3ecce34b043753b2894915975b6dd8440154ae2
(cherry-picked from commit cfaa0ba52fcf60578acdd64bc4dc9a00f6e300ed)
2018-10-18 09:16:57 -06:00
Jeff Sharkey
0c91451bc8 Catch more invalid file modes.
Bug: 117440225
Test: atest android.os.FileUtilsTest
Change-Id: Id5e8c0869182b6391994dd9266a455dd3152e653
2018-10-17 18:32:27 -06:00
TreeHugger Robot
11f07dec94 Merge "Private DNS: Add user restriction" 2018-10-17 08:36:56 +00:00
Peiyong Lin
88c38eb6fe [GraphicsEnvironment] Add whitelist support.
This patch adds the ability to load whitelist from updatable graphcis driver
apk. Typically a whitelist is part of the graphics driver apk, and the name is
set by overwriting ro.gfx.driver.whitelist.0

BUG: 117241379
Test: Build, flash and boot, whitelist an app and verify.
Change-Id: Ie36ca0173a90a8e48acaca2979ab64bbf92eeaed
2018-10-16 12:54:38 -07:00
Cody Northrop
fba8e6342f Merge "Revert "Revert "Rootless GPU Debug for GLES""" 2018-10-16 18:54:42 +00:00
Cody Northrop
ebe6a56f80 Revert "Revert "Rootless GPU Debug for GLES""
This reverts commit 2653e624dc.

Exempt-From-Owner-Approval: This restores a commit that was already
approved and rolled back for unrelated reasons in frameworks/native.

Test: cts-tradefed run singleCommand cts -m CtsGpuToolsHostTestCases
Test: Chromium starts up
Test: CtsDeqpTestCases:include-filter:dEQP-EGL.*
Test: CtsDeqpTestCases:include-filter:dEQP-GLES2.*
Test: CtsDeqpTestCases:include-filter:dEQP-GLES3.*
Test: CtsDeqpTestCases:include-filter:dEQP-GLES31.*
Bug: 110883880
Bug: 117609555
Change-Id: Iab23a5d598986ba34c0ba62dc78299d022924cd9
2018-10-16 18:51:28 +00:00
Luke Huang
ca4d6f124c Merge "Network-related commands porting" am: 9b20115264 am: 923aa75d75
am: 11454a2163

Change-Id: I61fea40c9659f1eed1638cc196d309289393d6a5
2018-10-16 02:32:50 -07:00
Luke Huang
11454a2163 Merge "Network-related commands porting" am: 9b20115264
am: 923aa75d75

Change-Id: I957050b73afed3e6fde908883568b81198310622
2018-10-16 02:19:35 -07:00
Luke Huang
9b20115264 Merge "Network-related commands porting" 2018-10-16 07:44:37 +00:00
Michael Groover
1905f3f162 Require READ_PHONE_STATE for DO/PO dev ID access
When device identifier access was moved from a runtime permission to a
privileged permission device and profile owner access regressed by no longer
requiring consent to access the identifiers. With this change device and
profile owners will still need to have the READ_PHONE_STATE permission to
access identifiers.

Bug: 117611604
Test: cts-tradefed run cts -m CtsDevicePolicyManagerTestCases \
      -t com.android.cts.devicepolicy.DeviceOwnerTest#testDeviceOwnerCanGetDeviceIdentifiers
Test: cts-tradefed run cts -m CtsDevicePolicyManagerTestCases \
      -t com.android.cts.devicepolicy.ManagedProfileTest#testProfileOwnerCanGetDeviceIdentifiers

Change-Id: Ib2d86440c531eab075d010de183ccfa45c2443e5
2018-10-15 16:45:12 -07:00
Philip P. Moltmann
54118289e5 Merge "Use public method in RestrictedLockUtils#isCurrentUserOrProfile" 2018-10-15 16:41:53 +00:00
Eran Messeri
09b122daac Private DNS: Add user restriction
Add a user restriction to prevent the user from changing the Private DNS
settings.

This would be used together with the new DevicePolicyManager API to set
the Private DNS settings by the Device Policy Client to enforce Private
DNS settings by the IT admin of the user.

Bug: 112982691
Test: atest com.android.cts.devicepolicy.DeviceOwnerTest#testPrivateDnsPolicy
Test: m -j RunSettingsRoboTests ROBOTEST_FILTER=PrivateDnsModeDialogPreferenceTest
Test: Manual, using TestDPC
Change-Id: Ibec3cfcede7e4082db4068cbdd047ada3f6c227e
2018-10-15 07:52:26 +01:00
Cody Northrop
2653e624dc Revert "Rootless GPU Debug for GLES"
This reverts commit f41625936f.

Exempt-From-Owner-Approval: Reverting
Bug: 110883880
Test: Chrome no longer crashes
Change-Id: I70c9d4a0376b27059e7759e1b6283903c0cf168b
2018-10-12 21:34:15 +00:00
Nandana Dutt
d1773d6459 Merge "Add DumpstateOptions java implementation" am: 52502ef1a1 am: 8a9f23c8a1
am: 1d1184cf83

Change-Id: I556407ee455b92e3bae34dfa603e159b99f45080
2018-10-12 11:21:26 -07:00
Nandana Dutt
1d1184cf83 Merge "Add DumpstateOptions java implementation" am: 52502ef1a1
am: 8a9f23c8a1

Change-Id: I392c2c6bdb522efa708b82174debf3a18167c0bc
2018-10-12 11:07:59 -07:00
Marcin Oczeretko
4427272533 LooperStats - track time to message dispatch
Test: UT and manual
atest .../LooperStatsTest.java
Verified that adb shell cmd looper_stats dump produces data
with dispatch delay

Bug: 113651685

Change-Id: I44550f8c5d71848932733bd02016aa65ce7b75b3
2018-10-12 13:17:01 +01:00
Nandana Dutt
b3f7168136 Add DumpstateOptions java implementation
DumpstateOptions will be used to pass options to Dumpstate service
for specifying arguments for taking bugreports.

Test: m
Test: adb bugreport

Change-Id: I4dc9511f0be2f86239ea9094a3c527b6ce0d1d41
2018-10-11 17:05:35 +01:00
Anton Hansson
b32cb2a7d3 Merge "Tweak the getPartitions API" 2018-10-11 09:54:51 +00:00
Anton Hansson
81f76a0812 Tweak the getPartitions API
- Rename methods
- Annotate public APIs with @NonNull
- implement equals/hashcode

Bug: 117146036
Bug: 112584519
Test: atest BuildVersionTest
Change-Id: I0b55e7f8e240948e674a981b280d8c8c94de6f8e
2018-10-11 07:52:41 +00:00
Tor Norbye
757cc2cded Merge "Fix incorrect javadoc links" am: 0d954557a1 am: cd1c75ae4c
am: f2183961a9

Change-Id: Icf157b65308e7de18b51aec837b8c29baa5a1918
2018-10-10 23:22:18 -07:00
Tor Norbye
f2183961a9 Merge "Fix incorrect javadoc links" am: 0d954557a1
am: cd1c75ae4c

Change-Id: I6d8c44be9d156ac2b6a20d3d13972371ee4d741e
2018-10-10 17:20:42 -07:00
Cody Northrop
616d4f5697 Merge "Rootless GPU Debug for GLES" 2018-10-10 23:20:18 +00:00
Sudheer Shanka
dcd0b0abde Merge "Delete package sandbox data when it is uninstalled." 2018-10-10 21:00:04 +00:00
Cody Northrop
f41625936f Rootless GPU Debug for GLES
This commit adds the ability to enable debug layers for OpenGL ES.

Similar to Rootless Debug for Vulkan, layers can be loaded from the
APK or base directory of selected debuggable applications.

Layers will only be loaded when developers opt-in via settings for a
target application.

A separate application can now be specified as an additional location
for layer discovery.

Example usage:

  adb shell settings put global enable_gpu_debug_layers 1
  adb shell settings put global gpu_debug_app <target_app>
  adb shell settings put global gpu_debug_layers layer1.so:layer2.so
  adb shell settings put global gpu_debug_layer_app <layer_app>

Test: cts-tradefed run singleCommand cts -m CtsGpuToolsHostTestCases
Bug: 110883880
Change-Id: I16df1951be0c06c80a445991e3e6d1636222b17b
2018-10-10 14:50:25 -06:00
Philip P. Moltmann
e5e217dac2 Merge "Change DevicePolicyManager APIs as requested" 2018-10-10 19:50:06 +00:00
Irina Dumitrescu
c6426b0e41 Merge "Fix incorrect javadoc links" 2018-10-10 19:07:59 +00:00