Skip to content
Snippets Groups Projects
  1. Nov 17, 2023
    • Hari Raj Vijayakumar's avatar
      Fix AlarmManager high CPU issue · d90dd503
      Hari Raj Vijayakumar authored
      - clampPositive assumes negative value is due to overflow and so sets
         to MAX_VALUE. However it also possible that negative value occurs
          due to addition of negative value(of higher magnitude) with positive
          of lower magnitude. In issue case, NTP sync causes RTC to move
          forward thus pushing whenElapsed to negative range. This means
          maxWhenElapsed would also be negative but is clamped to MAX_VALUE
          causing AlarmManager to go into infinite loop.
      
      Bug: b/308389917
      Test: manual
      Change-Id: Ie12d5125f1feeeb1a5dd661a744f86d00796d126
      Merged-In: I946333b86b2658ec1b70cb1e3110f5eae1b81486
      d90dd503
  2. Nov 08, 2023
  3. Oct 12, 2023
    • Kweku Adams's avatar
      Avoid loading duplicate jobs. · 9b4ec7c8
      Kweku Adams authored
      If the persisted files have somehow accumulated duplicate versions of
      the same job (identified by uid-namespace-jobId), then drop the
      duplicates and only keep one.
      
      Bug: 289062813
      Bug: 296890885
      Test: atest JobStoreTest
      Change-Id: I3179261309031801f0506cf905206376e59af1fe
      (cherry picked from commit c8fbd937)
      Merged-In: I3179261309031801f0506cf905206376e59af1fe
      9b4ec7c8
    • Kweku Adams's avatar
      Don't penalize app for slow app binding. · 8d6ab2f9
      Kweku Adams authored
      The system may be busy when trying to bind to the app, so don't penalize
      it for slow binding. Now, we'll retain the job that was slow to bind and
      stop triggering an ANR.
      
      Bug: 292090044
      Bug: 303533836
      Test: atest CtsJobSchedulerTestCases:JobSchedulingTest
      Change-Id: Ida52d63c5e9710d9d590388d20fceb4fa8f2e0d5
      (cherry picked from commit 71fdfd48)
      Merged-In: Ida52d63c5e9710d9d590388d20fceb4fa8f2e0d5
      8d6ab2f9
  4. Sep 14, 2023
    • Tej Singh's avatar
      Move system server pullers off background thread · c0da04b7
      Tej Singh authored
      The background thread is prone to severe delays in processing time near
      boot, which causes pull timeouts and event queue overflow in statsd. The
      vast majority of pullers use the DIRECT_EXECUTOR to execute pulls in the
      incoming binder thread, so move these pulled atoms to do the same thing.
      More context is in the bug and linked docs.
      
      Bug: 298133385
      Test: verified via boot traces that the pull durations are shorter and
      that the pulls no longer happen in the background thread
      
      Change-Id: I67a3d583cc13d9547dfe7108897e95f4a5238d26
      Merged-In: I67a3d583cc13d9547dfe7108897e95f4a5238d26
      (cherry picked from commit 5c85f29b)
      c0da04b7
  5. Aug 24, 2023
  6. Aug 23, 2023
  7. Aug 22, 2023
    • Kweku Adams's avatar
      Avoid loading duplicate jobs. · b74d32fa
      Kweku Adams authored
      If the persisted files have somehow accumulated duplicate versions of
      the same job (identified by uid-namespace-jobId), then drop the
      duplicates and only keep one.
      
      Bug: 289062813
      Bug: 296890885
      Test: atest JobStoreTest
      Change-Id: I3179261309031801f0506cf905206376e59af1fe
      b74d32fa
  8. Aug 21, 2023
  9. Aug 09, 2023
    • Eric Biggers's avatar
      Fix logspam from AppIdleHistory on first boot · 2ac7a0c2
      Eric Biggers authored
      Before /data/system/users/0/app_idle_stats.xml has been created, it is
      expected that it doesn't exist.  Log a simple debug message instead of
      an error message with stacktrace.
      
      Bug: 290410617
      Test: booted Cuttlefish and checked logcat
      Change-Id: I19a72e3bd74038e7447a2d47529022a68a13b1e9
      Merged-In: I19a72e3bd74038e7447a2d47529022a68a13b1e9
      (cherry picked from commit 4aa768b4)
      2ac7a0c2
  10. Jul 17, 2023
    • Suprabh Shukla's avatar
      Log when job quota is reduced for buggy apps · 65a72578
      Suprabh Shukla authored
      Count the times job scheduler artificially lowers quota for a job
      because it considers the caller buggy due to excessive job timeouts.
      
      The logic is refactored to allow simpler logging, but no other
      functional change is intended.
      
      Test: statsd_testdrive 528
      
      Existing job tests:
      Test: atest FrameworksMockingServicesTests:JobSchedulerServiceTest
      Test: atest FrameworksMockingServicesTests:JobStatusTest
      
      Bug: 291146667
      Change-Id: I62654be0a0cdc713a17146c3ec612b37e8283b3e
      Merged-In: I62654be0a0cdc713a17146c3ec612b37e8283b3e
      65a72578
  11. Jun 23, 2023
    • Kweku Adams's avatar
      Support test skipping when power save modes aren't enabled. · 1656f9a8
      Kweku Adams authored
      Some classes of devices will not have auto power save modes enabled. On
      those devices, we should skip tests that require the modes be enabled.
      
      Bug: 240108412
      Bug: 240630396
      Test: Manually go through CTS-V "Ignore Battery Optimizations Test"
      Test: atest CtsUsageStatsTestCases:UsageStatsTest
      Change-Id: Icc64fbe75213386a1f41fae258e50c4032920b0a
      (cherry picked from commit ba3b5d7e)
      Merged-In: Icc64fbe75213386a1f41fae258e50c4032920b0a
      1656f9a8
  12. Jun 09, 2023
    • Kweku Adams's avatar
      Ensure apps can't bypass FAS using UIJ. · 6a8a1bf6
      Kweku Adams authored
      Make sure UIJs are set to stop after an app leaves the TOP state if the
      user Background Restricted the app. Also remove associated notifications
      so that users don't get confused about the state of the app.
      
      Also modifying IDLE_UIDS_MSG queuing to enable deterministic testing.
      
      Bug: 285623302
      Test: atest CtsJobSchedulerTestCases:JobThrottlingTest
      Test: atest CtsJobSchedulerTestCases:NotificationTest
      Test: atest --rerun-until-failure 25 CtsJobSchedulerTestCases:UserInitiatedJobTest
      Test: atest FrameworksMockingServicesTests:JobNotificationCoordinatorTest
      Test: atest FrameworksMockingServicesTests:MockingOomAdjusterTests
      Test: atest FrameworksServicesTests:OomAdjusterTests
      Change-Id: I59f9880b0cfc4e5ba143cd522ed4c3df012f7154
      6a8a1bf6
  13. Jun 07, 2023
    • Rafal Slawik's avatar
      Use valid metric ids · bb673e2f
      Rafal Slawik authored
      Bug: 286192024
      Bug: 266008139
      Change-Id: Ieaea2b181334d40224fd97a7e2280827220cecb8
      Test: build
      bb673e2f
  14. Jun 02, 2023
    • Kweku Adams's avatar
      Log namespace hash. · 7a030400
      Kweku Adams authored
      Log the hash of the namespace to reduce privacy concerns while still
      being able to distinguish between namespaces.
      
      Bug: 138239687
      Test: statsd_testdrive 8
      Change-Id: I94d0e927e287339d5e74fa3db2f0e226f2fe3048
      7a030400
  15. Jun 01, 2023
    • Kweku Adams's avatar
      Add app-level timeout & ANR limits. · a57583df
      Kweku Adams authored
      If an app's jobs keep timing out, then the app potentially has a bug.
      Timeouts resulted in backoff of the individual job that timed out,
      but didn't affect other jobs. This meant that apps could bypass backoff
      by scheduling one-off jobs instead of rescheduling using the return
      parameter to onStopJob. Now, JobScheduler will track the number of job
      timeouts across all of the app's jobs and reduce the app's max job time
      if it exceeds a threshold. If the total number of timeouts exceeds
      another limit, JobScheduler will consider the app buggy and
      attempt to put the app in the RESTRICTED bucket.
      
      Similarly, if an app keeps ANRing from JobScheduler's perspective, it
      will consider the app buggy and attempt to put it in the RESTRICTED
      bucket.
      
      When an unexempted app is considered buggy, don't treat any of its jobs
      as in the ACTIVE unless the app is current active.
      
      Also, reduce the delay for forcing an app in the RESTRICTED bucket
      (eg. when the app is buggy) to 1 hour. The normal bucket timeout
      continues to be 8 days.
      
      Bug: 284080732
      Test: atest AppStandbyControllerTests
      Test: atest FrameworksMockingServicesTests:JobSchedulerServiceTest
      Test: atest FrameworksMockingServicesTests:JobStatusTest
      Test: atest frameworks/base/services/tests/mockingservicestests/src/com/android/server/job
      Test: atest frameworks/base/services/tests/servicestests/src/com/android/server/job
      Change-Id: I8eb333a922658ba6137012dffd7a143cd990376d
      a57583df
  16. May 30, 2023
    • Kweku Adams's avatar
      Increase exempted apps' EJ quota. · 6f78eacc
      Kweku Adams authored
      Increase the EJ quota for EXEMPTED apps slightly.
      
      Bug: 267949143
      Test: atest FrameworksMockingServicesTests:QuotaControllerTest
      Change-Id: Ie08c0aae69d3f42e97d64c1433c51c614bbf9a59
      6f78eacc
  17. May 23, 2023
    • Kweku Adams's avatar
      Generate a logging ID incorporating the namespace. · 2a3609c2
      Kweku Adams authored
      Generate a unique logging ID incorporating the namespace and original
      job ID so that logs can differentiate between jobs in different
      namespaces.
      
      Bug: 138239687
      Test: statsd_testdrive 8
      Change-Id: I549c2bfaa3a75b7fbcdfae48829e02ffdcc77b64
      2a3609c2
  18. May 22, 2023
  19. May 16, 2023
    • Kweku Adams's avatar
      Treat ANR as an app failure. · 6b4693ff
      Kweku Adams authored
      Treat an ANR stop as an app failure and back off immediately when that
      happens.
      
      Bug: 258236856
      Bug: 282784507
      Test: atest FrameworksMockingServicesTests:JobSchedulerServiceTest
      Change-Id: I3feab21e74d55c4a2940e3ef2ca10175295970a3
      6b4693ff
  20. May 15, 2023
    • Kweku Adams's avatar
      Don't back off for first few system stops. · 9e653088
      Kweku Adams authored
      System requested stops theoretically have no reason to trigger an
      immediate backoff because there's no indication the backoff will help
      improve success rate, so don't back off a job for the first few system
      stops.
      
      Bug: 282784507
      Test: atest FrameworksMockingServicesTests:JobSchedulerServiceTest
      Change-Id: If30edd312e17a6baba05654075e7ed21ace6338b
      9e653088
  21. May 13, 2023
    • Amith Yamasani's avatar
      Delay freezing for given duration through broadcast options · 369f7153
      Amith Yamasani authored
      This allows a privileged app to set an allowlist duration to only
      delay freezing an app. It doesn't put the app into the temp allowlist
      nor put it into active state. It only kicks the can down the road
      on when to freeze the process.
      
      Fixes: 278940896
      Test: atest BroadcastFreezerTest
      Change-Id: I2498c29401d1ec2514450e034498de0403f334da
      369f7153
  22. May 10, 2023
    • Kweku Adams's avatar
      Fix concurrency logging. · 5e204c1f
      Kweku Adams authored
      Avoid overcounting lower concurrency values from jobs finishing
      execution.
      
      Bug: 138239687
      Bug: 279935506
      Test: atest CtsJobSchedulerTestCases:JobSchedulingTest
      Change-Id: I000dcfba72d8394486889dbb53aaa7039c62fac3
      5e204c1f
    • Kweku Adams's avatar
      Remove demotion flags when a JobWorkItem is enqueued. · 4e443ad0
      Kweku Adams authored
      Remove the demotion flags from a user-initiated job if the app
      successfully enqueues a new JobWorkItem. If an app successfully enqueues
      a JobWorkItem to a UI job, then the app is in a state to successfully
      schedule a UI job. Presumably, the user has asked for this additional
      bit of work, so it makes sense to remove the demotion flags. For now,
      we only do this for UI jobs since they have strict scheduling
      requirements. It's harder to assume other jobs were scheduled due to
      user interaction/request.
      
      This mimics the behavior when a UI job is rescheduled (without adding a
      JobWorkItem). Internal flags aren't copied over when a job is
      rescheduled.
      
      Bug: 281838527
      Test: atest FrameworksMockingServicesTests:JobStatusTest
      Change-Id: I591afc7c0ac23fa0bda646fd12053be58ff5d4ee
      4e443ad0
    • Kweku Adams's avatar
      Remove INTERNET permission requirement. · 4239484c
      Kweku Adams authored
      Bug: 280564348
      Test: atest CtsJobSchedulerTestCases
      Change-Id: I4fa917be0594c11ead64cfd98ab9e56045c159e9
      4239484c
    • Suprabh Shukla's avatar
      Count modifications to user's power allowlist · 6531a739
      Suprabh Shukla authored
      Log a counter everytime an app is put into or taken out of the power
      allowlist. In normal conditions, this is only expected to happen when
      the user toggles this in Settings, so should be relatively rare.
      
      Test: N/A
      
      Bug: 263411625
      Change-Id: Ie0d79d66cf2b480e8d94c7d6b1567d7785cde7be
      6531a739
  23. May 08, 2023
    • Kweku Adams's avatar
      Limit namespace length. · e3407ec2
      Kweku Adams authored
      Limit namespace length to 1000 characters to avoid memory or other
      potential issues.
      
      Bug: 281553712
      Test: atest CtsJobSchedulerTestCases
      Change-Id: I8c99ce6c5e9a23a38f91a00bdf22e80d08389f32
      e3407ec2
    • Kweku Adams's avatar
      Add metrics around scheduling failures. · 30cd1ec8
      Kweku Adams authored
      Add metrics to track how often apps fail to schedule jobs.
      
      Bug: 138239687
      Bug: 279935506
      Test: atest CtsJobSchedulerTestCases:JobSchedulingTest
      Change-Id: I05fec96feb4ab8b78a0e896b84a31512b4f84fe5
      30cd1ec8
  24. May 05, 2023
    • Suprabh Shukla's avatar
      Count app restriction events · 247c434e
      Suprabh Shukla authored
      Log a counter every time an app is put under battery restriction.
      
      Test: N/A
      
      Bug: 280192659
      Change-Id: I688f6e33fe74d637a453c5d5ecfbcf0d6c7f9379
      247c434e
  25. May 04, 2023
    • Kweku Adams's avatar
      Add scheduled job high water mark metric. · 531b7ec8
      Kweku Adams authored
      Add a metric to track the maximum number of jobs that are scheduled at a
      time, in 30 minute increments.
      
      Bug: 138239687
      Bug: 279935506
      Test: atest CtsJobSchedulerTestCases:ConnectivityConstraintTest
      Test: atest CtsJobSchedulerTestCases:JobSchedulingTest
      Test: atest CtsJobSchedulerTestCases:NotificationTest
      Change-Id: If0c190bf8ebcca55ef1907020b37a0e1c72181ae
      531b7ec8
  26. May 03, 2023
    • Kweku Adams's avatar
      Fix cumulative execution calculation. · b347ffad
      Kweku Adams authored
      The base timestamp wasn't being reset when the job started, so the
      duration was always being perceived as starting from boot time. Setting
      the base timestamp as the job start time fixes the cumulative execution
      tracking.
      
      Bug: 280653695
      Test: N/A
      Change-Id: I8fdcde54c21bc53cfdb41c78ba4f19d7b45cc50b
      b347ffad
    • Kweku Adams's avatar
      Add express logs for several JobScheduler events. · 72a334ca
      Kweku Adams authored
      Add express logs to track:
      1. How apps interact with the updateEstimatedNetworkBytes() API
      2. How apps interact with the updateTransferredNetworkBytes() API
      3. How apps interact with the setNotification() API
      4. How apps interact with the setEstimatedNetworkBytes() API
      5. How apps interact with the setMinimumChunkBytes() API
      6. How often apps hit the max scheduled job limit
      7. How often apps are too slow in responding to JobService API calls
      8. How many times apps crash (or otherwise unexpectedly lose their
         connection) while running a JobService
      9. How many JobWorkItems apps enqueue at a time
      10. Job execution concurrency
      
      Bug: 138239687
      Bug: 279935506
      Test: atest CtsJobSchedulerTestCases:ConnectivityConstraintTest
      Test: atest CtsJobSchedulerTestCases:JobSchedulingTest
      Test: atest CtsJobSchedulerTestCases:NotificationTest
      Test: atest FrameworksMockingServicesTests:JobNotificationCoordinatorTest
      Change-Id: I153eef1120fcdbf64c241707287233c422fa66db
      72a334ca
  27. Apr 28, 2023
  28. Apr 27, 2023
    • Kweku Adams's avatar
      Properly handle disabled location prefetch. · b6a89191
      Kweku Adams authored
      The controller was still registering for location updates when location
      prefetch was disabled. Now, it skips requesting location updates
      altogether when location prefetch is disabled.
      
      Bug: 279725615
      Test: atest DeviceIdleTest
      Test: atest FrameworksMockingServicesTests:DeviceIdleControllerTest
      Change-Id: If303d5448acbc4e97132f3713a7795e46eacc5ab
      b6a89191
  29. Apr 25, 2023
    • Suprabh Shukla's avatar
      Add some unit tests for listener exact alarms · db2a79da
      Suprabh Shukla authored
      Listener exact alarms no longer require permission. Adding unit test
      cases to document and test the same.
      
      Added couple string translations that were missing for exact-allow
      reasons.
      
      Test: FrameworksMockingServicesTests:AlarmManagerServiceTest
      
      BYPASS_INCLUSIVE_LANGUAGE_REASON=existing code
      
      Fixes: 265838027
      Change-Id: I0b985b5ee381bf8385e9ed43fa6efb4460bf59e6
      db2a79da
  30. Apr 21, 2023
  31. Apr 20, 2023
    • Suprabh Shukla's avatar
      Enable attribution for sensor and cellular wakeups · 4ed309b3
      Suprabh Shukla authored
      Sensor wakeup events are already being reported to batterystats.
      For cellular, the code in network stack will be enabled independently.
      
      Test: atest FrameworksServicesTests:CpuWakeupStatsTest
      Test: statsd_testdrive -e 588
      
      Bug: 276498460
      Bug: 275436924
      Change-Id: I1fc925193b4f0e3713d29de552138287c9a9768e
      4ed309b3
  32. Apr 18, 2023
    • Kweku Adams's avatar
      Shift job readiness re-evaluation check. · a2282a9c
      Kweku Adams authored
      Sometimes controllers actually update their relative bit on the job
      when the JobSchedulerService double checks with controllers. However,
      if JSS is looping through the changedJobs list when this happens, the
      controller will tell JSS of the change, but adding it to the changedJobs
      list will be a no-op so the job won't be added to the pending job list.
      And if the controller gets a callback and evaluate the job on its own,
      the bit won't change and so the job won't be added to the changedJobs
      list. This leads to inconsistent behavior based on timing/order of
      operations. Shifting the controller re-evaluation to when we're
      determine the job's readiness fixes the issue.
      
      Bug: 263216453
      Bug: 263699506
      Bug: 271128261
      Test: atest --rerun-until-failure 50 android.jobscheduler.cts.JobThrottlingTest#testRestrictedEJAllowedWhenAutoRestrictedBucketFeatureOn
      Test: atest FrameworksMockingServicesTests:JobSchedulerServiceTest
      Change-Id: Idb41cf030f63c697adb8e7bfebc132019f9dffbc
      a2282a9c
  33. Apr 17, 2023
    • Kweku Adams's avatar
      Log class name. · e57f0315
      Kweku Adams authored
      Log class name in the error message so developers can track down classes
      that don't override the method.
      
      Bug: 152942222
      Test: atest CtsJobSchedulerTestCases:ConnectivityConstraintTest
      Change-Id: Ifeef4fa8b801bd6c551cd095dabd7603b70b53bf
      e57f0315
Loading