gn2bp: Add helper function to get condition for arch

This function return the condition which can be used within the cmd in
the cc_genrule

Test: ./update_results.sh
Change-Id: Ib36bfed7f37a8d86d2dddd12c4fca31477ebd6ee
diff --git a/tools/gn2bp/gen_android_bp b/tools/gn2bp/gen_android_bp
index 081ac61..3e89efd 100755
--- a/tools/gn2bp/gen_android_bp
+++ b/tools/gn2bp/gen_android_bp
@@ -1110,6 +1110,23 @@
   blueprint.add_module(module)
   return module
 
+def get_cmd_condition(arch):
+  '''
+  :param arch: archtecture name e.g. android_x86_64, android_arm64
+  :return: condition that can be used in cc_genrule cmd to switch the behavior based on arch
+  '''
+  if arch == "android_x86_64":
+    return "( $$CC_ARCH == 'x86_64' && $$CC_OS == 'android' )"
+  elif arch == "android_x86":
+    return "( $$CC_ARCH == 'x86' && $$CC_OS == 'android' )"
+  elif arch == "android_arm":
+    return "( $$CC_ARCH == 'arm' && $$CC_OS == 'android' )"
+  elif arch == "android_arm64":
+    return "( $$CC_ARCH == 'arm64' && $$CC_OS == 'android' )"
+  elif arch == "host":
+    return "$$CC_OS != 'android'"
+  else:
+    raise Error(f'Unknown architecture type {arch}')
 
 
 def _get_cflags(cflags, defines):