Replace mischievous monkey with Java API to fix freezing rotation.

ag/13473673 used `monkey` to replace `am start`, probably for
verifying the command output. However, monkey forces unsetting a
frozen display rotation upon finish and causes our test to fail on
landscape small screen devices when Settings collapsible toolbar is
involved (ag/14950274). So replace monkey with starting the intent
returned by PackageManager.getLaunchIntentForPackage(), which is
equally handy while simple and robust.

This change also adds the FreezeRotationRule to
AppHibernationIntegrationTest, which is also testing against the
Settings page and has the same issue as in AutoRevokeTest when the
screen is in landscape.

Bug: 188092696
Test: atest AutoRevokeTest
Test: atest AppHibernationIntegrationTest
Test: Tested with phone almost vertical to the desk to ensure rotation
      is disabled.
Change-Id: I03e877b8ff8a6d384e274aebcf3b15d0de4c79fb
2 files changed