In order to let external module report their network stats,
expose necessary APIs to construct NetworkStats object.
Test: atest FrameworksNetTests CtsUsageStatsTestCases
Test: m doc-comment-check-docs
Bug: 130855321
Change-Id: Id3ec8aaff3df67948c25eac2319a74cf33a27979
Create new APIs in TelephonyManager for DevicePolicyManager to add
override APNs, and use them in DevicePolicyManagerService instead of
directly accessing the APN database.
Bug: 146834818
Test: cts-tradefed run cts --module DevicePolicyManager --test
com.android.cts.devicepolicy.DeviceOwnerTest#testOverrideApn
Test: atest TelephonyManagerTest
Change-Id: I6c6214424169c05fd452db71a8c6593f8473b9d4
Merged-In: I6c6214424169c05fd452db71a8c6593f8473b9d4
of LocalServices
b/69981755 introduces AppWidgetManagerInternal and added this instance
as key in Local Services. setup() phase of Second testcase onwards
throwing IllegalStateException as the AppWidgetManagerInternal interface
already added in the global registry of LocalServices in first time setup()
phase.
Bug: 147165870
Test: atest FrameworksServicesTests:com.android.server.appwidget.AppWidgetServiceImplTest
Change-Id: I9e74b1a06e1c9a4b0ee0cad982cecaac3059f7c9
Signed-off-by: Naga Venkata Durga Ashok Mutyala <quic_nmutya@quicinc.com>
Soong wasn't including android_app or android_test sources in the
javac-check target used for the Error Prone build, which allowed
some Error Prone errors to get in. Fix them so Error Prone can be
re-enabled for these targets.
Fixes:
frameworks/base/core/tests/coretests/src/android/view/textclassifier/ActionsSuggestionsHelperTest.java:241: error: [JUnit4TestNotRun] This looks like a test method but is not run; please add @Test and @Ignore, or, if this is a helper method, reduce its visibility.
frameworks/base/core/tests/systemproperties/src/android/os/SystemPropertiesTest.java:97: error: [JUnit3TestNotRun] Test method will not be run; please correct method signature (Should be public, non-static, and method name should begin with "test").
frameworks/base/services/tests/servicestests/src/com/android/server/backup/utils/FileUtilsTest.java:64: error: [CheckReturnValue] Ignored return value of method that is annotated with @CheckReturnValue
frameworks/base/services/tests/servicestests/src/com/android/server/backup/utils/FileUtilsTest.java:68: error: [CheckReturnValue] Ignored return value of method that is annotated with @CheckReturnValue
frameworks/base/services/tests/servicestests/src/com/android/server/backup/utils/FileUtilsTest.java:78: error: [CheckReturnValue] Ignored return value of method that is annotated with @CheckReturnValue
frameworks/base/services/tests/servicestests/src/com/android/server/hdmi/HdmiCecLocalDeviceAudioSystemTest.java:533: error: [JUnit4TestNotRun] This looks like a test method but is not run; please add @Test and @Ignore, or, if this is a helper method, reduce its visibility.
frameworks/base/services/tests/servicestests/src/com/android/server/locksettings/LockSettingsStorageTests.java:480: error: [JUnit4TestNotRun] This looks like a test method but is not run; please add @Test and @Ignore, or, if this is a helper method, reduce its visibility.
frameworks/base/services/tests/servicestests/src/com/android/server/locksettings/LockSettingsStorageTests.java:491: error: [JUnit4TestNotRun] This looks like a test method but is not run; please add @Test and @Ignore, or, if this is a helper method, reduce its visibility.
frameworks/base/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java:4196: error: [JUnit4TestNotRun] This looks like a test method but is not run; please add @Test and @Ignore, or, if this is a helper method, reduce its visibility.
Bug: 146455923
Test: m RUN_ERROR_PRONE=true javac-check
Change-Id: I829373d41c97962fe2122ea74cef12ba342ac33c
Merged-In: I829373d41c97962fe2122ea74cef12ba342ac33c
This change moves some logic associated with time detection out of the
NetworkTimeUpdateServiceImpl and moves it to the TimeDetectorStrategy
called by the TimeDetectorService.
The TimeDetectorStategy implementation now decides when to use an
NTP-derived time instead. The logic implemented here is effectively the
same as it was: NITZ takes priority over NTP until the latest NITZ
signal becomes "too old".
The motivating reasons for the change:
1) The "what signal is used when several are available?" logic should be
in one place: the TimeDetectoryStrategy not scattered around the
platform. Centralizing will enable different strategies and time sources
to be introduced over time.
2) It will allow removal of the ACTION_NETWORK_SET_TIME intent in a
follow-up commit; this intent was used to coordinate the NTP vs NITZ
logic should no longer be required.
The "bonus" effect of this change is that NetworkTimeUpdateServiceImpl
becomes more general: It can now be the authority for the NTP time on a
device independently of how the system clock should be set. e.g. it
could be used in future to back the
AlarmManager.currentNetworkTimeMillis() API call. Anything that needs a
"what is the best time according to NTP?" answer could use this service.
Note: The NetworkTimeUpdateServiceImpl still observes the AUTO_TIME
setting and will perform an NTP lookup "on demand" (if required) when
the user enables the setting. This should be a temporary state and
likely to be removed in future; knowledge of AUTO_TIME shouldn't be
required for the NTP info to be correct and if
NetworkTimeUpdateServiceImpl is doing the right thing.
Bug: 140712361
Test: atest com.android.server.timedetector
Test: atest android.app.timedetector
Change-Id: I4b2936a42c552c4dd4cb55010306bb81bca0c712
Extract a simple wrapper around ArrayMap called "ArrayMapWithHistory",
with associated tests. TimeDetectorStrategyImpl and
TimeZoneDetectorStrategy were duplicating some data structure logic.
ArrayMapWithHistory works the same as ArrayMap, but there is a (mostly
hidden) history of the values for each map entry. This is useful for
debugging.
A second class, ReferenceWithHistory, has been included to support the
ArrayMapWithHistory class and for use when extending the time / time
zone detector strategy implementations: this will be useful as
additional sources like GNSS / NTP are added to time detector, and
geo-location are added to time zone detection.
Bug: 146563025
Bug: 140712361
Test: atest com.android.server.timedetector
Test: atest com.android.server.timezonedetector
Change-Id: Ia6195cb628679a6a32c0118d2921e699514eed7d
This adds new permissions required when setting the time /zone in
response to telephony signals and when setting the time / zone manually
along the lines of "principle of least privilege".
The intent is to later restrict the number of distinct processes that
can manipulate the device system clock / time zone property directly so
that all time changes go through the time / time zone detector services,
which can enforce policy, log the reasons for changes, and so on.
Bug: 140712361
Test: atest com.android.server.timedetector
Change-Id: Iabd3a5f449ad2ef2b6581475ef2535a4a8a88ef9
Restrict the ability of callers to IPlatformCompat.setOverrides and
IPlatformCompat.clearOverride, depending on the type of build and/or
whether the app is debuggable.
Bug: 144552011
Test: atest PlatformCompatTest
Test: atest CompatConfigTest
Change-Id: Ibff7db73d7867735853aa2ddde7c14a12625b3dc
The annotation processor is being modified to produce an intermediate
output that will then be processed to produce the config that ends up on
device. As such, using XmlWriter in frameworks test code no longer makes
sense.
Instead, hard-code XML config in the test to break this problematic
dependency.
Test: atest CompatConfigTest
Change-Id: I371ba32bd83d6a84de94d594169dbb5c63f3d9be
Merged-In: I371ba32bd83d6a84de94d594169dbb5c63f3d9be
Fix TimeZoneDetectorStrategyTest#testFirstPlausiblePhoneSuggestionAcceptedWhenTimeZoneUninitialized.
A test that isn't run by treehugger. Broken by commit
9a81291281f16e1adbc2b260bebed91306649c83.
Test: atest com.android.server.timezonedetector
Bug: 140712361
Change-Id: Id1c867caf45055c22d6b8462534624cc82032293
This is a minimal change to allow ApexManager to work with the apex
service API change in aosp/1189340.
Bug: 141148175
Test: atest CtsRollbackManagerHostTestCases
Test: atest CtsStagedInstallHostTestCases
Change-Id: If0065516cfb32ee6c3dcaafeae7b8546a8cae903
Merged-In: I560ee4ed6dd82277892a511909378d5a5a8502ff
Fix TimeDetectorServiceTest permissions test. The suggestManualTime()
call was changed from enforceCallingPermission() to
enforceCallingOrSelfPermission() in commit 44fcf29.
Bug: 140712361
Test: atest com.android.server.timedetector
Change-Id: Ice263c7605c2ef7a04031404a25e2696f16b075c
Rename SimpleTimeZoneDetectorStrategy to TimeZoneDetectorStrategyImpl.
Its defining characteristic is not simplicity - it's currently the
only implementation.
There are also some small cleanups around the
TimeDetectorStrategy.Callback not being needed by TimeDetectorService.
Bug: 140712361
Test: treehugger only
Change-Id: Icdf365a6a123574fb2cd21b89a9749a2f386c5fd
Android has dual sim devices, which means multiple "phone" time
signals. NITZ is generally trusted and considered "good enough" in the
absence of better signals, but it is provided by carriers and it's not
unusual for the signals to be incorrect by minutes. We don't want the
device system clock just flicking to the latest signal received.
The changes to the SimpleTimeDetectorStrategy try to balance recency and
provide some consistency / determinism. See comments in the code for
details. The time zone detection works in a similar way, particularly
with respect to choosing the lowest phoneId in the event of a tie.
There will be a follow-up change to remove the word "Simple" from
SimpleTimeDetectorStrategy as it no longer applies.
Test: atest services/tests/servicestests/src/com/android/server/timedetector/SimpleTimeDetectorStrategyTest.java
Test: atest android.app.timedetector
Bug: 140712361
Change-Id: I228aff8709eabfcec910af22f7ab08fee32d566a
The extra key for subscription ID of ACTION_CARRIER_CONFIG_CHANGED is
CarrierConfigManager.EXTRA_SUBSCRIPTION_INDEX.
Bug: 140908357
Test: make
Change-Id: I437ebf67bd27e2ac69b2b7784d98d7683350652c
Merged-In: I437ebf67bd27e2ac69b2b7784d98d7683350652c
android.intent.action.NETWORK_SET_TIMEZONE is not used by anything in
the platform so it can be removed. It was previously broadcast when
telephony made a time zone change, presumably as a way to coordinate
time zone detection logic if there were other, lower-priority detection
mechanisms on the device. The logic for time zone detection is now
centralized in the system server so coordination can be done more
directly when needed.
All the APK usages appear to be only manifest entries for
<protected-broadcast> in apps that don't send the intent themselves,
which doesn't make a lot of sense.
Note: There is a separate commit to remove the broadcast from the old
(disabled) NITZ logic.
Bug: 140712361
Test: treehugger
Change-Id: Iab629778e45815f4632359e90d920b7751c1a199
Add TimeZoneDetector.suggestManualTimeZone() to set the time zone
"manually" and switch the device policy manager code over to using
it.
Add RequiredPermission annotations to TimeZoneDetector while there.
Bug: 140712361
Test: treehugger only
Test: atest services/tests/servicestests/src/com/android/server/devicepolicy/DevicePolicyManagerTest.java
Change-Id: Id247fddfdd793732dd88294ee215eda37cd0be4c
Capture the comment above a definition of a compat change and make it
the description.
Next: make sure existing changes use supported format (only /**
comments, only above the annotations), and use in developer UI.
Bug: 144927670
Test: atest com.android.server.compat.CompatConfigTest
Change-Id: Ib23f341baa171599654c351693e4b0ddf4b2515c
A number of connectivity checks that protect system-only methods
check for CONNECTIVITY_INTERNAL, but CONNECTIVITY_INTERNAL is a
signature|privileged permission. We should audit the permission
checks, and convert checks that protect code that should not be
called outside the system to a signature permission. So replace
all CONNECTIVITY_INTERNAL to other proper permissions.
Bug: 32963470
Test: atest FrameworksNetTests NetworkPolicyManagerServiceTest
Change-Id: I8f2dd1cd0609056494eaf612d39820e273ae093f
Merged-In: I8f2dd1cd0609056494eaf612d39820e273ae093f
TimeDetector improvements for production code and tests. Many of these
are based on feedback given for TimeZoneDetector and to improve
consistency across the two.
1) Add a builder for PhoneTimeSuggestion, making it immutable (except
for debug info that doesn't affect behavior).
2) Improve debug logging.
3) Improve comments / annotations.
Test: atest android.app.timedetector
Test: atest com.android.server.timedetector
Bug: 140712361
Change-Id: Ibd0d357c536d512ffe4995c4e6560e483a260ae5
Add a mechanism for suggesting the "manual" time zone setting to the
TimeZoneDetectorStrategy, e.g. for the settings app to use. This
involves various changes / renames to TimeZoneDetectorStrategy to
introduce a distinction between 3 things:
1) General detection code, applicable for anything that changes device
time zone.
2) Phone detection code, applicable for setting the device time zone
from phone signals.
3) Automatic detection code, applicable for setting the device time zone
automatically (of which telephony signals is currently the only example,
but could be joined by new things in future).
Adds tests for the new ManualTimeZoneSuggestion and makes improvements
to the existing tests for PhoneTimeZoneSuggestionTest.
Test: atest android.app.timezonedetector
Test: atest com.android.server.timezonedetector
Bug: 140712361
Change-Id: I9c3a18e47b157cccabda74855e5c91b45fa93b92
* changes:
DO NOT MERGE: Fixes NPE when preparing app data during init
Support privileged apps installed in APEX.
Support non-privileged APKs in APEX.
Refactors initial directory scan to be dryer
Add a new time zone detection service. Much of the code is from
frameworks/opt/telephony with some changes for naming, threading and
to modify the interaction with the "Callback" class.
Overall goal:
Implementing the service in the system server means it will be easier to
add new time zone detection logic unrelated to telephony in future.
Bug: 140712361
Test: atest com.android.server.timezonedetector
Test: atest android.app.timezonedetector
Change-Id: I89505fc4fecbd3667b60f8e1479b8f177eaa60ae
Merged-In: I89505fc4fecbd3667b60f8e1479b8f177eaa60ae
(cherry picked from commit 3e3b5405b6c5e77a640ad9450eb1cac5b7c80ff1)
Make TimeDetectorService / Strategy consistent with time zone detection
code, improve logging and generally tidy up.
1) Turn off debug logging / shorten log tags.
2) Add LocalLog for recording time changes.
3) Move to using FgThread for calls that can be done async / change
synchronization model (responsibility moves from service to strategy).
4) Move responisibility for determining current auto-time state to the
strategy.
5) Rename the strategy test to be correct(!)
Bug: 140712361
Test: atest services/tests/servicestests/src/com/android/server/timedetector/TimeDetectorServiceTest.java
Test: atest services/tests/servicestests/src/com/android/server/timedetector/SimpleTimeDetectorStrategyTest.java
Change-Id: I4902f6b360c168ec16a1595359153488a310a91a
This change collapses a bunch of manual calls to scanDir with a map and
a loop. This makes things a little more readable and easier to update
going forward.
Bug: NA
Test: boots without issue.
Merged-In: I81fb7a9474894d0bceecb6b0ef7a64d047a40c14
Change-Id: I81fb7a9474894d0bceecb6b0ef7a64d047a40c14
Before this change there are a various components that set the system
clock by directly calling AlarmManager.setTime(). This change exposes a
new method on TimeDetector to use when setting the device time manually
(e.g. via settings) and modifies some callers to use it.
The intent is to later restrict the number of distinct processes that
can manipulate the device system clock directly so that all time changes
go through the time detector service, which can enforce policy, log
the reasons for changes, and so on.
Bug: 140712361
Test: atest com.android.server.timedetector
Change-Id: I9300dba868ed61249d0848b0dd4b953996161bda
Merged-In: I9300dba868ed61249d0848b0dd4b953996161bda
(cherry picked from commit e376756b0c0e3164300c3fd624f9221181e82553)