gn2bp: try to put all common path operations in one function

This *might* just work. We'll see, I guess.

Test: none
Change-Id: Id78af8f1b1b7bc3b0e253e17c99049c72be49f08
diff --git a/gen_android_bp b/gen_android_bp
index 5ab0d4f..c7ea82a 100755
--- a/gen_android_bp
+++ b/gen_android_bp
@@ -678,9 +678,14 @@
   def _location_tag(self, filename):
     return '$(location %s)' % filename
 
-  # deletes the leading ../../
-  def _rebase_directory(self, filename):
-    return re.sub('^\.\./\.\./', '', filename)
+  # applies common directory transformation that *should* be universally applicable.
+  # TODO: verify if it actually *is* universally applicable.
+  def _sanitize_dir(self, filepath):
+    # Careful, order matters!
+    filepath = re.sub('^\.\./\.\./', '', filepath)
+    filepath = re.sub('^gen/jni_headers', '$(genDir)', filepath)
+    filepath = re.sub('^gen', '$(genDir)', filepath)
+    return filepath
 
   def get_args(self):
     return self.target.args