Merge "Add flag to disable .art file madvise by default" into main
diff --git a/api/StubLibraries.bp b/api/StubLibraries.bp
index 787fdee..3314b4a 100644
--- a/api/StubLibraries.bp
+++ b/api/StubLibraries.bp
@@ -648,7 +648,7 @@
java_api_library {
name: "android-non-updatable.stubs.module_lib.from-text",
- api_surface: "module_lib",
+ api_surface: "module-lib",
api_contributions: [
"api-stubs-docs-non-updatable.api.contribution",
"system-api-stubs-docs-non-updatable.api.contribution",
@@ -668,7 +668,7 @@
// generated from this module, as this module is strictly used for hiddenapi only.
java_api_library {
name: "android-non-updatable.stubs.test_module_lib",
- api_surface: "module_lib",
+ api_surface: "module-lib",
api_contributions: [
"api-stubs-docs-non-updatable.api.contribution",
"system-api-stubs-docs-non-updatable.api.contribution",
@@ -689,7 +689,7 @@
java_api_library {
name: "android-non-updatable.stubs.system_server.from-text",
- api_surface: "system_server",
+ api_surface: "system-server",
api_contributions: [
"api-stubs-docs-non-updatable.api.contribution",
"system-api-stubs-docs-non-updatable.api.contribution",
diff --git a/core/api/current.txt b/core/api/current.txt
index ab2d8c3..5acb9bf 100644
--- a/core/api/current.txt
+++ b/core/api/current.txt
@@ -10853,6 +10853,7 @@
field public static final String TELEPHONY_IMS_SERVICE = "telephony_ims";
field public static final String TELEPHONY_SERVICE = "phone";
field public static final String TELEPHONY_SUBSCRIPTION_SERVICE = "telephony_subscription_service";
+ field public static final String TETHERING_SERVICE = "tethering";
field public static final String TEXT_CLASSIFICATION_SERVICE = "textclassification";
field public static final String TEXT_SERVICES_MANAGER_SERVICE = "textservices";
field @FlaggedApi("android.media.tv.flags.enable_ad_service_fw") public static final String TV_AD_SERVICE = "tv_ad";
diff --git a/core/api/system-current.txt b/core/api/system-current.txt
index a1c18eb..34d9000 100644
--- a/core/api/system-current.txt
+++ b/core/api/system-current.txt
@@ -3851,7 +3851,6 @@
field public static final String STATS_MANAGER = "stats";
field public static final String SYSTEM_CONFIG_SERVICE = "system_config";
field public static final String SYSTEM_UPDATE_SERVICE = "system_update";
- field public static final String TETHERING_SERVICE = "tethering";
field @FlaggedApi("com.android.net.thread.platform.flags.thread_enabled_platform") public static final String THREAD_NETWORK_SERVICE = "thread_network";
field public static final String TIME_MANAGER_SERVICE = "time_manager";
field public static final String TRANSLATION_MANAGER_SERVICE = "translation";
diff --git a/core/java/android/content/Context.java b/core/java/android/content/Context.java
index 7e65439..7786937 100644
--- a/core/java/android/content/Context.java
+++ b/core/java/android/content/Context.java
@@ -4210,6 +4210,7 @@
//@hide: STATUS_BAR_SERVICE,
THREAD_NETWORK_SERVICE,
CONNECTIVITY_SERVICE,
+ TETHERING_SERVICE,
PAC_PROXY_SERVICE,
VCN_MANAGEMENT_SERVICE,
//@hide: IP_MEMORY_STORE_SERVICE,
@@ -4894,10 +4895,10 @@
/**
* Use with {@link #getSystemService(String)} to retrieve a {@link android.net.TetheringManager}
* for managing tethering functions.
- * @hide
+ *
* @see android.net.TetheringManager
*/
- @SystemApi
+ @SuppressLint("UnflaggedApi")
public static final String TETHERING_SERVICE = "tethering";
/**
diff --git a/core/java/android/hardware/usb/OWNERS b/core/java/android/hardware/usb/OWNERS
index 37604bc..1de8a24 100644
--- a/core/java/android/hardware/usb/OWNERS
+++ b/core/java/android/hardware/usb/OWNERS
@@ -1,7 +1,7 @@
# Bug component: 175220
-anothermark@google.com
+vmartensson@google.com
+nkapron@google.com
febinthattil@google.com
-aprasath@google.com
+shubhankarm@google.com
badhri@google.com
-kumarashishg@google.com
\ No newline at end of file
diff --git a/core/java/android/os/Binder.java b/core/java/android/os/Binder.java
index ed75491..86dc20c 100644
--- a/core/java/android/os/Binder.java
+++ b/core/java/android/os/Binder.java
@@ -149,6 +149,11 @@
private static volatile boolean sStackTrackingEnabled = false;
/**
+ * The extension binder object
+ */
+ private IBinder mExtension = null;
+
+ /**
* Enable Binder IPC stack tracking. If enabled, every binder transaction will be logged to
* {@link TransactionTracker}.
*
@@ -1234,7 +1239,9 @@
/** @hide */
@Override
- public final native @Nullable IBinder getExtension();
+ public final @Nullable IBinder getExtension() {
+ return mExtension;
+ }
/**
* Set the binder extension.
@@ -1242,7 +1249,12 @@
*
* @hide
*/
- public final native void setExtension(@Nullable IBinder extension);
+ public final void setExtension(@Nullable IBinder extension) {
+ mExtension = extension;
+ setExtensionNative(extension);
+ }
+
+ private final native void setExtensionNative(@Nullable IBinder extension);
/**
* Default implementation rewinds the parcels and calls onTransact. On
diff --git a/core/java/android/view/InsetsSourceControl.java b/core/java/android/view/InsetsSourceControl.java
index 7877352..c91a330 100644
--- a/core/java/android/view/InsetsSourceControl.java
+++ b/core/java/android/view/InsetsSourceControl.java
@@ -190,7 +190,7 @@
}
public void release(Consumer<SurfaceControl> surfaceReleaseConsumer) {
- if (mLeash != null) {
+ if (mLeash != null && mLeash.isValid()) {
surfaceReleaseConsumer.accept(mLeash);
}
}
diff --git a/core/java/android/window/OWNERS b/core/java/android/window/OWNERS
index 77c99b9..82d3724 100644
--- a/core/java/android/window/OWNERS
+++ b/core/java/android/window/OWNERS
@@ -3,3 +3,4 @@
include /services/core/java/com/android/server/wm/OWNERS
per-file DesktopModeFlags.java = file:/libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/OWNERS
+per-file DesktopExperienceFlags.java = file:/libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/OWNERS
diff --git a/core/java/com/android/internal/widget/LockPatternUtils.java b/core/java/com/android/internal/widget/LockPatternUtils.java
index d129762..83750ac 100644
--- a/core/java/com/android/internal/widget/LockPatternUtils.java
+++ b/core/java/com/android/internal/widget/LockPatternUtils.java
@@ -1051,7 +1051,7 @@
}
final int patternSize = pattern.size();
- byte[] res = new byte[patternSize];
+ byte[] res = newNonMovableByteArray(patternSize);
for (int i = 0; i < patternSize; i++) {
LockPatternView.Cell cell = pattern.get(i);
res[i] = (byte) (cell.getRow() * 3 + cell.getColumn() + '1');
diff --git a/core/java/com/android/internal/widget/LockscreenCredential.java b/core/java/com/android/internal/widget/LockscreenCredential.java
index 92ce990..2a12c98 100644
--- a/core/java/com/android/internal/widget/LockscreenCredential.java
+++ b/core/java/com/android/internal/widget/LockscreenCredential.java
@@ -81,9 +81,9 @@
/**
* Private constructor, use static builder methods instead.
*
- * <p> Builder methods should create a private copy of the credential bytes and pass in here.
- * LockscreenCredential will only store the reference internally without copying. This is to
- * minimize the number of extra copies introduced.
+ * <p> Builder methods should create a private copy of the credential bytes using a non-movable
+ * array and pass it in here. LockscreenCredential will only store the reference internally
+ * without copying. This is to minimize the number of extra copies introduced.
*/
private LockscreenCredential(int type, byte[] credential, boolean hasInvalidChars) {
Objects.requireNonNull(credential);
@@ -141,7 +141,7 @@
*/
public static LockscreenCredential createUnifiedProfilePassword(@NonNull byte[] password) {
return new LockscreenCredential(CREDENTIAL_TYPE_PASSWORD,
- Arrays.copyOf(password, password.length), /* hasInvalidChars= */ false);
+ copyOfArrayNonMovable(password), /* hasInvalidChars= */ false);
}
/**
@@ -237,7 +237,7 @@
/** Create a copy of the credential */
public LockscreenCredential duplicate() {
return new LockscreenCredential(mType,
- mCredential != null ? Arrays.copyOf(mCredential, mCredential.length) : null,
+ mCredential != null ? copyOfArrayNonMovable(mCredential) : null,
mHasInvalidChars);
}
@@ -252,6 +252,15 @@
}
/**
+ * Copies the given array into a new non-movable array.
+ */
+ private static byte[] copyOfArrayNonMovable(byte[] array) {
+ byte[] copy = LockPatternUtils.newNonMovableByteArray(array.length);
+ System.arraycopy(array, 0, copy, 0, array.length);
+ return copy;
+ }
+
+ /**
* Checks whether the credential meets basic requirements for setting it as a new credential.
*
* This is redundant if {@link android.app.admin.PasswordMetrics#validateCredential()}, which
@@ -440,7 +449,7 @@
* @return A byte array representing the input
*/
private static byte[] charsToBytesTruncating(CharSequence chars) {
- byte[] bytes = new byte[chars.length()];
+ byte[] bytes = LockPatternUtils.newNonMovableByteArray(chars.length());
for (int i = 0; i < chars.length(); i++) {
bytes[i] = (byte) chars.charAt(i);
}
diff --git a/core/jni/android_util_Binder.cpp b/core/jni/android_util_Binder.cpp
index 8003bb7..e85b33e 100644
--- a/core/jni/android_util_Binder.cpp
+++ b/core/jni/android_util_Binder.cpp
@@ -74,6 +74,7 @@
jmethodID mExecTransact;
jmethodID mGetInterfaceDescriptor;
jmethodID mTransactionCallback;
+ jmethodID mGetExtension;
// Object state.
jfieldID mObject;
@@ -489,8 +490,12 @@
if (mVintf) {
::android::internal::Stability::markVintf(b.get());
}
- if (mExtension != nullptr) {
- b.get()->setExtension(mExtension);
+ if (mSetExtensionCalled) {
+ jobject javaIBinderObject = env->CallObjectMethod(obj, gBinderOffsets.mGetExtension);
+ sp<IBinder> extensionFromJava = ibinderForJavaObject(env, javaIBinderObject);
+ if (extensionFromJava != nullptr) {
+ b.get()->setExtension(extensionFromJava);
+ }
}
mBinder = b;
ALOGV("Creating JavaBinder %p (refs %p) for Object %p, weakCount=%" PRId32 "\n",
@@ -516,21 +521,12 @@
mVintf = false;
}
- sp<IBinder> getExtension() {
- AutoMutex _l(mLock);
- sp<JavaBBinder> b = mBinder.promote();
- if (b != nullptr) {
- return b.get()->getExtension();
- }
- return mExtension;
- }
-
void setExtension(const sp<IBinder>& extension) {
AutoMutex _l(mLock);
- mExtension = extension;
+ mSetExtensionCalled = true;
sp<JavaBBinder> b = mBinder.promote();
if (b != nullptr) {
- b.get()->setExtension(mExtension);
+ b.get()->setExtension(extension);
}
}
@@ -542,8 +538,7 @@
// is too much binder state here, we can think about making JavaBBinder an
// sp here (avoid recreating it)
bool mVintf = false;
-
- sp<IBinder> mExtension;
+ bool mSetExtensionCalled = false;
};
// ----------------------------------------------------------------------------
@@ -1249,10 +1244,6 @@
return IPCThreadState::self()->blockUntilThreadAvailable();
}
-static jobject android_os_Binder_getExtension(JNIEnv* env, jobject obj) {
- JavaBBinderHolder* jbh = (JavaBBinderHolder*) env->GetLongField(obj, gBinderOffsets.mObject);
- return javaObjectForIBinder(env, jbh->getExtension());
-}
static void android_os_Binder_setExtension(JNIEnv* env, jobject obj, jobject extensionObject) {
JavaBBinderHolder* jbh = (JavaBBinderHolder*) env->GetLongField(obj, gBinderOffsets.mObject);
@@ -1295,8 +1286,7 @@
{ "getNativeBBinderHolder", "()J", (void*)android_os_Binder_getNativeBBinderHolder },
{ "getNativeFinalizer", "()J", (void*)android_os_Binder_getNativeFinalizer },
{ "blockUntilThreadAvailable", "()V", (void*)android_os_Binder_blockUntilThreadAvailable },
- { "getExtension", "()Landroid/os/IBinder;", (void*)android_os_Binder_getExtension },
- { "setExtension", "(Landroid/os/IBinder;)V", (void*)android_os_Binder_setExtension },
+ { "setExtensionNative", "(Landroid/os/IBinder;)V", (void*)android_os_Binder_setExtension },
};
// clang-format on
@@ -1313,6 +1303,8 @@
gBinderOffsets.mTransactionCallback =
GetStaticMethodIDOrDie(env, clazz, "transactionCallback", "(IIII)V");
gBinderOffsets.mObject = GetFieldIDOrDie(env, clazz, "mObject", "J");
+ gBinderOffsets.mGetExtension = GetMethodIDOrDie(env, clazz, "getExtension",
+ "()Landroid/os/IBinder;");
return RegisterMethodsOrDie(
env, kBinderPathName,
diff --git a/media/java/android/mtp/OWNERS b/media/java/android/mtp/OWNERS
index 77ed08b..c57265a 100644
--- a/media/java/android/mtp/OWNERS
+++ b/media/java/android/mtp/OWNERS
@@ -1,9 +1,9 @@
set noparent
-anothermark@google.com
+vmartensson@google.com
+nkapron@google.com
febinthattil@google.com
-aprasath@google.com
+shubhankarm@google.com
jsharkey@android.com
jameswei@google.com
rmojumder@google.com
-kumarashishg@google.com
diff --git a/media/jni/android_mtp_MtpDatabase.cpp b/media/jni/android_mtp_MtpDatabase.cpp
index a77bc9f..a1ce495 100644
--- a/media/jni/android_mtp_MtpDatabase.cpp
+++ b/media/jni/android_mtp_MtpDatabase.cpp
@@ -910,7 +910,7 @@
case MTP_FORMAT_TIFF:
case MTP_FORMAT_TIFF_EP:
case MTP_FORMAT_DEFINED: {
- String8 temp(path);
+ String8 temp {static_cast<std::string_view>(path)};
std::unique_ptr<FileStream> stream(new FileStream(temp));
piex::PreviewImageData image_data;
if (!GetExifFromRawImage(stream.get(), temp, image_data)) {
@@ -967,7 +967,7 @@
case MTP_FORMAT_TIFF:
case MTP_FORMAT_TIFF_EP:
case MTP_FORMAT_DEFINED: {
- String8 temp(path);
+ String8 temp {static_cast<std::string_view>(path)};
std::unique_ptr<FileStream> stream(new FileStream(temp));
piex::PreviewImageData image_data;
if (!GetExifFromRawImage(stream.get(), temp, image_data)) {
diff --git a/media/tests/MtpTests/OWNERS b/media/tests/MtpTests/OWNERS
index bdb6cdb..c57265a 100644
--- a/media/tests/MtpTests/OWNERS
+++ b/media/tests/MtpTests/OWNERS
@@ -1,9 +1,9 @@
set noparent
-anothermark@google.com
+vmartensson@google.com
+nkapron@google.com
febinthattil@google.com
-aprasath@google.com
+shubhankarm@google.com
jsharkey@android.com
jameswei@google.com
rmojumder@google.com
-kumarashishg@google.com
\ No newline at end of file
diff --git a/packages/ExtShared/Android.bp b/packages/ExtShared/Android.bp
index b1fd7f6..58016f7 100644
--- a/packages/ExtShared/Android.bp
+++ b/packages/ExtShared/Android.bp
@@ -38,6 +38,7 @@
aaptflags: ["--shared-lib"],
export_package_resources: true,
optimize: {
+ keep_runtime_invisible_annotations: true,
proguard_flags_files: ["proguard.proguard"],
},
}
diff --git a/packages/ExtShared/proguard.proguard b/packages/ExtShared/proguard.proguard
index e5dfbe1..699fbda 100644
--- a/packages/ExtShared/proguard.proguard
+++ b/packages/ExtShared/proguard.proguard
@@ -1,6 +1,8 @@
-keepparameternames
-keepattributes Exceptions,InnerClasses,Signature,Deprecated,
- SourceFile,LineNumberTable,*Annotation*,EnclosingMethod
+ SourceFile,LineNumberTable,EnclosingMethod,
+ RuntimeVisibleAnnotations,RuntimeVisibleParameterAnnotations,
+ RuntimeVisibleTypeAnnotations,AnnotationDefault
-keep public class * {
public protected *;
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsState.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsState.java
index ff08403..60fae3f 100644
--- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsState.java
+++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsState.java
@@ -18,10 +18,13 @@
import static android.os.Process.FIRST_APPLICATION_UID;
+import static com.android.aconfig_new_storage.Flags.enableAconfigStorageDaemon;
+
import android.aconfig.Aconfig.flag_permission;
import android.aconfig.Aconfig.flag_state;
import android.aconfig.Aconfig.parsed_flag;
import android.aconfig.Aconfig.parsed_flags;
+import android.aconfigd.AconfigdFlagInfo;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.content.Context;
@@ -65,14 +68,10 @@
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
-import java.io.InputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.nio.file.Files;
import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.nio.file.attribute.PosixFileAttributes;
-import java.nio.file.attribute.PosixFilePermission;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
@@ -84,18 +83,6 @@
import java.util.Set;
import java.util.concurrent.CountDownLatch;
-// FOR ACONFIGD TEST MISSION AND ROLLOUT
-import java.io.DataInputStream;
-import java.io.DataOutputStream;
-import android.util.proto.ProtoInputStream;
-import android.aconfigd.Aconfigd.StorageRequestMessage;
-import android.aconfigd.Aconfigd.StorageRequestMessages;
-import android.aconfigd.Aconfigd.StorageReturnMessage;
-import android.aconfigd.Aconfigd.StorageReturnMessages;
-import android.aconfigd.AconfigdClientSocket;
-import android.aconfigd.AconfigdFlagInfo;
-import android.aconfigd.AconfigdJavaUtils;
-import static com.android.aconfig_new_storage.Flags.enableAconfigStorageDaemon;
/**
* This class contains the state for one type of settings. It is responsible
* for saving the state asynchronously to an XML file after a mutation and
@@ -393,22 +380,6 @@
getAllAconfigFlagsFromSettings(mAconfigDefaultFlags);
}
}
-
- if (isConfigSettingsKey(mKey)) {
- requests = handleBulkSyncToNewStorage(mAconfigDefaultFlags);
- }
- }
-
- if (enableAconfigStorageDaemon()) {
- if (isConfigSettingsKey(mKey)){
- AconfigdClientSocket localSocket = AconfigdJavaUtils.getAconfigdClientSocket();
- if (requests != null) {
- InputStream res = localSocket.send(requests.getBytes());
- if (res == null) {
- Slog.w(LOG_TAG, "Bulk sync request to acongid failed.");
- }
- }
- }
}
}
@@ -482,87 +453,6 @@
return flag;
}
-
- // TODO(b/341764371): migrate aconfig flag push to GMS core
- @VisibleForTesting
- @GuardedBy("mLock")
- public ProtoOutputStream handleBulkSyncToNewStorage(
- Map<String, AconfigdFlagInfo> aconfigFlagMap) {
- // get marker or add marker if it does not exist
- Setting markerSetting = mSettings.get(BULK_SYNC_MARKER);
- int localCounter = 0;
- if (markerSetting == null) {
- markerSetting = new Setting(BULK_SYNC_MARKER, "0", false, "aconfig", "aconfig");
- mSettings.put(BULK_SYNC_MARKER, markerSetting);
- }
- try {
- localCounter = Integer.parseInt(markerSetting.value);
- } catch (NumberFormatException e) {
- // reset local counter
- markerSetting.value = "0";
- }
-
- if (enableAconfigStorageDaemon()) {
- Setting bulkSyncCounter = mSettings.get(BULK_SYNC_TRIGGER_COUNTER);
- int serverCounter = 0;
- if (bulkSyncCounter != null) {
- try {
- serverCounter = Integer.parseInt(bulkSyncCounter.value);
- } catch (NumberFormatException e) {
- // reset the local value of server counter
- bulkSyncCounter.value = "0";
- }
- }
-
- boolean shouldSync = localCounter < serverCounter;
- if (!shouldSync) {
- // CASE 1, flag is on, bulk sync marker true, nothing to do
- return null;
- } else {
- // CASE 2, flag is on, bulk sync marker false. Do following two tasks
- // (1) Do bulk sync here.
- // (2) After bulk sync, set marker to true.
-
- // first add storage reset request
- ProtoOutputStream requests = new ProtoOutputStream();
- AconfigdJavaUtils.writeResetStorageRequest(requests);
-
- // loop over all settings and add flag override requests
- for (AconfigdFlagInfo flag : aconfigFlagMap.values()) {
- // don't sync read_only flags
- if (!flag.getIsReadWrite()) {
- continue;
- }
-
- if (flag.getHasServerOverride()) {
- AconfigdJavaUtils.writeFlagOverrideRequest(
- requests,
- flag.getPackageName(),
- flag.getFlagName(),
- flag.getServerFlagValue(),
- StorageRequestMessage.SERVER_ON_REBOOT);
- }
-
- if (flag.getHasLocalOverride()) {
- AconfigdJavaUtils.writeFlagOverrideRequest(
- requests,
- flag.getPackageName(),
- flag.getFlagName(),
- flag.getLocalFlagValue(),
- StorageRequestMessage.LOCAL_ON_REBOOT);
- }
- }
-
- // mark sync has been done
- markerSetting.value = String.valueOf(serverCounter);
- scheduleWriteIfNeededLocked();
- return requests;
- }
- } else {
- return null;
- }
- }
-
@GuardedBy("mLock")
private void loadAconfigDefaultValuesLocked(List<String> filePaths) {
for (String fileName : filePaths) {
diff --git a/packages/SettingsProvider/test/src/com/android/providers/settings/SettingsStateTest.java b/packages/SettingsProvider/test/src/com/android/providers/settings/SettingsStateTest.java
index f798a35..81e1aa8 100644
--- a/packages/SettingsProvider/test/src/com/android/providers/settings/SettingsStateTest.java
+++ b/packages/SettingsProvider/test/src/com/android/providers/settings/SettingsStateTest.java
@@ -30,19 +30,20 @@
import android.platform.test.flag.junit.CheckFlagsRule;
import android.platform.test.flag.junit.DeviceFlagsValueProvider;
import android.util.Xml;
-import android.util.proto.ProtoOutputStream;
import androidx.test.InstrumentationRegistry;
import androidx.test.runner.AndroidJUnit4;
import com.android.modules.utils.TypedXmlSerializer;
-import android.platform.test.annotations.EnableFlags;
-import android.platform.test.annotations.DisableFlags;
-import android.platform.test.flag.junit.SetFlagsRule;
-
import com.google.common.base.Strings;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileOutputStream;
@@ -51,11 +52,6 @@
import java.util.List;
import java.util.Map;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.runner.RunWith;
@RunWith(AndroidJUnit4.class)
public class SettingsStateTest {
@@ -1084,124 +1080,6 @@
assertTrue(flag1.getHasLocalOverride());
}
- @Rule public final SetFlagsRule mSetFlagsRule = new SetFlagsRule();
-
- @Test
- @EnableFlags(com.android.aconfig_new_storage.Flags.FLAG_ENABLE_ACONFIG_STORAGE_DAEMON)
- public void testHandleBulkSyncWithAconfigdEnabled() {
- int configKey = SettingsState.makeKey(SettingsState.SETTINGS_TYPE_CONFIG, 0);
- Object lock = new Object();
- SettingsState settingsState =
- new SettingsState(
- InstrumentationRegistry.getContext(),
- lock,
- mSettingsFile,
- configKey,
- SettingsState.MAX_BYTES_PER_APP_PACKAGE_UNLIMITED,
- Looper.getMainLooper());
-
- Map<String, AconfigdFlagInfo> flags = new HashMap<>();
- flags.put(
- "com.android.flags/flag1",
- AconfigdFlagInfo.newBuilder()
- .setPackageName("com.android.flags")
- .setFlagName("flag1")
- .setBootFlagValue("true")
- .setIsReadWrite(true)
- .build());
-
- flags.put(
- "com.android.flags/flag2",
- AconfigdFlagInfo.newBuilder()
- .setPackageName("com.android.flags")
- .setFlagName("flag2")
- .setBootFlagValue("true")
- .setIsReadWrite(false)
- .build());
-
- String bulkSyncMarker = "aconfigd_marker/bulk_synced";
- String bulkSyncCounter =
- "core_experiments_team_internal/" +
- "BulkSyncTriggerCounterFlag__bulk_sync_trigger_counter";
-
- synchronized (lock) {
- settingsState.insertSettingLocked(bulkSyncMarker, "0", null, false, "aconfig");
- settingsState.insertSettingLocked(bulkSyncCounter, "1", null, false,
- "com.google.android.platform.core_experiments_team_internal");
-
- // first bulk sync
- ProtoOutputStream requests = settingsState.handleBulkSyncToNewStorage(flags);
- assertTrue(requests != null);
- String value = settingsState.getSettingLocked("aconfigd_marker/bulk_synced").getValue();
- assertEquals("1", value);
-
- // send time should no longer bulk sync
- requests = settingsState.handleBulkSyncToNewStorage(flags);
- assertNull(requests);
- value = settingsState.getSettingLocked("aconfigd_marker/bulk_synced").getValue();
- assertEquals("1", value);
-
- // won't sync if the marker is string
- settingsState.insertSettingLocked(bulkSyncMarker, "true", null, false, "aconfig");
- settingsState.insertSettingLocked(bulkSyncCounter, "0", null, false,
- "com.google.android.platform.core_experiments_team_internal");
- requests = settingsState.handleBulkSyncToNewStorage(flags);
- assertNull(requests);
- value = settingsState.getSettingLocked("aconfigd_marker/bulk_synced").getValue();
- assertEquals("0", value);
-
- // won't sync if the marker and counter value are the same
- settingsState.insertSettingLocked(bulkSyncMarker, "1", null, false, "aconfig");
- settingsState.insertSettingLocked(bulkSyncCounter, "1", null, false,
- "com.google.android.platform.core_experiments_team_internal");
- requests = settingsState.handleBulkSyncToNewStorage(flags);
- assertNull(requests);
- value = settingsState.getSettingLocked("aconfigd_marker/bulk_synced").getValue();
- assertEquals("1", value);
- }
- }
-
- @Test
- @DisableFlags(com.android.aconfig_new_storage.Flags.FLAG_ENABLE_ACONFIG_STORAGE_DAEMON)
- public void testHandleBulkSyncWithAconfigdDisabled() {
- int configKey = SettingsState.makeKey(SettingsState.SETTINGS_TYPE_CONFIG, 0);
- Object lock = new Object();
- SettingsState settingsState = new SettingsState(
- InstrumentationRegistry.getContext(), lock, mSettingsFile, configKey,
- SettingsState.MAX_BYTES_PER_APP_PACKAGE_UNLIMITED, Looper.getMainLooper());
-
- Map<String, AconfigdFlagInfo> flags = new HashMap<>();
- String bulkSyncMarker = "aconfigd_marker/bulk_synced";
- String bulkSyncCounter =
- "core_experiments_team_internal/" +
- "BulkSyncTriggerCounterFlag__bulk_sync_trigger_counter";
- synchronized (lock) {
- settingsState.insertSettingLocked("aconfigd_marker/bulk_synced",
- "true", null, false, "aconfig");
-
- // when aconfigd is off, should change the marker to false
- ProtoOutputStream requests = settingsState.handleBulkSyncToNewStorage(flags);
- assertNull(requests);
- String value = settingsState.getSettingLocked("aconfigd_marker/bulk_synced").getValue();
- assertEquals("0", value);
-
- // marker started with false value, after call, it should remain false
- requests = settingsState.handleBulkSyncToNewStorage(flags);
- assertNull(requests);
- value = settingsState.getSettingLocked("aconfigd_marker/bulk_synced").getValue();
- assertEquals("0", value);
-
- // won't sync
- settingsState.insertSettingLocked(bulkSyncMarker, "0", null, false, "aconfig");
- settingsState.insertSettingLocked(bulkSyncCounter, "1", null, false,
- "com.google.android.platform.core_experiments_team_internal");
- requests = settingsState.handleBulkSyncToNewStorage(flags);
- assertNull(requests);
- value = settingsState.getSettingLocked("aconfigd_marker/bulk_synced").getValue();
- assertEquals("0", value);
- }
- }
-
@Test
public void testGetAllAconfigFlagsFromSettings() throws Exception {
final Object lock = new Object();
diff --git a/packages/SystemUI/accessibility/accessibilitymenu/aconfig/Android.bp b/packages/SystemUI/accessibility/accessibilitymenu/aconfig/Android.bp
index 0ff856e..1d74774c 100644
--- a/packages/SystemUI/accessibility/accessibilitymenu/aconfig/Android.bp
+++ b/packages/SystemUI/accessibility/accessibilitymenu/aconfig/Android.bp
@@ -5,7 +5,7 @@
aconfig_declarations {
name: "com_android_a11y_menu_flags",
package: "com.android.systemui.accessibility.accessibilitymenu",
- container: "system",
+ container: "system_ext",
srcs: [
"accessibility.aconfig",
],
diff --git a/packages/SystemUI/accessibility/accessibilitymenu/aconfig/accessibility.aconfig b/packages/SystemUI/accessibility/accessibilitymenu/aconfig/accessibility.aconfig
index 6d79011..bdf6d42 100644
--- a/packages/SystemUI/accessibility/accessibilitymenu/aconfig/accessibility.aconfig
+++ b/packages/SystemUI/accessibility/accessibilitymenu/aconfig/accessibility.aconfig
@@ -1,5 +1,5 @@
package: "com.android.systemui.accessibility.accessibilitymenu"
-container: "system"
+container: "system_ext"
# NOTE: Keep alphabetized to help limit merge conflicts from multiple simultaneous editors.
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/media/dialog/OWNERS b/packages/SystemUI/multivalentTests/src/com/android/systemui/media/dialog/OWNERS
new file mode 100644
index 0000000..739d2ac
--- /dev/null
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/media/dialog/OWNERS
@@ -0,0 +1 @@
+file:/packages/SystemUI/src/com/android/systemui/media/dialog/OWNERS
diff --git a/packages/Vcn/framework-b/framework-vcn-jarjar-rules.txt b/packages/Vcn/framework-b/framework-vcn-jarjar-rules.txt
index 7e27b24..33287b7 100644
--- a/packages/Vcn/framework-b/framework-vcn-jarjar-rules.txt
+++ b/packages/Vcn/framework-b/framework-vcn-jarjar-rules.txt
@@ -1,2 +1,3 @@
rule android.net.vcn.persistablebundleutils.** android.net.connectivity.android.net.vcn.persistablebundleutils.@1
-rule android.net.vcn.util.** android.net.connectivity.android.net.vcn.util.@1
\ No newline at end of file
+rule android.net.vcn.util.** android.net.connectivity.android.net.vcn.util.@1
+rule android.util.IndentingPrintWriter android.net.connectivity.android.util.IndentingPrintWriter
\ No newline at end of file
diff --git a/ravenwood/Android.bp b/ravenwood/Android.bp
index 8e99842..adbb3af 100644
--- a/ravenwood/Android.bp
+++ b/ravenwood/Android.bp
@@ -175,9 +175,9 @@
}
java_device_for_host {
- name: "ravenwood-junit-impl-for-ravenizer",
+ name: "ravenwood-junit-for-ravenizer",
libs: [
- "ravenwood-junit-impl",
+ "ravenwood-junit",
],
visibility: [":__subpackages__"],
}
diff --git a/ravenwood/scripts/add-annotations.sh b/ravenwood/scripts/add-annotations.sh
new file mode 100755
index 0000000..3e86037
--- /dev/null
+++ b/ravenwood/scripts/add-annotations.sh
@@ -0,0 +1,84 @@
+#!/bin/bash
+# Copyright (C) 2025 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.
+
+#
+# Use "ravehleper mm" to create a shell script which:
+# - Reads read a list of methods from STDIN
+# Which basically looks like a list of 'com.android.ravenwoodtest.tests.Test1#testA'
+# - Add @DisabledOnRavenwood to them
+#
+# Example usage:
+#
+# ./add-annotations.sh $ANDROID_BUILD_TOP/frameworks/base/ravenwood/tests <METHOD-LIST.txt
+#
+# Use a different annotation instead. (Note, in order to use an at, you need to use a double-at.)
+# ./add-annotations.sh -t '@@Ignore' $ANDROID_BUILD_TOP/frameworks/base/ravenwood/tests <METHOD-LIST.txt
+#
+
+set -e
+
+# Uncomment it to always build ravenhelper (slow)
+# ${BUILD_CMD:-m} ravenhelper
+
+# We add this line to each methods found.
+# Note, if we used a single @, that'd be handled as an at file. Use
+# the double-at instead.
+annotation="@@android.platform.test.annotations.DisabledOnRavenwood"
+while getopts "t:" opt; do
+case "$opt" in
+ t)
+ annotation="$OPTARG"
+ ;;
+ '?')
+ exit 1
+ ;;
+esac
+done
+shift $(($OPTIND - 1))
+
+source_dirs="$@"
+
+OUT_SCRIPT="${OUT_SCRIPT:-/tmp/add-annotations.sh}"
+
+rm -f "$OUT_SCRIPT"
+
+
+with_flag() {
+ local flag="$1"
+ shift
+
+ for arg in "$@"; do
+ echo "$flag $arg"
+ done
+}
+
+run() {
+ echo "Running: $*"
+ "$@"
+}
+
+run ${RAVENHELPER_CMD:-ravenhelper mm} \
+ --output-script $OUT_SCRIPT \
+ --text "$annotation" \
+ $(with_flag --src $source_dirs)
+
+
+if ! [[ -f $OUT_SCRIPT ]] ; then
+ # no operations generated.
+ exit 0
+fi
+
+echo
+echo "Created script at $OUT_SCRIPT. Run it with: sh $OUT_SCRIPT"
diff --git a/ravenwood/scripts/pta-framework.sh b/ravenwood/scripts/pta-framework.sh
index 224ab59..d396839 100755
--- a/ravenwood/scripts/pta-framework.sh
+++ b/ravenwood/scripts/pta-framework.sh
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright (C) 2024 The Android Open Source Project
+# Copyright (C) 2025 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.
@@ -79,6 +79,7 @@
$extra_args
if ! [[ -f $OUT_SCRIPT ]] ; then
+ echo "No files need updating."
# no operations generated.
exit 0
fi
@@ -88,4 +89,4 @@
return 0
}
-run_pta "$extra_args"
\ No newline at end of file
+run_pta "$extra_args"
diff --git a/ravenwood/texts/ravenwood-framework-policies.txt b/ravenwood/texts/ravenwood-framework-policies.txt
index 4033782..fff9e6a 100644
--- a/ravenwood/texts/ravenwood-framework-policies.txt
+++ b/ravenwood/texts/ravenwood-framework-policies.txt
@@ -62,4 +62,4 @@
# Just enough to allow ResourcesManager to run
class android.hardware.display.DisplayManagerGlobal keep # no-pta
- method getInstance ()Landroid/hardware/display/DisplayManagerGlobal; ignore
+ method getInstance ()Landroid/hardware/display/DisplayManagerGlobal; ignore # no-pta
diff --git a/ravenwood/texts/ravenwood-standard-options.txt b/ravenwood/texts/ravenwood-standard-options.txt
index 27223d8b..91fd928 100644
--- a/ravenwood/texts/ravenwood-standard-options.txt
+++ b/ravenwood/texts/ravenwood-standard-options.txt
@@ -31,6 +31,9 @@
--remove-annotation
android.ravenwood.annotation.RavenwoodRemove
+--ignore-annotation
+ android.ravenwood.annotation.RavenwoodIgnore
+
--substitute-annotation
android.ravenwood.annotation.RavenwoodReplace
diff --git a/ravenwood/tools/hoststubgen/src/com/android/hoststubgen/HostStubGenOptions.kt b/ravenwood/tools/hoststubgen/src/com/android/hoststubgen/HostStubGenOptions.kt
index ae9276f..297420d 100644
--- a/ravenwood/tools/hoststubgen/src/com/android/hoststubgen/HostStubGenOptions.kt
+++ b/ravenwood/tools/hoststubgen/src/com/android/hoststubgen/HostStubGenOptions.kt
@@ -354,6 +354,8 @@
* Scan the arguments, and if any of them starts with an `@`, then load from the file
* and use its content as arguments.
*
+ * In order to pass an argument that starts with an '@', use '@@' instead.
+ *
* In this file, each line is treated as a single argument.
*
* The file can contain '#' as comments.
@@ -362,7 +364,10 @@
val ret = mutableListOf<String>()
args.forEach { arg ->
- if (!arg.startsWith('@')) {
+ if (arg.startsWith("@@")) {
+ ret += arg.substring(1)
+ return@forEach
+ } else if (!arg.startsWith('@')) {
ret += arg
return@forEach
}
diff --git a/ravenwood/tools/ravenhelper/src/com/android/platform/test/ravenwood/ravenhelper/RavenHelperMain.kt b/ravenwood/tools/ravenhelper/src/com/android/platform/test/ravenwood/ravenhelper/RavenHelperMain.kt
index e6efbf6..0be0c96 100644
--- a/ravenwood/tools/ravenhelper/src/com/android/platform/test/ravenwood/ravenhelper/RavenHelperMain.kt
+++ b/ravenwood/tools/ravenhelper/src/com/android/platform/test/ravenwood/ravenhelper/RavenHelperMain.kt
@@ -27,6 +27,7 @@
import com.android.hoststubgen.log
import com.android.hoststubgen.runMainWithBoilerplate
import com.android.platform.test.ravenwood.ravenhelper.policytoannot.PtaProcessor
+import com.android.platform.test.ravenwood.ravenhelper.sourcemap.MarkMethodHandler
interface SubcommandHandler {
fun handle(args: List<String>)
@@ -39,7 +40,10 @@
Subcommands:
pta: "policy-to-annotations" Convert policy file to annotations.
- (See the pta-framework.sh script for usage.) 1
+ (See the pta-framework.sh script for usage.)
+
+ mm: "mark methods" Used to add annotations (such as @DisabledOnRavenwood)
+ to methods.
""".trimIndent())
}
@@ -60,6 +64,7 @@
val subcommand = args[0]
val handler: SubcommandHandler = when (subcommand) {
"pta" -> PtaProcessor()
+ "mm" -> MarkMethodHandler()
else -> {
usage()
throw GeneralUserErrorException("Unknown subcommand '$subcommand'")
diff --git a/ravenwood/tools/ravenhelper/src/com/android/platform/test/ravenwood/ravenhelper/policytoannot/Annotations.kt b/ravenwood/tools/ravenhelper/src/com/android/platform/test/ravenwood/ravenhelper/policytoannot/Annotations.kt
index 4a11259..ef1cb5d 100644
--- a/ravenwood/tools/ravenhelper/src/com/android/platform/test/ravenwood/ravenhelper/policytoannot/Annotations.kt
+++ b/ravenwood/tools/ravenhelper/src/com/android/platform/test/ravenwood/ravenhelper/policytoannot/Annotations.kt
@@ -45,7 +45,8 @@
"@android.ravenwood.annotation.RavenwoodRedirect"
FilterPolicy.Throw ->
"@android.ravenwood.annotation.RavenwoodThrow"
- FilterPolicy.Ignore -> null // Ignore has no annotation. (because it's not very safe.)
+ FilterPolicy.Ignore ->
+ "@android.ravenwood.annotation.RavenwoodIgnore"
FilterPolicy.Remove ->
"@android.ravenwood.annotation.RavenwoodRemove"
}
diff --git a/ravenwood/tools/ravenhelper/src/com/android/platform/test/ravenwood/ravenhelper/policytoannot/Operations.kt b/ravenwood/tools/ravenhelper/src/com/android/platform/test/ravenwood/ravenhelper/policytoannot/Operations.kt
index 3531ba95..256d123 100644
--- a/ravenwood/tools/ravenhelper/src/com/android/platform/test/ravenwood/ravenhelper/policytoannot/Operations.kt
+++ b/ravenwood/tools/ravenhelper/src/com/android/platform/test/ravenwood/ravenhelper/policytoannot/Operations.kt
@@ -24,6 +24,8 @@
import com.android.hoststubgen.log
import java.io.BufferedWriter
import java.io.File
+import java.io.FileOutputStream
+import java.io.OutputStreamWriter
enum class SourceOperationType {
/** Insert a line */
@@ -198,4 +200,26 @@
}
}
}
+}
+
+fun createShellScript(ops: SourceOperations, scriptFile: String?): Boolean {
+ if (ops.size == 0) {
+ log.i("No files need to be updated.")
+ return false
+ }
+
+ val scriptWriter = BufferedWriter(
+ OutputStreamWriter(
+ scriptFile?.let { file ->
+ FileOutputStream(file)
+ } ?: System.out
+ ))
+
+ scriptWriter.use { writer ->
+ scriptFile?.let {
+ log.i("Creating script file at $it ...")
+ }
+ createShellScript(ops, writer)
+ }
+ return true
}
\ No newline at end of file
diff --git a/ravenwood/tools/ravenhelper/src/com/android/platform/test/ravenwood/ravenhelper/policytoannot/PtaProcessor.kt b/ravenwood/tools/ravenhelper/src/com/android/platform/test/ravenwood/ravenhelper/policytoannot/PtaProcessor.kt
index 5984e4f..3657a90 100644
--- a/ravenwood/tools/ravenhelper/src/com/android/platform/test/ravenwood/ravenhelper/policytoannot/PtaProcessor.kt
+++ b/ravenwood/tools/ravenhelper/src/com/android/platform/test/ravenwood/ravenhelper/policytoannot/PtaProcessor.kt
@@ -31,10 +31,7 @@
import com.android.platform.test.ravenwood.ravenhelper.sourcemap.ClassInfo
import com.android.platform.test.ravenwood.ravenhelper.sourcemap.MethodInfo
import com.android.platform.test.ravenwood.ravenhelper.sourcemap.SourceLoader
-import java.io.BufferedWriter
-import java.io.FileOutputStream
import java.io.FileReader
-import java.io.OutputStreamWriter
import java.util.regex.Pattern
/**
@@ -55,25 +52,7 @@
)
converter.process()
- val ops = converter.resultOperations
-
- if (ops.size == 0) {
- log.i("No files need to be updated.")
- return
- }
-
- val scriptWriter = BufferedWriter(OutputStreamWriter(
- options.outputScriptFile.get?.let { file ->
- FileOutputStream(file)
- } ?: System.out
- ))
-
- scriptWriter.use { writer ->
- options.outputScriptFile.get?.let {
- log.i("Creating script file at $it ...")
- }
- createShellScript(ops, writer)
- }
+ createShellScript(converter.resultOperations, options.outputScriptFile.get)
}
}
@@ -424,7 +403,7 @@
if (methodsAndAnnot == null) {
classHasMember = true
- return // This policy can't converted.
+ return // This policy can't be converted.
}
val methods = methodsAndAnnot.first
val annot = methodsAndAnnot.second
@@ -476,4 +455,4 @@
classHasMember = true
}
}
-}
\ No newline at end of file
+}
diff --git a/ravenwood/tools/ravenhelper/src/com/android/platform/test/ravenwood/ravenhelper/sourcemap/MapOptions.kt b/ravenwood/tools/ravenhelper/src/com/android/platform/test/ravenwood/ravenhelper/sourcemap/MapOptions.kt
new file mode 100644
index 0000000..ee200bb
--- /dev/null
+++ b/ravenwood/tools/ravenhelper/src/com/android/platform/test/ravenwood/ravenhelper/sourcemap/MapOptions.kt
@@ -0,0 +1,95 @@
+/*
+ * Copyright (C) 2025 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 com.android.platform.test.ravenwood.ravenhelper.sourcemap
+
+import com.android.hoststubgen.ArgIterator
+import com.android.hoststubgen.ArgumentsException
+import com.android.hoststubgen.SetOnce
+import com.android.hoststubgen.ensureFileExists
+import com.android.hoststubgen.log
+
+/**
+ * Options for the "ravenhelper map" subcommand.
+ */
+class MapOptions(
+ /** Source files or directories. */
+ var sourceFilesOrDirectories: MutableList<String> = mutableListOf(),
+
+ /** Files containing target methods */
+ var targetMethodFiles: MutableList<String> = mutableListOf(),
+
+ /** Output script file. */
+ var outputScriptFile: SetOnce<String?> = SetOnce(null),
+
+ /** Text to insert. */
+ var text: SetOnce<String?> = SetOnce(null),
+) {
+ companion object {
+ fun parseArgs(args: List<String>): MapOptions {
+ val ret = MapOptions()
+ val ai = ArgIterator.withAtFiles(args.toTypedArray())
+
+ while (true) {
+ val arg = ai.nextArgOptional() ?: break
+
+ fun nextArg(): String = ai.nextArgRequired(arg)
+
+ if (log.maybeHandleCommandLineArg(arg) { nextArg() }) {
+ continue
+ }
+ try {
+ when (arg) {
+ // TODO: Write help
+ "-h", "--help" -> TODO("Help is not implemented yet")
+
+ "-s", "--src" ->
+ ret.sourceFilesOrDirectories.add(nextArg().ensureFileExists())
+
+ "-i", "--input" ->
+ ret.targetMethodFiles.add(nextArg().ensureFileExists())
+
+ "-o", "--output-script" ->
+ ret.outputScriptFile.set(nextArg())
+
+ "-t", "--text" ->
+ ret.text.set(nextArg())
+
+ else -> throw ArgumentsException("Unknown option: $arg")
+ }
+ } catch (e: SetOnce.SetMoreThanOnceException) {
+ throw ArgumentsException("Duplicate or conflicting argument found: $arg")
+ }
+ }
+
+ if (ret.sourceFilesOrDirectories.size == 0) {
+ throw ArgumentsException("Must specify at least one source path")
+ }
+
+ return ret
+ }
+ }
+
+ override fun toString(): String {
+ return """
+ PtaOptions{
+ sourceFilesOrDirectories=$sourceFilesOrDirectories
+ targetMethods=$targetMethodFiles
+ outputScriptFile=$outputScriptFile
+ text=$text
+ }
+ """.trimIndent()
+ }
+}
\ No newline at end of file
diff --git a/ravenwood/tools/ravenhelper/src/com/android/platform/test/ravenwood/ravenhelper/sourcemap/MarkMethodHandler.kt b/ravenwood/tools/ravenhelper/src/com/android/platform/test/ravenwood/ravenhelper/sourcemap/MarkMethodHandler.kt
new file mode 100644
index 0000000..8085253
--- /dev/null
+++ b/ravenwood/tools/ravenhelper/src/com/android/platform/test/ravenwood/ravenhelper/sourcemap/MarkMethodHandler.kt
@@ -0,0 +1,197 @@
+/*
+ * Copyright (C) 2025 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 com.android.platform.test.ravenwood.ravenhelper.sourcemap
+
+import com.android.hoststubgen.GeneralUserErrorException
+import com.android.hoststubgen.log
+import com.android.platform.test.ravenwood.ravenhelper.SubcommandHandler
+import com.android.platform.test.ravenwood.ravenhelper.policytoannot.SourceOperation
+import com.android.platform.test.ravenwood.ravenhelper.policytoannot.SourceOperationType
+import com.android.platform.test.ravenwood.ravenhelper.policytoannot.SourceOperations
+import com.android.platform.test.ravenwood.ravenhelper.policytoannot.createShellScript
+import com.android.platform.test.ravenwood.ravenhelper.psi.createUastEnvironment
+import java.io.BufferedReader
+import java.io.FileReader
+
+/**
+ * This is the main routine of the "mm" subcommands, which marks specified methods with
+ * a given line, which defaults to "@DisabledOnRavenwood". This can be used to add bulk-annotate
+ * tests methods that are failing.
+ *
+ * See the javadoc of [MarkMethodProcessor] for more details.
+ */
+class MarkMethodHandler : SubcommandHandler {
+ override fun handle(args: List<String>) {
+ val options = MapOptions.parseArgs(args)
+
+ log.i("Options: $options")
+
+ // Files from which we load a list of methods.
+ val inputFiles = if (options.targetMethodFiles.isEmpty()) {
+ log.w("[Reading method list from STDIN...]")
+ log.flush()
+ listOf("/dev/stdin")
+ } else {
+ options.targetMethodFiles
+ }
+
+ // A string to inject before each method.
+ val text = if (options.text.isSet) {
+ options.text.get!!
+ } else {
+ "@android.platform.test.annotations.DisabledOnRavenwood"
+ }
+
+ // Process.
+ val processor = MarkMethodProcessor(
+ options.sourceFilesOrDirectories,
+ inputFiles,
+ text,
+ )
+ processor.process()
+
+ // Create the output script.
+ createShellScript(processor.resultOperations, options.outputScriptFile.get)
+ }
+}
+
+/**
+ * Load a list of methods / classes from [targetMethodFiles], and inject [textToInsert] to
+ * each of them, to the source files under [sourceFilesOrDirectories]
+ *
+ * An example input files look like this -- this can be generated from atest output.
+ * <pre>
+
+ # We add @DisabledOnRavenwood to the following methods.
+ com.android.ravenwoodtest.tests.Test1#testA
+ com.android.ravenwoodtest.tests.Test1#testB
+ com.android.ravenwoodtest.tests.Test1#testC
+
+ # We add @DisabledOnRavenwood to the following class.
+ com.android.ravenwoodtest.tests.Test2
+
+ # Special case: we add the annotation to the class too.
+ com.android.ravenwoodtest.tests.Test3#initializationError
+ </pre>
+
+ */
+private class MarkMethodProcessor(
+ private val sourceFilesOrDirectories: List<String>,
+ private val targetMethodFiles: List<String>,
+ private val textToInsert: String,
+) {
+ private val classes = AllClassInfo()
+ val resultOperations = SourceOperations()
+
+ /**
+ * Entry point.
+ */
+ fun process() {
+ val env = createUastEnvironment()
+ try {
+ loadSources()
+
+ processInputFiles()
+ } finally {
+ env.dispose()
+ }
+ }
+
+ private fun loadSources() {
+ val env = createUastEnvironment()
+ try {
+ val loader = SourceLoader(env)
+ loader.load(sourceFilesOrDirectories, classes)
+ } finally {
+ env.dispose()
+ }
+ }
+
+ /**
+ * Process liput files. Input files looks like this:
+ * <pre>
+ * # We add @DisabledOnRavenwood to the following methods.
+ * com.android.ravenwoodtest.tests.Test1#testA
+ * com.android.ravenwoodtest.tests.Test1#testB
+ * com.android.ravenwoodtest.tests.Test1#testC
+ *
+ * # We add @DisabledOnRavenwood to the following class.
+ * com.android.ravenwoodtest.tests.Test2
+ *
+ * # Special case: we add the annotation to the class too.
+ * com.android.ravenwoodtest.tests.Test3#initializationError
+ * </pre>
+ */
+ private fun processInputFiles() {
+ targetMethodFiles.forEach { filename ->
+ BufferedReader(FileReader(filename)).use { reader ->
+ reader.readLines().forEach { line ->
+ if (line.isBlank() || line.startsWith('#')) {
+ return@forEach
+ }
+ processSingleLine(line)
+ }
+ }
+ }
+ }
+
+ private fun processSingleLine(line: String) {
+ val cm = line.split("#") // Class and method
+ if (cm.size > 2) {
+ throw GeneralUserErrorException("Input line \"$line\" contains too many #'s")
+ }
+ val className = cm[0]
+ val methodName = if (cm.size == 2 && cm[1] != "initializationError") {
+ cm[1]
+ } else {
+ ""
+ }
+
+ // Find class info
+ val ci = classes.findClass(className)
+ ?: throw GeneralUserErrorException("Class \"$className\" not found\"")
+
+ if (methodName == "") {
+ processClass(ci)
+ } else {
+ processMethod(ci, methodName)
+ }
+ }
+
+ private fun processClass(ci: ClassInfo) {
+ addOperation(ci.location, "Class ${ci.fullName}")
+ }
+
+ private fun processMethod(ci: ClassInfo, methodName: String) {
+ var methods = ci.methods[methodName]
+ ?: throw GeneralUserErrorException("method \"$methodName\" not found\"")
+ methods.forEach { mi ->
+ addOperation(mi.location, "Method ${mi.name}")
+ }
+ }
+
+ private fun addOperation(loc: Location, description: String) {
+ resultOperations.add(
+ SourceOperation(
+ loc.file,
+ loc.line,
+ SourceOperationType.Insert,
+ loc.getIndent() + textToInsert,
+ description
+ )
+ )
+ }
+}
diff --git a/ravenwood/tools/ravenizer/Android.bp b/ravenwood/tools/ravenizer/Android.bp
index 2892d07..a52a04b 100644
--- a/ravenwood/tools/ravenizer/Android.bp
+++ b/ravenwood/tools/ravenizer/Android.bp
@@ -19,7 +19,7 @@
"ow2-asm-tree",
"ow2-asm-util",
"junit",
- "ravenwood-junit-impl-for-ravenizer",
+ "ravenwood-junit-for-ravenizer",
],
visibility: ["//visibility:public"],
}
diff --git a/services/core/java/com/android/server/am/SettingsToPropertiesMapper.java b/services/core/java/com/android/server/am/SettingsToPropertiesMapper.java
index 8d8064f..ccc0a256 100644
--- a/services/core/java/com/android/server/am/SettingsToPropertiesMapper.java
+++ b/services/core/java/com/android/server/am/SettingsToPropertiesMapper.java
@@ -113,6 +113,7 @@
DeviceConfig.NAMESPACE_LMKD_NATIVE,
DeviceConfig.NAMESPACE_MEDIA_NATIVE,
DeviceConfig.NAMESPACE_MGLRU_NATIVE,
+ DeviceConfig.NAMESPACE_MMD_NATIVE,
DeviceConfig.NAMESPACE_NETD_NATIVE,
DeviceConfig.NAMESPACE_NNAPI_NATIVE,
DeviceConfig.NAMESPACE_PROFCOLLECT_NATIVE_BOOT,
diff --git a/services/core/java/com/android/server/audio/AudioService.java b/services/core/java/com/android/server/audio/AudioService.java
index 5b9bab7..b09a192 100644
--- a/services/core/java/com/android/server/audio/AudioService.java
+++ b/services/core/java/com/android/server/audio/AudioService.java
@@ -12506,10 +12506,10 @@
int uid = intent.getIntExtra(Intent.EXTRA_UID, Process.INVALID_UID);
if (intent.getBooleanExtra(EXTRA_REPLACING, false) ||
intent.getBooleanExtra(EXTRA_ARCHIVAL, false)) return;
- if (action.equals(ACTION_PACKAGE_ADDED)) {
+ if (ACTION_PACKAGE_ADDED.equals(action)) {
audioserverExecutor.execute(() ->
provider.onModifyPackageState(uid, pkgName, false /* isRemoved */));
- } else if (action.equals(ACTION_PACKAGE_REMOVED)) {
+ } else if (ACTION_PACKAGE_REMOVED.equals(action)) {
audioserverExecutor.execute(() ->
provider.onModifyPackageState(uid, pkgName, true /* isRemoved */));
}
diff --git a/services/core/java/com/android/server/infra/OWNERS b/services/core/java/com/android/server/infra/OWNERS
index 4fea05d..0f0d382 100644
--- a/services/core/java/com/android/server/infra/OWNERS
+++ b/services/core/java/com/android/server/infra/OWNERS
@@ -1,3 +1,4 @@
# Bug component: 655446
srazdan@google.com
+reemabajwa@google.com
diff --git a/services/foldables/devicestateprovider/src/com/android/server/policy/feature/Android.bp b/services/foldables/devicestateprovider/src/com/android/server/policy/feature/Android.bp
index 6393e11..1db9e8d 100644
--- a/services/foldables/devicestateprovider/src/com/android/server/policy/feature/Android.bp
+++ b/services/foldables/devicestateprovider/src/com/android/server/policy/feature/Android.bp
@@ -1,7 +1,7 @@
aconfig_declarations {
name: "device_state_flags",
package: "com.android.server.policy.feature.flags",
- container: "system",
+ container: "system_ext",
srcs: [
"device_state_flags.aconfig",
],
diff --git a/services/foldables/devicestateprovider/src/com/android/server/policy/feature/device_state_flags.aconfig b/services/foldables/devicestateprovider/src/com/android/server/policy/feature/device_state_flags.aconfig
index 21e33dd..f827b55 100644
--- a/services/foldables/devicestateprovider/src/com/android/server/policy/feature/device_state_flags.aconfig
+++ b/services/foldables/devicestateprovider/src/com/android/server/policy/feature/device_state_flags.aconfig
@@ -1,5 +1,5 @@
package: "com.android.server.policy.feature.flags"
-container: "system"
+container: "system_ext"
flag {
name: "enable_dual_display_blocking"
diff --git a/services/usb/OWNERS b/services/usb/OWNERS
index 2dff392..2592612 100644
--- a/services/usb/OWNERS
+++ b/services/usb/OWNERS
@@ -1,9 +1,9 @@
-anothermark@google.com
+vmartensson@google.com
+nkapron@google.com
febinthattil@google.com
-aprasath@google.com
+shubhankarm@google.com
badhri@google.com
elaurent@google.com
albertccwang@google.com
jameswei@google.com
howardyen@google.com
-kumarashishg@google.com
\ No newline at end of file