Set DreamsActivateOnSleepSetting and handle Sandman in tests
Two PowerManagerServiceTest were failing on TV: - testRemovedDisplayGroupWakeLock_affectsNoDisplayGroups - testWakeLock_affectsProperDisplayGroup These tests expected the device to be DOZING at the end of the test, but the devices was found to be DREAMING. This difference came from `mDreamsActivateOnSleepSetting`, which was not set for phones, but is set on TV. Two tests are added to test the behaviour of this setting. This CL also changes a call to `Handler#sendMessage` to `Handler#sendMessageAtTime`, which schedules the message according to the time of the test clock, instead of the real SystemClock. This causes `handleSandman` to actually run during the test, which would put the device to sleep if DOZING and dream couldn't be started, so when #startDream is called on the DreamManager mock, we set #isDreaming on the mock. Bug: 205837239 Test: atest PowerManagerServiceTest Change-Id: I6f27ea6a5cf8ddb1b7735c8d6ef67f27a5eb3747 (cherry picked from commit dbcf8a0a)
Loading
Please register or sign in to comment