Commit Graph

7041 Commits

Author SHA1 Message Date
Kenny Root
8b0a22dbad Merge changes from topic "usb-adb-separation"
* changes:
  Update USB tests for ADB split
  Move AdbDebuggingManager to AdbService
  AdbService: move source of truth for enabled
  Add empty AdbHandler
  Add systemReady call for AdbService
  Add function to query ADB state
  Register USB as an ADB transport type
  Add ADB transport skeleton
  Add empty AdbManagerInternal for system server
  Add empty AdbService to SystemServer
  Move ADB debugging manager to core
  Rename to AdbDebuggingManager
  Move UsbDebuggingManager to new package
2018-11-02 00:43:05 +00:00
Chris Craik
ce58754645 Merge "Add 'profileable' application manifest tag" 2018-11-01 21:28:58 +00:00
TreeHugger Robot
2c87f2ead8 Merge "Add an intent to launch the app permission usage screen." 2018-10-31 19:28:03 +00:00
Patrick Baumann
1f9b8850a2 Only adds hidden app detail for normal apps
The new hidden app detail activity was being added to all packages being
installed, even static shared libraries, which may not have any
activities and which we do not want to surface to the user in launcher.

Change-Id: I80e7d379abed04f2464d1dc7e8b75456e43063f4
Fixes: 118145903
Test: atest android.os.cts.StaticSharedLibsHostTests
2018-10-31 15:51:02 +00:00
Kenny Root
f74bfdee01 Add empty AdbService to SystemServer
Create skeleton service to migrate functions from UsbService in later
change.

Bug: 63820489
Test: make
Change-Id: I07672fe87cfae188fe77c173fc49119e182c6b05
2018-10-31 16:11:01 +09:00
Chris Craik
ce0302890a Add 'profileable' application manifest tag
Bug: 117841084
Test: atest CtsAtraceHostTestCases:AtraceHostTest

Allow apps to opt-in to important profiling features (systrace, binder
tracing), without requiring debuggable=true. Debuggable has
significant performance overhead, and is undesirable for profiling.

Profileable is set to true when debuggable is true.

Change-Id: I16aaa7bc60dee4b1b262e169ac285759d57d8198
2018-10-30 10:24:31 -07:00
TreeHugger Robot
64f878e0a9 Merge "Add RoleManager into the system." 2018-10-30 10:03:39 +00:00
Jeff Sharkey
00e3e1b203 Merge "Force apps to request permissions for teamfooding." 2018-10-30 00:19:57 +00: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
Zhi An Ng
1c866f4f5a Merge "Add new queue to offload slow broadcasts" 2018-10-29 18:57:28 +00:00
Joel Galenson
78ec58d209 Add an intent to launch the app permission usage screen.
Bug: 63532550
Test: Launched the new screen with this intent.
Change-Id: I0b690b742ad4e89fcbd6e613675f5e08ed3dc644
2018-10-29 08:41:56 -07:00
Hai Zhang
b777668584 Add RoleManager into the system.
A role is a unique name within the system associated with certain
privileges. There can be multiple applications qualifying for a role,
but only a subset of them can become role holders. To qualify for a
role, an application must meet certain requirements, including
defining certain components in its manifest. Then the application will
need user consent to become the role holder.

Upon becoming a role holder, the application may be granted certain
privileges that are role specific. When an application loses its role,
these privileges will also be revoked.

Bug: 110557011
Test: build
Change-Id: Icd453a3b032857a8fd157048de8b9609f04e28b8
2018-10-27 11:14:32 -07:00
Jeff Sharkey
5f97b7ee27 Merge "Magic to keep "_data" paths working." 2018-10-26 19:31:08 +00:00
Sudheer Shanka
041d55c1e0 Merge "Update StorageManagerService handling of packages info." 2018-10-26 17:29:24 +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
Nicolas Geoffray
7fa407f752 Merge "Attach SharedLibraryInfo to a Package." 2018-10-26 12:56:01 +00: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
Steven Moreland
748f697207 Merge "pm: Disallow HIDL libs from boot jars >= Q." am: 06182b0764 am: 7430f3e6fd
am: 71ac2676b6

Change-Id: I4daf19b65d9b3e24c196e6ede697935b5c5460a3
2018-10-25 16:51:48 -07:00
Makoto Onuki
25c782f9f2 Merge "DB Wipe detection" 2018-10-25 17:40:43 +00:00
Steven Moreland
71ac2676b6 Merge "pm: Disallow HIDL libs from boot jars >= Q." am: 06182b0764
am: 7430f3e6fd

Change-Id: I0f2fa1c1571283d247fb6ac344b0dc5b6085d3aa
2018-10-24 14:44:14 -07:00
Makoto Onuki
ee93ad28ff DB Wipe detection
- Create a check file for each database in order to detect
1) an unexpected DB file removal
2) DB wipe caused by a DB corruption.

- Either case, do a WTF to collect information on APR.

- Also print file timestamps in "dumpsys dbinfo". Example:

=====================
Database files in /data/system:
  locksettings.db                            20480b ctime=2018-10-23T22:48:35Z mtime=2018-10-23T22:48:35Z atime=2018-10-23T18:54:12Z
  locksettings.db-wipecheck                      0b ctime=2018-10-23T18:54:12Z mtime=2018-10-23T18:54:12Z atime=2018-10-23T18:54:12Z
  notification_log.db                        45056b ctime=2018-10-23T22:48:08Z mtime=2018-10-23T22:48:08Z atime=2018-10-23T18:54:13Z
    :
=====================

Change-Id: I77fbeb0bb635c787aba797412f116475fecbe41c
Fixes: 117886381
Test: manual test

Test 1: corruption
1. Stop CP2 process (adb shell killall android.process.acore)
2. shell 'echo abc > /data/user/0/com.android.providers.contacts/databases/contacts2.db'
3. Launch the contacts app.

Test 2: Unexpected file removal
1. Stop CP2 process (adb shell killall android.process.acore)
2. shell 'rm -f /data/user/0/com.android.providers.contacts/databases/contacts2.db'
3. Launch the contacts app.

In both cases, logcat shows a client side stacktrace and also a WTF. (am_wtf)
2018-10-24 08:34:04 -07:00
Joel Galenson
095513c4d9 Merge "Add a new Intent for seeing permission usages" 2018-10-23 16:35:47 +00:00
Nicolas Geoffray
abcd58e4a2 Attach SharedLibraryInfo to a Package.
bug: 112405321
Test: boots, PackageParserTest
Change-Id: Ib218dac8f554505188990436cae4147666f3aece
2018-10-23 14:14:30 +01:00
Ng Zhi An
150a6bac3b Add new queue to offload slow broadcasts
Process BOOT_COMPLETED on this new queue

Change-Id: I14e7e7cc42f02b38a9becb47f7913684f55979fa
Test: boot device, dumpsys activity broadcasts
Bug: 111368744
2018-10-22 12:36:47 -07:00
Treehugger Robot
06182b0764 Merge "pm: Disallow HIDL libs from boot jars >= Q." 2018-10-22 07:08:10 +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
Joel Galenson
13096ea738 Add a new Intent for seeing permission usages
This intent is used by the Permissions Hub.

We also give PermissionController the GET_APP_OPS_STATS permission.

Bug: 63532550
Test: Used the Permissions Hub.
Change-Id: If1254f67c12fc5052d6ad5ff8260778a7c59dccc
2018-10-19 10:56:21 -07:00
Jeff Sharkey
4e5efa3186 Convenience method for obtaining thumbnails.
Obtaining a thumbnail for a Uri requires opening it with the slightly
obscure openTypedAssetFileDescriptor(), passing in "image/*" with the
right Bundle of EXTRA_SIZE to hint the target area on screen, and
defensively scaling any returned results.

This is pretty tedious to get right, so offer a convenience method
that does all this for the developer.  Internally uses ImageDecoder
to follow best-practices, and replaces older getDocumentThumbnail()
implementation by delegating to this one.

A future CL will teach ImageDecoder about how to read any embedded
EXIF thumbnails, including any required rotation.

Bug: 111268862
Test: atest FrameworksCoreTests:android.content.ContentResolverTest
Change-Id: I5c9c09ddf9b480f3b5c6ade0a078cccb68de2f2b
2018-10-18 14:32:51 -06:00
Steven Moreland
ae88825916 pm: Disallow HIDL libs from boot jars >= Q.
These two libraries:
android.hidl.base-V1.0-java
android.hidl.manager-V1.0-java

were removed from BOOT_JARS. This change disallows them to be used on
the classpath >= Q. They are still allowed to be used <= P for legacy
reasons.

Test: atest android.content.pm.AndroidHidlUpdaterTest
Test: build & boot Pixel 2
Fixes: 77307025

Change-Id: I7752812318030cbaa15f42301c168371ceade901
2018-10-17 18:17:33 -07:00
TreeHugger Robot
38d0bd0634 Merge "Set EXTRA_USER instead of EXTRA_USER_ID for ACTION_SHOW_ADMIN_SUPPORT_DETAILS" 2018-10-17 00:26:37 +00:00
TreeHugger Robot
e9944aa1dc Merge "Make loadSafeLabel a generic facility as makeSafeForPresentation" 2018-10-16 16:21:10 +00:00
TreeHugger Robot
02f2a315d7 Merge "Add Context.getDisplayId() to avoid possible IPC" 2018-10-16 00:20:52 +00:00
TreeHugger Robot
bc9ebba7e5 Merge "Suspending app can customize intercepting dialog" 2018-10-15 21:51:52 +00:00
Philip P. Moltmann
c1fda744f0 Make loadSafeLabel a generic facility as makeSafeForPresentation
Any app loading untrusted strings should make the strings face. Hence make
the method publicly available.

Test: atest CtsTextTestCases:MakeSafeForPresentationTest GtsContentTestCases:PackageItemInfoTests
Change-Id: Ib0679fe892181535339dac77583c427e0d64dd05
Fixes: 113856697
2018-10-15 09:11:52 -07:00
Ricky Wai
6763d1f3fe Merge "Return app hidden details activity in launcher api" 2018-10-15 04:21:59 +00:00
Yohei Yukawa
5281b6b4c0 Add Context.getDisplayId() to avoid possible IPC
ContextImpl has an internal rule that when ContextImpl#mDisplay is
null the Context is associated with the default display.  The problem
is that, as discussed in Bug 117709581, when ContextImpl#mDisplay is
null ContextImpl#getDisplay() tries to get some non-null Display
object by making an IPC to the system server, which is redundant when
the display ID is the only thing that the caller wants to know.

By having an @hide method Context.getDisplayId(), we can ensure that
display ID can be obtained without any IPC.  This enables us to
re-submit my CL [1] that aimed to instantiate InputMethodManager (IMM)
for each display but then got reverted due to a performance regression
(Bug 117434607).

There should be no developer-observable behavior change.

 [1]: I7242e765426353672823fcc8277f20ac361930d7
      c53d78e992

Fix: 117712745
Test: atest FrameworksCoreTests:android.content.ContextTest
Test: prebuilts/checkstyle/checkstyle.py -f \
      frameworks/base/core/tests/coretests/src/android/content/ContextTest.java
Change-Id: I2534530a5ce90e2620c5039d793a6454a0a1e154
2018-10-15 07:38:25 +08:00
Philip P. Moltmann
add325328b Merge "Make PermissionManager use lists" 2018-10-12 23:43:11 +00:00
Suprabh Shukla
389cb6f54a Suspending app can customize intercepting dialog
The suspending app has more context about why a particular app was
suspended by the user, but we do not want to delegate the interception
of the suspended activity out of the system.
Hence allowing it further customizations to the dialog to make
it clearer.

Test: atest com.android.server.pm.SuspendDialogInfoTest \
com.android.server.pm.SuspendPackagesTest \
com.android.server.pm.PackageUserStateTest \
com.android.server.pm.PackageManagerSettingsTests \
com.android.server.am.ActivityStartInterceptorTest

atest GtsSuspendAppsPermissionTestCases GtsSuspendAppsTestCases

Bug: 112486945
Bug: 113150060
Change-Id: If9f4d14587a2b75bb572e7984a90e300a2c72d16
2018-10-12 16:02:53 -07:00
TreeHugger Robot
a87f032c15 Merge "Implement launch bounds logic in Android (2/3)" 2018-10-12 20:08:40 +00:00
Chen Xu
2a670634e3 Merge "refactor data/voice roaming states" am: 6bd29ab2df am: 652ec06948
am: 6169b04385

Change-Id: I921e3dd8f4c82d83d1f12657813945fbcc2e21b2
2018-10-12 11:57:14 -07:00
Chen Xu
6169b04385 Merge "refactor data/voice roaming states" am: 6bd29ab2df
am: 652ec06948

Change-Id: I1f82195e5477401f3216db92bbdac388bbe16c7f
2018-10-12 11:32:19 -07:00
Chen Xu
652ec06948 Merge "refactor data/voice roaming states"
am: 6bd29ab2df

Change-Id: Iac8184fe2dfdb7ff4c3d93ecb7c0c9dd9a7a46a5
2018-10-12 11:20:18 -07:00
Chen Xu
6bd29ab2df Merge "refactor data/voice roaming states" 2018-10-12 18:02:17 +00:00
Garfield Tan
b5cc09fe4a Implement launch bounds logic in Android (2/3)
This CL implements the biggest chunk of launch bounds logic in Android
branch and combine ActivityLaunchParamsModifier logic into
TaskLaunchParamsModifier. It left some things to be implemented:
1) It didn't yet consider persisting/recovering data;
2) It didn't implement letterboxing/pillarboxing, but according to
offline chat this should be enforced after launch bounds policies by
system;
3) Immersive mode is not yet implemented, but that's more tied to
recovering previous immersive mode and we won't launch apps to immersive
mode directly in any case;
4) No last seen non-fullscreen bounds are set if display is fullscreen,
which could be useful when display windowing mode changes from
fullscreen to freeform at later time.

There are also some topics that for sure need future discussions, so I
left them out of this CL as well:
1) App controlled apps (not only bounds specified in ActivityOptions);
2) Metadata indicating that the app prefers tablet-like bounds for
freeform windows (i.e. w/o limiting window size to Nexus 5x screen
size);
3) Fixed maximized size, which indicates that the maximized size
shouldn't be changed due to display resolution or orientation changes;
4) What to do if app requests to launch an activity without any flag
that indicates a new task should be used, but with a preferred display
ID/bounds set to a different value than its current window;
5) Should insets be considered in launch bounds (AM side) or on WM side,
IIUC freeform windows don't need to consider insets, and fullscreen
windows are covered by WM.

Our policy also has special treatment for Chrome snapped windows
(side-by-side mode in our tablet), which may not make much sense in
Android.

Bug: 113252871
Test: go/wm-smoke. Try launching some freeform windows on secondary
displays.
atest FrameworksServicesTests:TaskLaunchParamsModifierTests
atest ActivityManagerManifestLayoutTests
Change-Id: I974031725015b6283f33b9076788e7ce45134690
2018-10-12 10:38:34 -07:00
Jeff Sharkey
83e5229ab7 Merge "Recover shady content:// paths." into pi-dev
am: 7402d7611c

Change-Id: I499e0086df06d77d1fce3afaa86bb19a136b1ca2
2018-10-11 21:22:04 -07:00
TreeHugger Robot
7402d7611c Merge "Recover shady content:// paths." into pi-dev 2018-10-12 03:59:38 +00:00
chen xu
0281169e6d refactor data/voice roaming states
1. migrate set/get roamingType from ServiceState to
NetworkRegState.set/get roamingType
2. migrate set/get roamingStateFromRegstate from ServiceState
to NetworkRegState.regState
3. new System API for neworkRegistration.isRoaming().

Bug: 116127096
Test: ServiceStateTest, ServiceStateProviderTest

Change-Id: Ib89744089c98713819c8d313240d629ddb77d0bf
2018-10-11 15:10:32 -07:00
Philip P. Moltmann
a3ba4d9861 Make PermissionManager use lists
... as requested per API review.

- Sets require iteration via iterators
- Sets are more expensive to construct
- The advantage of sets (faster .contains) is not used
- The system ensures uniqueness of the entires in the list

Test: Built
Bug: 116798569
Change-Id: I2c3b5c6801b78e0bf942073bde1e90299aee39f6
2018-10-11 08:16:16 -07:00
Ricky Wai
cf134ebfb7 Return app hidden details activity in launcher api
If a normal app does not have launcher icon, launcher api
will return app details activity instead, so user will
be noticed that the app is still installed.

Bug: 111348460

Test: Installed an app without launcher activity, an app icon is being
shown in launcher allapps, and it forwards user to app details page.

Change-Id: I9c17f5edfdefe19727145e7176d7e113286c997d
2018-10-11 14:19:04 +00:00
Scott Kennedy
4763647b27 Merge "Mark getInstallerPackageName @Nullable" am: c41a5d6bc0 am: cecccf6258
am: 61f76551f1

Change-Id: I416572b4d162f2dd98ddcec068fcd6e835b53e7a
2018-10-10 21:35:51 -07:00