18745 Commits

Author SHA1 Message Date
Svetoslav Ganov
f9e2ad0b3c Add Bluetooth toggle prompts - framework
If permission review is enabled toggling bluetoth on or off
results in a user prompt to collect consent. This applies
only to legacy apps, i.e. ones that don't support runtime
permissions as they target SDK 22.

Also added a configuration resource which controls whether
permission review mode is enabled. By default it is not and
an OEM can change this via an overlay. For now we also keep
the old mechanism to toggle review mode via a build property
which is still used and will be removed when clients have
transitioned.

bug:28715749

Change-Id: I94c5828ad6c8aa6b363622a26ff9da4fc2e2fac7
(cherry picked from commit ac69be543f89ea6e9a27204492e0a170d9b3450e)
2016-10-27 22:49:11 +00:00
Leonard Mosescu
1ab879be90 Adding "attach-agent" to ActivityManagerShellCommand
This new command is used to attach runtime agents to a running application:

attach-agent <PROCESS> <FILE>
   Attach an agent to the specified <PROCESS>,
   which may be either a process name or a PID.

Test: m test-art-host, manual testing:
    . invalid syntax, missing arguments
    . invalid syntax, extra arguments
    . invalid numeric PID
    . invalid process name
    . valid process, not debuggable
    . valid process, missing agent
    . valid process, valid agent

Bug: 31682382

Change-Id: Ife88dbf23991dde7945d9208e54cd014bb7ecdc6

Merged-In: Ife88dbf23991dde7945d9208e54cd014bb7ecdc6
2016-10-27 17:03:57 +00:00
Michal Karpinski
265494a0f8 Add connect event reporting
Adds reporting of connect events including netId, destination IP address,
destination port, uid and connect latency.
Currently ignores the new data it receives, further work will be
done in the subsequent CLs.

Test: for now just the benchmarking, in the future CTS

Bug: 29748723

(cherry picked from commit 965894eeb90c13255b5559b925d13fd22528f8cb)

Change-Id: I0c563f26ac39a7e1870153f30d073fc7d0006abc
2016-10-27 18:23:21 +09:00
Michal Karpinski
f82d1596ce Extending DNS event reporting
This adds hostname, array of addresses, total count of IP addresses
and uid to the existing pipeline.
Currently ignores the new data it receives, further work will be
done in the subsequent CLs.

Test: for now just the benchmarking, in the future unit and CTS

(cherry picked from commit 14c9d2d0df7fab2b0470c3c404f600d87d4f0f93)

Bug: 29748723
Change-Id: Ice7db208282934e74f0e1808ffbae96d476c4216
2016-10-27 18:23:16 +09:00
Treehugger Robot
836ffa6e1c Merge "Add unit tests for Tethering.isTetherProvisioningRequired" 2016-10-25 18:12:42 +00:00
Christopher Wiley
497c147b82 Add unit tests for Tethering.isTetherProvisioningRequired
Check that we tolerate various dependencies not being available.

Bug: 31946071
Test: These are tests

Change-Id: Ic0a9cd6f255ba9ff4c774dee640df1a0bdf8dc39
2016-10-24 17:07:05 -07:00
Treehugger Robot
f741f88284 Merge "Avoid NPE around mReusedTask of ActivityStarter" 2016-10-24 14:09:35 +00:00
Shigeki Yokomichi
0bd28e2c5f Avoid NPE around mReusedTask of ActivityStarter
Symptom:
System crash by NPE is observed on ActivityStarter
during phone boot-up.

Detail and sample:
ActivityStarter has possibility to be called itself recursively
by calling TaskRecord$performClearTaskLocked().
Then class variable of mReusedTask is initialized to null
after the call, because the recursive call isn't guarded by
synchronized block.
Then NPE crash occurs on next statement.

Solutions:
Avoid to use the class variable on null possibility statement.

Bug: 32361138

Change-Id: Iaea3e066a6f7134fcae4338ff864bb236241194c
2016-10-24 13:30:49 +09:00
Treehugger Robot
8be2850546 Merge "Create the WebViewZygote and implement WebViewZygoteInit." 2016-10-22 03:03:10 +00:00
liulvping
d01db540a7 fix mistaken check of mScreenBrightnessDarkConfig
Change-Id: Ibd1234a5a69422f3124e72cd561d4f3624a82faf
Signed-off-by: liulvping <liulvping@xiaomi.com>
2016-10-21 01:59:02 +00:00
yangzhenyu
d509bc93e6 [ActivityManager] Fix the inconsistence between ProcessRecord and BroadcastQueues
Symptom:
Even though one process is executing one BroadcastReceiver,
it may be killed as one EMPTY process occasionally

Detail and sample:
https://code.google.com/p/android/issues/detail?id=221524

Root cause:
app.curReceiver can only remember the last running.
If an application is both receiving FG and BG broadcast,
when one is finished, app.curReceiver becomes null,
the state of application becomes EMPTY.

Solution:
save all running receivers at ProcessRecord

Change-Id: I01b8813af652a8c434be7de0678dc06f99831ae0
Signed-off-by: yangzhenyu <yangzhenyu@xiaomi.com>
2016-10-17 13:58:17 +08:00
Selim Cinek
4df8d64dab DO NOT MERGE - Fixed an issue where the emergency affordance would show
If a device isn't voice capable, it shouldn't show the emergency
option.

Test: use tablet which isn't voice capable, insert indian sim and
make sure no emergency option is displayed in global actions.
Bug: 31953703
Change-Id: I351e87320f3ffec76d1c1fc5aac78e5c48c0ac54
2016-10-12 23:20:30 +00:00
Rebecca Silberstein
87e8014117 Tethering: check if configManager is null
cherry-picked from b07f1409045091476e5296f9b0dd41c8712fe49a

Before attempting to retrieve a carrier entitlement setting, first make
sure we have a carrier config manager and if we do have a carrier config
manager, the config it holds is not null.

Bug: 31929638
Test: unittests coming in follow on CL
Change-Id: Iee476c476cb3de109cdccbd955b7fb986dd4267b
2016-10-11 16:46:55 -07:00
Treehugger Robot
a0322d5c5a Merge "DO NOT MERGE - Added Emergency affordance feature" 2016-10-10 20:41:14 +00:00
Selim Cinek
e0c3c660a7 DO NOT MERGE - Added Emergency affordance feature
Added a service that listens whether emergency affordances
are necessary.

If the they are needed, it adds an option to the
global actions dialog that directly launches the
emergency call and also adds a long-press listener
to the keyguard emergency button.

Test: adb shell settings put global force_emergency_affordance 1 && adb shell settings put global emergency_affordance_number 111112
Bug: 30404490
Change-Id: Ib96a15da2ef4b568a8d77140ebca6aa6f20f5ddb
2016-10-10 18:58:23 +00:00
lei.peng
75685f7437 Modify the case in adjustFocus when the mFocusedActivity is null
Starting activity failed and the mFocusedActvity become null,
consider this condition when adjust focus.

Because in this condition, the focus mismatch between
ActivityManagerService#mFocusedActivity and
InputDispatcher(inputfilnger)#mFocusedApplication, ANR may occur.

Test: monkey test 48h with no ANR

Change-Id: Id1a2bf0d6ca6530e34443d359fbe2aa6c11b878c
2016-10-09 10:35:20 +08:00
Robert Sesek
ded2098436 Create the WebViewZygote and implement WebViewZygoteInit.
This adds a new init-spawned daemon, webview_zygote, that starts a JVM and
acts as a zygote process for WebView isolated_app services.

Test: m
Test: angler boots
Test: Turn on Settings>Developer>Multiprocess Webview. webview_zygote32 or
      webview_zygote64 start (requires dependent CLs).

Bug: 21643067
Change-Id: Ida98bd04b4d77736b672b03af651c4eb97ce88c1
2016-10-07 12:38:04 -04:00
Qiushi Han
32fed96632 Fix window animation flash issue
The original logic cuts down the mShownPosition, causing 1 pixel offset,
sometimes this will cause flash.

To fix this, Use Math.round() instead.

google issue:
https://code.google.com/p/android/issues/detail?id=224185

Change-Id: I8a2fe55a2df6eaa9eda4ba78966a74ea492ab8ea
2016-10-01 17:32:28 +08:00
Tao Bao
42d25b5992 Merge "Handle the race condition when calling uncrypt services." 2016-09-30 20:30:43 +00:00
Tao Bao
794c8b0b3f Handle the race condition when calling uncrypt services.
We call uncrypt services to setup / clear bootloader control block (BCB)
for scheduling tasks under recovery (applying OTAs, performing FDR).
However, we cannot start multiple requests simultaneously. Because they
all use the same socket (/dev/socket/uncrypt) for communication and init
deletes the socket on service exits.

This CL fixes the issue by a) adding synchronized blocks for the service
requests; b) checking the availability of the socket before initiating a
new one.

Note that adding synchronized blocks to RecoverySystem doesn't help,
because the calls could be made from different processes (e.g. priv-app,
system_server).

Bug: 31526152
Test: FDR works while a priv-app keeps calling clear BCB.

Change-Id: I95308989e849a9c98a9503ac509f2bc51ed3de19
2016-09-29 16:07:19 -07:00
Treehugger Robot
00b678dd2d Merge "Clear pending activity launches when force stop package" 2016-09-29 19:17:36 +00:00
liulvping
b55e42df97 Clear pending activity launches when force stop package
https://code.google.com/p/android/issues/detail?id=223731

It is possible that an activity in pending launches be resumed while
it's package was stopped by some other reason, like uninstall pkg.

Merged-In: I130ded89cee162aa59ac2bf330f026e49e16ef69
Change-Id: I130ded89cee162aa59ac2bf330f026e49e16ef69
Signed-off-by: liulvping <liulvping@xiaomi.com>
2016-09-29 16:42:16 +00:00
Treehugger Robot
b60951f670 Merge "Reset mCurrentUserId when fingerprintd died" 2016-09-29 05:00:42 +00:00
Treehugger Robot
0ac1aa8256 Merge changes from topic 'cherry_ota_dexopt'
* changes:
  OtaDexopt: Fix after-ota space measure
  OtaDexoptService: Add tron logging
  OtaDexopt: Downgrade apps when low on space
  Installer: Support delete_odex command
  Package Manager: Sort list of packages to dexopt
2016-09-29 00:00:49 +00:00
Andreas Gampe
13018f3730 OtaDexopt: Fix after-ota space measure
Actually measure the available space.

Bug: 31458900
Change-Id: I16ecee6c275229bc21e908b88b24152484025bc8
(cherry picked from commit 8d1d2ab5b94f011ed611259df387391f1a1fe60f)
2016-09-28 15:01:06 -07:00
Andreas Gampe
112e01480f OtaDexoptService: Add tron logging
Log key properties of A/B OTA dexopting.

Bug: 31458900
Change-Id: Iba1e5a40ff8b4998d4d876800ee59940f01afb6e
(cherry picked from commit 77cc8172d31fff398b81a039b3fddc8acd1c609b)
2016-09-28 14:54:14 -07:00
Andreas Gampe
1920d7b434 OtaDexopt: Downgrade apps when low on space
When running low on space, attempt to "downgrade" apps to lower
states in the optimization flow to free up space before starting
the OTA.

Bug: 31347757
Change-Id: I3a44b106b83d86d7290f4c557267b319f28de12a
(cherry picked from commit dab38e000436bf8234955b0333eaecf389e65b6f)
2016-09-28 14:11:08 -07:00
Andreas Gampe
33c592da0c Installer: Support delete_odex command
Add support for deleting odex files.

Bug: 31347757
Change-Id: I29bca8751bcee8d6981c682fbbc816c73b78ac68
(cherry picked from commit e5fedb95761fbffbd80200440f32e99e0d8c6f90)
2016-09-28 14:00:20 -07:00
Andreas Gampe
71ea678683 Package Manager: Sort list of packages to dexopt
Sort the list by last-use-time, if available. Interleave the
dependencies with the packages.

Clean up the code a bit for better code reuse and ease of writing
filters.

This should help with prioritization under space constraints.

Bug: 31347757
Change-Id: Ia0ec62faf013a379dc4c80b18fd6b2bfbfa470c4
(cherry picked from commit d3e07d46d41e8411def67c2150a0bae064e900dc)
2016-09-28 13:59:03 -07:00
Treehugger Robot
c1973ecbd2 Merge "Log the error when uncrypt timeouts" 2016-09-28 19:42:29 +00:00
Treehugger Robot
ae302cef52 Merge "fix persistent process is killed and restart again and again" 2016-09-28 16:20:56 +00:00
Tianjie Xu
036d08638e Log the error when uncrypt timeouts
Log the error code to uncrypt_status if uncrypt gets killed because
of timeout.

Test: We log the error code correctly in uncrypt_status when uncrypt timeouts.
Bug: 31603820
Change-Id: Ia623c333714295e68f4269257fbb4297a867e42b
2016-09-27 13:34:58 -07:00
Treehugger Robot
7fd48d54de Merge "Implement untetherAll as calls to stopTethering" 2016-09-27 13:18:53 +00:00
Treehugger Robot
4062bec04e Merge "Notify NetworkPolicyManagerService on tethering changes" 2016-09-27 13:18:38 +00:00
takuya,souma
895da77aa6 Reset mCurrentUserId when fingerprintd died
A template fingerprint data is not loaded in fingerprintd when
fingerprintd is died and restarted.
FigerprintService tries to set userId after a restart of fingerprintd,
but it's skipped because the service tries to set same userId already
set to mCurrentUserId.

To load correct template fingerprint data, reset mCurrentUserId
when fingerprintd died.

Bug: 31734514
Change-Id: I0d3452fc6c1f82bb2a2af10f61d3f3a47df9dec6
2016-09-26 14:42:43 +09:00
Pavlin Radoslavov
74f60c0de8 Removed MESSAGE_BIND_PROFILE_SERVICE messages on unbind
Add a missing call to remove all MESSAGE_BIND_PROFILE_SERVICE
message when unbinding and finishing.

Bug: 31442739
Test: manual, and "frameworks/base/core/tests/bluetoothtests" unit tests
Change-Id: I7e9a8f79a38d4eb8ab8b53be04650226fc72732e
2016-09-22 20:05:22 +00:00
liulvping
2527fa3067 Skip uninstalled package for getPackagesForUid()
If a package with sharedUserId had been setInstalled
with false, then the result of getPackagesForUid()
should not include it.

https://code.google.com/p/android/issues/detail?id=212255

Change-Id: I7b984051db34ecc2d0ef9518786d51100ab9ac79
Signed-off-by: liulvping <liulvping@xiaomi.com>
2016-09-22 16:53:21 +00:00
Treehugger Robot
1d5447d70b Merge "[ActivityManager] Reset killed flag at attachApplicationLocked" 2016-09-22 14:54:16 +00:00
yuanhuihui
dc94b2973f [ActivityManager] Reset killed flag at attachApplicationLocked
A restarted process will reuse original process record.
If only reset KilledByAm flag, not reset Killed flag.
When app process have been killed by AMS can skip  unnessary ANR,
but not catch lowmemorykiller in AppErrors.appNotResponding()

Change-Id: Ie4653edf4252797eaeefbf9a4a35ac00cfa857d8
Signed-off-by: yuanhuihui <yuanhuihui@xiaomi.com>
2016-09-22 18:17:16 +08:00
Greg Hackmann
59acc059a6 Merge changes Iaa153fca,I619e2d8a
* changes:
  AlarmManagerService: explain some timerfd_create() failures
  AlarmManagerService: remove legacy /dev/alarm support
2016-09-21 21:04:09 +00:00
Michal Karpinski
cc6b37d9e2 Rename the DnsEventListenerService to NetdEventListenerService
The service will be extended to include listening for connect events as well.

Test: this is just a renaming change

Bug: 29748723
Change-Id: I4e50e24d1bfb0b5ead4010cc7df3434d38b753d8
2016-09-21 16:17:26 +09:00
Christopher Wiley
5df6ed4a87 Implement untetherAll as calls to stopTethering
Calling untether() on an interface name leaves the system
in an inconsistent state, since this is an API for use by
network subsystems to start or stop the tethering of a prepared
downstream network interface.  The proper way to disable tethering
is to call stopTethering() with an appropriate technology.

untetherAll() is called in parts of the system UI to disable
all tethering on system state changes (e.g. on the enabling
of data saver).

Bug: 31405407
Test: Enabling data saver now correctly disables tethering
Change-Id: I8e5724a31e015721910a8d278e100daf697c34d7
2016-09-20 15:23:06 -07:00
Christopher Wiley
d73faf0760 Notify NetworkPolicyManagerService on tethering changes
No longer do this in ConnectivityService#tether/untether.
Instead, have Tethering do it when an interface is actually
tethered.

Bug: 31405407
Test: Toggling hotspot now disables data saver

Change-Id: I9910a2e488c30c92d45f817c8f5df0fac5510de6
2016-09-20 15:18:50 -07:00
Greg Hackmann
a0126e0857 AlarmManagerService: explain some timerfd_create() failures
When AlarmManagerService is broken, starting the framework fails in
weird and inconsistent ways.  So if we detect your kernel is missing the
required timerfd support, give up immediately and explain why.

Bug: 28357356

Test: manually break timerfd_create syscall, check adb logcat during boot
Change-Id: Iaa153fca38e9cd8e801f3e71c3e1ae2351907828
Signed-off-by: Greg Hackmann <ghackmann@google.com>
2016-09-20 14:33:28 -07:00
Greg Hackmann
d7151c06f1 AlarmManagerService: remove legacy /dev/alarm support
We've removed the Android alarm driver from our supported kernels.  It's
time to remove the userspace callers too: they make the native side of
AlarmManagerService more complex, and send the wrong signal about
/dev/alarm still being supported.

Bug: 28357356

Test: cts-tradefed run singleCommand cts -d -c android.app.cts.AlarmManagerTest
Change-Id: I619e2d8a98e4c4728131a2d826b1295f858abedd
Signed-off-by: Greg Hackmann <ghackmann@google.com>
2016-09-20 10:35:40 -07:00
Christopher Wiley
ce5d913387 Allow WiFi components to manage interface up state
Setting the WiFi network interface up or down is racy because it
is not synchronized with the WiFi components managing the interface.

This causes a problem for hostapd when the interface is marked down
before hostapd starts because it causes the driver to enter the
de-initialization process.  hostapd does not know how to react to this
change of events.

Bug: 31205821
Test: bug no longer reproduces on upcoming devices, unit tests pass

Change-Id: I96938e2aef89b400593d42ce1b0a6ccc2d2e5754
2016-09-19 14:12:38 -07:00
Mark Lu
41d65f28c2 [AM] Skip unnessary ANR when process already died.
When app process been killed by AMS or lowmemkiller just before ANR report,
because process record info has been cleared after received death recipient,
it also cannot dump trace log because process already dead,
so report ANR & show ANR UI to let user wait seems is unnecessary.
(compare normal ANR case, if kill app process by command,
ANR dialog will also dismissed, it seems reasonable.)

To check above condition, if ANR process record killed set as true,
it means process already dead & can skip report this ANR.

Change-Id: I483cb02bacb10c32db80ca1097310b02abbac24d
2016-09-17 00:28:20 +08:00
Elliott Hughes
f0c606eb3e Stop including libcore/include/ in most of frameworks/base.
frameworks/base/core/jni/android_text_StaticLayout.cpp does actually use
ScopedIcuLocale, so I've left that for now.

Change-Id: I6458cd133871281a747a9da2e304da10b445051a
2016-09-15 13:13:39 -07:00
Treehugger Robot
9d9cf5b383 Merge "Skip ANR for processes that have been killed" 2016-09-14 13:54:37 +00:00
Treehugger Robot
1bb0616c56 Merge "DO NOT MERGE. Listen to ACTION_UID_REMOVED only." 2016-09-12 21:07:40 +00:00