Open Bug 1157531 Opened 5 years ago Updated 1 year ago

Remove remote debugging settings UI in favor of using system settings

Categories

(Firefox for Android :: Settings and Preferences, defect)

35 Branch
defect
Not set

Tracking

()

People

(Reporter: Margaret, Unassigned)

References

(Blocks 1 open bug)

Details

This is a spin-off from bug 1154504. See comments 5-8 in that bug.

mhaigh, what's the bug you're using to track updating our settings?
Flags: needinfo?(mhaigh)
Flags: needinfo?(mhaigh)
jryans, do you know what we would need to do to fix this bug? Is it a matter of listening for some Android setting to enable our remote devtools? Or is it just that would we just always enable them, but then we could only accept a connection if USB debugging is enabled anyway?

In bug 1154504, you mention that we've made some memory improvements with our remote devtools, but I don't think we would want to take any memory regression for something that most users aren't going to use, so I think we would want this to act like it's disabled if the user doesn't have USB debugging enabled.
Flags: needinfo?(jryans)
(In reply to :Margaret Leibovic from comment #1)
> jryans, do you know what we would need to do to fix this bug? Is it a matter
> of listening for some Android setting to enable our remote devtools? Or is
> it just that would we just always enable them, but then we could only accept
> a connection if USB debugging is enabled anyway?
> 
> In bug 1154504, you mention that we've made some memory improvements with
> our remote devtools, but I don't think we would want to take any memory
> regression for something that most users aren't going to use, so I think we
> would want this to act like it's disabled if the user doesn't have USB
> debugging enabled.

I think we should first try:

1. Listen for Android's USB debugging, enable DevTools if this is enabled

This way, there is no memory impact unless USB debugging is enabled.  However, we may conclude that the memory is still too high for just USB debugging users (since developers likely leave this on all the time).  So, the next (more complex) change we can make is:

2. When USB debugging is on, start only a port listener, not the entire DevTools server

This should drop memory usage down to about as small as we can make it while still be able to connect.

I don't really know how #1 should be done, as I am not sure how you watch for such an Android change (...or even if you can at all).  But, assuming we do #1 and memory usage shows #2 is needed as well, I can help with #2.
Flags: needinfo?(jryans)
(In reply to :Margaret Leibovic from comment #1)
> so I think we
> would want this to act like it's disabled if the user doesn't have USB
> debugging enabled.

(In reply to J. Ryan Stinnett [:jryans] (use ni?) from comment #2)
> 1. Listen for Android's USB debugging, enable DevTools if this is enabled
>
> 2. When USB debugging is on, start only a port listener, not the entire
> DevTools server
> 
> This should drop memory usage down to about as small as we can make it while
> still be able to connect.
> 
> I don't really know how #1 should be done, as I am not sure how you watch
> for such an Android change (...or even if you can at all).  But, assuming we
> do #1 and memory usage shows #2 is needed as well, I can help with #2.

These both sound good to me! *chimes out*
+1 because I tend to forget that I need to enable debugging inside Firefox too..
The code to work out if we're in USB debugging mode on the device should be:

boolean isDebuggable =  ( 0 != ( getApplicationInfo().flags &= ApplicationInfo.FLAG_DEBUGGABLE ) );
(In reply to Martyn Haigh (:mhaigh) from comment #5)
> The code to work out if we're in USB debugging mode on the device should be:
> 
> boolean isDebuggable =  ( 0 != ( getApplicationInfo().flags &=
> ApplicationInfo.FLAG_DEBUGGABLE ) );

How do you figure? From the documentation, I understood that this is if android:debuggable is enabled in the APK (which might correspond to our debug vs. opt builds).

I found http://stackoverflow.com/a/12676235 which states:

 int adb = Settings.Secure.getInt(context.getContentResolver(), Settings.Secure.ADB_ENABLED, 0);

(though there's an solution for > 17, where ^ gets deprecated in 17)
In bug 1180996, I recently added WiFi debugging for Fennec, which adds a new WiFi specific option to this settings menu.

So, I think removing the entire "Remote Debugging" settings panel would be harder to do now.

The WiFi debugging option is not based on ADB, so probing the ADB state is not helpful for that case.  There is not really any Android system level option to base the state of WiFi debugging on, I don't think, so at least that option seems like it would need to stay in the Fennec settings UI.

In any case, we could still automate the debugging via USB setting as described in other comments here.
No longer blocks: menu-reorg
You need to log in before you can comment on or make changes to this bug.