Loading tools/aconfig/aconfig/src/codegen/java.rs +11 −0 Original line number Diff line number Diff line Loading @@ -513,6 +513,7 @@ mod tests { package com.android.aconfig.test; // TODO(b/303773055): Remove the annotation after access issue is resolved. import android.compat.annotation.UnsupportedAppUsage; import android.os.Binder; import android.provider.DeviceConfig; import android.provider.DeviceConfig.Properties; import android.aconfig.storage.StorageInternalReader; Loading Loading @@ -544,6 +545,7 @@ mod tests { isCached = true; } private void load_overrides_aconfig_test() { final long ident = Binder.clearCallingIdentity(); try { Properties properties = DeviceConfig.getProperties("aconfig_test"); disabledRw = Loading @@ -563,11 +565,14 @@ mod tests { ); } catch (SecurityException e) { // for isolated process case, skip loading flag value from the storage, use the default } finally { Binder.restoreCallingIdentity(ident); } aconfig_test_is_cached = true; } private void load_overrides_other_namespace() { final long ident = Binder.clearCallingIdentity(); try { Properties properties = DeviceConfig.getProperties("other_namespace"); disabledRwInOtherNamespace = Loading @@ -583,6 +588,8 @@ mod tests { ); } catch (SecurityException e) { // for isolated process case, skip loading flag value from the storage, use the default } finally { Binder.restoreCallingIdentity(ident); } other_namespace_is_cached = true; } Loading Loading @@ -764,6 +771,7 @@ mod tests { let expect_feature_flags_impl_content = r#" package com.android.aconfig.test; import android.os.Binder; import android.provider.DeviceConfig; import android.provider.DeviceConfig.Properties; /** @hide */ Loading @@ -774,6 +782,7 @@ mod tests { private static boolean enabledRoExported = false; private void load_overrides_aconfig_test() { final long ident = Binder.clearCallingIdentity(); try { Properties properties = DeviceConfig.getProperties("aconfig_test"); disabledRwExported = Loading @@ -793,6 +802,8 @@ mod tests { ); } catch (SecurityException e) { // for isolated process case, skip loading flag value from the storage, use the default } finally { Binder.restoreCallingIdentity(ident); } aconfig_test_is_cached = true; } Loading tools/aconfig/aconfig/templates/FeatureFlagsImpl.java.template +4 −0 Original line number Diff line number Diff line Loading @@ -7,6 +7,7 @@ import android.compat.annotation.UnsupportedAppUsage; {{ -endif }} {{ -if runtime_lookup_required }} import android.os.Binder; import android.provider.DeviceConfig; import android.provider.DeviceConfig.Properties; Loading Loading @@ -57,6 +58,7 @@ public final class FeatureFlagsImpl implements FeatureFlags \{ {{ for namespace_with_flags in namespace_flags }} private void load_overrides_{namespace_with_flags.namespace}() \{ final long ident = Binder.clearCallingIdentity(); try \{ Properties properties = DeviceConfig.getProperties("{namespace_with_flags.namespace}"); {{ -for flag in namespace_with_flags.flags }} Loading @@ -76,6 +78,8 @@ public final class FeatureFlagsImpl implements FeatureFlags \{ ); } catch (SecurityException e) \{ // for isolated process case, skip loading flag value from the storage, use the default } finally \{ Binder.restoreCallingIdentity(ident); } {namespace_with_flags.namespace}_is_cached = true; } Loading tools/aconfig/fake_device_config/src/android/os/Binder.java 0 → 100644 +26 −0 Original line number Diff line number Diff line /* * Copyright (C) 2024 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 * * http://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. */ package android.os; public class Binder { public static final long clearCallingIdentity() { throw new UnsupportedOperationException("Stub!"); } public static final void restoreCallingIdentity(long token) { throw new UnsupportedOperationException("Stub!"); } } Loading
tools/aconfig/aconfig/src/codegen/java.rs +11 −0 Original line number Diff line number Diff line Loading @@ -513,6 +513,7 @@ mod tests { package com.android.aconfig.test; // TODO(b/303773055): Remove the annotation after access issue is resolved. import android.compat.annotation.UnsupportedAppUsage; import android.os.Binder; import android.provider.DeviceConfig; import android.provider.DeviceConfig.Properties; import android.aconfig.storage.StorageInternalReader; Loading Loading @@ -544,6 +545,7 @@ mod tests { isCached = true; } private void load_overrides_aconfig_test() { final long ident = Binder.clearCallingIdentity(); try { Properties properties = DeviceConfig.getProperties("aconfig_test"); disabledRw = Loading @@ -563,11 +565,14 @@ mod tests { ); } catch (SecurityException e) { // for isolated process case, skip loading flag value from the storage, use the default } finally { Binder.restoreCallingIdentity(ident); } aconfig_test_is_cached = true; } private void load_overrides_other_namespace() { final long ident = Binder.clearCallingIdentity(); try { Properties properties = DeviceConfig.getProperties("other_namespace"); disabledRwInOtherNamespace = Loading @@ -583,6 +588,8 @@ mod tests { ); } catch (SecurityException e) { // for isolated process case, skip loading flag value from the storage, use the default } finally { Binder.restoreCallingIdentity(ident); } other_namespace_is_cached = true; } Loading Loading @@ -764,6 +771,7 @@ mod tests { let expect_feature_flags_impl_content = r#" package com.android.aconfig.test; import android.os.Binder; import android.provider.DeviceConfig; import android.provider.DeviceConfig.Properties; /** @hide */ Loading @@ -774,6 +782,7 @@ mod tests { private static boolean enabledRoExported = false; private void load_overrides_aconfig_test() { final long ident = Binder.clearCallingIdentity(); try { Properties properties = DeviceConfig.getProperties("aconfig_test"); disabledRwExported = Loading @@ -793,6 +802,8 @@ mod tests { ); } catch (SecurityException e) { // for isolated process case, skip loading flag value from the storage, use the default } finally { Binder.restoreCallingIdentity(ident); } aconfig_test_is_cached = true; } Loading
tools/aconfig/aconfig/templates/FeatureFlagsImpl.java.template +4 −0 Original line number Diff line number Diff line Loading @@ -7,6 +7,7 @@ import android.compat.annotation.UnsupportedAppUsage; {{ -endif }} {{ -if runtime_lookup_required }} import android.os.Binder; import android.provider.DeviceConfig; import android.provider.DeviceConfig.Properties; Loading Loading @@ -57,6 +58,7 @@ public final class FeatureFlagsImpl implements FeatureFlags \{ {{ for namespace_with_flags in namespace_flags }} private void load_overrides_{namespace_with_flags.namespace}() \{ final long ident = Binder.clearCallingIdentity(); try \{ Properties properties = DeviceConfig.getProperties("{namespace_with_flags.namespace}"); {{ -for flag in namespace_with_flags.flags }} Loading @@ -76,6 +78,8 @@ public final class FeatureFlagsImpl implements FeatureFlags \{ ); } catch (SecurityException e) \{ // for isolated process case, skip loading flag value from the storage, use the default } finally \{ Binder.restoreCallingIdentity(ident); } {namespace_with_flags.namespace}_is_cached = true; } Loading
tools/aconfig/fake_device_config/src/android/os/Binder.java 0 → 100644 +26 −0 Original line number Diff line number Diff line /* * Copyright (C) 2024 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 * * http://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. */ package android.os; public class Binder { public static final long clearCallingIdentity() { throw new UnsupportedOperationException("Stub!"); } public static final void restoreCallingIdentity(long token) { throw new UnsupportedOperationException("Stub!"); } }