Closed GoogleCodeExporter closed 8 years ago
I don't know how to control adbd from an activity. Any idea?
Original comment by hari.swa...@gmail.com
on 7 Mar 2010 at 8:26
mabey turn off and on USB Debugging mode?
Original comment by SkavenAn...@gmail.com
on 7 Mar 2010 at 9:00
in the init.rc script, they run "start adbd" and "stop adbd". Can you execute a
command from java?
Original comment by bgalbre...@gmail.com
on 7 Mar 2010 at 9:47
I tried that before. doesn't work. I can invoke other shell commands like ls,
logcat
etc but not the stop and start commands.
I'll try to debug this and include it in a build once I find a solution.
Original comment by hari.swa...@gmail.com
on 7 Mar 2010 at 10:18
Try:
import android.os.SystemProperties;
SystemProperties.set("persist.service.adb.enable", "1");
SystemProperties.set("persist.service.adb.enable", "0");
(This way is preferable because I think this setting will persist across
reboots.
You can use the corresponding .get method to get the current setting.)
Alternatively:
SystemService.start("adbd")
SystemService.stop("adbd")
(Should work but won't persist across reboots; so if user turns adbd off then
reboots, it will come back on.)
Original comment by jmc...@gmail.com
on 8 Mar 2010 at 6:34
I tried SystemProperties.set("persist.service.adb.enable", "0") yesterday. For
some
reason, it doesn't change the value. If I do a get after this, it returns 1 and
there is no change in the adb connection.
I'll try the SystemService calls & see if that works.
Original comment by hari.swa...@gmail.com
on 8 Mar 2010 at 1:47
Not sure if I need to assign any special permissions to access these classes.
I can call the SystemProperties.get/set and SystemService.start/stop methods
without
any exceptions, but there is no effect on the service. I'll try to spend more
time
on this next weekend and see what's going on.
If anyone has a fix/solution, please let me know.
Thanks,
Original comment by hari.swa...@gmail.com
on 8 Mar 2010 at 2:58
Okay, I think there is a process "AdbSettingsObserver" that may not let you
directly
start/stop it. I think they want you to go through the System Settings. See
http://developer.android.com/reference/android/provider/Settings.System.html#ADB
_ENAB
LED
Settings.System.putInt(getContentResolver(), Settings.System.ADB_ENABLED, 1);
Unfortunately, that setting was deprecated and moved to a "secure" setting
starting
with Cupcake (i.e. Android 1.5--which is what the nook runs and is why your
efforts
above failed). Unfortunately, only system software (signed with the platform
certificate--not SDK applications) can change these "secure" settings.
See http://groups.google.com/group/android-
discuss/browse_thread/thread/595025c7cd6e6197?pli=1
There must be a way around that. Could we not edit init.rc to tie the
start/stop
procedures to a custom (non-secure) property of our choosing, then set it using
WifiLocker?
There is a suggestion here
http://www.mail-archive.com/android-beginners@googlegroups.com/msg14879.html
that assigning an app the "android.permission.WRITE_SECURE_SETTINGS" may work
but
only if the app is moved into and run from the "system" folder
http://www.mail-archive.com/android-beginners@googlegroups.com/msg17756.html
Original comment by jmc...@gmail.com
on 9 Mar 2010 at 1:09
A better link to the discussion I linked above:
http://groups.google.com/group/android-
beginners/browse_thread/thread/e0cd42df7a097b00
A little but more info with regard to enabling/disbling the GPS (another
setting
made "secure" in 1.5):
http://www.seangri-la.com/cgi-bin/moin.cgi/Enabling_GPS_
(and_other_location_providers)_when_user_has_disabled_them
If that still doesn't work, I think you may be able to take the user to the GUI
settings page that controls whether to start adbd by using the
ACTION_APPLICATION_DEVELOPMENT_SETTINGS activity. I think it is the "USB
Debugging"
option.
Original comment by jmc...@gmail.com
on 9 Mar 2010 at 1:25
Thanks for the details. I'll go thro' it over the weekend.
We already tried the ACTION_APPLICATION_DEVELOPMENT_SETTINGS activity approach
for
enabling non_market apps. This activity is not there in the system for nook.
Original comment by hari.swa...@gmail.com
on 9 Mar 2010 at 2:52
The "install_non_market_apps" setting was made a secure setting in 1.5 also.
So, the same method used for
changing it (i.e. running sqlite commands) should work for the adbd setting.
Of course, the issue is how to do
that programmatically. You can't run a .sh script from an app can you? I
wonder if you could set up a new
service in init.rc to do that...
Original comment by jmc...@gmail.com
on 9 Mar 2010 at 4:01
I tried Runtime.exec and ProcessManager class for executing the scripts. I can
do
stuff like "ls -l" but when I tried to call setprop/start/stop etc, it doesn't
do
anything.
How to you call a service defined in init.rc? it will probably have the same
restrictions. I'll check with stangri in IRC on this. He did the softroot
changes
and must be familiar with it.
Original comment by hari.swa...@gmail.com
on 9 Mar 2010 at 4:12
It works!. I just had to add android:sharedUserId="android.uid.system" in the
manifest file and all the secure settings work. I can also call adb shell
commands
now.
Original comment by hari.swa...@gmail.com
on 9 Mar 2010 at 1:41
Excellent news! Another helpful addition along the same lines would be a
button to
start/stop the VNC server...
Original comment by jmc...@gmail.com
on 10 Mar 2010 at 12:32
Added this in version .3.
Original comment by hari.swa...@gmail.com
on 14 Mar 2010 at 11:07
Original issue reported on code.google.com by
bgalbre...@gmail.com
on 7 Mar 2010 at 6:51