summaryrefslogtreecommitdiff
path: root/core/java/android/os/SystemClock.java
Commit message (Collapse)AuthorAgeFilesLines
* Cache IAlarmManager binder handle.Sudheer Shanka2022-02-111-4/+12
| | | | | | Bug: 218909495 Test: treehugger Change-Id: Ib73dac85999311993fa9f0d552609065c24a155c
* [MS40.1] Remove Clock dependencies from NetworkStatsServiceJunyu Lai2022-01-061-1/+0
| | | | | | | | | | | | | | This includes: 1. Re-implement the BestClock in the static library. 2. Expose SystemClock#currentNetworkTimeClock as public Api Test: TH Bug: 204830222 CTS-Coverage-Bug: 213393821 Exempt-From-Owner-Approval: 1. Owner approved the change with explicitly granted submission after adderessing the straight-forward comment. 2. Owner is OOO for 3 months. Change-Id: I08c0162a7101cc6184f3eca3d4a59211183fb843
* Merge "Re-throw system server exception." am: 112cd8df86 am: c76d1a4c26 am: ↵Almaz Mingaleev2021-03-011-2/+1
|\ | | | | | | | | | | | | | | | | | | 08f03dc59c Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1608233 MUST ONLY BE SUBMITTED BY AUTOMERGER Change-Id: Ib5c9d8adbe377432df0710d8ab473683f6866bd7
| * Re-throw system server exception.Almaz Mingaleev2021-02-251-2/+1
| | | | | | | | | | | | | | | | | | Previous "return 0" was not reachable, this makes intention cleaner. Bug: minor cleanup Test: TH only Change-Id: I50d7d1a2ed53b8f8fe245c6ac6aad4fb8b4ce6e3
| * Add maxTargetSdk restriction to unused APIs.Mathew Inwood2020-11-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | These are APIs that have @UnsupportedAppUsage but for which we don't have any evidence of them currently being used, so should be safe to remove from the unsupported list. Bug: 170729553 Test: Treehugger Merged-In: I626caf7c1fe46c5ab1f39c2895b42a34319f771a Change-Id: I54e5ecd11e76ca1de3c5893e3a98b0108e735413
* | Add maxTargetSdk restriction to unused APIs.Mathew Inwood2020-10-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These are APIs that have @UnsupportedAppUsage but for which we don't have any evidence of them currently being used, so should be safe to remove from the unsupported list. This is a resubmit of ag/12929664 with some APIs excluded that caused test failures; see bugs 171886397, 171888296, 171864568. APIs excluded: Landroid/bluetooth/le/ScanRecord;->parseFromBytes([B)Landroid/bluetooth/le/ScanRecord; Landroid/os/Process;->myPpid()I Landroid/os/SharedMemory;->getFd()I Landroid/hardware/input/InputManager;->INJECT_INPUT_EVENT_MODE_WAIT_FOR_FINISH:I Bug: 170729553 Test: Treehugger Change-Id: I8285daa8530260251ecad6f3f38f98e263629ca7
* | Revert "Add maxTargetSdk restriction to unused APIs."Hongwei Wang2020-10-281-1/+1
| | | | | | | | | | | | | | | | | | This reverts commit 72f07d6a8a32db4a0dedd7682a0b3385be2b9cd6. Reason for revert: Droidcop-triggered revert due to breakage https://android-build.googleplex.com/builds/quarterdeck?testMethod=testAppZygotePreload&testClass=android.app.cts.ServiceTest&atpConfigName=suite%2Ftest-mapping-presubmit-retry_cloud-tf&testModule=CtsAppTestCases&fkbb=6936597&lkbb=6936969&lkgb=6936551&testResults=true&branch=git_master&target=cf_x86_phone-userdebug>, bug b/171886397 Bug: 171886397 Change-Id: Ibe0f0430a3451477c1ee8ef56a596e91ea1e7672
* | Add maxTargetSdk restriction to unused APIs.Mathew Inwood2020-10-271-1/+1
| | | | | | | | | | | | | | | | | | | | These are APIs that have @UnsupportedAppUsage but for which we don't have any evidence of them currently being used, so should be safe to remove from the unsupported list. Bug: 170729553 Test: Treehugger Change-Id: I4c8fd0006f950de9955242e93968fb0996ceb372
* | Switching StatLogger to uptimeSuprabh Shukla2020-08-051-0/+9
|/ | | | | | | | | | | | Uptime is a better estimate of time spent in cpu. Adding uptimeNanos to SystemClock to get finer timestamps. Test: Manual: `adb shell dumpsys alarm` should show sensible information under 'Stats' printed at the end. Bug: 162791194 Change-Id: I4f1c9d41c53ec03fc414730d38fd7a2233bb0569
* Use new UnsupportedAppUsage annotation.Artur Satayev2019-12-181-1/+1
| | | | | | | | Existing annotations in libcore/ and frameworks/ will deleted after the migration. This also means that any java library that compiles @UnsupportedAppUsage requires a direct dependency on "unsupportedappusage" java_library. Bug: 145132366 Test: m && diff unsupportedappusage_index.csv Change-Id: I534e3fd1305e2f4af076986770033478448a665c
* Merge "Remove dead code from SystemServer" am: 05eeef4188 am: 01d1dd28f1Neil Fuller2019-11-251-0/+1
|\ | | | | | | | | | | am: 18e458ef00 Change-Id: Ibb828d6acea117032d9dbb1e6669c119768f5cf3
| * Remove dead code from SystemServerNeil Fuller2019-11-211-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove dead code from SystemServer that obstensively protects devices from negative (< 1970) system clock times, but does not. In reality, SystemServer calls SystemClock.setCurrentTimeMillis(), which calls through to the AlarmManager.setTime() binder call. When the code runs the system server hasn't started any services yet, so this would always fail. AlarmManager has similar protections in place that do work: if the device is earlier than a "build time", then the device's clock is forced forward. That provides the protection that the code being removed from SystemServer was trying to achieve. Test: Added logging to SystemClock to prove AlarmManager is null / manual debugging Change-Id: I87dca1062829bc1a10202804fa7ee31e0a6f03a3
* | Remove SystemClock.uptimeMillisClock().Kweku Adams2019-06-171-8/+0
|/ | | | | | | | It was marked @removed in Pie. Now removing it from the code. Bug: 135214188 Test: atest FrameworksMockingServicesTests Change-Id: Id8bdf28d8d10a767f54af1bf421185e179c0379a
* Merge "Add location backed system clock"Chad Brubaker2019-03-211-0/+31
|\
| * Add location backed system clockChad Brubaker2019-03-201-0/+31
| | | | | | | | | | | | | | | | | | This provides a permissionless way to use the location (e.g. GNSS) provided time data for more accurate time keeping. Test: atest LocationManagerTest#testGnssProvidedClock Bug: 123530510 Change-Id: Ifbc45997868040abbb3e1399a8649911afb0af05
* | Add @UnsupportedAppUsage annotationsAndrei Onea2019-03-151-0/+4
|/ | | | | | | | | | | | | | | | For packages: android.os This is an automatically generated CL. See go/UnsupportedAppUsage for more details. Exempted-From-Owner-Approval: Mechanical changes to the codebase which have been approved by Android API council and announced on android-eng@ Bug: 110868826 Test: m Change-Id: I4ece0a3f37f88fc2508cb965092aed7cabc61819
* API council requested tweaks to SystemClock.Jeff Sharkey2018-03-261-0/+2
| | | | | | Test: none Bug: 73952114 Change-Id: Idd7aae5161a2326920860a6a9c7137369a4d8b3d
* Better handling of NTP-based clocks.Jeff Sharkey2018-02-161-31/+76
| | | | | | | | | | | | | | | | | | | | Now that we have a nice Clock abstraction, we can use it to represent a clock backed by an NTP fix. (This makes testing logic much easier to write.) We now rely completely on NetworkTimeUpdateService to keep our NTP fix up to date, instead of trying to refresh in the middle of critical paths which could trigger random ANRs. Add internal FallbackClock to make it easier to handle missing NTP fixes. Add internal SimpleClock to let implementers focus on single millis() method. Test: bit FrameworksNetTests:com.android.server.net.NetworkStatsServiceTest Test: bit FrameworksServicesTests:com.android.server.NetworkPolicyManagerServiceTest Bug: 69714690, 72320957 Change-Id: Ic32cdcbe093d08b73b0e4b23d6910b23ea8e1968 Exempt-From-Owner-Approval: approved in previous PS
* Extend JobInfo to support NetworkRequest.Jeff Sharkey2017-11-091-0/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The current JobInfo.NETWORK_TYPE values offer basic network selection ability, but more precise requirements continue to come up. Instead of creating more NETWORK_TYPE constants, add support for the existing NetworkRequest object, which is the idiomatic way for an app to express the type of network they'd like to use. Move the implementation details of NETWORK_TYPE constants to use this new NetworkRequest functionality. Deprecate NETWORK_TYPE_METERED, since the lack of the NOT_METERED capability doesn't imply that the connection is metered. (Apps using this API to get to a cellular network should use TRANSPORT_CELLULAR instead.) Add new SystemClock APIs that return java.time.Clock instances for various Android-specific clocks. This gives us a clean interface (with negligible overhead) for swapping in artificial clocks for testing purposes. Improve JobStoreTest to validate new NetworkRequest features, and add one last sanity check to assertTasksEqual() to compare raw bits-on-wire, to catch people who forget to check new fields. Watch for IoThread to go idle to run tests faster. Test: bit FrameworksServicesTests:com.android.server.job. Bug: 67040695 Change-Id: I189e7602132a0ec26d2f0cc6dadc188664961a47
* SystemClock JNI updateJohn Reck2016-10-031-7/+15
| | | | | | | Switch to @CriticalNative Test: make & boot Change-Id: I5ead83f5c201bf9bb50a39b5c6dcd8b6ac6b5ba5
* Move time setting code from SystemClock to AlarmManagerServiceGreg Hackmann2014-02-211-1/+22
| | | | | | | | | | | | | | | | | On devices using /dev/rtc instead of /dev/alarm, updating the time-of-day clock and RTC are separate syscalls. Hence the clock and RTC could be left in inconsistent states if two threads called SystemClock.setCurrentTimeMillis() simultaneously. By moving this code into AlarmManagerService, we can put a global lock around AlarmManagerService.setTime() and prevent the race condition. Note that access to SystemClock.setCurrentTimeMillis() is now gated by android.permission.SET_TIME, where before it was gated by filesystem permissions (i.e., could the process write to /dev/alarm or /dev/rtc). Change-Id: Ia34899a4cde983656305fd2ef466dfe908ed23c8 Signed-off-by: Greg Hackmann <ghackmann@google.com>
* Remove misleading documentation from SystemClockMichael Wright2013-03-221-2/+0
| | | | Change-Id: Ic97f911dca5c2b8911a4b2c670c4c79578f2cec0
* Fix for bug: #7173350. elapsedRealtimeNano() -> elapsedRealtimeNanos()Philip Milne2012-09-261-2/+2
| | | | Change-Id: Ie38952bbaace080e81e41e61350cda172951d548
* Revert "Fix for bug: #7173350. elapsedRealtimeNano() -> elapsedRealtimeNanos()"Philip Milne2012-09-241-2/+2
| | | | | | This reverts commit 2f6d8829524dfca3a77e9a57c3b9c3862209877d Change-Id: Id5af767a09fc319127c4ebef837c5b7a7f75cb01
* Fix for bug: #7173350. elapsedRealtimeNano() -> elapsedRealtimeNanos()Philip Milne2012-09-211-2/+2
| | | | Change-Id: I71c24ea10093ece07a0780e97bc641ff548c1a44
* Introduce SystemClock#elapsedRealtimeNano.Nick Pelly2012-07-201-9/+17
| | | | Change-Id: I47e1b14d45c5321f959d46e1805f86aafd72f5d4
* Convert looper traces to traceview tracesRomain Guy2011-07-201-0/+18
| | | | Change-Id: If9238e8b00744118c1c4d2182727569f94deb638
* Update docs.Joe Onorato2009-07-311-1/+7
|
* auto import from //depot/cupcake/@135843The Android Open Source Project2009-03-031-0/+154
|
* auto import from //depot/cupcake/@135843The Android Open Source Project2009-03-031-154/+0
|
* Initial ContributionThe Android Open Source Project2008-10-211-0/+154