Closed Bug 768957 Opened 9 years ago Closed 9 years ago

Make SUTAgent able to get MAC address from ethernet connection

Categories

(Testing :: General, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
mozilla16

People

(Reporter: ted, Assigned: wlach)

Details

Attachments

(2 files)

Currently the SUTAgent can't find the MAC address of eth0 on the Pandaboard. This patch fixes that. (Additionally, because the agent would fall back to looking at the bluetooth connection, it'd crash the phone process when it did that, which was annoying.)

I need to charge my tablet so I can make sure it doesn't break the WiFi case.
Comment on attachment 637177 [details] [diff] [review]
Make SUTAgent able to get MAC address from ethernet connection

This works fine on my tablet as well.
Attachment #637177 - Flags: review?(ctalbert)
Comment on attachment 637177 [details] [diff] [review]
Make SUTAgent able to get MAC address from ethernet connection

Looks good to me.

Thanks Ted!
Attachment #637177 - Flags: review?(ctalbert) → review+
https://hg.mozilla.org/mozilla-central/rev/835c0105e4f0
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla16
Unfortunately, NetworkInterface.getHardwareAddress is only available for API level 9 and above -- calling it on a level 8 device (like a Tegra), causes SUTAgent to crash:

E/AndroidRuntime( 1587): FATAL EXCEPTION: main
E/AndroidRuntime( 1587): java.lang.NoSuchMethodError: java.net.NetworkInterface.getHardwareAddress
E/AndroidRuntime( 1587): 	at com.mozilla.SUTAgentAndroid.SUTAgentAndroid.onCreate(SUTAgentAndroid.java:132)
E/AndroidRuntime( 1587): 	at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
E/AndroidRuntime( 1587): 	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
E/AndroidRuntime( 1587): 	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
E/AndroidRuntime( 1587): 	at android.app.ActivityThread.access$2300(ActivityThread.java:125)
E/AndroidRuntime( 1587): 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
E/AndroidRuntime( 1587): 	at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 1587): 	at android.os.Looper.loop(Looper.java:123)
E/AndroidRuntime( 1587): 	at android.app.ActivityThread.main(ActivityThread.java:4627)
E/AndroidRuntime( 1587): 	at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 1587): 	at java.lang.reflect.Method.invoke(Method.java:521)
E/AndroidRuntime( 1587): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
E/AndroidRuntime( 1587): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
E/AndroidRuntime( 1587): 	at dalvik.system.NativeStart.main(Native Method)
W/ActivityManager( 1025):   Force finishing activity com.mozilla.SUTAgentAndroid/.SUTAgentAndroid
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Ugh. Can we wrap this in a try/catch, and fall back to the old WifiManager method?
I think there's no need for a try/catch -- we should be able to check api level with something like:

  if (Build.VERSION.SDK_INT > 8)
Wanted this fixed, so here's a quick patch that seems to work on both my Galaxy Nexus running 4.0 (with new stuff) and my LG G2X running 2.2 (with old stuff)
Assignee: ted.mielczarek → wlachance
Attachment #641088 - Flags: review?(jmaher)
Comment on attachment 641088 [details] [diff] [review]
Use new method if buildversion is large enough, otherwise fall back to old method

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

thanks!

::: build/mobile/sutagent/android/SUTAgentAndroid.java
@@ +149,4 @@
>          }
> +        else
> +            {
> +                // fall back to getting info from wifiman on older versions of Android,

nit: capitalize Fall
Attachment #641088 - Flags: review?(jmaher) → review+
https://hg.mozilla.org/mozilla-central/rev/f87229369e59
Status: REOPENED → RESOLVED
Closed: 9 years ago9 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.