Commit Graph

5758 Commits

Author SHA1 Message Date
Salvador Martinez
5980543478 Merge changes from topic "dynamic_power_saver"
* changes:
  Create APIs to interact with DynamicPowerSaver
  Create new battery saver mode
2018-11-13 20:23:03 +00:00
Risan
f8771d362c Merge "Introducing StubVolume in StorageManager" am: b499af866c am: eb871cc916
am: ee32e0d473

Change-Id: I4098132df9833b7cbac0db9bdadac297d324a822
2018-11-13 12:12:23 -08:00
Risan
ee32e0d473 Merge "Introducing StubVolume in StorageManager" am: b499af866c
am: eb871cc916

Change-Id: I69240d32659b511aec0e1e029fb6c6f1ab455c9c
2018-11-13 11:57:12 -08:00
Treehugger Robot
b499af866c Merge "Introducing StubVolume in StorageManager" 2018-11-13 19:20:38 +00:00
Salvador Martinez
812ea7554b Create APIs to interact with DynamicPowerSaver
This creates the PowerManager APIs that allow apps with the
appropriate permissions to interact with Dynamic Power Saver.

Bug: 111450127
Test: WIP
Change-Id: I5b9483fa0fba81a4ade622b1f3dbaec580b68a67
2018-11-13 09:33:50 -08:00
Anton Hansson
4a08723c5f Merge "Make Environment.getProductDirectory() @TestApi" 2018-11-13 12:53:07 +00:00
Sudheer Shanka
52b976d8be Merge "Update storage sandbox path translation methods." 2018-11-13 03:51:48 +00:00
TreeHugger Robot
3ab40f1866 Merge "Add sm set-isolated-storage [true|false]" 2018-11-13 01:19:24 +00:00
Sudheer Shanka
87915d66c3 Update storage sandbox path translation methods.
Update these methods to consider if the app is sandboxed or not.
Earlier, only apps with WRITE_MEDIA_STORAGE have access to full
external storage. So, clients had to check this before calling
these translate methods. Now, apps under instrumention might also
have full storage access and DownloadProvider will also start
using these translate methods. So, instead of having the clients
deal with it, move the logic of checking if an app is sandboxed or
not into these translate methods.

Bug: 117229024
Bug: 119265456
Test: atest MediaProviderTests
Test: atest cts/tests/tests/provider/src/android/provider/cts/MediaStore*
Test: atest services/tests/servicestests/src/com/android/server/StorageManagerServiceTest.java

Change-Id: If679e71a906bb2106752721409b4410557fb3e28
2018-11-12 14:56:58 -08:00
Josh Gao
bd1db80249 Merge "Close PFD.AutoClose{In,Out}putStream before the PFD itself." am: 8fe23dfeff am: dcf129f380
am: a355924be3

Change-Id: I9db1facad1b464715a1d8d64d9caa1ebd5d3ba43
2018-11-12 13:28:18 -08:00
Josh Gao
a355924be3 Merge "Close PFD.AutoClose{In,Out}putStream before the PFD itself." am: 8fe23dfeff
am: dcf129f380

Change-Id: I6926ff23f7360ba2acf2b87dff1b20c548d7d0d4
2018-11-12 13:12:13 -08:00
Josh Gao
401fb2485a Close PFD.AutoClose{In,Out}putStream before the PFD itself.
Bug: http://b/118316956
Test: atest ParcelFileDescriptorTest
Test: atest ParcelFileDescriptor_AutoCloseOutputStreamTest
Change-Id: I39c5b15ea8ac5915e4f5e4e42328cd08f65ec9a0
2018-11-09 14:10:33 -08:00
Peiyong Lin
2d5a2bb0ad Add global property to store opt-in application package name.
We provide a way in developer option to opt-in an application to use updated
graphics driver. To make sure we set up the graphics environment correctly, we
need to access the package name of the selected application. This patch
introduces a global property to store the package name.

BUG: 119221883
Test: Build, flash and boot, verify with prototype
Change-Id: I49dfcccf387169c072fb9345f7a50c00fcdb0737
2018-11-09 11:53:00 -08:00
Risan
05c41e6a0a Introducing StubVolume in StorageManager
Bug: 110380403
Test: Tested in ARC++ (with Settings and vold changes in separate CLS)
- able to see the external storage under StorageSettings. Also tested
the sm command to print stubvolumes.

Change-Id: I7517260a40399bd9800424bb394512601f6af617
2018-11-08 21:48:35 +00:00
Sudheer Shanka
be0febe40a Add sm set-isolated-storage [true|false]
Bug: 119038726
Test: manual
Change-Id: I29eeec7872584f1173e9b6d31434b36487515d9e
2018-11-08 11:36:04 -08:00
Cody Northrop
5431cccea9 Merge changes from topic "rules_fd_from_disk"
* changes:
  Add temp ANGLE rules support
  Remove app preference from ANGLE logic
2018-11-08 15:01:51 +00:00
Anton Hansson
09e47be13b Make Environment.getProductDirectory() @TestApi
Tests should be allowed to know where the product directory is mounted.

Bug: 119049497
Test: atest SysConfigTest
Change-Id: I3f196a862ad10d21646d4d5f8e46f6eec0a3bf6c
2018-11-08 13:08:42 +00:00
TreeHugger Robot
157edce8a7 Merge "Deprecated scoped directory access." 2018-11-08 02:14:24 +00:00
Cody Northrop
8d72a6b06f Add temp ANGLE rules support
If root is available or the app is debuggable,
check for the following property and use it to load
a rules file instead of the one that comes with ANGLE:

  debug.angle.rules

For example:

  adb shell setprop debug.angle.rules /data/local/tmp/a4a_rules.json

Bug: 80239516
Test: Manual build, ensure rules behave as expected
Test: cts-tradefed run singleCommand cts -m CtsAngleIntegrationHostTestCases
Change-Id: Ie43c67c078ad962ba12f1046a878f79216660755
2018-11-07 14:38:58 -07:00
Wei Wang
bad7c20606 Add thermal service into system_server
This system service will listen to ThermalHAL for throttling events and
take actions accordingly, e.g. shutdown device and/or sending
notification to registered listeners to IThermalSerivce.

Bug: 79443945
Bug: 118510237
Bug: 111086696
Bug: 116541003
Test: Boot and test callback on ThermalHAL 1.1
Test: Boot and test callback on ThermalHAL 2.0
Test: Kill ThermalHAL process
Test: Change device threshold to trigger shutdown
Change-Id: I1f4066c9f1cf9ab46c1738a0a4435802512e4339
2018-11-07 13:38:57 -08:00
Cody Northrop
6d8d96801e Remove app preference from ANGLE logic
* The use of meta-data to specify app preference for ANGLE was
  temporary, so remove it.
* Since we no longer plan to allow apps to specify a preference
  at all, remove the JNI plumbing.

Bug: 80239516
Test: Manual build, ensure rules are followed
Test: cts-tradefed run singleCommand cts -m CtsAngleIntegrationHostTestCases
Change-Id: If8eb6087ae85bb82eae6625778e1c3a926fe038a
2018-11-07 14:00:58 -07:00
Felipe Leme
05083b019f Merge "Initial APIs for Intelligence Service." 2018-11-05 21:48:54 +00:00
Felipe Leme
1dfa9a0195 Initial APIs for Intelligence Service.
A.K.A: "The thing's hollow — it goes on forever — and — oh my God! —
        it's full of TODOs!"

Bug: 117944706
Test: m update-api && m

Change-Id: I0774a0df4f4ea0810a8c5f72a1fbcd4eef5cd09b
2018-11-05 09:22:18 -08:00
Cody Northrop
e4ae7ea03e Merge "Add GLES specific setting for layers" 2018-11-04 17:00:46 +00:00
Jeff Sharkey
e4d87cb722 Merge "First pass at APIs for contributing new media." 2018-11-03 19:42:58 +00:00
Jeff Sharkey
c8e4924b57 First pass at APIs for contributing new media.
MediaStore has long suffered from race conditions around creation
of new media.  For example, if developers write raw files before
inserting the MediaStore item, an in-progress media scan might pick
up the file before they could insert it.  Conversely, if developers
insert the item before writing the files, backup apps get confused
about the file not existing yet.

In addition, the new storage model in Q means that apps can't write
raw files directly to disk, so they need to insert the MediaStore
item first.

To solve this collection of issues, this CL introduces first-class
APIs for contribution of new "pending" media, which includes hiding
the pending media until explicitly published.  Apps can safely
resume pending sessions if they crash and restart, which is useful
when the media item is coming from a flaky network.  Apps can also
publish progress information about pending media, such as when a
panorama is taking several seconds to process.

Bug: 115377970
Test: atest MediaProviderTests
Test: atest cts/tests/tests/provider/src/android/provider/cts/MediaStore*
Change-Id: I6adee3c4ad1fb9db94906dd1293caaa1a09c6da0
2018-11-03 12:03:07 -06:00
Risan
d17dabf5dd Merge "ResetListener in StorageManagerService" am: 6b3a5194d9
am: 493110e0b4

Change-Id: I25a0a9a949d17c0a0d05106dc91254f5fbc901e3
2018-11-02 21:43:07 -07:00
Risan
a354a27056 ResetListener in StorageManagerService
Bug: 110380403
Test: Manual test in ARC++, prototyped a way that reset reaches ARC++
service.
Change-Id: Icc7dcc8b5c726ed9f61226569227c4d47f44b386
Merged-In: Icc7dcc8b5c726ed9f61226569227c4d47f44b386
2018-11-02 21:45:43 +00:00
Amin Shaikh
b49cedf0b3 Deprecated scoped directory access.
- Deprecate StorageVolume#createAccessIntent and
Settings#ACTION_STORAGE_VOLUME_ACCESS_SETTINGS
- Delete StorageVolume#ScopedAccessProviderContract

Bug: 111892460
Test: atest \
	cts/tests/providerui/src/android/providerui/cts/MediaStoreUiTest.java \
	cts/tests/tests/os/src/android/os/storage/cts/StorageManagerTest.java \
	cts/hostsidetests/appsecurity/test-apps/DocumentClient/src/com/android/cts/documentclient/ScopedDirectoryAccessClientTest.java

Change-Id: I2d0dcc87d5b18a6424cb73384a88cdd2cabe0f4d
2018-11-02 15:13:29 -04:00
TreeHugger Robot
9aab89bd58 Merge "ResetListener in StorageManagerService" 2018-11-02 18:23:49 +00:00
Risan
aec0ee73d7 ResetListener in StorageManagerService
Bug: 110380403
Test: Manual test in ARC++, prototyped a way that reset reaches ARC++
service.
Change-Id: Icc7dcc8b5c726ed9f61226569227c4d47f44b386
2018-11-02 03:42:15 +00:00
Wei Wang
356a75ad94 Add a missing sync to RemoteCallbackList dump
Test: Build and boot
Change-Id: Icda7aa10569c0946bbbf0ed08d04b4d21c53b7aa
2018-11-01 16:07:38 -07:00
Cody Northrop
0fa1d220dc Add GLES specific setting for layers
This allows loading layers for GLES and Vulkan at the
same time by adding a GLES specific setting:

  GPU_DEBUG_LAYERS_GLES

which mirrors the existing setting:

  GPU_DEBUG_LAYERS

The Vulkan and GLES loaders now scan distinct layer
lists, correcting an issue that would prevent Vulkan
from loading when it failed to find GLES layers.

Bug: 110883880
Test: Load a GLES layer when running ANGLE with Vulkan backend
Test: cts-tradefed run singleCommand cts -m CtsGpuToolsHostTestCases
Change-Id: I370be4ce6fdde9e95989eb1f274add8b5790263e
2018-11-01 14:15:44 -06:00
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
Nathan Harold
41e2d7494f Merge "Move some members to the "Q blacklist"." am: f5cf9f24ed
am: 13c9e7e2f3

Change-Id: Ia2419cce28d26d9464da2a5172cb332b629e943e
2018-10-24 16:14:06 -07: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