summaryrefslogtreecommitdiff
path: root/cmds/svc/svc.sh
blob: a2c9de32b3d0648a6739b5f7a829e24bb015c52a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/system/bin/sh

# `svc wifi` has been migrated to WifiShellCommand,
# simply perform translation to `cmd wifi set-wifi-enabled` here.
if [ "x$1" == "xwifi" ]; then
    # `cmd wifi` by convention uses enabled/disabled
    # instead of enable/disable
    if [ "x$2" == "xenable" ]; then
        exec cmd wifi set-wifi-enabled enabled
    elif [ "x$2" == "xdisable" ]; then
        exec cmd wifi set-wifi-enabled disabled
    else
        echo "Control the Wi-Fi manager"
        echo ""
        echo "usage: svc wifi [enable|disable]"
        echo "         Turn Wi-Fi on or off."
        echo ""
    fi
    exit 1
fi

if [ "x$1" == "xdata" ]; then
    if [ "x$2" == "xenable" ]; then
        exec cmd phone data enable
    elif [ "x$2" == "xdisable" ]; then
        exec cmd phone data disable
    else
        echo "Enable/Disable Mobile Data Connectivity"
        echo ""
        echo "usage: svc data [enable|disable]"
        echo ""
    fi
    exit 1
fi

# `svc bluetooth` has been migrated to BluetoothShellCommand,
# simply perform translation to `cmd bluetooth set-bluetooth-enabled` here.
if [ "x$1" == "xbluetooth" ]; then
    # `cmd wifi` by convention uses enabled/disabled
    # instead of enable/disable
    if [ "x$2" == "xenable" ]; then
        exec cmd bluetooth_manager enable
    elif [ "x$2" == "xdisable" ]; then
        exec cmd bluetooth_manager disable
    else
        echo "Control the Bluetooth manager"
        echo ""
        echo "usage: svc bluetooth [enable|disable]"
        echo "         Turn Bluetooth on or off."
        echo ""
    fi
    exit 1
fi

export CLASSPATH=/system/framework/svc.jar
exec app_process /system/bin com.android.commands.svc.Svc "$@"