Closed Bug 1084473 Opened 5 years ago Closed 5 years ago

devicemanager.getTopActivity sometimes fails on Android 4.4

Categories

(Testing :: Mozbase, defect)

x86_64
Linux
defect
Not set

Tracking

(Not tracked)

RESOLVED FIXED
mozilla36

People

(Reporter: gbrown, Assigned: gbrown)

References

Details

Attachments

(1 file)

getTopActivity sometimes fails on Android 4.4 when it receives unexpected output from "dumpsys window windows". Here are some captured outputs from dumpsys on android 4.4 devices:

  mCurConfiguration={1.0 310mcc?mnc en_US ldltr sw384dp w384dp h567dp 320dpi nrml port finger -keyb/v/h -nav/h s.5}
  mCurrentFocus=Window{426c4780 u0 org.mozilla.fennec/org.mozilla.fennec.App}
  mFocusedApp=AppWindowToken{42619ec8 token=Token{42492f68 ActivityRecord{42492cf0 u0 com.android.launcher/com.android.launcher2.Launcher t1}}}

  mCurConfiguration={1.0 310mcc260mnc en_US ldltr sw360dp w360dp h567dp 480dpi nrml port finger qwerty/v/v -nav/h s.5}
  mCurrentFocus=Window{b2181228 u0 org.mozilla.fennec_gbrown/org.mozilla.fennec_gbrown.App}
  mFocusedApp=AppWindowToken{b23b85e8 token=Token{b20e8330 ActivityRecord{b21407f8 u0 org.mozilla.fennec_gbrown/.App t7}}}

  mCurConfiguration={1.0 310mcc260mnc en_US ldltr sw360dp w360dp h567dp 480dpi nrml port finger qwerty/v/v -nav/h s.5}
  mCurrentFocus=Window{b20cf778 u0 com.android.launcher/com.android.launcher2.Launcher}
  mFocusedApp=null

The last case is a problem; the others are OK. The last case seems to happen when the home screen is displayed. We likely need to update both droid.py and the sutagent "activity" command.
I hope you can still test this solution on your device.

sutagent avoids this problem my returning an empty string when the focused application cannot be determined. That works out well since clients of getTopActivity() usually compare activity == "org.mozilla.fennec".

This patch modifies the adb case to work the same way: Instead of raising DMError, return an empty string.
Attachment #8509025 - Flags: review?(jmaher)
Comment on attachment 8509025 [details] [diff] [review]
return empty string instead of DMError when focused app not found

Review of attachment 8509025 [details] [diff] [review]:
-----------------------------------------------------------------

this seems to work.
Attachment #8509025 - Flags: review?(jmaher) → review+
is this something we should land?  do we need to update mozdevice or something?
Flags: needinfo?(gbrown)
Sorry, just being lazy...

https://hg.mozilla.org/integration/mozilla-inbound/rev/b7ecfedc0ef3
Flags: needinfo?(gbrown)
https://hg.mozilla.org/mozilla-central/rev/b7ecfedc0ef3
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla36
You need to log in before you can comment on or make changes to this bug.