Skip to content
Commit 91d4d591 authored by Jay Thomas Sullivan's avatar Jay Thomas Sullivan Committed by Jay Sullivan
Browse files

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
parent 43adc7bc
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment