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

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

Issue 1153343007: Fix regression in adb_*_command_line commands caused by c481d677 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 months 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/bin/bash 1 #!/bin/bash
2 # 2 #
3 # Copyright 2015 The Chromium Authors. All rights reserved. 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 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 # Variables must be set before calling: 7 # Variables must be set before calling:
8 # CMD_LINE_FILE - Path on device to flags file. 8 # CMD_LINE_FILE - Path on device to flags file.
9 # REQUIRES_SU - Set to 1 if path requires root. 9 # REQUIRES_SU - Set to 1 if path requires root.
10 function set_command_line() { 10 function set_command_line() {
11 SU_CMD="" 11 SU_CMD=""
12 if [[ "$REQUIRES_SU" = 1 ]]; then 12 if [[ "$REQUIRES_SU" = 1 ]]; then
13 # Older androids accept "su -c", while newer use "su uid". 13 # Older androids accept "su -c", while newer use "su uid".
14 SDK_LEVEL=$(adb shell getprop ro.build.version.sdk | tr -d '\r') 14 SDK_LEVEL=$(adb shell getprop ro.build.version.sdk | tr -d '\r')
15 # E.g. if no device connected. 15 # E.g. if no device connected.
16 if [[ -z "$SDK_LEVEL" ]]; then 16 if [[ -z "$SDK_LEVEL" ]]; then
17 exit 1 17 exit 1
18 fi 18 fi
19 SU_CMD="su -c" 19 SU_CMD="su -c"
20 if (( $SDK_LEVEL >= 21 )); then 20 if (( $SDK_LEVEL >= 21 )); then
21 SU_CMD="su 0" 21 SU_CMD="su 0"
22 fi 22 fi
23 fi 23 fi
24 24
25 if [ $# -eq 0 ] ; then 25 if [ $# -eq 0 ] ; then
26 # If nothing specified, print the command line (stripping off "chrome ") 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-" 27 adb shell "cat $CMD_LINE_FILE 2>/dev/null" | cut -d ' ' -s -f2-
jbudorick 2015/06/03 00:25:03 just want to make sure that -f2- behaves like -f "
agrieve 2015/06/03 01:26:30 It does (I didn't touch the cut command)
jbudorick 2015/06/03 02:52:57 just asking because it was -f "2-" prior to your f
28 elif [ $# -eq 1 ] && [ "$1" = '' ] ; then 28 elif [ $# -eq 1 ] && [ "$1" = '' ] ; then
29 # If given an empty string, delete the command line. 29 # If given an empty string, delete the command line.
30 set -x 30 set -x
31 adb shell $SU_CMD rm $CMD_LINE_FILE >/dev/null 31 adb shell $SU_CMD rm $CMD_LINE_FILE >/dev/null
32 else 32 else
33 # Else set it. 33 # Else set it.
34 set -x 34 set -x
35 adb shell "echo 'chrome $*' | $SU_CMD dd of=$CMD_LINE_FILE" 35 adb shell "echo 'chrome $*' | $SU_CMD dd of=$CMD_LINE_FILE"
36 # Prevent other apps from modifying flags (this can create security issues). 36 # Prevent other apps from modifying flags (this can create security issues).
37 adb shell $SU_CMD chmod 0664 $CMD_LINE_FILE 37 adb shell $SU_CMD chmod 0664 $CMD_LINE_FILE
38 fi 38 fi
39 } 39 }
40 40
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698