Merge "Migrate test mapping options -> Android.bp" into main
diff --git a/apct-tests/perftests/core/src/android/libcore/SystemArrayCopyPerfTest.java b/apct-tests/perftests/core/src/android/libcore/SystemArrayCopyPerfTest.java
index 6363e9c..25e4c43 100644
--- a/apct-tests/perftests/core/src/android/libcore/SystemArrayCopyPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/SystemArrayCopyPerfTest.java
@@ -16,7 +16,8 @@
package android.libcore;
-import android.perftests.utils.BenchmarkState;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
@@ -34,7 +35,8 @@
@RunWith(JUnitParamsRunner.class)
@LargeTest
public class SystemArrayCopyPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule
+ public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
public static Collection<Object[]> getData() {
return Arrays.asList(
@@ -51,7 +53,7 @@
final int len = arrayLength;
char[] src = new char[len];
char[] dst = new char[len];
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
System.arraycopy(src, 0, dst, 0, len);
}
@@ -63,7 +65,7 @@
final int len = arrayLength;
byte[] src = new byte[len];
byte[] dst = new byte[len];
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
System.arraycopy(src, 0, dst, 0, len);
}
@@ -75,7 +77,7 @@
final int len = arrayLength;
short[] src = new short[len];
short[] dst = new short[len];
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
System.arraycopy(src, 0, dst, 0, len);
}
@@ -87,7 +89,7 @@
final int len = arrayLength;
int[] src = new int[len];
int[] dst = new int[len];
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
System.arraycopy(src, 0, dst, 0, len);
}
@@ -99,7 +101,7 @@
final int len = arrayLength;
long[] src = new long[len];
long[] dst = new long[len];
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
System.arraycopy(src, 0, dst, 0, len);
}
@@ -111,7 +113,7 @@
final int len = arrayLength;
float[] src = new float[len];
float[] dst = new float[len];
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
System.arraycopy(src, 0, dst, 0, len);
}
@@ -123,7 +125,7 @@
final int len = arrayLength;
double[] src = new double[len];
double[] dst = new double[len];
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
System.arraycopy(src, 0, dst, 0, len);
}
@@ -135,7 +137,7 @@
final int len = arrayLength;
boolean[] src = new boolean[len];
boolean[] dst = new boolean[len];
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
System.arraycopy(src, 0, dst, 0, len);
}
diff --git a/apex/jobscheduler/service/java/com/android/server/DeviceIdleController.java b/apex/jobscheduler/service/java/com/android/server/DeviceIdleController.java
index 11d3e96..a21d810c 100644
--- a/apex/jobscheduler/service/java/com/android/server/DeviceIdleController.java
+++ b/apex/jobscheduler/service/java/com/android/server/DeviceIdleController.java
@@ -2628,8 +2628,13 @@
for (int i=0; i<allowPowerExceptIdle.size(); i++) {
String pkg = allowPowerExceptIdle.valueAt(i);
try {
+ // On some devices (eg. HSUM), some apps may
+ // be not be pre-installed on user 0, but may be
+ // pre-installed on FULL users. Look for pre-installed system
+ // apps across all users to make sure they're properly
+ // allowlisted.
ApplicationInfo ai = pm.getApplicationInfo(pkg,
- PackageManager.MATCH_SYSTEM_ONLY);
+ PackageManager.MATCH_ANY_USER | PackageManager.MATCH_SYSTEM_ONLY);
int appid = UserHandle.getAppId(ai.uid);
mPowerSaveWhitelistAppsExceptIdle.put(ai.packageName, appid);
mPowerSaveWhitelistSystemAppIdsExceptIdle.put(appid, true);
@@ -2640,8 +2645,13 @@
for (int i=0; i<allowPower.size(); i++) {
String pkg = allowPower.valueAt(i);
try {
+ // On some devices (eg. HSUM), some apps may
+ // be not be pre-installed on user 0, but may be
+ // pre-installed on FULL users. Look for pre-installed system
+ // apps across all users to make sure they're properly
+ // allowlisted.
ApplicationInfo ai = pm.getApplicationInfo(pkg,
- PackageManager.MATCH_SYSTEM_ONLY);
+ PackageManager.MATCH_ANY_USER | PackageManager.MATCH_SYSTEM_ONLY);
int appid = UserHandle.getAppId(ai.uid);
// These apps are on both the whitelist-except-idle as well
// as the full whitelist, so they apply in all cases.
diff --git a/core/api/system-current.txt b/core/api/system-current.txt
index 02c88e2..ccae2ba 100644
--- a/core/api/system-current.txt
+++ b/core/api/system-current.txt
@@ -11883,6 +11883,7 @@
field public static final String ACTION_MANAGE_APP_OVERLAY_PERMISSION = "android.settings.MANAGE_APP_OVERLAY_PERMISSION";
field public static final String ACTION_MANAGE_DOMAIN_URLS = "android.settings.MANAGE_DOMAIN_URLS";
field public static final String ACTION_MANAGE_MORE_DEFAULT_APPS_SETTINGS = "android.settings.MANAGE_MORE_DEFAULT_APPS_SETTINGS";
+ field @FlaggedApi("android.nfc.nfc_action_manage_services_settings") public static final String ACTION_MANAGE_OTHER_NFC_SERVICES_SETTINGS = "android.settings.MANAGE_OTHER_NFC_SERVICES_SETTINGS";
field public static final String ACTION_NOTIFICATION_POLICY_ACCESS_DETAIL_SETTINGS = "android.settings.NOTIFICATION_POLICY_ACCESS_DETAIL_SETTINGS";
field public static final String ACTION_REQUEST_ENABLE_CONTENT_CAPTURE = "android.settings.REQUEST_ENABLE_CONTENT_CAPTURE";
field public static final String ACTION_SHOW_ADMIN_SUPPORT_DETAILS = "android.settings.SHOW_ADMIN_SUPPORT_DETAILS";
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index 51585af..beeab14 100644
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -2256,6 +2256,26 @@
"android.settings.MANAGE_MORE_DEFAULT_APPS_SETTINGS";
/**
+ * Activity Action: Show Other NFC services settings.
+ * <p>
+ * If a Settings activity handles this intent action, an "Other NFC services" entry will be
+ * shown in the Default payment app settings, and clicking it will launch that activity.
+ * <p>
+ * In some cases, a matching Activity may not exist, so ensure you safeguard against this.
+ * <p>
+ * Input: Nothing.
+ * <p>
+ * Output: Nothing.
+ *
+ * @hide
+ */
+ @FlaggedApi(android.nfc.Flags.FLAG_NFC_ACTION_MANAGE_SERVICES_SETTINGS)
+ @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
+ @SystemApi
+ public static final String ACTION_MANAGE_OTHER_NFC_SERVICES_SETTINGS =
+ "android.settings.MANAGE_OTHER_NFC_SERVICES_SETTINGS";
+
+ /**
* Activity Action: Show app screen size list settings for user to override app aspect
* ratio.
* <p>
diff --git a/core/java/android/util/NtpTrustedTime.java b/core/java/android/util/NtpTrustedTime.java
index 3adbd68..9f54d9f 100644
--- a/core/java/android/util/NtpTrustedTime.java
+++ b/core/java/android/util/NtpTrustedTime.java
@@ -24,7 +24,7 @@
import android.content.res.Resources;
import android.net.ConnectivityManager;
import android.net.Network;
-import android.net.NetworkInfo;
+import android.net.NetworkCapabilities;
import android.net.SntpClient;
import android.os.Build;
import android.os.SystemClock;
@@ -687,8 +687,16 @@
if (connectivityManager == null) {
return false;
}
- final NetworkInfo ni = connectivityManager.getNetworkInfo(network);
-
+ final NetworkCapabilities networkCapabilities =
+ connectivityManager.getNetworkCapabilities(network);
+ if (networkCapabilities == null) {
+ if (LOGD) Log.d(TAG, "getNetwork: failed to get network capabilities");
+ return false;
+ }
+ final boolean isConnectedToInternet = networkCapabilities.hasCapability(
+ NetworkCapabilities.NET_CAPABILITY_INTERNET)
+ && networkCapabilities.hasCapability(
+ NetworkCapabilities.NET_CAPABILITY_VALIDATED);
// This connectivity check is to avoid performing a DNS lookup for the time server on a
// unconnected network. There are races to obtain time in Android when connectivity
// changes, which means that forceRefresh() can be called by various components before
@@ -698,8 +706,8 @@
// A side effect of check is that tests that run a fake NTP server on the device itself
// will only be able to use it if the active network is connected, even though loopback
// addresses are actually reachable.
- if (ni == null || !ni.isConnected()) {
- if (LOGD) Log.d(TAG, "getNetwork: no connectivity");
+ if (!isConnectedToInternet) {
+ if (LOGD) Log.d(TAG, "getNetwork: no internet connectivity");
return false;
}
return true;
diff --git a/core/java/android/view/contentprotection/OWNERS b/core/java/android/view/contentprotection/OWNERS
index b3583a7..48052c6 100644
--- a/core/java/android/view/contentprotection/OWNERS
+++ b/core/java/android/view/contentprotection/OWNERS
@@ -1,4 +1,6 @@
-# Bug component: 544200
+# Bug component: 1040349
-include /core/java/android/view/contentcapture/OWNERS
+njagar@google.com
+williamluh@google.com
+aaronjosephs@google.com
diff --git a/core/jni/com_android_internal_os_Zygote.cpp b/core/jni/com_android_internal_os_Zygote.cpp
index dbbcbad..5d8d73b 100644
--- a/core/jni/com_android_internal_os_Zygote.cpp
+++ b/core/jni/com_android_internal_os_Zygote.cpp
@@ -59,8 +59,7 @@
#include <sys/resource.h>
#include <sys/socket.h>
#include <sys/stat.h>
-#define _REALLY_INCLUDE_SYS__SYSTEM_PROPERTIES_H_
-#include <sys/_system_properties.h>
+#include <sys/system_properties.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/un.h>
diff --git a/core/tests/coretests/src/android/view/contentprotection/OWNERS b/core/tests/coretests/src/android/view/contentprotection/OWNERS
index b3583a7..3d09da3 100644
--- a/core/tests/coretests/src/android/view/contentprotection/OWNERS
+++ b/core/tests/coretests/src/android/view/contentprotection/OWNERS
@@ -1,4 +1,4 @@
-# Bug component: 544200
+# Bug component: 1040349
-include /core/java/android/view/contentcapture/OWNERS
+include /core/java/android/view/contentprotection/OWNERS
diff --git a/nfc/java/android/nfc/INfcAdapter.aidl b/nfc/java/android/nfc/INfcAdapter.aidl
index 90ca92f..c5b82ed 100644
--- a/nfc/java/android/nfc/INfcAdapter.aidl
+++ b/nfc/java/android/nfc/INfcAdapter.aidl
@@ -88,7 +88,7 @@
boolean isReaderOptionEnabled();
boolean isReaderOptionSupported();
@JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS)")
- boolean enableReaderOption(boolean enable);
+ boolean enableReaderOption(boolean enable, in String pkg);
boolean isObserveModeSupported();
boolean isObserveModeEnabled();
boolean setObserveMode(boolean enabled, String pkg);
diff --git a/nfc/java/android/nfc/NfcAdapter.java b/nfc/java/android/nfc/NfcAdapter.java
index b36b705..525e2c5 100644
--- a/nfc/java/android/nfc/NfcAdapter.java
+++ b/nfc/java/android/nfc/NfcAdapter.java
@@ -2011,7 +2011,8 @@
if (!sHasNfcFeature) {
throw new UnsupportedOperationException();
}
- return callServiceReturn(() -> sService.enableReaderOption(enable), false);
+ return callServiceReturn(() ->
+ sService.enableReaderOption(enable, mContext.getPackageName()), false);
}
diff --git a/nfc/java/android/nfc/flags.aconfig b/nfc/java/android/nfc/flags.aconfig
index 29699fc..4d70d4a 100644
--- a/nfc/java/android/nfc/flags.aconfig
+++ b/nfc/java/android/nfc/flags.aconfig
@@ -125,3 +125,10 @@
bug: "321310044"
}
+flag {
+ name: "nfc_action_manage_services_settings"
+ is_exported: true
+ namespace: "nfc"
+ description: "Add Settings.ACTION_MANAGE_OTHER_NFC_SERVICES_SETTINGS"
+ bug: "358129872"
+}
diff --git a/services/contentcapture/java/com/android/server/contentprotection/OWNERS b/services/contentcapture/java/com/android/server/contentprotection/OWNERS
new file mode 100644
index 0000000..3d09da3
--- /dev/null
+++ b/services/contentcapture/java/com/android/server/contentprotection/OWNERS
@@ -0,0 +1,4 @@
+# Bug component: 1040349
+
+include /core/java/android/view/contentprotection/OWNERS
+
diff --git a/services/core/java/com/android/server/wm/Task.java b/services/core/java/com/android/server/wm/Task.java
index a310992..4a2694b 100644
--- a/services/core/java/com/android/server/wm/Task.java
+++ b/services/core/java/com/android/server/wm/Task.java
@@ -4772,6 +4772,9 @@
mTransitionController.collect(topActivity);
final Task lastParentBeforePip = topActivity.getLastParentBeforePip();
+ // Reset the activity windowing mode to match the parent.
+ topActivity.getRequestedOverrideConfiguration()
+ .windowConfiguration.setWindowingMode(WINDOWING_MODE_UNDEFINED);
topActivity.reparent(lastParentBeforePip,
lastParentBeforePip.getChildCount() /* top */,
"movePinnedActivityToOriginalTask");
diff --git a/services/core/java/com/android/server/wm/Transition.java b/services/core/java/com/android/server/wm/Transition.java
index 7edc3a2..e7af870 100644
--- a/services/core/java/com/android/server/wm/Transition.java
+++ b/services/core/java/com/android/server/wm/Transition.java
@@ -1745,8 +1745,9 @@
// already been reset by the original hiding-transition's finishTransaction (we can't
// show in the finishTransaction because by then the activity doesn't hide until
// surface placement).
- for (WindowContainer p = ar.getParent(); p != null && !containsChangeFor(p, mTargets);
- p = p.getParent()) {
+ for (WindowContainer p = ar.getParent();
+ p != null && !containsChangeFor(p, mTargets) && !p.isOrganized();
+ p = p.getParent()) {
if (p.getSurfaceControl() != null) {
transaction.show(p.getSurfaceControl());
}
diff --git a/services/proguard.flags b/services/proguard.flags
index f84eff7..21d0488 100644
--- a/services/proguard.flags
+++ b/services/proguard.flags
@@ -57,9 +57,6 @@
-keep public class com.android.server.utils.Slogf { *; }
# Referenced in wear-service
-# HIDL interfaces
--keep public class android.hidl.base.** { *; }
--keep public class android.hidl.manager.** { *; }
-keep public class com.android.server.wm.WindowManagerInternal { *; }
# JNI keep rules
@@ -112,8 +109,16 @@
-keep,allowoptimization,allowaccessmodification class com.android.server.SystemService { *; }
-keep,allowoptimization,allowaccessmodification class com.android.server.SystemService$TargetUser { *; }
-keep,allowoptimization,allowaccessmodification class com.android.server.usage.StorageStatsManagerLocal { *; }
--keep,allowoptimization,allowaccessmodification class com.android.internal.util.** { *; }
--keep,allowoptimization,allowaccessmodification class android.os.** { *; }
+
+# Prevent optimizations of any statically linked code that may shadow code in
+# the bootclasspath. See also StrictJavaPackagesTest for details on exceptions.
+# TODO(b/222468116): Resolve such collisions in the build system.
+-keep public class android.gsi.** { *; }
+-keep public class android.hidl.base.** { *; }
+-keep public class android.hidl.manager.** { *; }
+-keep public class android.os.** { *; }
+-keep public class com.android.internal.util.** { *; }
+-keep public class com.android.modules.utils.build.** { *; }
# CoverageService guards optional jacoco class references with a runtime guard, so we can safely
# suppress build-time warnings.
diff --git a/services/tests/servicestests/src/com/android/server/contentprotection/OWNERS b/services/tests/servicestests/src/com/android/server/contentprotection/OWNERS
index 24561c5..3d09da3 100644
--- a/services/tests/servicestests/src/com/android/server/contentprotection/OWNERS
+++ b/services/tests/servicestests/src/com/android/server/contentprotection/OWNERS
@@ -1,3 +1,4 @@
-# Bug component: 544200
+# Bug component: 1040349
-include /core/java/android/view/contentcapture/OWNERS
+include /core/java/android/view/contentprotection/OWNERS
+