Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(65)

Side by Side Diff: build/android/adb_command_line_functions.sh

Issue 1469143002: Refactor adb_*_command_line helpers bash->python (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review nits Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « build/android/adb_command_line.py ('k') | build/android/adb_content_shell_command_line » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!/bin/bash
2 #
3 # Copyright 2015 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file.
6
7 # Variables must be set before calling:
8 # CMD_LINE_FILE - Path on device to flags file.
9 # REQUIRES_SU - Set to 1 if path requires root.
10 function set_command_line() {
11 SU_CMD=""
12 if [[ "$REQUIRES_SU" = 1 ]]; then
13 # Older androids accept "su -c", while newer use "su uid".
14 SDK_LEVEL=$(adb shell getprop ro.build.version.sdk | tr -d '\r')
15 # E.g. if no device connected.
16 if [[ -z "$SDK_LEVEL" ]]; then
17 exit 1
18 fi
19 SU_CMD="su -c"
20 if (( $SDK_LEVEL >= 21 )); then
21 SU_CMD="su 0"
22 fi
23 fi
24
25 if [ $# -eq 0 ] ; then
26 # If nothing specified, print the command line (stripping off "chrome ")
27 adb shell "cat $CMD_LINE_FILE 2>/dev/null" | cut -d ' ' -s -f2-
28 elif [ $# -eq 1 ] && [ "$1" = '' ] ; then
29 # If given an empty string, delete the command line.
30 set -x
31 adb shell $SU_CMD rm $CMD_LINE_FILE >/dev/null
32 else
33 # Else set it.
34 set -x
35 adb shell "echo 'chrome $*' | $SU_CMD dd of=$CMD_LINE_FILE"
36 # Prevent other apps from modifying flags (this can create security issues).
37 adb shell $SU_CMD chmod 0664 $CMD_LINE_FILE
38 fi
39 }
40
OLDNEW
« no previous file with comments | « build/android/adb_command_line.py ('k') | build/android/adb_content_shell_command_line » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698