วันอังคารที่ 28 กรกฎาคม พ.ศ. 2558

adb shell command svc recovery segment


Using adb, I believe it is possible:
am [start|instrument]
am start [-a <action>] [-d ] [-t <mime_type>]
[-c <category> [-c <category>] ...]
[-e <extra_key> <extra_value> [-e <extra_key> <extra_value> ...]
[-n <component>] [-D] [<uri>]
am instrument [-e <arg_name> <arg_value>] [-p <prof_file>]
[-w] <component>
for example we have android program with Manifest as under:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
 package="com.app1.android.xtract">
  <application android:icon="@drawable/icon">
   <activity class=".Contact" android:label="@string/app_name">
    <intent-filter>
    <action android:value="android.intent.action.MAIN" />
    <category android:value="android.intent.category.LAUNCHER" />
   </intent-filter>
  </activity>
 </application>
.
.
</manifest>
To run the code issue command like this (in one line):
am start -a android.intent.action.MAIN -n com.app1.android.xtract/com.app1.android.xtract.Contac
================= Rootless CLI Utilities
Do I have to root my android device to install command line utilities? I would really like to run Vim, among other programs on my phone. I have no reason not to root my phone, I just want to know if this is possible.
The Android Scripting seems to possibly have done this. Do I have to write my own Terminal app to be able to do this?
shareimprove this question

2 Answers

You don't need root. You also don't need a terminal, for an app to use its own private utilities. But if you want vim, Terminal IDE provides that, a number of other utilities (git, ssh, tmux), the ability to use bash or Java as a 'scripting language' at the terminal, and the ability to create and install Android apps on-device. I use Terminal IDE and vim quite a bit, (but with Better Terminal Emulator Pro's terminal, actually.)
shareimprove this answer
   
What's the correct way to run Terminal IDE's bash from "adb shell"? Running it manually "su; /data/data/com.spartacusrex.spartacuside/files/system/bin/bash" leaves a slightly broken env. –  stsquadApr 30 '12 at 16:53
Rooting your phone gives you root access (duh!), but that doesn't mean accessing a shell requires you to root your phone. You can use ADB to connect to your device and gain shell access.
You can also use ConnectBot to access your device's shell on the device itself.
This will give you normal access to your device and you will not be able to run su to gain root access. You can, however, modify and play with files to which you have access.
vim is available without root access, so, so far you still have no reason to root your phone.
shareimprove this answer
====================
You should be able to call the messaging intent with
am start -a android.intent.action.VIEW "sms:numberhere" -e "sms_body" "hello"
Using the intent command as described here:
============================

service list
1|root@android:/ # service list
service list
Found 63 services:
0       phone: [com.android.internal.telephony.ITelephony]
1       iphonesubinfo: [com.android.internal.telephony.IPhoneSubInfo]
2       simphonebook: [com.android.internal.telephony.IIccPhoneBook]
3       isms: [com.android.internal.telephony.ISms]
4       samplingprofiler: []
5       diskstats: []
6       appwidget: [com.android.internal.appwidget.IAppWidgetService]
am start -n android/com.android.server.ShutdownActivity   ปิด
#!/bin/sh
am broadcast android.intent.action.ACTION_SHUTDOWN
sleep(5)
reboot      คำสั่ง reboot
เปิด usb ด้วย am และ ส่ง keyevent 66 2 คร้ง
F:\sdk\platform-tools>adb shell am start -n com.android.systemui/.usb.UsbStorag
Activity
Starting: Intent { cmp=com.android.systemui/.usb.UsbStorageActivity }

F:\sdk\platform-tools>input keyevent 66
'input' is not recognized as an internal or external command,
operable program or batch file.

F:\sdk\platform-tools>adb shell input keyevent 66

F:\sdk\platform-tools>adb shell input keyevent 66
http://android.stackexchange.com/tags/command-line/hot

adb shell setprop sys.usb.config mass_storage   **คำสั่งนี้ ดีกว่า เปิด usb storage ได้
=========

root@android:/ # svc wifi enable
svc wifi enable
root@android:/ # svc wifi disable

root@android:/ # svc
svc
Available commands:
    help     Show information about the subcomma
    power    Control the power manager
    data     Control mobile data connectivity
    wifi     Control the Wi-Fi manager
root@android:/ # svc help

Control the power manager

usage: svc power stayon [true|false|usb|ac]
         Set the 'keep awake while plugged in' setting.


root@android:/ # svc data
svc data
Control mobile data connectivity

usage: svc data [enable|disable]
         Turn mobile data on or off.

       svc data prefer
          Set mobile as the preferred data network

=======================
recovery Segmentation fault
you can try running
$ strace recovery
and see if that gives any information on what is going on.
you can also try
c:/> adb reboot recovery
and see if that allows you to reboot.
shareimprove this answer

ไม่มีความคิดเห็น:

แสดงความคิดเห็น