Merge "Clean up flag network_metric_monitor" into main
diff --git a/MULTIUSER_OWNERS b/MULTIUSER_OWNERS
index b8857ec..1738a35 100644
--- a/MULTIUSER_OWNERS
+++ b/MULTIUSER_OWNERS
@@ -3,7 +3,5 @@
bookatz@google.com
nykkumar@google.com
olilan@google.com
-omakoto@google.com
tetianameronyk@google.com
tyk@google.com
-yamasani@google.com
diff --git a/OWNERS b/OWNERS
index afa60be..eb2bfcf 100644
--- a/OWNERS
+++ b/OWNERS
@@ -7,8 +7,6 @@
hackbod@android.com #{LAST_RESORT_SUGGESTION}
hackbod@google.com #{LAST_RESORT_SUGGESTION}
jjaggi@google.com #{LAST_RESORT_SUGGESTION}
-jsharkey@android.com #{LAST_RESORT_SUGGESTION}
-jsharkey@google.com #{LAST_RESORT_SUGGESTION}
lorenzo@google.com #{LAST_RESORT_SUGGESTION}
michaelwr@google.com #{LAST_RESORT_SUGGESTION}
nandana@google.com #{LAST_RESORT_SUGGESTION}
@@ -33,19 +31,19 @@
per-file TestProtoLibraries.bp = file:platform/platform_testing:/libraries/health/OWNERS
per-file TestProtoLibraries.bp = file:platform/tools/tradefederation:/OWNERS
-per-file INPUT_OWNERS = file:/INPUT_OWNERS
-per-file ZYGOTE_OWNERS = file:/ZYGOTE_OWNERS
-per-file SQLITE_OWNERS = file:/SQLITE_OWNERS
-
per-file *ravenwood* = file:ravenwood/OWNERS
per-file *Ravenwood* = file:ravenwood/OWNERS
+per-file INPUT_OWNERS = file:/INPUT_OWNERS
+per-file ZYGOTE_OWNERS = file:/ZYGOTE_OWNERS
+per-file SQLITE_OWNERS = file:/SQLITE_OWNERS
per-file PERFORMANCE_OWNERS = file:/PERFORMANCE_OWNERS
-
per-file PACKAGE_MANAGER_OWNERS = file:/PACKAGE_MANAGER_OWNERS
-
per-file WEAR_OWNERS = file:/WEAR_OWNERS
-
+per-file ACTIVITY_MANAGER_OWNERS = file:/ACTIVITY_MANAGER_OWNERS
+per-file BATTERY_STATS_OWNERS = file:/BATTERY_STATS_OWNERS
+per-file OOM_ADJUSTER_OWNERS = file:/OOM_ADJUSTER_OWNERS
+per-file MULTIUSER_OWNERS = file:/MULTIUSER_OWNERS
+per-file BROADCASTS_OWNERS = file:/BROADCASTS_OWNERS
per-file ADPF_OWNERS = file:/ADPF_OWNERS
-
per-file GAME_MANAGER_OWNERS = file:/GAME_MANAGER_OWNERS
diff --git a/apex/jobscheduler/service/java/com/android/server/DeviceIdleController.java b/apex/jobscheduler/service/java/com/android/server/DeviceIdleController.java
index c1894f0..a37779e 100644
--- a/apex/jobscheduler/service/java/com/android/server/DeviceIdleController.java
+++ b/apex/jobscheduler/service/java/com/android/server/DeviceIdleController.java
@@ -3568,7 +3568,7 @@
Slog.i(TAG, "becomeActiveLocked, reason=" + activeReason
+ ", changeLightIdle=" + changeLightIdle);
}
- if (mState != STATE_ACTIVE || mLightState != STATE_ACTIVE) {
+ if (mState != STATE_ACTIVE || mLightState != LIGHT_STATE_ACTIVE) {
moveToStateLocked(STATE_ACTIVE, activeReason);
mInactiveTimeout = newInactiveTimeout;
resetIdleManagementLocked();
diff --git a/core/java/android/app/SystemServiceRegistry.java b/core/java/android/app/SystemServiceRegistry.java
index 8f298db..89d353c9 100644
--- a/core/java/android/app/SystemServiceRegistry.java
+++ b/core/java/android/app/SystemServiceRegistry.java
@@ -66,8 +66,6 @@
import android.companion.virtual.IVirtualDeviceManager;
import android.companion.virtual.VirtualDeviceManager;
import android.compat.Compatibility;
-import android.compat.annotation.ChangeId;
-import android.compat.annotation.EnabledSince;
import android.content.ClipboardManager;
import android.content.ContentCaptureOptions;
import android.content.Context;
@@ -162,8 +160,7 @@
import android.net.PacProxyManager;
import android.net.TetheringManager;
import android.net.VpnManager;
-import android.net.vcn.IVcnManagementService;
-import android.net.vcn.VcnManager;
+import android.net.vcn.VcnFrameworkInitializer;
import android.net.wifi.WifiFrameworkInitializer;
import android.net.wifi.nl80211.WifiNl80211Manager;
import android.net.wifi.sharedconnectivity.app.SharedConnectivityManager;
@@ -198,7 +195,6 @@
import android.os.ServiceManager.ServiceNotFoundException;
import android.os.StatsFrameworkInitializer;
import android.os.SystemConfigManager;
-import android.os.SystemProperties;
import android.os.SystemUpdateManager;
import android.os.SystemVibrator;
import android.os.SystemVibratorManager;
@@ -289,28 +285,6 @@
/** @hide */
public static boolean sEnableServiceNotFoundWtf = false;
- /**
- * Starting with {@link VANILLA_ICE_CREAM}, Telephony feature flags
- * (e.g. {@link PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION}) are being checked before
- * returning managers that depend on them. If the feature is missing,
- * {@link Context#getSystemService} will return null.
- *
- * This change is specific to VcnManager.
- */
- @ChangeId
- @EnabledSince(targetSdkVersion = Build.VERSION_CODES.VANILLA_ICE_CREAM)
- static final long ENABLE_CHECKING_TELEPHONY_FEATURES_FOR_VCN = 330902016;
-
- /**
- * The corresponding vendor API for Android V
- *
- * <p>Starting with Android V, the vendor API format has switched to YYYYMM.
- *
- * @see <a href="https://preview.source.android.com/docs/core/architecture/api-flags">Vendor API
- * level</a>
- */
- private static final int VENDOR_API_FOR_ANDROID_V = 202404;
-
// Service registry information.
// This information is never changed once static initialization has completed.
private static final Map<Class<?>, String> SYSTEM_SERVICE_NAMES =
@@ -472,22 +446,6 @@
return new VpnManager(ctx, service);
}});
- registerService(Context.VCN_MANAGEMENT_SERVICE, VcnManager.class,
- new CachedServiceFetcher<VcnManager>() {
- @Override
- public VcnManager createService(ContextImpl ctx) throws ServiceNotFoundException {
- final String telephonyFeatureToCheck = getVcnFeatureDependency();
-
- if (telephonyFeatureToCheck != null
- && !ctx.getPackageManager().hasSystemFeature(telephonyFeatureToCheck)) {
- return null;
- }
-
- IBinder b = ServiceManager.getService(Context.VCN_MANAGEMENT_SERVICE);
- IVcnManagementService service = IVcnManagementService.Stub.asInterface(b);
- return new VcnManager(ctx, service);
- }});
-
registerService(Context.COUNTRY_DETECTOR, CountryDetector.class,
new StaticServiceFetcher<CountryDetector>() {
@Override
@@ -1721,6 +1679,8 @@
OnDevicePersonalizationFrameworkInitializer.registerServiceWrappers();
DeviceLockFrameworkInitializer.registerServiceWrappers();
VirtualizationFrameworkInitializer.registerServiceWrappers();
+ VcnFrameworkInitializer.registerServiceWrappers();
+
if (com.android.server.telecom.flags.Flags.telecomMainlineBlockedNumbersManager()) {
ProviderFrameworkInitializer.registerServiceWrappers();
}
@@ -1782,30 +1742,6 @@
return manager.hasSystemFeature(featureName);
}
- // Suppressing AndroidFrameworkCompatChange because we're querying vendor
- // partition SDK level, not application's target SDK version (which BTW we
- // also check through Compatibility framework a few lines below).
- @SuppressWarnings("AndroidFrameworkCompatChange")
- @Nullable
- private static String getVcnFeatureDependency() {
- // Check SDK version of the client app. Apps targeting pre-V SDK might
- // have not checked for existence of these features.
- if (!Compatibility.isChangeEnabled(ENABLE_CHECKING_TELEPHONY_FEATURES_FOR_VCN)) {
- return null;
- }
-
- // Check SDK version of the vendor partition. Pre-V devices might have
- // incorrectly under-declared telephony features.
- final int vendorApiLevel = SystemProperties.getInt(
- "ro.vendor.api_level", Build.VERSION.DEVICE_INITIAL_SDK_INT);
- if (vendorApiLevel < VENDOR_API_FOR_ANDROID_V) {
- return PackageManager.FEATURE_TELEPHONY;
- } else {
- return PackageManager.FEATURE_TELEPHONY_SUBSCRIPTION;
- }
-
- }
-
/**
* Gets a system service from a given context.
* @hide
diff --git a/core/java/android/net/vcn/VcnFrameworkInitializer.java b/core/java/android/net/vcn/VcnFrameworkInitializer.java
new file mode 100644
index 0000000..8cb213b
--- /dev/null
+++ b/core/java/android/net/vcn/VcnFrameworkInitializer.java
@@ -0,0 +1,106 @@
+/*
+ * 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.net.vcn;
+
+import android.annotation.Nullable;
+import android.app.SystemServiceRegistry;
+import android.compat.Compatibility;
+import android.compat.annotation.ChangeId;
+import android.compat.annotation.EnabledSince;
+import android.content.Context;
+import android.content.pm.PackageManager;
+import android.os.Build;
+import android.os.SystemProperties;
+
+/**
+ * Class for performing registration for VCN service.
+ *
+ * @hide
+ */
+// TODO: Expose it as @SystemApi(client = MODULE_LIBRARIES)
+public final class VcnFrameworkInitializer {
+ /**
+ * Starting with {@link VANILLA_ICE_CREAM}, Telephony feature flags (e.g. {@link
+ * PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION}) are being checked before returning managers
+ * that depend on them. If the feature is missing, {@link Context#getSystemService} will return
+ * null.
+ *
+ * <p>This change is specific to VcnManager.
+ */
+ @ChangeId
+ @EnabledSince(targetSdkVersion = Build.VERSION_CODES.VANILLA_ICE_CREAM)
+ private static final long ENABLE_CHECKING_TELEPHONY_FEATURES_FOR_VCN = 330902016;
+
+ /**
+ * The corresponding vendor API for Android V
+ *
+ * <p>Starting with Android V, the vendor API format has switched to YYYYMM.
+ *
+ * @see <a href="https://preview.source.android.com/docs/core/architecture/api-flags">Vendor API
+ * level</a>
+ */
+ private static final int VENDOR_API_FOR_ANDROID_V = 202404;
+
+ private VcnFrameworkInitializer() {}
+
+ // Suppressing AndroidFrameworkCompatChange because we're querying vendor
+ // partition SDK level, not application's target SDK version (which BTW we
+ // also check through Compatibility framework a few lines below).
+ @Nullable
+ private static String getVcnFeatureDependency() {
+ // Check SDK version of the client app. Apps targeting pre-V SDK might
+ // have not checked for existence of these features.
+ if (!Compatibility.isChangeEnabled(ENABLE_CHECKING_TELEPHONY_FEATURES_FOR_VCN)) {
+ return null;
+ }
+
+ // Check SDK version of the vendor partition. Pre-V devices might have
+ // incorrectly under-declared telephony features.
+ final int vendorApiLevel =
+ SystemProperties.getInt(
+ "ro.vendor.api_level", Build.VERSION.DEVICE_INITIAL_SDK_INT);
+ if (vendorApiLevel < VENDOR_API_FOR_ANDROID_V) {
+ return PackageManager.FEATURE_TELEPHONY;
+ } else {
+ return PackageManager.FEATURE_TELEPHONY_SUBSCRIPTION;
+ }
+ }
+
+ /**
+ * Register VCN service to {@link Context}, so that {@link Context#getSystemService} can return
+ * a VcnManager.
+ *
+ * @throws IllegalStateException if this is called anywhere besides {@link
+ * SystemServiceRegistry}.
+ */
+ public static void registerServiceWrappers() {
+ SystemServiceRegistry.registerContextAwareService(
+ VcnManager.VCN_MANAGEMENT_SERVICE_STRING,
+ VcnManager.class,
+ (context, serviceBinder) -> {
+ final String telephonyFeatureToCheck = getVcnFeatureDependency();
+ if (telephonyFeatureToCheck != null
+ && !context.getPackageManager()
+ .hasSystemFeature(telephonyFeatureToCheck)) {
+ return null;
+ }
+ IVcnManagementService service =
+ IVcnManagementService.Stub.asInterface(serviceBinder);
+ return new VcnManager(context, service);
+ });
+ }
+}
diff --git a/libs/androidfw/CursorWindow.cpp b/libs/androidfw/CursorWindow.cpp
index cbb1e8f..5e645cc 100644
--- a/libs/androidfw/CursorWindow.cpp
+++ b/libs/androidfw/CursorWindow.cpp
@@ -18,11 +18,10 @@
#include <androidfw/CursorWindow.h>
-#include "android-base/logging.h"
-#include "android-base/mapped_file.h"
-#include "cutils/ashmem.h"
+#include <sys/mman.h>
-using android::base::MappedFile;
+#include "android-base/logging.h"
+#include "cutils/ashmem.h"
namespace android {
@@ -40,7 +39,7 @@
CursorWindow::~CursorWindow() {
if (mAshmemFd != -1) {
- mMappedFile.reset();
+ ::munmap(mData, mSize);
::close(mAshmemFd);
} else {
free(mData);
@@ -76,7 +75,6 @@
status_t CursorWindow::maybeInflate() {
int ashmemFd = 0;
void* newData = nullptr;
- std::unique_ptr<MappedFile> mappedFile;
// Bail early when we can't expand any further
if (mReadOnly || mSize == mInflatedSize) {
@@ -97,12 +95,11 @@
goto fail_silent;
}
- mappedFile = MappedFile::FromFd(ashmemFd, 0, mInflatedSize, PROT_READ | PROT_WRITE);
- if (mappedFile == nullptr) {
+ newData = ::mmap(nullptr, mInflatedSize, PROT_READ | PROT_WRITE, MAP_SHARED, ashmemFd, 0);
+ if (newData == MAP_FAILED) {
PLOG(ERROR) << "Failed mmap";
goto fail_silent;
}
- newData = mappedFile->data();
if (ashmem_set_prot_region(ashmemFd, PROT_READ) < 0) {
PLOG(ERROR) << "Failed ashmem_set_prot_region";
@@ -123,7 +120,6 @@
mData = newData;
mSize = mInflatedSize;
mSlotsOffset = newSlotsOffset;
- mMappedFile = std::move(mappedFile);
updateSlotsData();
}
@@ -134,7 +130,7 @@
fail:
LOG(ERROR) << "Failed maybeInflate";
fail_silent:
- mappedFile.reset();
+ ::munmap(newData, mInflatedSize);
::close(ashmemFd);
return UNKNOWN_ERROR;
}
@@ -171,12 +167,11 @@
goto fail_silent;
}
- window->mMappedFile = MappedFile::FromFd(window->mAshmemFd, 0, window->mSize, PROT_READ);
- if (window->mMappedFile == nullptr) {
+ window->mData = ::mmap(nullptr, window->mSize, PROT_READ, MAP_SHARED, window->mAshmemFd, 0);
+ if (window->mData == MAP_FAILED) {
PLOG(ERROR) << "Failed mmap";
goto fail_silent;
}
- window->mData = window->mMappedFile->data();
} else {
window->mAshmemFd = -1;
diff --git a/libs/androidfw/include/androidfw/CursorWindow.h b/libs/androidfw/include/androidfw/CursorWindow.h
index c2eac12..9ec026a 100644
--- a/libs/androidfw/include/androidfw/CursorWindow.h
+++ b/libs/androidfw/include/androidfw/CursorWindow.h
@@ -26,8 +26,6 @@
#include "binder/Parcel.h"
#include "utils/String8.h"
-#include "android-base/mapped_file.h"
-
#define LOG_WINDOW(...)
namespace android {
@@ -151,8 +149,6 @@
String8 mName;
int mAshmemFd = -1;
void* mData = nullptr;
- std::unique_ptr<android::base::MappedFile> mMappedFile;
-
/**
* Pointer to the first FieldSlot, used to optimize the extremely
* hot code path of getFieldSlot().
diff --git a/ravenwood/Android.bp b/ravenwood/Android.bp
index 8e884bc..d918201 100644
--- a/ravenwood/Android.bp
+++ b/ravenwood/Android.bp
@@ -124,6 +124,7 @@
],
libs: [
"framework-minus-apex.ravenwood",
+ "framework-configinfrastructure.ravenwood",
"ravenwood-helper-libcore-runtime",
],
sdk_version: "core_current",
@@ -395,6 +396,9 @@
"icu4j-icudata-jarjar",
"icu4j-icutzdata-jarjar",
+ // DeviceConfig
+ "framework-configinfrastructure.ravenwood",
+
// Provide runtime versions of utils linked in below
"junit",
"truth",
diff --git a/ravenwood/Framework.bp b/ravenwood/Framework.bp
index 5cb1479..1bea434 100644
--- a/ravenwood/Framework.bp
+++ b/ravenwood/Framework.bp
@@ -290,3 +290,57 @@
"core-icu4j-for-host.ravenwood.jar",
],
}
+
+///////////////////////////////////
+// framework-configinfrastructure
+///////////////////////////////////
+
+java_genrule {
+ name: "framework-configinfrastructure.ravenwood-base",
+ tools: ["hoststubgen"],
+ cmd: "$(location hoststubgen) " +
+ "@$(location :ravenwood-standard-options) " +
+
+ "--debug-log $(location framework-configinfrastructure.log) " +
+ "--stats-file $(location framework-configinfrastructure_stats.csv) " +
+ "--supported-api-list-file $(location framework-configinfrastructure_apis.csv) " +
+ "--gen-keep-all-file $(location framework-configinfrastructure_keep_all.txt) " +
+ "--gen-input-dump-file $(location framework-configinfrastructure_dump.txt) " +
+
+ "--out-impl-jar $(location ravenwood.jar) " +
+ "--in-jar $(location :framework-configinfrastructure.impl{.jar}) " +
+
+ "--policy-override-file $(location :ravenwood-common-policies) " +
+ "--policy-override-file $(location :framework-configinfrastructure-ravenwood-policies) ",
+ srcs: [
+ ":framework-configinfrastructure.impl{.jar}",
+
+ ":ravenwood-common-policies",
+ ":framework-configinfrastructure-ravenwood-policies",
+ ":ravenwood-standard-options",
+ ],
+ out: [
+ "ravenwood.jar",
+
+ // Following files are created just as FYI.
+ "framework-configinfrastructure_keep_all.txt",
+ "framework-configinfrastructure_dump.txt",
+
+ "framework-configinfrastructure.log",
+ "framework-configinfrastructure_stats.csv",
+ "framework-configinfrastructure_apis.csv",
+ ],
+ visibility: ["//visibility:private"],
+}
+
+java_genrule {
+ name: "framework-configinfrastructure.ravenwood",
+ defaults: ["ravenwood-internal-only-visibility-genrule"],
+ cmd: "cp $(in) $(out)",
+ srcs: [
+ ":framework-configinfrastructure.ravenwood-base{ravenwood.jar}",
+ ],
+ out: [
+ "framework-configinfrastructure.ravenwood.jar",
+ ],
+}
diff --git a/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodRuntimeEnvironmentController.java b/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodRuntimeEnvironmentController.java
index afa7a6c..e2d73d1 100644
--- a/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodRuntimeEnvironmentController.java
+++ b/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodRuntimeEnvironmentController.java
@@ -40,6 +40,7 @@
import android.os.Looper;
import android.os.ServiceManager;
import android.os.SystemProperties;
+import android.provider.DeviceConfig_host;
import android.system.ErrnoException;
import android.system.Os;
import android.util.Log;
@@ -333,6 +334,8 @@
}
android.os.Process.reset$ravenwood();
+ DeviceConfig_host.reset();
+
try {
ResourcesManager.setInstance(null); // Better structure needed.
} catch (Exception e) {
diff --git a/ravenwood/runtime-helper-src/framework/android/provider/DeviceConfig_host.java b/ravenwood/runtime-helper-src/framework/android/provider/DeviceConfig_host.java
new file mode 100644
index 0000000..9c2188f
--- /dev/null
+++ b/ravenwood/runtime-helper-src/framework/android/provider/DeviceConfig_host.java
@@ -0,0 +1,33 @@
+/*
+ * 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.provider;
+
+public class DeviceConfig_host {
+
+ /**
+ * Called by Ravenwood runtime to reset all local changes.
+ */
+ public static void reset() {
+ RavenwoodConfigDataStore.getInstance().clearAll();
+ }
+
+ /**
+ * Called by {@link DeviceConfig#newDataStore()}
+ */
+ public static DeviceConfigDataStore newDataStore() {
+ return RavenwoodConfigDataStore.getInstance();
+ }
+}
diff --git a/ravenwood/runtime-helper-src/framework/android/provider/RavenwoodConfigDataStore.java b/ravenwood/runtime-helper-src/framework/android/provider/RavenwoodConfigDataStore.java
new file mode 100644
index 0000000..4bc3de7
--- /dev/null
+++ b/ravenwood/runtime-helper-src/framework/android/provider/RavenwoodConfigDataStore.java
@@ -0,0 +1,253 @@
+/*
+ * 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.provider;
+
+import android.annotation.NonNull;
+import android.annotation.Nullable;
+import android.content.ContentResolver;
+import android.database.ContentObserver;
+import android.net.Uri;
+import android.os.Handler;
+import android.os.Looper;
+import android.provider.DeviceConfig.BadConfigException;
+import android.provider.DeviceConfig.MonitorCallback;
+import android.provider.DeviceConfig.Properties;
+
+import com.android.internal.annotations.GuardedBy;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.concurrent.Executor;
+
+/**
+ * {@link DeviceConfigDataStore} used only on Ravenwood.
+ *
+ * TODO(b/368591527) Support monitor callback related features
+ * TODO(b/368591527) Support "default" related features
+ */
+final class RavenwoodConfigDataStore implements DeviceConfigDataStore {
+ private static final RavenwoodConfigDataStore sInstance = new RavenwoodConfigDataStore();
+
+ private final Object mLock = new Object();
+
+ @GuardedBy("mLock")
+ private int mSyncDisabledMode = DeviceConfig.SYNC_DISABLED_MODE_NONE;
+
+ @GuardedBy("mLock")
+ private final HashMap<String, HashMap<String, String>> mStore = new HashMap<>();
+
+ private record ObserverInfo(String namespace, ContentObserver observer) {
+ }
+
+ @GuardedBy("mLock")
+ private final ArrayList<ObserverInfo> mObservers = new ArrayList<>();
+
+ static RavenwoodConfigDataStore getInstance() {
+ return sInstance;
+ }
+
+ private static void shouldNotBeCalled() {
+ throw new RuntimeException("shouldNotBeCalled");
+ }
+
+ void clearAll() {
+ synchronized (mLock) {
+ mSyncDisabledMode = DeviceConfig.SYNC_DISABLED_MODE_NONE;
+ mStore.clear();
+ }
+ }
+
+ @GuardedBy("mLock")
+ private HashMap<String, String> getNamespaceLocked(@NonNull String namespace) {
+ Objects.requireNonNull(namespace);
+ return mStore.computeIfAbsent(namespace, k -> new HashMap<>());
+ }
+
+ /** {@inheritDoc} */
+ @NonNull
+ @Override
+ public Map<String, String> getAllProperties() {
+ synchronized (mLock) {
+ var ret = new HashMap<String, String>();
+
+ for (var namespaceAndMap : mStore.entrySet()) {
+ for (var nameAndValue : namespaceAndMap.getValue().entrySet()) {
+ ret.put(namespaceAndMap.getKey() + "/" + nameAndValue.getKey(),
+ nameAndValue.getValue());
+ }
+ }
+ return ret;
+ }
+ }
+
+ /** {@inheritDoc} */
+ @NonNull
+ @Override
+ public Properties getProperties(@NonNull String namespace, @NonNull String... names) {
+ Objects.requireNonNull(namespace);
+
+ synchronized (mLock) {
+ var namespaceMap = getNamespaceLocked(namespace);
+
+ if (names.length == 0) {
+ return new Properties(namespace, Map.copyOf(namespaceMap));
+ } else {
+ var map = new HashMap<String, String>();
+ for (var name : names) {
+ Objects.requireNonNull(name);
+ map.put(name, namespaceMap.get(name));
+ }
+ return new Properties(namespace, map);
+ }
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public boolean setProperties(@NonNull Properties properties) throws BadConfigException {
+ Objects.requireNonNull(properties);
+
+ synchronized (mLock) {
+ var namespaceMap = getNamespaceLocked(properties.getNamespace());
+ for (var kv : properties.getPropertyValues().entrySet()) {
+ namespaceMap.put(
+ Objects.requireNonNull(kv.getKey()),
+ Objects.requireNonNull(kv.getValue())
+ );
+ }
+ notifyObserversLock(properties.getNamespace(),
+ properties.getKeyset().toArray(new String[0]));
+ }
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public boolean setProperty(@NonNull String namespace, @NonNull String name,
+ @Nullable String value, boolean makeDefault) {
+ Objects.requireNonNull(namespace);
+ Objects.requireNonNull(name);
+
+ synchronized (mLock) {
+ var namespaceMap = getNamespaceLocked(namespace);
+ namespaceMap.put(name, value);
+
+ // makeDefault not supported.
+ notifyObserversLock(namespace, new String[]{name});
+ }
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public boolean deleteProperty(@NonNull String namespace, @NonNull String name) {
+ Objects.requireNonNull(namespace);
+ Objects.requireNonNull(name);
+
+ synchronized (mLock) {
+ var namespaceMap = getNamespaceLocked(namespace);
+ if (namespaceMap.remove(name) != null) {
+ notifyObserversLock(namespace, new String[]{name});
+ }
+ }
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void resetToDefaults(int resetMode, @Nullable String namespace) {
+ // not supported in DeviceConfig.java
+ shouldNotBeCalled();
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void setSyncDisabledMode(int syncDisabledMode) {
+ synchronized (mLock) {
+ mSyncDisabledMode = syncDisabledMode;
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public int getSyncDisabledMode() {
+ synchronized (mLock) {
+ return mSyncDisabledMode;
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void setMonitorCallback(@NonNull ContentResolver resolver, @NonNull Executor executor,
+ @NonNull MonitorCallback callback) {
+ // not supported in DeviceConfig.java
+ shouldNotBeCalled();
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void clearMonitorCallback(@NonNull ContentResolver resolver) {
+ // not supported in DeviceConfig.java
+ shouldNotBeCalled();
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void registerContentObserver(@NonNull String namespace, boolean notifyForescendants,
+ ContentObserver contentObserver) {
+ synchronized (mLock) {
+ mObservers.add(new ObserverInfo(
+ Objects.requireNonNull(namespace),
+ Objects.requireNonNull(contentObserver)
+ ));
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void unregisterContentObserver(@NonNull ContentObserver contentObserver) {
+ synchronized (mLock) {
+ for (int i = mObservers.size() - 1; i >= 0; i--) {
+ if (mObservers.get(i).observer == contentObserver) {
+ mObservers.remove(i);
+ }
+ }
+ }
+ }
+
+ private static final Uri CONTENT_URI = Uri.parse("content://settings/config");
+
+ @GuardedBy("mLock")
+ private void notifyObserversLock(@NonNull String namespace, String[] keys) {
+ var urib = CONTENT_URI.buildUpon().appendPath(namespace);
+ for (var key : keys) {
+ urib.appendEncodedPath(key);
+ }
+ var uri = urib.build();
+
+ final var copy = List.copyOf(mObservers);
+ new Handler(Looper.getMainLooper()).post(() -> {
+ for (int i = copy.size() - 1; i >= 0; i--) {
+ if (copy.get(i).namespace.equals(namespace)) {
+ copy.get(i).observer.dispatchChange(false, uri);
+ }
+ }
+ });
+ }
+}
diff --git a/services/accessibility/OWNERS b/services/accessibility/OWNERS
index 0e35a40..4e11750 100644
--- a/services/accessibility/OWNERS
+++ b/services/accessibility/OWNERS
@@ -2,10 +2,11 @@
# Android Accessibility Framework owners
danielnorman@google.com
-aarmaly@google.com
chunkulin@google.com
fuego@google.com
sallyyuen@google.com
+yingleiw@google.com
+caseyburkhardt@google.com
# Android Accessibility members who have OWNERS but should not be sent
# day-to-day changes for code review:
diff --git a/services/core/java/com/android/server/biometrics/sensors/AuthenticationClient.java b/services/core/java/com/android/server/biometrics/sensors/AuthenticationClient.java
index daaafcb..c38ad60 100644
--- a/services/core/java/com/android/server/biometrics/sensors/AuthenticationClient.java
+++ b/services/core/java/com/android/server/biometrics/sensors/AuthenticationClient.java
@@ -115,7 +115,7 @@
}
@LockoutTracker.LockoutMode
- public int handleFailedAttempt(int userId) {
+ private int handleFailedAttempt(int userId) {
if (mLockoutTracker != null) {
mLockoutTracker.addFailedAttemptForUser(getTargetUserId());
}
diff --git a/services/core/java/com/android/server/content/OWNERS b/services/core/java/com/android/server/content/OWNERS
index b6a9fe86..5642382 100644
--- a/services/core/java/com/android/server/content/OWNERS
+++ b/services/core/java/com/android/server/content/OWNERS
@@ -1 +1,3 @@
-include /services/core/java/com/android/server/am/OWNERS
\ No newline at end of file
+include /services/core/java/com/android/server/am/OWNERS
+
+per-file Sync* = file:/apex/jobscheduler/JOB_OWNERS
\ No newline at end of file
diff --git a/services/core/java/com/android/server/net/OWNERS b/services/core/java/com/android/server/net/OWNERS
index bbc7c01..4596a44 100644
--- a/services/core/java/com/android/server/net/OWNERS
+++ b/services/core/java/com/android/server/net/OWNERS
@@ -2,7 +2,5 @@
file:platform/packages/modules/Connectivity:main:/OWNERS_core_networking
per-file NetworkPolicyManagerService.java=jackyu@google.com, sarahchin@google.com
-jsharkey@android.com
sudheersai@google.com
-yamasani@google.com
suprabh@google.com
diff --git a/services/core/java/com/android/server/security/advancedprotection/OWNERS b/services/core/java/com/android/server/security/advancedprotection/OWNERS
new file mode 100644
index 0000000..9bf5e58
--- /dev/null
+++ b/services/core/java/com/android/server/security/advancedprotection/OWNERS
@@ -0,0 +1 @@
+file:platform/frameworks/base:main:/core/java/android/security/advancedprotection/OWNERS
diff --git a/services/tests/mockingservicestests/src/com/android/server/SensitiveContentProtectionManagerServiceNotificationTest.java b/services/tests/mockingservicestests/src/com/android/server/SensitiveContentProtectionManagerServiceNotificationTest.java
index 8b65337..32135f1 100644
--- a/services/tests/mockingservicestests/src/com/android/server/SensitiveContentProtectionManagerServiceNotificationTest.java
+++ b/services/tests/mockingservicestests/src/com/android/server/SensitiveContentProtectionManagerServiceNotificationTest.java
@@ -22,9 +22,10 @@
import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation;
import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.ArgumentMatchers.anyLong;
import static org.mockito.ArgumentMatchers.eq;
-import static org.mockito.Mockito.doCallRealMethod;
+import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.never;
@@ -36,6 +37,7 @@
import android.media.projection.MediaProjectionInfo;
import android.media.projection.MediaProjectionManager;
import android.os.Process;
+import android.os.RemoteException;
import android.platform.test.annotations.RequiresFlagsDisabled;
import android.platform.test.annotations.RequiresFlagsEnabled;
import android.platform.test.flag.junit.CheckFlagsRule;
@@ -137,9 +139,17 @@
mSensitiveContentProtectionManagerService.mNotificationListener =
spy(mSensitiveContentProtectionManagerService.mNotificationListener);
- doCallRealMethod()
- .when(mSensitiveContentProtectionManagerService.mNotificationListener)
- .onListenerConnected();
+
+ // Unexpected NLS interactions when registered cause test flakes. For purposes of this test,
+ // the test will control any NLS calls.
+ try {
+ doNothing().when(mSensitiveContentProtectionManagerService.mNotificationListener)
+ .registerAsSystemService(any(), any(), anyInt());
+ doNothing().when(mSensitiveContentProtectionManagerService.mNotificationListener)
+ .unregisterAsSystemService();
+ } catch (RemoteException e) {
+ // Intra-process call, should never happen.
+ }
// Setup RankingMap and two possilbe rankings
when(mSensitiveRanking.hasSensitiveContent()).thenReturn(true);
diff --git a/services/usage/OWNERS b/services/usage/OWNERS
index f825f55..678c7ac 100644
--- a/services/usage/OWNERS
+++ b/services/usage/OWNERS
@@ -3,7 +3,6 @@
mwachens@google.com
varunshah@google.com
-yamasani@google.com
guanxin@google.com
per-file *StorageStats* = file:/core/java/android/os/storage/OWNERS