sh 一个简单的bash脚本,通过ADB在Marshmallow +设备上启用演示模式(基于http://bit.ly/295BHLx)

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh 一个简单的bash脚本,通过ADB在Marshmallow +设备上启用演示模式(基于http://bit.ly/295BHLx)相关的知识,希望对你有一定的参考价值。

#!/bin/sh

# License for any modification to the original (linked below):
# ----------------------------------------------------------------------------
# "THE BEER-WARE LICENSE" (Revision 42):
# Sebastiano Poggi wrote this file. As long as you retain 
# this notice you can do whatever you want with this stuff. If we meet some day,
# and you think this stuff is worth it, you can buy us a beer in return.
#
# Based on http://bit.ly/295BHLx

CMD=$1

if [[ $ADB == "" ]]; then
  ADB=adb
fi

if [[ $CMD != "on" && $CMD != "off" ]]; then
  echo "Usage: $0 [on|off] [hhmm]" >&2
  exit
fi

if [[ "$2" != "" ]]; then
  HHMM="$2"
fi

$ADB root || exit
$ADB wait-for-device
$ADB shell settings put global sysui_demo_allowed 1

if [ $CMD == "on" ]; then
  $ADB shell am broadcast -a com.android.systemui.demo -e command enter || exit
  if [[ "$HHMM" != "" ]]; then
    $ADB shell am broadcast -a com.android.systemui.demo -e command clock -e hhmm ${HHMM}
  fi
  $ADB shell am broadcast -a com.android.systemui.demo -e command battery -e plugged false
  $ADB shell am broadcast -a com.android.systemui.demo -e command battery -e level 100
  $ADB shell am broadcast -a com.android.systemui.demo -e command network -e nosim hide
  $ADB shell am broadcast -a com.android.systemui.demo -e command network -e wifi show -e level 4
  $ADB shell am broadcast -a com.android.systemui.demo -e command network -e mobile show -e datatype 4g -e level 4 -e fully true
  $ADB shell am broadcast -a com.android.systemui.demo -e command notifications -e visible false
elif [ $CMD == "off" ]; then
  $ADB shell am broadcast -a com.android.systemui.demo -e command exit
fi

以上是关于sh 一个简单的bash脚本,通过ADB在Marshmallow +设备上启用演示模式(基于http://bit.ly/295BHLx)的主要内容,如果未能解决你的问题,请参考以下文章

sh 一个简单的bash脚本,通过ADB在Marshmallow +设备上启用演示模式(基于http://bit.ly/295BHLx)

sh 一个简单的bash脚本,通过ADB在Marshmallow +设备上启用演示模式(基于http://bit.ly/295BHLx)

sh 一个简单的bash脚本,通过ADB在Marshmallow +设备上启用演示模式(基于http://bit.ly/295BHLx)

sh 一个简单的bash脚本,通过ADB在Marshmallow +设备上启用演示模式(基于http://bit.ly/295BHLx)

sh 一个简单的bash脚本,通过ADB在Marshmallow +设备上启用演示模式(基于http://bit.ly/295BHLx)

sh 一个简单的bash脚本,通过ADB在Marshmallow +设备上启用演示模式(基于http://bit.ly/295BHLx)