Closed Bug 1016073 Opened 10 years ago Closed 10 years ago

mozdevice's stopApplication should work on older versions of Android

Categories

(Testing :: Mozbase, defect)

x86_64
Linux
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
mozilla32

People

(Reporter: wlach, Assigned: wlach)

References

Details

Attachments

(1 file, 2 obsolete files)

While hacking on bug 1016041 for eideticker, I realized that I had written some compatibility type code which tries to kill a browser in a similar way to "am force-stop" (i.e. trying repeatedly over a duration to kill all instances of a process), since just running killProcess seems not to be 100% reliable (because background processes might occasionally be launched when you're in the process of killing the browser). We may as well try to consolidate this code inside devicemanager so other people can use it.
Attached patch Add Android 2.x support to stopApplication (obsolete) (deleted) — Splinter Review
Assignee: nobody → wlachance
Attachment #8428892 - Flags: review?(bclary)
Comment on attachment 8428892 [details] [diff] [review] Add Android 2.x support to stopApplication Review of attachment 8428892 [details] [diff] [review]: ----------------------------------------------------------------- ::: testing/mozbase/mozdevice/mozdevice/droid.py @@ +141,5 @@ > + if num_tries > max_tries: > + raise DMError("Couldn't successfully kill %s after %s " > + "tries" % (appName, max_tries)) > + self.killProcess(appName) > + num_tries+=1 spaces @@ +144,5 @@ > + self.killProcess(appName) > + num_tries+=1 > + # sleep for a short duration to make sure there are no > + # additional processes in the process of being launched > + time.sleep(0.1) How did you decide on 0.1 seconds?
Attachment #8428892 - Flags: review?(bclary) → review+
Blocks: 1016041
(In reply to Bob Clary [:bc:] from comment #2) > Comment on attachment 8428892 [details] [diff] [review] > Add Android 2.x support to stopApplication > > Review of attachment 8428892 [details] [diff] [review]: > ----------------------------------------------------------------- > > ::: testing/mozbase/mozdevice/mozdevice/droid.py > @@ +141,5 @@ > > + if num_tries > max_tries: > > + raise DMError("Couldn't successfully kill %s after %s " > > + "tries" % (appName, max_tries)) > > + self.killProcess(appName) > > + num_tries+=1 > > spaces How do you mean? > @@ +144,5 @@ > > + self.killProcess(appName) > > + num_tries+=1 > > + # sleep for a short duration to make sure there are no > > + # additional processes in the process of being launched > > + time.sleep(0.1) > > How did you decide on 0.1 seconds? It's pretty much arbitrary and thus probably flakey. I'll update the comment to admit this, and maybe lengthen the timeout to a second. Fortunately we only need to use this functionality on Android 2.3 and below.
Attached patch Updated patch (obsolete) (deleted) — Splinter Review
Updating patch, carrying forward r+
Attachment #8428892 - Attachment is obsolete: true
Attachment #8429541 - Flags: review+
(In reply to William Lachance (:wlach) from comment #3) > > > + num_tries+=1 > > > > spaces > > How do you mean? spaces around the operator? num_tries+=1 -> num_tries += 1 The new patch is fine if you are ok with the spaces.
Attached patch Update once more for spacing (deleted) — Splinter Review
Attachment #8429541 - Attachment is obsolete: true
Attachment #8429572 - Flags: review+
Note for sheriffs; no need for try run as nothing in the tree actually uses this method ( http://mxr.mozilla.org/mozilla-central/search?string=stopApplication). I have tested this locally and it works well.
Keywords: checkin-needed
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla32
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: