Commit Graph

11883 Commits

Author SHA1 Message Date
nharold
b2749539c0 Merge changes from topic "ipsec-sync-with-pi"
* changes:
  Disable the AppOp Restriction for IpSec Tunnels
  Rework Exception Handling for IpSecManager
  Update IpSecManager to use InetAddress and prefixLen
  Add AppOps Checks for MANAGE_IPSEC_TUNNELS
  Add MANAGE_IPSEC_TUNNELS Permission
2018-06-08 17:07:11 +00:00
Nathan Harold
21208eeccc Add AppOps Checks for MANAGE_IPSEC_TUNNELS
Adds support for a new AppOp to permit services to
use IpSec tunnel mode. The IpSecService now needs
a context so change the service mode to a cached
service rather than a static service.

Bug: 66955045
Test: runtest frameworks-net
Merged-In: I17a4a286225b432c3e15ea1587d946189931b4f4
Change-Id: I17a4a286225b432c3e15ea1587d946189931b4f4
(cherry picked from commit 592dadbd43)
2018-06-07 18:42:52 -07:00
Chalard Jean
042be01f9e Opportunistic typo fix
Test: unneeded
Change-Id: I2f5636f3d7ea4b6e9d3e6feddfd0cb586d658813
2018-06-07 14:55:31 +09:00
Treehugger Robot
4517eacd5d Merge "Fix: ConnectivityManager is initialized with a wrong context" 2018-05-25 16:42:59 +00:00
Tetsutoki Shiozawa
f9f15fce9d Fix: ConnectivityManager is initialized with a wrong context
ActivityThread#setHttpProxy uses a system context to get
a ConnectivityManager instance. If it's not already cached, the
system service registry will cache this instance initialized
with the system context, and subsequent calls to get this service
will return the bad instance.
This patch uses the application context instead, unless it's
not available for some unlikely reason.

A possible symptom of this issue is to have Bluetooth tethering
failing with a security exception, because it's requested by
the "android" package without system uid.

Merged-In: Ib8815f010883cdb94fcad2cdfb237de39327b20a
Bug: 73572062
Change-Id: Id652c1625194dc73dcbf8dfcad4b4e2e6fbebf4e
2018-05-25 15:04:59 +00:00
Tyler Gunn
84dad9565f Require READ_CALL_LOG permission to see phone numbers in phone state.
Incoming and outgoing call phone numbers are visible in the phone state
broadcast and via the PhoneStateListener.  To enhance user privacy, change
to require the READ_CALL_LOG permission in order to receive the call
phone numbers.

This means to see phone numbers:
1. android.intent.action.PHONE_STATE - requires READ_PHONE_STATE and
READ_CALL_LOG permission.
2. PhoneStateListener#onCallStateChanged - now required READ_CALL_LOG
permission.

To support this new behavior, added sendBroadcastAsUserMultiplePermissions
method to context to allow sending the broadcast to all users while
requiring the two permissions.

Bug: 78650469
Test: Created PHONE_STATE broadcast receiver in test app and verified that
when no permissions are granted, the phone number is empty for incoming
and outgoing calls.
Test: Granted Phone state permission to test app and verified that phone
number is not populated.
Test: Granted test app read call log permission and verified that phone
number is populated.
Test: Created PhoneStateListener in test app and verified that when no
permissions are granted, phone number is empty for incoming and outgoing.
calls.
Test: Granted read call log permission to test app and verified that both
the incoming and outgoing numbers are populated.

Change-Id: I857ea00cc58a0abbb77960643f361dd6dd9c8b56
2018-05-18 14:37:43 -07:00
Treehugger Robot
46be1f15af Merge "Modify isShowing method in Dialog" 2018-04-04 18:39:38 +00:00
tiansiming [田思明]
ca1c4d2755 Modify isShowing method in Dialog
The method isShowing in Dialog.java is to judge whether
the dialog is currently showing, but it will return true
when the dialog is hidden.

Bug: 74416088
Test: modify testShow in DialogTest.java (see 639879)
run cts -m CtsAppTestCases -t android.app.cts.DialogTest#testShow

Change-Id: Ibf15e080678f414f8a66ff0841be17a2f9d2d652
Signed-off-by: tiansiming [田思明] <tiansiming@xiaomi.com>
2018-04-04 10:54:24 +08:00
Andreas Gampe
5a8ea8c619 Frameworks: Fix system server profiling
Avoid a race to close the profiling file descriptor.

Bug: 74883338
Test: m
Test: am profile start `pid system_server` /data/local/tmp/test.trace && sleep 5s && am profile stop `pid system_server` && adb pull /data/local/tmp/test.trace && [[ $(find test.trace -size +1K) ]] && echo Success
Change-Id: Ib506ce38ac1ac7c0b91079ba9b35aca6ae289d22
2018-03-14 23:19:21 -07:00
Remi NGUYEN VAN
489e8b02f8 Allow null subscriberId in NetworkStatsManager.
Use a MATCH_MOBILE_WILDCARD template to avoid filtering by
subscriberId when querying statistics from NetworkStatsService.

Bug: 74038898
Change-Id: I4b39e7031416cb33b23d89aa36ff0f774eaa942f
Fixes: 74038898
Test: runtest frameworks-net, CTS tests pass
2018-03-06 13:28:19 +09:00
Treehugger Robot
e7d04d728c Merge "Let sendShowMessage called from hide to show" 2018-02-24 01:27:13 +00:00
Treehugger Robot
b98102b4dc Merge changes from topic "cp_calin_framework_2017"
* changes:
  Allow public profile compilation for primary apks
  [framework] Pass .dm files to dexopt at install time
  Extend the ArtManager profiling API to cover boot image profiling
  [framework] Extend profile operations to take the profile name
  Accept UserHandle.USER_ALL during profile preparation
  [framework] Prepare profile for app code paths
  Perform a non strict matching of .dm files when computing the size
  Support installation of DexMetadata files (.dm)
  Rename snapshotProfile to createProfileSnapshot for consistency
  Implement ArtManager#snapshotProfile API
  Add SystemApis to expose runtime profile information
  Log SHA256 of secondary dex files during reconcile.
2018-02-15 16:17:06 +00:00
David Brazdil
10034d94cf Merge "Update hidden API toast message" 2018-02-15 11:55:15 +00:00
David Brazdil
5234d559b4 Update hidden API toast message
Change the toast message shown by an Activity when VMRuntime reports
that the app has used a private API.
(a) fix a typo: compatiblity -> compatibility
(b) change guidance from "please consult log" to "go to <url> for
    more info" where devs can learn how to proceed if their app does
    have compatibility issues.

Bug: 64382372
Test: make, visual
Change-Id: Idbe32a724438bb7b0826d0b4e11ef505015cb321
2018-02-15 09:09:55 +00:00
Calin Juravle
ea6c0ffb4a [framework] Extend profile operations to take the profile name
Extend the installd profile interface to take the profile name as
argument. This shifts the responsibility for choosing the names of
profiles for primary apks completely to PackageManager. Each of the
application code paths will get an unique profile name based on their
split name.

All the profile operations will now work on a specific profile name rather
than assuming a default global name.

Also, move dumpProfiles and clearProfiles functionality to the
ArtManagerService so that we can re-use profileName computations easier.

(cherry picked from commit 6ae39fc2e5)

Test: manual (dexopt apps, merge profiles, clear profiles)
      gts GtsAndroidRuntimeManagerHostTestCases
Bug: 30934496

Merged-In: Ie65d45eed7de0844edf4b7af918d7eaa74ec1f2c
Change-Id: Ie65d45eed7de0844edf4b7af918d7eaa74ec1f2c
2018-02-14 08:19:42 -08:00
Calin Juravle
1d875ad3ae Add SystemApis to expose runtime profile information
The API allows a system apps which acquired
{@code android.permission.READ_RUNTIME_PROFILE} to snapshot the runtime
profiles of installed packages.

The API is implemented in a new service class (AndroidRuntimeManager)
accessible from the context using
context().getPackageManager().getAndroidRuntimeManager().

The main functionality is exposed as a one way call into the
AndroidRuntimeManager with the result being posted on a callback. The
profile is available to the caller as a read-only ParcelFileDescriptor.

This CL only adds the API interfaces and validation. It does not fully
implement the functionality.

oneway void snapshotRuntimeProfile(in String packageName,
  in String codePath, in ISnapshotRuntimeProfileCallback callback)

(cherry picked from commit 45f8b29ce0)

Bug: 30934496
Test: gts-tradefed -m GtsAndroidRuntimeManagerHostTestCases

Merged-In: Iaa6be4715840f24508acba3162ea9c1ab725bd38
Change-Id: Iaa6be4715840f24508acba3162ea9c1ab725bd38
2018-02-14 08:00:56 -08:00
Holly Jiuyu Sun
052fbabc35 Public EuiccManager APIs.
Public EuiccManager and other related necessary files.
Mark EuiccCardManager and other related necessary files as @SystemApi.
Solve lint errors and warnings.

Bug: 35851809
Test: test on phone
Change-Id: I8a2c78804cae56b679d311d613edca5be4bc2522
Merged-In: I68853e134e1e31fa9b91a83af6c491a2a8cca971
2018-02-13 12:53:45 -08:00
tiansiming [田思明]
690b36903c Let sendShowMessage called from hide to show
Dialog's onShow callback is not called from hide to show.
Detailed information is written in the bug link.

Bug: 73147112
Test: Manual test with the demo

Change-Id: I1d32d9695c18a206b661a1bd7c0dba25dbfbf28b
Signed-off-by: tiansiming [田思明] <tiansiming@xiaomi.com>
2018-02-10 15:53:53 +08:00
David Brazdil
d960cc4a51 Show hidden API warning once per process
In order to not spam users with warning toasts, add a boolean flag
that guards the displaying of a warning message about hidden API
usage and is set after the first time a message is shown.

Bug: 64382372
Test: manual
Change-Id: If7ea995ddf4727a15eccf55dad42ef7775b1fc91
2018-01-31 08:03:29 +00:00
Treehugger Robot
1dfa830bb0 Merge "Add handover permission, fill in some missing API gaps." 2018-01-30 18:33:27 +00:00
David Brazdil
795cbfb1c1 Control hidden API toast with a system property
CL Id0a4200f912ac3303026cb26b6d8974c47332828 sets a system property
"ro.art.hiddenapi.warning" for non-release, non-user builds. This
patch reads that flag and unless the flag is set, will only ever show
the warning message if the app is debuggable.

Test: manual
Bug: 64382372
Change-Id: I9b552792779589a7a91818a82d5c86141fc0a30b
2018-01-29 10:22:54 +00:00
Tyler Gunn
858bfaf79c Add handover permission, fill in some missing API gaps.
Adding the ACCEPT_HANDOVER runtime permission which an app must have in
order to accept handovers (this is per design).

Adding missing onHandoverComplete method in the android.telecom.Connection
API (per design).

Finishing plumbing for android.telecom.Call#onHandoverComplete API.

Fix issue where the new handover API methods would never get called; the
legacy handover extra was being used in this case when it should not have
been.

Bug: 65415068
Test: Verified using new CTS tests
Change-Id: If1558f6a23911862c02ac5b18fb62d86911ed7e2
Merged-In: If1558f6a23911862c02ac5b18fb62d86911ed7e2
2018-01-25 16:20:03 -08:00
David Brazdil
fbef950d95 Merge "Show a warning toast/dialog when an app uses hidden APIs" 2018-01-25 19:53:13 +00:00
Andreas Gampe
5b495d54d3 ActivityManager: Add support for agents on startup
Add setAgentApp similar to setDebugApp. If given, attempt to attach the given
agent during handleBindApplication.

The flow needed a slight refactor. It is not possible to do a debuggability
check at setAgentApp time (without checking all installed apps). Instead,
when a ProfilerInfo contains an agent, perform a debuggability check then.
This is consistent with how setDebugApp works.

Expose through the shell command:

  cmd activity set-agent-app process agent

Add CTS coverage.

Bug: 69929492
Test: m
Test: m cts
Test: cts-tradefed run commandAndExit cts-dev -m CtsJvmtiAttachingHostTestCases
Change-Id: I65e869debd45e6073f9ab21cb9de9c9deb828a2e
2018-01-24 17:48:02 -08:00
David Brazdil
927d6de11f Show a warning toast/dialog when an app uses hidden APIs
Check VMRuntime.hasUsedHiddenApi() on each Activity start and show
a toast/dialog urging the user to check logcat.

Test: manual
Bug: 64382372
Change-Id: Ida8a6ed9ab9b56a76882501b2a3473a5f1448cb3
2018-01-24 19:57:18 +00:00
Lorenzo Colitti
d15c937f97 Support passing a template to NetworkStatsManager queries.
Currently, NetworkStatsManager queries and callbacks only allow
selecting network traffic based on network identifiers:
networkType, subscriptionId and networkId.  The code ends up
converting these into a template under the hood.

Now that templates can express more fine-grained queries (e.g.,
select only roaming traffic, or select only traffic that's not
on the default network) add a hidden method to pass in a
template. This should have no security implications, as all the
access controls are performed in NetworkStatsService.

Bug: 35142602
Test: android.app.usage.cts.NetworkUsageStatsTest passes
Change-Id: Iab4afa26b34544299d2a9c501c1b0feb470e90a9
Merged-In: Iab4afa26b34544299d2a9c501c1b0feb470e90a9
2018-01-23 18:38:48 +09:00
Lorenzo Colitti
d5876bc438 Add getDefaultNetwork to the NetworkStats public API.
This allows an app using the public API to know whether the
traffic in a particular bucket was on the default network
(i.e., the network was selected by the system), or not (i.e.,
the network was selected by the app).

Bug: 35142602
Test: builds, boots
Test: added coverage to NetworkUsageStatsTest CTS test, still passes
Change-Id: I9f6669908fa119743b9c0aa0c31a03e5ebafa7db
Merged-In: I9f6669908fa119743b9c0aa0c31a03e5ebafa7db
2018-01-23 18:28:07 +09:00
Andreas Gampe
ab8a63be6a ActivityThread: Attempt to attach agent with app's classloader
Try to use the app's (main) classloader when an attach-agent request
is handled. If that fails, retry without a classloader.

Add bind-application-time flag to ProfilerInfo. Use the flag to have
a second attach-agent point on app startup. Add --attach-agent-bind
to cmd activity start to expose the difference between pre-bind and
bind-time attaching.

Bug: 70901841
Test: m
Test: cts-tradefed run commandAndExit cts-dev -m CtsJvmtiAttachingHostTestCases
Change-Id: I21698ec3be43a6d095d577100b2adfb22daca7d5
2018-01-15 13:04:25 -08:00
Jeff Hamilton
caf728ea26 Minor LoadedApk refactoring.
- Rename varaibles holding LoadedApk to make the code easier to read.
- Move resource creation into LoadedApk, consolidating the logic.

(cherry picked from commit 7541ca4d1a)

Test: manual
Merged-In: I6bdc70482fbbb346ff694ada528ded18d3a63ef7
Change-Id: I6bdc70482fbbb346ff694ada528ded18d3a63ef7
2018-01-12 11:05:50 -08:00
Treehugger Robot
5edae415b0 Merge "Frameworks: Move SharedPreferencesImpl to tristate" 2018-01-11 23:52:46 +00:00
Jerry Zhang
68ad3d119c Merge "DO NOT MERGE: Add ScreenObserver" 2018-01-11 23:50:34 +00:00
Jerry Zhang
1b4b3c4e9b DO NOT MERGE: Add ScreenObserver
ScreenObserver allows system components to
monitor the screen lock state.

Bug: 68054513
Test: manual
Change-Id: I50f4690f68443f676d17e93efb1b7cb0857abd9e
2018-01-11 19:38:27 +00:00
Holly Jiuyu Sun
3d6b53c075 Add EuiccCardManager and EuiccCardController.
EuiccCardManager is in the same path with EuiccManager.
EuiccCardController is in the same path with EuiccController.
Use getAllProfiles() as an example interface.
The implementation of EuiccCard and its content will be added in a
follow up CL.
The new API is marked as @hide and TODO for @SystemApi.

Bug: 38206971
Test: test on phone
Change-Id: I153937c0f79bdd1a00b06b234a6e254a3f43072c
Merged-In: I153937c0f79bdd1a00b06b234a6e254a3f43072c
2018-01-11 10:30:43 -08:00
Andreas Gampe
1aa0d01cc8 Frameworks: Move SharedPreferencesImpl to tristate
The code loading shared preferences from disk may throw in other
ways then a missing file, for example during an out-of-memory
situation. Ensure that waiters will be woken up, and propagate
the exception to the getters.

Bug: 67986472
Test: m
Test: Device boots
Test: m cts && cts-tradefed run commandAndExit cts-dev --module CtsContentTestCases -c android.content.cts.SharedPreferencesTest
Change-Id: I56e47342111f1cb53c5817c0429af4a6787475a9
2018-01-05 18:02:30 -08:00
Andreas Gampe
158bde462e Revert "Frameworks: Move SharedPreferencesImpl to Future"
This reverts commit 70b600d456.

In preparation for a different fix. There are too many loopholes
with updates vs commits.

Bug: 67986472
Bug: 71533447
Test: m
Test: Device boots
Test: m cts && cts-tradefed run commandAndExit cts-dev --module CtsContentTestCases -c android.content.cts.SharedPreferencesTest
Change-Id: I872a81ae1a26e1f77aad2a52daf88e093a686ec6
2018-01-03 17:58:44 -08:00
Andreas Gampe
383f4f397b Revert "Frameworks: Silently ignore InterruptedException"
This reverts commit c8d5fc8572.

In preparation for different fix.

Bug: 67986472
Bug: 70122540
Bug: 71533447
Test: m
Test: Device boots
Test: m cts && cts-tradefed run commandAndExit cts-dev --module CtsContentTestCases -c android.content.cts.SharedPreferencesTest
Change-Id: I0b9e72d271725e15c20b68de981303c96ac1bd2a
2018-01-03 17:58:39 -08:00
Treehugger Robot
29f61c21f4 Merge "Fixed create app shortcut text and icon alignment in RTL Language" 2017-12-15 21:58:07 +00:00
susanta.patra
63c4f3318c Fixed create app shortcut text and icon alignment in RTL Language
The icon and text alignment was inconsistent in create app shortcut.

Test: 1. RTL language
      2. adb shell am start -n com.android.settings/com.android.settings.CreateShortcut
      3. Check the alignment
Bug: 70201173

Change-Id: Ib2be99fd6b5da5853acf34ade8e3b407164383aa
Signed-off-by: susanta.patra <susanta.patra@lge.com>
2017-12-05 15:44:26 +05:30
Andreas Gampe
a6c6c4f5d3 Merge "Frameworks: Silently ignore InterruptedException"
am: 7e717e09cd

Change-Id: I75da071918e7fc2e547df4e4d75121806c730ca2
2017-12-05 02:34:41 +00:00
Andreas Gampe
c8d5fc8572 Frameworks: Silently ignore InterruptedException
Apps seem to rely on this undocumented behavior so that the
threaded sync adapter doesn't crash an app. That's really
bad on the app side, but we will have to live with it.

Bug: 67986472
Bug: 70122540
Test: m
Test: Device boots
Test: m cts && cts-tradefed run commandAndExit cts-dev --module CtsContentTestCases -c android.content.cts.SharedPreferencesTest
Change-Id: I1ee4dfba4ad29c4f66fa60d3c8f8a99900b3447a
2017-12-04 15:00:24 -08:00
Andreas Gampe
bd4b1bad48 Merge "Frameworks: Move SharedPreferencesImpl to Future"
am: aa3e9d351e

Change-Id: I2a47400d1e584aef1a16e05840ab964ca5735110
2017-12-02 23:45:54 +00:00
Andreas Gampe
70da38960c Merge "Frameworks: Clean up SharedPreferencesImpl"
am: 572f46a3ef

Change-Id: I7b922f795283cefabf661e999e5a9897889fa287
2017-11-29 19:25:13 +00:00
Andreas Gampe
70b600d456 Frameworks: Move SharedPreferencesImpl to Future
The asynchronous loading code is not safe wrt/ exceptions. Instead
of adding a tri-state for loading, move the code to use a Future
for the map. This encapsulates the required wait & synchronization,
as well as propagating any exceptions.

Bug: 67986472
Test: m
Test: Device boots
Test: m cts && cts-tradefed run commandAndExit cts-dev --module CtsContentTestCases -c android.content.cts.SharedPreferencesTest
Change-Id: I6616e8a05e64eb1cfe024cc3239a05847dfe1fab
2017-11-21 15:59:02 -08:00
Andreas Gampe
f78a51759b Frameworks: Clean up SharedPreferencesImpl
Clean up in preparation for an implementation change. Add missing
annotations. Rename inner lock to be uniquely named. Use the local
map instead of mMap in the commit logic.

Test: m
Test: m cts && cts-tradefed run commandAndExit cts-dev --module CtsContentTestCases -c android.content.cts.SharedPreferencesTest
Change-Id: Id3a798732c83a4aa6487225e2375ade4985852e2
2017-11-21 15:34:05 -08:00
Philip P. Moltmann
7e37d48b0a Make SharedPreferences check with higher precision
When two processes modify shared preferences we use the timestamp to
figure out if the file was changes underneath. Do this with the highest
precision available (instead of sec) as before.

It would be possible to make the check more reliable by writing a unique
id to the shared pref file, but this would make this check much more
expensive in the common case that nothing changed. Considering that this
has not been a problem and we don't officially give any guarantee for
this sounds like a good middle-ground.

(cherry picked from commit ffe74357ae)

Merged-In: I04c96b6a946618d5599c26410c88d7cd654d31fb
Change-Id: I04c96b6a946618d5599c26410c88d7cd654d31fb
Test: SharedPreferencesTest
Fixes: 62949739
2017-11-20 10:01:08 -08:00
Ahmad Melegy
8c7c6e3952 Merge "Fix typo"
am: 913f396c11

Change-Id: I244ccafe5bf76718cdc48b2fa7d9ce8270b0dd33
2017-11-17 18:55:53 +00:00
Ahmad Melegy
e2bfbf1348 Fix typo
Fix typo in Activity class in requestPermissions method

Test: Existing unit tests still pass.
Bugs: None

Change-Id: If81117a0e769bca2f303e1ebce57ecda9544e129
Signed-off-by: Ahmad Melegy <ahmad.melegy@gmail.com>
2017-11-14 21:51:40 +00:00
Xin Li
220871a697 Merge commit '98e12851336b7db16e583f9afac63ecc97465980' from
oc-mr1-dev-plus-aosp-without-vendor into stage-aosp-master.

Change-Id: Ia7b8da4a00d215160e4a4fa40f6044208d1297b7
Merged-In: I19846d2a3ee27aecbae2367a74ee49082eea154d
2017-11-14 12:31:11 -08:00
Tianran Li
2973f63816 Merge "TimePickerDialog OTG keyboard entry discarded"
am: 8c2cb6ff08

Change-Id: Ib28468e637c146e69d59ee352b5a019654b3dc14
2017-11-14 19:47:34 +00:00
Treehugger Robot
8c2cb6ff08 Merge "TimePickerDialog OTG keyboard entry discarded" 2017-11-14 19:35:20 +00:00