summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--DREAM_MANAGER_OWNERS1
-rw-r--r--api/StubLibraries.bp20
-rw-r--r--cmds/bootanimation/BootAnimation.cpp2
-rw-r--r--cmds/bootanimation/FORMAT.md2
-rw-r--r--cmds/uiautomator/library/core-src/com/android/uiautomator/core/AccessibilityNodeInfoDumper.java10
-rw-r--r--config/Android.bp2
-rw-r--r--core/java/android/accessibilityservice/AccessibilityService.java4
-rw-r--r--core/java/android/accounts/AccountManager.java2
-rw-r--r--core/java/android/app/OWNERS3
-rw-r--r--core/java/android/app/admin/flags/flags.aconfig10
-rw-r--r--core/java/android/app/prediction/OWNERS2
-rw-r--r--core/java/android/net/NetworkPolicyManager.java6
-rw-r--r--core/java/android/net/vcn/flags.aconfig10
-rw-r--r--core/java/android/os/VintfObject.java18
-rw-r--r--core/java/android/permission/OWNERS3
-rw-r--r--core/java/android/security/flags.aconfig15
-rw-r--r--core/java/android/view/FocusFinder.java4
-rw-r--r--core/java/android/webkit/WebChromeClient.java22
-rw-r--r--core/java/com/android/internal/content/om/OverlayConfigParser.java101
-rw-r--r--core/java/com/android/internal/pm/pkg/parsing/ParsingPackageUtils.java14
-rw-r--r--core/java/com/android/internal/ravenwood/RavenwoodEnvironment.java55
-rw-r--r--core/jni/Android.bp4
-rw-r--r--core/jni/android_os_VintfObject.cpp90
-rw-r--r--core/jni/com_android_internal_os_Zygote.cpp14
-rw-r--r--core/res/res/xml/sms_short_codes.xml9
-rw-r--r--core/tests/coretests/Android.bp3
-rw-r--r--core/tests/coretests/src/android/net/OWNERS3
-rw-r--r--core/tests/coretests/src/android/os/VintfObjectTest.java39
-rw-r--r--core/tests/coretests/src/com/android/internal/content/res/OverlayConfigParserTest.java119
-rw-r--r--core/tests/coretests/src/com/android/internal/ravenwood/RavenwoodEnvironmentTest.java38
-rw-r--r--data/keyboards/Android.bp6
-rw-r--r--graphics/java/android/graphics/BitmapFactory.java34
-rw-r--r--graphics/java/android/graphics/Canvas.java14
-rw-r--r--graphics/java/android/graphics/ComposePathEffect.java4
-rw-r--r--graphics/java/android/graphics/FontFamily.java2
-rw-r--r--graphics/java/android/graphics/FontListParser.java4
-rw-r--r--graphics/java/android/graphics/FrameInfo.java2
-rw-r--r--graphics/java/android/graphics/Interpolator.java28
-rw-r--r--graphics/java/android/graphics/LightingColorFilter.java4
-rw-r--r--graphics/java/android/graphics/LinearGradient.java4
-rw-r--r--graphics/java/android/graphics/Matrix.java2
-rw-r--r--graphics/java/android/graphics/Mesh.java10
-rw-r--r--graphics/java/android/graphics/NinePatch.java18
-rw-r--r--graphics/java/android/graphics/PathMeasure.java8
-rw-r--r--graphics/java/android/graphics/Rasterizer.java4
-rw-r--r--graphics/java/android/graphics/Rect.java18
-rw-r--r--graphics/java/android/graphics/RectF.java48
-rw-r--r--graphics/java/android/graphics/RenderNode.java8
-rw-r--r--graphics/java/android/graphics/SurfaceTexture.java4
-rw-r--r--graphics/java/android/graphics/Typeface.java6
-rw-r--r--graphics/java/android/graphics/Xfermode.java6
-rw-r--r--graphics/java/android/graphics/YuvImage.java2
-rw-r--r--graphics/java/android/graphics/drawable/AdaptiveIconDrawable.java2
-rw-r--r--graphics/java/android/graphics/drawable/Drawable.java2
-rw-r--r--graphics/java/android/graphics/drawable/GradientDrawable.java2
-rw-r--r--graphics/java/android/graphics/drawable/shapes/PathShape.java2
-rw-r--r--graphics/java/android/graphics/fonts/Font.java2
-rw-r--r--graphics/java/android/graphics/fonts/FontFileUtil.java4
-rw-r--r--graphics/java/android/graphics/fonts/SystemFonts.java2
-rw-r--r--graphics/java/android/graphics/text/LineBreaker.java4
-rw-r--r--graphics/java/android/graphics/text/PositionedGlyphs.java2
-rw-r--r--keystore/java/android/security/KeyStore.java31
-rw-r--r--libs/WindowManager/Shell/tests/flicker/service/Android.bp4
-rw-r--r--libs/androidfw/fuzz/resourcefile_fuzzer/Android.bp14
-rw-r--r--nfc/java/android/nfc/NfcActivityManager.java16
-rw-r--r--nfc/java/android/nfc/NfcAdapter.java5
-rw-r--r--nfc/java/android/nfc/cardemulation/CardEmulation.java6
-rw-r--r--nfc/java/android/nfc/cardemulation/HostApduService.java2
-rw-r--r--packages/DynamicSystemInstallationService/src/com/android/dynsystem/DynamicSystemInstallationService.java2
-rw-r--r--proto/src/am_capabilities.proto8
-rw-r--r--ravenwood/OWNERS4
-rw-r--r--ravenwood/ravenwood-annotation-allowed-classes.txt2
-rw-r--r--services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java4
-rw-r--r--services/companion/java/com/android/server/companion/securechannel/SecureChannel.java10
-rw-r--r--services/core/java/com/android/server/BootReceiver.java28
-rw-r--r--services/core/java/com/android/server/PinnerService.java13
-rw-r--r--services/core/java/com/android/server/SystemConfig.java8
-rw-r--r--services/core/java/com/android/server/VcnManagementService.java20
-rw-r--r--services/core/java/com/android/server/WallpaperUpdateReceiver.java9
-rw-r--r--services/core/java/com/android/server/am/ActivityManagerService.java9
-rw-r--r--services/core/java/com/android/server/am/ActivityManagerShellCommand.java10
-rw-r--r--services/core/java/com/android/server/audio/AudioService.java7
-rw-r--r--services/core/java/com/android/server/audio/MusicFxHelper.java21
-rw-r--r--services/core/java/com/android/server/audio/SpatializerHelper.java5
-rw-r--r--services/core/java/com/android/server/locksettings/LockSettingsService.java16
-rw-r--r--services/core/java/com/android/server/net/NetworkManagementService.java228
-rw-r--r--services/core/java/com/android/server/net/NetworkPolicyLogger.java14
-rw-r--r--services/core/java/com/android/server/net/NetworkPolicyManagerService.java89
-rw-r--r--services/core/java/com/android/server/net/flags.aconfig10
-rw-r--r--services/core/java/com/android/server/pm/AppDataHelper.java9
-rw-r--r--services/core/java/com/android/server/rollback/RollbackPackageHealthObserver.java2
-rw-r--r--services/core/java/com/android/server/rollback/WatchdogRollbackLogger.java2
-rw-r--r--services/core/java/com/android/server/wm/ActivityStarter.java2
-rw-r--r--services/core/java/com/android/server/wm/OWNERS1
-rw-r--r--services/devicepolicy/java/com/android/server/devicepolicy/NonRequiredPackageDeleteObserver.java27
-rw-r--r--services/permission/java/com/android/server/permission/access/permission/PermissionService.kt14
-rw-r--r--services/profcollect/src/com/android/server/profcollect/ProfcollectForwardingService.java85
-rw-r--r--services/tests/apexsystemservices/OWNERS3
-rw-r--r--services/tests/mockingservicestests/src/com/android/server/RescuePartyTest.java12
-rw-r--r--services/tests/mockingservicestests/src/com/android/server/am/OWNERS2
-rw-r--r--services/tests/servicestests/AndroidTest.xml7
-rw-r--r--services/tests/servicestests/src/com/android/server/audio/MusicFxHelperTest.java80
-rw-r--r--services/tests/servicestests/src/com/android/server/net/NetworkManagementServiceTest.java78
-rw-r--r--tests/BinderLeakTest/Android.bp3
-rw-r--r--tests/FlickerTests/IME/Android.bp4
-rw-r--r--tests/FlickerTests/Rotation/Android.bp4
-rw-r--r--tests/Input/src/android/hardware/input/KeyboardLayoutPreviewTests.kt6
-rw-r--r--tests/vcn/java/com/android/server/VcnManagementServiceTest.java37
-rw-r--r--tools/aapt/Symbol.h3
-rw-r--r--tools/hoststubgen/OWNERS4
110 files changed, 1371 insertions, 492 deletions
diff --git a/DREAM_MANAGER_OWNERS b/DREAM_MANAGER_OWNERS
new file mode 100644
index 000000000000..48bde6024cba
--- /dev/null
+++ b/DREAM_MANAGER_OWNERS
@@ -0,0 +1 @@
+brycelee@google.com
diff --git a/api/StubLibraries.bp b/api/StubLibraries.bp
index f2c39be28bcf..f77f1c638f09 100644
--- a/api/StubLibraries.bp
+++ b/api/StubLibraries.bp
@@ -44,13 +44,13 @@ non_updatable_exportable_droidstubs {
removed_api_file: ":non-updatable-removed.txt",
},
last_released: {
- api_file: ":android-non-updatable.api.public.latest",
- removed_api_file: ":android-non-updatable-removed.api.public.latest",
+ api_file: ":android-non-updatable.api.combined.public.latest",
+ removed_api_file: ":android-non-updatable-removed.api.combined.public.latest",
baseline_file: ":android-non-updatable-incompatibilities.api.public.latest",
},
api_lint: {
enabled: true,
- new_since: ":android.api.public.latest",
+ new_since: ":android.api.combined.public.latest",
baseline_file: ":non-updatable-lint-baseline.txt",
},
},
@@ -124,13 +124,13 @@ non_updatable_exportable_droidstubs {
removed_api_file: ":non-updatable-system-removed.txt",
},
last_released: {
- api_file: ":android-non-updatable.api.system.latest",
- removed_api_file: ":android-non-updatable-removed.api.system.latest",
+ api_file: ":android-non-updatable.api.combined.system.latest",
+ removed_api_file: ":android-non-updatable-removed.api.combined.system.latest",
baseline_file: ":android-non-updatable-incompatibilities.api.system.latest",
},
api_lint: {
enabled: true,
- new_since: ":android.api.system.latest",
+ new_since: ":android.api.combined.system.latest",
baseline_file: ":non-updatable-system-lint-baseline.txt",
},
},
@@ -185,7 +185,7 @@ non_updatable_exportable_droidstubs {
},
api_lint: {
enabled: true,
- new_since: ":android.api.test.latest",
+ new_since: ":android.api.combined.test.latest",
baseline_file: ":non-updatable-test-lint-baseline.txt",
},
},
@@ -263,13 +263,13 @@ non_updatable_exportable_droidstubs {
removed_api_file: ":non-updatable-module-lib-removed.txt",
},
last_released: {
- api_file: ":android-non-updatable.api.module-lib.latest",
- removed_api_file: ":android-non-updatable-removed.api.module-lib.latest",
+ api_file: ":android-non-updatable.api.combined.module-lib.latest",
+ removed_api_file: ":android-non-updatable-removed.api.combined.module-lib.latest",
baseline_file: ":android-non-updatable-incompatibilities.api.module-lib.latest",
},
api_lint: {
enabled: true,
- new_since: ":android.api.module-lib.latest",
+ new_since: ":android.api.combined.module-lib.latest",
baseline_file: ":non-updatable-module-lib-lint-baseline.txt",
},
},
diff --git a/cmds/bootanimation/BootAnimation.cpp b/cmds/bootanimation/BootAnimation.cpp
index 77b74e9898b8..5adcd930e341 100644
--- a/cmds/bootanimation/BootAnimation.cpp
+++ b/cmds/bootanimation/BootAnimation.cpp
@@ -707,11 +707,11 @@ void BootAnimation::resizeSurface(int newWidth, int newHeight) {
eglMakeCurrent(mDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
eglDestroySurface(mDisplay, mSurface);
- mFlingerSurfaceControl->updateDefaultBufferSize(newWidth, newHeight);
const auto limitedSize = limitSurfaceSize(newWidth, newHeight);
mWidth = limitedSize.width;
mHeight = limitedSize.height;
+ mFlingerSurfaceControl->updateDefaultBufferSize(mWidth, mHeight);
EGLConfig config = getEglConfig(mDisplay);
EGLSurface surface = eglCreateWindowSurface(mDisplay, config, mFlingerSurface.get(), nullptr);
if (eglMakeCurrent(mDisplay, surface, surface, mContext) == EGL_FALSE) {
diff --git a/cmds/bootanimation/FORMAT.md b/cmds/bootanimation/FORMAT.md
index 01e8fe13fdf6..da8331af1492 100644
--- a/cmds/bootanimation/FORMAT.md
+++ b/cmds/bootanimation/FORMAT.md
@@ -126,7 +126,7 @@ the system property `service.bootanim.exit` to a nonzero string.)
Use `zopflipng` if you have it, otherwise `pngcrush` will do. e.g.:
for fn in *.png ; do
- zopflipng -m ${fn}s ${fn}s.new && mv -f ${fn}s.new ${fn}
+ zopflipng -m ${fn} ${fn}.new && mv -f ${fn}.new ${fn}
# or: pngcrush -q ....
done
diff --git a/cmds/uiautomator/library/core-src/com/android/uiautomator/core/AccessibilityNodeInfoDumper.java b/cmds/uiautomator/library/core-src/com/android/uiautomator/core/AccessibilityNodeInfoDumper.java
index 488292d68620..f726361effd6 100644
--- a/cmds/uiautomator/library/core-src/com/android/uiautomator/core/AccessibilityNodeInfoDumper.java
+++ b/cmds/uiautomator/library/core-src/com/android/uiautomator/core/AccessibilityNodeInfoDumper.java
@@ -292,13 +292,17 @@ public class AccessibilityNodeInfoDumper {
int childCount = node.getChildCount();
for (int x = 0; x < childCount; x++) {
AccessibilityNodeInfo childNode = node.getChild(x);
-
+ if (childNode == null) {
+ continue;
+ }
if (!safeCharSeqToString(childNode.getContentDescription()).isEmpty()
- || !safeCharSeqToString(childNode.getText()).isEmpty())
+ || !safeCharSeqToString(childNode.getText()).isEmpty()) {
return true;
+ }
- if (childNafCheck(childNode))
+ if (childNafCheck(childNode)) {
return true;
+ }
}
return false;
}
diff --git a/config/Android.bp b/config/Android.bp
index adce203e1140..c9948c31f1c3 100644
--- a/config/Android.bp
+++ b/config/Android.bp
@@ -33,7 +33,7 @@ prebuilt_etc {
name: "preloaded-classes",
src: "preloaded-classes",
filename: "preloaded-classes",
- installable: false,
+ no_full_install: true,
}
filegroup {
diff --git a/core/java/android/accessibilityservice/AccessibilityService.java b/core/java/android/accessibilityservice/AccessibilityService.java
index 2a7dbab2bfd1..e7e3a8563319 100644
--- a/core/java/android/accessibilityservice/AccessibilityService.java
+++ b/core/java/android/accessibilityservice/AccessibilityService.java
@@ -364,12 +364,12 @@ public abstract class AccessibilityService extends Service {
public static final int GESTURE_SWIPE_UP_AND_RIGHT = 14;
/**
- * The user has performed an down and left gesture on the touch screen.
+ * The user has performed a down and left gesture on the touch screen.
*/
public static final int GESTURE_SWIPE_DOWN_AND_LEFT = 15;
/**
- * The user has performed an down and right gesture on the touch screen.
+ * The user has performed a down and right gesture on the touch screen.
*/
public static final int GESTURE_SWIPE_DOWN_AND_RIGHT = 16;
diff --git a/core/java/android/accounts/AccountManager.java b/core/java/android/accounts/AccountManager.java
index 7ee3413550af..497d47adc7cc 100644
--- a/core/java/android/accounts/AccountManager.java
+++ b/core/java/android/accounts/AccountManager.java
@@ -2015,7 +2015,7 @@ public class AccountManager {
* null for no callback
* @param handler {@link Handler} identifying the callback thread,
* null for the main thread
- * @return An {@link AccountManagerFuture} which resolves to a Boolean indicated wether it
+ * @return An {@link AccountManagerFuture} which resolves to a Boolean indicated whether it
* succeeded.
* @hide
*/
diff --git a/core/java/android/app/OWNERS b/core/java/android/app/OWNERS
index 712f3e534a1c..02f00ba006d8 100644
--- a/core/java/android/app/OWNERS
+++ b/core/java/android/app/OWNERS
@@ -60,6 +60,9 @@ per-file ReceiverInfo* = file:/BROADCASTS_OWNERS
# ComponentCaller
per-file ComponentCaller.java = file:COMPONENT_CALLER_OWNERS
+# DreamManager
+per-file DreamManager.java = file:/DREAM_MANAGER_OWNERS
+
# GrammaticalInflectionManager
per-file *GrammaticalInflection* = file:/services/core/java/com/android/server/grammaticalinflection/OWNERS
diff --git a/core/java/android/app/admin/flags/flags.aconfig b/core/java/android/app/admin/flags/flags.aconfig
index 6600ca9989bb..649b8126a371 100644
--- a/core/java/android/app/admin/flags/flags.aconfig
+++ b/core/java/android/app/admin/flags/flags.aconfig
@@ -44,6 +44,16 @@ flag {
}
flag {
+ name: "hsum_unlock_notification_fix"
+ namespace: "enterprise"
+ description: "Using the right userId when starting the work profile unlock flow "
+ bug: "327350831"
+ metadata {
+ purpose: PURPOSE_BUGFIX
+ }
+}
+
+flag {
name: "dumpsys_policy_engine_migration_enabled"
namespace: "enterprise"
description: "Update DumpSys to include information about migrated APIs in DPE"
diff --git a/core/java/android/app/prediction/OWNERS b/core/java/android/app/prediction/OWNERS
index fe012da8e307..73168fb90dbc 100644
--- a/core/java/android/app/prediction/OWNERS
+++ b/core/java/android/app/prediction/OWNERS
@@ -1,2 +1,4 @@
+pinyaoting@google.com
+hyunyoungs@google.com
adamcohen@google.com
sunnygoyal@google.com
diff --git a/core/java/android/net/NetworkPolicyManager.java b/core/java/android/net/NetworkPolicyManager.java
index 594ec18d9996..334b2316b268 100644
--- a/core/java/android/net/NetworkPolicyManager.java
+++ b/core/java/android/net/NetworkPolicyManager.java
@@ -173,6 +173,12 @@ public class NetworkPolicyManager {
public static final String FIREWALL_CHAIN_NAME_LOW_POWER_STANDBY = "low_power_standby";
/** @hide */
public static final String FIREWALL_CHAIN_NAME_BACKGROUND = "background";
+ /** @hide */
+ public static final String FIREWALL_CHAIN_NAME_METERED_ALLOW = "metered_allow";
+ /** @hide */
+ public static final String FIREWALL_CHAIN_NAME_METERED_DENY_USER = "metered_deny_user";
+ /** @hide */
+ public static final String FIREWALL_CHAIN_NAME_METERED_DENY_ADMIN = "metered_deny_admin";
private static final boolean ALLOW_PLATFORM_APP_POLICY = true;
diff --git a/core/java/android/net/vcn/flags.aconfig b/core/java/android/net/vcn/flags.aconfig
index 9fe0befb4f97..d4d1ed22dd4e 100644
--- a/core/java/android/net/vcn/flags.aconfig
+++ b/core/java/android/net/vcn/flags.aconfig
@@ -38,6 +38,16 @@ flag{
}
flag{
+ name: "enforce_main_user"
+ namespace: "vcn"
+ description: "Enforce main user to make VCN HSUM compatible"
+ bug: "310310661"
+ metadata {
+ purpose: PURPOSE_BUGFIX
+ }
+}
+
+flag{
name: "handle_seq_num_leap"
namespace: "vcn"
description: "Do not report bad network when there is a suspected sequence number leap"
diff --git a/core/java/android/os/VintfObject.java b/core/java/android/os/VintfObject.java
index 505655775239..bb89e0791053 100644
--- a/core/java/android/os/VintfObject.java
+++ b/core/java/android/os/VintfObject.java
@@ -17,8 +17,11 @@
package android.os;
import android.annotation.NonNull;
+import android.annotation.Nullable;
import android.annotation.TestApi;
+import android.app.ActivityThread;
+import java.io.IOException;
import java.util.Map;
/**
@@ -113,5 +116,20 @@ public class VintfObject {
@TestApi
public static native Long getTargetFrameworkCompatibilityMatrixVersion();
+ /**
+ * Executes a shell command using shell user identity, and return the standard output in string.
+ *
+ * @hide
+ */
+ private static @Nullable String runShellCommand(@NonNull String command) throws IOException {
+ var activityThread = ActivityThread.currentActivityThread();
+ var instrumentation = activityThread.getInstrumentation();
+ var automation = instrumentation.getUiAutomation();
+ var pfd = automation.executeShellCommand(command);
+ try (var is = new ParcelFileDescriptor.AutoCloseInputStream(pfd)) {
+ return new String(is.readAllBytes());
+ }
+ }
+
private VintfObject() {}
}
diff --git a/core/java/android/permission/OWNERS b/core/java/android/permission/OWNERS
index d2f4b50eaa1b..857bacd34714 100644
--- a/core/java/android/permission/OWNERS
+++ b/core/java/android/permission/OWNERS
@@ -1,14 +1,13 @@
# Bug component: 137825
-augale@google.com
evanseverson@google.com
fayey@google.com
jaysullivan@google.com
joecastro@google.com
-kvakil@google.com
mrulhania@google.com
ntmyren@google.com
rmacgregor@google.com
theianchen@google.com
yutingfang@google.com
zhanghai@google.com
+kiranmr@google.com
diff --git a/core/java/android/security/flags.aconfig b/core/java/android/security/flags.aconfig
index 7d1c86bb2a37..aadc8db903eb 100644
--- a/core/java/android/security/flags.aconfig
+++ b/core/java/android/security/flags.aconfig
@@ -79,8 +79,15 @@ flag {
}
flag {
- name: "report_primary_auth_attempts"
- namespace: "biometrics"
- description: "Report primary auth attempts from LockSettingsService"
- bug: "285053096"
+ name: "report_primary_auth_attempts"
+ namespace: "biometrics"
+ description: "Report primary auth attempts from LockSettingsService"
+ bug: "285053096"
+}
+
+flag {
+ name: "dump_attestation_verifications"
+ namespace: "hardware_backed_security"
+ description: "Add a dump capability for attestation_verification service"
+ bug: "335498868"
}
diff --git a/core/java/android/view/FocusFinder.java b/core/java/android/view/FocusFinder.java
index 064bc6947fc4..5c49e24439bb 100644
--- a/core/java/android/view/FocusFinder.java
+++ b/core/java/android/view/FocusFinder.java
@@ -129,7 +129,7 @@ public class FocusFinder {
}
ViewGroup effective = null;
ViewParent nextParent = focused.getParent();
- do {
+ while (nextParent instanceof ViewGroup) {
if (nextParent == root) {
return effective != null ? effective : root;
}
@@ -143,7 +143,7 @@ public class FocusFinder {
effective = vg;
}
nextParent = nextParent.getParent();
- } while (nextParent instanceof ViewGroup);
+ }
return root;
}
diff --git a/core/java/android/webkit/WebChromeClient.java b/core/java/android/webkit/WebChromeClient.java
index a07141b260ee..b7ee0b8a238a 100644
--- a/core/java/android/webkit/WebChromeClient.java
+++ b/core/java/android/webkit/WebChromeClient.java
@@ -520,6 +520,13 @@ public class WebChromeClient {
* To cancel the request, call <code>filePathCallback.onReceiveValue(null)</code> and
* return {@code true}.
*
+ * <p class="note"><b>Note:</b> WebView does not enforce any restrictions on
+ * the chosen file(s). WebView can access all files that your app can access.
+ * In case the file(s) are chosen through an untrusted source such as a third-party
+ * app, it is your own app's responsibility to check what the returned Uris
+ * refer to before calling the <code>filePathCallback</code>. See
+ * {@link #createIntent} and {@link #parseResult} for more details.</p>
+ *
* @param webView The WebView instance that is initiating the request.
* @param filePathCallback Invoke this callback to supply the list of paths to files to upload,
* or {@code null} to cancel. Must only be called if the
@@ -556,6 +563,15 @@ public class WebChromeClient {
* Parse the result returned by the file picker activity. This method should be used with
* {@link #createIntent}. Refer to {@link #createIntent} for how to use it.
*
+ * <p class="note"><b>Note:</b> The intent returned by the file picker activity
+ * should be treated as untrusted. A third-party app handling the implicit
+ * intent created by {@link #createIntent} might return Uris that the third-party
+ * app itself does not have access to, such as your own app's sensitive data files.
+ * WebView does not enforce any restrictions on the returned Uris. It is the
+ * app's responsibility to ensure that the untrusted source (such as a third-party
+ * app) has access the Uris it has returned and that the Uris are not pointing
+ * to any sensitive data files.</p>
+ *
* @param resultCode the integer result code returned by the file picker activity.
* @param data the intent returned by the file picker activity.
* @return the Uris of selected file(s) or {@code null} if the resultCode indicates
@@ -618,6 +634,12 @@ public class WebChromeClient {
* WebChromeClient#onShowFileChooser}</li>
* </ol>
*
+ * <p class="note"><b>Note:</b> The created intent may be handled by
+ * third-party applications on device. The received result must be treated
+ * as untrusted as it can contain Uris pointing to your own app's sensitive
+ * data files. Your app should check the resultant Uris in {@link #parseResult}
+ * before calling the <code>filePathCallback</code>.</p>
+ *
* @return an Intent that supports basic file chooser sources.
*/
public abstract Intent createIntent();
diff --git a/core/java/com/android/internal/content/om/OverlayConfigParser.java b/core/java/com/android/internal/content/om/OverlayConfigParser.java
index faaf7d5cef18..8132652ed6f4 100644
--- a/core/java/com/android/internal/content/om/OverlayConfigParser.java
+++ b/core/java/com/android/internal/content/om/OverlayConfigParser.java
@@ -24,6 +24,8 @@ import android.content.pm.PackagePartitions;
import android.content.pm.PackagePartitions.SystemPartition;
import android.os.Build;
import android.os.FileUtils;
+import android.os.SystemProperties;
+import android.text.TextUtils;
import android.util.ArraySet;
import android.util.Log;
import android.util.Xml;
@@ -241,6 +243,18 @@ public final class OverlayConfigParser {
}
}
+ @FunctionalInterface
+ public interface SysPropWrapper{
+ /**
+ * Get system property
+ *
+ * @param property the key to look up.
+ *
+ * @return The property value if found, empty string otherwise.
+ */
+ String get(String property);
+ }
+
/**
* Retrieves overlays configured within the partition in increasing priority order.
*
@@ -320,6 +334,76 @@ public final class OverlayConfigParser {
}
/**
+ * Expand the property inside a rro configuration path.
+ *
+ * A RRO configuration can contain a property, this method expands
+ * the property to its value.
+ *
+ * Only read only properties allowed, prefixed with ro. Other
+ * properties will raise exception.
+ *
+ * Only a single property in the path is allowed.
+ *
+ * Example "${ro.boot.hardware.sku}/config.xml" would expand to
+ * "G020N/config.xml"
+ *
+ * @param configPath path to expand
+ * @param sysPropWrapper method used for reading properties
+ *
+ * @return The expanded path. Returns null if configPath is null.
+ */
+ @VisibleForTesting
+ public static String expandProperty(String configPath,
+ SysPropWrapper sysPropWrapper) {
+ if (configPath == null) {
+ return null;
+ }
+
+ int propStartPos = configPath.indexOf("${");
+ if (propStartPos == -1) {
+ // No properties inside the string, return as is
+ return configPath;
+ }
+
+ final StringBuilder sb = new StringBuilder();
+ sb.append(configPath.substring(0, propStartPos));
+
+ // Read out the end position
+ int propEndPos = configPath.indexOf("}", propStartPos);
+ if (propEndPos == -1) {
+ throw new IllegalStateException("Malformed property, unmatched braces, in: "
+ + configPath);
+ }
+
+ // Confirm that there is only one property inside the string
+ if (configPath.indexOf("${", propStartPos + 2) != -1) {
+ throw new IllegalStateException("Only a single property supported in path: "
+ + configPath);
+ }
+
+ final String propertyName = configPath.substring(propStartPos + 2, propEndPos);
+ if (!propertyName.startsWith("ro.")) {
+ throw new IllegalStateException("Only read only properties can be used when "
+ + "merging RRO config files: " + propertyName);
+ }
+ final String propertyValue = sysPropWrapper.get(propertyName);
+ if (TextUtils.isEmpty(propertyValue)) {
+ throw new IllegalStateException("Property is empty or doesn't exist: " + propertyName);
+ }
+ Log.d(TAG, String.format("Using property in overlay config path: \"%s\"", propertyName));
+ sb.append(propertyValue);
+
+ // propEndPos points to '}', need to step to next character, might be outside of string
+ propEndPos = propEndPos + 1;
+ // Append the remainder, if exists
+ if (propEndPos < configPath.length()) {
+ sb.append(configPath.substring(propEndPos));
+ }
+
+ return sb.toString();
+ }
+
+ /**
* Parses a <merge> tag within an overlay configuration file.
*
* Merge tags allow for other configuration files to be "merged" at the current parsing
@@ -331,10 +415,21 @@ public final class OverlayConfigParser {
@Nullable OverlayScanner scanner,
@Nullable Map<String, ParsedOverlayInfo> packageManagerOverlayInfos,
@NonNull ParsingContext parsingContext) {
- final String path = parser.getAttributeValue(null, "path");
+ final String path;
+
+ try {
+ SysPropWrapper sysPropWrapper = p -> {
+ return SystemProperties.get(p, "");
+ };
+ path = expandProperty(parser.getAttributeValue(null, "path"), sysPropWrapper);
+ } catch (IllegalStateException e) {
+ throw new IllegalStateException(String.format("<merge> path expand error in %s at %s",
+ configFile, parser.getPositionDescription()), e);
+ }
+
if (path == null) {
- throw new IllegalStateException(String.format("<merge> without path in %s at %s"
- + configFile, parser.getPositionDescription()));
+ throw new IllegalStateException(String.format("<merge> without path in %s at %s",
+ configFile, parser.getPositionDescription()));
}
if (path.startsWith("/")) {
diff --git a/core/java/com/android/internal/pm/pkg/parsing/ParsingPackageUtils.java b/core/java/com/android/internal/pm/pkg/parsing/ParsingPackageUtils.java
index 9fc7ddb57847..0e5049e97711 100644
--- a/core/java/com/android/internal/pm/pkg/parsing/ParsingPackageUtils.java
+++ b/core/java/com/android/internal/pm/pkg/parsing/ParsingPackageUtils.java
@@ -1911,12 +1911,16 @@ public class ParsingPackageUtils {
} else if (parser.getName().equals("package")) {
final TypedArray sa = res.obtainAttributes(parser,
R.styleable.AndroidManifestQueriesPackage);
- final String packageName = sa.getNonConfigurationString(
- R.styleable.AndroidManifestQueriesPackage_name, 0);
- if (TextUtils.isEmpty(packageName)) {
- return input.error("Package name is missing from package tag.");
+ try {
+ final String packageName = sa.getNonConfigurationString(
+ R.styleable.AndroidManifestQueriesPackage_name, 0);
+ if (TextUtils.isEmpty(packageName)) {
+ return input.error("Package name is missing from package tag.");
+ }
+ pkg.addQueriesPackage(packageName.intern());
+ } finally {
+ sa.recycle();
}
- pkg.addQueriesPackage(packageName.intern());
} else if (parser.getName().equals("provider")) {
final TypedArray sa = res.obtainAttributes(parser,
R.styleable.AndroidManifestQueriesProvider);
diff --git a/core/java/com/android/internal/ravenwood/RavenwoodEnvironment.java b/core/java/com/android/internal/ravenwood/RavenwoodEnvironment.java
new file mode 100644
index 000000000000..1340156321b2
--- /dev/null
+++ b/core/java/com/android/internal/ravenwood/RavenwoodEnvironment.java
@@ -0,0 +1,55 @@
+/*
+ * 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 com.android.internal.ravenwood;
+
+/**
+ * Class to interact with the Ravenwood environment.
+ */
+@android.ravenwood.annotation.RavenwoodKeepWholeClass
+public class RavenwoodEnvironment {
+ private static RavenwoodEnvironment sInstance = new RavenwoodEnvironment();
+
+ private RavenwoodEnvironment() {
+ }
+
+ /**
+ * @return the singleton instance.
+ */
+ public static RavenwoodEnvironment getInstance() {
+ return sInstance;
+ }
+
+ /**
+ * USE IT SPARINGLY! Returns true if it's running on Ravenwood, hostside test environment.
+ *
+ * <p>Using this allows code to behave differently on a real device and on Ravenwood, but
+ * generally speaking, that's a bad idea because we want the test target code to behave
+ * differently.
+ *
+ * <p>This should be only used when different behavior is absolutely needed.
+ *
+ * <p>If someone needs it without having access to the SDK, the following hack would work too.
+ * <code>System.getProperty("java.class.path").contains("ravenwood")</code>
+ */
+ @android.ravenwood.annotation.RavenwoodReplace
+ public boolean isRunningOnRavenwood() {
+ return false;
+ }
+
+ public boolean isRunningOnRavenwood$ravenwood() {
+ return true;
+ }
+}
diff --git a/core/jni/Android.bp b/core/jni/Android.bp
index 6412ddb3f6a7..3024b943ec2e 100644
--- a/core/jni/Android.bp
+++ b/core/jni/Android.bp
@@ -478,4 +478,8 @@ cc_library_shared {
"libnativehelper",
"libvintf",
],
+
+ required: [
+ "vintf",
+ ],
}
diff --git a/core/jni/android_os_VintfObject.cpp b/core/jni/android_os_VintfObject.cpp
index 8dc9d0aa578e..7a4854bbd260 100644
--- a/core/jni/android_os_VintfObject.cpp
+++ b/core/jni/android_os_VintfObject.cpp
@@ -32,6 +32,8 @@ static jmethodID gHashMapInit;
static jmethodID gHashMapPut;
static jclass gLongClazz;
static jmethodID gLongValueOf;
+static jclass gVintfObjectClazz;
+static jmethodID gRunCommand;
namespace android {
@@ -47,6 +49,56 @@ using vintf::VintfObject;
using vintf::Vndk;
using vintf::CheckFlags::ENABLE_ALL_CHECKS;
+// Instead of VintfObject::GetXxx(), we construct
+// HalManifest/CompatibilityMatrix objects by calling `vintf` through
+// UiAutomation.executeShellCommand() so that the commands are executed
+// using shell identity. Otherwise, we would need to allow "apps" to access
+// files like apex-info-list.xml which we don't want to open to apps.
+// This is okay because VintfObject is @TestApi and only used in CTS tests.
+
+static std::string runCmd(JNIEnv* env, const char* cmd) {
+ jstring jstr = (jstring)env->CallStaticObjectMethod(gVintfObjectClazz, gRunCommand,
+ env->NewStringUTF(cmd));
+ std::string output;
+ if (jstr) {
+ auto cstr = env->GetStringUTFChars(jstr, nullptr);
+ output = std::string(cstr);
+ env->ReleaseStringUTFChars(jstr, cstr);
+ } else {
+ LOG(WARNING) << "Failed to run " << cmd;
+ env->ExceptionDescribe();
+ env->ExceptionClear();
+ }
+ return output;
+}
+
+template <typename T>
+static std::shared_ptr<const T> fromXml(const std::string& content) {
+ std::shared_ptr<T> object = std::make_unique<T>();
+ std::string error;
+ if (fromXml(object.get(), content, &error)) {
+ return object;
+ }
+ LOG(WARNING) << "Unabled to parse: " << error;
+ return nullptr;
+}
+
+static std::shared_ptr<const HalManifest> getDeviceHalManifest(JNIEnv* env) {
+ return fromXml<HalManifest>(runCmd(env, "vintf dm"));
+}
+
+static std::shared_ptr<const HalManifest> getFrameworkHalManifest(JNIEnv* env) {
+ return fromXml<HalManifest>(runCmd(env, "vintf fm"));
+}
+
+static std::shared_ptr<const CompatibilityMatrix> getDeviceCompatibilityMatrix(JNIEnv* env) {
+ return fromXml<CompatibilityMatrix>(runCmd(env, "vintf dcm"));
+}
+
+static std::shared_ptr<const CompatibilityMatrix> getFrameworkCompatibilityMatrix(JNIEnv* env) {
+ return fromXml<CompatibilityMatrix>(runCmd(env, "vintf fcm"));
+}
+
template<typename V>
static inline jobjectArray toJavaStringArray(JNIEnv* env, const V& v) {
size_t i;
@@ -83,12 +135,10 @@ static jobjectArray android_os_VintfObject_report(JNIEnv* env, jclass)
{
std::vector<std::string> cStrings;
- tryAddSchema(VintfObject::GetDeviceHalManifest(), "device manifest", &cStrings);
- tryAddSchema(VintfObject::GetFrameworkHalManifest(), "framework manifest", &cStrings);
- tryAddSchema(VintfObject::GetDeviceCompatibilityMatrix(), "device compatibility matrix",
- &cStrings);
- tryAddSchema(VintfObject::GetFrameworkCompatibilityMatrix(), "framework compatibility matrix",
- &cStrings);
+ tryAddSchema(getDeviceHalManifest(env), "device manifest", &cStrings);
+ tryAddSchema(getFrameworkHalManifest(env), "framework manifest", &cStrings);
+ tryAddSchema(getDeviceCompatibilityMatrix(env), "device compatibility matrix", &cStrings);
+ tryAddSchema(getFrameworkCompatibilityMatrix(env), "framework compatibility matrix", &cStrings);
return toJavaStringArray(env, cStrings);
}
@@ -108,15 +158,13 @@ static jint android_os_VintfObject_verifyBuildAtBoot(JNIEnv*, jclass) {
static jobjectArray android_os_VintfObject_getHalNamesAndVersions(JNIEnv* env, jclass) {
std::set<std::string> halNames;
- tryAddHalNamesAndVersions(VintfObject::GetDeviceHalManifest(),
- "device manifest", &halNames);
- tryAddHalNamesAndVersions(VintfObject::GetFrameworkHalManifest(),
- "framework manifest", &halNames);
+ tryAddHalNamesAndVersions(getDeviceHalManifest(env), "device manifest", &halNames);
+ tryAddHalNamesAndVersions(getFrameworkHalManifest(env), "framework manifest", &halNames);
return toJavaStringArray(env, halNames);
}
static jstring android_os_VintfObject_getSepolicyVersion(JNIEnv* env, jclass) {
- std::shared_ptr<const HalManifest> manifest = VintfObject::GetDeviceHalManifest();
+ std::shared_ptr<const HalManifest> manifest = getDeviceHalManifest(env);
if (manifest == nullptr || manifest->type() != SchemaType::DEVICE) {
LOG(WARNING) << __FUNCTION__ << "Cannot get device manifest";
return nullptr;
@@ -126,8 +174,7 @@ static jstring android_os_VintfObject_getSepolicyVersion(JNIEnv* env, jclass) {
}
static jstring android_os_VintfObject_getPlatformSepolicyVersion(JNIEnv* env, jclass) {
- std::shared_ptr<const CompatibilityMatrix> matrix =
- VintfObject::GetFrameworkCompatibilityMatrix();
+ std::shared_ptr<const CompatibilityMatrix> matrix = getFrameworkCompatibilityMatrix(env);
if (matrix == nullptr || matrix->type() != SchemaType::FRAMEWORK) {
jniThrowRuntimeException(env, "Cannot get framework compatibility matrix");
return nullptr;
@@ -148,7 +195,7 @@ static jstring android_os_VintfObject_getPlatformSepolicyVersion(JNIEnv* env, jc
}
static jobject android_os_VintfObject_getVndkSnapshots(JNIEnv* env, jclass) {
- std::shared_ptr<const HalManifest> manifest = VintfObject::GetFrameworkHalManifest();
+ std::shared_ptr<const HalManifest> manifest = getFrameworkHalManifest(env);
if (manifest == nullptr || manifest->type() != SchemaType::FRAMEWORK) {
LOG(WARNING) << __FUNCTION__ << "Cannot get framework manifest";
return nullptr;
@@ -163,7 +210,7 @@ static jobject android_os_VintfObject_getVndkSnapshots(JNIEnv* env, jclass) {
}
static jobject android_os_VintfObject_getTargetFrameworkCompatibilityMatrixVersion(JNIEnv* env, jclass) {
- std::shared_ptr<const HalManifest> manifest = VintfObject::GetDeviceHalManifest();
+ std::shared_ptr<const HalManifest> manifest = getDeviceHalManifest(env);
if (manifest == nullptr || manifest->level() == Level::UNSPECIFIED) {
return nullptr;
}
@@ -188,19 +235,20 @@ static const JNINativeMethod gVintfObjectMethods[] = {
const char* const kVintfObjectPathName = "android/os/VintfObject";
-int register_android_os_VintfObject(JNIEnv* env)
-{
-
+int register_android_os_VintfObject(JNIEnv* env) {
gString = MakeGlobalRefOrDie(env, FindClassOrDie(env, "java/lang/String"));
gHashMapClazz = MakeGlobalRefOrDie(env, FindClassOrDie(env, "java/util/HashMap"));
gHashMapInit = GetMethodIDOrDie(env, gHashMapClazz, "<init>", "()V");
- gHashMapPut = GetMethodIDOrDie(env, gHashMapClazz,
- "put", "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;");
+ gHashMapPut = GetMethodIDOrDie(env, gHashMapClazz, "put",
+ "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;");
gLongClazz = MakeGlobalRefOrDie(env, FindClassOrDie(env, "java/lang/Long"));
gLongValueOf = GetStaticMethodIDOrDie(env, gLongClazz, "valueOf", "(J)Ljava/lang/Long;");
+ gVintfObjectClazz = MakeGlobalRefOrDie(env, FindClassOrDie(env, kVintfObjectPathName));
+ gRunCommand = GetStaticMethodIDOrDie(env, gVintfObjectClazz, "runShellCommand",
+ "(Ljava/lang/String;)Ljava/lang/String;");
return RegisterMethodsOrDie(env, kVintfObjectPathName, gVintfObjectMethods,
- NELEM(gVintfObjectMethods));
+ NELEM(gVintfObjectMethods));
}
extern int register_android_os_VintfRuntimeInfo(JNIEnv* env);
diff --git a/core/jni/com_android_internal_os_Zygote.cpp b/core/jni/com_android_internal_os_Zygote.cpp
index 3ed9f49ede26..dbbcbad8bbac 100644
--- a/core/jni/com_android_internal_os_Zygote.cpp
+++ b/core/jni/com_android_internal_os_Zygote.cpp
@@ -116,7 +116,7 @@ using android::base::GetBoolProperty;
using android::zygote::ZygoteFailure;
-using Action = android_mallopt_gwp_asan_options_t::Action;
+using Mode = android_mallopt_gwp_asan_options_t::Mode;
// This type is duplicated in fd_utils.h
typedef const std::function<void(std::string)>& fail_fn_t;
@@ -2101,21 +2101,21 @@ static void SpecializeCommon(JNIEnv* env, uid_t uid, gid_t gid, jintArray gids,
switch (runtime_flags & RuntimeFlags::GWP_ASAN_LEVEL_MASK) {
default:
case RuntimeFlags::GWP_ASAN_LEVEL_DEFAULT:
- gwp_asan_options.desire = GetBoolProperty(kGwpAsanAppRecoverableSysprop, true)
- ? Action::TURN_ON_FOR_APP_SAMPLED_NON_CRASHING
- : Action::DONT_TURN_ON_UNLESS_OVERRIDDEN;
+ gwp_asan_options.mode = GetBoolProperty(kGwpAsanAppRecoverableSysprop, true)
+ ? Mode::APP_MANIFEST_DEFAULT
+ : Mode::APP_MANIFEST_NEVER;
android_mallopt(M_INITIALIZE_GWP_ASAN, &gwp_asan_options, sizeof(gwp_asan_options));
break;
case RuntimeFlags::GWP_ASAN_LEVEL_NEVER:
- gwp_asan_options.desire = Action::DONT_TURN_ON_UNLESS_OVERRIDDEN;
+ gwp_asan_options.mode = Mode::APP_MANIFEST_NEVER;
android_mallopt(M_INITIALIZE_GWP_ASAN, &gwp_asan_options, sizeof(gwp_asan_options));
break;
case RuntimeFlags::GWP_ASAN_LEVEL_ALWAYS:
- gwp_asan_options.desire = Action::TURN_ON_FOR_APP;
+ gwp_asan_options.mode = Mode::APP_MANIFEST_ALWAYS;
android_mallopt(M_INITIALIZE_GWP_ASAN, &gwp_asan_options, sizeof(gwp_asan_options));
break;
case RuntimeFlags::GWP_ASAN_LEVEL_LOTTERY:
- gwp_asan_options.desire = Action::TURN_ON_WITH_SAMPLING;
+ gwp_asan_options.mode = Mode::APP_MANIFEST_DEFAULT;
android_mallopt(M_INITIALIZE_GWP_ASAN, &gwp_asan_options, sizeof(gwp_asan_options));
break;
}
diff --git a/core/res/res/xml/sms_short_codes.xml b/core/res/res/xml/sms_short_codes.xml
index 4d7c00991798..67cceb5d5343 100644
--- a/core/res/res/xml/sms_short_codes.xml
+++ b/core/res/res/xml/sms_short_codes.xml
@@ -60,6 +60,9 @@
<!-- Belgium: 4 digits, plus EU: http://www.mobileweb.be/en/mobileweb/sms-numberplan.asp -->
<shortcode country="be" premium="\\d{4}" free="8\\d{3}|116\\d{3}" />
+ <!-- Burkina Faso: 1-4 digits (standard system default, not country specific) -->
+ <shortcode country="bf" pattern="\\d{1,4}" free="3558" />
+
<!-- Bulgaria: 4-5 digits, plus EU -->
<shortcode country="bg" pattern="\\d{4,5}" premium="18(?:16|423)|19(?:1[56]|35)" free="116\\d{3}|1988|1490" />
@@ -175,8 +178,8 @@
<!-- Israel: 1-5 digits, known premium codes listed -->
<shortcode country="il" pattern="\\d{1,5}" premium="4422|4545" free="37477|6681" />
- <!-- Iran: 4-6 digits, known premium codes listed -->
- <shortcode country="ir" pattern="\\d{4,6}" free="700791|700792" />
+ <!-- Iran: 4-8 digits, known premium codes listed -->
+ <shortcode country="ir" pattern="\\d{4,8}" free="700791|700792|100016|30008360" />
<!-- Italy: 5 digits (premium=41xxx,42xxx), plus EU:
https://www.itu.int/dms_pub/itu-t/oth/02/02/T020200006B0001PDFE.pdf -->
@@ -352,7 +355,7 @@
<shortcode country="za" pattern="\\d{1,5}" free="44136|30791|36056|33009" />
<!-- Yemen -->
- <shortcode country="ye" pattern="\\d{1,4}" free="5081" />
+ <shortcode country="ye" pattern="\\d{1,4}" free="5079" />
<!-- Zimbabwe -->
<shortcode country="zw" pattern="\\d{1,5}" free="33679" />
diff --git a/core/tests/coretests/Android.bp b/core/tests/coretests/Android.bp
index 871feb65bc75..5a051adb140b 100644
--- a/core/tests/coretests/Android.bp
+++ b/core/tests/coretests/Android.bp
@@ -103,6 +103,7 @@ android_test {
sdk_version: "core_platform",
test_suites: [
"device-tests",
+ "device-platinum-tests",
"automotive-tests",
],
@@ -211,6 +212,8 @@ android_ravenwood_test {
"src/com/android/internal/util/**/*.java",
"src/com/android/internal/power/EnergyConsumerStatsTest.java",
":FrameworksCoreTests{.aapt.srcjar}",
+ "src/com/android/internal/ravenwood/**/*.java",
+
":FrameworksCoreTests-aidl",
":FrameworksCoreTests-helpers",
":FrameworksCoreTestDoubles-sources",
diff --git a/core/tests/coretests/src/android/net/OWNERS b/core/tests/coretests/src/android/net/OWNERS
index a779c00814cb..beb77dc8f4fd 100644
--- a/core/tests/coretests/src/android/net/OWNERS
+++ b/core/tests/coretests/src/android/net/OWNERS
@@ -1,4 +1,5 @@
include /services/core/java/com/android/server/net/OWNERS
-per-file SSL*,Uri*,Url* = prb@google.com,oth@google.com,narayan@google.com,ngeoffray@google.com
+per-file SSL*,Url* = prb@google.com,oth@google.com,narayan@google.com,ngeoffray@google.com
per-file SntpClient* = file:/services/core/java/com/android/server/timedetector/OWNERS
+per-file Uri* = varunshah@google.com
diff --git a/core/tests/coretests/src/android/os/VintfObjectTest.java b/core/tests/coretests/src/android/os/VintfObjectTest.java
index f34b8fd358d9..f81b31d0bd5a 100644
--- a/core/tests/coretests/src/android/os/VintfObjectTest.java
+++ b/core/tests/coretests/src/android/os/VintfObjectTest.java
@@ -16,16 +16,25 @@
package android.os;
-import static org.junit.Assert.assertTrue;
+import static com.google.common.truth.Truth.assertThat;
+
+import static java.util.stream.Collectors.toList;
import android.platform.test.annotations.IgnoreUnderRavenwood;
import android.platform.test.ravenwood.RavenwoodRule;
+import android.util.Pair;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.xml.sax.InputSource;
+
+import java.io.StringReader;
+import java.util.stream.Stream;
+
+import javax.xml.parsers.DocumentBuilderFactory;
@RunWith(AndroidJUnit4.class)
@IgnoreUnderRavenwood(blockedBy = VintfObject.class)
@@ -39,12 +48,26 @@ public class VintfObjectTest {
@Test
public void testReport() {
String[] xmls = VintfObject.report();
- assertTrue(xmls.length > 0);
- // From /system/manifest.xml
- assertTrue(String.join("", xmls).contains(
- "<manifest version=\"1.0\" type=\"framework\">"));
- // From /system/compatibility-matrix.xml
- assertTrue(String.join("", xmls).contains(
- "<compatibility-matrix version=\"1.0\" type=\"framework\""));
+
+ assertThat(Stream.of(xmls).map(xml -> rootAndType(xml)).collect(toList()))
+ .containsExactly(
+ Pair.create("manifest", "framework"),
+ Pair.create("compatibility-matrix", "framework"),
+ Pair.create("manifest", "device"),
+ Pair.create("compatibility-matrix", "device")
+ );
+ }
+
+ private static Pair<String, String> rootAndType(String content) {
+ try {
+ var factory = DocumentBuilderFactory.newInstance();
+ var builder = factory.newDocumentBuilder();
+ var inputSource = new InputSource(new StringReader(content));
+ var document = builder.parse(inputSource);
+ var root = document.getDocumentElement();
+ return Pair.create(root.getTagName(), root.getAttribute("type"));
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
}
}
diff --git a/core/tests/coretests/src/com/android/internal/content/res/OverlayConfigParserTest.java b/core/tests/coretests/src/com/android/internal/content/res/OverlayConfigParserTest.java
new file mode 100644
index 000000000000..4eccbe5f1dc4
--- /dev/null
+++ b/core/tests/coretests/src/com/android/internal/content/res/OverlayConfigParserTest.java
@@ -0,0 +1,119 @@
+/*
+ * 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 com.android.internal.content.res;
+
+import static com.android.internal.content.om.OverlayConfigParser.SysPropWrapper;
+
+import static org.junit.Assert.assertEquals;
+
+import android.platform.test.annotations.Presubmit;
+
+import androidx.test.runner.AndroidJUnit4;
+
+import com.android.internal.content.om.OverlayConfigParser;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+@Presubmit
+@RunWith(AndroidJUnit4.class)
+public class OverlayConfigParserTest {
+ @Test(expected = IllegalStateException.class)
+ public void testMergePropNotRoProp() {
+ SysPropWrapper sysProp = p -> {
+ return "dummy_value";
+ };
+ OverlayConfigParser.expandProperty("${persist.value}/path", sysProp);
+ }
+
+ @Test(expected = IllegalStateException.class)
+ public void testMergePropMissingEndBracket() {
+ SysPropWrapper sysProp = p -> {
+ return "dummy_value";
+ };
+ OverlayConfigParser.expandProperty("${ro.value/path", sysProp);
+ }
+
+ @Test(expected = IllegalStateException.class)
+ public void testMergeOnlyPropStart() {
+ SysPropWrapper sysProp = p -> {
+ return "dummy_value";
+ };
+ OverlayConfigParser.expandProperty("path/${", sysProp);
+ }
+
+ @Test(expected = IllegalStateException.class)
+ public void testMergePropInProp() {
+ SysPropWrapper sysProp = p -> {
+ return "dummy_value";
+ };
+ OverlayConfigParser.expandProperty("path/${${ro.value}}", sysProp);
+ }
+
+ /**
+ * The path is only allowed to contain one property.
+ */
+ @Test(expected = IllegalStateException.class)
+ public void testMergePropMultipleProps() {
+ SysPropWrapper sysProp = p -> {
+ return "dummy_value";
+ };
+ OverlayConfigParser.expandProperty("${ro.value}/path${ro.value2}/path", sysProp);
+ }
+
+ @Test
+ public void testMergePropOneProp() {
+ final SysPropWrapper sysProp = p -> {
+ if ("ro.value".equals(p)) {
+ return "dummy_value";
+ } else {
+ return "invalid";
+ }
+ };
+
+ // Property in the beginnig of the string
+ String result = OverlayConfigParser.expandProperty("${ro.value}/path",
+ sysProp);
+ assertEquals("dummy_value/path", result);
+
+ // Property in the middle of the string
+ result = OverlayConfigParser.expandProperty("path/${ro.value}/file",
+ sysProp);
+ assertEquals("path/dummy_value/file", result);
+
+ // Property at the of the string
+ result = OverlayConfigParser.expandProperty("path/${ro.value}",
+ sysProp);
+ assertEquals("path/dummy_value", result);
+
+ // Property is the entire string
+ result = OverlayConfigParser.expandProperty("${ro.value}",
+ sysProp);
+ assertEquals("dummy_value", result);
+ }
+
+ @Test
+ public void testMergePropNoProp() {
+ final SysPropWrapper sysProp = p -> {
+ return "dummy_value";
+ };
+
+ final String path = "no_props/path";
+ String result = OverlayConfigParser.expandProperty(path, sysProp);
+ assertEquals(path, result);
+ }
+}
diff --git a/core/tests/coretests/src/com/android/internal/ravenwood/RavenwoodEnvironmentTest.java b/core/tests/coretests/src/com/android/internal/ravenwood/RavenwoodEnvironmentTest.java
new file mode 100644
index 000000000000..d1ef61b2e365
--- /dev/null
+++ b/core/tests/coretests/src/com/android/internal/ravenwood/RavenwoodEnvironmentTest.java
@@ -0,0 +1,38 @@
+/*
+ * 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 com.android.internal.ravenwood;
+
+import static junit.framework.TestCase.assertEquals;
+
+import android.platform.test.ravenwood.RavenwoodRule;
+
+import androidx.test.runner.AndroidJUnit4;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+@RunWith(AndroidJUnit4.class)
+public class RavenwoodEnvironmentTest {
+ @Rule
+ public final RavenwoodRule mRavenwood = new RavenwoodRule();
+
+ @Test
+ public void testIsRunningOnRavenwood() {
+ assertEquals(RavenwoodRule.isUnderRavenwood(),
+ RavenwoodEnvironment.getInstance().isRunningOnRavenwood());
+ }
+}
diff --git a/data/keyboards/Android.bp b/data/keyboards/Android.bp
index e62678f92d8b..423b55bd85db 100644
--- a/data/keyboards/Android.bp
+++ b/data/keyboards/Android.bp
@@ -33,7 +33,7 @@ prebuilt_usr_keylayout {
srcs: [
"*.kl",
],
- installable: false,
+ no_full_install: true,
}
prebuilt_usr_keychars {
@@ -41,7 +41,7 @@ prebuilt_usr_keychars {
srcs: [
"*.kcm",
],
- installable: false,
+ no_full_install: true,
}
prebuilt_usr_idc {
@@ -49,5 +49,5 @@ prebuilt_usr_idc {
srcs: [
"*.idc",
],
- installable: false,
+ no_full_install: true,
}
diff --git a/graphics/java/android/graphics/BitmapFactory.java b/graphics/java/android/graphics/BitmapFactory.java
index d915b746e0cc..1c2014183bb7 100644
--- a/graphics/java/android/graphics/BitmapFactory.java
+++ b/graphics/java/android/graphics/BitmapFactory.java
@@ -143,7 +143,7 @@ public class BitmapFactory {
* the decoder will try to pick the best matching config based on the
* system's screen depth, and characteristics of the original image such
* as if it has per-pixel alpha (requiring a config that also does).
- *
+ *
* Image are loaded with the {@link Bitmap.Config#ARGB_8888} config by
* default.
*/
@@ -183,7 +183,7 @@ public class BitmapFactory {
/**
* If true (which is the default), the resulting bitmap will have its
- * color channels pre-multipled by the alpha channel.
+ * color channels pre-multiplied by the alpha channel.
*
* <p>This should NOT be set to false for images to be directly drawn by
* the view system or through a {@link Canvas}. The view system and
@@ -221,9 +221,9 @@ public class BitmapFactory {
* if {@link #inScaled} is set (which it is by default} and this
* density does not match {@link #inTargetDensity}, then the bitmap
* will be scaled to the target density before being returned.
- *
+ *
* <p>If this is 0,
- * {@link BitmapFactory#decodeResource(Resources, int)},
+ * {@link BitmapFactory#decodeResource(Resources, int)},
* {@link BitmapFactory#decodeResource(Resources, int, android.graphics.BitmapFactory.Options)},
* and {@link BitmapFactory#decodeResourceStream}
* will fill in the density associated with the resource. The other
@@ -242,29 +242,29 @@ public class BitmapFactory {
* This is used in conjunction with {@link #inDensity} and
* {@link #inScaled} to determine if and how to scale the bitmap before
* returning it.
- *
+ *
* <p>If this is 0,
- * {@link BitmapFactory#decodeResource(Resources, int)},
+ * {@link BitmapFactory#decodeResource(Resources, int)},
* {@link BitmapFactory#decodeResource(Resources, int, android.graphics.BitmapFactory.Options)},
* and {@link BitmapFactory#decodeResourceStream}
* will fill in the density associated the Resources object's
* DisplayMetrics. The other
* functions will leave it as-is and no scaling for density will be
* performed.
- *
+ *
* @see #inDensity
* @see #inScreenDensity
* @see #inScaled
* @see android.util.DisplayMetrics#densityDpi
*/
public int inTargetDensity;
-
+
/**
* The pixel density of the actual screen that is being used. This is
* purely for applications running in density compatibility code, where
* {@link #inTargetDensity} is actually the density the application
* sees rather than the real screen density.
- *
+ *
* <p>By setting this, you
* allow the loading code to avoid scaling a bitmap that is currently
* in the screen density up/down to the compatibility density. Instead,
@@ -274,18 +274,18 @@ public class BitmapFactory {
* Bitmap.getScaledWidth} and {@link Bitmap#getScaledHeight
* Bitmap.getScaledHeight} to account for any different between the
* bitmap's density and the target's density.
- *
+ *
* <p>This is never set automatically for the caller by
* {@link BitmapFactory} itself. It must be explicitly set, since the
* caller must deal with the resulting bitmap in a density-aware way.
- *
+ *
* @see #inDensity
* @see #inTargetDensity
* @see #inScaled
* @see android.util.DisplayMetrics#densityDpi
*/
public int inScreenDensity;
-
+
/**
* When this flag is set, if {@link #inDensity} and
* {@link #inTargetDensity} are not 0, the
@@ -345,7 +345,7 @@ public class BitmapFactory {
* ignored.
*
* In {@link android.os.Build.VERSION_CODES#KITKAT} and below, this
- * field works in conjuction with inPurgeable. If inPurgeable is false,
+ * field works in conjunction with inPurgeable. If inPurgeable is false,
* then this field is ignored. If inPurgeable is true, then this field
* determines whether the bitmap can share a reference to the input
* data (inputstream, array, etc.) or if it must make a deep copy.
@@ -583,11 +583,11 @@ public class BitmapFactory {
opts.inDensity = density;
}
}
-
+
if (opts.inTargetDensity == 0 && res != null) {
opts.inTargetDensity = res.getDisplayMetrics().densityDpi;
}
-
+
return decodeStream(is, pad, opts);
}
@@ -611,8 +611,8 @@ public class BitmapFactory {
public static Bitmap decodeResource(Resources res, int id, Options opts) {
validate(opts);
Bitmap bm = null;
- InputStream is = null;
-
+ InputStream is = null;
+
try {
final TypedValue value = new TypedValue();
is = res.openRawResource(id, value);
diff --git a/graphics/java/android/graphics/Canvas.java b/graphics/java/android/graphics/Canvas.java
index d1aceafc4e2c..5291f7b4c16c 100644
--- a/graphics/java/android/graphics/Canvas.java
+++ b/graphics/java/android/graphics/Canvas.java
@@ -52,7 +52,7 @@ import java.lang.annotation.RetentionPolicy;
* Canvas and Drawables</a> developer guide.</p></div>
*/
public class Canvas extends BaseCanvas {
- private static int sCompatiblityVersion = 0;
+ private static int sCompatibilityVersion = 0;
private static boolean sCompatibilityRestore = false;
private static boolean sCompatibilitySetBitmap = false;
@@ -71,7 +71,7 @@ public class Canvas extends BaseCanvas {
// Maximum bitmap size as defined in Skia's native code
// (see SkCanvas.cpp, SkDraw.cpp)
- private static final int MAXMIMUM_BITMAP_SIZE = 32766;
+ private static final int MAXIMUM_BITMAP_SIZE = 32766;
// Use a Holder to allow static initialization of Canvas in the boot image.
private static class NoImagePreloadHolder {
@@ -316,7 +316,7 @@ public class Canvas extends BaseCanvas {
* @see #getMaximumBitmapHeight()
*/
public int getMaximumBitmapWidth() {
- return MAXMIMUM_BITMAP_SIZE;
+ return MAXIMUM_BITMAP_SIZE;
}
/**
@@ -327,7 +327,7 @@ public class Canvas extends BaseCanvas {
* @see #getMaximumBitmapWidth()
*/
public int getMaximumBitmapHeight() {
- return MAXMIMUM_BITMAP_SIZE;
+ return MAXIMUM_BITMAP_SIZE;
}
// the SAVE_FLAG constants must match their native equivalents
@@ -408,7 +408,7 @@ public class Canvas extends BaseCanvas {
public static final int ALL_SAVE_FLAG = 0x1F;
private static void checkValidSaveFlags(int saveFlags) {
- if (sCompatiblityVersion >= Build.VERSION_CODES.P
+ if (sCompatibilityVersion >= Build.VERSION_CODES.P
&& saveFlags != ALL_SAVE_FLAG) {
throw new IllegalArgumentException(
"Invalid Layer Save Flag - only ALL_SAVE_FLAGS is allowed");
@@ -817,7 +817,7 @@ public class Canvas extends BaseCanvas {
}
private static void checkValidClipOp(@NonNull Region.Op op) {
- if (sCompatiblityVersion >= Build.VERSION_CODES.P
+ if (sCompatibilityVersion >= Build.VERSION_CODES.P
&& op != Region.Op.INTERSECT && op != Region.Op.DIFFERENCE) {
throw new IllegalArgumentException(
"Invalid Region.Op - only INTERSECT and DIFFERENCE are allowed");
@@ -1383,7 +1383,7 @@ public class Canvas extends BaseCanvas {
}
/*package*/ static void setCompatibilityVersion(int apiLevel) {
- sCompatiblityVersion = apiLevel;
+ sCompatibilityVersion = apiLevel;
sCompatibilityRestore = apiLevel < Build.VERSION_CODES.M;
sCompatibilitySetBitmap = apiLevel < Build.VERSION_CODES.O;
nSetCompatibilityVersion(apiLevel);
diff --git a/graphics/java/android/graphics/ComposePathEffect.java b/graphics/java/android/graphics/ComposePathEffect.java
index 3fc9eb5aea15..7d59ecea948e 100644
--- a/graphics/java/android/graphics/ComposePathEffect.java
+++ b/graphics/java/android/graphics/ComposePathEffect.java
@@ -20,13 +20,13 @@ public class ComposePathEffect extends PathEffect {
/**
* Construct a PathEffect whose effect is to apply first the inner effect
- * and the the outer pathEffect (e.g. outer(inner(path))).
+ * and the outer pathEffect (e.g. outer(inner(path))).
*/
public ComposePathEffect(PathEffect outerpe, PathEffect innerpe) {
native_instance = nativeCreate(outerpe.native_instance,
innerpe.native_instance);
}
-
+
private static native long nativeCreate(long nativeOuterpe,
long nativeInnerpe);
}
diff --git a/graphics/java/android/graphics/FontFamily.java b/graphics/java/android/graphics/FontFamily.java
index f50de1665453..91fa1a6a236c 100644
--- a/graphics/java/android/graphics/FontFamily.java
+++ b/graphics/java/android/graphics/FontFamily.java
@@ -215,7 +215,7 @@ public class FontFamily {
@CriticalNative
private static native long nGetFamilyReleaseFunc();
- // By passing -1 to weigth argument, the weight value is resolved by OS/2 table in the font.
+ // By passing -1 to weight argument, the weight value is resolved by OS/2 table in the font.
// By passing -1 to italic argument, the italic value is resolved by OS/2 table in the font.
private static native boolean nAddFont(long builderPtr, ByteBuffer font, int ttcIndex,
int weight, int isItalic);
diff --git a/graphics/java/android/graphics/FontListParser.java b/graphics/java/android/graphics/FontListParser.java
index 52b0b95d3e76..2d3ffb5d31ff 100644
--- a/graphics/java/android/graphics/FontListParser.java
+++ b/graphics/java/android/graphics/FontListParser.java
@@ -127,7 +127,7 @@ public class FontListParser {
parser.setInput(is, null);
parser.nextTag();
return readFamilies(parser, systemFontDir, oemCustomization, updatableFontMap,
- lastModifiedDate, configVersion, false /* filter out the non-exising files */);
+ lastModifiedDate, configVersion, false /* filter out the non-existing files */);
}
}
@@ -254,7 +254,7 @@ public class FontListParser {
* @param parser An XML parser.
* @param fontDir a font directory name.
* @param updatableFontMap a updated font file map.
- * @param allowNonExistingFile true to allow font file that doesn't exists
+ * @param allowNonExistingFile true to allow font file that doesn't exist.
* @return a FontFamily instance. null if no font files are available in this FontFamily.
*/
public static @Nullable FontConfig.FontFamily readFamily(XmlPullParser parser, String fontDir,
diff --git a/graphics/java/android/graphics/FrameInfo.java b/graphics/java/android/graphics/FrameInfo.java
index b3615ff60bce..8f1282897780 100644
--- a/graphics/java/android/graphics/FrameInfo.java
+++ b/graphics/java/android/graphics/FrameInfo.java
@@ -24,7 +24,7 @@ import java.lang.annotation.RetentionPolicy;
/**
* Class that contains all the timing information for the current frame. This
* is used in conjunction with the hardware renderer to provide
- * continous-monitoring jank events
+ * continuous-monitoring jank events
*
* All times in nanoseconds from CLOCK_MONOTONIC/System.nanoTime()
*
diff --git a/graphics/java/android/graphics/Interpolator.java b/graphics/java/android/graphics/Interpolator.java
index 104546454fa9..418922f767bb 100644
--- a/graphics/java/android/graphics/Interpolator.java
+++ b/graphics/java/android/graphics/Interpolator.java
@@ -25,13 +25,13 @@ public class Interpolator {
mFrameCount = 2;
native_instance = nativeConstructor(valueCount, 2);
}
-
+
public Interpolator(int valueCount, int frameCount) {
mValueCount = valueCount;
mFrameCount = frameCount;
native_instance = nativeConstructor(valueCount, frameCount);
}
-
+
/**
* Reset the Interpolator to have the specified number of values and an
* implicit keyFrame count of 2 (just a start and end). After this call the
@@ -40,7 +40,7 @@ public class Interpolator {
public void reset(int valueCount) {
reset(valueCount, 2);
}
-
+
/**
* Reset the Interpolator to have the specified number of values and
* keyFrames. After this call the values for each keyFrame must be assigned
@@ -51,20 +51,20 @@ public class Interpolator {
mFrameCount = frameCount;
nativeReset(native_instance, valueCount, frameCount);
}
-
+
public final int getKeyFrameCount() {
return mFrameCount;
}
-
+
public final int getValueCount() {
return mValueCount;
}
-
+
/**
* Assign the keyFrame (specified by index) a time value and an array of key
- * values (with an implicity blend array of [0, 0, 1, 1] giving linear
+ * values (with an implicitly blend array of [0, 0, 1, 1] giving linear
* transition to the next set of key values).
- *
+ *
* @param index The index of the key frame to assign
* @param msec The time (in mililiseconds) for this key frame. Based on the
* SystemClock.uptimeMillis() clock
@@ -77,7 +77,7 @@ public class Interpolator {
/**
* Assign the keyFrame (specified by index) a time value and an array of key
* values and blend array.
- *
+ *
* @param index The index of the key frame to assign
* @param msec The time (in mililiseconds) for this key frame. Based on the
* SystemClock.uptimeMillis() clock
@@ -96,7 +96,7 @@ public class Interpolator {
}
nativeSetKeyFrame(native_instance, index, msec, values, blend);
}
-
+
/**
* Set a repeat count (which may be fractional) for the interpolator, and
* whether the interpolator should mirror its repeats. The default settings
@@ -107,7 +107,7 @@ public class Interpolator {
nativeSetRepeatMirror(native_instance, repeatCount, mirror);
}
}
-
+
public enum Result {
NORMAL,
FREEZE_START,
@@ -127,7 +127,7 @@ public class Interpolator {
* return whether the specified time was within the range of key times
* (NORMAL), was before the first key time (FREEZE_START) or after the last
* key time (FREEZE_END). In any event, computed values are always returned.
- *
+ *
* @param msec The time (in milliseconds) used to sample into the
* Interpolator. Based on the SystemClock.uptimeMillis() clock
* @param values Where to write the computed values (may be NULL).
@@ -143,13 +143,13 @@ public class Interpolator {
default: return Result.FREEZE_END;
}
}
-
+
@Override
protected void finalize() throws Throwable {
nativeDestructor(native_instance);
native_instance = 0; // Other finalizers can still call us.
}
-
+
private int mValueCount;
private int mFrameCount;
private long native_instance;
diff --git a/graphics/java/android/graphics/LightingColorFilter.java b/graphics/java/android/graphics/LightingColorFilter.java
index 0aa6f1282c1a..fe73a1a70b9c 100644
--- a/graphics/java/android/graphics/LightingColorFilter.java
+++ b/graphics/java/android/graphics/LightingColorFilter.java
@@ -16,8 +16,8 @@
// This file was generated from the C++ include file: SkColorFilter.h
// Any changes made to this file will be discarded by the build.
-// To change this file, either edit the include, or device/tools/gluemaker/main.cpp,
-// or one of the auxilary file specifications in device/tools/gluemaker.
+// To change this file, either edit the include, or device/tools/gluemaker/main.cpp,
+// or one of the auxiliary file specifications in device/tools/gluemaker.
package android.graphics;
diff --git a/graphics/java/android/graphics/LinearGradient.java b/graphics/java/android/graphics/LinearGradient.java
index 56d912b1eada..087937144b97 100644
--- a/graphics/java/android/graphics/LinearGradient.java
+++ b/graphics/java/android/graphics/LinearGradient.java
@@ -63,7 +63,7 @@ public class LinearGradient extends Shader {
* @param colors The sRGB colors to be distributed along the gradient line
* @param positions May be null. The relative positions [0..1] of
* each corresponding color in the colors array. If this is null,
- * the the colors are distributed evenly along the gradient line.
+ * the colors are distributed evenly along the gradient line.
* @param tile The Shader tiling mode
*/
public LinearGradient(float x0, float y0, float x1, float y1, @NonNull @ColorInt int[] colors,
@@ -82,7 +82,7 @@ public class LinearGradient extends Shader {
* @param colors The colors to be distributed along the gradient line
* @param positions May be null. The relative positions [0..1] of
* each corresponding color in the colors array. If this is null,
- * the the colors are distributed evenly along the gradient line.
+ * the colors are distributed evenly along the gradient line.
* @param tile The Shader tiling mode
*
* @throws IllegalArgumentException if there are less than two colors, the colors do
diff --git a/graphics/java/android/graphics/Matrix.java b/graphics/java/android/graphics/Matrix.java
index bc58febc388b..66553d87e944 100644
--- a/graphics/java/android/graphics/Matrix.java
+++ b/graphics/java/android/graphics/Matrix.java
@@ -559,7 +559,7 @@ public class Matrix {
/**
* Set the matrix to the scale and translate values that map the source rectangle to the
- * destination rectangle, returning true if the the result can be represented.
+ * destination rectangle, returning true if the result can be represented.
*
* @param src the source rectangle to map from.
* @param dst the destination rectangle to map to.
diff --git a/graphics/java/android/graphics/Mesh.java b/graphics/java/android/graphics/Mesh.java
index a4bce9eb5e88..6be8332e784b 100644
--- a/graphics/java/android/graphics/Mesh.java
+++ b/graphics/java/android/graphics/Mesh.java
@@ -271,7 +271,7 @@ public class Mesh {
* not have a uniform with that name or if the uniform is declared with a type other than int
* or int[1] then an IllegalArgumentException is thrown.
*
- * @param uniformName name matching the int uniform delcared in the shader program.
+ * @param uniformName name matching the int uniform declared in the shader program.
* @param value value corresponding to the int uniform with the given name.
*/
public void setIntUniform(@NonNull String uniformName, int value) {
@@ -283,7 +283,7 @@ public class Mesh {
* not have a uniform with that name or if the uniform is declared with a type other than ivec2
* or int[2] then an IllegalArgumentException is thrown.
*
- * @param uniformName name matching the int uniform delcared in the shader program.
+ * @param uniformName name matching the int uniform declared in the shader program.
* @param value1 first value corresponding to the int uniform with the given name.
* @param value2 second value corresponding to the int uniform with the given name.
*/
@@ -296,7 +296,7 @@ public class Mesh {
* not have a uniform with that name or if the uniform is declared with a type other than ivec3
* or int[3] then an IllegalArgumentException is thrown.
*
- * @param uniformName name matching the int uniform delcared in the shader program.
+ * @param uniformName name matching the int uniform declared in the shader program.
* @param value1 first value corresponding to the int uniform with the given name.
* @param value2 second value corresponding to the int uniform with the given name.
* @param value3 third value corresponding to the int uniform with the given name.
@@ -310,7 +310,7 @@ public class Mesh {
* not have a uniform with that name or if the uniform is declared with a type other than ivec4
* or int[4] then an IllegalArgumentException is thrown.
*
- * @param uniformName name matching the int uniform delcared in the shader program.
+ * @param uniformName name matching the int uniform declared in the shader program.
* @param value1 first value corresponding to the int uniform with the given name.
* @param value2 second value corresponding to the int uniform with the given name.
* @param value3 third value corresponding to the int uniform with the given name.
@@ -327,7 +327,7 @@ public class Mesh {
* int (for N=1), ivecN, or int[N], where N is the length of the values param, then an
* IllegalArgumentException is thrown.
*
- * @param uniformName name matching the int uniform delcared in the shader program.
+ * @param uniformName name matching the int uniform declared in the shader program.
* @param values int values corresponding to the vec4 int uniform with the given name.
*/
public void setIntUniform(@NonNull String uniformName, @NonNull int[] values) {
diff --git a/graphics/java/android/graphics/NinePatch.java b/graphics/java/android/graphics/NinePatch.java
index af2095713ec2..382269f74366 100644
--- a/graphics/java/android/graphics/NinePatch.java
+++ b/graphics/java/android/graphics/NinePatch.java
@@ -22,12 +22,12 @@ import android.compat.annotation.UnsupportedAppUsage;
* The NinePatch class permits drawing a bitmap in nine or more sections.
* Essentially, it allows the creation of custom graphics that will scale the
* way that you define, when content added within the image exceeds the normal
- * bounds of the graphic. For a thorough explanation of a NinePatch image,
- * read the discussion in the
+ * bounds of the graphic. For a thorough explanation of a NinePatch image,
+ * read the discussion in the
* <a href="{@docRoot}guide/topics/graphics/2d-graphics.html#nine-patch">2D
* Graphics</a> document.
* <p>
- * The <a href="{@docRoot}guide/developing/tools/draw9patch.html">Draw 9-Patch</a>
+ * The <a href="{@docRoot}guide/developing/tools/draw9patch.html">Draw 9-Patch</a>
* tool offers an extremely handy way to create your NinePatch images,
* using a WYSIWYG graphics editor.
* </p>
@@ -104,7 +104,7 @@ public class NinePatch {
this(bitmap, chunk, null);
}
- /**
+ /**
* Create a drawable projection from a bitmap to nine patches.
*
* @param bitmap The bitmap describing the patches.
@@ -122,7 +122,7 @@ public class NinePatch {
protected void finalize() throws Throwable {
try {
if (mNativeChunk != 0) {
- // only attempt to destroy correctly initilized chunks
+ // only attempt to destroy correctly initialized chunks
nativeFinalize(mNativeChunk);
mNativeChunk = 0;
}
@@ -169,8 +169,8 @@ public class NinePatch {
public Bitmap getBitmap() {
return mBitmap;
}
-
- /**
+
+ /**
* Draws the NinePatch. This method will use the paint returned by {@link #getPaint()}.
*
* @param canvas A container for the current matrix and clip used to draw the NinePatch.
@@ -180,7 +180,7 @@ public class NinePatch {
canvas.drawPatch(this, location, mPaint);
}
- /**
+ /**
* Draws the NinePatch. This method will use the paint returned by {@link #getPaint()}.
*
* @param canvas A container for the current matrix and clip used to draw the NinePatch.
@@ -190,7 +190,7 @@ public class NinePatch {
canvas.drawPatch(this, location, mPaint);
}
- /**
+ /**
* Draws the NinePatch. This method will ignore the paint returned
* by {@link #getPaint()} and use the specified paint instead.
*
diff --git a/graphics/java/android/graphics/PathMeasure.java b/graphics/java/android/graphics/PathMeasure.java
index 5500c5217de4..2c6cfa5c2e3d 100644
--- a/graphics/java/android/graphics/PathMeasure.java
+++ b/graphics/java/android/graphics/PathMeasure.java
@@ -25,14 +25,14 @@ public class PathMeasure {
* setPath.
*
* Note that once a path is associated with the measure object, it is
- * undefined if the path is subsequently modified and the the measure object
+ * undefined if the path is subsequently modified and the measure object
* is used. If the path is modified, you must call setPath with the path.
*/
public PathMeasure() {
mPath = null;
native_instance = native_create(0, false);
}
-
+
/**
* Create a PathMeasure object associated with the specified path object
* (already created and specified). The measure object can now return the
@@ -40,7 +40,7 @@ public class PathMeasure {
* path.
*
* Note that once a path is associated with the measure object, it is
- * undefined if the path is subsequently modified and the the measure object
+ * undefined if the path is subsequently modified and the measure object
* is used. If the path is modified, you must call setPath with the path.
*
* @param path The path that will be measured by this object
@@ -121,7 +121,7 @@ public class PathMeasure {
* such as <code>dst.rLineTo(0, 0)</code>.</p>
*/
public boolean getSegment(float startD, float stopD, Path dst, boolean startWithMoveTo) {
- // Skia used to enforce this as part of it's API, but has since relaxed that restriction
+ // Skia used to enforce this as part of its API, but has since relaxed that restriction
// so to maintain consistency in our API we enforce the preconditions here.
float length = getLength();
if (startD < 0) {
diff --git a/graphics/java/android/graphics/Rasterizer.java b/graphics/java/android/graphics/Rasterizer.java
index 29d82fa1d98b..575095426563 100644
--- a/graphics/java/android/graphics/Rasterizer.java
+++ b/graphics/java/android/graphics/Rasterizer.java
@@ -16,8 +16,8 @@
// This file was generated from the C++ include file: SkRasterizer.h
// Any changes made to this file will be discarded by the build.
-// To change this file, either edit the include, or device/tools/gluemaker/main.cpp,
-// or one of the auxilary file specifications in device/tools/gluemaker.
+// To change this file, either edit the include, or device/tools/gluemaker/main.cpp,
+// or one of the auxiliary file specifications in device/tools/gluemaker.
package android.graphics;
diff --git a/graphics/java/android/graphics/Rect.java b/graphics/java/android/graphics/Rect.java
index 411a10b85bd2..5211e3a75d09 100644
--- a/graphics/java/android/graphics/Rect.java
+++ b/graphics/java/android/graphics/Rect.java
@@ -165,7 +165,7 @@ public final class Rect implements Parcelable {
public String toShortString() {
return toShortString(new StringBuilder(32));
}
-
+
/**
* Return a string representation of the rectangle in a compact form.
* @hide
@@ -184,7 +184,7 @@ public final class Rect implements Parcelable {
*
* <p>You can later recover the Rect from this string through
* {@link #unflattenFromString(String)}.
- *
+ *
* @return Returns a new String of the form "left top right bottom"
*/
@NonNull
@@ -314,7 +314,7 @@ public final class Rect implements Parcelable {
public final int height() {
return bottom - top;
}
-
+
/**
* @return the horizontal center of the rectangle. If the computed value
* is fractional, this method returns the largest integer that is
@@ -323,7 +323,7 @@ public final class Rect implements Parcelable {
public final int centerX() {
return (left + right) >> 1;
}
-
+
/**
* @return the vertical center of the rectangle. If the computed value
* is fractional, this method returns the largest integer that is
@@ -332,14 +332,14 @@ public final class Rect implements Parcelable {
public final int centerY() {
return (top + bottom) >> 1;
}
-
+
/**
* @return the exact horizontal center of the rectangle as a float.
*/
public final float exactCenterX() {
return (left + right) * 0.5f;
}
-
+
/**
* @return the exact vertical center of the rectangle as a float.
*/
@@ -493,7 +493,7 @@ public final class Rect implements Parcelable {
* @param top The top of the rectangle being tested for containment
* @param right The right side of the rectangle being tested for containment
* @param bottom The bottom of the rectangle being tested for containment
- * @return true iff the the 4 specified sides of a rectangle are inside or
+ * @return true iff the 4 specified sides of a rectangle are inside or
* equal to this rectangle
*/
public boolean contains(int left, int top, int right, int bottom) {
@@ -548,7 +548,7 @@ public final class Rect implements Parcelable {
}
return false;
}
-
+
/**
* If the specified rectangle intersects this rectangle, return true and set
* this rectangle to that intersection, otherwise return false and do not
@@ -670,7 +670,7 @@ public final class Rect implements Parcelable {
public void union(@NonNull Rect r) {
union(r.left, r.top, r.right, r.bottom);
}
-
+
/**
* Update this Rect to enclose itself and the [x,y] coordinate. There is no
* check to see that this rectangle is non-empty.
diff --git a/graphics/java/android/graphics/RectF.java b/graphics/java/android/graphics/RectF.java
index ff50a0c55e6c..5b9b7641111b 100644
--- a/graphics/java/android/graphics/RectF.java
+++ b/graphics/java/android/graphics/RectF.java
@@ -38,7 +38,7 @@ public class RectF implements Parcelable {
public float top;
public float right;
public float bottom;
-
+
/**
* Create a new empty RectF. All coordinates are initialized to 0.
*/
@@ -78,7 +78,7 @@ public class RectF implements Parcelable {
bottom = r.bottom;
}
}
-
+
public RectF(@Nullable Rect r) {
if (r == null) {
left = top = right = bottom = 0.0f;
@@ -121,7 +121,7 @@ public class RectF implements Parcelable {
public String toShortString() {
return toShortString(new StringBuilder(32));
}
-
+
/**
* Return a string representation of the rectangle in a compact form.
* @hide
@@ -134,7 +134,7 @@ public class RectF implements Parcelable {
sb.append(','); sb.append(bottom); sb.append(']');
return sb.toString();
}
-
+
/**
* Print short representation to given writer.
* @hide
@@ -183,14 +183,14 @@ public class RectF implements Parcelable {
public final float centerY() {
return (top + bottom) * 0.5f;
}
-
+
/**
* Set the rectangle to (0,0,0,0)
*/
public void setEmpty() {
left = right = top = bottom = 0;
}
-
+
/**
* Set the rectangle's coordinates to the specified values. Note: no range
* checking is performed, so it is up to the caller to ensure that
@@ -220,7 +220,7 @@ public class RectF implements Parcelable {
this.right = src.right;
this.bottom = src.bottom;
}
-
+
/**
* Copy the coordinates from src into this rectangle.
*
@@ -261,7 +261,7 @@ public class RectF implements Parcelable {
left = newLeft;
top = newTop;
}
-
+
/**
* Inset the rectangle by (dx,dy). If dx is positive, then the sides are
* moved inwards, making the rectangle narrower. If dx is negative, then the
@@ -293,7 +293,7 @@ public class RectF implements Parcelable {
return left < right && top < bottom // check for empty first
&& x >= left && x < right && y >= top && y < bottom;
}
-
+
/**
* Returns true iff the 4 specified sides of a rectangle are inside or equal
* to this rectangle. i.e. is this rectangle a superset of the specified
@@ -303,7 +303,7 @@ public class RectF implements Parcelable {
* @param top The top of the rectangle being tested for containment
* @param right The right side of the rectangle being tested for containment
* @param bottom The bottom of the rectangle being tested for containment
- * @return true iff the the 4 specified sides of a rectangle are inside or
+ * @return true iff the 4 specified sides of a rectangle are inside or
* equal to this rectangle
*/
public boolean contains(float left, float top, float right, float bottom) {
@@ -313,7 +313,7 @@ public class RectF implements Parcelable {
&& this.left <= left && this.top <= top
&& this.right >= right && this.bottom >= bottom;
}
-
+
/**
* Returns true iff the specified rectangle r is inside or equal to this
* rectangle. An empty rectangle never contains another rectangle.
@@ -329,7 +329,7 @@ public class RectF implements Parcelable {
&& left <= r.left && top <= r.top
&& right >= r.right && bottom >= r.bottom;
}
-
+
/**
* If the rectangle specified by left,top,right,bottom intersects this
* rectangle, return true and set this rectangle to that intersection,
@@ -367,7 +367,7 @@ public class RectF implements Parcelable {
}
return false;
}
-
+
/**
* If the specified rectangle intersects this rectangle, return true and set
* this rectangle to that intersection, otherwise return false and do not
@@ -382,7 +382,7 @@ public class RectF implements Parcelable {
public boolean intersect(@NonNull RectF r) {
return intersect(r.left, r.top, r.right, r.bottom);
}
-
+
/**
* If rectangles a and b intersect, return true and set this rectangle to
* that intersection, otherwise return false and do not change this
@@ -406,7 +406,7 @@ public class RectF implements Parcelable {
}
return false;
}
-
+
/**
* Returns true if this rectangle intersects the specified rectangle.
* In no event is this rectangle modified. No check is performed to see
@@ -426,7 +426,7 @@ public class RectF implements Parcelable {
return this.left < right && left < this.right
&& this.top < bottom && top < this.bottom;
}
-
+
/**
* Returns true iff the two specified rectangles intersect. In no event are
* either of the rectangles modified. To record the intersection,
@@ -441,7 +441,7 @@ public class RectF implements Parcelable {
return a.left < b.right && b.left < a.right
&& a.top < b.bottom && b.top < a.bottom;
}
-
+
/**
* Set the dst integer Rect by rounding this rectangle's coordinates
* to their nearest integer values.
@@ -489,7 +489,7 @@ public class RectF implements Parcelable {
}
}
}
-
+
/**
* Update this Rect to enclose itself and the specified rectangle. If the
* specified rectangle is empty, nothing is done. If this rectangle is empty
@@ -500,7 +500,7 @@ public class RectF implements Parcelable {
public void union(@NonNull RectF r) {
union(r.left, r.top, r.right, r.bottom);
}
-
+
/**
* Update this Rect to enclose itself and the [x,y] coordinate. There is no
* check to see that this rectangle is non-empty.
@@ -520,7 +520,7 @@ public class RectF implements Parcelable {
bottom = y;
}
}
-
+
/**
* Swap top/bottom or left/right if there are flipped (i.e. left > right
* and/or top > bottom). This can be called if
@@ -548,7 +548,7 @@ public class RectF implements Parcelable {
public int describeContents() {
return 0;
}
-
+
/**
* Write this rectangle to the specified parcel. To restore a rectangle from
* a parcel, use readFromParcel()
@@ -561,7 +561,7 @@ public class RectF implements Parcelable {
out.writeFloat(right);
out.writeFloat(bottom);
}
-
+
public static final @android.annotation.NonNull Parcelable.Creator<RectF> CREATOR = new Parcelable.Creator<RectF>() {
/**
* Return a new rectangle from the data in the specified parcel.
@@ -572,7 +572,7 @@ public class RectF implements Parcelable {
r.readFromParcel(in);
return r;
}
-
+
/**
* Return an array of rectangles of the specified size.
*/
@@ -581,7 +581,7 @@ public class RectF implements Parcelable {
return new RectF[size];
}
};
-
+
/**
* Set the rectangle's coordinates from the data stored in the specified
* parcel. To write a rectangle to a parcel, call writeToParcel().
diff --git a/graphics/java/android/graphics/RenderNode.java b/graphics/java/android/graphics/RenderNode.java
index 27325694073c..0650b7817729 100644
--- a/graphics/java/android/graphics/RenderNode.java
+++ b/graphics/java/android/graphics/RenderNode.java
@@ -765,12 +765,12 @@ public final class RenderNode {
* Default value is false. See
* {@link #setProjectBackwards(boolean)} for a description of what this entails.
*
- * @param shouldRecieve True if this RenderNode is a projection receiver, false otherwise.
+ * @param shouldReceive True if this RenderNode is a projection receiver, false otherwise.
* Default is false.
* @return True if the value changed, false if the new value was the same as the previous value.
*/
- public boolean setProjectionReceiver(boolean shouldRecieve) {
- return nSetProjectionReceiver(mNativeRenderNode, shouldRecieve);
+ public boolean setProjectionReceiver(boolean shouldReceive) {
+ return nSetProjectionReceiver(mNativeRenderNode, shouldReceive);
}
/**
@@ -1799,7 +1799,7 @@ public final class RenderNode {
private static native boolean nSetProjectBackwards(long renderNode, boolean shouldProject);
@CriticalNative
- private static native boolean nSetProjectionReceiver(long renderNode, boolean shouldRecieve);
+ private static native boolean nSetProjectionReceiver(long renderNode, boolean shouldReceive);
@CriticalNative
private static native boolean nSetOutlineRoundRect(long renderNode, int left, int top,
diff --git a/graphics/java/android/graphics/SurfaceTexture.java b/graphics/java/android/graphics/SurfaceTexture.java
index dd82fed03087..c1b531fb2d9c 100644
--- a/graphics/java/android/graphics/SurfaceTexture.java
+++ b/graphics/java/android/graphics/SurfaceTexture.java
@@ -318,7 +318,7 @@ public class SurfaceTexture {
}
/**
- * Releases the the texture content. This is needed in single buffered mode to allow the image
+ * Releases the texture content. This is needed in single buffered mode to allow the image
* content producer to take ownership of the image buffer.
* <p>
* For more information see {@link #SurfaceTexture(int, boolean)}.
@@ -431,7 +431,7 @@ public class SurfaceTexture {
* error.
* <p>
* Note that while calling this method causes all the buffers to be freed
- * from the perspective of the the SurfaceTexture, if there are additional
+ * from the perspective of the SurfaceTexture, if there are additional
* references on the buffers (e.g. if a buffer is referenced by a client or
* by OpenGL ES as a texture) then those buffer will remain allocated.
* <p>
diff --git a/graphics/java/android/graphics/Typeface.java b/graphics/java/android/graphics/Typeface.java
index 4c4e8fa9c088..fd788167a0d8 100644
--- a/graphics/java/android/graphics/Typeface.java
+++ b/graphics/java/android/graphics/Typeface.java
@@ -600,7 +600,7 @@ public class Typeface {
* {@link #setWeight} and {@link #setItalic}.
*
* If {@link #setWeight} is not called, the fallback family keeps the default weight.
- * Similary, if {@link #setItalic} is not called, the fallback family keeps the default
+ * Similarly, if {@link #setItalic} is not called, the fallback family keeps the default
* italic information. For example, calling {@code builder.setFallback("sans-serif-light")}
* is equivalent to calling {@code builder.setFallback("sans-serif").setWeight(300)} in
* terms of fallback. The default weight and italic information are overridden by calling
@@ -794,7 +794,7 @@ public class Typeface {
/**
* Returns the maximum capacity of custom fallback families.
*
- * This includes the the first font family passed to the constructor.
+ * This includes the first font family passed to the constructor.
* It is guaranteed that the value will be greater than or equal to 64.
*
* @return the maximum number of font families for the custom fallback
@@ -816,7 +816,7 @@ public class Typeface {
/**
* Sets a system fallback by name.
*
- * You can specify generic font familiy names or OEM specific family names. If the system
+ * You can specify generic font family names or OEM specific family names. If the system
* don't have a specified fallback, the default fallback is used instead.
* For more information about generic font families, see <a
* href="https://www.w3.org/TR/css-fonts-4/#generic-font-families">CSS specification</a>
diff --git a/graphics/java/android/graphics/Xfermode.java b/graphics/java/android/graphics/Xfermode.java
index 81769e2e21bf..6bb22a12280e 100644
--- a/graphics/java/android/graphics/Xfermode.java
+++ b/graphics/java/android/graphics/Xfermode.java
@@ -16,8 +16,8 @@
// This file was generated from the C++ include file: SkXfermode.h
// Any changes made to this file will be discarded by the build.
-// To change this file, either edit the include, or device/tools/gluemaker/main.cpp,
-// or one of the auxilary file specifications in device/tools/gluemaker.
+// To change this file, either edit the include, or device/tools/gluemaker/main.cpp,
+// or one of the auxiliary file specifications in device/tools/gluemaker.
package android.graphics;
@@ -28,7 +28,7 @@ import android.os.Build;
* Xfermode is the base class for objects that are called to implement custom
* "transfer-modes" in the drawing pipeline. The static function Create(Modes)
* can be called to return an instance of any of the predefined subclasses as
- * specified in the Modes enum. When an Xfermode is assigned to an Paint, then
+ * specified in the Modes enum. When an Xfermode is assigned to a Paint, then
* objects drawn with that paint have the xfermode applied.
*/
public class Xfermode {
diff --git a/graphics/java/android/graphics/YuvImage.java b/graphics/java/android/graphics/YuvImage.java
index ce35b55d526f..b0c7f202f23a 100644
--- a/graphics/java/android/graphics/YuvImage.java
+++ b/graphics/java/android/graphics/YuvImage.java
@@ -63,7 +63,7 @@ public class YuvImage {
private int mWidth;
/**
- * The height of the the image.
+ * The height of the image.
*/
private int mHeight;
diff --git a/graphics/java/android/graphics/drawable/AdaptiveIconDrawable.java b/graphics/java/android/graphics/drawable/AdaptiveIconDrawable.java
index 688425a77ab5..7ee7d6beec78 100644
--- a/graphics/java/android/graphics/drawable/AdaptiveIconDrawable.java
+++ b/graphics/java/android/graphics/drawable/AdaptiveIconDrawable.java
@@ -98,7 +98,7 @@ public class AdaptiveIconDrawable extends Drawable implements Drawable.Callback
* extra content to reveal within the clip path when performing affine transformations on the
* layers.
*
- * Each layers will reserve 25% of it's width and height.
+ * Each layers will reserve 25% of its width and height.
*
* As a result, the view port of the layers is smaller than their intrinsic width and height.
*/
diff --git a/graphics/java/android/graphics/drawable/Drawable.java b/graphics/java/android/graphics/drawable/Drawable.java
index 4972e928dd22..7f2feac2278d 100644
--- a/graphics/java/android/graphics/drawable/Drawable.java
+++ b/graphics/java/android/graphics/drawable/Drawable.java
@@ -839,7 +839,7 @@ public abstract class Drawable {
}
/**
- * Describes the current state, as a union of primitve states, such as
+ * Describes the current state, as a union of primitive states, such as
* {@link android.R.attr#state_focused},
* {@link android.R.attr#state_selected}, etc.
* Some drawables may modify their imagery based on the selected state.
diff --git a/graphics/java/android/graphics/drawable/GradientDrawable.java b/graphics/java/android/graphics/drawable/GradientDrawable.java
index 166a795e1661..29d033e64aea 100644
--- a/graphics/java/android/graphics/drawable/GradientDrawable.java
+++ b/graphics/java/android/graphics/drawable/GradientDrawable.java
@@ -936,7 +936,7 @@ public class GradientDrawable extends Drawable {
}
/**
- * Retrn the inner radius of the ring
+ * Return the inner radius of the ring
*
* @see #setInnerRadius(int)
* @attr ref android.R.styleable#GradientDrawable_innerRadius
diff --git a/graphics/java/android/graphics/drawable/shapes/PathShape.java b/graphics/java/android/graphics/drawable/shapes/PathShape.java
index 393fdee87bb8..299f6d5cddfa 100644
--- a/graphics/java/android/graphics/drawable/shapes/PathShape.java
+++ b/graphics/java/android/graphics/drawable/shapes/PathShape.java
@@ -93,7 +93,7 @@ public class PathShape extends Shape {
&& Float.compare(pathShape.mStdHeight, mStdHeight) == 0
&& Float.compare(pathShape.mScaleX, mScaleX) == 0
&& Float.compare(pathShape.mScaleY, mScaleY) == 0
- // Path does not have equals implementation but incase it gains one, use it here
+ // Path does not have equals implementation but in case it gains one, use it here
&& Objects.equals(mPath, pathShape.mPath);
}
diff --git a/graphics/java/android/graphics/fonts/Font.java b/graphics/java/android/graphics/fonts/Font.java
index 28cc05162cbb..9aea246dbd06 100644
--- a/graphics/java/android/graphics/fonts/Font.java
+++ b/graphics/java/android/graphics/fonts/Font.java
@@ -787,7 +787,7 @@ public final class Font {
return false;
}
- // ByteBuffer#equals compares all bytes which is not performant for e.g HashMap. Since
+ // ByteBuffer#equals compares all bytes which is not performant for e.g. HashMap. Since
// underlying native font object holds buffer address, check if this buffer points exactly
// the same address as a shortcut of equality. For being compatible with of API30 or before,
// check buffer position even if the buffer points the same address.
diff --git a/graphics/java/android/graphics/fonts/FontFileUtil.java b/graphics/java/android/graphics/fonts/FontFileUtil.java
index ff38282255f2..abcafb666576 100644
--- a/graphics/java/android/graphics/fonts/FontFileUtil.java
+++ b/graphics/java/android/graphics/fonts/FontFileUtil.java
@@ -34,7 +34,7 @@ import java.util.Set;
*/
public class FontFileUtil {
- private FontFileUtil() {} // Do not instanciate
+ private FontFileUtil() {} // Do not instantiate
/**
* Unpack the weight value from packed integer.
@@ -87,7 +87,7 @@ public class FontFileUtil {
}
if (weight != -1 && italic != -1) {
- // Both weight/italic style are specifeid by variation settings.
+ // Both weight/italic style are specified by variation settings.
// No need to look into OS/2 table.
// TODO: Good to look HVAR table to check if this font supports wght/ital axes.
return pack(weight, italic == 1);
diff --git a/graphics/java/android/graphics/fonts/SystemFonts.java b/graphics/java/android/graphics/fonts/SystemFonts.java
index 3ef714ed8bdf..6e20034c838a 100644
--- a/graphics/java/android/graphics/fonts/SystemFonts.java
+++ b/graphics/java/android/graphics/fonts/SystemFonts.java
@@ -151,7 +151,7 @@ public final class SystemFonts {
} else if (defaultFamily != null) {
familyListSet.familyList.add(defaultFamily);
} else {
- // There is no valid for for default fallback. Ignore.
+ // There is no valid for default fallback. Ignore.
}
}
}
diff --git a/graphics/java/android/graphics/text/LineBreaker.java b/graphics/java/android/graphics/text/LineBreaker.java
index 0e3fb163ef75..06ff4c5c5f36 100644
--- a/graphics/java/android/graphics/text/LineBreaker.java
+++ b/graphics/java/android/graphics/text/LineBreaker.java
@@ -368,8 +368,8 @@ public class LineBreaker {
* @see LineBreaker#computeLineBreaks
*/
public static class Result {
- // Following two contstant must be synced with minikin's line breaker.
- // TODO(nona): Remove these constatns by introducing native methods.
+ // Following two constants must be synced with minikin's line breaker.
+ // TODO(nona): Remove these constants by introducing native methods.
private static final int TAB_MASK = 0x20000000;
private static final int HYPHEN_MASK = 0xFF;
private static final int START_HYPHEN_MASK = 0x18; // 0b11000
diff --git a/graphics/java/android/graphics/text/PositionedGlyphs.java b/graphics/java/android/graphics/text/PositionedGlyphs.java
index 7932e3334063..fe20089901e1 100644
--- a/graphics/java/android/graphics/text/PositionedGlyphs.java
+++ b/graphics/java/android/graphics/text/PositionedGlyphs.java
@@ -137,7 +137,7 @@ public final class PositionedGlyphs {
* Returns the glyph ID used for drawing the glyph at the given index.
*
* @param index the glyph index
- * @return An glyph ID of the font.
+ * @return A glyph ID of the font.
*/
@IntRange(from = 0)
public int getGlyphId(@IntRange(from = 0) int index) {
diff --git a/keystore/java/android/security/KeyStore.java b/keystore/java/android/security/KeyStore.java
deleted file mode 100644
index d1d7c145680f..000000000000
--- a/keystore/java/android/security/KeyStore.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (C) 2009 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.security;
-
-/**
- * This class provides some constants and helper methods related to Android's Keystore service.
- * This class was originally much larger, but its functionality was superseded by other classes.
- * It now just contains a few remaining pieces for which the users haven't been updated yet.
- * You may be looking for {@link java.security.KeyStore} instead.
- *
- * @hide
- */
-public class KeyStore {
-
- // Used for UID field to indicate the calling UID.
- public static final int UID_SELF = -1;
-}
diff --git a/libs/WindowManager/Shell/tests/flicker/service/Android.bp b/libs/WindowManager/Shell/tests/flicker/service/Android.bp
index 4f1a68a1a74e..a5bc26152d16 100644
--- a/libs/WindowManager/Shell/tests/flicker/service/Android.bp
+++ b/libs/WindowManager/Shell/tests/flicker/service/Android.bp
@@ -65,6 +65,10 @@ android_test {
package_name: "com.android.wm.shell.flicker.service",
instrumentation_target_package: "com.android.wm.shell.flicker.service",
test_config_template: "AndroidTestTemplate.xml",
+ test_suites: [
+ "device-tests",
+ "device-platinum-tests",
+ ],
srcs: [":WMShellFlickerServicePlatinumTests-src"],
static_libs: ["WMShellFlickerTestsBase"],
data: ["trace_config/*"],
diff --git a/libs/androidfw/fuzz/resourcefile_fuzzer/Android.bp b/libs/androidfw/fuzz/resourcefile_fuzzer/Android.bp
index b511244c4a30..619658923865 100644
--- a/libs/androidfw/fuzz/resourcefile_fuzzer/Android.bp
+++ b/libs/androidfw/fuzz/resourcefile_fuzzer/Android.bp
@@ -19,6 +19,7 @@ package {
// to get the below license kinds:
// SPDX-license-identifier-Apache-2.0
default_applicable_licenses: ["frameworks_base_libs_androidfw_license"],
+ default_team: "trendy_team_android_resources",
}
cc_fuzz {
@@ -31,7 +32,7 @@ cc_fuzz {
static_libs: ["libgmock"],
target: {
android: {
- shared_libs:[
+ shared_libs: [
"libandroidfw",
"libbase",
"libcutils",
@@ -52,4 +53,15 @@ cc_fuzz {
],
},
},
+ fuzz_config: {
+ cc: [
+ "android-resources@google.com",
+ ],
+ componentid: 568761,
+ description: "The fuzzer targets the APIs of libandroidfw",
+ vector: "local_no_privileges_required",
+ service_privilege: "privileged",
+ users: "multi_user",
+ fuzzed_code_usage: "shipped",
+ },
}
diff --git a/nfc/java/android/nfc/NfcActivityManager.java b/nfc/java/android/nfc/NfcActivityManager.java
index f03fc0af86b3..0e40db612708 100644
--- a/nfc/java/android/nfc/NfcActivityManager.java
+++ b/nfc/java/android/nfc/NfcActivityManager.java
@@ -195,16 +195,25 @@ public final class NfcActivityManager extends IAppCallback.Stub
Bundle extras) {
boolean isResumed;
Binder token;
+ int pollTech, listenTech;
synchronized (NfcActivityManager.this) {
NfcActivityState state = getActivityState(activity);
state.readerCallback = callback;
state.readerModeFlags = flags;
state.readerModeExtras = extras;
+ pollTech = state.mPollTech;
+ listenTech = state.mListenTech;
token = state.token;
isResumed = state.resumed;
}
if (isResumed) {
- setReaderMode(token, flags, extras);
+ if (listenTech != NfcAdapter.FLAG_USE_ALL_TECH
+ || pollTech != NfcAdapter.FLAG_USE_ALL_TECH) {
+ throw new IllegalStateException(
+ "Cannot be used when alternative DiscoveryTechnology is set");
+ } else {
+ setReaderMode(token, flags, extras);
+ }
}
}
@@ -385,15 +394,12 @@ public final class NfcActivityManager extends IAppCallback.Stub
boolean readerModeFlagsSet;
synchronized (NfcActivityManager.this) {
NfcActivityState state = getActivityState(activity);
- readerModeFlagsSet = state.readerModeFlags != 0;
state.mListenTech = NfcAdapter.FLAG_USE_ALL_TECH;
state.mPollTech = NfcAdapter.FLAG_USE_ALL_TECH;
token = state.token;
isResumed = state.resumed;
}
- if (readerModeFlagsSet) {
- disableReaderMode(activity);
- } else if (isResumed) {
+ if (isResumed) {
changeDiscoveryTech(token, NfcAdapter.FLAG_USE_ALL_TECH, NfcAdapter.FLAG_USE_ALL_TECH);
}
diff --git a/nfc/java/android/nfc/NfcAdapter.java b/nfc/java/android/nfc/NfcAdapter.java
index 7e0a1111b574..e1c18843313d 100644
--- a/nfc/java/android/nfc/NfcAdapter.java
+++ b/nfc/java/android/nfc/NfcAdapter.java
@@ -1846,10 +1846,7 @@ public final class NfcAdapter {
throw new UnsupportedOperationException();
}
}
- mNfcActivityManager.enableReaderMode(activity, null, pollTechnology, null);
- return;
- }
- if (pollTechnology == FLAG_READER_DISABLE) {
+ } else if (pollTechnology == FLAG_READER_DISABLE) {
synchronized (sLock) {
if (!sHasCeFeature) {
throw new UnsupportedOperationException();
diff --git a/nfc/java/android/nfc/cardemulation/CardEmulation.java b/nfc/java/android/nfc/cardemulation/CardEmulation.java
index ad86d70db967..4bae1188e0df 100644
--- a/nfc/java/android/nfc/cardemulation/CardEmulation.java
+++ b/nfc/java/android/nfc/cardemulation/CardEmulation.java
@@ -970,16 +970,16 @@ public final class CardEmulation {
*
* @param service The ComponentName of the service
* @param status true to enable, false to disable
+ * @param userId the user handle of the user whose information is being requested.
* @return set service for the category and true if service is already set return false.
*
* @hide
*/
- public boolean setServiceEnabledForCategoryOther(ComponentName service, boolean status) {
+ public boolean setServiceEnabledForCategoryOther(ComponentName service, boolean status,
+ int userId) {
if (service == null) {
throw new NullPointerException("activity or service or category is null");
}
- int userId = mContext.getUser().getIdentifier();
-
try {
return sService.setServiceEnabledForCategoryOther(userId, service, status);
} catch (RemoteException e) {
diff --git a/nfc/java/android/nfc/cardemulation/HostApduService.java b/nfc/java/android/nfc/cardemulation/HostApduService.java
index 7cd2533a7dbf..ea3fd0d47a90 100644
--- a/nfc/java/android/nfc/cardemulation/HostApduService.java
+++ b/nfc/java/android/nfc/cardemulation/HostApduService.java
@@ -20,6 +20,7 @@ import android.annotation.FlaggedApi;
import android.annotation.NonNull;
import android.annotation.SdkConstant;
import android.annotation.SdkConstant.SdkConstantType;
+import android.annotation.SuppressLint;
import android.app.Service;
import android.content.Intent;
import android.content.pm.PackageManager;
@@ -481,6 +482,7 @@ public abstract class HostApduService extends Service {
*
* @param frame A description of the polling frame.
*/
+ @SuppressLint("OnNameExpected")
@FlaggedApi(android.nfc.Flags.FLAG_NFC_READ_POLLING_LOOP)
public void processPollingFrames(@NonNull List<Bundle> frame) {
}
diff --git a/packages/DynamicSystemInstallationService/src/com/android/dynsystem/DynamicSystemInstallationService.java b/packages/DynamicSystemInstallationService/src/com/android/dynsystem/DynamicSystemInstallationService.java
index 25ac3c9d9074..635dc420f18c 100644
--- a/packages/DynamicSystemInstallationService/src/com/android/dynsystem/DynamicSystemInstallationService.java
+++ b/packages/DynamicSystemInstallationService/src/com/android/dynsystem/DynamicSystemInstallationService.java
@@ -172,7 +172,7 @@ public class DynamicSystemInstallationService extends Service
// This is for testing only now
private boolean mEnableWhenCompleted;
- private boolean mOneShot;
+ private boolean mOneShot = true;
private boolean mHideNotification;
private InstallationAsyncTask.Progress mInstallTaskProgress;
diff --git a/proto/src/am_capabilities.proto b/proto/src/am_capabilities.proto
index fc9f7a4590bd..c2b3ac2aaa78 100644
--- a/proto/src/am_capabilities.proto
+++ b/proto/src/am_capabilities.proto
@@ -15,8 +15,16 @@ message FrameworkCapability {
string name = 1;
}
+message VMInfo {
+ // The value of the "java.vm.name" system property
+ string name = 1;
+ // The value of the "java.vm.version" system property
+ string version = 2;
+}
+
message Capabilities {
repeated Capability values = 1;
repeated VMCapability vm_capabilities = 2;
repeated FrameworkCapability framework_capabilities = 3;
+ VMInfo vm_info = 4;
}
diff --git a/ravenwood/OWNERS b/ravenwood/OWNERS
index 41fd68e6c2d9..a90328c2e8c6 100644
--- a/ravenwood/OWNERS
+++ b/ravenwood/OWNERS
@@ -2,4 +2,6 @@ set noparent
jsharkey@google.com
omakoto@google.com
-jaggies@google.com
+
+per-file ravenwood-annotation-allowed-classes.txt = dplotnikov@google.com
+per-file texts/ravenwood-annotation-allowed-classes.txt = dplotnikov@google.com
diff --git a/ravenwood/ravenwood-annotation-allowed-classes.txt b/ravenwood/ravenwood-annotation-allowed-classes.txt
index 13908f1732e1..56eb658a3f2d 100644
--- a/ravenwood/ravenwood-annotation-allowed-classes.txt
+++ b/ravenwood/ravenwood-annotation-allowed-classes.txt
@@ -1,5 +1,7 @@
# Only classes listed here can use the Ravenwood annotations.
+com.android.internal.ravenwood.*
+
com.android.internal.util.ArrayUtils
com.android.internal.os.BatteryStatsHistory
com.android.internal.os.BatteryStatsHistory$TraceDelegate
diff --git a/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java b/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
index a4b28967e3b2..96ae7904d57e 100644
--- a/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
+++ b/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
@@ -5084,7 +5084,9 @@ class AppWidgetServiceImpl extends IAppWidgetService.Stub implements WidgetBacku
// so we tear it down in anticipation of it (possibly) being
// reconstructed due to the restore
host.widgets.remove(widget);
- provider.widgets.remove(widget);
+ if (provider != null) {
+ provider.widgets.remove(widget);
+ }
// Check if we need to destroy any services (if no other app widgets are
// referencing the same service)
decrementAppWidgetServiceRefCount(widget);
diff --git a/services/companion/java/com/android/server/companion/securechannel/SecureChannel.java b/services/companion/java/com/android/server/companion/securechannel/SecureChannel.java
index 0e66fbc020a1..71a182225013 100644
--- a/services/companion/java/com/android/server/companion/securechannel/SecureChannel.java
+++ b/services/companion/java/com/android/server/companion/securechannel/SecureChannel.java
@@ -23,6 +23,7 @@ import android.content.Context;
import android.os.Build;
import android.util.Slog;
+import com.google.security.cryptauth.lib.securegcm.ukey2.AlertException;
import com.google.security.cryptauth.lib.securegcm.ukey2.BadHandleException;
import com.google.security.cryptauth.lib.securegcm.ukey2.CryptoException;
import com.google.security.cryptauth.lib.securegcm.ukey2.D2DConnectionContextV1;
@@ -203,7 +204,8 @@ public class SecureChannel {
*
* This method must only be called from one of the two participants.
*/
- public void establishSecureConnection() throws IOException, SecureChannelException {
+ public void establishSecureConnection() throws IOException,
+ SecureChannelException, HandshakeException {
if (isSecured()) {
Slog.d(TAG, "Channel is already secure.");
return;
@@ -334,7 +336,7 @@ public class SecureChannel {
}
}
- private void initiateHandshake() throws IOException, BadHandleException {
+ private void initiateHandshake() throws IOException, BadHandleException , HandshakeException {
if (mConnectionContext != null) {
Slog.d(TAG, "Ukey2 handshake is already completed.");
return;
@@ -394,8 +396,8 @@ public class SecureChannel {
}
}
- private void exchangeHandshake()
- throws IOException, HandshakeException, BadHandleException, CryptoException {
+ private void exchangeHandshake() throws IOException, HandshakeException,
+ BadHandleException, CryptoException, AlertException {
if (mConnectionContext != null) {
Slog.d(TAG, "Ukey2 handshake is already completed.");
return;
diff --git a/services/core/java/com/android/server/BootReceiver.java b/services/core/java/com/android/server/BootReceiver.java
index 9f279b1ba3fe..f69a521130ab 100644
--- a/services/core/java/com/android/server/BootReceiver.java
+++ b/services/core/java/com/android/server/BootReceiver.java
@@ -34,6 +34,7 @@ import android.os.TombstoneWithHeadersProto;
import android.provider.Downloads;
import android.system.ErrnoException;
import android.system.Os;
+import android.system.OsConstants;
import android.text.TextUtils;
import android.util.AtomicFile;
import android.util.EventLog;
@@ -230,16 +231,23 @@ public class BootReceiver extends BroadcastReceiver {
}
private static String getCurrentBootHeaders() throws IOException {
- return new StringBuilder(512)
- .append("Build: ").append(Build.FINGERPRINT).append("\n")
- .append("Hardware: ").append(Build.BOARD).append("\n")
- .append("Revision: ")
- .append(SystemProperties.get("ro.revision", "")).append("\n")
- .append("Bootloader: ").append(Build.BOOTLOADER).append("\n")
- .append("Radio: ").append(Build.getRadioVersion()).append("\n")
- .append("Kernel: ")
- .append(FileUtils.readTextFile(new File("/proc/version"), 1024, "...\n"))
- .append("\n").toString();
+ StringBuilder builder = new StringBuilder(512)
+ .append("Build: ").append(Build.FINGERPRINT).append("\n")
+ .append("Hardware: ").append(Build.BOARD).append("\n")
+ .append("Revision: ")
+ .append(SystemProperties.get("ro.revision", "")).append("\n")
+ .append("Bootloader: ").append(Build.BOOTLOADER).append("\n")
+ .append("Radio: ").append(Build.getRadioVersion()).append("\n")
+ .append("Kernel: ")
+ .append(FileUtils.readTextFile(new File("/proc/version"), 1024, "...\n"));
+
+ // If device is not using 4KB pages, add the PageSize
+ long pageSize = Os.sysconf(OsConstants._SC_PAGESIZE);
+ if (pageSize != 4096) {
+ builder.append("PageSize: ").append(pageSize).append("\n");
+ }
+ builder.append("\n");
+ return builder.toString();
}
diff --git a/services/core/java/com/android/server/PinnerService.java b/services/core/java/com/android/server/PinnerService.java
index c5c2b0b5dd59..a19bb1d6f308 100644
--- a/services/core/java/com/android/server/PinnerService.java
+++ b/services/core/java/com/android/server/PinnerService.java
@@ -885,6 +885,7 @@ public final class PinnerService extends SystemService {
}
synchronized (this) {
pinnedApp.mFiles.add(pf);
+ mPinnedFiles.put(pf.fileName, pf);
}
apkPinSizeLimit -= pf.bytesPinned;
@@ -1356,18 +1357,6 @@ public final class PinnerService extends SystemService {
public List<PinnedFileStat> getPinnerStats() {
ArrayList<PinnedFileStat> stats = new ArrayList<>();
- Collection<PinnedApp> pinnedApps;
- synchronized(this) {
- pinnedApps = mPinnedApps.values();
- }
- for (PinnedApp pinnedApp : pinnedApps) {
- for (PinnedFile pf : pinnedApp.mFiles) {
- PinnedFileStat stat =
- new PinnedFileStat(pf.fileName, pf.bytesPinned, pf.groupName);
- stats.add(stat);
- }
- }
-
Collection<PinnedFile> pinnedFiles;
synchronized(this) {
pinnedFiles = mPinnedFiles.values();
diff --git a/services/core/java/com/android/server/SystemConfig.java b/services/core/java/com/android/server/SystemConfig.java
index 79620cff2b24..1c1190fde049 100644
--- a/services/core/java/com/android/server/SystemConfig.java
+++ b/services/core/java/com/android/server/SystemConfig.java
@@ -1638,7 +1638,13 @@ public class SystemConfig {
String gidStr = parser.getAttributeValue(null, "gid");
if (gidStr != null) {
int gid = Process.getGidForName(gidStr);
- perm.gids = appendInt(perm.gids, gid);
+ if (gid != -1) {
+ perm.gids = appendInt(perm.gids, gid);
+ } else {
+ Slog.w(TAG, "<group> with unknown gid \""
+ + gidStr + " for permission " + name + " in "
+ + parser.getPositionDescription());
+ }
} else {
Slog.w(TAG, "<group> without gid at "
+ parser.getPositionDescription());
diff --git a/services/core/java/com/android/server/VcnManagementService.java b/services/core/java/com/android/server/VcnManagementService.java
index 7acca19f9d79..e2b6bd6ae360 100644
--- a/services/core/java/com/android/server/VcnManagementService.java
+++ b/services/core/java/com/android/server/VcnManagementService.java
@@ -36,6 +36,7 @@ import static java.util.Objects.requireNonNull;
import android.annotation.NonNull;
import android.annotation.Nullable;
+import android.annotation.SuppressLint;
import android.app.AppOpsManager;
import android.content.BroadcastReceiver;
import android.content.Context;
@@ -47,6 +48,7 @@ import android.net.LinkProperties;
import android.net.Network;
import android.net.NetworkCapabilities;
import android.net.NetworkRequest;
+import android.net.vcn.Flags;
import android.net.vcn.IVcnManagementService;
import android.net.vcn.IVcnStatusCallback;
import android.net.vcn.IVcnUnderlyingNetworkPolicyListener;
@@ -68,6 +70,7 @@ import android.os.Process;
import android.os.RemoteException;
import android.os.ServiceSpecificException;
import android.os.UserHandle;
+import android.os.UserManager;
import android.telephony.SubscriptionInfo;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
@@ -431,6 +434,8 @@ public class VcnManagementService extends IVcnManagementService.Stub {
mTelephonySubscriptionTracker.register();
}
+ // The system server automatically has the required permissions for #getMainUser()
+ @SuppressLint("AndroidFrameworkRequiresPermission")
private void enforcePrimaryUser() {
final int uid = mDeps.getBinderCallingUid();
if (uid == Process.SYSTEM_UID) {
@@ -438,7 +443,20 @@ public class VcnManagementService extends IVcnManagementService.Stub {
"Calling identity was System Server. Was Binder calling identity cleared?");
}
- if (!UserHandle.getUserHandleForUid(uid).isSystem()) {
+ final UserHandle userHandle = UserHandle.getUserHandleForUid(uid);
+
+ if (Flags.enforceMainUser()) {
+ final UserManager userManager = mContext.getSystemService(UserManager.class);
+
+ Binder.withCleanCallingIdentity(
+ () -> {
+ if (!Objects.equals(userManager.getMainUser(), userHandle)) {
+ throw new SecurityException(
+ "VcnManagementService can only be used by callers running as"
+ + " the main user");
+ }
+ });
+ } else if (!userHandle.isSystem()) {
throw new SecurityException(
"VcnManagementService can only be used by callers running as the primary user");
}
diff --git a/services/core/java/com/android/server/WallpaperUpdateReceiver.java b/services/core/java/com/android/server/WallpaperUpdateReceiver.java
index 2812233815a6..42391a55fed6 100644
--- a/services/core/java/com/android/server/WallpaperUpdateReceiver.java
+++ b/services/core/java/com/android/server/WallpaperUpdateReceiver.java
@@ -24,7 +24,6 @@ import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
-import android.graphics.Bitmap;
import android.os.AsyncTask;
import android.os.ParcelFileDescriptor;
import android.util.Slog;
@@ -59,10 +58,10 @@ public class WallpaperUpdateReceiver extends BroadcastReceiver {
return;
}
if (DEBUG) Slog.d(TAG, "Set customized default_wallpaper.");
- Bitmap blank = Bitmap.createBitmap(1, 1, Bitmap.Config.ALPHA_8);
- // set a blank wallpaper to force a redraw of default_wallpaper
- wallpaperManager.setBitmap(blank);
- wallpaperManager.setResource(com.android.internal.R.drawable.default_wallpaper);
+ // Check if it is not a live wallpaper set
+ if (wallpaperManager.getWallpaperInfo() == null) {
+ wallpaperManager.clearWallpaper();
+ }
} catch (Exception e) {
Slog.w(TAG, "Failed to customize system wallpaper." + e);
}
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java
index 28d840bc036c..11e4a03e44a4 100644
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -369,6 +369,8 @@ import android.provider.DeviceConfig;
import android.provider.Settings;
import android.server.ServerProtoEnums;
import android.sysprop.InitProperties;
+import android.system.Os;
+import android.system.OsConstants;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
import android.text.style.SuggestionSpan;
@@ -9618,6 +9620,13 @@ public class ActivityManagerService extends IActivityManager.Stub
sb.append("ErrorId: ").append(errorId.toString()).append("\n");
}
sb.append("Build: ").append(Build.FINGERPRINT).append("\n");
+
+ // If device is not using 4KB pages, add the PageSize
+ long pageSize = Os.sysconf(OsConstants._SC_PAGESIZE);
+ if (pageSize != 4096) {
+ sb.append("PageSize: ").append(pageSize).append("\n");
+ }
+
if (Debug.isDebuggerConnected()) {
sb.append("Debugger: Connected\n");
}
diff --git a/services/core/java/com/android/server/am/ActivityManagerShellCommand.java b/services/core/java/com/android/server/am/ActivityManagerShellCommand.java
index c13f02ebdf1b..9a173663383d 100644
--- a/services/core/java/com/android/server/am/ActivityManagerShellCommand.java
+++ b/services/core/java/com/android/server/am/ActivityManagerShellCommand.java
@@ -127,6 +127,7 @@ import com.android.server.am.nano.Capabilities;
import com.android.server.am.nano.Capability;
import com.android.server.am.nano.FrameworkCapability;
import com.android.server.am.nano.VMCapability;
+import com.android.server.am.nano.VMInfo;
import com.android.server.compat.PlatformCompat;
import com.android.server.pm.UserManagerInternal;
import com.android.server.utils.Slogf;
@@ -438,6 +439,8 @@ final class ActivityManagerShellCommand extends ShellCommand {
return -1;
}
}
+ String vmName = System.getProperty("java.vm.name", "?");
+ String vmVersion = System.getProperty("java.vm.version", "?");
if (outputAsProtobuf) {
Capabilities capabilities = new Capabilities();
@@ -464,6 +467,11 @@ final class ActivityManagerShellCommand extends ShellCommand {
capabilities.frameworkCapabilities[i] = cap;
}
+ VMInfo vmInfo = new VMInfo();
+ vmInfo.name = vmName;
+ vmInfo.version = vmVersion;
+ capabilities.vmInfo = vmInfo;
+
try {
getRawOutputStream().write(Capabilities.toByteArray(capabilities));
} catch (IOException e) {
@@ -483,6 +491,8 @@ final class ActivityManagerShellCommand extends ShellCommand {
for (String capability : Debug.getFeatureList()) {
pw.println("framework:" + capability);
}
+ pw.println("vm_name:" + vmName);
+ pw.println("vm_version:" + vmVersion);
}
return 0;
}
diff --git a/services/core/java/com/android/server/audio/AudioService.java b/services/core/java/com/android/server/audio/AudioService.java
index 5e6cf1ab73c6..69c6752fce1f 100644
--- a/services/core/java/com/android/server/audio/AudioService.java
+++ b/services/core/java/com/android/server/audio/AudioService.java
@@ -4408,7 +4408,8 @@ public class AudioService extends IAudioService.Stub
|| usage == AudioAttributes.USAGE_VOICE_COMMUNICATION_SIGNALLING) {
voiceActive = true;
}
- if (usage == AudioAttributes.USAGE_MEDIA || usage == AudioAttributes.USAGE_GAME) {
+ if (usage == AudioAttributes.USAGE_MEDIA || usage == AudioAttributes.USAGE_GAME
+ || usage == AudioAttributes.USAGE_UNKNOWN) {
mediaActive = true;
}
}
@@ -9680,9 +9681,9 @@ public class AudioService extends IAudioService.Stub
mContentResolver.registerContentObserver(Settings.Global.getUriFor(
Settings.Global.DOCK_AUDIO_MEDIA_ENABLED), false, this);
mContentResolver.registerContentObserver(Settings.System.getUriFor(
- Settings.System.MASTER_MONO), false, this);
+ Settings.System.MASTER_MONO), false, this, UserHandle.USER_ALL);
mContentResolver.registerContentObserver(Settings.System.getUriFor(
- Settings.System.MASTER_BALANCE), false, this);
+ Settings.System.MASTER_BALANCE), false, this, UserHandle.USER_ALL);
mEncodedSurroundMode = mSettings.getGlobalInt(
mContentResolver, Settings.Global.ENCODED_SURROUND_OUTPUT,
diff --git a/services/core/java/com/android/server/audio/MusicFxHelper.java b/services/core/java/com/android/server/audio/MusicFxHelper.java
index 85b3b49ecf78..cf0b2ae15618 100644
--- a/services/core/java/com/android/server/audio/MusicFxHelper.java
+++ b/services/core/java/com/android/server/audio/MusicFxHelper.java
@@ -70,6 +70,8 @@ public class MusicFxHelper {
// The binder token identifying the UidObserver registration.
private IBinder mUidObserverToken = null;
+ private boolean mIsBound;
+
// Package name and list of open audio sessions for this package
private static class PackageSessions {
String mPackageName;
@@ -90,7 +92,6 @@ public class MusicFxHelper {
* observer will also be removed, and observer token reset to null
*/
private class MySparseArray extends SparseArray<PackageSessions> {
- private final String mMusicFxPackageName = "com.android.musicfx";
@RequiresPermission(anyOf = {
android.Manifest.permission.INTERACT_ACROSS_USERS_FULL,
@@ -110,6 +111,7 @@ public class MusicFxHelper {
if (procState > ActivityManager.PROCESS_STATE_IMPORTANT_FOREGROUND) {
Intent bindIntent = new Intent().setClassName(mMusicFxPackageName,
"com.android.musicfx.KeepAliveService");
+ mIsBound = true;
mContext.bindServiceAsUser(
bindIntent, mMusicFxBindConnection, Context.BIND_AUTO_CREATE,
UserHandle.of(getCurrentUserId()));
@@ -158,9 +160,12 @@ public class MusicFxHelper {
Log.e(TAG, "RemoteException with unregisterUidObserver: " + e);
}
mUidObserverToken = null;
- mContext.unbindService(mMusicFxBindConnection);
- Log.i(TAG, "last session closed, unregister UID observer, and unbind "
- + mMusicFxPackageName);
+ if (mIsBound) {
+ mContext.unbindService(mMusicFxBindConnection);
+ mIsBound = false;
+ Log.i(TAG, "last session closed, unregister UID observer, and unbind "
+ + mMusicFxPackageName);
+ }
}
}
}
@@ -229,6 +234,10 @@ public class MusicFxHelper {
if (ril != null && ril.size() != 0) {
ResolveInfo ri = ril.get(0);
final String senderPackageName = intent.getStringExtra(AudioEffect.EXTRA_PACKAGE_NAME);
+ if (senderPackageName == null) {
+ Log.w(TAG, "Intent package name must not be null");
+ return;
+ }
try {
if (ri != null && ri.activityInfo != null && ri.activityInfo.packageName != null) {
final int senderUid = pm.getPackageUidAsUser(senderPackageName,
@@ -265,7 +274,7 @@ public class MusicFxHelper {
+ senderUid + ", package: " + senderPackageName + ", abort");
return false;
}
- if (pkgSessions.mPackageName != senderPackageName) {
+ if (!pkgSessions.mPackageName.equals(senderPackageName)) {
Log.w(TAG, "Inconsistency package names for UID open: " + senderUid + " prev: "
+ pkgSessions.mPackageName + ", now: " + senderPackageName);
return false;
@@ -297,7 +306,7 @@ public class MusicFxHelper {
Log.e(TAG, senderPackageName + " UID " + senderUid + " does not exist in map, abort");
return false;
}
- if (pkgSessions.mPackageName != senderPackageName) {
+ if (!pkgSessions.mPackageName.equals(senderPackageName)) {
Log.w(TAG, "Inconsistency package names for UID " + senderUid + " close, prev: "
+ pkgSessions.mPackageName + ", now: " + senderPackageName);
return false;
diff --git a/services/core/java/com/android/server/audio/SpatializerHelper.java b/services/core/java/com/android/server/audio/SpatializerHelper.java
index 4f7f31dfa7dc..5be2291ff056 100644
--- a/services/core/java/com/android/server/audio/SpatializerHelper.java
+++ b/services/core/java/com/android/server/audio/SpatializerHelper.java
@@ -342,9 +342,6 @@ public class SpatializerHelper {
//------------------------------------------------------
// routing monitoring
synchronized void onRoutingUpdated() {
- if (!mFeatureEnabled) {
- return;
- }
switch (mState) {
case STATE_UNINITIALIZED:
case STATE_NOT_SUPPORTED:
@@ -388,7 +385,7 @@ public class SpatializerHelper {
setDispatchAvailableState(false);
}
- boolean enabled = able && enabledAvailable.first;
+ boolean enabled = mFeatureEnabled && able && enabledAvailable.first;
if (enabled) {
loglogi("Enabling Spatial Audio since enabled for media device:"
+ currentDevice);
diff --git a/services/core/java/com/android/server/locksettings/LockSettingsService.java b/services/core/java/com/android/server/locksettings/LockSettingsService.java
index ba99d2e4a950..54fb65c4e799 100644
--- a/services/core/java/com/android/server/locksettings/LockSettingsService.java
+++ b/services/core/java/com/android/server/locksettings/LockSettingsService.java
@@ -724,12 +724,13 @@ public class LockSettingsService extends ILockSettings.Stub {
!mUserManager.isQuietModeEnabled(userHandle)) {
// Only show notifications for managed profiles once their parent
// user is unlocked.
- showEncryptionNotificationForProfile(userHandle, reason);
+ showEncryptionNotificationForProfile(userHandle, parent.getUserHandle(), reason);
}
}
}
- private void showEncryptionNotificationForProfile(UserHandle user, String reason) {
+ private void showEncryptionNotificationForProfile(UserHandle user, UserHandle parent,
+ String reason) {
CharSequence title = getEncryptionNotificationTitle();
CharSequence message = getEncryptionNotificationMessage();
CharSequence detail = getEncryptionNotificationDetail();
@@ -746,8 +747,15 @@ public class LockSettingsService extends ILockSettings.Stub {
unlockIntent.setFlags(
Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
- PendingIntent intent = PendingIntent.getActivity(mContext, 0, unlockIntent,
- PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_MUTABLE_UNAUDITED);
+ PendingIntent intent;
+ if (android.app.admin.flags.Flags.hsumUnlockNotificationFix()) {
+ intent = PendingIntent.getActivityAsUser(mContext, 0, unlockIntent,
+ PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_MUTABLE_UNAUDITED,
+ null, parent);
+ } else {
+ intent = PendingIntent.getActivity(mContext, 0, unlockIntent,
+ PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_MUTABLE_UNAUDITED);
+ }
Slogf.d(TAG, "Showing encryption notification for user %d; reason: %s",
user.getIdentifier(), reason);
diff --git a/services/core/java/com/android/server/net/NetworkManagementService.java b/services/core/java/com/android/server/net/NetworkManagementService.java
index d25f52973085..5ea3e70f7957 100644
--- a/services/core/java/com/android/server/net/NetworkManagementService.java
+++ b/services/core/java/com/android/server/net/NetworkManagementService.java
@@ -20,6 +20,9 @@ import static android.Manifest.permission.CONNECTIVITY_INTERNAL;
import static android.net.ConnectivityManager.FIREWALL_CHAIN_BACKGROUND;
import static android.net.ConnectivityManager.FIREWALL_CHAIN_DOZABLE;
import static android.net.ConnectivityManager.FIREWALL_CHAIN_LOW_POWER_STANDBY;
+import static android.net.ConnectivityManager.FIREWALL_CHAIN_METERED_ALLOW;
+import static android.net.ConnectivityManager.FIREWALL_CHAIN_METERED_DENY_ADMIN;
+import static android.net.ConnectivityManager.FIREWALL_CHAIN_METERED_DENY_USER;
import static android.net.ConnectivityManager.FIREWALL_CHAIN_POWERSAVE;
import static android.net.ConnectivityManager.FIREWALL_CHAIN_RESTRICTED;
import static android.net.ConnectivityManager.FIREWALL_CHAIN_STANDBY;
@@ -31,6 +34,9 @@ import static android.net.INetd.FIREWALL_RULE_DENY;
import static android.net.NetworkPolicyManager.FIREWALL_CHAIN_NAME_BACKGROUND;
import static android.net.NetworkPolicyManager.FIREWALL_CHAIN_NAME_DOZABLE;
import static android.net.NetworkPolicyManager.FIREWALL_CHAIN_NAME_LOW_POWER_STANDBY;
+import static android.net.NetworkPolicyManager.FIREWALL_CHAIN_NAME_METERED_ALLOW;
+import static android.net.NetworkPolicyManager.FIREWALL_CHAIN_NAME_METERED_DENY_ADMIN;
+import static android.net.NetworkPolicyManager.FIREWALL_CHAIN_NAME_METERED_DENY_USER;
import static android.net.NetworkPolicyManager.FIREWALL_CHAIN_NAME_POWERSAVE;
import static android.net.NetworkPolicyManager.FIREWALL_CHAIN_NAME_RESTRICTED;
import static android.net.NetworkPolicyManager.FIREWALL_CHAIN_NAME_STANDBY;
@@ -143,6 +149,8 @@ public class NetworkManagementService extends INetworkManagementService.Stub {
private final Object mQuotaLock = new Object();
private final Object mRulesLock = new Object();
+ private final boolean mUseMeteredFirewallChains;
+
/** Set of interfaces with active quotas. */
@GuardedBy("mQuotaLock")
private HashMap<String, Long> mActiveQuotas = Maps.newHashMap();
@@ -150,9 +158,11 @@ public class NetworkManagementService extends INetworkManagementService.Stub {
@GuardedBy("mQuotaLock")
private HashMap<String, Long> mActiveAlerts = Maps.newHashMap();
/** Set of UIDs denied on metered networks. */
+ // TODO: b/336693007 - Remove once NPMS has completely migrated to metered firewall chains.
@GuardedBy("mRulesLock")
private SparseBooleanArray mUidRejectOnMetered = new SparseBooleanArray();
/** Set of UIDs allowed on metered networks. */
+ // TODO: b/336693007 - Remove once NPMS has completely migrated to metered firewall chains.
@GuardedBy("mRulesLock")
private SparseBooleanArray mUidAllowOnMetered = new SparseBooleanArray();
/** Set of UIDs with cleartext penalties. */
@@ -196,10 +206,32 @@ public class NetworkManagementService extends INetworkManagementService.Stub {
@GuardedBy("mRulesLock")
private final SparseIntArray mUidFirewallBackgroundRules = new SparseIntArray();
+ /**
+ * Contains the per-UID firewall rules that are used to allowlist the app from metered-network
+ * restrictions when data saver is enabled.
+ */
+ @GuardedBy("mRulesLock")
+ private final SparseIntArray mUidMeteredFirewallAllowRules = new SparseIntArray();
+
+ /**
+ * Contains the per-UID firewall rules that are used to deny app access to metered networks
+ * due to user action.
+ */
+ @GuardedBy("mRulesLock")
+ private final SparseIntArray mUidMeteredFirewallDenyUserRules = new SparseIntArray();
+
+ /**
+ * Contains the per-UID firewall rules that are used to deny app access to metered networks
+ * due to admin action.
+ */
+ @GuardedBy("mRulesLock")
+ private final SparseIntArray mUidMeteredFirewallDenyAdminRules = new SparseIntArray();
+
/** Set of states for the child firewall chains. True if the chain is active. */
@GuardedBy("mRulesLock")
final SparseBooleanArray mFirewallChainStates = new SparseBooleanArray();
+ // TODO: b/336693007 - Remove once NPMS has completely migrated to metered firewall chains.
@GuardedBy("mQuotaLock")
private volatile boolean mDataSaverMode;
@@ -217,6 +249,15 @@ public class NetworkManagementService extends INetworkManagementService.Stub {
mContext = context;
mDeps = deps;
+ mUseMeteredFirewallChains = Flags.useMeteredFirewallChains();
+
+ if (mUseMeteredFirewallChains) {
+ // These firewalls are always on and currently ConnectivityService does not allow
+ // changing their enabled state.
+ mFirewallChainStates.put(FIREWALL_CHAIN_METERED_DENY_USER, true);
+ mFirewallChainStates.put(FIREWALL_CHAIN_METERED_DENY_ADMIN, true);
+ }
+
mDaemonHandler = new Handler(FgThread.get().getLooper());
mNetdUnsolicitedEventListener = new NetdUnsolicitedEventListener();
@@ -410,33 +451,39 @@ public class NetworkManagementService extends INetworkManagementService.Stub {
}
}
- SparseBooleanArray uidRejectOnQuota = null;
- SparseBooleanArray uidAcceptOnQuota = null;
- synchronized (mRulesLock) {
- size = mUidRejectOnMetered.size();
- if (size > 0) {
- if (DBG) Slog.d(TAG, "Pushing " + size + " UIDs to metered denylist rules");
- uidRejectOnQuota = mUidRejectOnMetered;
- mUidRejectOnMetered = new SparseBooleanArray();
- }
+ if (!mUseMeteredFirewallChains) {
+ SparseBooleanArray uidRejectOnQuota = null;
+ SparseBooleanArray uidAcceptOnQuota = null;
+ synchronized (mRulesLock) {
+ size = mUidRejectOnMetered.size();
+ if (size > 0) {
+ if (DBG) {
+ Slog.d(TAG, "Pushing " + size + " UIDs to metered denylist rules");
+ }
+ uidRejectOnQuota = mUidRejectOnMetered;
+ mUidRejectOnMetered = new SparseBooleanArray();
+ }
- size = mUidAllowOnMetered.size();
- if (size > 0) {
- if (DBG) Slog.d(TAG, "Pushing " + size + " UIDs to metered allowlist rules");
- uidAcceptOnQuota = mUidAllowOnMetered;
- mUidAllowOnMetered = new SparseBooleanArray();
+ size = mUidAllowOnMetered.size();
+ if (size > 0) {
+ if (DBG) {
+ Slog.d(TAG, "Pushing " + size + " UIDs to metered allowlist rules");
+ }
+ uidAcceptOnQuota = mUidAllowOnMetered;
+ mUidAllowOnMetered = new SparseBooleanArray();
+ }
}
- }
- if (uidRejectOnQuota != null) {
- for (int i = 0; i < uidRejectOnQuota.size(); i++) {
- setUidOnMeteredNetworkDenylist(uidRejectOnQuota.keyAt(i),
- uidRejectOnQuota.valueAt(i));
+ if (uidRejectOnQuota != null) {
+ for (int i = 0; i < uidRejectOnQuota.size(); i++) {
+ setUidOnMeteredNetworkDenylist(uidRejectOnQuota.keyAt(i),
+ uidRejectOnQuota.valueAt(i));
+ }
}
- }
- if (uidAcceptOnQuota != null) {
- for (int i = 0; i < uidAcceptOnQuota.size(); i++) {
- setUidOnMeteredNetworkAllowlist(uidAcceptOnQuota.keyAt(i),
- uidAcceptOnQuota.valueAt(i));
+ if (uidAcceptOnQuota != null) {
+ for (int i = 0; i < uidAcceptOnQuota.size(); i++) {
+ setUidOnMeteredNetworkAllowlist(uidAcceptOnQuota.keyAt(i),
+ uidAcceptOnQuota.valueAt(i));
+ }
}
}
@@ -459,8 +506,16 @@ public class NetworkManagementService extends INetworkManagementService.Stub {
syncFirewallChainLocked(FIREWALL_CHAIN_RESTRICTED, "restricted ");
syncFirewallChainLocked(FIREWALL_CHAIN_LOW_POWER_STANDBY, "low power standby ");
syncFirewallChainLocked(FIREWALL_CHAIN_BACKGROUND, FIREWALL_CHAIN_NAME_BACKGROUND);
+ if (mUseMeteredFirewallChains) {
+ syncFirewallChainLocked(FIREWALL_CHAIN_METERED_ALLOW,
+ FIREWALL_CHAIN_NAME_METERED_ALLOW);
+ syncFirewallChainLocked(FIREWALL_CHAIN_METERED_DENY_USER,
+ FIREWALL_CHAIN_NAME_METERED_DENY_USER);
+ syncFirewallChainLocked(FIREWALL_CHAIN_METERED_DENY_ADMIN,
+ FIREWALL_CHAIN_NAME_METERED_DENY_ADMIN);
+ }
- final int[] chains = {
+ final int[] chainsToEnable = {
FIREWALL_CHAIN_STANDBY,
FIREWALL_CHAIN_DOZABLE,
FIREWALL_CHAIN_POWERSAVE,
@@ -469,14 +524,13 @@ public class NetworkManagementService extends INetworkManagementService.Stub {
FIREWALL_CHAIN_BACKGROUND,
};
- for (int chain : chains) {
+ for (int chain : chainsToEnable) {
if (getFirewallChainState(chain)) {
setFirewallChainEnabled(chain, true);
}
}
}
-
try {
getBatteryStats().noteNetworkStatsEnabled();
} catch (RemoteException e) {
@@ -1077,6 +1131,14 @@ public class NetworkManagementService extends INetworkManagementService.Stub {
mContext.getSystemService(ConnectivityManager.class)
.setDataSaverEnabled(enable);
mDataSaverMode = enable;
+ if (mUseMeteredFirewallChains) {
+ // Copy mDataSaverMode state to FIREWALL_CHAIN_METERED_ALLOW
+ // until ConnectivityService allows manipulation of the data saver mode via
+ // FIREWALL_CHAIN_METERED_ALLOW.
+ synchronized (mRulesLock) {
+ mFirewallChainStates.put(FIREWALL_CHAIN_METERED_ALLOW, enable);
+ }
+ }
return true;
} else {
final boolean changed = mNetdService.bandwidthEnableDataSaver(enable);
@@ -1191,9 +1253,9 @@ public class NetworkManagementService extends INetworkManagementService.Stub {
setFirewallChainState(chain, enable);
}
- final String chainName = getFirewallChainName(chain);
- if (chain == FIREWALL_CHAIN_NONE) {
- throw new IllegalArgumentException("Bad child chain: " + chainName);
+ if (!isValidFirewallChainForSetEnabled(chain)) {
+ throw new IllegalArgumentException("Invalid chain for setFirewallChainEnabled: "
+ + NetworkPolicyLogger.getFirewallChainName(chain));
}
final ConnectivityManager cm = mContext.getSystemService(ConnectivityManager.class);
@@ -1205,38 +1267,29 @@ public class NetworkManagementService extends INetworkManagementService.Stub {
}
}
- private String getFirewallChainName(int chain) {
- switch (chain) {
- case FIREWALL_CHAIN_STANDBY:
- return FIREWALL_CHAIN_NAME_STANDBY;
- case FIREWALL_CHAIN_DOZABLE:
- return FIREWALL_CHAIN_NAME_DOZABLE;
- case FIREWALL_CHAIN_POWERSAVE:
- return FIREWALL_CHAIN_NAME_POWERSAVE;
- case FIREWALL_CHAIN_RESTRICTED:
- return FIREWALL_CHAIN_NAME_RESTRICTED;
- case FIREWALL_CHAIN_LOW_POWER_STANDBY:
- return FIREWALL_CHAIN_NAME_LOW_POWER_STANDBY;
- case FIREWALL_CHAIN_BACKGROUND:
- return FIREWALL_CHAIN_NAME_BACKGROUND;
- default:
- throw new IllegalArgumentException("Bad child chain: " + chain);
- }
+ private boolean isValidFirewallChainForSetEnabled(int chain) {
+ return switch (chain) {
+ case FIREWALL_CHAIN_STANDBY, FIREWALL_CHAIN_DOZABLE, FIREWALL_CHAIN_POWERSAVE,
+ FIREWALL_CHAIN_RESTRICTED, FIREWALL_CHAIN_LOW_POWER_STANDBY,
+ FIREWALL_CHAIN_BACKGROUND -> true;
+ // METERED_* firewall chains are not yet supported by
+ // ConnectivityService#setFirewallChainEnabled.
+ default -> false;
+ };
}
private int getFirewallType(int chain) {
switch (chain) {
case FIREWALL_CHAIN_STANDBY:
+ case FIREWALL_CHAIN_METERED_DENY_ADMIN:
+ case FIREWALL_CHAIN_METERED_DENY_USER:
return FIREWALL_DENYLIST;
case FIREWALL_CHAIN_DOZABLE:
- return FIREWALL_ALLOWLIST;
case FIREWALL_CHAIN_POWERSAVE:
- return FIREWALL_ALLOWLIST;
case FIREWALL_CHAIN_RESTRICTED:
- return FIREWALL_ALLOWLIST;
case FIREWALL_CHAIN_LOW_POWER_STANDBY:
- return FIREWALL_ALLOWLIST;
case FIREWALL_CHAIN_BACKGROUND:
+ case FIREWALL_CHAIN_METERED_ALLOW:
return FIREWALL_ALLOWLIST;
default:
return isFirewallEnabled() ? FIREWALL_ALLOWLIST : FIREWALL_DENYLIST;
@@ -1360,6 +1413,12 @@ public class NetworkManagementService extends INetworkManagementService.Stub {
return mUidFirewallLowPowerStandbyRules;
case FIREWALL_CHAIN_BACKGROUND:
return mUidFirewallBackgroundRules;
+ case FIREWALL_CHAIN_METERED_ALLOW:
+ return mUidMeteredFirewallAllowRules;
+ case FIREWALL_CHAIN_METERED_DENY_USER:
+ return mUidMeteredFirewallDenyUserRules;
+ case FIREWALL_CHAIN_METERED_DENY_ADMIN:
+ return mUidMeteredFirewallDenyAdminRules;
case FIREWALL_CHAIN_NONE:
return mUidFirewallRules;
default:
@@ -1378,6 +1437,10 @@ public class NetworkManagementService extends INetworkManagementService.Stub {
protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
if (!DumpUtils.checkDumpPermission(mContext, TAG, pw)) return;
+ pw.println("Flags:");
+ pw.println(Flags.FLAG_USE_METERED_FIREWALL_CHAINS + ": " + mUseMeteredFirewallChains);
+ pw.println();
+
synchronized (mQuotaLock) {
pw.print("Active quota ifaces: "); pw.println(mActiveQuotas.toString());
pw.print("Active alert ifaces: "); pw.println(mActiveAlerts.toString());
@@ -1416,6 +1479,27 @@ public class NetworkManagementService extends INetworkManagementService.Stub {
pw.print("UID firewall background chain enabled: ");
pw.println(getFirewallChainState(FIREWALL_CHAIN_BACKGROUND));
dumpUidFirewallRule(pw, FIREWALL_CHAIN_NAME_BACKGROUND, mUidFirewallBackgroundRules);
+
+ pw.print("UID firewall metered allow chain enabled (Data saver mode): ");
+ // getFirewallChainState should maintain a duplicated state from mDataSaverMode when
+ // mUseMeteredFirewallChains is enabled.
+ pw.println(getFirewallChainState(FIREWALL_CHAIN_METERED_ALLOW));
+ dumpUidFirewallRule(pw, FIREWALL_CHAIN_NAME_METERED_ALLOW,
+ mUidMeteredFirewallAllowRules);
+
+ pw.print("UID firewall metered deny_user chain enabled (always-on): ");
+ // This always-on state should be reflected by getFirewallChainState when
+ // mUseMeteredFirewallChains is enabled.
+ pw.println(getFirewallChainState(FIREWALL_CHAIN_METERED_DENY_USER));
+ dumpUidFirewallRule(pw, FIREWALL_CHAIN_NAME_METERED_DENY_USER,
+ mUidMeteredFirewallDenyUserRules);
+
+ pw.print("UID firewall metered deny_admin chain enabled (always-on): ");
+ // This always-on state should be reflected by getFirewallChainState when
+ // mUseMeteredFirewallChains is enabled.
+ pw.println(getFirewallChainState(FIREWALL_CHAIN_METERED_DENY_ADMIN));
+ dumpUidFirewallRule(pw, FIREWALL_CHAIN_NAME_METERED_DENY_ADMIN,
+ mUidMeteredFirewallDenyAdminRules);
}
pw.print("Firewall enabled: "); pw.println(mFirewallEnabled);
@@ -1520,14 +1604,40 @@ public class NetworkManagementService extends INetworkManagementService.Stub {
if (DBG) Slog.d(TAG, "Uid " + uid + " restricted because it is in background");
return true;
}
- if (mUidRejectOnMetered.get(uid)) {
- if (DBG) Slog.d(TAG, "Uid " + uid + " restricted because of no metered data"
- + " in the background");
- return true;
- }
- if (mDataSaverMode && !mUidAllowOnMetered.get(uid)) {
- if (DBG) Slog.d(TAG, "Uid " + uid + " restricted because of data saver mode");
- return true;
+ if (mUseMeteredFirewallChains) {
+ if (getFirewallChainState(FIREWALL_CHAIN_METERED_DENY_USER)
+ && mUidMeteredFirewallDenyUserRules.get(uid) == FIREWALL_RULE_DENY) {
+ if (DBG) {
+ Slog.d(TAG, "Uid " + uid + " restricted because of user-restricted metered"
+ + " data in the background");
+ }
+ return true;
+ }
+ if (getFirewallChainState(FIREWALL_CHAIN_METERED_DENY_ADMIN)
+ && mUidMeteredFirewallDenyAdminRules.get(uid) == FIREWALL_RULE_DENY) {
+ if (DBG) {
+ Slog.d(TAG, "Uid " + uid + " restricted because of admin-restricted metered"
+ + " data in the background");
+ }
+ return true;
+ }
+ if (getFirewallChainState(FIREWALL_CHAIN_METERED_ALLOW)
+ && mUidMeteredFirewallAllowRules.get(uid) != FIREWALL_RULE_ALLOW) {
+ if (DBG) Slog.d(TAG, "Uid " + uid + " restricted because of data saver mode");
+ return true;
+ }
+ } else {
+ if (mUidRejectOnMetered.get(uid)) {
+ if (DBG) {
+ Slog.d(TAG, "Uid " + uid
+ + " restricted because of no metered data in the background");
+ }
+ return true;
+ }
+ if (mDataSaverMode && !mUidAllowOnMetered.get(uid)) {
+ if (DBG) Slog.d(TAG, "Uid " + uid + " restricted because of data saver mode");
+ return true;
+ }
}
return false;
}
diff --git a/services/core/java/com/android/server/net/NetworkPolicyLogger.java b/services/core/java/com/android/server/net/NetworkPolicyLogger.java
index 8e2d7780204a..681aa8aef219 100644
--- a/services/core/java/com/android/server/net/NetworkPolicyLogger.java
+++ b/services/core/java/com/android/server/net/NetworkPolicyLogger.java
@@ -19,6 +19,9 @@ import static android.net.ConnectivityManager.BLOCKED_REASON_NONE;
import static android.net.ConnectivityManager.FIREWALL_CHAIN_BACKGROUND;
import static android.net.ConnectivityManager.FIREWALL_CHAIN_DOZABLE;
import static android.net.ConnectivityManager.FIREWALL_CHAIN_LOW_POWER_STANDBY;
+import static android.net.ConnectivityManager.FIREWALL_CHAIN_METERED_ALLOW;
+import static android.net.ConnectivityManager.FIREWALL_CHAIN_METERED_DENY_ADMIN;
+import static android.net.ConnectivityManager.FIREWALL_CHAIN_METERED_DENY_USER;
import static android.net.ConnectivityManager.FIREWALL_CHAIN_POWERSAVE;
import static android.net.ConnectivityManager.FIREWALL_CHAIN_RESTRICTED;
import static android.net.ConnectivityManager.FIREWALL_CHAIN_STANDBY;
@@ -28,6 +31,9 @@ import static android.net.NetworkPolicyManager.ALLOWED_REASON_NONE;
import static android.net.NetworkPolicyManager.FIREWALL_CHAIN_NAME_BACKGROUND;
import static android.net.NetworkPolicyManager.FIREWALL_CHAIN_NAME_DOZABLE;
import static android.net.NetworkPolicyManager.FIREWALL_CHAIN_NAME_LOW_POWER_STANDBY;
+import static android.net.NetworkPolicyManager.FIREWALL_CHAIN_NAME_METERED_ALLOW;
+import static android.net.NetworkPolicyManager.FIREWALL_CHAIN_NAME_METERED_DENY_ADMIN;
+import static android.net.NetworkPolicyManager.FIREWALL_CHAIN_NAME_METERED_DENY_USER;
import static android.net.NetworkPolicyManager.FIREWALL_CHAIN_NAME_POWERSAVE;
import static android.net.NetworkPolicyManager.FIREWALL_CHAIN_NAME_RESTRICTED;
import static android.net.NetworkPolicyManager.FIREWALL_CHAIN_NAME_STANDBY;
@@ -379,7 +385,7 @@ public class NetworkPolicyLogger {
return "Interfaces of netId=" + netId + " changed to " + newIfaces;
}
- private static String getFirewallChainName(int chain) {
+ static String getFirewallChainName(int chain) {
switch (chain) {
case FIREWALL_CHAIN_DOZABLE:
return FIREWALL_CHAIN_NAME_DOZABLE;
@@ -393,6 +399,12 @@ public class NetworkPolicyLogger {
return FIREWALL_CHAIN_NAME_LOW_POWER_STANDBY;
case FIREWALL_CHAIN_BACKGROUND:
return FIREWALL_CHAIN_NAME_BACKGROUND;
+ case FIREWALL_CHAIN_METERED_ALLOW:
+ return FIREWALL_CHAIN_NAME_METERED_ALLOW;
+ case FIREWALL_CHAIN_METERED_DENY_USER:
+ return FIREWALL_CHAIN_NAME_METERED_DENY_USER;
+ case FIREWALL_CHAIN_METERED_DENY_ADMIN:
+ return FIREWALL_CHAIN_NAME_METERED_DENY_ADMIN;
default:
return String.valueOf(chain);
}
diff --git a/services/core/java/com/android/server/net/NetworkPolicyManagerService.java b/services/core/java/com/android/server/net/NetworkPolicyManagerService.java
index c6fca9b76f8e..a26ac615ba40 100644
--- a/services/core/java/com/android/server/net/NetworkPolicyManagerService.java
+++ b/services/core/java/com/android/server/net/NetworkPolicyManagerService.java
@@ -60,6 +60,9 @@ import static android.net.ConnectivityManager.CONNECTIVITY_ACTION;
import static android.net.ConnectivityManager.FIREWALL_CHAIN_BACKGROUND;
import static android.net.ConnectivityManager.FIREWALL_CHAIN_DOZABLE;
import static android.net.ConnectivityManager.FIREWALL_CHAIN_LOW_POWER_STANDBY;
+import static android.net.ConnectivityManager.FIREWALL_CHAIN_METERED_ALLOW;
+import static android.net.ConnectivityManager.FIREWALL_CHAIN_METERED_DENY_ADMIN;
+import static android.net.ConnectivityManager.FIREWALL_CHAIN_METERED_DENY_USER;
import static android.net.ConnectivityManager.FIREWALL_CHAIN_POWERSAVE;
import static android.net.ConnectivityManager.FIREWALL_CHAIN_RESTRICTED;
import static android.net.ConnectivityManager.FIREWALL_CHAIN_STANDBY;
@@ -514,6 +517,12 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub {
*/
private boolean mBackgroundNetworkRestricted;
+ /**
+ * Whether or not metered firewall chains should be used for uid policy controlling access to
+ * metered networks.
+ */
+ private boolean mUseMeteredFirewallChains;
+
// See main javadoc for instructions on how to use these locks.
final Object mUidRulesFirstLock = new Object();
final Object mNetworkPoliciesSecondLock = new Object();
@@ -997,6 +1006,8 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub {
mAppStandby = LocalServices.getService(AppStandbyInternal.class);
mActivityManagerInternal = LocalServices.getService(ActivityManagerInternal.class);
+ mUseMeteredFirewallChains = Flags.useMeteredFirewallChains();
+
synchronized (mUidRulesFirstLock) {
synchronized (mNetworkPoliciesSecondLock) {
updatePowerSaveAllowlistUL();
@@ -4030,8 +4041,10 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub {
fout.println();
fout.println("Flags:");
- fout.println("Network blocked for TOP_SLEEPING and above: "
+ fout.println(Flags.FLAG_NETWORK_BLOCKED_FOR_TOP_SLEEPING_AND_ABOVE + ": "
+ mBackgroundNetworkRestricted);
+ fout.println(Flags.FLAG_USE_METERED_FIREWALL_CHAINS + ": "
+ + mUseMeteredFirewallChains);
fout.println();
fout.println("mRestrictBackgroundLowPowerMode: " + mRestrictBackgroundLowPowerMode);
@@ -5367,23 +5380,44 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub {
postUidRulesChangedMsg(uid, uidRules);
}
- // Note that the conditionals below are for avoiding unnecessary calls to netd.
- // TODO: Measure the performance for doing a no-op call to netd so that we can
- // remove the conditionals to simplify the logic below. We can also further reduce
- // some calls to netd if they turn out to be costly.
- final int denylistReasons = BLOCKED_METERED_REASON_ADMIN_DISABLED
- | BLOCKED_METERED_REASON_USER_RESTRICTED;
- if ((oldEffectiveBlockedReasons & denylistReasons) != BLOCKED_REASON_NONE
- || (newEffectiveBlockedReasons & denylistReasons) != BLOCKED_REASON_NONE) {
- setMeteredNetworkDenylist(uid,
- (newEffectiveBlockedReasons & denylistReasons) != BLOCKED_REASON_NONE);
- }
- final int allowlistReasons = ALLOWED_METERED_REASON_FOREGROUND
- | ALLOWED_METERED_REASON_USER_EXEMPTED;
- if ((oldAllowedReasons & allowlistReasons) != ALLOWED_REASON_NONE
- || (newAllowedReasons & allowlistReasons) != ALLOWED_REASON_NONE) {
- setMeteredNetworkAllowlist(uid,
- (newAllowedReasons & allowlistReasons) != ALLOWED_REASON_NONE);
+ if (mUseMeteredFirewallChains) {
+ if ((newEffectiveBlockedReasons & BLOCKED_METERED_REASON_ADMIN_DISABLED)
+ != BLOCKED_REASON_NONE) {
+ setUidFirewallRuleUL(FIREWALL_CHAIN_METERED_DENY_ADMIN, uid, FIREWALL_RULE_DENY);
+ } else {
+ setUidFirewallRuleUL(FIREWALL_CHAIN_METERED_DENY_ADMIN, uid, FIREWALL_RULE_DEFAULT);
+ }
+ if ((newEffectiveBlockedReasons & BLOCKED_METERED_REASON_USER_RESTRICTED)
+ != BLOCKED_REASON_NONE) {
+ setUidFirewallRuleUL(FIREWALL_CHAIN_METERED_DENY_USER, uid, FIREWALL_RULE_DENY);
+ } else {
+ setUidFirewallRuleUL(FIREWALL_CHAIN_METERED_DENY_USER, uid, FIREWALL_RULE_DEFAULT);
+ }
+ if ((newAllowedReasons & (ALLOWED_METERED_REASON_FOREGROUND
+ | ALLOWED_METERED_REASON_USER_EXEMPTED)) != ALLOWED_REASON_NONE) {
+ setUidFirewallRuleUL(FIREWALL_CHAIN_METERED_ALLOW, uid, FIREWALL_RULE_ALLOW);
+ } else {
+ setUidFirewallRuleUL(FIREWALL_CHAIN_METERED_ALLOW, uid, FIREWALL_RULE_DEFAULT);
+ }
+ } else {
+ // Note that the conditionals below are for avoiding unnecessary calls to netd.
+ // TODO: Measure the performance for doing a no-op call to netd so that we can
+ // remove the conditionals to simplify the logic below. We can also further reduce
+ // some calls to netd if they turn out to be costly.
+ final int denylistReasons = BLOCKED_METERED_REASON_ADMIN_DISABLED
+ | BLOCKED_METERED_REASON_USER_RESTRICTED;
+ if ((oldEffectiveBlockedReasons & denylistReasons) != BLOCKED_REASON_NONE
+ || (newEffectiveBlockedReasons & denylistReasons) != BLOCKED_REASON_NONE) {
+ setMeteredNetworkDenylist(uid,
+ (newEffectiveBlockedReasons & denylistReasons) != BLOCKED_REASON_NONE);
+ }
+ final int allowlistReasons = ALLOWED_METERED_REASON_FOREGROUND
+ | ALLOWED_METERED_REASON_USER_EXEMPTED;
+ if ((oldAllowedReasons & allowlistReasons) != ALLOWED_REASON_NONE
+ || (newAllowedReasons & allowlistReasons) != ALLOWED_REASON_NONE) {
+ setMeteredNetworkAllowlist(uid,
+ (newAllowedReasons & allowlistReasons) != ALLOWED_REASON_NONE);
+ }
}
}
@@ -6143,6 +6177,8 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub {
} else if (chain == FIREWALL_CHAIN_BACKGROUND) {
mUidFirewallBackgroundRules.put(uid, rule);
}
+ // Note that we do not need keep a separate cache of uid rules for chains that we do
+ // not call #setUidFirewallRulesUL for.
try {
mNetworkManager.setFirewallUidRule(chain, uid, rule);
@@ -6200,10 +6236,19 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub {
FIREWALL_RULE_DEFAULT);
mNetworkManager.setFirewallUidRule(FIREWALL_CHAIN_BACKGROUND, uid,
FIREWALL_RULE_DEFAULT);
- mNetworkManager.setUidOnMeteredNetworkAllowlist(uid, false);
- mLogger.meteredAllowlistChanged(uid, false);
- mNetworkManager.setUidOnMeteredNetworkDenylist(uid, false);
- mLogger.meteredDenylistChanged(uid, false);
+ if (mUseMeteredFirewallChains) {
+ mNetworkManager.setFirewallUidRule(FIREWALL_CHAIN_METERED_DENY_ADMIN, uid,
+ FIREWALL_RULE_DEFAULT);
+ mNetworkManager.setFirewallUidRule(FIREWALL_CHAIN_METERED_DENY_USER, uid,
+ FIREWALL_RULE_DEFAULT);
+ mNetworkManager.setFirewallUidRule(FIREWALL_CHAIN_METERED_ALLOW, uid,
+ FIREWALL_RULE_DEFAULT);
+ } else {
+ mNetworkManager.setUidOnMeteredNetworkAllowlist(uid, false);
+ mLogger.meteredAllowlistChanged(uid, false);
+ mNetworkManager.setUidOnMeteredNetworkDenylist(uid, false);
+ mLogger.meteredDenylistChanged(uid, false);
+ }
} catch (IllegalStateException e) {
Log.wtf(TAG, "problem resetting firewall uid rules for " + uid, e);
} catch (RemoteException e) {
diff --git a/services/core/java/com/android/server/net/flags.aconfig b/services/core/java/com/android/server/net/flags.aconfig
index d9491de52d87..e986dd81b94b 100644
--- a/services/core/java/com/android/server/net/flags.aconfig
+++ b/services/core/java/com/android/server/net/flags.aconfig
@@ -7,3 +7,13 @@ flag {
description: "Block network access for apps in a low importance background state"
bug: "304347838"
}
+
+flag {
+ name: "use_metered_firewall_chains"
+ namespace: "backstage_power"
+ description: "Use metered firewall chains to control access to metered networks"
+ bug: "336693007"
+ metadata {
+ purpose: PURPOSE_BUGFIX
+ }
+}
diff --git a/services/core/java/com/android/server/pm/AppDataHelper.java b/services/core/java/com/android/server/pm/AppDataHelper.java
index 79d17534ab26..348452e8f097 100644
--- a/services/core/java/com/android/server/pm/AppDataHelper.java
+++ b/services/core/java/com/android/server/pm/AppDataHelper.java
@@ -534,9 +534,12 @@ public class AppDataHelper {
} else {
storageFlags = StorageManager.FLAG_STORAGE_DE | StorageManager.FLAG_STORAGE_CE;
}
- List<String> deferPackages = reconcileAppsDataLI(StorageManager.UUID_PRIVATE_INTERNAL,
- UserHandle.USER_SYSTEM, storageFlags, true /* migrateAppData */,
- true /* onlyCoreApps */);
+ final List<String> deferPackages;
+ synchronized (mPm.mInstallLock) {
+ deferPackages = reconcileAppsDataLI(StorageManager.UUID_PRIVATE_INTERNAL,
+ UserHandle.USER_SYSTEM, storageFlags, true /* migrateAppData */,
+ true /* onlyCoreApps */);
+ }
Future<?> prepareAppDataFuture = SystemServerInitThreadPool.submit(() -> {
TimingsTraceLog traceLog = new TimingsTraceLog("SystemServerTimingAsync",
Trace.TRACE_TAG_PACKAGE_MANAGER);
diff --git a/services/core/java/com/android/server/rollback/RollbackPackageHealthObserver.java b/services/core/java/com/android/server/rollback/RollbackPackageHealthObserver.java
index 93f26aefb692..c85ceac9ea55 100644
--- a/services/core/java/com/android/server/rollback/RollbackPackageHealthObserver.java
+++ b/services/core/java/com/android/server/rollback/RollbackPackageHealthObserver.java
@@ -642,6 +642,8 @@ public final class RollbackPackageHealthObserver implements PackageHealthObserve
.getPackages()
.get(0)
.getVersionRolledBackFrom();
+ Slog.i(TAG, "Rolling back high impact rollback for package: "
+ + firstRollback.getPackageName());
rollbackPackage(sortedHighImpactRollbacks.get(0), firstRollback, rollbackReason);
}
diff --git a/services/core/java/com/android/server/rollback/WatchdogRollbackLogger.java b/services/core/java/com/android/server/rollback/WatchdogRollbackLogger.java
index 519c0edfc532..7fc02923bfed 100644
--- a/services/core/java/com/android/server/rollback/WatchdogRollbackLogger.java
+++ b/services/core/java/com/android/server/rollback/WatchdogRollbackLogger.java
@@ -293,6 +293,8 @@ public final class WatchdogRollbackLogger {
return "REASON_APP_NOT_RESPONDING";
case WATCHDOG_ROLLBACK_OCCURRED__ROLLBACK_REASON__REASON_NATIVE_CRASH_DURING_BOOT:
return "REASON_NATIVE_CRASH_DURING_BOOT";
+ case WATCHDOG_ROLLBACK_OCCURRED__ROLLBACK_REASON__REASON_BOOT_LOOPING:
+ return "REASON_BOOT_LOOP";
default:
return "UNKNOWN";
}
diff --git a/services/core/java/com/android/server/wm/ActivityStarter.java b/services/core/java/com/android/server/wm/ActivityStarter.java
index 4b0177a36ebe..f249cb099f67 100644
--- a/services/core/java/com/android/server/wm/ActivityStarter.java
+++ b/services/core/java/com/android/server/wm/ActivityStarter.java
@@ -2643,7 +2643,7 @@ class ActivityStarter {
// If a target task is specified, try to reuse that one
if (mOptions != null && mOptions.getLaunchTaskId() != INVALID_TASK_ID) {
Task launchTask = mRootWindowContainer.anyTaskForId(mOptions.getLaunchTaskId());
- if (launchTask != null) {
+ if (launchTask != null && launchTask.isLeafTask()) {
return launchTask;
}
return null;
diff --git a/services/core/java/com/android/server/wm/OWNERS b/services/core/java/com/android/server/wm/OWNERS
index ce47f5cc8a7e..60454fc5d7c6 100644
--- a/services/core/java/com/android/server/wm/OWNERS
+++ b/services/core/java/com/android/server/wm/OWNERS
@@ -18,6 +18,7 @@ rgl@google.com
yunfanc@google.com
wilsonshih@google.com
jiamingliu@google.com
+pdwilliams@google.com
# Files related to background activity launches
per-file Background*Start* = set noparent
diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/NonRequiredPackageDeleteObserver.java b/services/devicepolicy/java/com/android/server/devicepolicy/NonRequiredPackageDeleteObserver.java
index 0e448cdb244c..a1bf0401d001 100644
--- a/services/devicepolicy/java/com/android/server/devicepolicy/NonRequiredPackageDeleteObserver.java
+++ b/services/devicepolicy/java/com/android/server/devicepolicy/NonRequiredPackageDeleteObserver.java
@@ -25,7 +25,6 @@ import android.util.Slog;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicInteger;
/**
* Awaits the deletion of all the non-required apps.
@@ -33,38 +32,38 @@ import java.util.concurrent.atomic.AtomicInteger;
final class NonRequiredPackageDeleteObserver extends IPackageDeleteObserver.Stub {
private static final int PACKAGE_DELETE_TIMEOUT_SEC = 30;
- private final AtomicInteger mPackageCount = new AtomicInteger(/* initialValue= */ 0);
private final CountDownLatch mLatch;
- private boolean mSuccess;
+ private boolean mFailed = false;
NonRequiredPackageDeleteObserver(int packageCount) {
this.mLatch = new CountDownLatch(packageCount);
- this.mPackageCount.set(packageCount);
}
@Override
public void packageDeleted(String packageName, int returnCode) {
if (returnCode != PackageManager.DELETE_SUCCEEDED) {
Slog.e(LOG_TAG, "Failed to delete package: " + packageName);
- mLatch.notifyAll();
- return;
- }
- int currentPackageCount = mPackageCount.decrementAndGet();
- if (currentPackageCount == 0) {
- mSuccess = true;
- Slog.i(LOG_TAG, "All non-required system apps with launcher icon, "
- + "and all disallowed apps have been uninstalled.");
+ mFailed = true;
}
mLatch.countDown();
}
public boolean awaitPackagesDeletion() {
try {
- mLatch.await(PACKAGE_DELETE_TIMEOUT_SEC, TimeUnit.SECONDS);
+ if (mLatch.await(PACKAGE_DELETE_TIMEOUT_SEC, TimeUnit.SECONDS)) {
+ if (!mFailed) {
+ Slog.i(LOG_TAG, "All non-required system apps with launcher icon, "
+ + "and all disallowed apps have been uninstalled.");
+ }
+ return !mFailed;
+ } else {
+ Slog.i(LOG_TAG, "Waiting time elapsed before all package deletion finished");
+ return false;
+ }
} catch (InterruptedException e) {
Log.w(LOG_TAG, "Interrupted while waiting for package deletion", e);
Thread.currentThread().interrupt();
+ return false;
}
- return mSuccess;
}
}
diff --git a/services/permission/java/com/android/server/permission/access/permission/PermissionService.kt b/services/permission/java/com/android/server/permission/access/permission/PermissionService.kt
index f469ab547763..33d3cd0358c8 100644
--- a/services/permission/java/com/android/server/permission/access/permission/PermissionService.kt
+++ b/services/permission/java/com/android/server/permission/access/permission/PermissionService.kt
@@ -2077,8 +2077,20 @@ class PermissionService(private val service: AccessCheckingService) :
writer.println("Unknown app ID $appId.")
}
}
+ } else if (args[0] == "--package" && args.size == 2) {
+ val packageName = args[1]
+ service.getState {
+ val packageState = state.externalState.packageStates[packageName]
+ if (packageState != null) {
+ writer.dumpAppIdState(packageState.appId, state, indexedSetOf(packageName))
+ } else {
+ writer.println("Unknown package $packageName.")
+ }
+ }
} else {
- writer.println("Usage: dumpsys permission [--app-id APP_ID]")
+ writer.println(
+ "Usage: dumpsys permissionmgr [--app-id <APP_ID>] [--package <PACKAGE_NAME>]"
+ )
}
}
diff --git a/services/profcollect/src/com/android/server/profcollect/ProfcollectForwardingService.java b/services/profcollect/src/com/android/server/profcollect/ProfcollectForwardingService.java
index 622e70279700..488fe57cf6f8 100644
--- a/services/profcollect/src/com/android/server/profcollect/ProfcollectForwardingService.java
+++ b/services/profcollect/src/com/android/server/profcollect/ProfcollectForwardingService.java
@@ -63,6 +63,9 @@ public final class ProfcollectForwardingService extends SystemService {
"com.android.server.profcollect.UPLOAD_PROFILES";
private static final long BG_PROCESS_INTERVAL = TimeUnit.HOURS.toMillis(4); // every 4 hours.
+ private int mUsageSetting;
+ private boolean mUploadEnabled;
+
private IProfCollectd mIProfcollect;
private static ProfcollectForwardingService sSelfService;
private final Handler mHandler = new ProfcollectdHandler(IoThread.getHandler().getLooper());
@@ -78,7 +81,7 @@ public final class ProfcollectForwardingService extends SystemService {
public void onReceive(Context context, Intent intent) {
if (INTENT_UPLOAD_PROFILES.equals(intent.getAction())) {
Log.d(LOG_TAG, "Received broadcast to pack and upload reports");
- packAndUploadReport();
+ createAndUploadReport(sSelfService);
}
}
};
@@ -91,6 +94,17 @@ public final class ProfcollectForwardingService extends SystemService {
}
sSelfService = this;
+ // Get "Usage & diagnostics" checkbox status. 1 is for enabled, 0 is for disabled.
+ try {
+ mUsageSetting = Settings.Global.getInt(context.getContentResolver(), "multi_cb");
+ } catch (SettingNotFoundException e) {
+ Log.e(LOG_TAG, "Usage setting not found: " + e.getMessage());
+ mUsageSetting = -1;
+ }
+
+ mUploadEnabled =
+ context.getResources().getBoolean(R.bool.config_profcollectReportUploaderEnabled);
+
final IntentFilter filter = new IntentFilter();
filter.addAction(INTENT_UPLOAD_PROFILES);
context.registerReceiver(mBroadcastReceiver, filter, Context.RECEIVER_NOT_EXPORTED);
@@ -221,7 +235,6 @@ public final class ProfcollectForwardingService extends SystemService {
*/
public static void schedule(Context context) {
JobScheduler js = context.getSystemService(JobScheduler.class);
-
js.schedule(new JobInfo.Builder(JOB_IDLE_PROCESS, JOB_SERVICE_NAME)
.setRequiresDeviceIdle(true)
.setRequiresCharging(true)
@@ -235,20 +248,8 @@ public final class ProfcollectForwardingService extends SystemService {
if (DEBUG) {
Log.d(LOG_TAG, "Starting background process job");
}
-
- BackgroundThread.get().getThreadHandler().post(
- () -> {
- try {
- if (sSelfService.mIProfcollect == null) {
- return;
- }
- sSelfService.mIProfcollect.process();
- jobFinished(params, false);
- } catch (RemoteException e) {
- Log.e(LOG_TAG, "Failed to process profiles in background: "
- + e.getMessage());
- }
- });
+ createAndUploadReport(sSelfService);
+ jobFinished(params, false);
return true;
}
@@ -357,7 +358,7 @@ public final class ProfcollectForwardingService extends SystemService {
}
if (status == UpdateEngine.UpdateStatusConstants.UPDATED_NEED_REBOOT) {
- packAndUploadReport();
+ createAndUploadReport(sSelfService);
}
}
@@ -368,41 +369,27 @@ public final class ProfcollectForwardingService extends SystemService {
});
}
- private void packAndUploadReport() {
- if (mIProfcollect == null) {
+ private static void createAndUploadReport(ProfcollectForwardingService pfs) {
+ String reportName;
+ try {
+ reportName = pfs.mIProfcollect.report(pfs.mUsageSetting) + ".zip";
+ } catch (RemoteException e) {
+ Log.e(LOG_TAG, "Failed to create report: " + e.getMessage());
+ return;
+ }
+ if (!pfs.mUploadEnabled) {
+ Log.i(LOG_TAG, "Upload is not enabled.");
return;
}
-
- Context context = getContext();
BackgroundThread.get().getThreadHandler().post(() -> {
- try {
- int usageSetting = -1;
- try {
- // Get "Usage & diagnostics" checkbox status. 1 is for enabled, 0 is for
- // disabled.
- usageSetting = Settings.Global.getInt(context.getContentResolver(), "multi_cb");
- } catch (SettingNotFoundException e) {
- Log.i(LOG_TAG, "Usage setting not found: " + e.getMessage());
- }
-
- // Prepare profile report
- String reportName = mIProfcollect.report(usageSetting) + ".zip";
-
- if (!context.getResources().getBoolean(
- R.bool.config_profcollectReportUploaderEnabled)) {
- Log.i(LOG_TAG, "Upload is not enabled.");
- return;
- }
-
- // Upload the report
- Intent intent = new Intent()
- .setPackage("com.android.shell")
- .setAction("com.android.shell.action.PROFCOLLECT_UPLOAD")
- .putExtra("filename", reportName);
- context.sendBroadcast(intent);
- } catch (RemoteException e) {
- Log.e(LOG_TAG, "Failed to upload report: " + e.getMessage());
- }
+ Intent intent = new Intent()
+ .setPackage("com.android.shell")
+ .setAction("com.android.shell.action.PROFCOLLECT_UPLOAD")
+ .putExtra("filename", reportName);
+ pfs.getContext().sendBroadcast(intent);
});
+ if (DEBUG) {
+ Log.d(LOG_TAG, "Sent report for upload.");
+ }
}
}
diff --git a/services/tests/apexsystemservices/OWNERS b/services/tests/apexsystemservices/OWNERS
index 0295b9e99326..8b6675ad22d7 100644
--- a/services/tests/apexsystemservices/OWNERS
+++ b/services/tests/apexsystemservices/OWNERS
@@ -1,4 +1 @@
-omakoto@google.com
-satayev@google.com
-
include platform/packages/modules/common:/OWNERS
diff --git a/services/tests/mockingservicestests/src/com/android/server/RescuePartyTest.java b/services/tests/mockingservicestests/src/com/android/server/RescuePartyTest.java
index 4a2164582890..42814e7c775e 100644
--- a/services/tests/mockingservicestests/src/com/android/server/RescuePartyTest.java
+++ b/services/tests/mockingservicestests/src/com/android/server/RescuePartyTest.java
@@ -239,6 +239,9 @@ public class RescuePartyTest {
@Test
public void testBootLoopDetectionWithExecutionForAllRescueLevels() {
+ // this is old test where the flag needs to be disabled
+ mSetFlagsRule.disableFlags(Flags.FLAG_RECOVERABILITY_DETECTION);
+
RescueParty.onSettingsProviderPublished(mMockContext);
verify(() -> DeviceConfig.setMonitorCallback(eq(mMockContentResolver),
any(Executor.class),
@@ -449,6 +452,9 @@ public class RescuePartyTest {
@Test
public void testNonPersistentAppCrashDetectionWithScopedResets() {
+ // this is old test where the flag needs to be disabled
+ mSetFlagsRule.disableFlags(Flags.FLAG_RECOVERABILITY_DETECTION);
+
RescueParty.onSettingsProviderPublished(mMockContext);
verify(() -> DeviceConfig.setMonitorCallback(eq(mMockContentResolver),
any(Executor.class),
@@ -506,6 +512,9 @@ public class RescuePartyTest {
@Test
public void testNonDeviceConfigSettingsOnlyResetOncePerLevel() {
+ // this is old test where the flag needs to be disabled
+ mSetFlagsRule.disableFlags(Flags.FLAG_RECOVERABILITY_DETECTION);
+
RescueParty.onSettingsProviderPublished(mMockContext);
verify(() -> DeviceConfig.setMonitorCallback(eq(mMockContentResolver),
any(Executor.class),
@@ -879,6 +888,9 @@ public class RescuePartyTest {
@Test
public void testBootLoopLevels() {
+ // this is old test where the flag needs to be disabled
+ mSetFlagsRule.disableFlags(Flags.FLAG_RECOVERABILITY_DETECTION);
+
RescuePartyObserver observer = RescuePartyObserver.getInstance(mMockContext);
assertEquals(observer.onBootLoop(0), PackageHealthObserverImpact.USER_IMPACT_LEVEL_0);
diff --git a/services/tests/mockingservicestests/src/com/android/server/am/OWNERS b/services/tests/mockingservicestests/src/com/android/server/am/OWNERS
index 72c0a9e6e90c..2cbc226da780 100644
--- a/services/tests/mockingservicestests/src/com/android/server/am/OWNERS
+++ b/services/tests/mockingservicestests/src/com/android/server/am/OWNERS
@@ -1 +1,3 @@
include /services/core/java/com/android/server/am/OWNERS
+
+per-file ApplicationStartInfoTest.java = yforta@google.com, carmenjackson@google.com, jji@google.com
diff --git a/services/tests/servicestests/AndroidTest.xml b/services/tests/servicestests/AndroidTest.xml
index b1d50399416a..84bafdac0a0c 100644
--- a/services/tests/servicestests/AndroidTest.xml
+++ b/services/tests/servicestests/AndroidTest.xml
@@ -25,6 +25,13 @@
value="/data/local/tmp/cts/content/broken_shortcut.xml" />
</target_preparer>
+ <target_preparer class="com.android.tradefed.targetprep.DeviceSetup">
+ <option name="force-skip-system-props" value="true" />
+ <option name="set-global-setting" key="verifier_engprod" value="1" />
+ <option name="set-global-setting" key="verifier_verify_adb_installs" value="0" />
+ <option name="restore-settings" value="true" />
+ </target_preparer>
+
<target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="install-arg" value="-t" />
diff --git a/services/tests/servicestests/src/com/android/server/audio/MusicFxHelperTest.java b/services/tests/servicestests/src/com/android/server/audio/MusicFxHelperTest.java
index 472a82c02937..d5638e9346f6 100644
--- a/services/tests/servicestests/src/com/android/server/audio/MusicFxHelperTest.java
+++ b/services/tests/servicestests/src/com/android/server/audio/MusicFxHelperTest.java
@@ -57,8 +57,9 @@ public class MusicFxHelperTest {
private ResolveInfo mResolveInfo1 = new ResolveInfo();
private ResolveInfo mResolveInfo2 = new ResolveInfo();
- private final String mTestPkg1 = "testPkg1", mTestPkg2 = "testPkg2", mTestPkg3 = "testPkg3";
- private final String mMusicFxPkgName = "com.android.musicfx";
+ private final String mTestPkg1 = new String("testPkg1"), mTestPkg2 = new String("testPkg2"),
+ mTestPkg3 = new String("testPkg3"), mTestPkg1Equivalent = new String("testPkg1");
+ private final String mMusicFxPkgName = new String("com.android.musicfx");
private final int mTestUid1 = 1, mTestUid2 = 2, mTestUid3 = 3, mMusicFxUid = 78;
private final int mTestSession1 = 11, mTestSession2 = 22, mTestSession3 = 33;
@@ -191,7 +192,8 @@ public class MusicFxHelperTest {
public void testCloseBroadcastIntent() {
Log.i(TAG, "running testCloseBroadcastIntent");
- closeSessionWithResList(null, 0, 0, null, mTestSession1, mTestUid1);
+ closeSessionWithResList(null, 0 /* unbind */, 0 /* broadcast */, null /* packageName */,
+ mTestSession1, mTestUid1);
}
/**
@@ -225,8 +227,10 @@ public class MusicFxHelperTest {
public void testBroadcastIntentWithNoPackageAndNoBroadcastReceiver() {
Log.i(TAG, "running testBroadcastIntentWithNoPackageAndNoBroadcastReceiver");
- openSessionWithResList(mEmptyList, 0, 0, null, mTestSession1, mTestUid1);
- closeSessionWithResList(mEmptyList, 0, 0, null, mTestSession1, mTestUid1);
+ openSessionWithResList(mEmptyList, 0 /* bind */, 0 /* broadcast */, null /* packageName */,
+ mTestSession1, mTestUid1);
+ closeSessionWithResList(mEmptyList, 0 /* unbind */, 0 /* broadcast */,
+ null /* packageName */, mTestSession1, mTestUid1);
}
/**
@@ -236,37 +240,63 @@ public class MusicFxHelperTest {
public void testBroadcastIntentWithNoPackageAndOneBroadcastReceiver() {
Log.i(TAG, "running testBroadcastIntentWithNoPackageAndOneBroadcastReceiver");
+ openSessionWithResList(mSingleList, 0 /* bind */, 0 /* broadcast */,
+ null /* packageName */, mTestSession1, mTestUid1);
+ closeSessionWithResList(mSingleList, 0 /* unbind */, 0 /* broadcast */,
+ null /* packageName */, mTestSession1, mTestUid1);
+ }
+
+ /**
+ * OPEN/CLOSE AUDIO_EFFECT_CONTROL_SESSION with two broadcast receivers.
+ */
+ @Test
+ public void testBroadcastIntentWithNoPackageAndTwoBroadcastReceivers() {
+ Log.i(TAG, "running testBroadcastIntentWithNoPackageAndTwoBroadcastReceivers");
+
+ openSessionWithResList(mDoubleList, 0 /* bind */, 0 /* broadcast */,
+ null /* packageName */, mTestSession1, mTestUid1);
+ closeSessionWithResList(mDoubleList, 0 /* bind */, 0 /* broadcast */,
+ null /* packageName */, mTestSession1, mTestUid1);
+ }
+
+ @Test
+ public void testBroadcastIntentWithPackageAndOneBroadcastReceiver() {
+ Log.i(TAG, "running testBroadcastIntentWithPackageAndOneBroadcastReceiver");
+
int broadcasts = 1, bind = 1, unbind = 1;
- openSessionWithResList(mSingleList, bind, broadcasts, null, mTestSession1, mTestUid1);
+ openSessionWithResList(mSingleList, bind, broadcasts, mTestPkg1, mTestSession1, mTestUid1);
+
broadcasts = broadcasts + 1;
- closeSessionWithResList(mSingleList, unbind, broadcasts, null, mTestSession1, mTestUid1);
+ closeSessionWithResList(mSingleList, unbind, broadcasts, mTestPkg1, mTestSession1,
+ mTestUid1);
// repeat with different session ID
broadcasts = broadcasts + 1;
bind = bind + 1;
unbind = unbind + 1;
- openSessionWithResList(mSingleList, bind, broadcasts, null, mTestSession2, mTestUid1);
+ openSessionWithResList(mSingleList, bind, broadcasts, mTestPkg2, mTestSession2, mTestUid1);
broadcasts = broadcasts + 1;
- closeSessionWithResList(mSingleList, unbind, broadcasts, null, mTestSession2, mTestUid1);
+ closeSessionWithResList(mSingleList, unbind, broadcasts, mTestPkg2, mTestSession2,
+ mTestUid1);
// repeat with different UID
broadcasts = broadcasts + 1;
bind = bind + 1;
unbind = unbind + 1;
- openSessionWithResList(mSingleList, bind, broadcasts, null, mTestSession1, mTestUid2);
+ openSessionWithResList(mSingleList, bind, broadcasts, mTestPkg3, mTestSession1, mTestUid2);
broadcasts = broadcasts + 1;
- closeSessionWithResList(mSingleList, unbind, broadcasts, null, mTestSession1, mTestUid2);
+ closeSessionWithResList(mSingleList, unbind, broadcasts, mTestPkg3, mTestSession1,
+ mTestUid2);
}
- /**
- * OPEN/CLOSE AUDIO_EFFECT_CONTROL_SESSION with two broadcast receivers.
- */
@Test
- public void testBroadcastIntentWithNoPackageAndTwoBroadcastReceivers() {
- Log.i(TAG, "running testBroadcastIntentWithNoPackageAndTwoBroadcastReceivers");
+ public void testBroadcastIntentWithPackageAndTwoBroadcastReceivers() {
+ Log.i(TAG, "running testBroadcastIntentWithPackageAndTwoBroadcastReceivers");
- openSessionWithResList(mDoubleList, 1, 1, null, mTestSession1, mTestUid1);
- closeSessionWithResList(mDoubleList, 1, 2, null, mTestSession1, mTestUid1);
+ openSessionWithResList(mDoubleList, 1 /* bind */, 1 /* broadcast */,
+ mTestPkg1 /* packageName */, mTestSession1, mTestUid1);
+ closeSessionWithResList(mDoubleList, 1 /* unbind */, 2 /* broadcast */,
+ mTestPkg1 /* packageName */, mTestSession1, mTestUid1);
}
/**
@@ -639,4 +669,18 @@ public class MusicFxHelperTest {
unbind = unbind + 1;
sendMessage(MusicFxHelper.MSG_EFFECT_CLIENT_GONE, mTestUid3, unbind, broadcasts);
}
+
+ /**
+ * Test audio session open/close with same package name value but different String object.
+ */
+ @Test
+ public void testSessionOpenCloseWithSamePackageNameValueButDiffObject() {
+ Log.i(TAG, "running testSessionOpenCloseWithSamePackageNameValueButDiffObject");
+ int broadcasts = 1;
+ openSessionWithResList(mSingleList, 1 /* bind */, broadcasts, mTestPkg1, mTestSession1,
+ mTestUid1);
+ closeSessionWithResList(mSingleList, 1 /* unbind */, broadcasts + 1, mTestPkg1Equivalent,
+ mTestSession1, mTestUid1);
+ }
+
}
diff --git a/services/tests/servicestests/src/com/android/server/net/NetworkManagementServiceTest.java b/services/tests/servicestests/src/com/android/server/net/NetworkManagementServiceTest.java
index d6d2b6d9abd2..2a49a868d1f7 100644
--- a/services/tests/servicestests/src/com/android/server/net/NetworkManagementServiceTest.java
+++ b/services/tests/servicestests/src/com/android/server/net/NetworkManagementServiceTest.java
@@ -19,9 +19,16 @@ package com.android.server.net;
import static android.net.ConnectivityManager.FIREWALL_CHAIN_BACKGROUND;
import static android.net.ConnectivityManager.FIREWALL_CHAIN_DOZABLE;
import static android.net.ConnectivityManager.FIREWALL_CHAIN_LOW_POWER_STANDBY;
+import static android.net.ConnectivityManager.FIREWALL_CHAIN_METERED_ALLOW;
+import static android.net.ConnectivityManager.FIREWALL_CHAIN_METERED_DENY_ADMIN;
+import static android.net.ConnectivityManager.FIREWALL_CHAIN_METERED_DENY_USER;
import static android.net.ConnectivityManager.FIREWALL_CHAIN_POWERSAVE;
import static android.net.ConnectivityManager.FIREWALL_CHAIN_RESTRICTED;
import static android.net.ConnectivityManager.FIREWALL_CHAIN_STANDBY;
+import static android.net.ConnectivityManager.FIREWALL_RULE_ALLOW;
+import static android.net.ConnectivityManager.FIREWALL_RULE_DEFAULT;
+import static android.net.ConnectivityManager.FIREWALL_RULE_DENY;
+import static android.platform.test.flag.junit.SetFlagsRule.DefaultInitValueType.DEVICE_DEFAULT;
import static android.util.DebugUtils.valueToString;
import static org.junit.Assert.assertEquals;
@@ -51,7 +58,10 @@ import android.os.PermissionEnforcer;
import android.os.Process;
import android.os.RemoteException;
import android.os.test.FakePermissionEnforcer;
+import android.platform.test.annotations.DisableFlags;
+import android.platform.test.annotations.EnableFlags;
import android.platform.test.annotations.Presubmit;
+import android.platform.test.flag.junit.SetFlagsRule;
import android.test.suitebuilder.annotation.SmallTest;
import android.util.ArrayMap;
@@ -62,6 +72,7 @@ import com.android.modules.utils.build.SdkLevel;
import org.junit.After;
import org.junit.Before;
+import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
@@ -84,6 +95,9 @@ public class NetworkManagementServiceTest {
@Mock private IBatteryStats.Stub mBatteryStatsService;
@Mock private INetd.Stub mNetdService;
+ @Rule
+ public final SetFlagsRule mSetFlagsRule = new SetFlagsRule(DEVICE_DEFAULT);
+
private static final int TEST_UID = 111;
@NonNull
@@ -254,6 +268,7 @@ public class NetworkManagementServiceTest {
}
@Test
+ @DisableFlags(Flags.FLAG_USE_METERED_FIREWALL_CHAINS)
public void testMeteredNetworkRestrictions() throws RemoteException {
// Make sure the mocked netd method returns true.
doReturn(true).when(mNetdService).bandwidthEnableDataSaver(anyBoolean());
@@ -295,6 +310,69 @@ public class NetworkManagementServiceTest {
}
@Test
+ @EnableFlags(Flags.FLAG_USE_METERED_FIREWALL_CHAINS)
+ public void testMeteredNetworkRestrictionsByAdminChain() {
+ mNMService.setFirewallUidRule(FIREWALL_CHAIN_METERED_DENY_ADMIN, TEST_UID,
+ FIREWALL_RULE_DENY);
+ verify(mCm).setUidFirewallRule(FIREWALL_CHAIN_METERED_DENY_ADMIN, TEST_UID,
+ FIREWALL_RULE_DENY);
+ assertTrue("Should be true since mobile data usage is restricted by admin chain",
+ mNMService.isNetworkRestricted(TEST_UID));
+
+ mNMService.setFirewallUidRule(FIREWALL_CHAIN_METERED_DENY_ADMIN, TEST_UID,
+ FIREWALL_RULE_DEFAULT);
+ verify(mCm).setUidFirewallRule(FIREWALL_CHAIN_METERED_DENY_ADMIN, TEST_UID,
+ FIREWALL_RULE_DEFAULT);
+ assertFalse("Should be false since mobile data usage is no longer restricted by admin",
+ mNMService.isNetworkRestricted(TEST_UID));
+ }
+
+ @Test
+ @EnableFlags(Flags.FLAG_USE_METERED_FIREWALL_CHAINS)
+ public void testMeteredNetworkRestrictionsByUserChain() {
+ mNMService.setFirewallUidRule(FIREWALL_CHAIN_METERED_DENY_USER, TEST_UID,
+ FIREWALL_RULE_DENY);
+ verify(mCm).setUidFirewallRule(FIREWALL_CHAIN_METERED_DENY_USER, TEST_UID,
+ FIREWALL_RULE_DENY);
+ assertTrue("Should be true since mobile data usage is restricted by user chain",
+ mNMService.isNetworkRestricted(TEST_UID));
+
+ mNMService.setFirewallUidRule(FIREWALL_CHAIN_METERED_DENY_USER, TEST_UID,
+ FIREWALL_RULE_DEFAULT);
+ verify(mCm).setUidFirewallRule(FIREWALL_CHAIN_METERED_DENY_USER, TEST_UID,
+ FIREWALL_RULE_DEFAULT);
+ assertFalse("Should be false since mobile data usage is no longer restricted by user",
+ mNMService.isNetworkRestricted(TEST_UID));
+ }
+
+ @Test
+ @EnableFlags(Flags.FLAG_USE_METERED_FIREWALL_CHAINS)
+ public void testDataSaverRestrictionsWithAllowChain() {
+ mNMService.setDataSaverModeEnabled(true);
+ verify(mCm).setDataSaverEnabled(true);
+
+ assertTrue("Should be true since data saver is on and the uid is not allowlisted",
+ mNMService.isNetworkRestricted(TEST_UID));
+
+ mNMService.setFirewallUidRule(FIREWALL_CHAIN_METERED_ALLOW, TEST_UID, FIREWALL_RULE_ALLOW);
+ verify(mCm).setUidFirewallRule(FIREWALL_CHAIN_METERED_ALLOW, TEST_UID, FIREWALL_RULE_ALLOW);
+ assertFalse("Should be false since data saver is on and the uid is allowlisted",
+ mNMService.isNetworkRestricted(TEST_UID));
+
+ // remove uid from allowlist and turn datasaver off again
+
+ mNMService.setFirewallUidRule(FIREWALL_CHAIN_METERED_ALLOW, TEST_UID,
+ FIREWALL_RULE_DEFAULT);
+ verify(mCm).setUidFirewallRule(FIREWALL_CHAIN_METERED_ALLOW, TEST_UID,
+ FIREWALL_RULE_DEFAULT);
+ mNMService.setDataSaverModeEnabled(false);
+ verify(mCm).setDataSaverEnabled(false);
+
+ assertFalse("Network should not be restricted when data saver is off",
+ mNMService.isNetworkRestricted(TEST_UID));
+ }
+
+ @Test
public void testFirewallChains() {
final ArrayMap<Integer, ArrayMap<Integer, Boolean>> expected = new ArrayMap<>();
// Dozable chain
diff --git a/tests/BinderLeakTest/Android.bp b/tests/BinderLeakTest/Android.bp
index 78b0ede76d4e..3747d049417f 100644
--- a/tests/BinderLeakTest/Android.bp
+++ b/tests/BinderLeakTest/Android.bp
@@ -24,6 +24,9 @@ java_defaults {
"androidx.test.rules",
"androidx.test.runner",
],
+ test_suites: [
+ "general-tests",
+ ],
}
// Built with target_sdk_version: current
diff --git a/tests/FlickerTests/IME/Android.bp b/tests/FlickerTests/IME/Android.bp
index 1141e5f3ae2f..358c4902a502 100644
--- a/tests/FlickerTests/IME/Android.bp
+++ b/tests/FlickerTests/IME/Android.bp
@@ -55,6 +55,10 @@ android_test {
defaults: ["FlickerTestsDefault"],
manifest: "AndroidManifest.xml",
test_config_template: "AndroidTestTemplate.xml",
+ test_suites: [
+ "device-tests",
+ "device-platinum-tests",
+ ],
srcs: [":FlickerTestsIme1-src"],
static_libs: [
"FlickerTestsBase",
diff --git a/tests/FlickerTests/Rotation/Android.bp b/tests/FlickerTests/Rotation/Android.bp
index 233a27691e21..6a0d9efa91e8 100644
--- a/tests/FlickerTests/Rotation/Android.bp
+++ b/tests/FlickerTests/Rotation/Android.bp
@@ -28,6 +28,10 @@ android_test {
defaults: ["FlickerTestsDefault"],
manifest: "AndroidManifest.xml",
test_config_template: "AndroidTestTemplate.xml",
+ test_suites: [
+ "device-tests",
+ "device-platinum-tests",
+ ],
srcs: ["src/**/*"],
static_libs: ["FlickerTestsBase"],
data: ["trace_config/*"],
diff --git a/tests/Input/src/android/hardware/input/KeyboardLayoutPreviewTests.kt b/tests/Input/src/android/hardware/input/KeyboardLayoutPreviewTests.kt
index 3a2a3be0690d..ae32bdaf80d7 100644
--- a/tests/Input/src/android/hardware/input/KeyboardLayoutPreviewTests.kt
+++ b/tests/Input/src/android/hardware/input/KeyboardLayoutPreviewTests.kt
@@ -16,6 +16,8 @@
package android.hardware.input
+import android.platform.test.annotations.DisableFlags
+import android.platform.test.annotations.EnableFlags
import android.content.ContextWrapper
import android.graphics.drawable.Drawable
import android.platform.test.annotations.Presubmit
@@ -54,16 +56,16 @@ class KeyboardLayoutPreviewTests {
}
@Test
+ @EnableFlags(Flags.FLAG_KEYBOARD_LAYOUT_PREVIEW_FLAG)
fun testKeyboardLayoutDrawable_hasCorrectDimensions() {
- setFlagsRule.enableFlags(Flags.FLAG_KEYBOARD_LAYOUT_PREVIEW_FLAG)
val drawable = createDrawable()!!
assertEquals(WIDTH, drawable.intrinsicWidth)
assertEquals(HEIGHT, drawable.intrinsicHeight)
}
@Test
+ @DisableFlags(Flags.FLAG_KEYBOARD_LAYOUT_PREVIEW_FLAG)
fun testKeyboardLayoutDrawable_isNull_ifFlagOff() {
- setFlagsRule.disableFlags(Flags.FLAG_KEYBOARD_LAYOUT_PREVIEW_FLAG)
assertNull(createDrawable())
}
} \ No newline at end of file
diff --git a/tests/vcn/java/com/android/server/VcnManagementServiceTest.java b/tests/vcn/java/com/android/server/VcnManagementServiceTest.java
index 960b57cb632a..580efe126ea3 100644
--- a/tests/vcn/java/com/android/server/VcnManagementServiceTest.java
+++ b/tests/vcn/java/com/android/server/VcnManagementServiceTest.java
@@ -70,6 +70,7 @@ import android.net.Network;
import android.net.NetworkCapabilities;
import android.net.NetworkRequest;
import android.net.Uri;
+import android.net.vcn.Flags;
import android.net.vcn.IVcnStatusCallback;
import android.net.vcn.IVcnUnderlyingNetworkPolicyListener;
import android.net.vcn.VcnConfig;
@@ -82,7 +83,9 @@ import android.os.ParcelUuid;
import android.os.PersistableBundle;
import android.os.Process;
import android.os.UserHandle;
+import android.os.UserManager;
import android.os.test.TestLooper;
+import android.platform.test.flag.junit.SetFlagsRule;
import android.telephony.SubscriptionInfo;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
@@ -101,6 +104,7 @@ import com.android.server.vcn.util.PersistableBundleUtils;
import com.android.server.vcn.util.PersistableBundleUtils.PersistableBundleWrapper;
import org.junit.Before;
+import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
@@ -118,6 +122,8 @@ import java.util.UUID;
@RunWith(AndroidJUnit4.class)
@SmallTest
public class VcnManagementServiceTest {
+ @Rule public final SetFlagsRule mSetFlagsRule = new SetFlagsRule();
+
private static final String CONTEXT_ATTRIBUTION_TAG = "VCN";
private static final String TEST_PACKAGE_NAME =
VcnManagementServiceTest.class.getPackage().getName();
@@ -129,7 +135,12 @@ public class VcnManagementServiceTest {
private static final ParcelUuid TEST_UUID_3 = new ParcelUuid(new UUID(2, 2));
private static final VcnConfig TEST_VCN_CONFIG;
private static final VcnConfig TEST_VCN_CONFIG_PKG_2;
- private static final int TEST_UID = Process.FIRST_APPLICATION_UID;
+
+ private static final int TEST_UID = 1010000; // A non-system user
+ private static final UserHandle TEST_USER_HANDLE = UserHandle.getUserHandleForUid(TEST_UID);
+ private static final UserHandle TEST_USER_HANDLE_OTHER =
+ UserHandle.of(TEST_USER_HANDLE.getIdentifier() + 1);
+
private static final String TEST_IFACE_NAME = "TEST_IFACE";
private static final String TEST_IFACE_NAME_2 = "TEST_IFACE2";
private static final LinkProperties TEST_LP_1 = new LinkProperties();
@@ -187,6 +198,7 @@ public class VcnManagementServiceTest {
private final TelephonyManager mTelMgr = mock(TelephonyManager.class);
private final SubscriptionManager mSubMgr = mock(SubscriptionManager.class);
private final AppOpsManager mAppOpsMgr = mock(AppOpsManager.class);
+ private final UserManager mUserManager = mock(UserManager.class);
private final VcnContext mVcnContext = mock(VcnContext.class);
private final PersistableBundleUtils.LockingReadWriteHelper mConfigReadWriteHelper =
mock(PersistableBundleUtils.LockingReadWriteHelper.class);
@@ -218,6 +230,9 @@ public class VcnManagementServiceTest {
Context.TELEPHONY_SUBSCRIPTION_SERVICE,
SubscriptionManager.class);
setupSystemService(mMockContext, mAppOpsMgr, Context.APP_OPS_SERVICE, AppOpsManager.class);
+ setupSystemService(mMockContext, mUserManager, Context.USER_SERVICE, UserManager.class);
+
+ doReturn(TEST_USER_HANDLE).when(mUserManager).getMainUser();
doReturn(TEST_PACKAGE_NAME).when(mMockContext).getOpPackageName();
@@ -267,6 +282,8 @@ public class VcnManagementServiceTest {
@Before
public void setUp() {
+ mSetFlagsRule.enableFlags(Flags.FLAG_ENFORCE_MAIN_USER);
+
doNothing()
.when(mMockContext)
.enforceCallingOrSelfPermission(
@@ -717,10 +734,8 @@ public class VcnManagementServiceTest {
}
@Test
- public void testSetVcnConfigRequiresSystemUser() throws Exception {
- doReturn(UserHandle.getUid(UserHandle.MIN_SECONDARY_USER_ID, TEST_UID))
- .when(mMockDeps)
- .getBinderCallingUid();
+ public void testSetVcnConfigRequiresMainUser() throws Exception {
+ doReturn(TEST_USER_HANDLE_OTHER).when(mUserManager).getMainUser();
try {
mVcnMgmtSvc.setVcnConfig(TEST_UUID_1, TEST_VCN_CONFIG, TEST_PACKAGE_NAME);
@@ -832,10 +847,8 @@ public class VcnManagementServiceTest {
}
@Test
- public void testClearVcnConfigRequiresSystemUser() throws Exception {
- doReturn(UserHandle.getUid(UserHandle.MIN_SECONDARY_USER_ID, TEST_UID))
- .when(mMockDeps)
- .getBinderCallingUid();
+ public void testClearVcnConfigRequiresMainUser() throws Exception {
+ doReturn(TEST_USER_HANDLE_OTHER).when(mUserManager).getMainUser();
try {
mVcnMgmtSvc.clearVcnConfig(TEST_UUID_1, TEST_PACKAGE_NAME);
@@ -921,10 +934,8 @@ public class VcnManagementServiceTest {
}
@Test
- public void testGetConfiguredSubscriptionGroupsRequiresSystemUser() throws Exception {
- doReturn(UserHandle.getUid(UserHandle.MIN_SECONDARY_USER_ID, TEST_UID))
- .when(mMockDeps)
- .getBinderCallingUid();
+ public void testGetConfiguredSubscriptionGroupsRequiresMainUser() throws Exception {
+ doReturn(TEST_USER_HANDLE_OTHER).when(mUserManager).getMainUser();
try {
mVcnMgmtSvc.getConfiguredSubscriptionGroups(TEST_PACKAGE_NAME);
diff --git a/tools/aapt/Symbol.h b/tools/aapt/Symbol.h
index de1d60cbae42..24c3208d9081 100644
--- a/tools/aapt/Symbol.h
+++ b/tools/aapt/Symbol.h
@@ -40,7 +40,7 @@ struct Symbol {
};
/**
- * A specific defintion of a symbol, defined with a configuration and a definition site.
+ * A specific definition of a symbol, defined with a configuration and a definition site.
*/
struct SymbolDefinition {
inline SymbolDefinition();
@@ -92,4 +92,3 @@ bool SymbolDefinition::operator<(const SymbolDefinition& rhs) const {
}
#endif // AAPT_SYMBOL_H
-
diff --git a/tools/hoststubgen/OWNERS b/tools/hoststubgen/OWNERS
index a8c5321307d1..3d8888d83cf4 100644
--- a/tools/hoststubgen/OWNERS
+++ b/tools/hoststubgen/OWNERS
@@ -1,3 +1 @@
-omakoto@google.com
-jsharkey@google.com
-jaggies@google.com
+file:platform/frameworks/base:/ravenwood/OWNERS