summaryrefstree
path: root/system/bin/upload_apr
blob: 3a0c29b3b869d8b026584882f087db4b5219cc38 (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

cmd=$1
opt1=$2
opt2=$3

AUTOUPLOAD_ACTION="android.intent.action.ACTION_START"
AUTOUPLOAD_COMPONENT="com.sprd.engineermode/.debuglog.APRService"
REFRESH_ACTION="com.sprd.engineermode.debuglog.refresh_ui"

function usage
{
  echo "Usage: upload_apr enable"
  echo "       upload_apr disable"
  echo "       upload_apr setting <Group> <Detect-time>"
}

if [ "$cmd" = "" ] ; then
  usage
  exit 1
fi

if [ "$cmd" = "enable" ] ; then
  # enable upload apr
  setprop persist.sys.apr.autoupload 1
  am startservice -a $AUTOUPLOAD_ACTION $AUTOUPLOAD_COMPONENT
elif [ "$cmd" = "disable" ] ; then
  # disable upload apr
  setprop persist.sys.apr.autoupload 0
  am stopservice -a $AUTOUPLOAD_ACTION $AUTOUPLOAD_COMPONENT
elif [ "$cmd" = "setting" ] ; then
  # setting upload paramers
  group=$opt1
  time=$opt2

  if [ "$group" = "" ] ; then
    echo "no Group given!!!"
    usage
    exit 1
  fi

  if [ "$time" = "" ] ; then
    echo "no Detect time given!!!"
    usage
    exit 1
  fi

  setprop persist.sys.apr.testgroup $group
  setprop persist.sys.apr.intervaltime $time
  # refresh ui
  am broadcast -a $REFRESH_ACTION
else
  # error
  echo "not support commond!"
  usage
  exit 1
fi