Merge "Small build and lint-required fixes"
diff --git a/build.gradle b/build.gradle
index 53d23e2..338199d 100644
--- a/build.gradle
+++ b/build.gradle
@@ -121,7 +121,9 @@
                 new SampleFolder(joinPath('src', 'tuningfork', 'proto')).include('tuningfork.proto'))
 
 def memoryAdviceNativeLibrary = new NativeLibrary(versions['memory_advice'])
-    .setUsesTensorflow()
+        .setUsesTensorflow()
+        .setMinimumNdkVersion(20)
+        .setAssetsDirectory("test/memoryadvice/memoryadvice/src/main/resources")
 
 def oboeNativeLibrary = new NativeLibrary(versions['oboe'])
         .setThirdParty()
@@ -337,6 +339,7 @@
     def buildKey = buildInfo.buildKey
     def cmakeFolder = joinPath(getTempPath(), buildKey, '.cmake', libraryName)
     def buildFolder = prefabBuildFolder(outFolder)
+    def assetsFolder = joinPath(buildFolder, 'assets')
     def prefabRoot = prefabDir(outFolder, libraryName)
     def sharedLibBuildFolder = joinPath(prefabRoot, 'libs',
             'android.' + buildKey)
@@ -424,6 +427,15 @@
         def jsonStaticModuleDescription = new File(joinPath(buildFolder, 'prefab', 'modules', libraryName + '_static', 'module.json'))
         jsonStaticModuleDescription.text = '{"library_name": "lib' + libraryName + '", "export_libraries": []}'
     }
+    // 6. Create assets folder
+    if (library.getAssetsDirectory() != null) {
+        copy {
+            from file(library.getAssetsDirectory())
+            include "*.*"
+            into file(assetsFolder)
+            includeEmptyDirs = false
+        }
+    }
 }
 
 def deleteDir(File dir) {
diff --git a/buildSrc/src/main/java/com/google/androidgamesdk/NativeLibrary.kt b/buildSrc/src/main/java/com/google/androidgamesdk/NativeLibrary.kt
index ac6db3b..a5746fa 100644
--- a/buildSrc/src/main/java/com/google/androidgamesdk/NativeLibrary.kt
+++ b/buildSrc/src/main/java/com/google/androidgamesdk/NativeLibrary.kt
@@ -31,6 +31,8 @@
         private set
     var usesTensorflow = false
         private set
+    var assetsDirectory: String? = null
+        private set
 
     fun addSampleAndroidProject(
         sampleAndroidProject: ExternalAndroidProject
@@ -86,6 +88,13 @@
         return this
     }
 
+    fun setAssetsDirectory(
+      assetsDirectory: String?
+    ): NativeLibrary {
+      this.assetsDirectory = assetsDirectory
+      return this
+    }
+
     data class SampleFolder(
         val sourcePath: String,
         val destinationPath: String
diff --git a/samples/agdktunnel/app/src/main/assets/tuningfork/dev_tuningfork.proto b/samples/agdktunnel/app/src/main/assets/tuningfork/dev_tuningfork.proto
index 66b84d4..ad48a35 100644
--- a/samples/agdktunnel/app/src/main/assets/tuningfork/dev_tuningfork.proto
+++ b/samples/agdktunnel/app/src/main/assets/tuningfork/dev_tuningfork.proto
@@ -1,7 +1,31 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 syntax = "proto3";
 
 package com.google.tuningfork;
 
+/*
+   Protocol buffer defines for our Android Performance Tuner messages.
+   Specific fidelity parameter configurations are defined in:
+      dev_tuningfork_fidelityparams_1.txt
+      dev_tuningfork_fidelityparams_2.txt
+   General settings for Android Performance Tuner initialization are defined in:
+      tuningfork_settings.txt
+*/
+
 enum InstrumentKey {
   CPU = 0;
   GPU = 1;
diff --git a/samples/agdktunnel/app/src/main/cpp/android_main.cpp b/samples/agdktunnel/app/src/main/cpp/android_main.cpp
index a4f9622..8f12d06 100644
--- a/samples/agdktunnel/app/src/main/cpp/android_main.cpp
+++ b/samples/agdktunnel/app/src/main/cpp/android_main.cpp
@@ -18,12 +18,16 @@
 #include "native_engine.hpp"
 
 extern "C" {
-void android_main(struct android_app *state);
+    void android_main(struct android_app *app);
 };
 
+/*
+    android_main (not main) is our game entry function, it is called from
+    the native app glue utility code as part of the onCreate handler.
+*/
+
 void android_main(struct android_app *app) {
     NativeEngine *engine = new NativeEngine(app);
     engine->GameLoop();
     delete engine;
 }
-
diff --git a/samples/agdktunnel/app/src/main/cpp/anim.cpp b/samples/agdktunnel/app/src/main/cpp/anim.cpp
index abb938b..114f688 100644
--- a/samples/agdktunnel/app/src/main/cpp/anim.cpp
+++ b/samples/agdktunnel/app/src/main/cpp/anim.cpp
@@ -49,4 +49,3 @@
         }
     }
 }
-
diff --git a/samples/agdktunnel/app/src/main/cpp/anim.hpp b/samples/agdktunnel/app/src/main/cpp/anim.hpp
index f4df7cd..5218ff9 100644
--- a/samples/agdktunnel/app/src/main/cpp/anim.hpp
+++ b/samples/agdktunnel/app/src/main/cpp/anim.hpp
@@ -24,4 +24,3 @@
 void RenderBackgroundAnimation(ShapeRenderer *r);
 
 #endif
-
diff --git a/samples/agdktunnel/app/src/main/cpp/ascii_to_geom.cpp b/samples/agdktunnel/app/src/main/cpp/ascii_to_geom.cpp
index af6ff4a..20f1def 100644
--- a/samples/agdktunnel/app/src/main/cpp/ascii_to_geom.cpp
+++ b/samples/agdktunnel/app/src/main/cpp/ascii_to_geom.cpp
@@ -17,12 +17,11 @@
 #include "ascii_to_geom.hpp"
 
 #define GEOM_DEBUG ALOGI
-//#define GEOM_DEBUG
 
 SimpleGeom *AsciiArtToGeom(const char *art, float scale) {
     // figure out width and height
     ALOGI("Creating geometry from ASCII art.");
-            GEOM_DEBUG("Ascii art source:\n%s", art);
+    GEOM_DEBUG("Ascii art source:\n%s", art);
     int rows = 1;
     int curCols = 0, cols = 0;
     int r, c;
@@ -37,8 +36,8 @@
         }
     }
 
-            GEOM_DEBUG("Ascii art has %d rows, %d cols.", rows, cols);
-            GEOM_DEBUG("Making working array.");
+    GEOM_DEBUG("Ascii art has %d rows, %d cols.", rows, cols);
+    GEOM_DEBUG("Making working array.");
 
     // allocate a rows x cols array that we will use as working space
     unsigned int **v = new unsigned int *[rows];
@@ -59,7 +58,7 @@
         }
     }
 
-            GEOM_DEBUG("Removing redundant line markers.");
+    GEOM_DEBUG("Removing redundant line markers.");
 
     // remove redundant line markers
     for (r = 0; r < rows; r++) {
@@ -92,7 +91,7 @@
         }
     }
 
-            GEOM_DEBUG("Total vertices: %d, total indices %d", vertices, indices);
+    GEOM_DEBUG("Total vertices: %d, total indices %d", vertices, indices);
 
     // allocate arrays for the vertices and lines
     const int VERTICES_STRIDE = sizeof(GLfloat) * 7;
@@ -114,7 +113,7 @@
         for (c = 0; c < cols; c++) {
             unsigned t = v[r][c];
             if (t == '+') {
-                        GEOM_DEBUG("Found vertex at %d,%d, index %d", r, c, vertices);
+                GEOM_DEBUG("Found vertex at %d,%d, index %d", r, c, vertices);
                 verticesArray[vertices * 7] = left + c * scale;
                 verticesArray[vertices * 7 + 1] = top - r * scale;
                 verticesArray[vertices * 7 + 2] = 0.0f; // z coord is always 0
@@ -133,25 +132,25 @@
     int col_dir, row_dir;
     int start_c, start_r, end_c, end_r;
 
-            GEOM_DEBUG("Now processing lines.");
+    GEOM_DEBUG("Now processing lines.");
     for (r = 0; r < rows; r++) {
         for (c = 0; c < cols; c++) {
             int t = v[r][c];
             if (t == '-') {
                 // horizontal line
-                        GEOM_DEBUG("Horizontal line found at %d,%d", r, c);
+                GEOM_DEBUG("Horizontal line found at %d,%d", r, c);
                 col_dir = -1, row_dir = 0;
             } else if (t == '|') {
                 // vertical line
-                        GEOM_DEBUG("Vertical line found at %d,%d", r, c);
+                GEOM_DEBUG("Vertical line found at %d,%d", r, c);
                 col_dir = 0, row_dir = -1;
             } else if (t == '`') {
                 // horizontal line, slanting down
-                        GEOM_DEBUG("Downward diagonal line found at %d,%d", r, c);
+                GEOM_DEBUG("Downward diagonal line found at %d,%d", r, c);
                 col_dir = -1, row_dir = -1;
             } else if (t == '/') {
                 // horizontal line, slanting down
-                        GEOM_DEBUG("Upward diagonal line found at %d,%d", r, c);
+                GEOM_DEBUG("Upward diagonal line found at %d,%d", r, c);
                 col_dir = -1, row_dir = 1;
             } else {
                 continue;
@@ -168,8 +167,8 @@
                     ABORT_GAME;
                 }
             }
-                    GEOM_DEBUG("Start vertex is at %d,%d, index %d", start_r, start_c,
-                               v[start_r][start_c] & VERTEX_INDEX_MASK);
+            GEOM_DEBUG("Start vertex is at %d,%d, index %d", start_r, start_c,
+                    v[start_r][start_c] & VERTEX_INDEX_MASK);
 
             // look for the vertex that ends the line
             end_c = c;
@@ -183,17 +182,17 @@
                 }
             }
 
-                    GEOM_DEBUG("End vertex is at %d,%d, index %d", end_r, end_c,
-                               v[end_r][end_c] & VERTEX_INDEX_MASK);
+            GEOM_DEBUG("End vertex is at %d,%d, index %d", end_r, end_c,
+                    v[end_r][end_c] & VERTEX_INDEX_MASK);
 
             indicesArray[indices] = static_cast<GLushort>(v[start_r][start_c] & VERTEX_INDEX_MASK);
             indicesArray[indices + 1] = static_cast<GLushort>(v[end_r][end_c] & VERTEX_INDEX_MASK);
             indices += 2;
-                    GEOM_DEBUG("We now have %d indices.", indices);
+            GEOM_DEBUG("We now have %d indices.", indices);
         }
     }
 
-            GEOM_DEBUG("Deallocating working space.");
+    GEOM_DEBUG("Deallocating working space.");
     // get rid of the working arrays
     for (r = 0; r < rows; r++) {
         delete v[r];
@@ -201,21 +200,21 @@
     delete[] v;
 
     for (int i = 0; i < indices; i++) {
-                GEOM_DEBUG("indices[%d] = %d\n", i, indicesArray[i]);
+        GEOM_DEBUG("indices[%d] = %d\n", i, indicesArray[i]);
     }
     for (int i = 0; i < vertices; i++) {
-                GEOM_DEBUG("vertices[%d]", i * 7);
+        GEOM_DEBUG("vertices[%d]", i * 7);
         for (int j = 0; j < 7; j++) {
-                    GEOM_DEBUG("vertices[%d+%d=%d] = %f\n", i * 7, j, i * 7 + j,
-                               verticesArray[i * 7 + j]);
+            GEOM_DEBUG("vertices[%d+%d=%d] = %f\n", i * 7, j, i * 7 + j,
+                    verticesArray[i * 7 + j]);
         }
     }
 
     // create the buffers
-            GEOM_DEBUG("Creating output VBO (%d vertices) and IBO (%d indices).", vertices,
-                       indices);
+    GEOM_DEBUG("Creating output VBO (%d vertices) and IBO (%d indices).", vertices,
+            indices);
     SimpleGeom *out = new SimpleGeom(new VertexBuf(verticesArray, vertices * sizeof(GLfloat) *
-                                                   VERTICES_STRIDE, VERTICES_STRIDE),
+                                                                  VERTICES_STRIDE, VERTICES_STRIDE),
                                      new IndexBuf(indicesArray, indices *
                                                                 sizeof(GLushort)));
     out->vbuf->SetPrimitive(GL_LINES);  // draw as lines
@@ -231,4 +230,3 @@
 
     return out;
 }
-
diff --git a/samples/agdktunnel/app/src/main/cpp/ascii_to_geom.hpp b/samples/agdktunnel/app/src/main/cpp/ascii_to_geom.hpp
index d5c4b2e..ee6984d 100644
--- a/samples/agdktunnel/app/src/main/cpp/ascii_to_geom.hpp
+++ b/samples/agdktunnel/app/src/main/cpp/ascii_to_geom.hpp
@@ -40,4 +40,3 @@
 SimpleGeom *AsciiArtToGeom(const char *art, float scale);
 
 #endif
-
diff --git a/samples/agdktunnel/app/src/main/cpp/common.hpp b/samples/agdktunnel/app/src/main/cpp/common.hpp
index 8d3c202..4856b78 100644
--- a/samples/agdktunnel/app/src/main/cpp/common.hpp
+++ b/samples/agdktunnel/app/src/main/cpp/common.hpp
@@ -32,7 +32,9 @@
 #include "glm/gtc/matrix_transform.hpp"
 
 #define LOG_TAG "AGDKTunnel"
+
 #include "Log.h"
+
 #define ABORT_GAME { ALOGE("*** GAME ABORTING."); *((volatile char*)0) = 'a'; }
 #define DEBUG_BLIP ALOGI("[ BLIP ]: %s:%d", __FILE__, __LINE__)
 
@@ -44,4 +46,3 @@
 #include "our_key_codes.hpp"
 
 #endif
-
diff --git a/samples/agdktunnel/app/src/main/cpp/dialog_scene.cpp b/samples/agdktunnel/app/src/main/cpp/dialog_scene.cpp
index bb169af..ef74a1e 100644
--- a/samples/agdktunnel/app/src/main/cpp/dialog_scene.cpp
+++ b/samples/agdktunnel/app/src/main/cpp/dialog_scene.cpp
@@ -152,4 +152,3 @@
             break;
     }
 }
-
diff --git a/samples/agdktunnel/app/src/main/cpp/dialog_scene.hpp b/samples/agdktunnel/app/src/main/cpp/dialog_scene.hpp
index 3245c11..d059213 100644
--- a/samples/agdktunnel/app/src/main/cpp/dialog_scene.hpp
+++ b/samples/agdktunnel/app/src/main/cpp/dialog_scene.hpp
@@ -94,4 +94,3 @@
 };
 
 #endif
-
diff --git a/samples/agdktunnel/app/src/main/cpp/game_asset_manager.cpp b/samples/agdktunnel/app/src/main/cpp/game_asset_manager.cpp
index ac88d10..458d71c 100644
--- a/samples/agdktunnel/app/src/main/cpp/game_asset_manager.cpp
+++ b/samples/agdktunnel/app/src/main/cpp/game_asset_manager.cpp
@@ -22,6 +22,7 @@
 #include "common.hpp"
 #include "game_asset_manager.hpp"
 #include "game_asset_manifest.hpp"
+
 #if !defined(NO_ASSET_PACKS)
 #include "play/asset_pack.h"
 #endif
diff --git a/samples/agdktunnel/app/src/main/cpp/game_asset_manager.hpp b/samples/agdktunnel/app/src/main/cpp/game_asset_manager.hpp
index ac7f486..d6ed00b 100644
--- a/samples/agdktunnel/app/src/main/cpp/game_asset_manager.hpp
+++ b/samples/agdktunnel/app/src/main/cpp/game_asset_manager.hpp
@@ -143,4 +143,4 @@
     GameAssetManagerInternals *mInternals;
 };
 
-#endif
\ No newline at end of file
+#endif
diff --git a/samples/agdktunnel/app/src/main/cpp/game_asset_manifest.hpp b/samples/agdktunnel/app/src/main/cpp/game_asset_manifest.hpp
index dd708ee..be3a4b0 100644
--- a/samples/agdktunnel/app/src/main/cpp/game_asset_manifest.hpp
+++ b/samples/agdktunnel/app/src/main/cpp/game_asset_manifest.hpp
@@ -61,4 +61,4 @@
     const AssetPackDefinition *AssetManifest_GetAssetPackDefinitions();
 }
 
-#endif
\ No newline at end of file
+#endif
diff --git a/samples/agdktunnel/app/src/main/cpp/game_consts.hpp b/samples/agdktunnel/app/src/main/cpp/game_consts.hpp
index 8b13118..0b9bfa3 100644
--- a/samples/agdktunnel/app/src/main/cpp/game_consts.hpp
+++ b/samples/agdktunnel/app/src/main/cpp/game_consts.hpp
@@ -159,4 +159,3 @@
 #define LEVELS_PER_CHECKPOINT 4
 
 #endif
-
diff --git a/samples/agdktunnel/app/src/main/cpp/indexbuf.cpp b/samples/agdktunnel/app/src/main/cpp/indexbuf.cpp
index 2e850d0..42c232b 100644
--- a/samples/agdktunnel/app/src/main/cpp/indexbuf.cpp
+++ b/samples/agdktunnel/app/src/main/cpp/indexbuf.cpp
@@ -37,4 +37,3 @@
 void IndexBuf::UnbindBuffer() {
     glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
 }
-
diff --git a/samples/agdktunnel/app/src/main/cpp/indexbuf.hpp b/samples/agdktunnel/app/src/main/cpp/indexbuf.hpp
index 2e8e722..d5a72f9 100644
--- a/samples/agdktunnel/app/src/main/cpp/indexbuf.hpp
+++ b/samples/agdktunnel/app/src/main/cpp/indexbuf.hpp
@@ -38,4 +38,3 @@
 };
 
 #endif
-
diff --git a/samples/agdktunnel/app/src/main/cpp/input_util.cpp b/samples/agdktunnel/app/src/main/cpp/input_util.cpp
index 53d949f..0f6935d 100644
--- a/samples/agdktunnel/app/src/main/cpp/input_util.cpp
+++ b/samples/agdktunnel/app/src/main/cpp/input_util.cpp
@@ -94,17 +94,17 @@
         int action = motionEvent->action;
         int actionMasked = action & AMOTION_EVENT_ACTION_MASK;
         int ptrIndex = (action & AMOTION_EVENT_ACTION_POINTER_INDEX_MASK) >>
-                AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT;
+                                 AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT;
 
         if (ptrIndex < motionEvent->pointerCount) {
             struct CookedEvent ev;
             memset(&ev, 0, sizeof(ev));
 
-            if (actionMasked == AMOTION_EVENT_ACTION_DOWN || actionMasked ==
-                    AMOTION_EVENT_ACTION_POINTER_DOWN) {
+            if (actionMasked == AMOTION_EVENT_ACTION_DOWN ||
+                actionMasked == AMOTION_EVENT_ACTION_POINTER_DOWN) {
                 ev.type = COOKED_EVENT_TYPE_POINTER_DOWN;
-            } else if (actionMasked == AMOTION_EVENT_ACTION_UP || actionMasked ==
-                    AMOTION_EVENT_ACTION_POINTER_UP) {
+            } else if (actionMasked == AMOTION_EVENT_ACTION_UP ||
+                       actionMasked == AMOTION_EVENT_ACTION_POINTER_UP) {
                 ev.type = COOKED_EVENT_TYPE_POINTER_UP;
             } else {
                 ev.type = COOKED_EVENT_TYPE_POINTER_MOVE;
@@ -158,6 +158,3 @@
     }
     return (addedControllerEvent != 0);
 }
-
-
-
diff --git a/samples/agdktunnel/app/src/main/cpp/input_util.hpp b/samples/agdktunnel/app/src/main/cpp/input_util.hpp
index 6aa6beb..99f82ad 100644
--- a/samples/agdktunnel/app/src/main/cpp/input_util.hpp
+++ b/samples/agdktunnel/app/src/main/cpp/input_util.hpp
@@ -60,4 +60,3 @@
 bool CookGameControllerEvent(const int32_t gameControllerIndex, CookedEventCallback callback);
 
 #endif
-
diff --git a/samples/agdktunnel/app/src/main/cpp/jni_util.cpp b/samples/agdktunnel/app/src/main/cpp/jni_util.cpp
index 4e62c5d..5d48f93 100644
--- a/samples/agdktunnel/app/src/main/cpp/jni_util.cpp
+++ b/samples/agdktunnel/app/src/main/cpp/jni_util.cpp
@@ -28,5 +28,3 @@
     }
     return &_jni_setup;
 }
-
-
diff --git a/samples/agdktunnel/app/src/main/cpp/jni_util.hpp b/samples/agdktunnel/app/src/main/cpp/jni_util.hpp
index f4b0d5b..de60652 100644
--- a/samples/agdktunnel/app/src/main/cpp/jni_util.hpp
+++ b/samples/agdktunnel/app/src/main/cpp/jni_util.hpp
@@ -27,4 +27,3 @@
 struct JniSetup *GetJNISetup();
 
 #endif
-
diff --git a/samples/agdktunnel/app/src/main/cpp/joystick-support.hpp b/samples/agdktunnel/app/src/main/cpp/joystick-support.hpp
index 6de1fc2..9d20eb5 100644
--- a/samples/agdktunnel/app/src/main/cpp/joystick-support.hpp
+++ b/samples/agdktunnel/app/src/main/cpp/joystick-support.hpp
@@ -31,4 +31,3 @@
 static const int SOURCE_TOUCH_NAVIGATION = 0x00200000;
 
 #endif
-
diff --git a/samples/agdktunnel/app/src/main/cpp/loader_scene.hpp b/samples/agdktunnel/app/src/main/cpp/loader_scene.hpp
index 4ab6840..9c09966 100644
--- a/samples/agdktunnel/app/src/main/cpp/loader_scene.hpp
+++ b/samples/agdktunnel/app/src/main/cpp/loader_scene.hpp
@@ -58,4 +58,3 @@
 };
 
 #endif
-
diff --git a/samples/agdktunnel/app/src/main/cpp/native_engine.cpp b/samples/agdktunnel/app/src/main/cpp/native_engine.cpp
index cc35e8d..8e62d6e 100644
--- a/samples/agdktunnel/app/src/main/cpp/native_engine.cpp
+++ b/samples/agdktunnel/app/src/main/cpp/native_engine.cpp
@@ -319,7 +319,7 @@
                 }
             }
             VLOGD("HandleCommand(%d): hasWindow = %d, hasFocus = %d", cmd,
-                          mHasWindow ? 1 : 0, mHasFocus ? 1 : 0);
+                  mHasWindow ? 1 : 0, mHasFocus ? 1 : 0);
             break;
         case APP_CMD_TERM_WINDOW:
             // The window is going away -- kill the surface
@@ -396,9 +396,9 @@
             break;
     }
 
-            VLOGD("NativeEngine: STATUS: F%d, V%d, W%d, EGL: D %p, S %p, CTX %p, CFG %p",
-                  mHasFocus, mIsVisible, mHasWindow, mEglDisplay, mEglSurface, mEglContext,
-                  mEglConfig);
+    VLOGD("NativeEngine: STATUS: F%d, V%d, W%d, EGL: D %p, S %p, CTX %p, CFG %p",
+          mHasFocus, mIsVisible, mHasWindow, mEglDisplay, mEglSurface, mEglContext,
+          mEglConfig);
 }
 
 bool NativeEngine::HandleInput(AInputEvent *event) {
@@ -586,7 +586,7 @@
         }
 
         ALOGI("NativeEngine: binding surface and context (display %p, surface %p, context %p)",
-             mEglDisplay, mEglSurface, mEglContext);
+              mEglDisplay, mEglSurface, mEglContext);
 
         // bind them
         if (EGL_FALSE == eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface, mEglContext)) {
@@ -718,7 +718,7 @@
     // prepare to render (create context, surfaces, etc, if needed)
     if (!PrepareToRender()) {
         // not ready
-                VLOGD("NativeEngine: preparation to render failed.");
+        VLOGD("NativeEngine: preparation to render failed.");
         return;
     }
 
@@ -733,7 +733,7 @@
     if (width != mSurfWidth || height != mSurfHeight) {
         // notify scene manager that the surface has changed size
         ALOGI("NativeEngine: surface changed size %dx%d --> %dx%d", mSurfWidth, mSurfHeight,
-             width, height);
+              width, height);
         mSurfWidth = width;
         mSurfHeight = height;
         mgr->SetScreenSize(mSurfWidth, mSurfHeight);
diff --git a/samples/agdktunnel/app/src/main/cpp/native_engine.hpp b/samples/agdktunnel/app/src/main/cpp/native_engine.hpp
index 94d0976..1ccc494 100644
--- a/samples/agdktunnel/app/src/main/cpp/native_engine.hpp
+++ b/samples/agdktunnel/app/src/main/cpp/native_engine.hpp
@@ -152,4 +152,3 @@
 };
 
 #endif
-
diff --git a/samples/agdktunnel/app/src/main/cpp/obstacle.cpp b/samples/agdktunnel/app/src/main/cpp/obstacle.cpp
index 16e41e0..64cb1c6 100644
--- a/samples/agdktunnel/app/src/main/cpp/obstacle.cpp
+++ b/samples/agdktunnel/app/src/main/cpp/obstacle.cpp
@@ -63,4 +63,3 @@
         }
     }
 }
-
diff --git a/samples/agdktunnel/app/src/main/cpp/obstacle.hpp b/samples/agdktunnel/app/src/main/cpp/obstacle.hpp
index f52ad28..f8fe09c 100644
--- a/samples/agdktunnel/app/src/main/cpp/obstacle.hpp
+++ b/samples/agdktunnel/app/src/main/cpp/obstacle.hpp
@@ -79,4 +79,3 @@
 };
 
 #endif
-
diff --git a/samples/agdktunnel/app/src/main/cpp/obstacle_generator.cpp b/samples/agdktunnel/app/src/main/cpp/obstacle_generator.cpp
index 2916374..261f771 100644
--- a/samples/agdktunnel/app/src/main/cpp/obstacle_generator.cpp
+++ b/samples/agdktunnel/app/src/main/cpp/obstacle_generator.cpp
@@ -182,4 +182,3 @@
             break;
     }
 }
-
diff --git a/samples/agdktunnel/app/src/main/cpp/obstacle_generator.hpp b/samples/agdktunnel/app/src/main/cpp/obstacle_generator.hpp
index 6ec3d29..cb6b6dd 100644
--- a/samples/agdktunnel/app/src/main/cpp/obstacle_generator.hpp
+++ b/samples/agdktunnel/app/src/main/cpp/obstacle_generator.hpp
@@ -51,4 +51,3 @@
 };
 
 #endif
-
diff --git a/samples/agdktunnel/app/src/main/cpp/our_key_codes.hpp b/samples/agdktunnel/app/src/main/cpp/our_key_codes.hpp
index 8708431..3f2efce 100644
--- a/samples/agdktunnel/app/src/main/cpp/our_key_codes.hpp
+++ b/samples/agdktunnel/app/src/main/cpp/our_key_codes.hpp
@@ -27,4 +27,3 @@
 #define OURKEY_COUNT 6 // how many keycodes there are
 
 #endif
-
diff --git a/samples/agdktunnel/app/src/main/cpp/our_shader.cpp b/samples/agdktunnel/app/src/main/cpp/our_shader.cpp
index 7a38fb0..d8e3eab 100644
--- a/samples/agdktunnel/app/src/main/cpp/our_shader.cpp
+++ b/samples/agdktunnel/app/src/main/cpp/our_shader.cpp
@@ -129,4 +129,3 @@
 const char *OurShader::GetShaderName() {
     return "OurShader";
 }
-
diff --git a/samples/agdktunnel/app/src/main/cpp/our_shader.hpp b/samples/agdktunnel/app/src/main/cpp/our_shader.hpp
index b795354..cbce21d 100644
--- a/samples/agdktunnel/app/src/main/cpp/our_shader.hpp
+++ b/samples/agdktunnel/app/src/main/cpp/our_shader.hpp
@@ -55,4 +55,3 @@
 };
 
 #endif
-
diff --git a/samples/agdktunnel/app/src/main/cpp/play_scene.cpp b/samples/agdktunnel/app/src/main/cpp/play_scene.cpp
index 5080a82..cfe79e9 100644
--- a/samples/agdktunnel/app/src/main/cpp/play_scene.cpp
+++ b/samples/agdktunnel/app/src/main/cpp/play_scene.cpp
@@ -184,7 +184,7 @@
 
     ALOGI("Final decision on starting level: %d", mSavedCheckpoint);
     ALOGI("Final decision on whether to use cloud: %s", mUseCloudSave ? "USE CLOUD" :
-                                                       "DO NOT USE CLOUD (failed)");
+                                                        "DO NOT USE CLOUD (failed)");
 }
 
 void PlayScene::WriteSaveFile(int level) {
@@ -890,4 +890,3 @@
     mProjMat = glm::perspective(RENDER_FOV, mgr->GetScreenAspect(), RENDER_NEAR_CLIP,
                                 RENDER_FAR_CLIP);
 }
-
diff --git a/samples/agdktunnel/app/src/main/cpp/play_scene.hpp b/samples/agdktunnel/app/src/main/cpp/play_scene.hpp
index d700913..1aff838 100644
--- a/samples/agdktunnel/app/src/main/cpp/play_scene.hpp
+++ b/samples/agdktunnel/app/src/main/cpp/play_scene.hpp
@@ -296,4 +296,3 @@
 };
 
 #endif
-
diff --git a/samples/agdktunnel/app/src/main/cpp/scene.cpp b/samples/agdktunnel/app/src/main/cpp/scene.cpp
index 019fff7..c5b1711 100644
--- a/samples/agdktunnel/app/src/main/cpp/scene.cpp
+++ b/samples/agdktunnel/app/src/main/cpp/scene.cpp
@@ -52,4 +52,3 @@
 void Scene::OnTextInput() {}
 
 Scene::~Scene() {}
-
diff --git a/samples/agdktunnel/app/src/main/cpp/scene.hpp b/samples/agdktunnel/app/src/main/cpp/scene.hpp
index 841f38c..d799bc9 100644
--- a/samples/agdktunnel/app/src/main/cpp/scene.hpp
+++ b/samples/agdktunnel/app/src/main/cpp/scene.hpp
@@ -80,4 +80,3 @@
 };
 
 #endif
-
diff --git a/samples/agdktunnel/app/src/main/cpp/scene_manager.cpp b/samples/agdktunnel/app/src/main/cpp/scene_manager.cpp
index abfe733..92653bc 100644
--- a/samples/agdktunnel/app/src/main/cpp/scene_manager.cpp
+++ b/samples/agdktunnel/app/src/main/cpp/scene_manager.cpp
@@ -184,4 +184,4 @@
     if (mHasGraphics && mCurScene) {
         mCurScene->OnTextInput();
     }
-}
\ No newline at end of file
+}
diff --git a/samples/agdktunnel/app/src/main/cpp/scene_manager.hpp b/samples/agdktunnel/app/src/main/cpp/scene_manager.hpp
index 023ef06..c72c9b6 100644
--- a/samples/agdktunnel/app/src/main/cpp/scene_manager.hpp
+++ b/samples/agdktunnel/app/src/main/cpp/scene_manager.hpp
@@ -113,4 +113,3 @@
 };
 
 #endif
-
diff --git a/samples/agdktunnel/app/src/main/cpp/sfxman.cpp b/samples/agdktunnel/app/src/main/cpp/sfxman.cpp
index 1008f7f..d94a118 100644
--- a/samples/agdktunnel/app/src/main/cpp/sfxman.cpp
+++ b/samples/agdktunnel/app/src/main/cpp/sfxman.cpp
@@ -222,4 +222,4 @@
     }
 
     return oboe::DataCallbackResult::Continue;
-}
\ No newline at end of file
+}
diff --git a/samples/agdktunnel/app/src/main/cpp/sfxman.hpp b/samples/agdktunnel/app/src/main/cpp/sfxman.hpp
index 35b7f19..4809ee0 100644
--- a/samples/agdktunnel/app/src/main/cpp/sfxman.hpp
+++ b/samples/agdktunnel/app/src/main/cpp/sfxman.hpp
@@ -69,4 +69,3 @@
 };
 
 #endif
-
diff --git a/samples/agdktunnel/app/src/main/cpp/shader.cpp b/samples/agdktunnel/app/src/main/cpp/shader.cpp
index 80116fa..b27818d 100644
--- a/samples/agdktunnel/app/src/main/cpp/shader.cpp
+++ b/samples/agdktunnel/app/src/main/cpp/shader.cpp
@@ -283,5 +283,3 @@
     MY_ASSERT(mTintLoc >= 0);
     glUniform4f(mTintLoc, mTint[0], mTint[1], mTint[2], 1.0f);
 }
-
-
diff --git a/samples/agdktunnel/app/src/main/cpp/shader.hpp b/samples/agdktunnel/app/src/main/cpp/shader.hpp
index 902238c..db06fbf 100644
--- a/samples/agdktunnel/app/src/main/cpp/shader.hpp
+++ b/samples/agdktunnel/app/src/main/cpp/shader.hpp
@@ -128,4 +128,3 @@
 };
 
 #endif
-
diff --git a/samples/agdktunnel/app/src/main/cpp/shape_renderer.cpp b/samples/agdktunnel/app/src/main/cpp/shape_renderer.cpp
index 1f9e15c..8dbb4b4 100644
--- a/samples/agdktunnel/app/src/main/cpp/shape_renderer.cpp
+++ b/samples/agdktunnel/app/src/main/cpp/shape_renderer.cpp
@@ -56,4 +56,3 @@
     mTrivialShader->SetTintColor(mColor[0], mColor[1], mColor[2]);
     mTrivialShader->RenderSimpleGeom(&mat, mGeom);
 }
-
diff --git a/samples/agdktunnel/app/src/main/cpp/shape_renderer.hpp b/samples/agdktunnel/app/src/main/cpp/shape_renderer.hpp
index 413d38f..aa63cd2 100644
--- a/samples/agdktunnel/app/src/main/cpp/shape_renderer.hpp
+++ b/samples/agdktunnel/app/src/main/cpp/shape_renderer.hpp
@@ -46,4 +46,3 @@
 };
 
 #endif
-
diff --git a/samples/agdktunnel/app/src/main/cpp/simplegeom.hpp b/samples/agdktunnel/app/src/main/cpp/simplegeom.hpp
index 5af728b..4dc39d6 100644
--- a/samples/agdktunnel/app/src/main/cpp/simplegeom.hpp
+++ b/samples/agdktunnel/app/src/main/cpp/simplegeom.hpp
@@ -53,4 +53,3 @@
 };
 
 #endif
-
diff --git a/samples/agdktunnel/app/src/main/cpp/tex_quad.cpp b/samples/agdktunnel/app/src/main/cpp/tex_quad.cpp
index fdad3d4..7a9b70d 100644
--- a/samples/agdktunnel/app/src/main/cpp/tex_quad.cpp
+++ b/samples/agdktunnel/app/src/main/cpp/tex_quad.cpp
@@ -104,5 +104,3 @@
         glEnable(GL_DEPTH_TEST);
     }
 }
-
-
diff --git a/samples/agdktunnel/app/src/main/cpp/tex_quad.hpp b/samples/agdktunnel/app/src/main/cpp/tex_quad.hpp
index f0f7953..2ae6479 100644
--- a/samples/agdktunnel/app/src/main/cpp/tex_quad.hpp
+++ b/samples/agdktunnel/app/src/main/cpp/tex_quad.hpp
@@ -109,4 +109,3 @@
 };
 
 #endif
-
diff --git a/samples/agdktunnel/app/src/main/cpp/text_renderer.cpp b/samples/agdktunnel/app/src/main/cpp/text_renderer.cpp
index 595d3e1..9e66ef9 100644
--- a/samples/agdktunnel/app/src/main/cpp/text_renderer.cpp
+++ b/samples/agdktunnel/app/src/main/cpp/text_renderer.cpp
@@ -140,4 +140,3 @@
     }
     return this;
 }
-
diff --git a/samples/agdktunnel/app/src/main/cpp/text_renderer.hpp b/samples/agdktunnel/app/src/main/cpp/text_renderer.hpp
index ac53892..b4e2805 100644
--- a/samples/agdktunnel/app/src/main/cpp/text_renderer.hpp
+++ b/samples/agdktunnel/app/src/main/cpp/text_renderer.hpp
@@ -75,4 +75,3 @@
 };
 
 #endif
-
diff --git a/samples/agdktunnel/app/src/main/cpp/texture.cpp b/samples/agdktunnel/app/src/main/cpp/texture.cpp
index 7d40480..defa417 100644
--- a/samples/agdktunnel/app/src/main/cpp/texture.cpp
+++ b/samples/agdktunnel/app/src/main/cpp/texture.cpp
@@ -42,4 +42,3 @@
 void Texture::Unbind() {
     glBindTexture(GL_TEXTURE_2D, 0);
 }
-
diff --git a/samples/agdktunnel/app/src/main/cpp/texture.hpp b/samples/agdktunnel/app/src/main/cpp/texture.hpp
index f062cc4..d91b989 100644
--- a/samples/agdktunnel/app/src/main/cpp/texture.hpp
+++ b/samples/agdktunnel/app/src/main/cpp/texture.hpp
@@ -46,4 +46,3 @@
 };
 
 #endif
-
diff --git a/samples/agdktunnel/app/src/main/cpp/tuning_manager.cpp b/samples/agdktunnel/app/src/main/cpp/tuning_manager.cpp
index 30bf1ac..b353997 100644
--- a/samples/agdktunnel/app/src/main/cpp/tuning_manager.cpp
+++ b/samples/agdktunnel/app/src/main/cpp/tuning_manager.cpp
@@ -34,7 +34,7 @@
  * Internal to this file - do not use.
  */
 extern "C" void TuningFork_CProtobufSerialization_Dealloc(
-        TuningFork_CProtobufSerialization* c);
+        TuningFork_CProtobufSerialization *c);
 
 /** @endcond */
 
@@ -45,29 +45,30 @@
     TuningFork_LoadingTimeMetadata startupLoadingMetadata;
 
     typedef void (*func_AChoreographer_postFrameCallback64)(
-            AChoreographer* choreographer, AChoreographer_frameCallback64 callback,
-            void* data);
+            AChoreographer *choreographer, AChoreographer_frameCallback64 callback,
+            void *data);
+
     func_AChoreographer_postFrameCallback64 pAChoreographer_postFrameCallback64 = nullptr;
 
-    void choreographer_callback(long /*frameTimeNanos*/, void* data) {
-        TuningManager* tuningManager = reinterpret_cast<TuningManager*>(data);
+    void choreographer_callback(long /*frameTimeNanos*/, void *data) {
+        TuningManager *tuningManager = reinterpret_cast<TuningManager *>(data);
         tuningManager->HandleChoreographerFrame();
     }
 
-    void choreographer_callback64(int64_t /*frameTimeNanos*/, void* data) {
-        TuningManager* tuningManager = reinterpret_cast<TuningManager*>(data);
+    void choreographer_callback64(int64_t /*frameTimeNanos*/, void *data) {
+        TuningManager *tuningManager = reinterpret_cast<TuningManager *>(data);
         tuningManager->HandleChoreographerFrame();
     }
 
-    bool serialize_annotation(TuningFork_CProtobufSerialization& cser,
-                             const _com_google_tuningfork_Annotation* annotation) {
+    bool serialize_annotation(TuningFork_CProtobufSerialization &cser,
+                              const _com_google_tuningfork_Annotation *annotation) {
         bool success = false;
         cser.bytes = NULL;
         cser.size = 0;
 
         size_t encodedSize = 0;
         if (pb_get_encoded_size(&encodedSize, com_google_tuningfork_Annotation_fields,
-            annotation)) {
+                                annotation)) {
             cser.bytes = (uint8_t *) ::malloc(encodedSize);
             cser.size = encodedSize;
             cser.dealloc = TuningFork_CProtobufSerialization_Dealloc;
@@ -80,10 +81,10 @@
     }
 }
 
-TuningManager::TuningManager(JNIEnv* env, jobject activity, AConfiguration* config) {
+TuningManager::TuningManager(JNIEnv *env, jobject activity, AConfiguration *config) {
     mTFInitialized = false;
 
-    TuningFork_Settings settings {};
+    TuningFork_Settings settings{};
 
     // Performance Tuner can work with the Frame Pacing library to automatically
     // record frame time via the tracer function
@@ -108,8 +109,8 @@
      */
     TuningFork_CProtobufSerialization fps = {};
     bool bHighDensity = (RENDER_TUNNEL_SECTION_COUNT == 8 && TUNNEL_SECTION_LENGTH == 75.0f);
-    const char* filename = bHighDensity ? "dev_tuningfork_fidelityparams_2.bin" :
-            "dev_tuningfork_fidelityparams_1.bin";
+    const char *filename = bHighDensity ? "dev_tuningfork_fidelityparams_2.bin" :
+                           "dev_tuningfork_fidelityparams_1.bin";
     if (TuningFork_findFidelityParamsInApk(env, activity, filename, &fps)
         == TUNINGFORK_ERROR_OK) {
         // This overrides the value in default_fidelity_parameters_filename
@@ -142,7 +143,7 @@
     }
 }
 
-void TuningManager::InitializeChoreographerCallback(AConfiguration* config) {
+void TuningManager::InitializeChoreographerCallback(AConfiguration *config) {
     int32_t sdkVersion = AConfiguration_getSdkVersion(config);
     if (sdkVersion >= 29) {
         // The original postFrameCallback is deprecated in 29 and later, try and
@@ -164,7 +165,7 @@
         }
     } else {
         AChoreographer_postFrameCallback(AChoreographer_getInstance(),
-            choreographer_callback, this);
+                                         choreographer_callback, this);
     }
 }
 
@@ -189,7 +190,7 @@
     }
 }
 
-void TuningManager::SetCurrentAnnotation(const _com_google_tuningfork_Annotation* annotation) {
+void TuningManager::SetCurrentAnnotation(const _com_google_tuningfork_Annotation *annotation) {
     TuningFork_CProtobufSerialization cser;
     if (serialize_annotation(cser, annotation)) {
         if (TuningFork_setCurrentAnnotation(&cser) != TUNINGFORK_ERROR_OK) {
@@ -229,4 +230,4 @@
     annotation.loading = com_google_tuningfork_LoadingState_NOT_LOADING;
     annotation.level = com_google_tuningfork_Level_LEVEL_1;
     SetCurrentAnnotation(&annotation);
-}
\ No newline at end of file
+}
diff --git a/samples/agdktunnel/app/src/main/cpp/tuning_manager.hpp b/samples/agdktunnel/app/src/main/cpp/tuning_manager.hpp
index a093e08..9aa5940 100644
--- a/samples/agdktunnel/app/src/main/cpp/tuning_manager.hpp
+++ b/samples/agdktunnel/app/src/main/cpp/tuning_manager.hpp
@@ -24,19 +24,25 @@
 struct AConfiguration;
 
 class TuningManager {
-    private:
-        bool mTFInitialized;
+private:
+    bool mTFInitialized;
 
-        void InitializeChoreographerCallback(AConfiguration* config);
-    public:
-        TuningManager(JNIEnv* env, jobject context, AConfiguration* config);
-        ~TuningManager();
+    void InitializeChoreographerCallback(AConfiguration *config);
 
-        void HandleChoreographerFrame();
-        void PostFrameTick(const uint16_t frameKey);
-        void SetCurrentAnnotation(const _com_google_tuningfork_Annotation* annotation);
-        void StartLoading();
-        void FinishLoading();
+public:
+    TuningManager(JNIEnv *env, jobject context, AConfiguration *config);
+
+    ~TuningManager();
+
+    void HandleChoreographerFrame();
+
+    void PostFrameTick(const uint16_t frameKey);
+
+    void SetCurrentAnnotation(const _com_google_tuningfork_Annotation *annotation);
+
+    void StartLoading();
+
+    void FinishLoading();
 };
 
-#endif
\ No newline at end of file
+#endif
diff --git a/samples/agdktunnel/app/src/main/cpp/ui_scene.cpp b/samples/agdktunnel/app/src/main/cpp/ui_scene.cpp
index fe5752d..ac4c9ed 100644
--- a/samples/agdktunnel/app/src/main/cpp/ui_scene.cpp
+++ b/samples/agdktunnel/app/src/main/cpp/ui_scene.cpp
@@ -349,4 +349,3 @@
 }
 
 void UiScene::OnCreateWidgets() {}
-
diff --git a/samples/agdktunnel/app/src/main/cpp/ui_scene.hpp b/samples/agdktunnel/app/src/main/cpp/ui_scene.hpp
index 5f03e0e..b01535c 100644
--- a/samples/agdktunnel/app/src/main/cpp/ui_scene.hpp
+++ b/samples/agdktunnel/app/src/main/cpp/ui_scene.hpp
@@ -322,4 +322,3 @@
 };
 
 #endif
-
diff --git a/samples/agdktunnel/app/src/main/cpp/util.cpp b/samples/agdktunnel/app/src/main/cpp/util.cpp
index 4fba5e2..b49b3f2 100644
--- a/samples/agdktunnel/app/src/main/cpp/util.cpp
+++ b/samples/agdktunnel/app/src/main/cpp/util.cpp
@@ -55,4 +55,3 @@
 bool BlinkFunc(float period) {
     return (int) (Clock() / period) & 1;
 }
-
diff --git a/samples/agdktunnel/app/src/main/cpp/util.hpp b/samples/agdktunnel/app/src/main/cpp/util.hpp
index d778834..7a1ffb5 100644
--- a/samples/agdktunnel/app/src/main/cpp/util.hpp
+++ b/samples/agdktunnel/app/src/main/cpp/util.hpp
@@ -119,4 +119,3 @@
 };
 
 #endif
-
diff --git a/samples/agdktunnel/app/src/main/cpp/vertexbuf.cpp b/samples/agdktunnel/app/src/main/cpp/vertexbuf.cpp
index 14e34e2..e437600 100644
--- a/samples/agdktunnel/app/src/main/cpp/vertexbuf.cpp
+++ b/samples/agdktunnel/app/src/main/cpp/vertexbuf.cpp
@@ -44,5 +44,3 @@
     glDeleteBuffers(1, &mVbo);
     mVbo = 0;
 }
-
-
diff --git a/samples/agdktunnel/app/src/main/cpp/vertexbuf.hpp b/samples/agdktunnel/app/src/main/cpp/vertexbuf.hpp
index 2d7df46..7778ef2 100644
--- a/samples/agdktunnel/app/src/main/cpp/vertexbuf.hpp
+++ b/samples/agdktunnel/app/src/main/cpp/vertexbuf.hpp
@@ -62,4 +62,3 @@
 };
 
 #endif
-
diff --git a/samples/agdktunnel/app/src/main/cpp/welcome_scene.hpp b/samples/agdktunnel/app/src/main/cpp/welcome_scene.hpp
index 7c90c8c..d7a2ce7 100644
--- a/samples/agdktunnel/app/src/main/cpp/welcome_scene.hpp
+++ b/samples/agdktunnel/app/src/main/cpp/welcome_scene.hpp
@@ -78,4 +78,3 @@
 };
 
 #endif
-
diff --git a/src/memory_advice/core/predictor.cpp b/src/memory_advice/core/predictor.cpp
index 7d2a64d..faee082 100644
--- a/src/memory_advice/core/predictor.cpp
+++ b/src/memory_advice/core/predictor.cpp
@@ -21,7 +21,6 @@
 #include <stdlib.h>
 
 #include <algorithm>
-#include <filesystem>
 #include <fstream>
 #include <iterator>
 #include <map>