Fix monkey NPE

Bug 33177567

Monkey was causing a commit() while the activity was shutting down.
This protects from an NPE in this unlikely situation.

Test: cts-tradefed run singleCommand cts -d --skip-preconditions
      --skip-connectivity-check -m CtsFragmentTestCases

Change-Id: I832cfa8fb187c61b4d2f5a8a4d0f508d7a435171
(cherry picked from commit 3005e17b03d60a4ce0ed5ba04a9f474533c5c564)
1 file changed