This patch refines the Apf IPv4 filter for interfaces with Apf
capabilities to drop packets when:
- the multicast lock is not held
- the packet is an IPv4 packet
- the packet is not a DHCP packet addressed to us
- the packet is L2 broadcast, or IPv4 multicast, or IPv4 broadcast
- caveat: subnet broadcast address is not checked.
This allows to drop IPv4 broadcast packets whose MAC destination
address is not the L2 broadcast address but the current address of the
interface. Such packets can be received on network that rewrite L2
addresses and can put significant pressure on battery by waking up the
phone unnecessarily.
Bug: 30231088
Change-Id: I8b1785fc5ceadaa1f2881765983e502135dcbc46
This patch improves the test coverage of ApfFilter for IPv4 broadcast and
multicast traffic.
Bug: 30231088
Change-Id: I2e1d5d5a7cbae17f3d5978a4cf5f10666b5c6104
- This CL does two things, firstly, it ensures that all first & last
active times are monotonically increasing and independent of the
current system time. This allows us to better keep track of which
tasks are historical and should be hidden, and which are not.
Secondly, this CL moves the tracking of the last visible active time
into the system (per user) where it can be adjusted along with the
task active times when they are loaded.
- Following this CL, all active times in the future will be adjusted on
boot such that old tasks are made relative to the current boot time.
It’s not important exactly what time they are, only that they are
adjusted along with the last visible task active time so that we
always keep track of what is visible.
Bug: 28908500
Change-Id: I4f789df3a6bd825517cf3a70e26fb60deff89d06
This patch adds a daily limit to the maximum number of notifications
shown when switching networks.
It also adds a rate limit to prevent rapid successive notifications in
flapping scenarios.
Bug: 31132499
Change-Id: Iccb6d0899646ea6df3cfad32a421922263e0eb85
NetworkPolicyManagerService (NPMS) used to depend on screen on/off
changes to determine if a foreground activity should have network
restrictions, but such check is now redundant since ActivityManager
already changes the proper UID state (like going from TOP to
TOP_SLEEPING) when the screen status is changed.
Removing such code decreases the NPMS lock contention when the screen is
turned on in about 3-5ms.
Change-Id: I2853443efedbf14961ae9a5b2e72689d4d1a646c
BUG: 30785671
(cherry picked from commit 88f40ad9a721ee30708be82f66fb58c64f1d36b5)
(cherry picked from commit f8dd7b4e8d548274c680644a2225951b97e94a4f)
Unregister AccountManagerInternal before creating a new instance of
AccountManagerService, otherwise it will cause:
java.lang.IllegalStateException: Overriding service registration
Also overrode MockPm.addOnPermissionsChangeListener to be a noop and
not throw an exception.
Bug: 31071079
Change-Id: I0d24232eba655a68bf3fb38d7aa9edb92d469cea
This reverts commit c34649411d053185b3572c4cd924e6f14295d8cd.
Dispatching accessibility events in their own thread is causing Chrome and gmail to crash. We've identified two issues: Chrome is allocating strings natively using references that aren't valid outside of their thread, and the text is being set to values that are changed in the UI thread.
I'm going to resolve these issues on master by making deep copies of the strings, but that change will have its own performance implications.
Since we were bit almost immediately by an unexpected result of this change, and I need to erode its benefit by making deep copies, I think it's a bad bet to push it into MR1.
Bug: 31042124
Change-Id: I6f5c225a9197036db43fd0ac6008447b22617525
Added RegisteredServicesCache.updateServices method which allows callers
to request an update to services for which package has been updated.
Added a call to updateServices in getAuthenticatorTypesInternal
Test: Manually tested update flow on test authenticator with an artificial
delay in broadcast handling
Bug: 30979262
Change-Id: I499b2ee0be53fed01201c56068d929b6d621a78e
There was a race condition, due to which, by the time
TaskPersister started writing the taskids to the file,
the user was stopped and its data from memory was unloaded,
resulting in a NullPointerException
Bug: 30944155
Change-Id: Iac3333b7744241c90a7769686983e3f16e6880c1
* Catch RuntimeException from restore, in case restoring from a
partner device with an incompatible file format.
* When a restore target app is already installed, and
- if it has allowBackup=true, we'll restore normally, so all
existing shortcuts will be replaced. (but manifest shortcuts
will be re-published anyway.) We log a warning on logcat.
- if it has allowBackup=false, we don't touch any of the
existing shortcuts.
Bug 31057974
Bug 30766177
Change-Id: Ic3f7e860e7ea0d086fc589d8cbed8c4cebdd4bc6
NetworkPolicyManagerService (NPMS) used to depend on screen on/off
changes to determine if a foreground activity should have network
restrictions, but such check is now redundant since ActivityManager
already changes the proper UID state (like going from TOP to
TOP_SLEEPING) when the screen status is changed.
Removing such code decreases the NPMS lock contention when the screen is
turned on in about 3-5ms.
Change-Id: I2853443efedbf14961ae9a5b2e72689d4d1a646c
BUG: 30785671
(cherry picked from commit 88f40ad9a721ee30708be82f66fb58c64f1d36b5)
Stop writing to disk every time the display goes off. Only write to
disk periodically.
Consequences
Previously, if the device rebooted after the screen duration was written
to disk, apps would appear more stale than they actually were.
Now apps will always look fresher, which is a better scenario.
Bug:30807864
Change-Id: Ia69a2e51fc9e397789215b449fae56fa3e29c74a
- isUserUnlocked check is still racy
We used a local copy of each user state in mUnlockedUsers, and updated
it in the service lifecycle events. However because
SystemService.onUnlockUser() is called on Handler, there was a brief
window between when the user was actually unlocked and the shortcut
manager thought the user was unlocked.
So now check with activity manager for the latest state too. We still
check with the local copy first, because we want to consider STOPPING
as "unlocked".
- Messenger loses all bitmap icons.
Because we delay-save the shortcuts.xml file, if the device shut down
before we save the XML file but after removing the bitmap files,
we'd lose the bitmaps.
(Apparently SystemService.onCleanupUser() may not be called even when
a device is cleanly shutting down.)
So don't remove bitmap files synchronously, ever, and instead after
saving the XML just run the dangling file cleanup.
Bug 30784267
Bug 30730471
Change-Id: Ie58656efba2dca2b00582e145613bc56266a091e
We were not calling setActiveAdmin before calling setDeviceOwner or
setProfileOwner in these tests. They were passing because the admins
were not being properly removed in the first place. The admin is
actually removed from the admin list inside onReceive of the receiver
passed in sendOrderedBroadcastForUser, which was not overridden to call
onReceive in DpmMockContext.
Bug: 30726135
Change-Id: I08cab5821228738196b229a8f885f7488aaafa34
Originally when I wrote backup & restore for ShortcutManager,
there was no manifest shortcuts, so there was no need to
handle preintalled apps specially.
However, now we have manifest shortcuts, which are published
when the user is unlocked, by the time restore happens preinstalled
apps may already have manifest shortcuts, which will be overwritten
by the restored shortcuts.
So we need to re-publish manifest shortcuts after restore.
Bug 30746028
Change-Id: I6afbae7790c9ed38483637f33c381ecb6f854677
- Don't use lastUpdateTime for system apps since it's not reliable.
- Scan downgraded apps too.
Bug 30708050
Bug 30734178
Change-Id: I98253f4c635466197548385275ab08c5e3a1a10b
- When the cached UID state says a UID is in the background,
check with AM and get the latest state, since the state
might just have been changed.
Bug 30640208
Change-Id: If448f6f21f290fa0fc13550d9c740f56aa8bfce0
Similarly to ApfTest, this patch changes ConnectivityServiceTest to use
a mock object instead of IpConnectivityLog so that running
ConnectivityServiceTest does not generate android.net.metrics events.
Bug: 30450301
Change-Id: Ibc0479f381f26e60baefbae15407c62aecbf6666
- More unit tests
- LauncherApps.startShortcut() now supports sourceBounds
(again)
- Updated the javadoc.
Bug 30218829
Change-Id: Iae208ffd4911d149246ccfd0c4380544c2aafffc
Also fix b/30230996.
TODO: Support the sourceBounds argument to LauncherApps.
startShortcut().
Bug 30218829
Bug 30230996
Change-Id: Ibb6c59d5b7c0a320c21d09436d016d0eac94644f