Merge "Satellite Internet Support" into main
diff --git a/stats/enums/app/settings_enums.proto b/stats/enums/app/settings_enums.proto
index 05f62ab..4c20a90 100644
--- a/stats/enums/app/settings_enums.proto
+++ b/stats/enums/app/settings_enums.proto
@@ -1581,6 +1581,13 @@
     // CATEGORY: SETTINGS
     // OS: V
     ACTION_RUN_BACKUP_TASKS_TOGGLE = 1907;
+
+    // ACTION: Settings > Security&Privacy > Private space
+    // > Lock private space automatically
+    // Subtype on_device_lock = 0, after_inactivity = 1, never = 2
+    // Category: SETTINGS
+    // OS: V
+    ACTION_SET_PRIVATE_SPACE_AUTOLOCK = 1908;
 }
 
 /**
diff --git a/stats/enums/view/inputmethod/enums.proto b/stats/enums/view/inputmethod/enums.proto
index e52e799..2dec93b 100644
--- a/stats/enums/view/inputmethod/enums.proto
+++ b/stats/enums/view/inputmethod/enums.proto
@@ -64,6 +64,21 @@
     REASON_HIDE_WHEN_INPUT_TARGET_INVISIBLE = 37;
     REASON_HIDE_CLOSE_CURRENT_SESSION = 38;
     REASON_HIDE_SOFT_INPUT_FROM_VIEW = 39;
+    REASON_SHOW_SOFT_INPUT_LEGACY_DIRECT = 40;
+    REASON_HIDE_SOFT_INPUT_LEGACY_DIRECT = 41;
+    REASON_SHOW_WINDOW_LEGACY_DIRECT = 42;
+    REASON_HIDE_WINDOW_LEGACY_DIRECT = 43;
+    REASON_RESET_NEW_CONFIGURATION = 44;
+    REASON_UPDATE_CANDIDATES_VIEW_VISIBILITY = 45;
+    REASON_CONTROLS_CHANGED = 46;
+    REASON_DISPLAY_CONFIGURATION_CHANGED = 47;
+    REASON_DISPLAY_INSETS_CHANGED = 48;
+    REASON_DISPLAY_CONTROLS_CHANGED = 49;
+    REASON_UNBIND_CURRENT_METHOD = 50;
+    REASON_HIDE_SOFT_INPUT_ON_ANIMATION_STATE_CHANGED = 51;
+    REASON_HIDE_SOFT_INPUT_REQUEST_HIDE_WITH_CONTROL = 52;
+    REASON_SHOW_SOFT_INPUT_IME_TOGGLE_SOFT_INPUT = 53;
+    REASON_SHOW_SOFT_INPUT_IMM_DEPRECATION = 54;
 }
 
 // The type of the IME request, used by android/view/inputmethod/ImeTracker.java.
@@ -97,13 +112,21 @@
     // IME request origin not set.
     ORIGIN_NOT_SET = 0;
     // The IME show request originated in the client.
-    ORIGIN_CLIENT_SHOW_SOFT_INPUT = 1;
+    ORIGIN_CLIENT_SHOW_SOFT_INPUT = 1 [deprecated = true];
     // The IME hide request originated in the client.
-    ORIGIN_CLIENT_HIDE_SOFT_INPUT = 2;
+    ORIGIN_CLIENT_HIDE_SOFT_INPUT = 2 [deprecated = true];
     // The IME show request originated in the server.
-    ORIGIN_SERVER_START_INPUT = 3;
+    ORIGIN_SERVER_START_INPUT = 3 [deprecated = true];
     // The IME hide request originated in the server.
-    ORIGIN_SERVER_HIDE_INPUT = 4;
+    ORIGIN_SERVER_HIDE_INPUT = 4 [deprecated = true];
+    // The IME request originated in the client.
+    ORIGIN_CLIENT = 5;
+    // The IME request originated in the server.
+    ORIGIN_SERVER = 6;
+    // The IME request originated in the IME.
+    ORIGIN_IME = 7;
+    // The IME request originated in the WindowManager Shell.
+    ORIGIN_WM_SHELL = 8;
 }
 
 enum ImeRequestPhaseEnum {
@@ -133,14 +156,14 @@
     PHASE_IME_WRAPPER = 11;
     // Dispatched from the IME wrapper to the IME.
     PHASE_IME_WRAPPER_DISPATCH = 12;
-    // Reached the IME' showSoftInput method.
+    // Reached the IME's showSoftInput method.
     PHASE_IME_SHOW_SOFT_INPUT = 13;
-    // Reached the IME' hideSoftInput method.
+    // Reached the IME's hideSoftInput method.
     PHASE_IME_HIDE_SOFT_INPUT = 14;
     // The server decided the IME should be shown.
     PHASE_IME_ON_SHOW_SOFT_INPUT_TRUE = 15;
     // Requested applying the IME visibility in the insets source consumer.
-    PHASE_IME_APPLY_VISIBILITY_INSETS_CONSUMER = 16;
+    PHASE_IME_APPLY_VISIBILITY_INSETS_CONSUMER = 16 [deprecated = true];
     // Applied the IME visibility.
     PHASE_SERVER_APPLY_IME_VISIBILITY = 17;
     // Started the show IME runner.
@@ -195,5 +218,13 @@
     PHASE_CLIENT_ANIMATION_FINISHED_HIDE = 42;
     // Aborted the request to show the IME post layout.
     PHASE_WM_ABORT_SHOW_IME_POST_LAYOUT = 43;
+    // Reached the IME's showWindow method.
+    PHASE_IME_SHOW_WINDOW = 44;
+    // Reached the IME's hideWindow method.
+    PHASE_IME_HIDE_WINDOW = 45;
+    // Reached the InputMethodPrivilegedOperations handler.
+    PHASE_IME_PRIVILEGED_OPERATIONS = 46;
+    // Checked that the calling IME is the currently active IME.
+    PHASE_SERVER_CURRENT_ACTIVE_IME = 47;
 }
 
diff --git a/stats/stats_log_api_gen/java_writer.cpp b/stats/stats_log_api_gen/java_writer.cpp
index 46bba32..dae0c0e 100644
--- a/stats/stats_log_api_gen/java_writer.cpp
+++ b/stats/stats_log_api_gen/java_writer.cpp
@@ -42,27 +42,24 @@
     return 0;
 }
 
-static void write_java_annotation_constants(FILE* out, const int minApiLevel,
-                                            const int compileApiLevel) {
+static void write_java_annotation_constants(FILE* out, const int minApiLevel) {
     fprintf(out, "    // Annotation constants.\n");
 
     const map<AnnotationId, AnnotationStruct>& ANNOTATION_ID_CONSTANTS =
             get_annotation_id_constants(ANNOTATION_CONSTANT_NAME_PREFIX);
     for (const auto& [id, annotation] : ANNOTATION_ID_CONSTANTS) {
-        if (annotation.minApiLevel < API_U) {  // we don't generate annotation constants for U+
-            if (compileApiLevel <= API_R) {
-                fprintf(out, "    public static final byte %s = %hhu;\n", annotation.name.c_str(),
-                        id);
-            } else if (minApiLevel <= API_R) {  // compileApiLevel = S+
-                fprintf(out, "    public static final byte %s =\n", annotation.name.c_str());
-                fprintf(out, "            Build.VERSION.SDK_INT <= %s ?\n",
-                        get_java_build_version_code(API_R).c_str());
-                fprintf(out, "            %hhu : StatsLog.%s;\n", id, annotation.name.c_str());
-                fprintf(out, "\n");
-            } else {
-                fprintf(out, "    public static final byte %s = StatsLog.%s;\n",
-                        annotation.name.c_str(), annotation.name.c_str());
-            }
+        if (annotation.minApiLevel >= API_U) {  // we don't generate annotation constants for U+
+            continue;
+        }
+        if (minApiLevel <= API_R) {
+            fprintf(out, "    public static final byte %s =\n", annotation.name.c_str());
+            fprintf(out, "            Build.VERSION.SDK_INT <= %s ?\n",
+                    get_java_build_version_code(API_R).c_str());
+            fprintf(out, "            %hhu : StatsLog.%s;\n", id, annotation.name.c_str());
+            fprintf(out, "\n");
+        } else {
+            fprintf(out, "    public static final byte %s = StatsLog.%s;\n",
+                    annotation.name.c_str(), annotation.name.c_str());
         }
     }
 
@@ -326,7 +323,7 @@
 
 int write_stats_log_java(FILE* out, const Atoms& atoms, const AtomDecl& attributionDecl,
                          const string& javaClass, const string& javaPackage, const int minApiLevel,
-                         const int compileApiLevel, const bool supportWorkSource) {
+                         const bool supportWorkSource) {
     // Print prelude
     fprintf(out, "// This file is autogenerated\n");
     fprintf(out, "\n");
@@ -353,7 +350,7 @@
 
     write_java_atom_codes(out, atoms);
     write_java_enum_values(out, atoms);
-    write_java_annotation_constants(out, minApiLevel, compileApiLevel);
+    write_java_annotation_constants(out, minApiLevel);
 
     int errors = 0;
 
diff --git a/stats/stats_log_api_gen/java_writer.h b/stats/stats_log_api_gen/java_writer.h
index f87be53..dea06f8 100644
--- a/stats/stats_log_api_gen/java_writer.h
+++ b/stats/stats_log_api_gen/java_writer.h
@@ -31,7 +31,7 @@
 
 int write_stats_log_java(FILE* out, const Atoms& atoms, const AtomDecl& attributionDecl,
                          const string& javaClass, const string& javaPackage, const int minApiLevel,
-                         const int compileApiLevel, const bool supportWorkSource);
+                         const bool supportWorkSource);
 
 }  // namespace stats_log_api_gen
 }  // namespace android
diff --git a/stats/stats_log_api_gen/main.cpp b/stats/stats_log_api_gen/main.cpp
index 10bb6ae..7533708 100644
--- a/stats/stats_log_api_gen/main.cpp
+++ b/stats/stats_log_api_gen/main.cpp
@@ -61,9 +61,6 @@
     fprintf(stderr,
             "  --worksource         Include support for logging WorkSource "
             "objects.\n");
-    fprintf(stderr,
-            "  --compileApiLevel API_LEVEL           specify which API level generated code is "
-            "compiled against. (Java only).\n");
     fprintf(stderr, "                                        Default is \"current\".\n");
     fprintf(stderr,
             "  --bootstrap          If this logging is from a bootstrap process. "
@@ -93,7 +90,6 @@
     string vendorProto;
     bool supportWorkSource = false;
     int minApiLevel = API_LEVEL_CURRENT;
-    int compileApiLevel = API_LEVEL_CURRENT;
     bool bootstrap = false;
 
     int index = 1;
@@ -191,15 +187,6 @@
             if (0 != strcmp("current", argv[index])) {
                 minApiLevel = atoi(argv[index]);
             }
-        } else if (0 == strcmp("--compileApiLevel", argv[index])) {
-            index++;
-            if (index >= argc) {
-                print_usage();
-                return 1;
-            }
-            if (0 != strcmp("current", argv[index])) {
-                compileApiLevel = atoi(argv[index]);
-            }
         } else if (0 == strcmp("--bootstrap", argv[index])) {
             bootstrap = true;
 #ifdef WITH_VENDOR
@@ -227,40 +214,18 @@
         print_usage();
         return 1;
     }
-    if (DEFAULT_MODULE_NAME == moduleName &&
-        (minApiLevel != API_LEVEL_CURRENT || compileApiLevel != API_LEVEL_CURRENT)) {
+    if (DEFAULT_MODULE_NAME == moduleName && minApiLevel != API_LEVEL_CURRENT) {
         // Default module only supports current API level.
         fprintf(stderr, "%s cannot support older API levels\n", moduleName.c_str());
         return 1;
     }
 
-    if (compileApiLevel < API_R) {
-        // Cannot compile against pre-R.
-        fprintf(stderr, "compileApiLevel must be %d or higher.\n", API_R);
-        return 1;
-    }
-
     if (minApiLevel < API_Q) {
         // Cannot support pre-Q.
         fprintf(stderr, "minApiLevel must be %d or higher.\n", API_Q);
         return 1;
     }
 
-    if (minApiLevel == API_LEVEL_CURRENT) {
-        if (minApiLevel > compileApiLevel) {
-            // If minApiLevel is not specified, assume it is not higher than compileApiLevel.
-            minApiLevel = compileApiLevel;
-        }
-    } else {
-        if (minApiLevel > compileApiLevel) {
-            // If specified, minApiLevel should always be lower than compileApiLevel.
-            fprintf(stderr,
-                    "Invalid minApiLevel or compileApiLevel. If minApiLevel and"
-                    " compileApiLevel are specified, minApiLevel should not be higher"
-                    " than compileApiLevel.\n");
-            return 1;
-        }
-    }
     if (bootstrap) {
         if (cppFilename.empty() && headerFilename.empty()) {
             fprintf(stderr, "Bootstrap flag can only be used for cpp/header files.\n");
@@ -270,7 +235,7 @@
             fprintf(stderr, "Bootstrap flag does not support worksources");
             return 1;
         }
-        if ((minApiLevel != API_LEVEL_CURRENT) || (compileApiLevel != API_LEVEL_CURRENT)) {
+        if (minApiLevel != API_LEVEL_CURRENT) {
             fprintf(stderr, "Bootstrap flag does not support older API levels");
             return 1;
         }
@@ -396,7 +361,7 @@
         if (vendorProto.empty()) {
             errorCount = android::stats_log_api_gen::write_stats_log_java(
                     out, atoms, attributionDecl, javaClass, javaPackage, minApiLevel,
-                    compileApiLevel, supportWorkSource);
+                    supportWorkSource);
         } else {
 #ifdef WITH_VENDOR
             if (supportWorkSource) {