diff options
90 files changed, 996 insertions, 411 deletions
diff --git a/Android.mk b/Android.mk index e2c1ed8e9ddb..a126c52e2491 100644 --- a/Android.mk +++ b/Android.mk @@ -15,67 +15,6 @@ # LOCAL_PATH := $(call my-dir) -$(eval $(call declare-1p-copy-files,frameworks/base,.ogg)) -$(eval $(call declare-1p-copy-files,frameworks/base,.kl)) -$(eval $(call declare-1p-copy-files,frameworks/base,.kcm)) -$(eval $(call declare-1p-copy-files,frameworks/base,.idc)) -$(eval $(call declare-1p-copy-files,frameworks/base,dirty-image-objects)) -$(eval $(call declare-1p-copy-files,frameworks/base/config,)) -$(eval $(call declare-1p-copy-files,frameworks/native/data,)) - -# Load framework-specific path mappings used later in the build. -include $(LOCAL_PATH)/pathmap.mk - -# Build the master framework library. -# The framework contains too many method references (>64K) for poor old DEX. -# So we first build the framework as a monolithic static library then split it -# up into smaller pieces. -# ============================================================ - -# embedded builds use nothing in frameworks/base -ifneq ($(ANDROID_BUILD_EMBEDDED),true) - -# Copy AIDL files to be preprocessed and included in the SDK, -# specified relative to the root of the build tree. -# ============================================================ -include $(CLEAR_VARS) - -# sdk.atree needs to copy the whole dir: $(OUT_DOCS)/offline-sdk to the final zip. -# So keep offline-sdk-timestamp target here, and unzip offline-sdk-docs.zip to -# $(OUT_DOCS)/offline-sdk. -$(OUT_DOCS)/offline-sdk-timestamp: $(OUT_DOCS)/offline-sdk-docs-docs.zip - $(hide) rm -rf $(OUT_DOCS)/offline-sdk - $(hide) mkdir -p $(OUT_DOCS)/offline-sdk - ( unzip -qo $< -d $(OUT_DOCS)/offline-sdk && touch -f $@ ) || exit 1 - -.PHONY: docs offline-sdk-docs -docs offline-sdk-docs: $(OUT_DOCS)/offline-sdk-timestamp - -SDK_METADATA_DIR :=$= $(call intermediates-dir-for,PACKAGING,framework-doc-stubs-metadata,,COMMON) -SDK_METADATA_FILES :=$= $(addprefix $(SDK_METADATA_DIR)/,\ - activity_actions.txt \ - broadcast_actions.txt \ - categories.txt \ - features.txt \ - service_actions.txt \ - widgets.txt) -SDK_METADATA :=$= $(firstword $(SDK_METADATA_FILES)) -$(SDK_METADATA): .KATI_IMPLICIT_OUTPUTS := $(filter-out $(SDK_METADATA),$(SDK_METADATA_FILES)) -$(SDK_METADATA): $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/framework-doc-stubs-metadata.zip - rm -rf $(SDK_METADATA_DIR) - mkdir -p $(SDK_METADATA_DIR) - unzip -DDqo $< -d $(SDK_METADATA_DIR) - -.PHONY: framework-doc-stubs -framework-doc-stubs: $(SDK_METADATA) - -# Include subdirectory makefiles -# ============================================================ - -# If we're building with ONE_SHOT_MAKEFILE (mm, mmm), then what the framework -# team really wants is to build the stuff defined by this makefile. -ifeq (,$(ONE_SHOT_MAKEFILE)) +# TODO: Empty this file after all subdirectories' Android.mk have been +# converted to Android.bp to avoid using any newly added Android.mk. include $(call first-makefiles-under,$(LOCAL_PATH)) -endif - -endif # ANDROID_BUILD_EMBEDDED diff --git a/apex/jobscheduler/service/Android.bp b/apex/jobscheduler/service/Android.bp index 8b55e071e715..a654f7a2d974 100644 --- a/apex/jobscheduler/service/Android.bp +++ b/apex/jobscheduler/service/Android.bp @@ -20,7 +20,9 @@ java_library { ], libs: [ + "androidx.annotation_annotation", "app-compat-annotations", + "error_prone_annotations", "framework", "services.core", "unsupportedappusage", diff --git a/core/api/current.txt b/core/api/current.txt index 78ef5f14f37a..48949f8883bd 100644 --- a/core/api/current.txt +++ b/core/api/current.txt @@ -23419,6 +23419,13 @@ package android.media { field public static final int VIDEO_ENCODING_STATISTICS_LEVEL_NONE = 0; // 0x0 } + @FlaggedApi("android.media.codec.region_of_interest") public static final class MediaFormat.QpOffsetRect { + ctor public MediaFormat.QpOffsetRect(@NonNull android.graphics.Rect, int); + method @NonNull public String flattenToString(); + method @NonNull public static String flattenToString(@NonNull java.util.List<android.media.MediaFormat.QpOffsetRect>); + method public void set(@NonNull android.graphics.Rect, int); + } + public final class MediaMetadata implements android.os.Parcelable { method public boolean containsKey(String); method public int describeContents(); diff --git a/core/api/module-lib-current.txt b/core/api/module-lib-current.txt index 56610c6a2e09..513e5bb9d084 100644 --- a/core/api/module-lib-current.txt +++ b/core/api/module-lib-current.txt @@ -206,6 +206,7 @@ package android.media { method @NonNull public static android.media.BluetoothProfileConnectionInfo createA2dpInfo(boolean, int); method @NonNull public static android.media.BluetoothProfileConnectionInfo createA2dpSinkInfo(int); method @NonNull public static android.media.BluetoothProfileConnectionInfo createHearingAidInfo(boolean); + method @FlaggedApi("android.media.audio.sco_managed_by_audio") @NonNull public static android.media.BluetoothProfileConnectionInfo createHfpInfo(); method @NonNull public static android.media.BluetoothProfileConnectionInfo createLeAudioInfo(boolean, boolean); method @NonNull public static android.media.BluetoothProfileConnectionInfo createLeAudioOutputInfo(boolean, int); method public int describeContents(); diff --git a/core/java/Android.bp b/core/java/Android.bp index eba500dd32b4..0147910595e1 100644 --- a/core/java/Android.bp +++ b/core/java/Android.bp @@ -166,6 +166,9 @@ java_library { "com/android/internal/logging/UiEventLoggerImpl.java", ":statslog-framework-java-gen", ], + libs: [ + "androidx.annotation_annotation", + ], static_libs: ["modules-utils-uieventlogger-interface"], } diff --git a/core/java/android/accessibilityservice/OWNERS b/core/java/android/accessibilityservice/OWNERS index fb06e236dd8a..1265dfa2c441 100644 --- a/core/java/android/accessibilityservice/OWNERS +++ b/core/java/android/accessibilityservice/OWNERS @@ -1,6 +1,4 @@ -pweaver@google.com -ryanlwlin@google.com -danielnorman@google.com -sallyyuen@google.com -aarmaly@google.com -fuego@google.com +# Bug component: 44215 + +# Android Accessibility Framework owners +include /services/accessibility/OWNERS
\ No newline at end of file diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java index 6ddb36a72aa9..0e66010ae2c3 100644 --- a/core/java/android/app/ActivityThread.java +++ b/core/java/android/app/ActivityThread.java @@ -4022,6 +4022,13 @@ public final class ActivityThread extends ClientTransactionHandler ActivityManager.getService().waitForNetworkStateUpdate(mNetworkBlockSeq); mNetworkBlockSeq = INVALID_PROC_STATE_SEQ; } catch (RemoteException ignored) {} + if (android.app.Flags.clearDnsCacheOnNetworkRulesUpdate()) { + // InetAddress will cache UnknownHostException failures. If the rules got + // updated and the app has network access now, we need to clear the negative + // cache to ensure valid dns queries can work immediately. + // TODO: b/329133769 - Clear only the negative cache once it is available. + InetAddress.clearDnsCache(); + } } } } diff --git a/core/java/android/app/network-policy.aconfig b/core/java/android/app/network-policy.aconfig new file mode 100644 index 000000000000..88f386f6025d --- /dev/null +++ b/core/java/android/app/network-policy.aconfig @@ -0,0 +1,11 @@ +package: "android.app" + +flag { + namespace: "backstage_power" + name: "clear_dns_cache_on_network_rules_update" + description: "Clears the DNS cache when the network rules update" + bug: "237556596" + metadata { + purpose: PURPOSE_BUGFIX + } +}
\ No newline at end of file diff --git a/core/java/android/content/rollback/OWNERS b/core/java/android/content/rollback/OWNERS index 8e5a0d8af550..c328b7c36b8f 100644 --- a/core/java/android/content/rollback/OWNERS +++ b/core/java/android/content/rollback/OWNERS @@ -1,5 +1,3 @@ # Bug component: 819107 -ancr@google.com -harshitmahajan@google.com -robertogil@google.com +include /services/core/java/com/android/server/crashrecovery/OWNERS
\ No newline at end of file diff --git a/core/java/android/service/media/OWNERS b/core/java/android/service/media/OWNERS deleted file mode 100644 index 916fc36ffbc6..000000000000 --- a/core/java/android/service/media/OWNERS +++ /dev/null @@ -1,8 +0,0 @@ -# Bug component: 137631 - -hdmoon@google.com -insun@google.com -jaewan@google.com -jinpark@google.com -klhyun@google.com -gyumin@google.com diff --git a/core/java/android/view/accessibility/OWNERS b/core/java/android/view/accessibility/OWNERS index 73d134146c3f..b0943e9cff62 100644 --- a/core/java/android/view/accessibility/OWNERS +++ b/core/java/android/view/accessibility/OWNERS @@ -1,16 +1,13 @@ -# Bug component: 44214 +# Bug component: 44215 -romainguy@google.com -alanv@google.com -adamp@google.com -aurimas@google.com -nduca@google.com -sumir@google.com -ogunwale@google.com -jjaggi@google.com -pweaver@google.com -ryanlwlin@google.com -danielnorman@google.com -sallyyuen@google.com -aarmaly@google.com -fuego@google.com +# Android Accessibility Framework owners +include /services/accessibility/OWNERS + +# Android members outside of Accessibility +adamp@google.com #{LAST_RESORT_SUGGESTION} +alanv@google.com #{LAST_RESORT_SUGGESTION} +aurimas@google.com #{LAST_RESORT_SUGGESTION} +jjaggi@google.com #{LAST_RESORT_SUGGESTION} +ogunwale@google.com #{LAST_RESORT_SUGGESTION} +romainguy@google.com #{LAST_RESORT_SUGGESTION} +sumir@google.com #{LAST_RESORT_SUGGESTION} diff --git a/core/java/com/android/internal/accessibility/OWNERS b/core/java/com/android/internal/accessibility/OWNERS index 0955e005791e..1265dfa2c441 100644 --- a/core/java/com/android/internal/accessibility/OWNERS +++ b/core/java/com/android/internal/accessibility/OWNERS @@ -1,6 +1,4 @@ -# Bug component: 44214 -pweaver@google.com -danielnorman@google.com -sallyyuen@google.com -aarmaly@google.com -fuego@google.com +# Bug component: 44215 + +# Android Accessibility Framework owners +include /services/accessibility/OWNERS
\ No newline at end of file diff --git a/core/java/com/android/internal/accessibility/common/MagnificationConstants.java b/core/java/com/android/internal/accessibility/common/MagnificationConstants.java index 2c493031ea8a..2db3e658530f 100644 --- a/core/java/com/android/internal/accessibility/common/MagnificationConstants.java +++ b/core/java/com/android/internal/accessibility/common/MagnificationConstants.java @@ -16,6 +16,8 @@ package com.android.internal.accessibility.common; +import android.os.SystemProperties; + /** * Collection of common constants for accessibility magnification. */ @@ -31,6 +33,7 @@ public final class MagnificationConstants { /** Minimum supported value for magnification scale. */ public static final float SCALE_MIN_VALUE = 1.0f; - /** Maximum supported value for magnification scale. */ - public static final float SCALE_MAX_VALUE = 8.0f; + /** Maximum supported value for magnification scale. Default of 8.0. */ + public static final float SCALE_MAX_VALUE = + Float.parseFloat(SystemProperties.get("ro.config.max_magnification_scale", "8.0")); } diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml index f40d6c455e1a..7bac3381193d 100644 --- a/core/res/AndroidManifest.xml +++ b/core/res/AndroidManifest.xml @@ -154,6 +154,7 @@ <protected-broadcast android:name="android.app.backup.intent.INIT" /> <protected-broadcast android:name="android.bluetooth.intent.DISCOVERABLE_TIMEOUT" /> + <protected-broadcast android:name="android.bluetooth.action.AUTO_ON_STATE_CHANGED" /> <protected-broadcast android:name="android.bluetooth.adapter.action.STATE_CHANGED" /> <protected-broadcast android:name="android.bluetooth.adapter.action.SCAN_MODE_CHANGED" /> <protected-broadcast android:name="android.bluetooth.adapter.action.DISCOVERY_STARTED" /> diff --git a/data/etc/OWNERS b/data/etc/OWNERS index 245f21658b7a..701d145fe805 100644 --- a/data/etc/OWNERS +++ b/data/etc/OWNERS @@ -12,3 +12,4 @@ yamasani@google.com per-file preinstalled-packages* = file:/MULTIUSER_OWNERS per-file services.core.protolog.json = file:/services/core/java/com/android/server/wm/OWNERS +per-file core.protolog.pb = file:/services/core/java/com/android/server/wm/OWNERS diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/StageCoordinator.java b/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/StageCoordinator.java index 96e57e71f05c..99b18d7d860d 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/StageCoordinator.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/StageCoordinator.java @@ -29,6 +29,7 @@ import static android.view.Display.DEFAULT_DISPLAY; import static android.view.RemoteAnimationTarget.MODE_OPENING; import static android.view.WindowManager.LayoutParams.TYPE_DOCK_DIVIDER; import static android.view.WindowManager.TRANSIT_CHANGE; +import static android.view.WindowManager.TRANSIT_CLOSE; import static android.view.WindowManager.TRANSIT_KEYGUARD_OCCLUDE; import static android.view.WindowManager.TRANSIT_TO_BACK; import static android.view.WindowManager.TRANSIT_TO_FRONT; @@ -2671,7 +2672,7 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, + " with " + taskInfo.taskId + " before startAnimation()."); record.addRecord(stage, true, taskInfo.taskId); } - } else if (isClosingType(change.getMode())) { + } else if (change.getMode() == TRANSIT_CLOSE) { if (stage.containsTask(taskInfo.taskId)) { record.addRecord(stage, false, taskInfo.taskId); Log.w(TAG, "Expected onTaskVanished on " + stage + " to have been called" diff --git a/libs/hwui/pipeline/skia/ShaderCache.h b/libs/hwui/pipeline/skia/ShaderCache.h index 6ccb212fe6ca..40dfc9d4309b 100644 --- a/libs/hwui/pipeline/skia/ShaderCache.h +++ b/libs/hwui/pipeline/skia/ShaderCache.h @@ -16,6 +16,7 @@ #pragma once +#include <FileBlobCache.h> #include <GrContextOptions.h> #include <SkRefCnt.h> #include <cutils/compiler.h> @@ -32,7 +33,6 @@ class SkData; namespace android { class BlobCache; -class FileBlobCache; namespace uirenderer { namespace skiapipeline { diff --git a/media/OWNERS b/media/OWNERS index 994a7b810009..2e9276d73392 100644 --- a/media/OWNERS +++ b/media/OWNERS @@ -3,14 +3,9 @@ atneya@google.com elaurent@google.com essick@google.com etalvala@google.com -hdmoon@google.com hunga@google.com -insun@google.com -jaewan@google.com -jinpark@google.com jmtrivi@google.com jsharkey@android.com -klhyun@google.com lajos@google.com nchalko@google.com philburk@google.com @@ -20,8 +15,6 @@ wonsik@google.com # go/android-fwk-media-solutions for info on areas of ownership. include platform/frameworks/av:/media/janitors/media_solutions_OWNERS -# SEO - # SEA/KIR/BVE jtinker@google.com robertshih@google.com diff --git a/media/java/android/media/BluetoothProfileConnectionInfo.java b/media/java/android/media/BluetoothProfileConnectionInfo.java index e4dc1521ae70..0613fc655521 100644 --- a/media/java/android/media/BluetoothProfileConnectionInfo.java +++ b/media/java/android/media/BluetoothProfileConnectionInfo.java @@ -15,6 +15,9 @@ */ package android.media; +import static android.media.audio.Flags.FLAG_SCO_MANAGED_BY_AUDIO; + +import android.annotation.FlaggedApi; import android.annotation.NonNull; import android.annotation.SystemApi; import android.bluetooth.BluetoothProfile; @@ -174,4 +177,13 @@ public final class BluetoothProfileConnectionInfo implements Parcelable { public boolean isLeOutput() { return mIsLeOutput; } + + /** + * Factory method for <code>BluetoothProfileConnectionInfo</code> for an HFP device. + */ + @FlaggedApi(FLAG_SCO_MANAGED_BY_AUDIO) + public static @NonNull BluetoothProfileConnectionInfo createHfpInfo() { + return new BluetoothProfileConnectionInfo(BluetoothProfile.HEADSET, false, + -1, false); + } } diff --git a/media/java/android/media/MediaCodec.java b/media/java/android/media/MediaCodec.java index e0e198ae551d..45bf5c415a7e 100644 --- a/media/java/android/media/MediaCodec.java +++ b/media/java/android/media/MediaCodec.java @@ -5099,7 +5099,7 @@ final public class MediaCodec { * size is larger than 16x16, then the qpOffset information of all 16x16 blocks that * encompass the coding unit is combined and used. The QP of target block will be calculated * as 'frameQP + offsetQP'. If the result exceeds minQP or maxQP configured then the value - * may be clamped. Negative offset results in blocks encoded at lower QP than frame QP and + * will be clamped. Negative offset results in blocks encoded at lower QP than frame QP and * positive offsets will result in encoding blocks at higher QP than frame QP. If the areas * of negative QP and positive QP are chosen wisely, the overall viewing experience can be * improved. @@ -5126,7 +5126,7 @@ final public class MediaCodec { * quantization parameter (QP) offset of the blocks in the bounding box. The bounding box * will get stretched outwards to align to LCU boundaries during encoding. The Qp Offset is * integral and shall be in the range [-128, 127]. The QP of target block will be calculated - * as frameQP + offsetQP. If the result exceeds minQP or maxQP configured then the value may + * as frameQP + offsetQP. If the result exceeds minQP or maxQP configured then the value will * be clamped. Negative offset results in blocks encoded at lower QP than frame QP and * positive offsets will result in blocks encoded at higher QP than frame QP. If the areas of * negative QP and positive QP are chosen wisely, the overall viewing experience can be diff --git a/media/java/android/media/MediaCodecInfo.java b/media/java/android/media/MediaCodecInfo.java index 1e7bc4764dd7..abad46046890 100644 --- a/media/java/android/media/MediaCodecInfo.java +++ b/media/java/android/media/MediaCodecInfo.java @@ -2651,11 +2651,10 @@ public final class MediaCodecInfo { mBlockAspectRatioRange = POSITIVE_RATIONALS; mAspectRatioRange = POSITIVE_RATIONALS; - // YUV 4:2:0 requires 2:2 alignment - mWidthAlignment = 2; - mHeightAlignment = 2; - mBlockWidth = 2; - mBlockHeight = 2; + mWidthAlignment = 1; + mHeightAlignment = 1; + mBlockWidth = 1; + mBlockHeight = 1; mSmallerDimensionUpperLimit = getSizeRange().getUpper(); } diff --git a/media/java/android/media/MediaFormat.java b/media/java/android/media/MediaFormat.java index 7b83842a9fb2..cd0654ceb348 100644 --- a/media/java/android/media/MediaFormat.java +++ b/media/java/android/media/MediaFormat.java @@ -17,6 +17,7 @@ package android.media; import static android.media.codec.Flags.FLAG_IN_PROCESS_SW_AUDIO_CODEC; +import static android.media.codec.Flags.FLAG_REGION_OF_INTEREST; import static com.android.media.codec.flags.Flags.FLAG_CODEC_IMPORTANCE; import static com.android.media.codec.flags.Flags.FLAG_LARGE_AUDIO_FRAME; @@ -26,6 +27,8 @@ import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.Nullable; import android.compat.annotation.UnsupportedAppUsage; +import android.graphics.Rect; +import android.text.TextUtils; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; @@ -34,6 +37,7 @@ import java.nio.ByteOrder; import java.util.AbstractSet; import java.util.HashMap; import java.util.Iterator; +import java.util.List; import java.util.Map; import java.util.Set; import java.util.stream.Collectors; @@ -1769,6 +1773,67 @@ public final class MediaFormat { @FlaggedApi(FLAG_IN_PROCESS_SW_AUDIO_CODEC) public static final String KEY_SECURITY_MODEL = "security-model"; + /** + * QpOffsetRect constitutes the metadata required for encoding a region of interest in an + * image or a video frame. The region of interest is represented by a rectangle. The four + * integer coordinates of the rectangle are stored in fields left, top, right, bottom. + * Note that the right and bottom coordinates are exclusive. + * This is paired with a suggestive qp offset information that is to be used during encoding + * of the blocks belonging to the to the box. + */ + @FlaggedApi(FLAG_REGION_OF_INTEREST) + public static final class QpOffsetRect { + private Rect mContour; + private int mQpOffset; + + /** + * Create a new region of interest with the specified coordinates and qpOffset. Note: no + * range checking is performed, so the caller must ensure that left >= 0, left <= right, + * top >= 0 and top <= bottom. Note that the right and bottom coordinates are exclusive. + * + * @param contour Rectangle specifying the region of interest + * @param qpOffset qpOffset to be used for the blocks in the specified rectangle + */ + public QpOffsetRect(@NonNull Rect contour, int qpOffset) { + mContour = contour; + mQpOffset = qpOffset; + } + + /** + * Update the region of interest information with the specified coordinates and qpOffset + * + * @param contour Rectangle specifying the region of interest + * @param qpOffset qpOffset to be used for the blocks in the specified rectangle + */ + public void set(@NonNull Rect contour, int qpOffset) { + mContour = contour; + mQpOffset = qpOffset; + } + + /** + * @return Return a string representation of qpOffsetRect in a compact form. + * Helper function to insert key {@link #PARAMETER_KEY_QP_OFFSET_RECTS} in MediaFormat + */ + @NonNull + public String flattenToString() { + return TextUtils.formatSimple("%d,%d-%d,%d=%d;", mContour.top, mContour.left, + mContour.bottom, mContour.right, mQpOffset); + } + + /** + * @return Return a string representation of qpOffsetRect in a compact form. + * Helper function to insert key {@link #PARAMETER_KEY_QP_OFFSET_RECTS} in MediaFormat + */ + @NonNull + public static String flattenToString(@NonNull List<QpOffsetRect> qpOffsetRects) { + StringBuilder builder = new StringBuilder(); + for (QpOffsetRect qpOffsetRect : qpOffsetRects) { + builder.append(qpOffsetRect.flattenToString()); + } + return builder.toString(); + } + } + /* package private */ MediaFormat(@NonNull Map<String, Object> map) { mMap = map; } diff --git a/media/java/android/media/browse/OWNERS b/media/java/android/media/browse/OWNERS deleted file mode 100644 index 916fc36ffbc6..000000000000 --- a/media/java/android/media/browse/OWNERS +++ /dev/null @@ -1,8 +0,0 @@ -# Bug component: 137631 - -hdmoon@google.com -insun@google.com -jaewan@google.com -jinpark@google.com -klhyun@google.com -gyumin@google.com diff --git a/media/java/android/media/session/OWNERS b/media/java/android/media/session/OWNERS deleted file mode 100644 index 916fc36ffbc6..000000000000 --- a/media/java/android/media/session/OWNERS +++ /dev/null @@ -1,8 +0,0 @@ -# Bug component: 137631 - -hdmoon@google.com -insun@google.com -jaewan@google.com -jinpark@google.com -klhyun@google.com -gyumin@google.com diff --git a/media/jni/soundpool/android_media_SoundPool.cpp b/media/jni/soundpool/android_media_SoundPool.cpp index 25040a942061..e872a58c96cf 100644 --- a/media/jni/soundpool/android_media_SoundPool.cpp +++ b/media/jni/soundpool/android_media_SoundPool.cpp @@ -86,7 +86,7 @@ public: } // Retrieves the associated object, returns nullValue T if not available. - T get(JNIEnv *env, jobject thiz) { + T get(JNIEnv *env, jobject thiz) const { std::lock_guard lg(mLock); // NOLINTNEXTLINE(performance-no-int-to-ptr) auto ptr = reinterpret_cast<T*>(env->GetLongField(thiz, mFieldId)); @@ -167,8 +167,10 @@ private: // is possible by checking if the WeakGlobalRef is null equivalent. auto& getSoundPoolManager() { - static ObjectManager<std::shared_ptr<SoundPool>> soundPoolManager(fields.mNativeContext); - return soundPoolManager; + // never-delete singleton + static auto soundPoolManager = + new ObjectManager<std::shared_ptr<SoundPool>>(fields.mNativeContext); + return *soundPoolManager; } inline auto getSoundPool(JNIEnv *env, jobject thiz) { @@ -274,8 +276,9 @@ static_assert(std::is_same_v<JWeakValue*, jweak>); auto& getSoundPoolJavaRefManager() { // Note this can store shared_ptrs to either jweak and jobject, // as the underlying type is identical. - static ConcurrentHashMap<SoundPool *, std::shared_ptr<JWeakValue>> concurrentHashMap; - return concurrentHashMap; + static auto concurrentHashMap = + new ConcurrentHashMap<SoundPool *, std::shared_ptr<JWeakValue>>(); + return *concurrentHashMap; } // make_shared_globalref_from_localref() creates a sharable Java global diff --git a/nfc/Android.bp b/nfc/Android.bp index 2090d3397dfe..3909e1d3b807 100644 --- a/nfc/Android.bp +++ b/nfc/Android.bp @@ -69,6 +69,9 @@ java_sdk_library { lint: { strict_updatability_linting: true, }, + aconfig_declarations: [ + "android.nfc.flags-aconfig", + ], } filegroup { diff --git a/packages/CrashRecovery/OWNERS b/packages/CrashRecovery/OWNERS index daa02111f71f..8337fd2453df 100644 --- a/packages/CrashRecovery/OWNERS +++ b/packages/CrashRecovery/OWNERS @@ -1,3 +1 @@ -ancr@google.com -harshitmahajan@google.com -robertogil@google.com +include /services/core/java/com/android/server/crashrecovery/OWNERS
\ No newline at end of file diff --git a/packages/CrashRecovery/services/java/com/android/server/PackageWatchdog.java b/packages/CrashRecovery/services/java/com/android/server/PackageWatchdog.java index 5d71b7d98fdc..37b5d408a508 100644 --- a/packages/CrashRecovery/services/java/com/android/server/PackageWatchdog.java +++ b/packages/CrashRecovery/services/java/com/android/server/PackageWatchdog.java @@ -38,15 +38,15 @@ import android.text.TextUtils; import android.util.ArrayMap; import android.util.ArraySet; import android.util.AtomicFile; -import android.util.BackgroundThread; -import android.util.LongArrayQueue; import android.util.Slog; import android.util.Xml; +import android.utils.BackgroundThread; +import android.utils.LongArrayQueue; +import android.utils.XmlUtils; import com.android.internal.annotations.GuardedBy; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.util.IndentingPrintWriter; -import com.android.internal.util.XmlUtils; import com.android.modules.utils.TypedXmlPullParser; import com.android.modules.utils.TypedXmlSerializer; diff --git a/packages/CrashRecovery/services/java/com/android/server/RescueParty.java b/packages/CrashRecovery/services/java/com/android/server/RescueParty.java index 9217e7012e7e..7bdc1a0e3ac7 100644 --- a/packages/CrashRecovery/services/java/com/android/server/RescueParty.java +++ b/packages/CrashRecovery/services/java/com/android/server/RescueParty.java @@ -29,7 +29,6 @@ import android.content.pm.PackageManager; import android.content.pm.VersionedPackage; import android.os.Build; import android.os.Environment; -import android.os.FileUtils; import android.os.PowerManager; import android.os.RecoverySystem; import android.os.SystemClock; @@ -42,10 +41,11 @@ import android.text.TextUtils; import android.util.ArraySet; import android.util.Log; import android.util.Slog; +import android.utils.ArrayUtils; +import android.utils.FileUtils; import com.android.internal.annotations.GuardedBy; import com.android.internal.annotations.VisibleForTesting; -import com.android.internal.util.ArrayUtils; import com.android.server.PackageWatchdog.FailureReasons; import com.android.server.PackageWatchdog.PackageHealthObserver; import com.android.server.PackageWatchdog.PackageHealthObserverImpact; @@ -163,10 +163,8 @@ public class RescueParty { * Check if we're currently attempting to reboot for a factory reset. This method must * return true if RescueParty tries to reboot early during a boot loop, since the device * will not be fully booted at this time. - * - * TODO(gavincorkery): Rename method since its scope has expanded. */ - public static boolean isAttemptingFactoryReset() { + public static boolean isRecoveryTriggeredReboot() { return isFactoryResetPropertySet() || isRebootPropertySet(); } @@ -707,7 +705,7 @@ public class RescueParty { if (pm.getModuleInfo(packageName, 0) != null) { return true; } - } catch (PackageManager.NameNotFoundException ignore) { + } catch (PackageManager.NameNotFoundException | IllegalStateException ignore) { } return isPersistentSystemApp(packageName); diff --git a/packages/CrashRecovery/services/java/com/android/utils/ArrayUtils.java b/packages/CrashRecovery/services/java/com/android/utils/ArrayUtils.java new file mode 100644 index 000000000000..fa4d6afc03d3 --- /dev/null +++ b/packages/CrashRecovery/services/java/com/android/utils/ArrayUtils.java @@ -0,0 +1,115 @@ +/* + * Copyright (C) 2024 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.utils; + +import android.annotation.NonNull; +import android.annotation.Nullable; + +import java.io.File; +import java.util.List; +import java.util.Objects; + +/** + * Copied over from frameworks/base/core/java/com/android/internal/util/ArrayUtils.java + * + * @hide + */ +public class ArrayUtils { + private ArrayUtils() { /* cannot be instantiated */ } + public static final File[] EMPTY_FILE = new File[0]; + + + /** + * Return first index of {@code value} in {@code array}, or {@code -1} if + * not found. + */ + public static <T> int indexOf(@Nullable T[] array, T value) { + if (array == null) return -1; + for (int i = 0; i < array.length; i++) { + if (Objects.equals(array[i], value)) return i; + } + return -1; + } + + /** @hide */ + public static @NonNull File[] defeatNullable(@Nullable File[] val) { + return (val != null) ? val : EMPTY_FILE; + } + + /** + * Checks if given array is null or has zero elements. + */ + public static boolean isEmpty(@Nullable int[] array) { + return array == null || array.length == 0; + } + + /** + * True if the byte array is null or has length 0. + */ + public static boolean isEmpty(@Nullable byte[] array) { + return array == null || array.length == 0; + } + + /** + * Converts from List of bytes to byte array + * @param list + * @return byte[] + */ + public static byte[] toPrimitive(List<byte[]> list) { + if (list.size() == 0) { + return new byte[0]; + } + int byteLen = list.get(0).length; + byte[] array = new byte[list.size() * byteLen]; + for (int i = 0; i < list.size(); i++) { + for (int j = 0; j < list.get(i).length; j++) { + array[i * byteLen + j] = list.get(i)[j]; + } + } + return array; + } + + /** + * Adds value to given array if not already present, providing set-like + * behavior. + */ + public static @NonNull int[] appendInt(@Nullable int[] cur, int val) { + return appendInt(cur, val, false); + } + + /** + * Adds value to given array. + */ + public static @NonNull int[] appendInt(@Nullable int[] cur, int val, + boolean allowDuplicates) { + if (cur == null) { + return new int[] { val }; + } + final int n = cur.length; + if (!allowDuplicates) { + for (int i = 0; i < n; i++) { + if (cur[i] == val) { + return cur; + } + } + } + int[] ret = new int[n + 1]; + System.arraycopy(cur, 0, ret, 0, n); + ret[n] = val; + return ret; + } +} diff --git a/packages/CrashRecovery/services/java/com/android/util/BackgroundThread.java b/packages/CrashRecovery/services/java/com/android/utils/BackgroundThread.java index a6ae68f62f10..afcf6895fd0d 100644 --- a/packages/CrashRecovery/services/java/com/android/util/BackgroundThread.java +++ b/packages/CrashRecovery/services/java/com/android/utils/BackgroundThread.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package android.util; +package android.utils; import android.annotation.NonNull; import android.os.Handler; diff --git a/packages/CrashRecovery/services/java/com/android/utils/FileUtils.java b/packages/CrashRecovery/services/java/com/android/utils/FileUtils.java new file mode 100644 index 000000000000..e4923bfc4ecb --- /dev/null +++ b/packages/CrashRecovery/services/java/com/android/utils/FileUtils.java @@ -0,0 +1,128 @@ +/* + * Copyright (C) 2024 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.utils; + +import android.annotation.NonNull; +import android.annotation.Nullable; + +import java.io.BufferedInputStream; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; + +/** + * Bits and pieces copied from hidden API of android.os.FileUtils. + * + * @hide + */ +public class FileUtils { + /** + * Read a text file into a String, optionally limiting the length. + * + * @param file to read (will not seek, so things like /proc files are OK) + * @param max length (positive for head, negative of tail, 0 for no limit) + * @param ellipsis to add of the file was truncated (can be null) + * @return the contents of the file, possibly truncated + * @throws IOException if something goes wrong reading the file + * @hide + */ + public static @Nullable String readTextFile(@Nullable File file, @Nullable int max, + @Nullable String ellipsis) throws IOException { + InputStream input = new FileInputStream(file); + // wrapping a BufferedInputStream around it because when reading /proc with unbuffered + // input stream, bytes read not equal to buffer size is not necessarily the correct + // indication for EOF; but it is true for BufferedInputStream due to its implementation. + BufferedInputStream bis = new BufferedInputStream(input); + try { + long size = file.length(); + if (max > 0 || (size > 0 && max == 0)) { // "head" mode: read the first N bytes + if (size > 0 && (max == 0 || size < max)) max = (int) size; + byte[] data = new byte[max + 1]; + int length = bis.read(data); + if (length <= 0) return ""; + if (length <= max) return new String(data, 0, length); + if (ellipsis == null) return new String(data, 0, max); + return new String(data, 0, max) + ellipsis; + } else if (max < 0) { // "tail" mode: keep the last N + int len; + boolean rolled = false; + byte[] last = null; + byte[] data = null; + do { + if (last != null) rolled = true; + byte[] tmp = last; + last = data; + data = tmp; + if (data == null) data = new byte[-max]; + len = bis.read(data); + } while (len == data.length); + + if (last == null && len <= 0) return ""; + if (last == null) return new String(data, 0, len); + if (len > 0) { + rolled = true; + System.arraycopy(last, len, last, 0, last.length - len); + System.arraycopy(data, 0, last, last.length - len, len); + } + if (ellipsis == null || !rolled) return new String(last); + return ellipsis + new String(last); + } else { // "cat" mode: size unknown, read it all in streaming fashion + ByteArrayOutputStream contents = new ByteArrayOutputStream(); + int len; + byte[] data = new byte[1024]; + do { + len = bis.read(data); + if (len > 0) contents.write(data, 0, len); + } while (len == data.length); + return contents.toString(); + } + } finally { + bis.close(); + input.close(); + } + } + + /** + * Perform an fsync on the given FileOutputStream. The stream at this + * point must be flushed but not yet closed. + * + * @hide + */ + public static boolean sync(FileOutputStream stream) { + try { + if (stream != null) { + stream.getFD().sync(); + } + return true; + } catch (IOException e) { + } + return false; + } + + /** + * List the files in the directory or return empty file. + * + * @hide + */ + public static @NonNull File[] listFilesOrEmpty(@Nullable File dir) { + return (dir != null) ? ArrayUtils.defeatNullable(dir.listFiles()) + : ArrayUtils.EMPTY_FILE; + } +} diff --git a/packages/CrashRecovery/services/java/com/android/util/HandlerExecutor.java b/packages/CrashRecovery/services/java/com/android/utils/HandlerExecutor.java index 948ebcca0263..fdb15e2333d5 100644 --- a/packages/CrashRecovery/services/java/com/android/util/HandlerExecutor.java +++ b/packages/CrashRecovery/services/java/com/android/utils/HandlerExecutor.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package android.util; +package android.utils; import android.annotation.NonNull; import android.os.Handler; diff --git a/packages/CrashRecovery/services/java/com/android/utils/LongArrayQueue.java b/packages/CrashRecovery/services/java/com/android/utils/LongArrayQueue.java new file mode 100644 index 000000000000..5cdc2536129a --- /dev/null +++ b/packages/CrashRecovery/services/java/com/android/utils/LongArrayQueue.java @@ -0,0 +1,188 @@ +/* + * Copyright (C) 2024 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.utils; + +import libcore.util.EmptyArray; + +import java.util.NoSuchElementException; + +/** + * Copied from frameworks/base/core/java/android/util/LongArrayQueue.java + * + * @hide + */ +public class LongArrayQueue { + + private long[] mValues; + private int mSize; + private int mHead; + private int mTail; + + private long[] newUnpaddedLongArray(int num) { + return new long[num]; + } + /** + * Initializes a queue with the given starting capacity. + * + * @param initialCapacity the capacity. + */ + public LongArrayQueue(int initialCapacity) { + if (initialCapacity == 0) { + mValues = EmptyArray.LONG; + } else { + mValues = newUnpaddedLongArray(initialCapacity); + } + mSize = 0; + mHead = mTail = 0; + } + + /** + * Initializes a queue with default starting capacity. + */ + public LongArrayQueue() { + this(16); + } + + /** @hide */ + public static int growSize(int currentSize) { + return currentSize <= 4 ? 8 : currentSize * 2; + } + + private void grow() { + if (mSize < mValues.length) { + throw new IllegalStateException("Queue not full yet!"); + } + final int newSize = growSize(mSize); + final long[] newArray = newUnpaddedLongArray(newSize); + final int r = mValues.length - mHead; // Number of elements on and to the right of head. + System.arraycopy(mValues, mHead, newArray, 0, r); + System.arraycopy(mValues, 0, newArray, r, mHead); + mValues = newArray; + mHead = 0; + mTail = mSize; + } + + /** + * Returns the number of elements in the queue. + */ + public int size() { + return mSize; + } + + /** + * Removes all elements from this queue. + */ + public void clear() { + mSize = 0; + mHead = mTail = 0; + } + + /** + * Adds a value to the tail of the queue. + * + * @param value the value to be added. + */ + public void addLast(long value) { + if (mSize == mValues.length) { + grow(); + } + mValues[mTail] = value; + mTail = (mTail + 1) % mValues.length; + mSize++; + } + + /** + * Removes an element from the head of the queue. + * + * @return the element at the head of the queue. + * @throws NoSuchElementException if the queue is empty. + */ + public long removeFirst() { + if (mSize == 0) { + throw new NoSuchElementException("Queue is empty!"); + } + final long ret = mValues[mHead]; + mHead = (mHead + 1) % mValues.length; + mSize--; + return ret; + } + + /** + * Returns the element at the given position from the head of the queue, where 0 represents the + * head of the queue. + * + * @param position the position from the head of the queue. + * @return the element found at the given position. + * @throws IndexOutOfBoundsException if {@code position} < {@code 0} or + * {@code position} >= {@link #size()} + */ + public long get(int position) { + if (position < 0 || position >= mSize) { + throw new IndexOutOfBoundsException("Index " + position + + " not valid for a queue of size " + mSize); + } + final int index = (mHead + position) % mValues.length; + return mValues[index]; + } + + /** + * Returns the element at the head of the queue, without removing it. + * + * @return the element at the head of the queue. + * @throws NoSuchElementException if the queue is empty + */ + public long peekFirst() { + if (mSize == 0) { + throw new NoSuchElementException("Queue is empty!"); + } + return mValues[mHead]; + } + + /** + * Returns the element at the tail of the queue. + * + * @return the element at the tail of the queue. + * @throws NoSuchElementException if the queue is empty. + */ + public long peekLast() { + if (mSize == 0) { + throw new NoSuchElementException("Queue is empty!"); + } + final int index = (mTail == 0) ? mValues.length - 1 : mTail - 1; + return mValues[index]; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + if (mSize <= 0) { + return "{}"; + } + + final StringBuilder buffer = new StringBuilder(mSize * 64); + buffer.append('{'); + buffer.append(get(0)); + for (int i = 1; i < mSize; i++) { + buffer.append(", "); + buffer.append(get(i)); + } + buffer.append('}'); + return buffer.toString(); + } +} diff --git a/packages/CrashRecovery/services/java/com/android/utils/XmlUtils.java b/packages/CrashRecovery/services/java/com/android/utils/XmlUtils.java new file mode 100644 index 000000000000..dbbef61f6777 --- /dev/null +++ b/packages/CrashRecovery/services/java/com/android/utils/XmlUtils.java @@ -0,0 +1,118 @@ +/* + * Copyright (C) 2024 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.utils; + +import android.annotation.NonNull; +import android.system.ErrnoException; +import android.system.Os; + +import com.android.modules.utils.TypedXmlPullParser; + +import libcore.util.XmlObjectFactory; + +import org.xmlpull.v1.XmlPullParser; +import org.xmlpull.v1.XmlPullParserException; + +import java.io.BufferedInputStream; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; + +/** + * Copied over partly from frameworks/base/core/java/com/android/internal/util/XmlUtils.java + * + * @hide + */ +public class XmlUtils { + + private static final String STRING_ARRAY_SEPARATOR = ":"; + + /** @hide */ + public static final void beginDocument(XmlPullParser parser, String firstElementName) + throws XmlPullParserException, IOException { + int type; + while ((type = parser.next()) != parser.START_TAG + && type != parser.END_DOCUMENT) { + // Do nothing + } + + if (type != parser.START_TAG) { + throw new XmlPullParserException("No start tag found"); + } + + if (!parser.getName().equals(firstElementName)) { + throw new XmlPullParserException("Unexpected start tag: found " + parser.getName() + + ", expected " + firstElementName); + } + } + + /** @hide */ + public static boolean nextElementWithin(XmlPullParser parser, int outerDepth) + throws IOException, XmlPullParserException { + for (;;) { + int type = parser.next(); + if (type == XmlPullParser.END_DOCUMENT + || (type == XmlPullParser.END_TAG && parser.getDepth() == outerDepth)) { + return false; + } + if (type == XmlPullParser.START_TAG + && parser.getDepth() == outerDepth + 1) { + return true; + } + } + } + + private static XmlPullParser newPullParser() { + try { + XmlPullParser parser = XmlObjectFactory.newXmlPullParser(); + parser.setFeature(XmlPullParser.FEATURE_PROCESS_DOCDECL, true); + parser.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, true); + return parser; + } catch (XmlPullParserException e) { + throw new AssertionError(); + } + } + + /** @hide */ + public static @NonNull TypedXmlPullParser resolvePullParser(@NonNull InputStream in) + throws IOException { + final byte[] magic = new byte[4]; + if (in instanceof FileInputStream) { + try { + Os.pread(((FileInputStream) in).getFD(), magic, 0, magic.length, 0); + } catch (ErrnoException e) { + throw e.rethrowAsIOException(); + } + } else { + if (!in.markSupported()) { + in = new BufferedInputStream(in); + } + in.mark(8); + in.read(magic); + in.reset(); + } + + final TypedXmlPullParser xml; + xml = (TypedXmlPullParser) newPullParser(); + try { + xml.setInput(in, "UTF_8"); + } catch (XmlPullParserException e) { + throw new IOException(e); + } + return xml; + } +} diff --git a/packages/SettingsLib/tests/robotests/src/com/android/settingslib/bluetooth/VolumeControlProfileTest.java b/packages/SettingsLib/tests/robotests/src/com/android/settingslib/bluetooth/VolumeControlProfileTest.java index fe1529d11cd8..9c518de18582 100644 --- a/packages/SettingsLib/tests/robotests/src/com/android/settingslib/bluetooth/VolumeControlProfileTest.java +++ b/packages/SettingsLib/tests/robotests/src/com/android/settingslib/bluetooth/VolumeControlProfileTest.java @@ -192,7 +192,7 @@ public class VolumeControlProfileTest { mServiceListener.onServiceConnected(BluetoothProfile.VOLUME_CONTROL, mService); final Executor executor = (command -> new Thread(command).start()); - final BluetoothVolumeControl.Callback callback = (device, volumeOffset) -> {}; + final BluetoothVolumeControl.Callback callback = new BluetoothVolumeControl.Callback() {}; mProfile.registerCallback(executor, callback); verify(mService).registerCallback(executor, callback); @@ -200,7 +200,7 @@ public class VolumeControlProfileTest { @Test public void unregisterCallback_verifyIsCalled() { - final BluetoothVolumeControl.Callback callback = (device, volumeOffset) -> {}; + final BluetoothVolumeControl.Callback callback = new BluetoothVolumeControl.Callback() {}; mServiceListener.onServiceConnected(BluetoothProfile.VOLUME_CONTROL, mService); mProfile.unregisterCallback(callback); diff --git a/packages/SystemUI/Android.bp b/packages/SystemUI/Android.bp index 62b8cb73af48..f8e207c8061a 100644 --- a/packages/SystemUI/Android.bp +++ b/packages/SystemUI/Android.bp @@ -214,6 +214,8 @@ android_library { javacflags: [ "-Adagger.fastInit=enabled", + "-Adagger.explicitBindingConflictsWithInject=ERROR", + "-Adagger.strictMultibindingValidation=enabled", "-Aroom.schemaLocation=frameworks/base/packages/SystemUI/schemas", ], kotlincflags: ["-Xjvm-default=all"], @@ -333,6 +335,7 @@ android_library { "platform-test-annotations", "notification_flags_lib", ], + skip_jarjar_repackage: true, } android_library { @@ -382,6 +385,7 @@ android_library { test: true, extra_check_modules: ["SystemUILintChecker"], }, + skip_jarjar_repackage: true, } android_app { diff --git a/packages/SystemUI/src/com/android/systemui/dagger/ReferenceSystemUIModule.java b/packages/SystemUI/src/com/android/systemui/dagger/ReferenceSystemUIModule.java index 236c5b8ed2d7..cc5be8d0b47e 100644 --- a/packages/SystemUI/src/com/android/systemui/dagger/ReferenceSystemUIModule.java +++ b/packages/SystemUI/src/com/android/systemui/dagger/ReferenceSystemUIModule.java @@ -59,6 +59,7 @@ import com.android.systemui.statusbar.policy.IndividualSensorPrivacyController; import com.android.systemui.statusbar.policy.IndividualSensorPrivacyControllerImpl; import com.android.systemui.statusbar.policy.SensorPrivacyController; import com.android.systemui.statusbar.policy.SensorPrivacyControllerImpl; +import com.android.systemui.unfold.UnfoldTransitionModule; import com.android.systemui.volume.dagger.VolumeModule; import com.android.systemui.wallpapers.dagger.WallpaperModule; @@ -99,6 +100,7 @@ import javax.inject.Named; RotationLockModule.class, SceneContainerFrameworkModule.class, StartCentralSurfacesModule.class, + UnfoldTransitionModule.Startables.class, VolumeModule.class, WallpaperModule.class, KeyboardShortcutsModule.class diff --git a/packages/SystemUI/src/com/android/systemui/unfold/SysUIUnfoldModule.kt b/packages/SystemUI/src/com/android/systemui/unfold/SysUIUnfoldModule.kt index 10fc83c8b82c..8cbe9c5e56cf 100644 --- a/packages/SystemUI/src/com/android/systemui/unfold/SysUIUnfoldModule.kt +++ b/packages/SystemUI/src/com/android/systemui/unfold/SysUIUnfoldModule.kt @@ -26,7 +26,6 @@ import com.android.systemui.unfold.util.ScopedUnfoldTransitionProgressProvider import com.android.systemui.unfold.util.UnfoldKeyguardVisibilityManager import com.android.systemui.util.kotlin.getOrNull import dagger.BindsInstance -import dagger.Lazy import dagger.Module import dagger.Provides import dagger.Subcomponent @@ -34,7 +33,9 @@ import java.util.Optional import javax.inject.Named import javax.inject.Scope -@Scope @MustBeDocumented @Retention(AnnotationRetention.RUNTIME) annotation class SysUIUnfoldScope +@Scope @MustBeDocumented +@Retention(AnnotationRetention.RUNTIME) +annotation class SysUIUnfoldScope /** * Creates an injectable [SysUIUnfoldComponent] that provides objects that have been scoped with @@ -49,7 +50,6 @@ import javax.inject.Scope */ @Module(subcomponents = [SysUIUnfoldComponent::class]) class SysUIUnfoldModule { - @Provides @SysUISingleton fun provideSysUIUnfoldComponent( @@ -57,8 +57,7 @@ class SysUIUnfoldModule { rotationProvider: Optional<NaturalRotationUnfoldProgressProvider>, @Named(UNFOLD_STATUS_BAR) scopedProvider: Optional<ScopedUnfoldTransitionProgressProvider>, @UnfoldBg bgProvider: Optional<UnfoldTransitionProgressProvider>, - unfoldLatencyTracker: Lazy<UnfoldLatencyTracker>, - factory: SysUIUnfoldComponent.Factory + factory: SysUIUnfoldComponent.Factory, ): Optional<SysUIUnfoldComponent> { val p1 = provider.getOrNull() val p2 = rotationProvider.getOrNull() @@ -67,7 +66,7 @@ class SysUIUnfoldModule { return if (p1 == null || p2 == null || p3 == null || p4 == null) { Optional.empty() } else { - Optional.of(factory.create(p1, p2, p3, p4, unfoldLatencyTracker.get())) + Optional.of(factory.create(p1, p2, p3, p4)) } } } @@ -75,7 +74,6 @@ class SysUIUnfoldModule { @SysUIUnfoldScope @Subcomponent interface SysUIUnfoldComponent { - @Subcomponent.Factory interface Factory { fun create( @@ -83,7 +81,6 @@ interface SysUIUnfoldComponent { @BindsInstance p2: NaturalRotationUnfoldProgressProvider, @BindsInstance p3: ScopedUnfoldTransitionProgressProvider, @BindsInstance @UnfoldBg p4: UnfoldTransitionProgressProvider, - @BindsInstance p5: UnfoldLatencyTracker, ): SysUIUnfoldComponent } diff --git a/packages/SystemUI/src/com/android/systemui/unfold/UnfoldTransitionModule.kt b/packages/SystemUI/src/com/android/systemui/unfold/UnfoldTransitionModule.kt index 50515daedc51..3c55ce912072 100644 --- a/packages/SystemUI/src/com/android/systemui/unfold/UnfoldTransitionModule.kt +++ b/packages/SystemUI/src/com/android/systemui/unfold/UnfoldTransitionModule.kt @@ -170,14 +170,17 @@ class UnfoldTransitionModule { @Module interface Bindings { + @Binds fun bindRepository(impl: UnfoldTransitionRepositoryImpl): UnfoldTransitionRepository + + @Binds fun bindInteractor(impl: UnfoldTransitionInteractorImpl): UnfoldTransitionInteractor + } + + @Module + interface Startables { @Binds @IntoMap @ClassKey(UnfoldTraceLogger::class) fun bindUnfoldTraceLogger(impl: UnfoldTraceLogger): CoreStartable - - @Binds fun bindRepository(impl: UnfoldTransitionRepositoryImpl): UnfoldTransitionRepository - - @Binds fun bindInteractor(impl: UnfoldTransitionInteractorImpl): UnfoldTransitionInteractor } } diff --git a/packages/Tethering/OWNERS b/packages/Tethering/OWNERS deleted file mode 100644 index aa87958f1d53..000000000000 --- a/packages/Tethering/OWNERS +++ /dev/null @@ -1 +0,0 @@ -include /services/core/java/com/android/server/net/OWNERS diff --git a/services/accessibility/OWNERS b/services/accessibility/OWNERS index 6e76a207e06f..0e35a409c82c 100644 --- a/services/accessibility/OWNERS +++ b/services/accessibility/OWNERS @@ -1,6 +1,13 @@ -pweaver@google.com -sallyyuen@google.com -ryanlwlin@google.com -fuego@google.com +# Bug component: 44215 + +# Android Accessibility Framework owners danielnorman@google.com aarmaly@google.com +chunkulin@google.com +fuego@google.com +sallyyuen@google.com + +# Android Accessibility members who have OWNERS but should not be sent +# day-to-day changes for code review: +pweaver@google.com #{LAST_RESORT_SUGGESTION} +ryanlwlin@google.com #{LAST_RESORT_SUGGESTION}
\ No newline at end of file diff --git a/services/accessibility/java/com/android/server/accessibility/gestures/TouchState.java b/services/accessibility/java/com/android/server/accessibility/gestures/TouchState.java index d9e25ef7dcdc..e13994e75690 100644 --- a/services/accessibility/java/com/android/server/accessibility/gestures/TouchState.java +++ b/services/accessibility/java/com/android/server/accessibility/gestures/TouchState.java @@ -525,8 +525,9 @@ public class TouchState { mReceivedPointersDown |= pointerFlag; mReceivedPointers[pointerId].set( event.getX(pointerIndex), event.getY(pointerIndex), event.getEventTime()); - - mPrimaryPointerId = pointerId; + if (event.getActionMasked() == MotionEvent.ACTION_DOWN) { + mPrimaryPointerId = pointerId; + } } /** diff --git a/services/backup/BACKUP_OWNERS b/services/backup/BACKUP_OWNERS index f8f4f4f4bf2e..29ae2027fc3a 100644 --- a/services/backup/BACKUP_OWNERS +++ b/services/backup/BACKUP_OWNERS @@ -2,9 +2,10 @@ jstemmer@google.com martinoh@google.com -millmore@google.com niamhfw@google.com piee@google.com philippov@google.com rthakohov@google.com -sarpm@google.com
\ No newline at end of file +sarpm@google.com +beatricemarch@google.com +azilio@google.com
\ No newline at end of file diff --git a/services/core/java/com/android/server/crashrecovery/CrashRecoveryHelper.java b/services/core/java/com/android/server/crashrecovery/CrashRecoveryHelper.java new file mode 100644 index 000000000000..133c79f81bb5 --- /dev/null +++ b/services/core/java/com/android/server/crashrecovery/CrashRecoveryHelper.java @@ -0,0 +1,129 @@ +/* + * 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.server.crashrecovery; + +import android.annotation.AnyThread; +import android.annotation.NonNull; +import android.annotation.Nullable; +import android.content.Context; +import android.content.pm.PackageInfo; +import android.content.pm.PackageManager; +import android.content.pm.VersionedPackage; +import android.net.ConnectivityModuleConnector; +import android.text.TextUtils; +import android.util.Slog; + +import com.android.server.PackageWatchdog; +import com.android.server.pm.ApexManager; + +import java.util.Collections; +import java.util.List; + +/** + * Provides helper methods for the CrashRecovery APEX + * + * @hide + */ +public final class CrashRecoveryHelper { + private static final String TAG = "CrashRecoveryHelper"; + + private final ApexManager mApexManager; + private final Context mContext; + private final ConnectivityModuleConnector mConnectivityModuleConnector; + + + /** @hide */ + public CrashRecoveryHelper(@NonNull Context context) { + mContext = context; + mApexManager = ApexManager.getInstance(); + mConnectivityModuleConnector = ConnectivityModuleConnector.getInstance(); + } + + /** + * Returns true if the package name is the name of a module. + * If the package is an APK inside an APEX then it will use the parent's APEX package name + * do determine if it is a module or not. + * @hide + */ + @AnyThread + public boolean isModule(@NonNull String packageName) { + String apexPackageName = + mApexManager.getActiveApexPackageNameContainingPackage(packageName); + if (apexPackageName != null) { + packageName = apexPackageName; + } + + PackageManager pm = mContext.getPackageManager(); + try { + return pm.getModuleInfo(packageName, 0) != null; + } catch (PackageManager.NameNotFoundException ignore) { + return false; + } + } + + /** + * Register health listeners for explicit package failures. + * Currently only registering for Connectivity Module health. + * @hide + */ + public void registerConnectivityModuleHealthListener(@NonNull int failureReason) { + // register listener for ConnectivityModule + mConnectivityModuleConnector.registerHealthListener( + packageName -> { + final VersionedPackage pkg = getVersionedPackage(packageName); + if (pkg == null) { + Slog.wtf(TAG, "NetworkStack failed but could not find its package"); + return; + } + final List<VersionedPackage> pkgList = Collections.singletonList(pkg); + PackageWatchdog.getInstance(mContext).onPackageFailure(pkgList, failureReason); + }); + } + + @Nullable + private VersionedPackage getVersionedPackage(String packageName) { + final PackageManager pm = mContext.getPackageManager(); + if (pm == null || TextUtils.isEmpty(packageName)) { + return null; + } + try { + final long versionCode = getPackageInfo(packageName).getLongVersionCode(); + return new VersionedPackage(packageName, versionCode); + } catch (PackageManager.NameNotFoundException e) { + return null; + } + } + + /** + * Gets PackageInfo for the given package. Matches any user and apex. + * + * @throws PackageManager.NameNotFoundException if no such package is installed. + */ + private PackageInfo getPackageInfo(String packageName) + throws PackageManager.NameNotFoundException { + PackageManager pm = mContext.getPackageManager(); + try { + // The MATCH_ANY_USER flag doesn't mix well with the MATCH_APEX + // flag, so make two separate attempts to get the package info. + // We don't need both flags at the same time because we assume + // apex files are always installed for all users. + return pm.getPackageInfo(packageName, PackageManager.MATCH_ANY_USER); + } catch (PackageManager.NameNotFoundException e) { + return pm.getPackageInfo(packageName, PackageManager.MATCH_APEX); + } + } +} diff --git a/services/core/java/com/android/server/crashrecovery/OWNERS b/services/core/java/com/android/server/crashrecovery/OWNERS new file mode 100644 index 000000000000..daa02111f71f --- /dev/null +++ b/services/core/java/com/android/server/crashrecovery/OWNERS @@ -0,0 +1,3 @@ +ancr@google.com +harshitmahajan@google.com +robertogil@google.com diff --git a/services/core/java/com/android/server/net/NetworkPolicyManagerService.java b/services/core/java/com/android/server/net/NetworkPolicyManagerService.java index 2128cd14d65c..71ff52376b46 100644 --- a/services/core/java/com/android/server/net/NetworkPolicyManagerService.java +++ b/services/core/java/com/android/server/net/NetworkPolicyManagerService.java @@ -340,8 +340,6 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub { static final String TAG = NetworkPolicyLogger.TAG; private static final boolean LOGD = NetworkPolicyLogger.LOGD; private static final boolean LOGV = NetworkPolicyLogger.LOGV; - // TODO: b/304347838 - Remove once the feature is in staging. - private static final boolean ALWAYS_RESTRICT_BACKGROUND_NETWORK = false; /** * No opportunistic quota could be calculated from user data plan or data settings. @@ -1070,8 +1068,7 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub { } // The flag is boot-stable. - mBackgroundNetworkRestricted = ALWAYS_RESTRICT_BACKGROUND_NETWORK - && Flags.networkBlockedForTopSleepingAndAbove(); + mBackgroundNetworkRestricted = Flags.networkBlockedForTopSleepingAndAbove(); if (mBackgroundNetworkRestricted) { // Firewall rules and UidBlockedState will get updated in // updateRulesForGlobalChangeAL below. diff --git a/services/core/java/com/android/server/pm/UserRestrictionsUtils.java b/services/core/java/com/android/server/pm/UserRestrictionsUtils.java index 35861d79875d..7877d5d6ec2f 100644 --- a/services/core/java/com/android/server/pm/UserRestrictionsUtils.java +++ b/services/core/java/com/android/server/pm/UserRestrictionsUtils.java @@ -153,7 +153,8 @@ public class UserRestrictionsUtils { UserManager.DISALLOW_CELLULAR_2G, UserManager.DISALLOW_ULTRA_WIDEBAND_RADIO, UserManager.DISALLOW_CONFIG_DEFAULT_APPS, - UserManager.DISALLOW_NEAR_FIELD_COMMUNICATION_RADIO + UserManager.DISALLOW_NEAR_FIELD_COMMUNICATION_RADIO, + UserManager.DISALLOW_THREAD_NETWORK }); public static final Set<String> DEPRECATED_USER_RESTRICTIONS = Sets.newArraySet( @@ -204,7 +205,8 @@ public class UserRestrictionsUtils { UserManager.DISALLOW_ADD_WIFI_CONFIG, UserManager.DISALLOW_CELLULAR_2G, UserManager.DISALLOW_ULTRA_WIDEBAND_RADIO, - UserManager.DISALLOW_NEAR_FIELD_COMMUNICATION_RADIO + UserManager.DISALLOW_NEAR_FIELD_COMMUNICATION_RADIO, + UserManager.DISALLOW_THREAD_NETWORK ); /** @@ -248,7 +250,8 @@ public class UserRestrictionsUtils { UserManager.DISALLOW_ADD_WIFI_CONFIG, UserManager.DISALLOW_CELLULAR_2G, UserManager.DISALLOW_ULTRA_WIDEBAND_RADIO, - UserManager.DISALLOW_NEAR_FIELD_COMMUNICATION_RADIO + UserManager.DISALLOW_NEAR_FIELD_COMMUNICATION_RADIO, + UserManager.DISALLOW_THREAD_NETWORK ); /** diff --git a/services/core/java/com/android/server/power/PowerManagerService.java b/services/core/java/com/android/server/power/PowerManagerService.java index ec5172fca5fa..969784bcc4e7 100644 --- a/services/core/java/com/android/server/power/PowerManagerService.java +++ b/services/core/java/com/android/server/power/PowerManagerService.java @@ -3933,7 +3933,7 @@ public final class PowerManagerService extends SystemService UserspaceRebootLogger.noteUserspaceRebootWasRequested(); } if (mHandler == null || !mSystemReady) { - if (RescueParty.isAttemptingFactoryReset()) { + if (RescueParty.isRecoveryTriggeredReboot()) { // If we're stuck in a really low-level reboot loop, and a // rescue party is trying to prompt the user for a factory data // reset, we must GET TO DA CHOPPA! diff --git a/services/core/java/com/android/server/power/ShutdownThread.java b/services/core/java/com/android/server/power/ShutdownThread.java index 871e98bf4ab3..8ae515401c60 100644 --- a/services/core/java/com/android/server/power/ShutdownThread.java +++ b/services/core/java/com/android/server/power/ShutdownThread.java @@ -332,7 +332,7 @@ public final class ShutdownThread extends Thread { com.android.internal.R.string.reboot_to_update_reboot)); } } else if (mReason != null && mReason.equals(PowerManager.REBOOT_RECOVERY)) { - if (RescueParty.isAttemptingFactoryReset()) { + if (RescueParty.isRecoveryTriggeredReboot()) { // We're not actually doing a factory reset yet; we're rebooting // to ask the user if they'd like to reset, so give them a less // scary dialog message. diff --git a/services/core/java/com/android/server/rollback/OWNERS b/services/core/java/com/android/server/rollback/OWNERS index daa02111f71f..8337fd2453df 100644 --- a/services/core/java/com/android/server/rollback/OWNERS +++ b/services/core/java/com/android/server/rollback/OWNERS @@ -1,3 +1 @@ -ancr@google.com -harshitmahajan@google.com -robertogil@google.com +include /services/core/java/com/android/server/crashrecovery/OWNERS
\ No newline at end of file diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/PolicyDefinition.java b/services/devicepolicy/java/com/android/server/devicepolicy/PolicyDefinition.java index 0fc8c5e7a46a..260264d0fb9c 100644 --- a/services/devicepolicy/java/com/android/server/devicepolicy/PolicyDefinition.java +++ b/services/devicepolicy/java/com/android/server/devicepolicy/PolicyDefinition.java @@ -475,6 +475,10 @@ final class PolicyDefinition<V> { UserManager.DISALLOW_CELLULAR_2G, POLICY_FLAG_GLOBAL_ONLY_POLICY); USER_RESTRICTION_FLAGS.put( UserManager.DISALLOW_ULTRA_WIDEBAND_RADIO, POLICY_FLAG_GLOBAL_ONLY_POLICY); + if (com.android.net.thread.platform.flags.Flags.threadUserRestrictionEnabled()) { + USER_RESTRICTION_FLAGS.put( + UserManager.DISALLOW_THREAD_NETWORK, POLICY_FLAG_GLOBAL_ONLY_POLICY); + } for (String key : USER_RESTRICTION_FLAGS.keySet()) { createAndAddUserRestrictionPolicyDefinition(key, USER_RESTRICTION_FLAGS.get(key)); diff --git a/services/tests/PackageManagerServiceTests/server/Android.bp b/services/tests/PackageManagerServiceTests/server/Android.bp index 8d2541dca2df..dd3a4ca5a53c 100644 --- a/services/tests/PackageManagerServiceTests/server/Android.bp +++ b/services/tests/PackageManagerServiceTests/server/Android.bp @@ -94,7 +94,7 @@ android_test { "libutils", "netd_aidl_interface-V5-cpp", ], - + compile_multilib: "both", dxflags: ["--multi-dex"], java_resources: [ diff --git a/services/tests/VpnTests/Android.bp b/services/tests/VpnTests/Android.bp index 64a9a3b4f119..a5011a8d8b00 100644 --- a/services/tests/VpnTests/Android.bp +++ b/services/tests/VpnTests/Android.bp @@ -17,8 +17,7 @@ android_test { "java/**/*.java", "java/**/*.kt", ], - - defaults: ["framework-connectivity-test-defaults"], + sdk_version: "core_platform", // tests can use @CorePlatformApi's test_suites: ["device-tests"], static_libs: [ "androidx.test.rules", @@ -32,6 +31,13 @@ android_test { "service-connectivity-tiramisu-pre-jarjar", ], libs: [ + // order matters: classes in framework-connectivity are resolved before framework, + // meaning @hide APIs in framework-connectivity are resolved before @SystemApi + // stubs in framework + "framework-connectivity.impl", + "framework-connectivity-t.impl", + "framework", + "framework-res", "android.test.runner", "android.test.base", "android.test.mock", diff --git a/services/tests/mockingservicestests/src/com/android/server/RescuePartyTest.java b/services/tests/mockingservicestests/src/com/android/server/RescuePartyTest.java index 211a83d8588e..c30ac2d6c248 100644 --- a/services/tests/mockingservicestests/src/com/android/server/RescuePartyTest.java +++ b/services/tests/mockingservicestests/src/com/android/server/RescuePartyTest.java @@ -439,19 +439,19 @@ public class RescuePartyTest { } @Test - public void testIsAttemptingFactoryReset() { + public void testIsRecoveryTriggeredReboot() { for (int i = 0; i < LEVEL_FACTORY_RESET; i++) { noteBoot(i + 1); } assertFalse(RescueParty.isFactoryResetPropertySet()); setCrashRecoveryPropAttemptingReboot(false); noteBoot(LEVEL_FACTORY_RESET + 1); - assertTrue(RescueParty.isAttemptingFactoryReset()); + assertTrue(RescueParty.isRecoveryTriggeredReboot()); assertTrue(RescueParty.isFactoryResetPropertySet()); } @Test - public void testIsAttemptingFactoryResetOnlyAfterRebootCompleted() { + public void testIsRecoveryTriggeredRebootOnlyAfterRebootCompleted() { for (int i = 0; i < LEVEL_FACTORY_RESET; i++) { noteBoot(i + 1); } @@ -464,7 +464,7 @@ public class RescuePartyTest { noteBoot(mitigationCount++); setCrashRecoveryPropAttemptingReboot(false); noteBoot(mitigationCount + 1); - assertTrue(RescueParty.isAttemptingFactoryReset()); + assertTrue(RescueParty.isRecoveryTriggeredReboot()); assertTrue(RescueParty.isFactoryResetPropertySet()); } @@ -477,7 +477,7 @@ public class RescuePartyTest { for (int i = 1; i <= LEVEL_FACTORY_RESET; i++) { noteBoot(i); } - assertFalse(RescueParty.isAttemptingFactoryReset()); + assertFalse(RescueParty.isRecoveryTriggeredReboot()); } @Test @@ -489,7 +489,7 @@ public class RescuePartyTest { for (int i = 0; i <= LEVEL_FACTORY_RESET; i++) { noteAppCrash(i + 1, true); } - assertFalse(RescueParty.isAttemptingFactoryReset()); + assertFalse(RescueParty.isRecoveryTriggeredReboot()); } @Test @@ -501,7 +501,7 @@ public class RescuePartyTest { for (int i = 1; i <= LEVEL_FACTORY_RESET; i++) { noteBoot(i); } - assertTrue(RescueParty.isAttemptingFactoryReset()); + assertTrue(RescueParty.isRecoveryTriggeredReboot()); } @Test public void testNotThrottlingAfterTimeoutOnAppCrash() { @@ -512,7 +512,7 @@ public class RescuePartyTest { for (int i = 0; i <= LEVEL_FACTORY_RESET; i++) { noteAppCrash(i + 1, true); } - assertTrue(RescueParty.isAttemptingFactoryReset()); + assertTrue(RescueParty.isRecoveryTriggeredReboot()); } @Test diff --git a/services/tests/mockingservicestests/src/com/android/server/rollback/OWNERS b/services/tests/mockingservicestests/src/com/android/server/rollback/OWNERS index daa02111f71f..8337fd2453df 100644 --- a/services/tests/mockingservicestests/src/com/android/server/rollback/OWNERS +++ b/services/tests/mockingservicestests/src/com/android/server/rollback/OWNERS @@ -1,3 +1 @@ -ancr@google.com -harshitmahajan@google.com -robertogil@google.com +include /services/core/java/com/android/server/crashrecovery/OWNERS
\ No newline at end of file diff --git a/services/tests/servicestests/src/com/android/server/net/NetworkPolicyManagerServiceTest.java b/services/tests/servicestests/src/com/android/server/net/NetworkPolicyManagerServiceTest.java index ff19362061b6..a5f7963b9c96 100644 --- a/services/tests/servicestests/src/com/android/server/net/NetworkPolicyManagerServiceTest.java +++ b/services/tests/servicestests/src/com/android/server/net/NetworkPolicyManagerServiceTest.java @@ -206,7 +206,6 @@ import libcore.io.Streams; import org.junit.After; import org.junit.Assume; import org.junit.Before; -import org.junit.Ignore; import org.junit.Rule; import org.junit.Test; import org.junit.rules.MethodRule; @@ -2151,14 +2150,12 @@ public class NetworkPolicyManagerServiceTest { assertFalse(mService.isUidNetworkingBlocked(UID_E, false)); } - @Ignore("Temporarily disabled until the feature is enabled") @Test @RequiresFlagsEnabled(Flags.FLAG_NETWORK_BLOCKED_FOR_TOP_SLEEPING_AND_ABOVE) public void testBackgroundChainEnabled() throws Exception { verify(mNetworkManager).setFirewallChainEnabled(FIREWALL_CHAIN_BACKGROUND, true); } - @Ignore("Temporarily disabled until the feature is enabled") @Test @RequiresFlagsEnabled(Flags.FLAG_NETWORK_BLOCKED_FOR_TOP_SLEEPING_AND_ABOVE) public void testBackgroundChainOnProcStateChange() throws Exception { @@ -2188,7 +2185,6 @@ public class NetworkPolicyManagerServiceTest { assertTrue(mService.isUidNetworkingBlocked(UID_A, false)); } - @Ignore("Temporarily disabled until the feature is enabled") @Test @RequiresFlagsEnabled(Flags.FLAG_NETWORK_BLOCKED_FOR_TOP_SLEEPING_AND_ABOVE) public void testBackgroundChainOnAllowlistChange() throws Exception { @@ -2227,7 +2223,6 @@ public class NetworkPolicyManagerServiceTest { assertFalse(mService.isUidNetworkingBlocked(UID_B, false)); } - @Ignore("Temporarily disabled until the feature is enabled") @Test @RequiresFlagsEnabled(Flags.FLAG_NETWORK_BLOCKED_FOR_TOP_SLEEPING_AND_ABOVE) public void testBackgroundChainOnTempAllowlistChange() throws Exception { @@ -2266,7 +2261,6 @@ public class NetworkPolicyManagerServiceTest { && uidState.procState == procState && uidState.capability == capability; } - @Ignore("Temporarily disabled until the feature is enabled") @Test @RequiresFlagsEnabled(Flags.FLAG_NETWORK_BLOCKED_FOR_TOP_SLEEPING_AND_ABOVE) public void testUidObserverFiltersProcStateChanges() throws Exception { @@ -2329,7 +2323,6 @@ public class NetworkPolicyManagerServiceTest { waitForUidEventHandlerIdle(); } - @Ignore("Temporarily disabled until the feature is enabled") @Test @RequiresFlagsEnabled(Flags.FLAG_NETWORK_BLOCKED_FOR_TOP_SLEEPING_AND_ABOVE) public void testUidObserverFiltersStaleChanges() throws Exception { @@ -2350,7 +2343,6 @@ public class NetworkPolicyManagerServiceTest { waitForUidEventHandlerIdle(); } - @Ignore("Temporarily disabled until the feature is enabled") @Test @RequiresFlagsEnabled(Flags.FLAG_NETWORK_BLOCKED_FOR_TOP_SLEEPING_AND_ABOVE) public void testUidObserverFiltersCapabilityChanges() throws Exception { @@ -2430,7 +2422,6 @@ public class NetworkPolicyManagerServiceTest { assertFalse(mService.isUidNetworkingBlocked(UID_A, false)); } - @Ignore("Temporarily disabled until the feature is enabled") @Test @RequiresFlagsEnabled(Flags.FLAG_NETWORK_BLOCKED_FOR_TOP_SLEEPING_AND_ABOVE) public void testObsoleteHandleUidChanged() throws Exception { diff --git a/test-base/Android.bp b/test-base/Android.bp index 70a95400bd9e..d65a4e44440e 100644 --- a/test-base/Android.bp +++ b/test-base/Android.bp @@ -14,37 +14,22 @@ // limitations under the License. // +package { + default_applicable_licenses: ["Android-Apache-2.0"], +} + // Build the android.test.base library // =================================== // This contains the junit.framework and android.test classes that were in // Android API level 25 excluding those from android.test.runner. // Also contains the com.android.internal.util.Predicate[s] classes. -package { - // See: http://go/android-license-faq - // A large-scale-change added 'default_applicable_licenses' to import - // all of the 'license_kinds' from "frameworks_base_license" - // to get the below license kinds: - // SPDX-license-identifier-Apache-2.0 - // SPDX-license-identifier-CPL-1.0 - default_applicable_licenses: ["frameworks_base_test-base_license"], -} - -license { - name: "frameworks_base_test-base_license", - visibility: [":__subpackages__"], - license_kinds: [ - "SPDX-license-identifier-Apache-2.0", - "SPDX-license-identifier-CPL-1.0", - ], - license_text: [ - "src/junit/cpl-v10.html", - ], -} - java_sdk_library { name: "android.test.base", - srcs: [":android-test-base-sources"], + srcs: [ + ":android-test-base-sources", + ":frameworks-base-test-junit-framework", + ], errorprone: { javacflags: ["-Xep:DepAnn:ERROR"], @@ -84,7 +69,10 @@ java_library_static { ], installable: false, - srcs: [":android-test-base-sources"], + srcs: [ + ":android-test-base-sources", + ":frameworks-base-test-junit-framework", + ], errorprone: { javacflags: ["-Xep:DepAnn:ERROR"], @@ -104,8 +92,7 @@ java_library_static { name: "android.test.base-minus-junit", srcs: [ - "src/android/**/*.java", - "src/com/**/*.java", + "src/**/*.java", ], sdk_version: "current", diff --git a/test-base/hiddenapi/Android.bp b/test-base/hiddenapi/Android.bp index 1466590ef311..4c59b10ba423 100644 --- a/test-base/hiddenapi/Android.bp +++ b/test-base/hiddenapi/Android.bp @@ -15,12 +15,7 @@ // package { - // See: http://go/android-license-faq - // A large-scale-change added 'default_applicable_licenses' to import - // all of the 'license_kinds' from "frameworks_base_license" - // to get the below license kinds: - // SPDX-license-identifier-Apache-2.0 - default_applicable_licenses: ["frameworks_base_license"], + default_applicable_licenses: ["Android-Apache-2.0"], } // Provided solely to contribute information about which hidden parts of the android.test.base diff --git a/test-junit/Android.bp b/test-junit/Android.bp new file mode 100644 index 000000000000..8d3d439e034e --- /dev/null +++ b/test-junit/Android.bp @@ -0,0 +1,53 @@ +// +// 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 { + default_applicable_licenses: ["frameworks-base-test-junit-license"], +} + +license { + name: "frameworks-base-test-junit-license", + visibility: [":__subpackages__"], + license_kinds: [ + "SPDX-license-identifier-CPL-1.0", + ], + license_text: [ + "src/junit/cpl-v10.html", + ], +} + +filegroup { + name: "frameworks-base-test-junit-framework", + srcs: [ + "src/junit/framework/**/*.java", + ], + path: "src", + visibility: [ + "//frameworks/base/test-base", + ], +} + +filegroup { + name: "frameworks-base-test-junit-runner", + srcs: [ + "src/junit/runner/**/*.java", + "src/junit/textui/**/*.java", + ], + path: "src", + visibility: [ + "//frameworks/base/test-runner", + ], +} diff --git a/test-base/src/junit/MODULE_LICENSE_CPL b/test-junit/src/junit/MODULE_LICENSE_CPL index e69de29bb2d1..e69de29bb2d1 100644 --- a/test-base/src/junit/MODULE_LICENSE_CPL +++ b/test-junit/src/junit/MODULE_LICENSE_CPL diff --git a/test-base/src/junit/README.android b/test-junit/src/junit/README.android index 1384a1fedda2..1384a1fedda2 100644 --- a/test-base/src/junit/README.android +++ b/test-junit/src/junit/README.android diff --git a/test-base/src/junit/cpl-v10.html b/test-junit/src/junit/cpl-v10.html index 36aa208d4a29..36aa208d4a29 100644 --- a/test-base/src/junit/cpl-v10.html +++ b/test-junit/src/junit/cpl-v10.html diff --git a/test-base/src/junit/framework/Assert.java b/test-junit/src/junit/framework/Assert.java index 3dcc23d71c19..3dcc23d71c19 100644 --- a/test-base/src/junit/framework/Assert.java +++ b/test-junit/src/junit/framework/Assert.java diff --git a/test-base/src/junit/framework/AssertionFailedError.java b/test-junit/src/junit/framework/AssertionFailedError.java index 0d7802c431c6..0d7802c431c6 100644 --- a/test-base/src/junit/framework/AssertionFailedError.java +++ b/test-junit/src/junit/framework/AssertionFailedError.java diff --git a/test-base/src/junit/framework/ComparisonCompactor.java b/test-junit/src/junit/framework/ComparisonCompactor.java index e540f03b87d3..e540f03b87d3 100644 --- a/test-base/src/junit/framework/ComparisonCompactor.java +++ b/test-junit/src/junit/framework/ComparisonCompactor.java diff --git a/test-base/src/junit/framework/ComparisonFailure.java b/test-junit/src/junit/framework/ComparisonFailure.java index 507799328a44..507799328a44 100644 --- a/test-base/src/junit/framework/ComparisonFailure.java +++ b/test-junit/src/junit/framework/ComparisonFailure.java diff --git a/test-base/src/junit/framework/Protectable.java b/test-junit/src/junit/framework/Protectable.java index e1432370cfaf..e1432370cfaf 100644 --- a/test-base/src/junit/framework/Protectable.java +++ b/test-junit/src/junit/framework/Protectable.java diff --git a/test-base/src/junit/framework/Test.java b/test-junit/src/junit/framework/Test.java index a016ee8308f1..a016ee8308f1 100644 --- a/test-base/src/junit/framework/Test.java +++ b/test-junit/src/junit/framework/Test.java diff --git a/test-base/src/junit/framework/TestCase.java b/test-junit/src/junit/framework/TestCase.java index b047ec9e1afc..b047ec9e1afc 100644 --- a/test-base/src/junit/framework/TestCase.java +++ b/test-junit/src/junit/framework/TestCase.java diff --git a/test-base/src/junit/framework/TestFailure.java b/test-junit/src/junit/framework/TestFailure.java index 6662b1fab1b2..6662b1fab1b2 100644 --- a/test-base/src/junit/framework/TestFailure.java +++ b/test-junit/src/junit/framework/TestFailure.java diff --git a/test-base/src/junit/framework/TestListener.java b/test-junit/src/junit/framework/TestListener.java index 9b6944361b9d..9b6944361b9d 100644 --- a/test-base/src/junit/framework/TestListener.java +++ b/test-junit/src/junit/framework/TestListener.java diff --git a/test-base/src/junit/framework/TestResult.java b/test-junit/src/junit/framework/TestResult.java index 3052e94074fd..3052e94074fd 100644 --- a/test-base/src/junit/framework/TestResult.java +++ b/test-junit/src/junit/framework/TestResult.java diff --git a/test-base/src/junit/framework/TestSuite.java b/test-junit/src/junit/framework/TestSuite.java index 336efd1800d7..336efd1800d7 100644 --- a/test-base/src/junit/framework/TestSuite.java +++ b/test-junit/src/junit/framework/TestSuite.java diff --git a/test-runner/src/junit/runner/BaseTestRunner.java b/test-junit/src/junit/runner/BaseTestRunner.java index b2fa16c91da2..b2fa16c91da2 100644 --- a/test-runner/src/junit/runner/BaseTestRunner.java +++ b/test-junit/src/junit/runner/BaseTestRunner.java diff --git a/test-runner/src/junit/runner/StandardTestSuiteLoader.java b/test-junit/src/junit/runner/StandardTestSuiteLoader.java index 808963a5aea0..808963a5aea0 100644 --- a/test-runner/src/junit/runner/StandardTestSuiteLoader.java +++ b/test-junit/src/junit/runner/StandardTestSuiteLoader.java diff --git a/test-runner/src/junit/runner/TestRunListener.java b/test-junit/src/junit/runner/TestRunListener.java index 0e9581989eee..0e9581989eee 100644 --- a/test-runner/src/junit/runner/TestRunListener.java +++ b/test-junit/src/junit/runner/TestRunListener.java diff --git a/test-runner/src/junit/runner/TestSuiteLoader.java b/test-junit/src/junit/runner/TestSuiteLoader.java index 9cc6d81e125e..9cc6d81e125e 100644 --- a/test-runner/src/junit/runner/TestSuiteLoader.java +++ b/test-junit/src/junit/runner/TestSuiteLoader.java diff --git a/test-runner/src/junit/runner/Version.java b/test-junit/src/junit/runner/Version.java index dd88c03372c8..dd88c03372c8 100644 --- a/test-runner/src/junit/runner/Version.java +++ b/test-junit/src/junit/runner/Version.java diff --git a/test-runner/src/junit/runner/package-info.java b/test-junit/src/junit/runner/package-info.java index 364e3621456e..364e3621456e 100644 --- a/test-runner/src/junit/runner/package-info.java +++ b/test-junit/src/junit/runner/package-info.java diff --git a/test-runner/src/junit/textui/ResultPrinter.java b/test-junit/src/junit/textui/ResultPrinter.java index b4914529bf4f..b4914529bf4f 100644 --- a/test-runner/src/junit/textui/ResultPrinter.java +++ b/test-junit/src/junit/textui/ResultPrinter.java diff --git a/test-runner/src/junit/textui/TestRunner.java b/test-junit/src/junit/textui/TestRunner.java index 046448e5e76a..046448e5e76a 100644 --- a/test-runner/src/junit/textui/TestRunner.java +++ b/test-junit/src/junit/textui/TestRunner.java diff --git a/test-runner/src/junit/textui/package-info.java b/test-junit/src/junit/textui/package-info.java index 28b2ef46b582..28b2ef46b582 100644 --- a/test-runner/src/junit/textui/package-info.java +++ b/test-junit/src/junit/textui/package-info.java diff --git a/test-mock/Android.bp b/test-mock/Android.bp index f37d2d17973e..e29d321e5105 100644 --- a/test-mock/Android.bp +++ b/test-mock/Android.bp @@ -17,12 +17,7 @@ // Build the android.test.mock library // =================================== package { - // See: http://go/android-license-faq - // A large-scale-change added 'default_applicable_licenses' to import - // all of the 'license_kinds' from "frameworks_base_license" - // to get the below license kinds: - // SPDX-license-identifier-Apache-2.0 - default_applicable_licenses: ["frameworks_base_license"], + default_applicable_licenses: ["Android-Apache-2.0"], } java_sdk_library { diff --git a/test-runner/Android.bp b/test-runner/Android.bp index 21e09d3221ce..6b5be3cba204 100644 --- a/test-runner/Android.bp +++ b/test-runner/Android.bp @@ -14,29 +14,19 @@ // limitations under the License. // -// Build the android.test.runner library -// ===================================== package { - // See: http://go/android-license-faq - default_applicable_licenses: ["frameworks_base_test-runner_license"], -} - -license { - name: "frameworks_base_test-runner_license", - visibility: [":__subpackages__"], - license_kinds: [ - "SPDX-license-identifier-Apache-2.0", - "SPDX-license-identifier-CPL-1.0", - ], - license_text: [ - "src/junit/cpl-v10.html", - ], + default_applicable_licenses: ["Android-Apache-2.0"], } +// Build the android.test.runner library +// ===================================== java_sdk_library { name: "android.test.runner", - srcs: [":android-test-runner-sources"], + srcs: [ + ":android-test-runner-sources", + ":frameworks-base-test-junit-runner", + ], errorprone: { javacflags: ["-Xep:DepAnn:ERROR"], diff --git a/test-runner/src/junit/MODULE_LICENSE_CPL b/test-runner/src/junit/MODULE_LICENSE_CPL deleted file mode 100644 index e69de29bb2d1..000000000000 --- a/test-runner/src/junit/MODULE_LICENSE_CPL +++ /dev/null diff --git a/test-runner/src/junit/README.android b/test-runner/src/junit/README.android deleted file mode 100644 index 1384a1fedda2..000000000000 --- a/test-runner/src/junit/README.android +++ /dev/null @@ -1,11 +0,0 @@ -URL: https://github.com/junit-team/junit4 -License: Common Public License Version 1.0 -License File: cpl-v10.html - -This is JUnit 4.10 source that was previously part of the Android Public API. -Where necessary it has been patched to be compatible (according to Android API -requirements) with JUnit 3.8. - -These are copied here to ensure that the android.test.runner target remains -compatible with the last version of the Android API (25) that contained these -classes even when external/junit is upgraded to a later version. diff --git a/test-runner/src/junit/cpl-v10.html b/test-runner/src/junit/cpl-v10.html deleted file mode 100644 index 36aa208d4a29..000000000000 --- a/test-runner/src/junit/cpl-v10.html +++ /dev/null @@ -1,125 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"> -<HTML> -<HEAD> -<TITLE>Common Public License - v 1.0</TITLE> -<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> -</HEAD> - -<BODY BGCOLOR="#FFFFFF" VLINK="#800000"> - - -<P ALIGN="CENTER"><B>Common Public License - v 1.0</B> -<P><B></B><FONT SIZE="3"></FONT> -<P><FONT SIZE="3"></FONT><FONT SIZE="2">THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS COMMON PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.</FONT> -<P><FONT SIZE="2"></FONT> -<P><FONT SIZE="2"><B>1. DEFINITIONS</B></FONT> -<P><FONT SIZE="2">"Contribution" means:</FONT> - -<UL><FONT SIZE="2">a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and<BR CLEAR="LEFT"> -b) in the case of each subsequent Contributor:</FONT></UL> - - -<UL><FONT SIZE="2">i) changes to the Program, and</FONT></UL> - - -<UL><FONT SIZE="2">ii) additions to the Program;</FONT></UL> - - -<UL><FONT SIZE="2">where such changes and/or additions to the Program originate from and are distributed by that particular Contributor. </FONT><FONT SIZE="2">A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone acting on such Contributor's behalf. </FONT><FONT SIZE="2">Contributions do not include additions to the Program which: (i) are separate modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not derivative works of the Program. </FONT></UL> - -<P><FONT SIZE="2"></FONT> -<P><FONT SIZE="2">"Contributor" means any person or entity that distributes the Program.</FONT> -<P><FONT SIZE="2"></FONT><FONT SIZE="2"></FONT> -<P><FONT SIZE="2">"Licensed Patents " mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of its Contribution alone or when combined with the Program. </FONT> -<P><FONT SIZE="2"></FONT><FONT SIZE="2"></FONT> -<P><FONT SIZE="2"></FONT><FONT SIZE="2">"Program" means the Contributions distributed in accordance with this Agreement.</FONT> -<P><FONT SIZE="2"></FONT> -<P><FONT SIZE="2">"Recipient" means anyone who receives the Program under this Agreement, including all Contributors.</FONT> -<P><FONT SIZE="2"><B></B></FONT> -<P><FONT SIZE="2"><B>2. GRANT OF RIGHTS</B></FONT> - -<UL><FONT SIZE="2"></FONT><FONT SIZE="2">a) </FONT><FONT SIZE="2">Subject to the terms of this Agreement, each Contributor hereby grants</FONT><FONT SIZE="2"> Recipient a non-exclusive, worldwide, royalty-free copyright license to</FONT><FONT SIZE="2" COLOR="#FF0000"> </FONT><FONT SIZE="2">reproduce, prepare derivative works of, publicly display, publicly perform, distribute and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code form.</FONT></UL> - - -<UL><FONT SIZE="2"></FONT></UL> - - -<UL><FONT SIZE="2"></FONT><FONT SIZE="2">b) Subject to the terms of this Agreement, each Contributor hereby grants </FONT><FONT SIZE="2">Recipient a non-exclusive, worldwide,</FONT><FONT SIZE="2" COLOR="#008000"> </FONT><FONT SIZE="2">royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder. </FONT></UL> - - -<UL><FONT SIZE="2"></FONT></UL> - - -<UL><FONT SIZE="2">c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the Program, it is Recipient's responsibility to acquire that license before distributing the Program.</FONT></UL> - - -<UL><FONT SIZE="2"></FONT></UL> - - -<UL><FONT SIZE="2">d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to grant the copyright license set forth in this Agreement. </FONT></UL> - - -<UL><FONT SIZE="2"></FONT></UL> - -<P><FONT SIZE="2"><B>3. REQUIREMENTS</B></FONT> -<P><FONT SIZE="2"><B></B>A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that:</FONT> - -<UL><FONT SIZE="2">a) it complies with the terms and conditions of this Agreement; and</FONT></UL> - - -<UL><FONT SIZE="2">b) its license agreement:</FONT></UL> - - -<UL><FONT SIZE="2">i) effectively disclaims</FONT><FONT SIZE="2"> on behalf of all Contributors all warranties and conditions, express and implied, including warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose; </FONT></UL> - - -<UL><FONT SIZE="2">ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special, incidental and consequential damages, such as lost profits; </FONT></UL> - - -<UL><FONT SIZE="2">iii)</FONT><FONT SIZE="2"> states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any other party; and</FONT></UL> - - -<UL><FONT SIZE="2">iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it in a reasonable manner on or through a medium customarily used for software exchange.</FONT><FONT SIZE="2" COLOR="#0000FF"> </FONT><FONT SIZE="2" COLOR="#FF0000"></FONT></UL> - - -<UL><FONT SIZE="2" COLOR="#FF0000"></FONT><FONT SIZE="2"></FONT></UL> - -<P><FONT SIZE="2">When the Program is made available in source code form:</FONT> - -<UL><FONT SIZE="2">a) it must be made available under this Agreement; and </FONT></UL> - - -<UL><FONT SIZE="2">b) a copy of this Agreement must be included with each copy of the Program. </FONT></UL> - -<P><FONT SIZE="2"></FONT><FONT SIZE="2" COLOR="#0000FF"><STRIKE></STRIKE></FONT> -<P><FONT SIZE="2" COLOR="#0000FF"><STRIKE></STRIKE></FONT><FONT SIZE="2">Contributors may not remove or alter any copyright notices contained within the Program. </FONT> -<P><FONT SIZE="2"></FONT> -<P><FONT SIZE="2">Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows subsequent Recipients to identify the originator of the Contribution. </FONT> -<P><FONT SIZE="2"></FONT> -<P><FONT SIZE="2"><B>4. COMMERCIAL DISTRIBUTION</B></FONT> -<P><FONT SIZE="2">Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes the Program in a commercial product offering should do so in a manner which does not create potential liability for other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor ("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor") against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may participate in any such claim at its own expense.</FONT> -<P><FONT SIZE="2"></FONT> -<P><FONT SIZE="2">For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone. Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result, the Commercial Contributor must pay those damages.</FONT> -<P><FONT SIZE="2"></FONT><FONT SIZE="2" COLOR="#0000FF"></FONT> -<P><FONT SIZE="2" COLOR="#0000FF"></FONT><FONT SIZE="2"><B>5. NO WARRANTY</B></FONT> -<P><FONT SIZE="2">EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is</FONT><FONT SIZE="2"> solely responsible for determining the appropriateness of using and distributing </FONT><FONT SIZE="2">the Program</FONT><FONT SIZE="2"> and assumes all risks associated with its exercise of rights under this Agreement</FONT><FONT SIZE="2">, including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, </FONT><FONT SIZE="2">programs or equipment, and unavailability or interruption of operations</FONT><FONT SIZE="2">. </FONT><FONT SIZE="2"></FONT> -<P><FONT SIZE="2"></FONT> -<P><FONT SIZE="2"></FONT><FONT SIZE="2"><B>6. DISCLAIMER OF LIABILITY</B></FONT> -<P><FONT SIZE="2"></FONT><FONT SIZE="2">EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES </FONT><FONT SIZE="2">(INCLUDING WITHOUT LIMITATION LOST PROFITS),</FONT><FONT SIZE="2"> HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.</FONT> -<P><FONT SIZE="2"></FONT><FONT SIZE="2"></FONT> -<P><FONT SIZE="2"><B>7. GENERAL</B></FONT> -<P><FONT SIZE="2"></FONT><FONT SIZE="2">If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable.</FONT> -<P><FONT SIZE="2"></FONT> -<P><FONT SIZE="2">If Recipient institutes patent litigation against a Contributor with respect to a patent applicable to software (including a cross-claim or counterclaim in a lawsuit), then any patent licenses granted by that Contributor to such Recipient under this Agreement shall terminate as of the date such litigation is filed. In addition, if Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such litigation is filed. </FONT><FONT SIZE="2"></FONT> -<P><FONT SIZE="2"></FONT> -<P><FONT SIZE="2">All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses granted by Recipient relating to the Program shall continue and survive. </FONT><FONT SIZE="2"></FONT> -<P><FONT SIZE="2"></FONT> -<P><FONT SIZE="2"></FONT><FONT SIZE="2">Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to </FONT><FONT SIZE="2">publish new versions (including revisions) of this Agreement from time to </FONT><FONT SIZE="2">time. No one other than the Agreement Steward has the right to modify this Agreement. IBM is the initial Agreement Steward. IBM may assign the responsibility to serve as the Agreement Steward to a suitable separate entity. </FONT><FONT SIZE="2">Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the new </FONT><FONT SIZE="2">version. </FONT><FONT SIZE="2">Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, </FONT><FONT SIZE="2">by implication, estoppel or otherwise</FONT><FONT SIZE="2">.</FONT><FONT SIZE="2"> All rights in the Program not expressly granted under this Agreement are reserved.</FONT> -<P><FONT SIZE="2"></FONT> -<P><FONT SIZE="2">This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose. Each party waives its rights to a jury trial in any resulting litigation.</FONT> -<P><FONT SIZE="2"></FONT><FONT SIZE="2"></FONT> -<P><FONT SIZE="2"></FONT> - -</BODY> - -</HTML>
\ No newline at end of file diff --git a/test-runner/tests/Android.bp b/test-runner/tests/Android.bp index ac21bcb9d124..aad2bee8cb84 100644 --- a/test-runner/tests/Android.bp +++ b/test-runner/tests/Android.bp @@ -13,12 +13,7 @@ // limitations under the License. package { - // See: http://go/android-license-faq - // A large-scale-change added 'default_applicable_licenses' to import - // all of the 'license_kinds' from "frameworks_base_license" - // to get the below license kinds: - // SPDX-license-identifier-Apache-2.0 - default_applicable_licenses: ["frameworks_base_license"], + default_applicable_licenses: ["Android-Apache-2.0"], } android_test { diff --git a/tests/PackageWatchdog/src/com/android/server/PackageWatchdogTest.java b/tests/PackageWatchdog/src/com/android/server/PackageWatchdogTest.java index 755636aef7ed..75284c712bd2 100644 --- a/tests/PackageWatchdog/src/com/android/server/PackageWatchdogTest.java +++ b/tests/PackageWatchdog/src/com/android/server/PackageWatchdogTest.java @@ -43,13 +43,13 @@ import android.os.SystemProperties; import android.os.test.TestLooper; import android.provider.DeviceConfig; import android.util.AtomicFile; -import android.util.LongArrayQueue; import android.util.Xml; +import android.utils.LongArrayQueue; +import android.utils.XmlUtils; import androidx.test.InstrumentationRegistry; import com.android.dx.mockito.inline.extended.ExtendedMockito; -import com.android.internal.util.XmlUtils; import com.android.modules.utils.TypedXmlPullParser; import com.android.modules.utils.TypedXmlSerializer; import com.android.server.PackageWatchdog.HealthCheckState; |