Implement user-scoped geolocation configuration / behavior.
The main changes:
1) For simplicity, configuration change listener is no longer passed the
latest config. It is left to the listener to request the latest config.
This removes some of the previous complexity that required a SparseArray
to track listeners by userId.
2) The Callback implementation is now responsible for listening for
configuration / user changes and invoking a listener (which will invoke
other listeners). This is to try to have one class know all the various
settings that affect auto time / geolocation detection behavior, which
has become more complicated with the user-scoped geolocation config. The
TimeZoneDetectorInternal has some listener methods added in preparation
for later steps.
3) The new "geolocation detection enabled" setting is added. This allows
users to selectively disable geolocation time zone detection
independently of the location toggle.
4) The TimeZoneConfiguration now carries the ID of the user it is for,
since it now contains user-specific state.
5) Internally, the TimeZoneConfiguration is replaced by the
ConfigurationInternal class, which includes all properties (not just
user visible settings) that influence time zone behavior on the device.
The ConfigurationInternal generates the TimeZoneCapabilities and
TimeZoneConfiguration.
6) In a change from the initial behavior, any previously received
geolocation suggestion is cleared if geolocation detection is turned
off (or the current user switches to one that has it turned off), and
suggestions received when geolocation detection is off are ignored.
This is trying to be careful to avoid caching the geolocation timezone
if the user has signalled they don't want their device to use it.
Test: atest services/tests/servicestests/src/com/android/server/timezonedetector
Test: atest core/tests/coretests/src/android/app/timezonedetector
Bug: 149014708
Change-Id: Ieac9f8f646e16edcb8b6ea6c8749e45761898ac1
1. Scope dowm synchronized block to mAdjustedDisplays put and get
2. Use SoftReference instead of WeakReference because
display's weak reference is cleared after getAdjustedDisplay
returned and the cache didn't take effects previously.
fixes: 162445376
Test: ResourcesManagerPerfTest
Before:
getDisplayMetrics_median: 3413
getDisplayMetrics_mean: 3439
getDisplayMetrics_min: 3364
getDisplayMetrics_standardDeviation: 107
After:
getDisplayMetrics_median: 3048
getDisplayMetrics_mean: 3096
getDisplayMetrics_min: 2999
getDisplayMetrics_standardDeviation: 134
Change-Id: I8a5c3ba960c8231aee78b0e7fb958bf6845d5bb5
When user dismiss pip, WindowOrganizerController#applyChanges would
first try to resize pinned task, this will cause the activity to do
ensureActivityConfiguration and which could trigger configuration
change or relaunch the client activity. However, the windowing mode was
not change yet, so the windowing mode change would be scheduled in
another configuration change to client. But since the windowing mode
is not public, client will treat there is difference so skip that
configuration. To ensure client receive windowing mode change, check it
before check configuration difference.
And in order to prevent the WindowState#reportResized send before
ActivityRelaunchItem send to client, skip resize if we already know
that activity is going to relaunch.
Bug: 165051679
Test: atest ActivityLifecyclePipTests ActivityLifecycleSplitScreenTests
ActivityLifecycleTopResumedStateTests PinnedStackTests SplitScreenTests
ActivityLifecycleKeyguardTests
Change-Id: I7b96bbcf1a71ff75751e14db44c03261862bc857
This change migrates the previous usages of
ResourcesManager#getResources() from using the display id of expected
resources to an override display ID which will override the display
properties from the parent token resources. This ensures that all
contexts derived from a display context keep the overrides for their
intended display.
This also changes the meaning of ResourcesKey#mOverrideConfiguration and
ResourcesKey#mDisplayId. Previously mDisplayId was used as both the
current display of the ResourcesKey and used to apply overrides
to mOverrideConfiguration. This made it unclear whether a particular key
should keep its display override when an activity changes display or
whether it should inherit the new display from the activity. Now the
display IDs and overrides are managed by the ActivityResources struct and the
ResourcesKey is expected to only contain the final display ID expected
for the resources in 'mDisplayId' and the final configuration that should
be applied to the global configuration in 'mOverrideConfiguration'.
Fixes: 153866583
Fixes: 156758475
Fixes: 163813210
Fixes: 163812902
Fixes: 163813227
Test: ActivityThreadTest
Test: ResourcesManagerTest
Test: AppConfigurationTests#testActivityContextDerivedDisplayContextOrientationWhenRotating
Change-Id: If93f98f93ee15b27d8c7292a2f830c2cc0f49277
LoadedApk.updateApplicationInfo can call getResources while holding the
ResourcesManager lock. Remove the wtf and replace it wuth a debug
warning.
Bug: 165367316
Change-Id: I734688edd4e1d218fd0e2438b47ee05e477aa79f
Test: presubmit
The package verifier performs some system critical work that the user
doesn't need to be explicitly aware of. This adds a mechanism for the
verifier to indicate which foreground service notifications should be
hidden, if possible.
Bug: 164440539
Test: use test app to confirm requested fgs notifications are hidden
Change-Id: Ib3eb0b71cc676c145557ade9def98a363e5abebb
Bug: 160971853
Reduce the auto-cork delay from 2s to 50ms. Testing shows that this
introduces a very few new invalidate calls for the package_info cache
key, and greatly improves the hit ratio for the associated caches.
This change includes a fix to the cache-clear counter. Some clears
were missing.
Test:
* phone reboot
* atest CtsContactsProviderTestCases
* atest FrameworksServicesTests:UserSystemPackageInstallerTest
* atest FrameworksServicesTests:PackageManagerSettingsTests
Verified that hit ratios improved over the baseline. Verified that the
number of extra invalidates did not increase by more than 5.
Change-Id: I4b70b1da8c3927c74077e6da0e60dc56c2e007f1
When zygote preloads a classloader, but at runtime, a different one is
used, we get an error and fallback. This error is improved in the
following ways:
- print the zip name with the shared libraries, so we know which library
the error is for
- distinguish cached from runtime dependencies in the error message
itself
Bug: 163886868
Test: N/A
Change-Id: I3f4c4078e9eb05b83058982afc7b7ea0822d1257
Currently, MediaSessionService observes the
ENABLED_NOTIFICATION_LISTENERS value in Settings to be notified
when a previously "enabled" NotificationListener becomes "disabled".
Instead, this CL adds a new broadcast intent action that
NotificationManagerService can use to notify MediaSessionService
whenever the enabled value of a notification listener changes.
Bug: 160762852, Bug: 147019349
Test: Go to Settings > Apps & Notifications > Special app access
> Notification access
and check if allowing/disallowing Notification access for any
app causes onEnabledChanged to be called.
Change-Id: I3aefa40083fedb78214ae884c7cccaf8de206663
Autofill broken tests (b/162203720) that weren't executed in the
presubmit. Add the fail tests into TEST_MAPPING to make sure tests
can be tested in presubmit.
Bug: 154961272
Test: atest --test-mapping frameworks/base/core/java/android/app/
Test: TreeHugger
Change-Id: Ifaefa6fae08d698b770e43830a62b3afb5b4edc5
PackageNamePermissionQuery (and all that uses it) speaks
of uid, but it actually stores/queries a userId. We therefore
rename the variable/parameter from uid to userId, as appropriate.
Bug: 163651060
Test: still compiles (no functional changes were made)
Change-Id: I3db2263a3f960d7eda35466a2e9058fe6f27e49a
The name of the parameter should be userId, not uid.
All callers and implementations seem to use userId.
Test: compiles
Bug: 163626967
Change-Id: I5a733075f8a0f19b44c01f65221c04694a178e0c
SlicePermissionActivity reads provider_pkg from intent, which can be
modified at will. As a result user might see incorrect package name in
the dialog granting slice permission.
Bug: 159145361
Test: manual
Change-Id: I8b66c02786df4096dad74b7e76255d5ddd1d609d
Change TimeZoneDetectorStrategyImpl to allow a new "geo only" mode.
The strategy can now exist in one of two modes:
1) Telephony signals only
2) Geolocation signals only
They may later joined by a third "hybrid" mode where we can
experiment with how to blend the two (if that seems like it will provide
better results), or perform a fallback from one to the other.
Note that nothing is actually making Geolocation-based suggestions yet.
The shell command line can be used to simulate geolocation suggestions
in the meantime.
This commit doesn't contain real settings logic: the settings storage and
logic will be added in a follow-up commit.
Bug: 149014708
Test: atest com.android.server.timezonedetector
Test: atest core/tests/coretests/src/android/app/timezonedetector/
Change-Id: I83f8f64d40255567c035a67741b18ecaf6f0561d
In case of device-to-device migration:
1. Include no-backup and cache dirs.
2. Ignore restore eligibility check for file paths.
Bug: 160407842
Test: 1. atest BackupAgentTest
2. Manual: Verify that all files are backed up / restored for
migrations.
Change-Id: I011c954c3e9e09828d2fb65fdfe96d8b6a6ba150