Merge "Export flags used in FlaggedApi annotations" into main
diff --git a/core/java/android/app/usage/OWNERS b/core/java/android/app/usage/OWNERS
index a4bf985..57d958f 100644
--- a/core/java/android/app/usage/OWNERS
+++ b/core/java/android/app/usage/OWNERS
@@ -3,6 +3,7 @@
 yamasani@google.com
 mwachens@google.com
 varunshah@google.com
+guanxin@google.com
 
 per-file *StorageStats* = file:/core/java/android/os/storage/OWNERS
 per-file *Broadcast* = sudheersai@google.com
diff --git a/core/jni/android_os_Debug.cpp b/core/jni/android_os_Debug.cpp
index 1504a00..a98f947 100644
--- a/core/jni/android_os_Debug.cpp
+++ b/core/jni/android_os_Debug.cpp
@@ -410,6 +410,7 @@
             stats[sub_heap].swappedOut += usage.swap;
             stats[sub_heap].swappedOutPss += usage.swap_pss;
         }
+        return true;
     };
 
     return meminfo::ForEachVmaFromFile(smaps_path, vma_scan);
diff --git a/media/java/android/media/MediaCodec.java b/media/java/android/media/MediaCodec.java
index 5b479b5..2999d76 100644
--- a/media/java/android/media/MediaCodec.java
+++ b/media/java/android/media/MediaCodec.java
@@ -2345,6 +2345,15 @@
             throw new IllegalArgumentException("Can't use crypto and descrambler together!");
         }
 
+        // at the moment no codecs support detachable surface
+        if (android.media.codec.Flags.nullOutputSurface()) {
+            // Detached surface flag is only meaningful if surface is null. Otherwise, it is
+            // ignored.
+            if (surface == null && (flags & CONFIGURE_FLAG_DETACHED_SURFACE) != 0) {
+                throw new IllegalArgumentException("Codec does not support detached surface");
+            }
+        }
+
         String[] keys = null;
         Object[] values = null;
 
@@ -2419,7 +2428,8 @@
      *  output.
      *
      *  @throws IllegalStateException if the codec was not
-     *                                configured in surface mode.
+     *            configured in surface mode or if the codec does not support
+     *            detaching the output surface.
      *  @see CONFIGURE_FLAG_DETACHED_SURFACE
      */
     @FlaggedApi(FLAG_NULL_OUTPUT_SURFACE)
@@ -2429,6 +2439,7 @@
         }
         // note: we still have a surface in detached mode, so keep mHasSurface
         // we also technically allow calling detachOutputSurface multiple times in a row
+        throw new IllegalStateException("codec does not support detaching output surface");
         // native_detachSurface();
     }
 
diff --git a/services/core/java/com/android/server/location/contexthub/OWNERS b/services/core/java/com/android/server/location/contexthub/OWNERS
index 90c2330..c62e323 100644
--- a/services/core/java/com/android/server/location/contexthub/OWNERS
+++ b/services/core/java/com/android/server/location/contexthub/OWNERS
@@ -1,3 +1,3 @@
-arthuri@google.com
 bduddie@google.com
+matthewsedam@google.com
 stange@google.com
diff --git a/services/core/jni/com_android_server_am_CachedAppOptimizer.cpp b/services/core/jni/com_android_server_am_CachedAppOptimizer.cpp
index 4403bce..95e7b19 100644
--- a/services/core/jni/com_android_server_am_CachedAppOptimizer.cpp
+++ b/services/core/jni/com_android_server_am_CachedAppOptimizer.cpp
@@ -393,6 +393,7 @@
                 ++pageoutVmaIndex;
                 break;
         }
+        return true;
     };
     meminfo.ForEachVmaFromMaps(vmaCollectorCb, mapsBuffer);
     ATRACE_END();