capture NoClassDefFoundError
The generated code should capture NoClassDefFoundError, since mainline
module could run on older devices. The catch should be replaced to sdk
version check once the version is bumped.
Test: presubmit
Change-Id: Iba088848cbde5d395e41ac9b0f5bb84334bc0ca3
diff --git a/tools/aconfig/aconfig/src/codegen/java.rs b/tools/aconfig/aconfig/src/codegen/java.rs
index 84a17e5..2cb98ed 100644
--- a/tools/aconfig/aconfig/src/codegen/java.rs
+++ b/tools/aconfig/aconfig/src/codegen/java.rs
@@ -531,6 +531,9 @@
disabledRwInOtherNamespace = reader.getBooleanFlagValue(3);
} catch (Exception e) {
// pass
+ } catch (NoClassDefFoundError e) {
+ // for mainline module running on older devices.
+ // This should be replaces to version check, after the version bump.
}
isCached = true;
}
diff --git a/tools/aconfig/aconfig/templates/FeatureFlagsImpl.java.template b/tools/aconfig/aconfig/templates/FeatureFlagsImpl.java.template
index 0352452..98add32 100644
--- a/tools/aconfig/aconfig/templates/FeatureFlagsImpl.java.template
+++ b/tools/aconfig/aconfig/templates/FeatureFlagsImpl.java.template
@@ -29,6 +29,9 @@
{{ -endfor }}
} catch (Exception e) \{
// pass
+ } catch (NoClassDefFoundError e) \{
+ // for mainline module running on older devices.
+ // This should be replaces to version check, after the version bump.
}
isCached = true;
}