Update mainline reminder hooks

Changing the emphasis in these hooks to be more advisory.
Update list of mainline directories within frameworks/av/.

Bug: 157501573
Test: repo upload in several branches
Change-Id: I2a4f6ee4d204797de53c08887743130f2514de32
diff --git a/tools/mainline_hook.sh b/tools/mainline_hook.sh
deleted file mode 100755
index 58afb49..0000000
--- a/tools/mainline_hook.sh
+++ /dev/null
@@ -1,84 +0,0 @@
-#!/bin/bash
-LOCAL_DIR="$( dirname "${BASH_SOURCE}" )"
-
-MAINLINE_FRAMEWORKS_AV_PATHS=(
-    media/extractors/
-    media/codec2/components/
-    media/libstagefright/codecs/amrnb
-    media/libstagefright/codecs/amrwb
-    media/libstagefright/codecs/amrwbenc
-    media/libstagefright/codecs/common
-    media/libstagefright/codecs/mp3dec
-    media/libstagefright/codecs/m4v_h263
-    media/libstagefright/flac/dec
-    media/libstagefright/mpeg2ts
-)
-
-MAINLINE_EXTERNAL_PROJECTS=(
-    external/aac
-    external/flac
-    external/libaac
-    external/libaom
-    external/libavc
-    external/libgav1
-    external/libgsm
-    external/libhevc
-    external/libmpeg2
-    external/libopus
-    external/libvpx
-    external/libxaac
-    external/sonivox
-    external/tremolo
-)
-
-DEV_BRANCH=qt-aml-media-dev
-RED=$(tput setaf 1)
-NORMAL=$(tput sgr0)
-WARNING_FULL="${RED}Please upload this change in ${DEV_BRANCH} unless it is restricted
-from mainline release until next dessert release. Low/moderate security bugs
-are restricted this way.${NORMAL}"
-WARNING_PARTIAL="${RED}It looks like your change has mainline and non-mainline changes;
-Consider separating them into two separate CLs -- one for mainline files,
-one for non-mainline files.${NORMAL}"
-PWD=`pwd`
-
-if git branch -vv | grep -q -P "^\*[^\[]+\[goog/qt-aml-media-dev"; then
-    # Change appears to be in mainline dev branch
-    exit 0
-fi
-
-for path in "${MAINLINE_EXTERNAL_PROJECTS[@]}"; do
-    if [[ $PWD =~ $path ]]; then
-        echo -e "${RED}The source of truth for '$path' is in ${DEV_BRANCH}.${NORMAL}"
-        echo -e ${WARNING_FULL}
-        exit 1
-    fi
-done
-
-if [[ ! $PWD =~ frameworks/av ]]; then
-    exit 0
-fi
-
-mainline_count=0
-total_count=0
-echo
-while read -r file ; do
-    (( total_count++ ))
-    for path in "${MAINLINE_FRAMEWORKS_AV_PATHS[@]}"; do
-        if [[ $file =~ ^$path ]]; then
-            echo -e "${RED}The source of truth for '$file' is in ${DEV_BRANCH}.${NORMAL}"
-            (( mainline_count++ ))
-            break
-        fi
-    done
-done < <(git show --name-only --pretty=format: $1 | grep -- "$2")
-
-if (( mainline_count != 0 )); then
-    if (( mainline_count == total_count )); then
-        echo -e ${WARNING_FULL}
-    else
-        echo -e ${WARNING_PARTIAL}
-    fi
-    exit 1
-fi
-exit 0
diff --git a/tools/mainline_hook_partial.sh b/tools/mainline_hook_partial.sh
index 3dc6163..74c8ebd 100755
--- a/tools/mainline_hook_partial.sh
+++ b/tools/mainline_hook_partial.sh
@@ -35,7 +35,8 @@
 
 ## tunables:
 ##
-DEV_BRANCH=rvc-dev
+DEV_BRANCH=master
+MAINLINE_BRANCH=mainline-prod
 filelist_file=MainlineFiles.cfg
 
 ###
@@ -50,8 +51,9 @@
 ## get the active branch:
 ## * <localbranch> <shainfo> [goog/master] Fix to handle missing checks on error returned
 ## strip this down to "master"
+## * b157501573_advisory 25521834a6 [goog/sc-dev] Merge "PlayerBase: add audio session ID" into sc-dev
 ##
-current=`git branch -vv | grep -P "^\*[^\[]+\[goog/"|sed -e 's/^.*\[//' | sed -e 's/:.*$//'| sed -e 's/^goog\///'`
+current=`git branch -vv | grep -P "^\*[^\[]+\[goog/"|sed -e 's/^.*\[//' | sed -e 's/\].*$//'|sed -e 's/:.*$//'| sed -e 's/^goog\///'`
 if [ "${current}" = "" ] ; then
         current=unknown
 fi
@@ -142,12 +144,36 @@
     exit 0
 fi
 
+#
+# exit 0 is "all good, no output passed along to user"
+# exit 77 is "a warning, pass along the output to the user"
+# exit 1 will be a failure.
+#
 result=0
+
+# simple reminder that it should also land in mainline branch
+#
+if [ "${current}" != "${MAINLINE_BRANCH}" ] ; then
+        # simple reminder to ensure it hits mainline
+        result=77
+        cat - <<EOF
+You are uploading repo  ${RED}${REPO_PATH}${NORMAL} to branch ${RED}${current}${NORMAL}.
+The mainline branch for ${RED}${REPO_PATH}${NORMAL} is branch ${RED}${MAINLINE_BRANCH}${NORMAL}.
+
+Ensure an appropriate cherry pick or equivalent lands in branch ${RED}${MAINLINE_BRANCH}${NORMAL}.
+Security bulletin timing or unreleased functionality may drive when this can be landed.
+EOF
+fi
+
+# watch for the mixed some mainline / some not CL
+# we usually want to reject such mixed CLs
+#
+
 if [ ! -z "${mainline_no}" ] ; then
         # mixed bag, suggest (not insist) that developer split them.
         result=1
         cat - <<EOF
-This CL contains files contains both mainline and non-mainline files.  Consider separating
+This change contains both mainline and non-mainline files.  Please separate
 them into separate CLs. It may also be appropriate to update the list of mainline
 files in ${RED}${REPO_ROOT}/${filelist_file}${NORMAL}.
 
@@ -162,33 +188,6 @@
         echo ${mainline_no} | sed -e 's/ /
/g'
         echo -e ${NORMAL}
 
-fi
-
-if [ "${current}" != "${DEV_BRANCH}" ] ; then
-    # Change is not in the desired mainline dev branch
-    result=1
-
-    #echo -e "${RED}"
-    cat - <<EOF
-
-You are uploading repo  ${RED}${REPO_PATH}${NORMAL} to branch ${RED}${current}${NORMAL}. 
-The source of truth for ${RED}${REPO_PATH}${NORMAL} is branch ${RED}${DEV_BRANCH}${NORMAL}. 
-
-Please upload this change to branch ${RED}${DEV_BRANCH}${NORMAL} unless one or more of
-the following apply:
-- this is a security bug prohibited from disclosure before the next dessert release.
-  (moderate security bugs fall into this category).
-- this is new functionality prohibitied from disclosure before the next dessert release.
-EOF
-    #echo -e "${NORMAL}"
-
-fi
-
-## since stdout is buffered in a way that complicates the below, we're just going
-## to tell the user what they can do to get around this check instead of asking them
-## as part of this run of the command.
-
-if [ ${result} != 0 ] ; then
     cat - <<EOF
 
 If you are sure you want to proceed uploading to branch ${RED}${current}${NORMAL},
@@ -196,5 +195,11 @@
 
 EOF
 fi
+
+# result will be:
+# 0: all good, no output passed to user
+# 77: warnings (but we pass), output passed along to user
+# else: failure, output passed along to the user
+
 exit ${result}
 
diff --git a/tools/mainline_hook_project.sh b/tools/mainline_hook_project.sh
index 8d35470..e432000 100755
--- a/tools/mainline_hook_project.sh
+++ b/tools/mainline_hook_project.sh
@@ -16,7 +16,8 @@
 
 
 # tunables
-DEV_BRANCH=rvc-dev
+DEV_BRANCH=master
+MAINLINE_BRANCH=mainline-prod
 
 ###
 RED=$(tput setaf 1)
@@ -25,41 +26,27 @@
 ## check the active branch:
 ## * b131183694 d198c6a [goog/master] Fix to handle missing checks on error returned
 ##
-current=`git branch -vv | grep -P "^\*[^\[]+\[goog/"|sed -e 's/^.*\[//' | sed -e 's/:.*$//'| sed -e 's/^goog\///'`
+current=`git branch -vv | grep -P "^\*[^\[]+\[goog/"|sed -e 's/^.*\[//' | sed -e 's/\].*$//'|sed -e 's/:.*$//'| sed -e 's/^goog\///'`
 if [ "${current}" = "" ] ; then
         current=unknown
 fi
 
-if [ "${current}" = "${DEV_BRANCH}" ] ; then
-    # Change appears to be in mainline dev branch
-    exit 0
+# simple reminder that it should also land in mainline branch
+#
+if [ "${current}" != "${MAINLINE_BRANCH}" ] ; then
+        # simple reminder to ensure it hits mainline
+        cat - <<EOF
+You are uploading repo  ${RED}${REPO_PATH}${NORMAL} to branch ${RED}${current}${NORMAL}.
+The mainline branch for ${RED}${REPO_PATH}${NORMAL} is branch ${RED}${MAINLINE_BRANCH}${NORMAL}.
+
+Ensure an appropriate cherry pick or equivalent lands in branch ${RED}${MAINLINE_BRANCH}${NORMAL}.
+Security bulletin timing or unreleased functionality may determine when that can be landed.
+
+EOF
 fi
 
-## warn the user that about not being on the typical/desired branch.
-
-cat - <<EOF
-
-You are uploading repo  ${RED}${REPO_PATH}${NORMAL} to branch ${RED}${current}${NORMAL}. 
-The source of truth for ${RED}${REPO_PATH}${NORMAL} is branch ${RED}${DEV_BRANCH}${NORMAL}. 
-
-Please upload this change to branch ${RED}${DEV_BRANCH}${NORMAL} unless one or more of
-the following apply:
-- this is a security bug prohibited from disclosure before the next dessert release.
-  (moderate security bugs fall into this category).
-- this is new functionality prohibitied from disclosure before the next dessert release.
-EOF
-
-
-##
-## TODO: prompt the user y/n to continue right now instead of re-invoking with no-verify
-## this has to get around how repo buffers stdout from this script such that the output
-## is not flushed before we try to read the input.
-## 
-
-cat - <<EOF
-If you are sure you want to proceed uploading to branch ${RED}${current}${NORMAL},
-re-run your repo upload command with the '--no-verify' option
-
-EOF
-exit 1
+# exit 0 is "all good, no output passed along to user"
+# exit 77 is "all ok, but output is passed along to the user"
+#
+exit 77