In test helper apps, handle configuration changes
When a configuration change occurs, an activity may be recreated. Essentially, it's destroyed and a new one is created in its place. A problem with this is, some of our test helper apps perform non- idempotent actions, or store state in local variables. Restarting the activity can lead to hard-to-diagnose test failures. Of all the test helper activities, there are essentially these categories: 1. The activity already accounts for configuration changes. 2. The activity already finishes itself within onCreate. 3. The activity already appears to be completely idempotent. 4. The activity does not gracefully handle configuration changes, but is trivial to fix. 5. The activity does not gracefully handle configuration changes, and fixing it is non-trivial. This change fixes: - Category #4 activities by detecting, logging, and gracefully handling configuration changes. - Category #5 activities by disabling as many configuration changes as possible, then if a configuration change still occurs, detect, log and throw an exception. (This still won't reflect as a TestRunner exception, but it will show as an error in the logs.) Fix: 300545016 Fix: 280542662 Test: cd packages/modules/Permission && atest :alltests Change-Id: I60bb60a9a8fe93ef9d03d8f645c3d79ae787eefa
Loading
Please register or sign in to comment