Merge changes Ib678f277,Ieaae2f9c into main
* changes:
Fix notification visibility when screensharing
Refactor NotificationEntry utility methods
diff --git a/core/api/current.txt b/core/api/current.txt
index 47685a5..86f875b 100644
--- a/core/api/current.txt
+++ b/core/api/current.txt
@@ -144,10 +144,12 @@
field public static final String MANAGE_DEVICE_POLICY_AUDIO_OUTPUT = "android.permission.MANAGE_DEVICE_POLICY_AUDIO_OUTPUT";
field public static final String MANAGE_DEVICE_POLICY_AUTOFILL = "android.permission.MANAGE_DEVICE_POLICY_AUTOFILL";
field public static final String MANAGE_DEVICE_POLICY_BACKUP_SERVICE = "android.permission.MANAGE_DEVICE_POLICY_BACKUP_SERVICE";
+ field @FlaggedApi("android.app.admin.flags.dedicated_device_control_api_enabled") public static final String MANAGE_DEVICE_POLICY_BLOCK_UNINSTALL = "android.permission.MANAGE_DEVICE_POLICY_BLOCK_UNINSTALL";
field public static final String MANAGE_DEVICE_POLICY_BLUETOOTH = "android.permission.MANAGE_DEVICE_POLICY_BLUETOOTH";
field public static final String MANAGE_DEVICE_POLICY_BUGREPORT = "android.permission.MANAGE_DEVICE_POLICY_BUGREPORT";
field public static final String MANAGE_DEVICE_POLICY_CALLS = "android.permission.MANAGE_DEVICE_POLICY_CALLS";
field public static final String MANAGE_DEVICE_POLICY_CAMERA = "android.permission.MANAGE_DEVICE_POLICY_CAMERA";
+ field @FlaggedApi("android.app.admin.flags.dedicated_device_control_api_enabled") public static final String MANAGE_DEVICE_POLICY_CAMERA_TOGGLE = "android.permission.MANAGE_DEVICE_POLICY_CAMERA_TOGGLE";
field public static final String MANAGE_DEVICE_POLICY_CERTIFICATES = "android.permission.MANAGE_DEVICE_POLICY_CERTIFICATES";
field public static final String MANAGE_DEVICE_POLICY_COMMON_CRITERIA_MODE = "android.permission.MANAGE_DEVICE_POLICY_COMMON_CRITERIA_MODE";
field @FlaggedApi("android.view.contentprotection.flags.manage_device_policy_enabled") public static final String MANAGE_DEVICE_POLICY_CONTENT_PROTECTION = "android.permission.MANAGE_DEVICE_POLICY_CONTENT_PROTECTION";
@@ -169,6 +171,7 @@
field @FlaggedApi("android.app.admin.flags.esim_management_enabled") public static final String MANAGE_DEVICE_POLICY_MANAGED_SUBSCRIPTIONS = "android.permission.MANAGE_DEVICE_POLICY_MANAGED_SUBSCRIPTIONS";
field public static final String MANAGE_DEVICE_POLICY_METERED_DATA = "android.permission.MANAGE_DEVICE_POLICY_METERED_DATA";
field public static final String MANAGE_DEVICE_POLICY_MICROPHONE = "android.permission.MANAGE_DEVICE_POLICY_MICROPHONE";
+ field @FlaggedApi("android.app.admin.flags.dedicated_device_control_api_enabled") public static final String MANAGE_DEVICE_POLICY_MICROPHONE_TOGGLE = "android.permission.MANAGE_DEVICE_POLICY_MICROPHONE_TOGGLE";
field public static final String MANAGE_DEVICE_POLICY_MOBILE_NETWORK = "android.permission.MANAGE_DEVICE_POLICY_MOBILE_NETWORK";
field public static final String MANAGE_DEVICE_POLICY_MODIFY_USERS = "android.permission.MANAGE_DEVICE_POLICY_MODIFY_USERS";
field public static final String MANAGE_DEVICE_POLICY_MTE = "android.permission.MANAGE_DEVICE_POLICY_MTE";
@@ -8114,6 +8117,7 @@
method public boolean isLogoutEnabled();
method public boolean isManagedProfile(@NonNull android.content.ComponentName);
method public boolean isMasterVolumeMuted(@NonNull android.content.ComponentName);
+ method @FlaggedApi("android.app.admin.flags.is_mte_policy_enforced") public static boolean isMtePolicyEnforced();
method public boolean isNetworkLoggingEnabled(@Nullable android.content.ComponentName);
method public boolean isOrganizationOwnedDeviceWithManagedProfile();
method public boolean isOverrideApnEnabled(@NonNull android.content.ComponentName);
@@ -22750,12 +22754,16 @@
method @NonNull public String getCanonicalName();
method public android.media.MediaCodecInfo.CodecCapabilities getCapabilitiesForType(String);
method @NonNull public String getName();
+ method @FlaggedApi("android.media.codec.in_process_sw_audio_codec") public int getSecurityModel();
method public String[] getSupportedTypes();
method public boolean isAlias();
method public boolean isEncoder();
method public boolean isHardwareAccelerated();
method public boolean isSoftwareOnly();
method public boolean isVendor();
+ field @FlaggedApi("android.media.codec.in_process_sw_audio_codec") public static final int SECURITY_MODEL_MEMORY_SAFE = 1; // 0x1
+ field @FlaggedApi("android.media.codec.in_process_sw_audio_codec") public static final int SECURITY_MODEL_SANDBOXED = 0; // 0x0
+ field @FlaggedApi("android.media.codec.in_process_sw_audio_codec") public static final int SECURITY_MODEL_TRUSTED_CONTENT_ONLY = 2; // 0x2
}
public static final class MediaCodecInfo.AudioCapabilities {
@@ -23584,6 +23592,9 @@
field public static final int COLOR_TRANSFER_LINEAR = 1; // 0x1
field public static final int COLOR_TRANSFER_SDR_VIDEO = 3; // 0x3
field public static final int COLOR_TRANSFER_ST2084 = 6; // 0x6
+ field @FlaggedApi("android.media.codec.in_process_sw_audio_codec") public static final int FLAG_SECURITY_MODEL_MEMORY_SAFE = 2; // 0x2
+ field @FlaggedApi("android.media.codec.in_process_sw_audio_codec") public static final int FLAG_SECURITY_MODEL_SANDBOXED = 1; // 0x1
+ field @FlaggedApi("android.media.codec.in_process_sw_audio_codec") public static final int FLAG_SECURITY_MODEL_TRUSTED_CONTENT_ONLY = 4; // 0x4
field public static final String KEY_AAC_DRC_ALBUM_MODE = "aac-drc-album-mode";
field public static final String KEY_AAC_DRC_ATTENUATION_FACTOR = "aac-drc-cut-level";
field public static final String KEY_AAC_DRC_BOOST_FACTOR = "aac-drc-boost-level";
@@ -23665,6 +23676,7 @@
field public static final String KEY_REPEAT_PREVIOUS_FRAME_AFTER = "repeat-previous-frame-after";
field public static final String KEY_ROTATION = "rotation-degrees";
field public static final String KEY_SAMPLE_RATE = "sample-rate";
+ field @FlaggedApi("android.media.codec.in_process_sw_audio_codec") public static final String KEY_SECURITY_MODEL = "security-model";
field public static final String KEY_SLICE_HEIGHT = "slice-height";
field public static final String KEY_SLOW_MOTION_MARKERS = "slow-motion-markers";
field public static final String KEY_STRIDE = "stride";
@@ -42391,6 +42403,7 @@
field public static final int SUPPORTS_SET_INACTIVE = 2; // 0x2
field public static final int SUPPORTS_STREAM = 4; // 0x4
field public static final int SUPPORTS_TRANSFER = 8; // 0x8
+ field @FlaggedApi("com.android.server.telecom.flags.transactional_video_state") public static final int SUPPORTS_VIDEO_CALLING = 16; // 0x10
field public static final int VIDEO_CALL = 2; // 0x2
}
@@ -42426,6 +42439,7 @@
method @NonNull public android.os.ParcelUuid getCallId();
method public void requestCallEndpointChange(@NonNull android.telecom.CallEndpoint, @NonNull java.util.concurrent.Executor, @NonNull android.os.OutcomeReceiver<java.lang.Void,android.telecom.CallException>);
method @FlaggedApi("com.android.server.telecom.flags.set_mute_state") public void requestMuteState(boolean, @NonNull java.util.concurrent.Executor, @NonNull android.os.OutcomeReceiver<java.lang.Void,android.telecom.CallException>);
+ method @FlaggedApi("com.android.server.telecom.flags.transactional_video_state") public void requestVideoState(int, @NonNull java.util.concurrent.Executor, @NonNull android.os.OutcomeReceiver<java.lang.Void,android.telecom.CallException>);
method public void sendEvent(@NonNull String, @NonNull android.os.Bundle);
method public void setActive(@NonNull java.util.concurrent.Executor, @NonNull android.os.OutcomeReceiver<java.lang.Void,android.telecom.CallException>);
method public void setInactive(@NonNull java.util.concurrent.Executor, @NonNull android.os.OutcomeReceiver<java.lang.Void,android.telecom.CallException>);
@@ -42474,6 +42488,7 @@
method public void onCallStreamingFailed(int);
method public void onEvent(@NonNull String, @NonNull android.os.Bundle);
method public void onMuteStateChanged(boolean);
+ method @FlaggedApi("com.android.server.telecom.flags.transactional_video_state") public default void onVideoStateChanged(int);
}
public final class CallException extends java.lang.RuntimeException implements android.os.Parcelable {
diff --git a/core/api/system-current.txt b/core/api/system-current.txt
index f462ccc..bbd2bc9 100644
--- a/core/api/system-current.txt
+++ b/core/api/system-current.txt
@@ -203,7 +203,6 @@
field public static final String MANAGE_HOTWORD_DETECTION = "android.permission.MANAGE_HOTWORD_DETECTION";
field public static final String MANAGE_IPSEC_TUNNELS = "android.permission.MANAGE_IPSEC_TUNNELS";
field public static final String MANAGE_LOW_POWER_STANDBY = "android.permission.MANAGE_LOW_POWER_STANDBY";
- field @FlaggedApi("com.android.media.flags.limit_manage_media_projection") public static final String MANAGE_MEDIA_PROJECTION = "android.permission.MANAGE_MEDIA_PROJECTION";
field public static final String MANAGE_MUSIC_RECOGNITION = "android.permission.MANAGE_MUSIC_RECOGNITION";
field public static final String MANAGE_NOTIFICATION_LISTENERS = "android.permission.MANAGE_NOTIFICATION_LISTENERS";
field public static final String MANAGE_ONE_TIME_PERMISSION_SESSIONS = "android.permission.MANAGE_ONE_TIME_PERMISSION_SESSIONS";
@@ -14353,9 +14352,9 @@
@FlaggedApi("com.android.internal.telephony.flags.use_oem_domain_selection_service") public abstract class DomainSelectionService extends android.app.Service {
ctor public DomainSelectionService();
+ method @NonNull public java.util.concurrent.Executor getCreateExecutor();
method public void onBarringInfoUpdated(int, int, @NonNull android.telephony.BarringInfo);
method @Nullable public final android.os.IBinder onBind(@Nullable android.content.Intent);
- method @NonNull public java.util.concurrent.Executor onCreateExecutor();
method public abstract void onDomainSelection(@NonNull android.telephony.DomainSelectionService.SelectionAttributes, @NonNull android.telephony.TransportSelectorCallback);
method public void onServiceStateUpdated(int, int, @NonNull android.telephony.ServiceState);
field public static final int SCAN_TYPE_FULL_SERVICE = 2; // 0x2
diff --git a/core/java/android/app/ActivityOptions.java b/core/java/android/app/ActivityOptions.java
index e14bf68..2a2c5f0 100644
--- a/core/java/android/app/ActivityOptions.java
+++ b/core/java/android/app/ActivityOptions.java
@@ -20,6 +20,7 @@
import static android.Manifest.permission.START_TASKS_FROM_RECENTS;
import static android.app.WindowConfiguration.ACTIVITY_TYPE_UNDEFINED;
import static android.app.WindowConfiguration.WINDOWING_MODE_UNDEFINED;
+import static android.content.Intent.FLAG_ACTIVITY_MULTIPLE_TASK;
import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;
import static android.content.Intent.FLAG_RECEIVER_FOREGROUND;
import static android.view.Display.INVALID_DISPLAY;
@@ -1849,7 +1850,7 @@
public int getPendingIntentLaunchFlags() {
// b/243794108: Ignore all flags except the new task flag, to be reconsidered in b/254490217
return mPendingIntentLaunchFlags &
- (FLAG_ACTIVITY_NEW_TASK | FLAG_RECEIVER_FOREGROUND);
+ (FLAG_ACTIVITY_NEW_TASK | FLAG_ACTIVITY_MULTIPLE_TASK | FLAG_RECEIVER_FOREGROUND);
}
/**
diff --git a/core/java/android/app/OWNERS b/core/java/android/app/OWNERS
index f92ff83..da0cc01 100644
--- a/core/java/android/app/OWNERS
+++ b/core/java/android/app/OWNERS
@@ -31,6 +31,7 @@
per-file SystemServiceRegistry.java = file:/services/core/java/com/android/server/am/OWNERS
per-file *UserSwitchObserver* = file:/services/core/java/com/android/server/am/OWNERS
per-file *UiAutomation* = file:/services/accessibility/OWNERS
+per-file *UiAutomation* = file:/core/java/android/permission/OWNERS
per-file GameManager* = file:/GAME_MANAGER_OWNERS
per-file GameMode* = file:/GAME_MANAGER_OWNERS
per-file GameState* = file:/GAME_MANAGER_OWNERS
diff --git a/core/java/android/app/admin/DevicePolicyManager.java b/core/java/android/app/admin/DevicePolicyManager.java
index 34fb754..9947c46 100644
--- a/core/java/android/app/admin/DevicePolicyManager.java
+++ b/core/java/android/app/admin/DevicePolicyManager.java
@@ -55,6 +55,7 @@
import static android.app.admin.flags.Flags.FLAG_ESIM_MANAGEMENT_ENABLED;
import static android.app.admin.flags.Flags.FLAG_DEVICE_POLICY_SIZE_TRACKING_ENABLED;
import static android.app.admin.flags.Flags.onboardingBugreportV2Enabled;
+import static android.app.admin.flags.Flags.FLAG_IS_MTE_POLICY_ENFORCED;
import static android.content.Intent.LOCAL_FLAG_FROM_SYSTEM;
import static android.net.NetworkCapabilities.NET_ENTERPRISE_ID_1;
import static android.os.Build.VERSION_CODES.UPSIDE_DOWN_CAKE;
@@ -153,6 +154,7 @@
import com.android.internal.util.ArrayUtils;
import com.android.internal.util.Preconditions;
import com.android.org.conscrypt.TrustedCertificateStore;
+import com.android.internal.os.Zygote;
import java.io.ByteArrayInputStream;
import java.io.FileNotFoundException;
@@ -4117,6 +4119,19 @@
return MTE_NOT_CONTROLLED_BY_POLICY;
}
+ /**
+ * Get the current MTE state of the device.
+ *
+ * <a href="https://source.android.com/docs/security/test/memory-safety/arm-mte">
+ * Learn more about MTE</a>
+ *
+ * @return whether MTE is currently enabled on the device.
+ */
+ @FlaggedApi(FLAG_IS_MTE_POLICY_ENFORCED)
+ public static boolean isMtePolicyEnforced() {
+ return Zygote.nativeSupportsMemoryTagging();
+ }
+
/** Indicates that content protection is not controlled by policy, allowing user to choose. */
@FlaggedApi(android.view.contentprotection.flags.Flags.FLAG_MANAGE_DEVICE_POLICY_ENABLED)
public static final int CONTENT_PROTECTION_NOT_CONTROLLED_BY_POLICY = 0;
diff --git a/core/java/android/app/admin/flags/flags.aconfig b/core/java/android/app/admin/flags/flags.aconfig
index 726ddad..cbd8e5b 100644
--- a/core/java/android/app/admin/flags/flags.aconfig
+++ b/core/java/android/app/admin/flags/flags.aconfig
@@ -139,3 +139,10 @@
description: "Add Headless DO support."
bug: "289515470"
}
+
+flag {
+ name: "is_mte_policy_enforced"
+ namespace: "enterprise"
+ description: "Allow to query whether MTE is enabled or not to check for compliance for enterprise policy"
+ bug: "322777918"
+}
diff --git a/core/java/android/app/ondeviceintelligence/OWNERS b/core/java/android/app/ondeviceintelligence/OWNERS
new file mode 100644
index 0000000..6932ba2
--- /dev/null
+++ b/core/java/android/app/ondeviceintelligence/OWNERS
@@ -0,0 +1,7 @@
+# Bug component: 1363385
+
+sandeepbandaru@google.com
+shivanker@google.com
+hackz@google.com
+volnov@google.com
+
diff --git a/core/java/android/service/ondeviceintelligence/OWNERS b/core/java/android/service/ondeviceintelligence/OWNERS
new file mode 100644
index 0000000..09774f7
--- /dev/null
+++ b/core/java/android/service/ondeviceintelligence/OWNERS
@@ -0,0 +1 @@
+file:/core/java/android/app/ondeviceintelligence/OWNERS
diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml
index e7df19c..8c28753 100644
--- a/core/res/AndroidManifest.xml
+++ b/core/res/AndroidManifest.xml
@@ -3830,6 +3830,24 @@
<permission android:name="android.permission.MANAGE_DEVICE_POLICY_MANAGED_SUBSCRIPTIONS"
android:protectionLevel="internal|role" />
+ <!-- Allows an application to manage policy related to block package uninstallation.
+ @FlaggedApi("android.app.admin.flags.dedicated_device_control_api_enabled")
+ -->
+ <permission android:name="android.permission.MANAGE_DEVICE_POLICY_BLOCK_UNINSTALL"
+ android:protectionLevel="internal|role" />
+
+ <!-- Allows an application to manage policy related to camera toggle.
+ @FlaggedApi("android.app.admin.flags.dedicated_device_control_api_enabled")
+ -->
+ <permission android:name="android.permission.MANAGE_DEVICE_POLICY_CAMERA_TOGGLE"
+ android:protectionLevel="internal|role" />
+
+ <!-- Allows an application to manage policy related to microphone toggle.
+ @FlaggedApi("android.app.admin.flags.dedicated_device_control_api_enabled")
+ -->
+ <permission android:name="android.permission.MANAGE_DEVICE_POLICY_MICROPHONE_TOGGLE"
+ android:protectionLevel="internal|role" />
+
<!-- Allows an application to set device policies outside the current user
that are critical for securing data within the current user.
<p>Holding this permission allows the use of other held MANAGE_DEVICE_POLICY_*
@@ -6884,13 +6902,10 @@
<permission android:name="android.permission.ACCESS_DRM_CERTIFICATES"
android:protectionLevel="signature|privileged" />
- <!-- Allows an application to manage media projection sessions, by showing the permission dialog
- to the user and creating a new token for each capture session.
- @FlaggedApi("com.android.media.flags.limit_manage_media_projection")
- @SystemApi Only granted to apps holding role SYSTEM_UI.
+ <!-- Api Allows an application to manage media projection sessions.
@hide This is not a third-party API (intended for system apps). -->
<permission android:name="android.permission.MANAGE_MEDIA_PROJECTION"
- android:protectionLevel="internal|role" />
+ android:protectionLevel="signature" />
<!-- @SystemApi Allows an application to read install sessions
@hide This is not a third-party API (intended for system apps). -->
diff --git a/core/tests/BroadcastRadioTests/TEST_MAPPING b/core/tests/BroadcastRadioTests/TEST_MAPPING
index b085a27..5637063 100644
--- a/core/tests/BroadcastRadioTests/TEST_MAPPING
+++ b/core/tests/BroadcastRadioTests/TEST_MAPPING
@@ -1,5 +1,5 @@
{
- "postsubmit": [
+ "presubmit": [
{
"name": "BroadcastRadioTests"
}
diff --git a/media/java/android/media/MediaCodecInfo.java b/media/java/android/media/MediaCodecInfo.java
index 3174c37..1e7bc47 100644
--- a/media/java/android/media/MediaCodecInfo.java
+++ b/media/java/android/media/MediaCodecInfo.java
@@ -20,10 +20,12 @@
import static android.media.Utils.sortDistinctRanges;
import static android.media.codec.Flags.FLAG_DYNAMIC_COLOR_ASPECTS;
import static android.media.codec.Flags.FLAG_HLG_EDITING;
+import static android.media.codec.Flags.FLAG_IN_PROCESS_SW_AUDIO_CODEC;
import static android.media.codec.Flags.FLAG_NULL_OUTPUT_SURFACE;
import static android.media.codec.Flags.FLAG_REGION_OF_INTEREST;
import android.annotation.FlaggedApi;
+import android.annotation.IntDef;
import android.annotation.IntRange;
import android.annotation.NonNull;
import android.annotation.Nullable;
@@ -40,6 +42,8 @@
import android.util.Rational;
import android.util.Size;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
@@ -1808,6 +1812,55 @@
}
}
+ /** @hide */
+ @IntDef(prefix = {"SECURITY_MODEL_"}, value = {
+ SECURITY_MODEL_SANDBOXED,
+ SECURITY_MODEL_MEMORY_SAFE,
+ SECURITY_MODEL_TRUSTED_CONTENT_ONLY,
+ })
+ @Retention(RetentionPolicy.SOURCE)
+ public @interface SecurityModel {}
+
+ /**
+ * In this model the codec is running in a sandboxed process. Even if a
+ * malicious content was fed to the codecs in this model, the impact will
+ * be contained in the sandboxed process.
+ */
+ @FlaggedApi(FLAG_IN_PROCESS_SW_AUDIO_CODEC)
+ public static final int SECURITY_MODEL_SANDBOXED = 0;
+ /**
+ * In this model the codec is not running in a sandboxed process, but
+ * written in a memory-safe way. It typically means that the software
+ * implementation of the codec is written in a memory-safe language such
+ * as Rust.
+ */
+ @FlaggedApi(FLAG_IN_PROCESS_SW_AUDIO_CODEC)
+ public static final int SECURITY_MODEL_MEMORY_SAFE = 1;
+ /**
+ * In this model the codec is suitable only for trusted content where
+ * the input can be verified to be well-formed and no malicious actor
+ * can alter it. For example, codecs in this model are not suitable
+ * for arbitrary media downloaded from the internet or present in a user
+ * directory. On the other hand, they could be suitable for media encoded
+ * in the backend that the app developer wholly controls.
+ * <p>
+ * Codecs with this security model is not included in
+ * {@link MediaCodecList#REGULAR_CODECS}, but included in
+ * {@link MediaCodecList#ALL_CODECS}.
+ */
+ @FlaggedApi(FLAG_IN_PROCESS_SW_AUDIO_CODEC)
+ public static final int SECURITY_MODEL_TRUSTED_CONTENT_ONLY = 2;
+
+ /**
+ * Query the security model of the codec.
+ */
+ @FlaggedApi(FLAG_IN_PROCESS_SW_AUDIO_CODEC)
+ @SecurityModel
+ public int getSecurityModel() {
+ // TODO b/297922713 --- detect security model of out-of-sandbox codecs
+ return SECURITY_MODEL_SANDBOXED;
+ }
+
/**
* A class that supports querying the video capabilities of a codec.
*/
diff --git a/media/java/android/media/MediaFormat.java b/media/java/android/media/MediaFormat.java
index 5e40eee..7b83842 100644
--- a/media/java/android/media/MediaFormat.java
+++ b/media/java/android/media/MediaFormat.java
@@ -16,6 +16,8 @@
package android.media;
+import static android.media.codec.Flags.FLAG_IN_PROCESS_SW_AUDIO_CODEC;
+
import static com.android.media.codec.flags.Flags.FLAG_CODEC_IMPORTANCE;
import static com.android.media.codec.flags.Flags.FLAG_LARGE_AUDIO_FRAME;
@@ -1715,6 +1717,58 @@
@FlaggedApi(FLAG_CODEC_IMPORTANCE)
public static final String KEY_IMPORTANCE = "importance";
+ /** @hide */
+ @IntDef(flag = true, prefix = {"FLAG_SECURITY_MODEL_"}, value = {
+ FLAG_SECURITY_MODEL_SANDBOXED,
+ FLAG_SECURITY_MODEL_MEMORY_SAFE,
+ FLAG_SECURITY_MODEL_TRUSTED_CONTENT_ONLY,
+ })
+ @Retention(RetentionPolicy.SOURCE)
+ public @interface SecurityModelFlag {}
+
+ /**
+ * Flag for {@link MediaCodecInfo#SECURITY_MODEL_SANDBOXED}.
+ */
+ @FlaggedApi(FLAG_IN_PROCESS_SW_AUDIO_CODEC)
+ public static final int FLAG_SECURITY_MODEL_SANDBOXED =
+ (1 << MediaCodecInfo.SECURITY_MODEL_SANDBOXED);
+ /**
+ * Flag for {@link MediaCodecInfo#SECURITY_MODEL_MEMORY_SAFE}.
+ */
+ @FlaggedApi(FLAG_IN_PROCESS_SW_AUDIO_CODEC)
+ public static final int FLAG_SECURITY_MODEL_MEMORY_SAFE =
+ (1 << MediaCodecInfo.SECURITY_MODEL_MEMORY_SAFE);
+ /**
+ * Flag for {@link MediaCodecInfo#SECURITY_MODEL_TRUSTED_CONTENT_ONLY}.
+ */
+ @FlaggedApi(FLAG_IN_PROCESS_SW_AUDIO_CODEC)
+ public static final int FLAG_SECURITY_MODEL_TRUSTED_CONTENT_ONLY =
+ (1 << MediaCodecInfo.SECURITY_MODEL_TRUSTED_CONTENT_ONLY);
+
+ /**
+ * A key describing the requested security model as flags.
+ * <p>
+ * The associated value is a flag of the following values:
+ * {@link FLAG_SECURITY_MODEL_SANDBOXED},
+ * {@link FLAG_SECURITY_MODEL_MEMORY_SAFE},
+ * {@link FLAG_SECURITY_MODEL_TRUSTED_CONTENT_ONLY}. The default value is
+ * {@link FLAG_SECURITY_MODEL_SANDBOXED}.
+ * <p>
+ * When passed to {@link MediaCodecList#findDecoderForFormat} or
+ * {@link MediaCodecList#findEncoderForFormat}, MediaCodecList filters
+ * the security model of the codecs according to this flag value.
+ * <p>
+ * When passed to {@link MediaCodec#configure}, MediaCodec verifies
+ * the security model matches the flag value passed, and throws
+ * {@link java.lang.IllegalArgumentException} if the model does not match.
+ * <p>
+ * @see MediaCodecInfo#getSecurityModel
+ * @see MediaCodecList#findDecoderForFormat
+ * @see MediaCodecList#findEncoderForFormat
+ */
+ @FlaggedApi(FLAG_IN_PROCESS_SW_AUDIO_CODEC)
+ public static final String KEY_SECURITY_MODEL = "security-model";
+
/* package private */ MediaFormat(@NonNull Map<String, Object> map) {
mMap = map;
}
diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/ui/binder/SideFpsOverlayViewBinder.kt b/packages/SystemUI/src/com/android/systemui/biometrics/ui/binder/SideFpsOverlayViewBinder.kt
index 7b4be02..9c28f1c 100644
--- a/packages/SystemUI/src/com/android/systemui/biometrics/ui/binder/SideFpsOverlayViewBinder.kt
+++ b/packages/SystemUI/src/com/android/systemui/biometrics/ui/binder/SideFpsOverlayViewBinder.kt
@@ -115,17 +115,11 @@
}
private var overlayView: View? = null
- private var lottie: LottieAnimationView? = null
/** Show the side fingerprint sensor indicator */
private fun show() {
- overlayView?.let {
- if (it.isAttachedToWindow) {
- lottie = it.requireViewById<LottieAnimationView>(R.id.sidefps_animation)
- lottie?.pauseAnimation()
- lottie?.removeAllLottieOnCompositionLoadedListener()
- windowManager.get().removeView(it)
- }
+ if (overlayView?.isAttachedToWindow == true) {
+ return
}
overlayView = layoutInflater.get().inflate(R.layout.sidefps_view, null, false)
diff --git a/ravenwood/run-ravenwood-tests.sh b/ravenwood/run-ravenwood-tests.sh
index 3f4b8a7..259aa70 100755
--- a/ravenwood/run-ravenwood-tests.sh
+++ b/ravenwood/run-ravenwood-tests.sh
@@ -13,10 +13,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-# Run all the ravenwood tests.
+# Run all the ravenwood tests + hoststubgen unit tests.
+
+all_tests="hoststubgentest tiny-framework-dump-test hoststubgen-invoke-test"
# "echo" is to remove the newlines
-all_tests=$(echo $(${0%/*}/list-ravenwood-tests.sh) )
+all_tests="$all_tests $(echo $(${0%/*}/list-ravenwood-tests.sh) )"
echo "Running tests: $all_tests"
atest $all_tests
diff --git a/services/core/java/com/android/server/am/OomAdjusterModernImpl.java b/services/core/java/com/android/server/am/OomAdjusterModernImpl.java
index f85b03e..1bf779a 100644
--- a/services/core/java/com/android/server/am/OomAdjusterModernImpl.java
+++ b/services/core/java/com/android/server/am/OomAdjusterModernImpl.java
@@ -722,14 +722,8 @@
performNewUpdateOomAdjLSP(oomAdjReason, topApp, targetProcesses, activeUids,
fullUpdate, now, UNKNOWN_ADJ);
- if (fullUpdate) {
- assignCachedAdjIfNecessary(mProcessList.getLruProcessesLOSP());
- } else {
- activeProcesses.clear();
- activeProcesses.addAll(targetProcesses);
- assignCachedAdjIfNecessary(activeProcesses);
- activeProcesses.clear();
- }
+ // TODO: b/319163103 - optimize cache adj assignment to not require the whole lru list.
+ assignCachedAdjIfNecessary(mProcessList.getLruProcessesLOSP());
postUpdateOomAdjInnerLSP(oomAdjReason, activeUids, now, nowElapsed, oldTime);
targetProcesses.clear();
@@ -996,11 +990,11 @@
&& service.mState.getMaxAdj() < FOREGROUND_APP_ADJ)
|| (service.mState.getCurAdj() <= FOREGROUND_APP_ADJ
&& service.mState.getCurrentSchedulingGroup() > SCHED_GROUP_BACKGROUND
- && service.mState.getCurProcState() <= PROCESS_STATE_TOP)) {
+ && service.mState.getCurProcState() <= PROCESS_STATE_TOP)
+ || (service.isSdkSandbox && cr.binding.attributedClient != null)) {
continue;
}
-
computeServiceHostOomAdjLSP(cr, service, app, now, topApp, fullUpdate, false, false,
oomAdjReason, cachedAdj, false, false);
}
diff --git a/services/core/java/com/android/server/am/ProcessRecord.java b/services/core/java/com/android/server/am/ProcessRecord.java
index d23d9fb..9883f09 100644
--- a/services/core/java/com/android/server/am/ProcessRecord.java
+++ b/services/core/java/com/android/server/am/ProcessRecord.java
@@ -1678,7 +1678,11 @@
final ArrayList<ConnectionRecord> clist = serviceConnections.valueAt(j);
for (int k = clist.size() - 1; k >= 0; k--) {
final ConnectionRecord cr = clist.get(k);
- consumer.accept(cr.binding.client);
+ if (isSdkSandbox && cr.binding.attributedClient != null) {
+ consumer.accept(cr.binding.attributedClient);
+ } else {
+ consumer.accept(cr.binding.client);
+ }
}
}
}
@@ -1689,25 +1693,5 @@
consumer.accept(conn.client);
}
}
- // If this process is a sandbox itself, also add the app on whose behalf
- // its running
- if (isSdkSandbox) {
- for (int is = mServices.numberOfRunningServices() - 1; is >= 0; is--) {
- ServiceRecord s = mServices.getRunningServiceAt(is);
- ArrayMap<IBinder, ArrayList<ConnectionRecord>> serviceConnections =
- s.getConnections();
- for (int conni = serviceConnections.size() - 1; conni >= 0; conni--) {
- ArrayList<ConnectionRecord> clist = serviceConnections.valueAt(conni);
- for (int i = clist.size() - 1; i >= 0; i--) {
- ConnectionRecord cr = clist.get(i);
- ProcessRecord attributedApp = cr.binding.attributedClient;
- if (attributedApp == null || attributedApp == this) {
- continue;
- }
- consumer.accept(attributedApp);
- }
- }
- }
- }
}
}
diff --git a/services/core/java/com/android/server/appop/AppOpsService.java b/services/core/java/com/android/server/appop/AppOpsService.java
index 145b213..fd09ad1 100644
--- a/services/core/java/com/android/server/appop/AppOpsService.java
+++ b/services/core/java/com/android/server/appop/AppOpsService.java
@@ -166,7 +166,6 @@
import com.android.server.LocalManagerRegistry;
import com.android.server.LocalServices;
import com.android.server.LockGuard;
-import com.android.server.SystemServerInitThreadPool;
import com.android.server.SystemServiceManager;
import com.android.server.companion.virtual.VirtualDeviceManagerInternal;
import com.android.server.pm.PackageList;
@@ -1038,7 +1037,7 @@
new Ops(pkgName, uidState));
}
- createSandboxUidStateIfNotExistsForAppLocked(uid);
+ createSandboxUidStateIfNotExistsForAppLocked(uid, null);
}
} else if (action.equals(ACTION_PACKAGE_REMOVED) && !intent.hasExtra(EXTRA_REPLACING)) {
synchronized (AppOpsService.this) {
@@ -1050,69 +1049,8 @@
return;
}
- ArrayMap<String, String> dstAttributionTags = new ArrayMap<>();
- ArraySet<String> attributionTags = new ArraySet<>();
- attributionTags.add(null);
- if (pkg.getAttributions() != null) {
- int numAttributions = pkg.getAttributions().size();
- for (int attributionNum = 0; attributionNum < numAttributions;
- attributionNum++) {
- ParsedAttribution attribution = pkg.getAttributions().get(attributionNum);
- attributionTags.add(attribution.getTag());
-
- int numInheritFrom = attribution.getInheritFrom().size();
- for (int inheritFromNum = 0; inheritFromNum < numInheritFrom;
- inheritFromNum++) {
- dstAttributionTags.put(attribution.getInheritFrom().get(inheritFromNum),
- attribution.getTag());
- }
- }
- }
-
synchronized (AppOpsService.this) {
- UidState uidState = mUidStates.get(uid);
- if (uidState == null) {
- return;
- }
-
- Ops ops = uidState.pkgOps.get(pkgName);
- if (ops == null) {
- return;
- }
-
- // Reset cached package properties to re-initialize when needed
- ops.bypass = null;
- ops.knownAttributionTags.clear();
-
- // Merge data collected for removed attributions into their successor
- // attributions
- int numOps = ops.size();
- for (int opNum = 0; opNum < numOps; opNum++) {
- Op op = ops.valueAt(opNum);
- for (int deviceIndex = op.mDeviceAttributedOps.size() - 1; deviceIndex >= 0;
- deviceIndex--) {
- ArrayMap<String, AttributedOp> attributedOps =
- op.mDeviceAttributedOps.valueAt(deviceIndex);
- for (int tagIndex = attributedOps.size() - 1; tagIndex >= 0;
- tagIndex--) {
- String tag = attributedOps.keyAt(tagIndex);
- if (attributionTags.contains(tag)) {
- // attribution still exist after upgrade
- continue;
- }
-
- String newAttributionTag = dstAttributionTags.get(tag);
-
- AttributedOp newAttributedOp = op.getOrCreateAttribution(op,
- newAttributionTag,
- op.mDeviceAttributedOps.keyAt(deviceIndex));
- newAttributedOp.add(attributedOps.get(tag));
- attributedOps.remove(tag);
-
- scheduleFastWriteLocked();
- }
- }
- }
+ refreshAttributionsLocked(pkg, uid);
}
}
}
@@ -1136,41 +1074,6 @@
mContext.registerReceiverAsUser(mOnPackageUpdatedReceiver, UserHandle.ALL,
packageUpdateFilter, null, null);
- synchronized (this) {
- for (int uidNum = mUidStates.size() - 1; uidNum >= 0; uidNum--) {
- int uid = mUidStates.keyAt(uidNum);
- UidState uidState = mUidStates.valueAt(uidNum);
-
- String[] pkgsInUid = getPackagesForUid(uidState.uid);
- if (ArrayUtils.isEmpty(pkgsInUid) && uid >= Process.FIRST_APPLICATION_UID) {
- uidState.clear();
- mUidStates.removeAt(uidNum);
- scheduleFastWriteLocked();
- continue;
- }
-
- ArrayMap<String, Ops> pkgs = uidState.pkgOps;
-
- int numPkgs = pkgs.size();
- for (int pkgNum = 0; pkgNum < numPkgs; pkgNum++) {
- String pkg = pkgs.keyAt(pkgNum);
-
- String action;
- if (!ArrayUtils.contains(pkgsInUid, pkg)) {
- action = ACTION_PACKAGE_REMOVED;
- } else {
- action = Intent.ACTION_PACKAGE_REPLACED;
- }
-
- SystemServerInitThreadPool.submit(
- () -> mOnPackageUpdatedReceiver.onReceive(mContext, new Intent(action)
- .setData(Uri.fromParts("package", pkg, null))
- .putExtra(Intent.EXTRA_UID, uid)),
- "Update app-ops uidState in case package " + pkg + " changed");
- }
- }
- }
-
prepareInternalCallbacks();
final IntentFilter packageSuspendFilter = new IntentFilter();
@@ -1258,20 +1161,27 @@
void initializeUidStates() {
UserManagerInternal umi = getUserManagerInternal();
synchronized (this) {
+ SparseBooleanArray knownUids = new SparseBooleanArray();
+
+ for (int uid : NON_PACKAGE_UIDS) {
+ if (!mUidStates.contains(uid)) {
+ mUidStates.put(uid, new UidState(uid));
+ }
+ knownUids.put(uid, true);
+ }
+
int[] userIds = umi.getUserIds();
try (PackageManagerLocal.UnfilteredSnapshot snapshot =
getPackageManagerLocal().withUnfilteredSnapshot()) {
Map<String, PackageState> packageStates = snapshot.getPackageStates();
for (int i = 0; i < userIds.length; i++) {
int userId = userIds[i];
- initializeUserUidStatesLocked(userId, packageStates);
+ initializeUserUidStatesLocked(userId, packageStates, knownUids);
}
- }
- for (int uid : NON_PACKAGE_UIDS) {
- mUidStates.put(uid, new UidState(uid));
+ trimUidStatesLocked(knownUids, packageStates);
+ mUidStatesInitialized = true;
}
- mUidStatesInitialized = true;
}
}
@@ -1279,26 +1189,34 @@
synchronized (this) {
try (PackageManagerLocal.UnfilteredSnapshot snapshot =
getPackageManagerLocal().withUnfilteredSnapshot()) {
- initializeUserUidStatesLocked(userId, snapshot.getPackageStates());
+ initializeUserUidStatesLocked(userId, snapshot.getPackageStates(), null);
}
}
}
private void initializeUserUidStatesLocked(int userId, Map<String,
- PackageState> packageStates) {
+ PackageState> packageStates, SparseBooleanArray knownUids) {
for (Map.Entry<String, PackageState> entry : packageStates.entrySet()) {
- int appId = entry.getValue().getAppId();
+ PackageState packageState = entry.getValue();
+ if (packageState.isApex()) {
+ continue;
+ }
+ int appId = packageState.getAppId();
String packageName = entry.getKey();
- initializePackageUidStateLocked(userId, appId, packageName);
+ initializePackageUidStateLocked(userId, appId, packageName, knownUids);
}
}
/*
Be careful not to clear any existing data; only want to add objects that don't already exist.
*/
- private void initializePackageUidStateLocked(int userId, int appId, String packageName) {
+ private void initializePackageUidStateLocked(int userId, int appId, String packageName,
+ SparseBooleanArray knownUids) {
int uid = UserHandle.getUid(userId, appId);
+ if (knownUids != null) {
+ knownUids.put(uid, true);
+ }
UidState uidState = getUidStateLocked(uid, true);
Ops ops = uidState.pkgOps.get(packageName);
if (ops == null) {
@@ -1316,7 +1234,105 @@
}
}
- createSandboxUidStateIfNotExistsForAppLocked(uid);
+ createSandboxUidStateIfNotExistsForAppLocked(uid, knownUids);
+ }
+
+ private void trimUidStatesLocked(SparseBooleanArray knownUids,
+ Map<String, PackageState> packageStates) {
+ synchronized (this) {
+ // Remove what may have been added during persistence parsing
+ for (int i = mUidStates.size() - 1; i >= 0; i--) {
+ int uid = mUidStates.keyAt(i);
+ if (knownUids.get(uid, false)) {
+ if (uid >= Process.FIRST_APPLICATION_UID) {
+ ArrayMap<String, Ops> pkgOps = mUidStates.valueAt(i).pkgOps;
+ for (int j = 0; j < pkgOps.size(); j++) {
+ String pkgName = pkgOps.keyAt(j);
+ if (!packageStates.containsKey(pkgName)) {
+ pkgOps.removeAt(j);
+ continue;
+ }
+ AndroidPackage pkg = packageStates.get(pkgName).getAndroidPackage();
+ if (pkg != null) {
+ refreshAttributionsLocked(pkg, uid);
+ }
+ }
+ if (pkgOps.isEmpty()) {
+ mUidStates.remove(i);
+ }
+ }
+ } else {
+ mUidStates.removeAt(i);
+ }
+ }
+ }
+ }
+
+ @GuardedBy("this")
+ private void refreshAttributionsLocked(AndroidPackage pkg, int uid) {
+ String pkgName = pkg.getPackageName();
+ ArrayMap<String, String> dstAttributionTags = new ArrayMap<>();
+ ArraySet<String> attributionTags = new ArraySet<>();
+ attributionTags.add(null);
+ if (pkg.getAttributions() != null) {
+ int numAttributions = pkg.getAttributions().size();
+ for (int attributionNum = 0; attributionNum < numAttributions;
+ attributionNum++) {
+ ParsedAttribution attribution = pkg.getAttributions().get(attributionNum);
+ attributionTags.add(attribution.getTag());
+
+ int numInheritFrom = attribution.getInheritFrom().size();
+ for (int inheritFromNum = 0; inheritFromNum < numInheritFrom;
+ inheritFromNum++) {
+ dstAttributionTags.put(attribution.getInheritFrom().get(inheritFromNum),
+ attribution.getTag());
+ }
+ }
+ }
+
+ UidState uidState = mUidStates.get(uid);
+ if (uidState == null) {
+ return;
+ }
+
+ Ops ops = uidState.pkgOps.get(pkgName);
+ if (ops == null) {
+ return;
+ }
+
+ // Reset cached package properties to re-initialize when needed
+ ops.bypass = null;
+ ops.knownAttributionTags.clear();
+
+ // Merge data collected for removed attributions into their successor
+ // attributions
+ int numOps = ops.size();
+ for (int opNum = 0; opNum < numOps; opNum++) {
+ Op op = ops.valueAt(opNum);
+ for (int deviceIndex = op.mDeviceAttributedOps.size() - 1; deviceIndex >= 0;
+ deviceIndex--) {
+ ArrayMap<String, AttributedOp> attributedOps =
+ op.mDeviceAttributedOps.valueAt(deviceIndex);
+ for (int tagIndex = attributedOps.size() - 1; tagIndex >= 0;
+ tagIndex--) {
+ String tag = attributedOps.keyAt(tagIndex);
+ if (attributionTags.contains(tag)) {
+ // attribution still exist after upgrade
+ continue;
+ }
+
+ String newAttributionTag = dstAttributionTags.get(tag);
+
+ AttributedOp newAttributedOp = op.getOrCreateAttribution(op,
+ newAttributionTag,
+ op.mDeviceAttributedOps.keyAt(deviceIndex));
+ newAttributedOp.add(attributedOps.get(tag));
+ attributedOps.remove(tag);
+
+ scheduleFastWriteLocked();
+ }
+ }
+ }
}
/**
@@ -4251,8 +4267,15 @@
return uidState;
}
- private void createSandboxUidStateIfNotExistsForAppLocked(int uid) {
+ private void createSandboxUidStateIfNotExistsForAppLocked(int uid,
+ SparseBooleanArray knownUids) {
+ if (UserHandle.getAppId(uid) < Process.FIRST_APPLICATION_UID) {
+ return;
+ }
final int sandboxUid = Process.toSdkSandboxUid(uid);
+ if (knownUids != null) {
+ knownUids.put(sandboxUid, true);
+ }
getUidStateLocked(sandboxUid, true);
}
diff --git a/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java b/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java
index 4bb8e19..bc169ca 100644
--- a/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java
+++ b/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java
@@ -2901,16 +2901,12 @@
@GuardedBy("ImfLock.class")
void clearClientSessionsLocked() {
if (getCurMethodLocked() != null) {
- // TODO(b/322816970): Replace this with lambda.
- mClientController.forAllClients(new Consumer<ClientState>() {
-
- @GuardedBy("ImfLock.class")
- @Override
- public void accept(ClientState c) {
- clearClientSessionLocked(c);
- clearClientSessionForAccessibilityLocked(c);
- }
- });
+ // TODO(b/324907325): Remove the suppress warnings once b/324907325 is fixed.
+ @SuppressWarnings("GuardedBy") Consumer<ClientState> clearClientSession = c -> {
+ clearClientSessionLocked(c);
+ clearClientSessionForAccessibilityLocked(c);
+ };
+ mClientController.forAllClients(clearClientSession);
finishSessionLocked(mEnabledSession);
for (int i = 0; i < mEnabledAccessibilitySessions.size(); i++) {
@@ -4653,15 +4649,7 @@
super.startImeTrace_enforcePermission();
ImeTracing.getInstance().startTrace(null /* printwriter */);
synchronized (ImfLock.class) {
- // TODO(b/322816970): Replace this with lambda.
- mClientController.forAllClients(new Consumer<ClientState>() {
-
- @GuardedBy("ImfLock.class")
- @Override
- public void accept(ClientState c) {
- c.mClient.setImeTraceEnabled(true /* enabled */);
- }
- });
+ mClientController.forAllClients(c -> c.mClient.setImeTraceEnabled(true /* enabled */));
}
}
@@ -4673,15 +4661,7 @@
ImeTracing.getInstance().stopTrace(null /* printwriter */);
synchronized (ImfLock.class) {
- // TODO(b/322816970): Replace this with lambda.
- mClientController.forAllClients(new Consumer<ClientState>() {
-
- @GuardedBy("ImfLock.class")
- @Override
- public void accept(ClientState c) {
- c.mClient.setImeTraceEnabled(false /* enabled */);
- }
- });
+ mClientController.forAllClients(c -> c.mClient.setImeTraceEnabled(false /* enabled */));
}
}
@@ -5916,15 +5896,12 @@
// We only have sessions when we bound to an input method. Remove this session
// from all clients.
if (getCurMethodLocked() != null) {
- // TODO(b/322816970): Replace this with lambda.
- mClientController.forAllClients(new Consumer<ClientState>() {
+ // TODO(b/324907325): Remove the suppress warnings once b/324907325 is fixed.
+ @SuppressWarnings("GuardedBy") Consumer<ClientState> clearClientSession =
+ c -> clearClientSessionForAccessibilityLocked(c,
+ accessibilityConnectionId);
+ mClientController.forAllClients(clearClientSession);
- @GuardedBy("ImfLock.class")
- @Override
- public void accept(ClientState c) {
- clearClientSessionForAccessibilityLocked(c, accessibilityConnectionId);
- }
- });
AccessibilitySessionState session = mEnabledAccessibilitySessions.get(
accessibilityConnectionId);
if (session != null) {
@@ -6126,24 +6103,21 @@
}
// Dump ClientController#mClients
p.println(" ClientStates:");
- // TODO(b/322816970): Replace this with lambda.
- mClientController.forAllClients(new Consumer<ClientState>() {
+ // TODO(b/324907325): Remove the suppress warnings once b/324907325 is fixed.
+ @SuppressWarnings("GuardedBy") Consumer<ClientState> clientControllerDump = c -> {
+ p.println(" " + c + ":");
+ p.println(" client=" + c.mClient);
+ p.println(" fallbackInputConnection="
+ + c.mFallbackInputConnection);
+ p.println(" sessionRequested="
+ + c.mSessionRequested);
+ p.println(
+ " sessionRequestedForAccessibility="
+ + c.mSessionRequestedForAccessibility);
+ p.println(" curSession=" + c.mCurSession);
+ };
+ mClientController.forAllClients(clientControllerDump);
- @GuardedBy("ImfLock.class")
- @Override
- public void accept(ClientState c) {
- p.println(" " + c + ":");
- p.println(" client=" + c.mClient);
- p.println(" fallbackInputConnection="
- + c.mFallbackInputConnection);
- p.println(" sessionRequested="
- + c.mSessionRequested);
- p.println(
- " sessionRequestedForAccessibility="
- + c.mSessionRequestedForAccessibility);
- p.println(" curSession=" + c.mCurSession);
- }
- });
p.println(" mCurMethodId=" + getSelectedMethodIdLocked());
client = mCurClient;
p.println(" mCurClient=" + client + " mCurSeq=" + getSequenceNumberLocked());
diff --git a/services/core/java/com/android/server/media/projection/MediaProjectionManagerService.java b/services/core/java/com/android/server/media/projection/MediaProjectionManagerService.java
index 1546895..bbb19e3 100644
--- a/services/core/java/com/android/server/media/projection/MediaProjectionManagerService.java
+++ b/services/core/java/com/android/server/media/projection/MediaProjectionManagerService.java
@@ -550,8 +550,8 @@
break;
case RECORD_CONTENT_TASK:
IBinder taskWindowContainerToken =
- mProjectionGrant.getLaunchCookieInternal() == null ? null
- : mProjectionGrant.getLaunchCookieInternal().binder;
+ mProjectionGrant.getLaunchCookie() == null ? null
+ : mProjectionGrant.getLaunchCookie().binder;
setReviewedConsentSessionLocked(
ContentRecordingSession.createTaskSession(taskWindowContainerToken));
break;
@@ -603,17 +603,6 @@
return projection;
}
- /**
- * Test API mirroring the types in the aidl interface for access outside the projection
- * package.
- */
- @VisibleForTesting
- public IMediaProjection createProjectionInternal(int processUid, String packageName, int type,
- boolean isPermanentGrant) {
- return createProjectionInternal(processUid, packageName, type, isPermanentGrant,
- Binder.getCallingUserHandle());
- }
-
// TODO(b/261563516): Remove internal method and test aidl directly, here and elsewhere.
@VisibleForTesting
MediaProjection getProjectionInternal(int uid, String packageName) {
@@ -1203,10 +1192,6 @@
@Override // Binder call
public void setLaunchCookie(LaunchCookie launchCookie) {
setLaunchCookie_enforcePermission();
- setLaunchCookieInternal(launchCookie);
- }
-
- @VisibleForTesting void setLaunchCookieInternal(LaunchCookie launchCookie) {
mLaunchCookie = launchCookie;
}
@@ -1214,10 +1199,6 @@
@Override // Binder call
public LaunchCookie getLaunchCookie() {
getLaunchCookie_enforcePermission();
- return getLaunchCookieInternal();
- }
-
- @VisibleForTesting LaunchCookie getLaunchCookieInternal() {
return mLaunchCookie;
}
@@ -1225,11 +1206,6 @@
@Override
public boolean isValid() {
isValid_enforcePermission();
- return isValidInternal();
- }
-
- @VisibleForTesting
- boolean isValidInternal() {
synchronized (mLock) {
final long curMs = mClock.uptimeMillis();
final boolean hasTimedOut = curMs - mCreateTimeMs > mTimeoutMs;
@@ -1260,11 +1236,6 @@
@Override
public void notifyVirtualDisplayCreated(int displayId) {
notifyVirtualDisplayCreated_enforcePermission();
- notifyVirtualDisplayCreatedInternal(displayId);
- }
-
- @VisibleForTesting
- void notifyVirtualDisplayCreatedInternal(int displayId) {
synchronized (mLock) {
mVirtualDisplayId = displayId;
diff --git a/services/core/java/com/android/server/ondeviceintelligence/OWNERS b/services/core/java/com/android/server/ondeviceintelligence/OWNERS
new file mode 100644
index 0000000..09774f7
--- /dev/null
+++ b/services/core/java/com/android/server/ondeviceintelligence/OWNERS
@@ -0,0 +1 @@
+file:/core/java/android/app/ondeviceintelligence/OWNERS
diff --git a/services/core/java/com/android/server/wm/DisplayContent.java b/services/core/java/com/android/server/wm/DisplayContent.java
index 25a5fca..e743172 100644
--- a/services/core/java/com/android/server/wm/DisplayContent.java
+++ b/services/core/java/com/android/server/wm/DisplayContent.java
@@ -6783,14 +6783,6 @@
return mSandboxDisplayApis;
}
- /**
- * For testing only; inject a ContentRecorder instance.
- */
- @VisibleForTesting
- void setContentRecorder(ContentRecorder contentRecorder) {
- mContentRecorder = contentRecorder;
- }
-
private ContentRecorder getContentRecorder() {
if (mContentRecorder == null) {
mContentRecorder = new ContentRecorder(this);
diff --git a/services/core/java/com/android/server/wm/RootWindowContainer.java b/services/core/java/com/android/server/wm/RootWindowContainer.java
index 609ad1e..bf45804 100644
--- a/services/core/java/com/android/server/wm/RootWindowContainer.java
+++ b/services/core/java/com/android/server/wm/RootWindowContainer.java
@@ -612,10 +612,8 @@
}
void refreshSecureSurfaceState() {
- forAllWindows((w) -> {
- if (w.mHasSurface) {
- w.setSecureLocked(w.isSecureLocked());
- }
+ forAllWindows(w -> {
+ w.setSecureLocked(w.isSecureLocked());
}, true /* traverseTopToBottom */);
}
diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
index e619440..3c89432 100644
--- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
+++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
@@ -29,9 +29,11 @@
import static android.Manifest.permission.MANAGE_DEVICE_POLICY_APP_RESTRICTIONS;
import static android.Manifest.permission.MANAGE_DEVICE_POLICY_AUDIO_OUTPUT;
import static android.Manifest.permission.MANAGE_DEVICE_POLICY_AUTOFILL;
+import static android.Manifest.permission.MANAGE_DEVICE_POLICY_BLOCK_UNINSTALL;
import static android.Manifest.permission.MANAGE_DEVICE_POLICY_BLUETOOTH;
import static android.Manifest.permission.MANAGE_DEVICE_POLICY_CALLS;
import static android.Manifest.permission.MANAGE_DEVICE_POLICY_CAMERA;
+import static android.Manifest.permission.MANAGE_DEVICE_POLICY_CAMERA_TOGGLE;
import static android.Manifest.permission.MANAGE_DEVICE_POLICY_CERTIFICATES;
import static android.Manifest.permission.MANAGE_DEVICE_POLICY_COMMON_CRITERIA_MODE;
import static android.Manifest.permission.MANAGE_DEVICE_POLICY_CONTENT_PROTECTION;
@@ -50,6 +52,7 @@
import static android.Manifest.permission.MANAGE_DEVICE_POLICY_LOCK_TASK;
import static android.Manifest.permission.MANAGE_DEVICE_POLICY_MANAGED_SUBSCRIPTIONS;
import static android.Manifest.permission.MANAGE_DEVICE_POLICY_MICROPHONE;
+import static android.Manifest.permission.MANAGE_DEVICE_POLICY_MICROPHONE_TOGGLE;
import static android.Manifest.permission.MANAGE_DEVICE_POLICY_MOBILE_NETWORK;
import static android.Manifest.permission.MANAGE_DEVICE_POLICY_MODIFY_USERS;
import static android.Manifest.permission.MANAGE_DEVICE_POLICY_MTE;
@@ -22424,14 +22427,6 @@
});
}
- // Permission that will need to be created in V.
- private static final String MANAGE_DEVICE_POLICY_BLOCK_UNINSTALL =
- "manage_device_policy_block_uninstall";
- private static final String MANAGE_DEVICE_POLICY_CAMERA_TOGGLE =
- "manage_device_policy_camera_toggle";
- private static final String MANAGE_DEVICE_POLICY_MICROPHONE_TOGGLE =
- "manage_device_policy_microphone_toggle";
-
// DPC types
private static final int NOT_A_DPC = -1;
private static final int DEFAULT_DEVICE_OWNER = 0;
diff --git a/services/tests/PackageManagerServiceTests/appenumeration/Android.bp b/services/tests/PackageManagerServiceTests/appenumeration/Android.bp
index bd86fe2..f15e533 100644
--- a/services/tests/PackageManagerServiceTests/appenumeration/Android.bp
+++ b/services/tests/PackageManagerServiceTests/appenumeration/Android.bp
@@ -32,8 +32,6 @@
"androidx.test.runner",
"truth",
"Harrier",
- "frameworks-base-testutils",
- "services.core",
],
platform_apis: true,
certificate: "platform",
diff --git a/services/tests/PackageManagerServiceTests/appenumeration/src/com/android/server/pm/test/appenumeration/AppEnumerationInternalTests.java b/services/tests/PackageManagerServiceTests/appenumeration/src/com/android/server/pm/test/appenumeration/AppEnumerationInternalTests.java
index c615823..4012d8e 100644
--- a/services/tests/PackageManagerServiceTests/appenumeration/src/com/android/server/pm/test/appenumeration/AppEnumerationInternalTests.java
+++ b/services/tests/PackageManagerServiceTests/appenumeration/src/com/android/server/pm/test/appenumeration/AppEnumerationInternalTests.java
@@ -16,36 +16,32 @@
package com.android.server.pm.test.appenumeration;
+import static android.content.Context.MEDIA_PROJECTION_SERVICE;
+
import static com.android.compatibility.common.util.ShellUtils.runShellCommand;
import static com.google.common.truth.Truth.assertThat;
-import static org.mockito.MockitoAnnotations.initMocks;
-
-import android.app.ActivityManagerInternal;
import android.app.AppGlobals;
import android.app.PendingIntent;
import android.content.Context;
import android.content.IntentSender;
import android.content.pm.IPackageManager;
import android.content.pm.ProviderInfo;
+import android.media.projection.IMediaProjectionManager;
import android.media.projection.MediaProjectionManager;
import android.os.Process;
+import android.os.ServiceManager;
import android.os.UserHandle;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.runner.AndroidJUnit4;
-import com.android.internal.util.test.LocalServiceKeeperRule;
-import com.android.server.media.projection.MediaProjectionManagerService;
-
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
-import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
-import org.mockito.Mock;
import java.util.ArrayList;
import java.util.List;
@@ -77,17 +73,9 @@
private IPackageManager mIPackageManager;
- @Rule
- public LocalServiceKeeperRule mLocalServiceKeeperRule = new LocalServiceKeeperRule();
-
- @Mock private ActivityManagerInternal mActivityManagerInternal;
-
@Before
public void setup() {
- initMocks(this);
mIPackageManager = AppGlobals.getPackageManager();
- mLocalServiceKeeperRule.overrideLocalService(ActivityManagerInternal.class,
- mActivityManagerInternal);
}
@After
@@ -181,11 +169,11 @@
public void mediaProjectionManager_createProjection_canSeeForceQueryable()
throws Exception {
installPackage(SHARED_USER_APK_PATH, true /* forceQueryable */);
- final Context context = InstrumentationRegistry.getInstrumentation().getContext();
- final MediaProjectionManagerService mediaProjectionManager =
- new MediaProjectionManagerService(context);
+ final IMediaProjectionManager mediaProjectionManager =
+ IMediaProjectionManager.Stub.asInterface(
+ ServiceManager.getService(MEDIA_PROJECTION_SERVICE));
- assertThat(mediaProjectionManager.createProjectionInternal(0 /* uid */, TARGET_SHARED_USER,
+ assertThat(mediaProjectionManager.createProjection(0 /* uid */, TARGET_SHARED_USER,
MediaProjectionManager.TYPE_SCREEN_CAPTURE, false /* permanentGrant */))
.isNotNull();
}
@@ -193,13 +181,12 @@
@Test
public void mediaProjectionManager_createProjection_cannotSeeTarget() {
installPackage(SHARED_USER_APK_PATH, false /* forceQueryable */);
- final Context context = InstrumentationRegistry.getInstrumentation().getContext();
- final MediaProjectionManagerService mediaProjectionManager =
- new MediaProjectionManagerService(context);
+ final IMediaProjectionManager mediaProjectionManager =
+ IMediaProjectionManager.Stub.asInterface(
+ ServiceManager.getService(MEDIA_PROJECTION_SERVICE));
Assert.assertThrows(IllegalArgumentException.class,
- () -> mediaProjectionManager.createProjectionInternal(0 /* uid */,
- TARGET_SHARED_USER,
+ () -> mediaProjectionManager.createProjection(0 /* uid */, TARGET_SHARED_USER,
MediaProjectionManager.TYPE_SCREEN_CAPTURE, false /* permanentGrant */));
}
diff --git a/services/tests/mockingservicestests/src/com/android/server/am/MockingOomAdjusterTests.java b/services/tests/mockingservicestests/src/com/android/server/am/MockingOomAdjusterTests.java
index d876dae..47928bc 100644
--- a/services/tests/mockingservicestests/src/com/android/server/am/MockingOomAdjusterTests.java
+++ b/services/tests/mockingservicestests/src/com/android/server/am/MockingOomAdjusterTests.java
@@ -72,6 +72,8 @@
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertTrue;
import static org.mockito.AdditionalAnswers.answer;
+import static org.mockito.ArgumentMatchers.anyLong;
+import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.any;
import static org.mockito.Mockito.anyBoolean;
import static org.mockito.Mockito.anyInt;
@@ -157,9 +159,11 @@
private static final int MOCKAPP2_UID_OTHER = MOCKAPP2_UID + UserHandle.PER_USER_RANGE;
private static final int MOCKAPP_ISOLATED_UID = Process.FIRST_ISOLATED_UID + 321;
private static final String MOCKAPP_ISOLATED_PROCESSNAME = "isolated test #1";
+ private static final int MOCKAPP_SDK_SANDBOX_UID = Process.FIRST_SDK_SANDBOX_UID + 654;
+ private static final String MOCKAPP_SDK_SANDBOX_PROCESSNAME = "sandbox test #1";
private static int sFirstCachedAdj = ProcessList.CACHED_APP_MIN_ADJ
- + ProcessList.CACHED_APP_IMPORTANCE_LEVELS;
+ + ProcessList.CACHED_APP_IMPORTANCE_LEVELS;
private static Context sContext;
private static PackageManagerInternal sPackageManagerInternal;
private static ActivityManagerService sService;
@@ -271,7 +275,6 @@
/**
* Replace the process LRU with the given processes.
- * @param apps
*/
@SuppressWarnings("GuardedBy")
private void setProcessesToLru(ProcessRecord... apps) {
@@ -660,7 +663,7 @@
app.mState.setLastTopTime(nowUptime);
// Simulate the system starting and binding to a service in the app.
ServiceRecord s = bindService(app, system,
- null, Context.BIND_ALMOST_PERCEPTIBLE, mock(IBinder.class));
+ null, null, Context.BIND_ALMOST_PERCEPTIBLE, mock(IBinder.class));
s.lastTopAlmostPerceptibleBindRequestUptimeMs = nowUptime;
s.getConnections().clear();
app.mServices.updateHasTopStartedAlmostPerceptibleServices();
@@ -682,7 +685,7 @@
app.mState.setLastTopTime(nowUptime);
// Simulate the system starting and binding to a service in the app.
ServiceRecord s = bindService(app, system,
- null, Context.BIND_ALMOST_PERCEPTIBLE + 2, mock(IBinder.class));
+ null, null, Context.BIND_ALMOST_PERCEPTIBLE + 2, mock(IBinder.class));
s.lastTopAlmostPerceptibleBindRequestUptimeMs =
nowUptime - 2 * sService.mConstants.mServiceBindAlmostPerceptibleTimeoutMs;
app.mServices.updateHasTopStartedAlmostPerceptibleServices();
@@ -704,7 +707,7 @@
app.mState.setLastTopTime(nowUptime);
// Simulate the system starting and binding to a service in the app.
ServiceRecord s = bindService(app, system,
- null, Context.BIND_ALMOST_PERCEPTIBLE, mock(IBinder.class));
+ null, null, Context.BIND_ALMOST_PERCEPTIBLE, mock(IBinder.class));
s.lastTopAlmostPerceptibleBindRequestUptimeMs =
nowUptime - 2 * sService.mConstants.mServiceBindAlmostPerceptibleTimeoutMs;
s.getConnections().clear();
@@ -729,7 +732,7 @@
system.mState.setHasTopUi(true);
// Simulate the system starting and binding to a service in the app.
ServiceRecord s = bindService(app, system,
- null, Context.BIND_ALMOST_PERCEPTIBLE, mock(IBinder.class));
+ null, null, Context.BIND_ALMOST_PERCEPTIBLE, mock(IBinder.class));
sService.mWakefulness.set(PowerManagerInternal.WAKEFULNESS_AWAKE);
updateOomAdj(system, app);
@@ -901,7 +904,7 @@
MOCKAPP_PROCESSNAME, MOCKAPP_PACKAGENAME, true));
ProcessRecord client = spy(makeDefaultProcessRecord(MOCKAPP2_PID, MOCKAPP2_UID,
MOCKAPP2_PROCESSNAME, MOCKAPP2_PACKAGENAME, false));
- ServiceRecord s = bindService(app, client, null, Context.BIND_WAIVE_PRIORITY,
+ ServiceRecord s = bindService(app, client, null, null, Context.BIND_WAIVE_PRIORITY,
mock(IBinder.class));
s.startRequested = true;
sService.mWakefulness.set(PowerManagerInternal.WAKEFULNESS_AWAKE);
@@ -921,7 +924,7 @@
ProcessRecord client = spy(makeDefaultProcessRecord(MOCKAPP2_PID, MOCKAPP2_UID,
MOCKAPP2_PROCESSNAME, MOCKAPP2_PACKAGENAME, false));
client.mServices.setTreatLikeActivity(true);
- bindService(app, client, null, Context.BIND_WAIVE_PRIORITY
+ bindService(app, client, null, null, Context.BIND_WAIVE_PRIORITY
| Context.BIND_TREAT_LIKE_ACTIVITY, mock(IBinder.class));
sService.mWakefulness.set(PowerManagerInternal.WAKEFULNESS_AWAKE);
updateOomAdj(client, app);
@@ -937,7 +940,7 @@
ProcessRecord client = spy(makeDefaultProcessRecord(MOCKAPP2_PID, MOCKAPP2_UID,
MOCKAPP2_PROCESSNAME, MOCKAPP2_PACKAGENAME, false));
IBinder binder = mock(IBinder.class);
- ServiceRecord s = bindService(app, client, null, Context.BIND_WAIVE_PRIORITY
+ ServiceRecord s = bindService(app, client, null, null, Context.BIND_WAIVE_PRIORITY
| Context.BIND_ADJUST_WITH_ACTIVITY | Context.BIND_IMPORTANT, binder);
ConnectionRecord cr = s.getConnections().get(binder).get(0);
setFieldValue(ConnectionRecord.class, cr, "activity",
@@ -955,7 +958,7 @@
public void testUpdateOomAdj_DoOne_Service_Self() {
ProcessRecord app = spy(makeDefaultProcessRecord(MOCKAPP_PID, MOCKAPP_UID,
MOCKAPP_PROCESSNAME, MOCKAPP_PACKAGENAME, false));
- bindService(app, app, null, 0, mock(IBinder.class));
+ bindService(app, app, null, null, 0, mock(IBinder.class));
sService.mWakefulness.set(PowerManagerInternal.WAKEFULNESS_AWAKE);
updateOomAdj(app);
@@ -970,7 +973,7 @@
ProcessRecord client = spy(makeDefaultProcessRecord(MOCKAPP2_PID, MOCKAPP2_UID,
MOCKAPP2_PROCESSNAME, MOCKAPP2_PACKAGENAME, false));
client.mServices.setTreatLikeActivity(true);
- bindService(app, client, null, 0, mock(IBinder.class));
+ bindService(app, client, null, null, 0, mock(IBinder.class));
sService.mWakefulness.set(PowerManagerInternal.WAKEFULNESS_AWAKE);
updateOomAdj(client, app);
@@ -988,7 +991,8 @@
doReturn(true).when(wpc).hasActivities();
ProcessRecord client = spy(makeDefaultProcessRecord(MOCKAPP2_PID, MOCKAPP2_UID,
MOCKAPP2_PROCESSNAME, MOCKAPP2_PACKAGENAME, false));
- bindService(app, client, null, Context.BIND_ALLOW_OOM_MANAGEMENT, mock(IBinder.class));
+ bindService(app, client, null, null, Context.BIND_ALLOW_OOM_MANAGEMENT,
+ mock(IBinder.class));
doReturn(PROCESS_STATE_TOP).when(sService.mAtmInternal).getTopProcessState();
doReturn(client).when(sService).getTopApp();
sService.mWakefulness.set(PowerManagerInternal.WAKEFULNESS_AWAKE);
@@ -1005,7 +1009,7 @@
MOCKAPP_PROCESSNAME, MOCKAPP_PACKAGENAME, false));
ProcessRecord client = spy(makeDefaultProcessRecord(MOCKAPP2_PID, MOCKAPP2_UID,
MOCKAPP2_PROCESSNAME, MOCKAPP2_PACKAGENAME, false));
- bindService(app, client, null, Context.BIND_FOREGROUND_SERVICE, mock(IBinder.class));
+ bindService(app, client, null, null, Context.BIND_FOREGROUND_SERVICE, mock(IBinder.class));
client.mState.setMaxAdj(PERSISTENT_PROC_ADJ);
client.mState.setHasTopUi(true);
sService.mWakefulness.set(PowerManagerInternal.WAKEFULNESS_AWAKE);
@@ -1023,7 +1027,7 @@
MOCKAPP_PROCESSNAME, MOCKAPP_PACKAGENAME, false));
ProcessRecord client = spy(makeDefaultProcessRecord(MOCKAPP2_PID, MOCKAPP2_UID,
MOCKAPP2_PROCESSNAME, MOCKAPP2_PACKAGENAME, false));
- bindService(app, client, null, Context.BIND_IMPORTANT, mock(IBinder.class));
+ bindService(app, client, null, null, Context.BIND_IMPORTANT, mock(IBinder.class));
client.mServices.startExecutingService(mock(ServiceRecord.class));
sService.mWakefulness.set(PowerManagerInternal.WAKEFULNESS_AWAKE);
updateOomAdj(client, app);
@@ -1039,7 +1043,7 @@
MOCKAPP_PROCESSNAME, MOCKAPP_PACKAGENAME, false));
ProcessRecord client = spy(makeDefaultProcessRecord(MOCKAPP2_PID, MOCKAPP2_UID,
MOCKAPP2_PROCESSNAME, MOCKAPP2_PACKAGENAME, false));
- bindService(app, client, null, 0, mock(IBinder.class));
+ bindService(app, client, null, null, 0, mock(IBinder.class));
doReturn(PROCESS_STATE_TOP).when(sService.mAtmInternal).getTopProcessState();
doReturn(client).when(sService).getTopApp();
sService.mWakefulness.set(PowerManagerInternal.WAKEFULNESS_AWAKE);
@@ -1056,7 +1060,7 @@
MOCKAPP_PROCESSNAME, MOCKAPP_PACKAGENAME, false));
ProcessRecord client = spy(makeDefaultProcessRecord(MOCKAPP2_PID, MOCKAPP2_UID,
MOCKAPP2_PROCESSNAME, MOCKAPP2_PACKAGENAME, false));
- bindService(app, client, null, Context.BIND_FOREGROUND_SERVICE, mock(IBinder.class));
+ bindService(app, client, null, null, Context.BIND_FOREGROUND_SERVICE, mock(IBinder.class));
client.mState.setMaxAdj(PERSISTENT_PROC_ADJ);
sService.mWakefulness.set(PowerManagerInternal.WAKEFULNESS_AWAKE);
updateOomAdj(client, app);
@@ -1074,7 +1078,7 @@
MOCKAPP_PROCESSNAME, MOCKAPP_PACKAGENAME, false));
ProcessRecord client = spy(makeDefaultProcessRecord(MOCKAPP2_PID, MOCKAPP2_UID,
MOCKAPP2_PROCESSNAME, MOCKAPP2_PACKAGENAME, false));
- bindService(app, client, null, Context.BIND_NOT_FOREGROUND, mock(IBinder.class));
+ bindService(app, client, null, null, Context.BIND_NOT_FOREGROUND, mock(IBinder.class));
client.mState.setMaxAdj(PERSISTENT_PROC_ADJ);
sService.mWakefulness.set(PowerManagerInternal.WAKEFULNESS_AWAKE);
updateOomAdj(client, app);
@@ -1090,7 +1094,7 @@
MOCKAPP_PROCESSNAME, MOCKAPP_PACKAGENAME, false));
ProcessRecord client = spy(makeDefaultProcessRecord(MOCKAPP2_PID, MOCKAPP2_UID,
MOCKAPP2_PROCESSNAME, MOCKAPP2_PACKAGENAME, false));
- bindService(app, client, null, 0, mock(IBinder.class));
+ bindService(app, client, null, null, 0, mock(IBinder.class));
client.mServices.setHasForegroundServices(true, 0, /* hasNoneType=*/true);
sService.mWakefulness.set(PowerManagerInternal.WAKEFULNESS_AWAKE);
updateOomAdj(client, app);
@@ -1109,7 +1113,7 @@
MOCKAPP_PROCESSNAME, MOCKAPP_PACKAGENAME, false));
ProcessRecord client = spy(makeDefaultProcessRecord(MOCKAPP2_PID, MOCKAPP2_UID,
MOCKAPP2_PROCESSNAME, MOCKAPP2_PACKAGENAME, false));
- bindService(app, client, null, 0, mock(IBinder.class));
+ bindService(app, client, null, null, 0, mock(IBinder.class));
// In order to trick OomAdjuster to think it has a short-service, we need this logic.
ServiceRecord s = ServiceRecord.newEmptyInstanceForTest(sService);
@@ -1172,8 +1176,8 @@
ProcessRecord app1 = spy(makeDefaultProcessRecord(MOCKAPP2_PID, MOCKAPP2_UID,
MOCKAPP2_PROCESSNAME, MOCKAPP2_PACKAGENAME, false));
- bindService(app1, pers, null, Context.BIND_FOREGROUND_SERVICE, mock(IBinder.class));
- bindService(app2, app1, null, 0, mock(IBinder.class));
+ bindService(app1, pers, null, null, Context.BIND_FOREGROUND_SERVICE, mock(IBinder.class));
+ bindService(app2, app1, null, null, 0, mock(IBinder.class));
updateOomAdj(pers, app1, app2);
@@ -1192,7 +1196,7 @@
MOCKAPP_PROCESSNAME, MOCKAPP_PACKAGENAME, false));
ProcessRecord client = spy(makeDefaultProcessRecord(MOCKAPP2_PID, MOCKAPP2_UID,
MOCKAPP2_PROCESSNAME, MOCKAPP2_PACKAGENAME, false));
- bindService(app, client, null, Context.BIND_ABOVE_CLIENT, mock(IBinder.class));
+ bindService(app, client, null, null, Context.BIND_ABOVE_CLIENT, mock(IBinder.class));
BackupRecord backupTarget = new BackupRecord(null, 0, 0, 0);
backupTarget.app = client;
doReturn(backupTarget).when(sService.mBackupTargets).get(anyInt());
@@ -1218,7 +1222,7 @@
MOCKAPP_PROCESSNAME, MOCKAPP_PACKAGENAME, false));
ProcessRecord client = spy(makeDefaultProcessRecord(MOCKAPP2_PID, MOCKAPP2_UID,
MOCKAPP2_PROCESSNAME, MOCKAPP2_PACKAGENAME, false));
- bindService(app, client, null, Context.BIND_NOT_PERCEPTIBLE, mock(IBinder.class));
+ bindService(app, client, null, null, Context.BIND_NOT_PERCEPTIBLE, mock(IBinder.class));
client.mState.setRunningRemoteAnimation(true);
sService.mWakefulness.set(PowerManagerInternal.WAKEFULNESS_AWAKE);
updateOomAdj(client, app);
@@ -1233,7 +1237,7 @@
MOCKAPP_PROCESSNAME, MOCKAPP_PACKAGENAME, false));
ProcessRecord client = spy(makeDefaultProcessRecord(MOCKAPP2_PID, MOCKAPP2_UID,
MOCKAPP2_PROCESSNAME, MOCKAPP2_PACKAGENAME, false));
- bindService(app, client, null, Context.BIND_NOT_VISIBLE, mock(IBinder.class));
+ bindService(app, client, null, null, Context.BIND_NOT_VISIBLE, mock(IBinder.class));
client.mState.setRunningRemoteAnimation(true);
sService.mWakefulness.set(PowerManagerInternal.WAKEFULNESS_AWAKE);
updateOomAdj(client, app);
@@ -1248,7 +1252,7 @@
MOCKAPP_PROCESSNAME, MOCKAPP_PACKAGENAME, false));
ProcessRecord client = spy(makeDefaultProcessRecord(MOCKAPP2_PID, MOCKAPP2_UID,
MOCKAPP2_PROCESSNAME, MOCKAPP2_PACKAGENAME, false));
- bindService(app, client, null, 0, mock(IBinder.class));
+ bindService(app, client, null, null, 0, mock(IBinder.class));
client.mState.setHasOverlayUi(true);
sService.mWakefulness.set(PowerManagerInternal.WAKEFULNESS_AWAKE);
updateOomAdj(client, app);
@@ -1264,7 +1268,7 @@
MOCKAPP_PROCESSNAME, MOCKAPP_PACKAGENAME, false));
ProcessRecord client = spy(makeDefaultProcessRecord(MOCKAPP2_PID, MOCKAPP2_UID,
MOCKAPP2_PROCESSNAME, MOCKAPP2_PACKAGENAME, false));
- bindService(app, client, null,
+ bindService(app, client, null, null,
Context.BIND_ALMOST_PERCEPTIBLE | Context.BIND_NOT_FOREGROUND,
mock(IBinder.class));
client.mState.setMaxAdj(PERSISTENT_PROC_ADJ);
@@ -1283,7 +1287,7 @@
MOCKAPP2_PROCESSNAME, MOCKAPP2_PACKAGENAME, false));
WindowProcessController wpc = client.getWindowProcessController();
doReturn(true).when(wpc).isHeavyWeightProcess();
- bindService(app, client, null,
+ bindService(app, client, null, null,
Context.BIND_ALMOST_PERCEPTIBLE | Context.BIND_NOT_FOREGROUND,
mock(IBinder.class));
client.mState.setMaxAdj(PERSISTENT_PROC_ADJ);
@@ -1301,7 +1305,7 @@
MOCKAPP_PROCESSNAME, MOCKAPP_PACKAGENAME, false));
ProcessRecord client = spy(makeDefaultProcessRecord(MOCKAPP2_PID, MOCKAPP2_UID,
MOCKAPP2_PROCESSNAME, MOCKAPP2_PACKAGENAME, false));
- bindService(app, client, null,
+ bindService(app, client, null, null,
Context.BIND_ALMOST_PERCEPTIBLE,
mock(IBinder.class));
client.mState.setMaxAdj(PERSISTENT_PROC_ADJ);
@@ -1320,7 +1324,7 @@
MOCKAPP2_PROCESSNAME, MOCKAPP2_PACKAGENAME, false));
WindowProcessController wpc = client.getWindowProcessController();
doReturn(true).when(wpc).isHeavyWeightProcess();
- bindService(app, client, null,
+ bindService(app, client, null, null,
Context.BIND_ALMOST_PERCEPTIBLE,
mock(IBinder.class));
client.mState.setMaxAdj(PERSISTENT_PROC_ADJ);
@@ -1341,7 +1345,7 @@
MOCKAPP_PROCESSNAME, MOCKAPP_PACKAGENAME, false));
ProcessRecord client = spy(makeDefaultProcessRecord(MOCKAPP2_PID, MOCKAPP2_UID,
MOCKAPP2_PROCESSNAME, MOCKAPP2_PACKAGENAME, false));
- bindService(app, client, null, 0, mock(IBinder.class));
+ bindService(app, client, null, null, 0, mock(IBinder.class));
client.mState.setRunningRemoteAnimation(true);
sService.mWakefulness.set(PowerManagerInternal.WAKEFULNESS_AWAKE);
updateOomAdj(client, app);
@@ -1356,7 +1360,8 @@
MOCKAPP_PROCESSNAME, MOCKAPP_PACKAGENAME, false));
ProcessRecord client = spy(makeDefaultProcessRecord(MOCKAPP2_PID, MOCKAPP2_UID,
MOCKAPP2_PROCESSNAME, MOCKAPP2_PACKAGENAME, false));
- bindService(app, client, null, Context.BIND_IMPORTANT_BACKGROUND, mock(IBinder.class));
+ bindService(app, client, null, null, Context.BIND_IMPORTANT_BACKGROUND,
+ mock(IBinder.class));
client.mState.setHasOverlayUi(true);
sService.mWakefulness.set(PowerManagerInternal.WAKEFULNESS_AWAKE);
updateOomAdj(client, app);
@@ -1496,10 +1501,10 @@
MOCKAPP_PROCESSNAME, MOCKAPP_PACKAGENAME, false));
ProcessRecord client = spy(makeDefaultProcessRecord(MOCKAPP2_PID, MOCKAPP2_UID,
MOCKAPP2_PROCESSNAME, MOCKAPP2_PACKAGENAME, false));
- bindService(app, client, null, 0, mock(IBinder.class));
+ bindService(app, client, null, null, 0, mock(IBinder.class));
ProcessRecord client2 = spy(makeDefaultProcessRecord(MOCKAPP3_PID, MOCKAPP3_UID,
MOCKAPP3_PROCESSNAME, MOCKAPP3_PACKAGENAME, false));
- bindService(client, client2, null, 0, mock(IBinder.class));
+ bindService(client, client2, null, null, 0, mock(IBinder.class));
doReturn(PROCESS_STATE_TOP).when(sService.mAtmInternal).getTopProcessState();
doReturn(client2).when(sService).getTopApp();
sService.mWakefulness.set(PowerManagerInternal.WAKEFULNESS_AWAKE);
@@ -1517,10 +1522,10 @@
MOCKAPP_PROCESSNAME, MOCKAPP_PACKAGENAME, false));
ProcessRecord client = spy(makeDefaultProcessRecord(MOCKAPP2_PID, MOCKAPP2_UID,
MOCKAPP2_PROCESSNAME, MOCKAPP2_PACKAGENAME, false));
- bindService(app, client, null, 0, mock(IBinder.class));
+ bindService(app, client, null, null, 0, mock(IBinder.class));
ProcessRecord client2 = spy(makeDefaultProcessRecord(MOCKAPP3_PID, MOCKAPP3_UID,
MOCKAPP3_PROCESSNAME, MOCKAPP3_PACKAGENAME, false));
- bindService(app, client2, null, 0, mock(IBinder.class));
+ bindService(app, client2, null, null, 0, mock(IBinder.class));
client2.mServices.setHasForegroundServices(true, 0, /* hasNoneType=*/true);
sService.mWakefulness.set(PowerManagerInternal.WAKEFULNESS_AWAKE);
updateOomAdj(client, client2, app);
@@ -1537,10 +1542,10 @@
MOCKAPP_PROCESSNAME, MOCKAPP_PACKAGENAME, false));
ProcessRecord client = spy(makeDefaultProcessRecord(MOCKAPP2_PID, MOCKAPP2_UID,
MOCKAPP2_PROCESSNAME, MOCKAPP2_PACKAGENAME, false));
- bindService(app, client, null, 0, mock(IBinder.class));
+ bindService(app, client, null, null, 0, mock(IBinder.class));
ProcessRecord client2 = spy(makeDefaultProcessRecord(MOCKAPP3_PID, MOCKAPP3_UID,
MOCKAPP3_PROCESSNAME, MOCKAPP3_PACKAGENAME, false));
- bindService(client, client2, null, 0, mock(IBinder.class));
+ bindService(client, client2, null, null, 0, mock(IBinder.class));
client2.mServices.setHasForegroundServices(true, 0, /* hasNoneType=*/true);
sService.mWakefulness.set(PowerManagerInternal.WAKEFULNESS_AWAKE);
updateOomAdj(client, client2, app);
@@ -1557,12 +1562,12 @@
MOCKAPP_PROCESSNAME, MOCKAPP_PACKAGENAME, false));
ProcessRecord client = spy(makeDefaultProcessRecord(MOCKAPP2_PID, MOCKAPP2_UID,
MOCKAPP2_PROCESSNAME, MOCKAPP2_PACKAGENAME, false));
- bindService(app, client, null, 0, mock(IBinder.class));
+ bindService(app, client, null, null, 0, mock(IBinder.class));
ProcessRecord client2 = spy(makeDefaultProcessRecord(MOCKAPP3_PID, MOCKAPP3_UID,
MOCKAPP3_PROCESSNAME, MOCKAPP3_PACKAGENAME, false));
- bindService(client, client2, null, 0, mock(IBinder.class));
+ bindService(client, client2, null, null, 0, mock(IBinder.class));
client2.mServices.setHasForegroundServices(true, 0, /* hasNoneType=*/true);
- bindService(client2, app, null, 0, mock(IBinder.class));
+ bindService(client2, app, null, null, 0, mock(IBinder.class));
// Note: We add processes to LRU but still call updateOomAdjLocked() with a specific
// processes.
@@ -1599,11 +1604,11 @@
MOCKAPP_PROCESSNAME, MOCKAPP_PACKAGENAME, false));
ProcessRecord client = spy(makeDefaultProcessRecord(MOCKAPP2_PID, MOCKAPP2_UID,
MOCKAPP2_PROCESSNAME, MOCKAPP2_PACKAGENAME, false));
- bindService(app, client, null, 0, mock(IBinder.class));
- bindService(client, app, null, 0, mock(IBinder.class));
+ bindService(app, client, null, null, 0, mock(IBinder.class));
+ bindService(client, app, null, null, 0, mock(IBinder.class));
ProcessRecord client2 = spy(makeDefaultProcessRecord(MOCKAPP3_PID, MOCKAPP3_UID,
MOCKAPP3_PROCESSNAME, MOCKAPP3_PACKAGENAME, false));
- bindService(client2, client, null, 0, mock(IBinder.class));
+ bindService(client2, client, null, null, 0, mock(IBinder.class));
client.mServices.setHasForegroundServices(true, 0, /* hasNoneType=*/true);
sService.mWakefulness.set(PowerManagerInternal.WAKEFULNESS_AWAKE);
updateOomAdj(app, client, client2);
@@ -1626,11 +1631,11 @@
MOCKAPP_PROCESSNAME, MOCKAPP_PACKAGENAME, false));
ProcessRecord client = spy(makeDefaultProcessRecord(MOCKAPP2_PID, MOCKAPP2_UID,
MOCKAPP2_PROCESSNAME, MOCKAPP2_PACKAGENAME, false));
- bindService(app, client, null, 0, mock(IBinder.class));
+ bindService(app, client, null, null, 0, mock(IBinder.class));
ProcessRecord client2 = spy(makeDefaultProcessRecord(MOCKAPP3_PID, MOCKAPP3_UID,
MOCKAPP3_PROCESSNAME, MOCKAPP3_PACKAGENAME, false));
- bindService(client, client2, null, 0, mock(IBinder.class));
- bindService(client2, client, null, 0, mock(IBinder.class));
+ bindService(client, client2, null, null, 0, mock(IBinder.class));
+ bindService(client2, client, null, null, 0, mock(IBinder.class));
client.mServices.setHasForegroundServices(true, 0, /* hasNoneType=*/true);
sService.mWakefulness.set(PowerManagerInternal.WAKEFULNESS_AWAKE);
updateOomAdj(app, client, client2);
@@ -1653,18 +1658,18 @@
MOCKAPP_PROCESSNAME, MOCKAPP_PACKAGENAME, false));
ProcessRecord client = spy(makeDefaultProcessRecord(MOCKAPP2_PID, MOCKAPP2_UID,
MOCKAPP2_PROCESSNAME, MOCKAPP2_PACKAGENAME, false));
- bindService(app, client, null, 0, mock(IBinder.class));
+ bindService(app, client, null, null, 0, mock(IBinder.class));
ProcessRecord client2 = spy(makeDefaultProcessRecord(MOCKAPP3_PID, MOCKAPP3_UID,
MOCKAPP3_PROCESSNAME, MOCKAPP3_PACKAGENAME, false));
- bindService(client, client2, null, 0, mock(IBinder.class));
- bindService(client2, client, null, 0, mock(IBinder.class));
+ bindService(client, client2, null, null, 0, mock(IBinder.class));
+ bindService(client2, client, null, null, 0, mock(IBinder.class));
ProcessRecord client3 = spy(makeDefaultProcessRecord(MOCKAPP4_PID, MOCKAPP4_UID,
MOCKAPP4_PROCESSNAME, MOCKAPP4_PACKAGENAME, false));
- bindService(client3, client, null, 0, mock(IBinder.class));
+ bindService(client3, client, null, null, 0, mock(IBinder.class));
ProcessRecord client4 = spy(makeDefaultProcessRecord(MOCKAPP5_PID, MOCKAPP5_UID,
MOCKAPP5_PROCESSNAME, MOCKAPP5_PACKAGENAME, false));
- bindService(client3, client4, null, 0, mock(IBinder.class));
- bindService(client4, client3, null, 0, mock(IBinder.class));
+ bindService(client3, client4, null, null, 0, mock(IBinder.class));
+ bindService(client4, client3, null, null, 0, mock(IBinder.class));
client.mServices.setHasForegroundServices(true, 0, /* hasNoneType=*/true);
sService.mWakefulness.set(PowerManagerInternal.WAKEFULNESS_AWAKE);
updateOomAdj(app, client, client2, client3, client4);
@@ -1693,16 +1698,16 @@
MOCKAPP_PROCESSNAME, MOCKAPP_PACKAGENAME, false));
ProcessRecord client = spy(makeDefaultProcessRecord(MOCKAPP2_PID, MOCKAPP2_UID,
MOCKAPP2_PROCESSNAME, MOCKAPP2_PACKAGENAME, false));
- bindService(app, client, null, 0, mock(IBinder.class));
+ bindService(app, client, null, null, 0, mock(IBinder.class));
ProcessRecord client2 = spy(makeDefaultProcessRecord(MOCKAPP3_PID, MOCKAPP3_UID,
MOCKAPP3_PROCESSNAME, MOCKAPP3_PACKAGENAME, false));
- bindService(client, client2, null, 0, mock(IBinder.class));
+ bindService(client, client2, null, null, 0, mock(IBinder.class));
client2.mServices.setHasForegroundServices(true, 0, /* hasNoneType=*/true);
- bindService(client2, app, null, 0, mock(IBinder.class));
+ bindService(client2, app, null, null, 0, mock(IBinder.class));
ProcessRecord client3 = spy(makeDefaultProcessRecord(MOCKAPP4_PID, MOCKAPP4_UID,
MOCKAPP4_PROCESSNAME, MOCKAPP4_PACKAGENAME, false));
client3.mState.setForcingToImportant(new Object());
- bindService(app, client3, null, 0, mock(IBinder.class));
+ bindService(app, client3, null, null, 0, mock(IBinder.class));
sService.mWakefulness.set(PowerManagerInternal.WAKEFULNESS_AWAKE);
updateOomAdj(app, client, client2, client3);
@@ -1718,17 +1723,17 @@
MOCKAPP_PROCESSNAME, MOCKAPP_PACKAGENAME, false));
ProcessRecord client = spy(makeDefaultProcessRecord(MOCKAPP2_PID, MOCKAPP2_UID,
MOCKAPP2_PROCESSNAME, MOCKAPP2_PACKAGENAME, false));
- bindService(app, client, null, 0, mock(IBinder.class));
+ bindService(app, client, null, null, 0, mock(IBinder.class));
ProcessRecord client2 = spy(makeDefaultProcessRecord(MOCKAPP3_PID, MOCKAPP3_UID,
MOCKAPP3_PROCESSNAME, MOCKAPP3_PACKAGENAME, false));
- bindService(client, client2, null, 0, mock(IBinder.class));
- bindService(client2, app, null, 0, mock(IBinder.class));
+ bindService(client, client2, null, null, 0, mock(IBinder.class));
+ bindService(client2, app, null, null, 0, mock(IBinder.class));
WindowProcessController wpc = client2.getWindowProcessController();
doReturn(true).when(wpc).isHomeProcess();
ProcessRecord client3 = spy(makeDefaultProcessRecord(MOCKAPP4_PID, MOCKAPP4_UID,
MOCKAPP4_PROCESSNAME, MOCKAPP4_PACKAGENAME, false));
client3.mState.setForcingToImportant(new Object());
- bindService(app, client3, null, 0, mock(IBinder.class));
+ bindService(app, client3, null, null, 0, mock(IBinder.class));
sService.mWakefulness.set(PowerManagerInternal.WAKEFULNESS_AWAKE);
updateOomAdj(app, client, client2, client3);
@@ -1743,11 +1748,11 @@
MOCKAPP_PROCESSNAME, MOCKAPP_PACKAGENAME, false));
ProcessRecord client = spy(makeDefaultProcessRecord(MOCKAPP2_PID, MOCKAPP2_UID,
MOCKAPP2_PROCESSNAME, MOCKAPP2_PACKAGENAME, false));
- bindService(app, client, null, 0, mock(IBinder.class));
+ bindService(app, client, null, null, 0, mock(IBinder.class));
ProcessRecord client2 = spy(makeDefaultProcessRecord(MOCKAPP3_PID, MOCKAPP3_UID,
MOCKAPP3_PROCESSNAME, MOCKAPP3_PACKAGENAME, false));
- bindService(client, client2, null, 0, mock(IBinder.class));
- bindService(client2, app, null, 0, mock(IBinder.class));
+ bindService(client, client2, null, null, 0, mock(IBinder.class));
+ bindService(client2, app, null, null, 0, mock(IBinder.class));
WindowProcessController wpc = client2.getWindowProcessController();
doReturn(true).when(wpc).isHomeProcess();
ProcessRecord client3 = spy(makeDefaultProcessRecord(MOCKAPP4_PID, MOCKAPP4_UID,
@@ -1755,7 +1760,7 @@
ProcessRecord client4 = spy(makeDefaultProcessRecord(MOCKAPP5_PID, MOCKAPP5_UID,
MOCKAPP5_PROCESSNAME, MOCKAPP5_PACKAGENAME, false));
client4.mState.setForcingToImportant(new Object());
- bindService(app, client4, null, 0, mock(IBinder.class));
+ bindService(app, client4, null, null, 0, mock(IBinder.class));
sService.mWakefulness.set(PowerManagerInternal.WAKEFULNESS_AWAKE);
updateOomAdj(app, client, client2, client3, client4);
@@ -1770,21 +1775,21 @@
MOCKAPP_PROCESSNAME, MOCKAPP_PACKAGENAME, false));
ProcessRecord client = spy(makeDefaultProcessRecord(MOCKAPP2_PID, MOCKAPP2_UID,
MOCKAPP2_PROCESSNAME, MOCKAPP2_PACKAGENAME, false));
- bindService(app, client, null, 0, mock(IBinder.class));
+ bindService(app, client, null, null, 0, mock(IBinder.class));
ProcessRecord client2 = spy(makeDefaultProcessRecord(MOCKAPP3_PID, MOCKAPP3_UID,
MOCKAPP3_PROCESSNAME, MOCKAPP3_PACKAGENAME, false));
- bindService(client, client2, null, 0, mock(IBinder.class));
- bindService(client2, app, null, 0, mock(IBinder.class));
+ bindService(client, client2, null, null, 0, mock(IBinder.class));
+ bindService(client2, app, null, null, 0, mock(IBinder.class));
WindowProcessController wpc = client2.getWindowProcessController();
doReturn(true).when(wpc).isHomeProcess();
ProcessRecord client3 = spy(makeDefaultProcessRecord(MOCKAPP4_PID, MOCKAPP4_UID,
MOCKAPP4_PROCESSNAME, MOCKAPP4_PACKAGENAME, false));
client3.mState.setForcingToImportant(new Object());
- bindService(app, client3, null, 0, mock(IBinder.class));
+ bindService(app, client3, null, null, 0, mock(IBinder.class));
ProcessRecord client4 = spy(makeDefaultProcessRecord(MOCKAPP5_PID, MOCKAPP5_UID,
MOCKAPP5_PROCESSNAME, MOCKAPP5_PACKAGENAME, false));
client4.mServices.setHasForegroundServices(true, 0, /* hasNoneType=*/true);
- bindService(app, client4, null, 0, mock(IBinder.class));
+ bindService(app, client4, null, null, 0, mock(IBinder.class));
sService.mWakefulness.set(PowerManagerInternal.WAKEFULNESS_AWAKE);
updateOomAdj(app, client, client2, client3, client4);
@@ -1802,15 +1807,15 @@
MOCKAPP2_PROCESSNAME, MOCKAPP2_PACKAGENAME, false));
WindowProcessController wpc = client.getWindowProcessController();
doReturn(true).when(wpc).isHomeProcess();
- bindService(app, client, null, 0, mock(IBinder.class));
+ bindService(app, client, null, null, 0, mock(IBinder.class));
ProcessRecord client2 = spy(makeDefaultProcessRecord(MOCKAPP3_PID, MOCKAPP3_UID,
MOCKAPP3_PROCESSNAME, MOCKAPP3_PACKAGENAME, false));
- bindService(app, client2, null, 0, mock(IBinder.class));
+ bindService(app, client2, null, null, 0, mock(IBinder.class));
client2.mServices.setHasForegroundServices(true, 0, /* hasNoneType=*/true);
ProcessRecord client3 = spy(makeDefaultProcessRecord(MOCKAPP4_PID, MOCKAPP4_UID,
MOCKAPP4_PROCESSNAME, MOCKAPP4_PACKAGENAME, false));
client3.mState.setForcingToImportant(new Object());
- bindService(app, client3, null, 0, mock(IBinder.class));
+ bindService(app, client3, null, null, 0, mock(IBinder.class));
sService.mWakefulness.set(PowerManagerInternal.WAKEFULNESS_AWAKE);
updateOomAdj(client, client2, client3, app);
@@ -1826,7 +1831,7 @@
MOCKAPP_PROCESSNAME, MOCKAPP_PACKAGENAME, false));
ProcessRecord client = spy(makeDefaultProcessRecord(MOCKAPP2_PID, MOCKAPP2_UID,
MOCKAPP2_PROCESSNAME, MOCKAPP2_PACKAGENAME, false));
- bindService(app, client, null, 0, mock(IBinder.class));
+ bindService(app, client, null, null, 0, mock(IBinder.class));
ProcessRecord client2 = spy(makeDefaultProcessRecord(MOCKAPP3_PID, MOCKAPP3_UID,
MOCKAPP3_PROCESSNAME, MOCKAPP3_PACKAGENAME, false));
bindProvider(client, client2, null, null, false);
@@ -1846,12 +1851,12 @@
MOCKAPP_PROCESSNAME, MOCKAPP_PACKAGENAME, false));
ProcessRecord client = spy(makeDefaultProcessRecord(MOCKAPP2_PID, MOCKAPP2_UID,
MOCKAPP2_PROCESSNAME, MOCKAPP2_PACKAGENAME, false));
- bindService(app, client, null, 0, mock(IBinder.class));
+ bindService(app, client, null, null, 0, mock(IBinder.class));
ProcessRecord client2 = spy(makeDefaultProcessRecord(MOCKAPP3_PID, MOCKAPP3_UID,
MOCKAPP3_PROCESSNAME, MOCKAPP3_PACKAGENAME, false));
bindProvider(client, client2, null, null, false);
client2.mServices.setHasForegroundServices(true, 0, /* hasNoneType=*/true);
- bindService(client2, app, null, 0, mock(IBinder.class));
+ bindService(client2, app, null, null, 0, mock(IBinder.class));
sService.mWakefulness.set(PowerManagerInternal.WAKEFULNESS_AWAKE);
updateOomAdj(app, client, client2);
@@ -1912,9 +1917,9 @@
MOCKAPP3_PROCESSNAME, MOCKAPP3_PACKAGENAME, false));
final ProcessRecord client2 = spy(makeDefaultProcessRecord(MOCKAPP4_PID, MOCKAPP4_UID,
MOCKAPP4_PROCESSNAME, MOCKAPP4_PACKAGENAME, false));
- bindService(app1, client1, null, Context.BIND_FOREGROUND_SERVICE_WHILE_AWAKE,
+ bindService(app1, client1, null, null, Context.BIND_FOREGROUND_SERVICE_WHILE_AWAKE,
mock(IBinder.class));
- bindService(app2, client2, null, Context.BIND_FOREGROUND_SERVICE_WHILE_AWAKE,
+ bindService(app2, client2, null, null, Context.BIND_FOREGROUND_SERVICE_WHILE_AWAKE,
mock(IBinder.class));
client1.mState.setMaxAdj(PERSISTENT_PROC_ADJ);
client2.mServices.setHasForegroundServices(true, 0, /* hasNoneType=*/true);
@@ -1929,8 +1934,10 @@
assertBfsl(app1);
assertBfsl(app2);
- bindService(app1, client1, null, Context.BIND_SCHEDULE_LIKE_TOP_APP, mock(IBinder.class));
- bindService(app2, client2, null, Context.BIND_SCHEDULE_LIKE_TOP_APP, mock(IBinder.class));
+ bindService(app1, client1, null, null, Context.BIND_SCHEDULE_LIKE_TOP_APP,
+ mock(IBinder.class));
+ bindService(app2, client2, null, null, Context.BIND_SCHEDULE_LIKE_TOP_APP,
+ mock(IBinder.class));
updateOomAdj(client1, client2, app1, app2);
assertProcStates(app1, PROCESS_STATE_BOUND_FOREGROUND_SERVICE, VISIBLE_APP_ADJ,
@@ -1946,8 +1953,8 @@
SCHED_GROUP_DEFAULT);
assertBfsl(app2);
- bindService(client2, app1, null, 0, mock(IBinder.class));
- bindService(app1, client2, null, 0, mock(IBinder.class));
+ bindService(client2, app1, null, null, 0, mock(IBinder.class));
+ bindService(app1, client2, null, null, 0, mock(IBinder.class));
client2.mServices.setHasForegroundServices(false, 0, /* hasNoneType=*/false);
updateOomAdj(app1, client1, client2);
assertProcStates(app1, PROCESS_STATE_IMPORTANT_FOREGROUND, VISIBLE_APP_ADJ,
@@ -1968,9 +1975,9 @@
client1.mState.setMaxAdj(PERSISTENT_PROC_ADJ);
client2.mState.setMaxAdj(PERSISTENT_PROC_ADJ);
- final ServiceRecord s1 = bindService(app1, client1, null,
+ final ServiceRecord s1 = bindService(app1, client1, null, null,
Context.BIND_TREAT_LIKE_VISIBLE_FOREGROUND_SERVICE, mock(IBinder.class));
- final ServiceRecord s2 = bindService(app2, client2, null,
+ final ServiceRecord s2 = bindService(app2, client2, null, null,
Context.BIND_IMPORTANT, mock(IBinder.class));
updateOomAdj(client1, client2, app1, app2);
@@ -1980,7 +1987,7 @@
assertProcStates(app2, PROCESS_STATE_PERSISTENT, PERSISTENT_SERVICE_ADJ,
SCHED_GROUP_DEFAULT);
- bindService(app2, client1, s2, Context.BIND_TREAT_LIKE_VISIBLE_FOREGROUND_SERVICE,
+ bindService(app2, client1, null, s2, Context.BIND_TREAT_LIKE_VISIBLE_FOREGROUND_SERVICE,
mock(IBinder.class));
updateOomAdj(app2);
assertProcStates(app2, PROCESS_STATE_PERSISTENT, PERSISTENT_SERVICE_ADJ,
@@ -1995,9 +2002,9 @@
client1.mServices.setHasForegroundServices(true, 0, /* hasNoneType=*/true);
client2.mState.setHasOverlayUi(true);
- bindService(app1, client1, s1, Context.BIND_TREAT_LIKE_VISIBLE_FOREGROUND_SERVICE,
+ bindService(app1, client1, null, s1, Context.BIND_TREAT_LIKE_VISIBLE_FOREGROUND_SERVICE,
mock(IBinder.class));
- bindService(app2, client2, s2, Context.BIND_TREAT_LIKE_VISIBLE_FOREGROUND_SERVICE,
+ bindService(app2, client2, null, s2, Context.BIND_TREAT_LIKE_VISIBLE_FOREGROUND_SERVICE,
mock(IBinder.class));
updateOomAdj(client1, client2, app1, app2);
@@ -2030,7 +2037,7 @@
app1.mServices.setHasForegroundServices(true, 0, /* hasNoneType=*/true);
sService.mWakefulness.set(PowerManagerInternal.WAKEFULNESS_AWAKE);
- bindService(app1, client1, null, Context.BIND_NOT_PERCEPTIBLE, mock(IBinder.class));
+ bindService(app1, client1, null, null, Context.BIND_NOT_PERCEPTIBLE, mock(IBinder.class));
updateOomAdj(client1, app1);
@@ -2051,7 +2058,8 @@
app1.mServices.setHasForegroundServices(true, 0, /* hasNoneType=*/true);
sService.mWakefulness.set(PowerManagerInternal.WAKEFULNESS_AWAKE);
- bindService(app1, client1, null, Context.BIND_ALMOST_PERCEPTIBLE, mock(IBinder.class));
+ bindService(app1, client1, null, null, Context.BIND_ALMOST_PERCEPTIBLE,
+ mock(IBinder.class));
updateOomAdj(client1, app1);
@@ -2121,19 +2129,19 @@
final ComponentName cn1 = ComponentName.unflattenFromString(
MOCKAPP_PACKAGENAME + "/.TestService");
- final ServiceRecord s1 = bindService(app1, client1, null, 0, mock(IBinder.class));
+ final ServiceRecord s1 = bindService(app1, client1, null, null, 0, mock(IBinder.class));
setFieldValue(ServiceRecord.class, s1, "name", cn1);
s1.startRequested = true;
final ComponentName cn2 = ComponentName.unflattenFromString(
MOCKAPP2_PACKAGENAME + "/.TestService");
- final ServiceRecord s2 = bindService(app2, client2, null, 0, mock(IBinder.class));
+ final ServiceRecord s2 = bindService(app2, client2, null, null, 0, mock(IBinder.class));
setFieldValue(ServiceRecord.class, s2, "name", cn2);
s2.startRequested = true;
final ComponentName cn3 = ComponentName.unflattenFromString(
MOCKAPP5_PACKAGENAME + "/.TestService");
- final ServiceRecord s3 = bindService(app3, client1, null, 0, mock(IBinder.class));
+ final ServiceRecord s3 = bindService(app3, client1, null, null, 0, mock(IBinder.class));
setFieldValue(ServiceRecord.class, s3, "name", cn3);
s3.startRequested = true;
@@ -2177,7 +2185,7 @@
clientUidRecord.setIdle(true);
doReturn(ActivityManager.APP_START_MODE_DELAYED).when(sService)
.getAppStartModeLOSP(anyInt(), any(String.class), anyInt(),
- anyInt(), anyBoolean(), anyBoolean(), anyBoolean());
+ anyInt(), anyBoolean(), anyBoolean(), anyBoolean());
doNothing().when(sService.mServices)
.scheduleServiceTimeoutLocked(any(ProcessRecord.class));
updateOomAdj(client1, client2, app1, app2, app3);
@@ -2188,7 +2196,7 @@
} finally {
doCallRealMethod().when(sService)
.getAppStartModeLOSP(anyInt(), any(String.class), anyInt(),
- anyInt(), anyBoolean(), anyBoolean(), anyBoolean());
+ anyInt(), anyBoolean(), anyBoolean(), anyBoolean());
sService.mServices.mServiceMap.clear();
sService.mOomAdjuster.mActiveUids.clear();
}
@@ -2223,7 +2231,7 @@
ProcessRecord app2 = spy(makeDefaultProcessRecord(MOCKAPP2_PID, MOCKAPP2_UID,
MOCKAPP2_PROCESSNAME, MOCKAPP2_PACKAGENAME, false));
app2.mServices.setHasForegroundServices(true, 0, /* hasNoneType=*/true);
- bindService(app, app2, null, 0, mock(IBinder.class));
+ bindService(app, app2, null, null, 0, mock(IBinder.class));
sService.mWakefulness.set(PowerManagerInternal.WAKEFULNESS_AWAKE);
updateOomAdj(app, app2);
@@ -2242,12 +2250,12 @@
MOCKAPP_PROCESSNAME, MOCKAPP_PACKAGENAME, false));
ProcessRecord app2 = spy(makeDefaultProcessRecord(MOCKAPP2_PID, MOCKAPP2_UID,
MOCKAPP2_PROCESSNAME, MOCKAPP2_PACKAGENAME, false));
- bindService(app, app2, null, 0, mock(IBinder.class));
+ bindService(app, app2, null, null, 0, mock(IBinder.class));
ProcessRecord app3 = spy(makeDefaultProcessRecord(MOCKAPP3_PID, MOCKAPP3_UID,
MOCKAPP3_PROCESSNAME, MOCKAPP3_PACKAGENAME, false));
- bindService(app2, app3, null, 0, mock(IBinder.class));
+ bindService(app2, app3, null, null, 0, mock(IBinder.class));
app3.mServices.setHasForegroundServices(true, 0, /* hasNoneType=*/true);
- bindService(app3, app, null, 0, mock(IBinder.class));
+ bindService(app3, app, null, null, 0, mock(IBinder.class));
sService.mWakefulness.set(PowerManagerInternal.WAKEFULNESS_AWAKE);
updateOomAdj(app, app2, app3);
@@ -2278,21 +2286,21 @@
MOCKAPP_PROCESSNAME, MOCKAPP_PACKAGENAME, false));
ProcessRecord app2 = spy(makeDefaultProcessRecord(MOCKAPP2_PID, MOCKAPP2_UID,
MOCKAPP2_PROCESSNAME, MOCKAPP2_PACKAGENAME, false));
- ServiceRecord s = bindService(app, app2, null, 0, mock(IBinder.class));
+ ServiceRecord s = bindService(app, app2, null, null, 0, mock(IBinder.class));
ProcessRecord app3 = spy(makeDefaultProcessRecord(MOCKAPP3_PID, MOCKAPP3_UID,
MOCKAPP3_PROCESSNAME, MOCKAPP3_PACKAGENAME, false));
- bindService(app2, app3, null, 0, mock(IBinder.class));
- bindService(app3, app, null, 0, mock(IBinder.class));
+ bindService(app2, app3, null, null, 0, mock(IBinder.class));
+ bindService(app3, app, null, null, 0, mock(IBinder.class));
WindowProcessController wpc = app3.getWindowProcessController();
doReturn(true).when(wpc).isHomeProcess();
ProcessRecord app4 = spy(makeDefaultProcessRecord(MOCKAPP4_PID, MOCKAPP4_UID,
MOCKAPP4_PROCESSNAME, MOCKAPP4_PACKAGENAME, false));
app4.mState.setHasOverlayUi(true);
- bindService(app, app4, s, 0, mock(IBinder.class));
+ bindService(app, app4, null, s, 0, mock(IBinder.class));
ProcessRecord app5 = spy(makeDefaultProcessRecord(MOCKAPP5_PID, MOCKAPP5_UID,
MOCKAPP5_PROCESSNAME, MOCKAPP5_PACKAGENAME, false));
app5.mServices.setHasForegroundServices(true, 0, /* hasNoneType=*/true);
- bindService(app, app5, s, 0, mock(IBinder.class));
+ bindService(app, app5, null, s, 0, mock(IBinder.class));
sService.mWakefulness.set(PowerManagerInternal.WAKEFULNESS_AWAKE);
updateOomAdj(app, app2, app3, app4, app5);
@@ -2320,21 +2328,21 @@
MOCKAPP_PROCESSNAME, MOCKAPP_PACKAGENAME, false));
ProcessRecord app2 = spy(makeDefaultProcessRecord(MOCKAPP2_PID, MOCKAPP2_UID,
MOCKAPP2_PROCESSNAME, MOCKAPP2_PACKAGENAME, false));
- ServiceRecord s = bindService(app, app2, null, 0, mock(IBinder.class));
+ ServiceRecord s = bindService(app, app2, null, null, 0, mock(IBinder.class));
ProcessRecord app3 = spy(makeDefaultProcessRecord(MOCKAPP3_PID, MOCKAPP3_UID,
MOCKAPP3_PROCESSNAME, MOCKAPP3_PACKAGENAME, false));
- bindService(app2, app3, null, 0, mock(IBinder.class));
- bindService(app3, app, null, 0, mock(IBinder.class));
+ bindService(app2, app3, null, null, 0, mock(IBinder.class));
+ bindService(app3, app, null, null, 0, mock(IBinder.class));
WindowProcessController wpc = app3.getWindowProcessController();
doReturn(true).when(wpc).isHomeProcess();
ProcessRecord app4 = spy(makeDefaultProcessRecord(MOCKAPP4_PID, MOCKAPP4_UID,
MOCKAPP4_PROCESSNAME, MOCKAPP4_PACKAGENAME, false));
app4.mState.setHasOverlayUi(true);
- bindService(app, app4, s, 0, mock(IBinder.class));
+ bindService(app, app4, null, s, 0, mock(IBinder.class));
ProcessRecord app5 = spy(makeDefaultProcessRecord(MOCKAPP5_PID, MOCKAPP5_UID,
MOCKAPP5_PROCESSNAME, MOCKAPP5_PACKAGENAME, false));
app5.mServices.setHasForegroundServices(true, 0, /* hasNoneType=*/true);
- bindService(app, app5, s, 0, mock(IBinder.class));
+ bindService(app, app5, null, s, 0, mock(IBinder.class));
sService.mWakefulness.set(PowerManagerInternal.WAKEFULNESS_AWAKE);
updateOomAdj(app5, app4, app3, app2, app);
@@ -2362,21 +2370,21 @@
MOCKAPP_PROCESSNAME, MOCKAPP_PACKAGENAME, false));
ProcessRecord app2 = spy(makeDefaultProcessRecord(MOCKAPP2_PID, MOCKAPP2_UID,
MOCKAPP2_PROCESSNAME, MOCKAPP2_PACKAGENAME, false));
- ServiceRecord s = bindService(app, app2, null, 0, mock(IBinder.class));
+ ServiceRecord s = bindService(app, app2, null, null, 0, mock(IBinder.class));
ProcessRecord app3 = spy(makeDefaultProcessRecord(MOCKAPP3_PID, MOCKAPP3_UID,
MOCKAPP3_PROCESSNAME, MOCKAPP3_PACKAGENAME, false));
- bindService(app2, app3, null, 0, mock(IBinder.class));
- bindService(app3, app, null, 0, mock(IBinder.class));
+ bindService(app2, app3, null, null, 0, mock(IBinder.class));
+ bindService(app3, app, null, null, 0, mock(IBinder.class));
WindowProcessController wpc = app3.getWindowProcessController();
doReturn(true).when(wpc).isHomeProcess();
ProcessRecord app4 = spy(makeDefaultProcessRecord(MOCKAPP4_PID, MOCKAPP4_UID,
MOCKAPP4_PROCESSNAME, MOCKAPP4_PACKAGENAME, false));
app4.mState.setHasOverlayUi(true);
- bindService(app, app4, s, 0, mock(IBinder.class));
+ bindService(app, app4, null, s, 0, mock(IBinder.class));
ProcessRecord app5 = spy(makeDefaultProcessRecord(MOCKAPP5_PID, MOCKAPP5_UID,
MOCKAPP5_PROCESSNAME, MOCKAPP5_PACKAGENAME, false));
app5.mServices.setHasForegroundServices(true, 0, /* hasNoneType=*/true);
- bindService(app, app5, s, 0, mock(IBinder.class));
+ bindService(app, app5, null, s, 0, mock(IBinder.class));
sService.mWakefulness.set(PowerManagerInternal.WAKEFULNESS_AWAKE);
updateOomAdj(app3, app4, app2, app, app5);
@@ -2404,15 +2412,19 @@
MOCKAPP_PROCESSNAME, MOCKAPP_PACKAGENAME, false));
ProcessRecord client = spy(makeDefaultProcessRecord(MOCKAPP2_PID, MOCKAPP2_UID,
MOCKAPP2_PROCESSNAME, MOCKAPP2_PACKAGENAME, false));
- bindService(app, client, null, Context.BIND_INCLUDE_CAPABILITIES, mock(IBinder.class));
+ bindService(app, client, null, null, Context.BIND_INCLUDE_CAPABILITIES,
+ mock(IBinder.class));
ProcessRecord client2 = spy(makeDefaultProcessRecord(MOCKAPP3_PID, MOCKAPP3_UID,
MOCKAPP3_PROCESSNAME, MOCKAPP3_PACKAGENAME, false));
- bindService(client, client2, null, Context.BIND_INCLUDE_CAPABILITIES, mock(IBinder.class));
- bindService(client2, app, null, Context.BIND_INCLUDE_CAPABILITIES, mock(IBinder.class));
+ bindService(client, client2, null, null, Context.BIND_INCLUDE_CAPABILITIES,
+ mock(IBinder.class));
+ bindService(client2, app, null, null, Context.BIND_INCLUDE_CAPABILITIES,
+ mock(IBinder.class));
ProcessRecord client3 = spy(makeDefaultProcessRecord(MOCKAPP4_PID, MOCKAPP4_UID,
MOCKAPP4_PROCESSNAME, MOCKAPP4_PACKAGENAME, false));
client3.mState.setMaxAdj(PERSISTENT_PROC_ADJ);
- bindService(app, client3, null, Context.BIND_INCLUDE_CAPABILITIES, mock(IBinder.class));
+ bindService(app, client3, null, null, Context.BIND_INCLUDE_CAPABILITIES,
+ mock(IBinder.class));
sService.mWakefulness.set(PowerManagerInternal.WAKEFULNESS_AWAKE);
updateOomAdj(app, client, client2, client3);
@@ -2472,10 +2484,10 @@
ProcessRecord app2 = spy(makeDefaultProcessRecord(MOCKAPP2_PID, MOCKAPP2_UID,
MOCKAPP2_PROCESSNAME, MOCKAPP2_PACKAGENAME, false));
long now = SystemClock.uptimeMillis();
- ServiceRecord s = bindService(app, app2, null, 0, mock(IBinder.class));
+ ServiceRecord s = bindService(app, app2, null, null, 0, mock(IBinder.class));
s.startRequested = true;
s.lastActivity = now;
- s = bindService(app2, app, null, 0, mock(IBinder.class));
+ s = bindService(app2, app, null, null, 0, mock(IBinder.class));
s.startRequested = true;
s.lastActivity = now;
ProcessRecord app3 = spy(makeDefaultProcessRecord(MOCKAPP3_PID, MOCKAPP3_UID,
@@ -2507,11 +2519,11 @@
final int userOwner = 0;
final int userOther = 1;
final int cachedAdj1 = sService.mConstants.USE_TIERED_CACHED_ADJ
- ? CACHED_APP_MIN_ADJ + 10
- : CACHED_APP_MIN_ADJ + ProcessList.CACHED_APP_IMPORTANCE_LEVELS;
+ ? CACHED_APP_MIN_ADJ + 10
+ : CACHED_APP_MIN_ADJ + ProcessList.CACHED_APP_IMPORTANCE_LEVELS;
final int cachedAdj2 = sService.mConstants.USE_TIERED_CACHED_ADJ
- ? CACHED_APP_MIN_ADJ + 10
- : cachedAdj1 + ProcessList.CACHED_APP_IMPORTANCE_LEVELS * 2;
+ ? CACHED_APP_MIN_ADJ + 10
+ : cachedAdj1 + ProcessList.CACHED_APP_IMPORTANCE_LEVELS * 2;
doReturn(userOwner).when(sService.mUserController).getCurrentUserId();
final ArrayList<ProcessRecord> lru = sService.mProcessList.getLruProcessesLOSP();
@@ -2626,7 +2638,7 @@
// Simulate binding to a service in the same process using BIND_ABOVE_CLIENT and
// verify that its OOM adjustment level is unaffected.
- bindService(app, app, null, Context.BIND_ABOVE_CLIENT, mock(IBinder.class));
+ bindService(app, app, null, null, Context.BIND_ABOVE_CLIENT, mock(IBinder.class));
app.mServices.updateHasAboveClientLocked();
assertFalse(app.mServices.hasAboveClient());
@@ -2644,12 +2656,12 @@
final ProcessRecord app3 = spy(makeDefaultProcessRecord(MOCKAPP3_PID, MOCKAPP3_UID,
MOCKAPP3_PROCESSNAME, MOCKAPP3_PACKAGENAME, false));
long now = SystemClock.uptimeMillis();
- ServiceRecord s = bindService(app, app2, null, 0, mock(IBinder.class));
+ ServiceRecord s = bindService(app, app2, null, null, 0, mock(IBinder.class));
s.startRequested = true;
s.lastActivity = now;
- s = bindService(app2, app3, null, 0, mock(IBinder.class));
+ s = bindService(app2, app3, null, null, 0, mock(IBinder.class));
s.lastActivity = now;
- s = bindService(app3, app2, null, 0, mock(IBinder.class));
+ s = bindService(app3, app2, null, null, 0, mock(IBinder.class));
s.lastActivity = now;
sService.mWakefulness.set(PowerManagerInternal.WAKEFULNESS_AWAKE);
@@ -2678,7 +2690,7 @@
// Start binding to a service that isn't running yet.
ServiceRecord sr = makeServiceRecord(app);
sr.app = null;
- bindService(null, app, sr, Context.BIND_ABOVE_CLIENT, mock(IBinder.class));
+ bindService(null, app, null, sr, Context.BIND_ABOVE_CLIENT, mock(IBinder.class));
// Since sr.app is null, this service cannot be in the same process as the
// client so we expect the BIND_ABOVE_CLIENT adjustment to take effect.
@@ -2772,91 +2784,37 @@
ApplicationExitInfo.SUBREASON_ISOLATED_NOT_NEEDED, true);
}
- private ProcessRecord makeDefaultProcessRecord(int pid, int uid, String processName,
- String packageName, boolean hasShownUi) {
- long now = SystemClock.uptimeMillis();
- return makeProcessRecord(sService, pid, uid, processName,
- packageName, 12345, Build.VERSION_CODES.CUR_DEVELOPMENT,
- now, now, now, 12345, UNKNOWN_ADJ, UNKNOWN_ADJ,
- UNKNOWN_ADJ, CACHED_APP_MAX_ADJ,
- SCHED_GROUP_DEFAULT, SCHED_GROUP_DEFAULT,
- PROCESS_STATE_NONEXISTENT, PROCESS_STATE_NONEXISTENT,
- PROCESS_STATE_NONEXISTENT, PROCESS_STATE_NONEXISTENT,
- 0, 0, false, false, false, ServiceInfo.FOREGROUND_SERVICE_TYPE_NONE,
- false, false, false, hasShownUi, false, false, false, false, false, false, null,
- 0, Long.MIN_VALUE, Long.MIN_VALUE, true, 0, null, false);
+ @SuppressWarnings("GuardedBy")
+ @Test
+ public void testUpdateOomAdj_DoAll_SdkSandbox_attributedClient() {
+ ProcessRecord client = spy(makeDefaultProcessRecord(MOCKAPP2_PID, MOCKAPP2_UID,
+ MOCKAPP2_PROCESSNAME, MOCKAPP2_PACKAGENAME, false));
+ ProcessRecord attributedClient = spy(makeDefaultProcessRecord(MOCKAPP3_PID, MOCKAPP3_UID,
+ MOCKAPP3_PROCESSNAME, MOCKAPP3_PACKAGENAME, true));
+ ProcessRecord sandboxService = spy(new ProcessRecordBuilder(MOCKAPP_PID,
+ MOCKAPP_SDK_SANDBOX_UID, MOCKAPP_SDK_SANDBOX_PROCESSNAME, MOCKAPP_PACKAGENAME)
+ .setSdkSandboxClientAppPackage(MOCKAPP3_PACKAGENAME)
+ .build());
+
+ setProcessesToLru(sandboxService, client, attributedClient);
+
+ client.mState.setMaxAdj(PERSISTENT_PROC_ADJ);
+ attributedClient.mServices.setHasForegroundServices(true, 0, true);
+ bindService(sandboxService, client, attributedClient, null, 0, mock(IBinder.class));
+ sService.mWakefulness.set(PowerManagerInternal.WAKEFULNESS_AWAKE);
+ updateOomAdj();
+ assertProcStates(client, PROCESS_STATE_PERSISTENT, PERSISTENT_PROC_ADJ,
+ SCHED_GROUP_DEFAULT);
+ assertProcStates(attributedClient, PROCESS_STATE_FOREGROUND_SERVICE, PERCEPTIBLE_APP_ADJ,
+ SCHED_GROUP_DEFAULT);
+ assertProcStates(sandboxService, PROCESS_STATE_FOREGROUND_SERVICE, PERCEPTIBLE_APP_ADJ,
+ SCHED_GROUP_DEFAULT);
}
- private ProcessRecord makeProcessRecord(ActivityManagerService service, int pid, int uid,
- String processName, String packageName, long versionCode, int targetSdkVersion,
- long lastActivityTime, long lastPssTime, long nextPssTime, long lastPss, int maxAdj,
- int setRawAdj, int curAdj, int setAdj, int curSchedGroup, int setSchedGroup,
- int curProcState, int repProcState, int curRawProcState, int setProcState,
- int connectionGroup, int connectionImportance, boolean serviceb,
- boolean hasClientActivities, boolean hasForegroundServices, int fgServiceTypes,
- boolean hasForegroundActivities, boolean repForegroundActivities, boolean systemNoUi,
- boolean hasShownUi, boolean hasTopUi, boolean hasOverlayUi,
- boolean runningRemoteAnimation, boolean hasAboveClient, boolean treatLikeActivity,
- boolean killedByAm, Object forcingToImportant, int numOfCurReceivers,
- long lastProviderTime, long lastTopTime, boolean cached, int numOfExecutingServices,
- String isolatedEntryPoint, boolean execServicesFg) {
- ApplicationInfo ai = spy(new ApplicationInfo());
- ai.uid = uid;
- ai.packageName = packageName;
- ai.longVersionCode = versionCode;
- ai.targetSdkVersion = targetSdkVersion;
- ProcessRecord app = new ProcessRecord(service, ai, processName, uid);
- final ProcessStateRecord state = app.mState;
- final ProcessServiceRecord services = app.mServices;
- final ProcessReceiverRecord receivers = app.mReceivers;
- final ProcessProfileRecord profile = app.mProfile;
- final ProcessProviderRecord providers = app.mProviders;
- app.makeActive(mock(IApplicationThread.class), sService.mProcessStats);
- app.setLastActivityTime(lastActivityTime);
- app.setKilledByAm(killedByAm);
- app.setIsolatedEntryPoint(isolatedEntryPoint);
- setFieldValue(ProcessRecord.class, app, "mWindowProcessController",
- mock(WindowProcessController.class));
- profile.setLastPssTime(lastPssTime);
- profile.setNextPssTime(nextPssTime);
- profile.setLastPss(lastPss);
- state.setMaxAdj(maxAdj);
- state.setSetRawAdj(setRawAdj);
- state.setCurAdj(curAdj);
- state.setSetAdj(setAdj);
- state.setCurrentSchedulingGroup(curSchedGroup);
- state.setSetSchedGroup(setSchedGroup);
- state.setCurProcState(curProcState);
- state.setReportedProcState(repProcState);
- state.setCurRawProcState(curRawProcState);
- state.setSetProcState(setProcState);
- state.setServiceB(serviceb);
- state.setRepForegroundActivities(repForegroundActivities);
- state.setHasForegroundActivities(hasForegroundActivities);
- state.setSystemNoUi(systemNoUi);
- state.setHasShownUi(hasShownUi);
- state.setHasTopUi(hasTopUi);
- state.setRunningRemoteAnimation(runningRemoteAnimation);
- state.setHasOverlayUi(hasOverlayUi);
- state.setCached(cached);
- state.setLastTopTime(lastTopTime);
- state.setForcingToImportant(forcingToImportant);
- services.setConnectionGroup(connectionGroup);
- services.setConnectionImportance(connectionImportance);
- services.setHasClientActivities(hasClientActivities);
- services.setHasForegroundServices(hasForegroundServices, fgServiceTypes,
- /* hasNoneType=*/false);
- services.setHasAboveClient(hasAboveClient);
- services.setTreatLikeActivity(treatLikeActivity);
- services.setExecServicesFg(execServicesFg);
- for (int i = 0; i < numOfExecutingServices; i++) {
- services.startExecutingService(mock(ServiceRecord.class));
- }
- for (int i = 0; i < numOfCurReceivers; i++) {
- receivers.addCurReceiver(mock(BroadcastRecord.class));
- }
- providers.setLastProviderTime(lastProviderTime);
- return app;
+ private ProcessRecord makeDefaultProcessRecord(int pid, int uid, String processName,
+ String packageName, boolean hasShownUi) {
+ return new ProcessRecordBuilder(pid, uid, processName, packageName).setHasShownUi(
+ hasShownUi).build();
}
private ServiceRecord makeServiceRecord(ProcessRecord app) {
@@ -2870,6 +2828,7 @@
record.appInfo = app.info;
setFieldValue(ServiceRecord.class, record, "bindings", new ArrayMap<>());
setFieldValue(ServiceRecord.class, record, "pendingStarts", new ArrayList<>());
+ setFieldValue(ServiceRecord.class, record, "isSdkSandbox", app.isSdkSandbox);
return record;
}
@@ -2892,11 +2851,11 @@
}
private ServiceRecord bindService(ProcessRecord service, ProcessRecord client,
- ServiceRecord record, long bindFlags, IBinder binder) {
+ ProcessRecord attributedClient, ServiceRecord record, long bindFlags, IBinder binder) {
if (record == null) {
record = makeServiceRecord(service);
}
- AppBindRecord binding = new AppBindRecord(record, null, client, null);
+ AppBindRecord binding = new AppBindRecord(record, null, client, attributedClient);
ConnectionRecord cr = spy(new ConnectionRecord(binding,
mock(ActivityServiceConnectionsHolder.class),
mock(IServiceConnection.class), bindFlags,
@@ -2961,4 +2920,140 @@
assertBfsl(app);
}
}
+
+ private static class ProcessRecordBuilder {
+ @SuppressWarnings("UnusedVariable")
+ int mPid;
+ int mUid;
+ String mProcessName;
+ String mPackageName;
+ long mVersionCode = 12345;
+ int mTargetSdkVersion = Build.VERSION_CODES.CUR_DEVELOPMENT;
+ long mLastActivityTime;
+ long mLastPssTime;
+ long mNextPssTime;
+ long mLastPss = 12345;
+ int mMaxAdj = UNKNOWN_ADJ;
+ int mSetRawAdj = UNKNOWN_ADJ;
+ int mCurAdj = UNKNOWN_ADJ;
+ int mSetAdj = CACHED_APP_MAX_ADJ;
+ int mCurSchedGroup = SCHED_GROUP_DEFAULT;
+ int mSetSchedGroup = SCHED_GROUP_DEFAULT;
+ int mCurProcState = PROCESS_STATE_NONEXISTENT;
+ int mRepProcState = PROCESS_STATE_NONEXISTENT;
+ int mCurRawProcState = PROCESS_STATE_NONEXISTENT;
+ int mSetProcState = PROCESS_STATE_NONEXISTENT;
+ int mConnectionGroup = 0;
+ int mConnectionImportance = 0;
+ boolean mServiceb = false;
+ boolean mHasClientActivities = false;
+ boolean mHasForegroundServices = false;
+ int mFgServiceTypes = ServiceInfo.FOREGROUND_SERVICE_TYPE_NONE;
+ boolean mHasForegroundActivities = false;
+ boolean mRepForegroundActivities = false;
+ boolean mSystemNoUi = false;
+ boolean mHasShownUi = false;
+ boolean mHasTopUi = false;
+ boolean mHasOverlayUi = false;
+ boolean mRunningRemoteAnimation = false;
+ boolean mHasAboveClient = false;
+ boolean mTreatLikeActivity = false;
+ boolean mKilledByAm = false;
+ Object mForcingToImportant;
+ int mNumOfCurReceivers = 0;
+ long mLastProviderTime = Long.MIN_VALUE;
+ long mLastTopTime = Long.MIN_VALUE;
+ boolean mCached = true;
+ int mNumOfExecutingServices = 0;
+ String mIsolatedEntryPoint = null;
+ boolean mExecServicesFg = false;
+ String mSdkSandboxClientAppPackage = null;
+
+ ProcessRecordBuilder(int pid, int uid, String processName, String packageName) {
+ mPid = pid;
+ mUid = uid;
+ mProcessName = processName;
+ mPackageName = packageName;
+
+ long now = SystemClock.uptimeMillis();
+ mLastActivityTime = now;
+ mLastPssTime = now;
+ mNextPssTime = now;
+ }
+
+ ProcessRecordBuilder setHasShownUi(boolean hasShownUi) {
+ mHasShownUi = hasShownUi;
+ return this;
+ }
+
+ ProcessRecordBuilder setSdkSandboxClientAppPackage(String sdkSandboxClientAppPackage) {
+ mSdkSandboxClientAppPackage = sdkSandboxClientAppPackage;
+ return this;
+ }
+
+ @SuppressWarnings("GuardedBy")
+ public ProcessRecord build() {
+ ApplicationInfo ai = spy(new ApplicationInfo());
+ ai.uid = mUid;
+ ai.packageName = mPackageName;
+ ai.longVersionCode = mVersionCode;
+ ai.targetSdkVersion = mTargetSdkVersion;
+ doCallRealMethod().when(sService).getPackageManagerInternal();
+ doReturn(null).when(sPackageManagerInternal).getApplicationInfo(
+ eq(mSdkSandboxClientAppPackage), anyLong(), anyInt(), anyInt());
+ ProcessRecord app = new ProcessRecord(sService, ai, mProcessName, mUid,
+ mSdkSandboxClientAppPackage, -1, null);
+ final ProcessStateRecord state = app.mState;
+ final ProcessServiceRecord services = app.mServices;
+ final ProcessReceiverRecord receivers = app.mReceivers;
+ final ProcessProfileRecord profile = app.mProfile;
+ final ProcessProviderRecord providers = app.mProviders;
+ app.makeActive(mock(IApplicationThread.class), sService.mProcessStats);
+ app.setLastActivityTime(mLastActivityTime);
+ app.setKilledByAm(mKilledByAm);
+ app.setIsolatedEntryPoint(mIsolatedEntryPoint);
+ setFieldValue(ProcessRecord.class, app, "mWindowProcessController",
+ mock(WindowProcessController.class));
+ profile.setLastPssTime(mLastPssTime);
+ profile.setNextPssTime(mNextPssTime);
+ profile.setLastPss(mLastPss);
+ state.setMaxAdj(mMaxAdj);
+ state.setSetRawAdj(mSetRawAdj);
+ state.setCurAdj(mCurAdj);
+ state.setSetAdj(mSetAdj);
+ state.setCurrentSchedulingGroup(mCurSchedGroup);
+ state.setSetSchedGroup(mSetSchedGroup);
+ state.setCurProcState(mCurProcState);
+ state.setReportedProcState(mRepProcState);
+ state.setCurRawProcState(mCurRawProcState);
+ state.setSetProcState(mSetProcState);
+ state.setServiceB(mServiceb);
+ state.setRepForegroundActivities(mRepForegroundActivities);
+ state.setHasForegroundActivities(mHasForegroundActivities);
+ state.setSystemNoUi(mSystemNoUi);
+ state.setHasShownUi(mHasShownUi);
+ state.setHasTopUi(mHasTopUi);
+ state.setRunningRemoteAnimation(mRunningRemoteAnimation);
+ state.setHasOverlayUi(mHasOverlayUi);
+ state.setCached(mCached);
+ state.setLastTopTime(mLastTopTime);
+ state.setForcingToImportant(mForcingToImportant);
+ services.setConnectionGroup(mConnectionGroup);
+ services.setConnectionImportance(mConnectionImportance);
+ services.setHasClientActivities(mHasClientActivities);
+ services.setHasForegroundServices(mHasForegroundServices, mFgServiceTypes,
+ /* hasNoneType=*/false);
+ services.setHasAboveClient(mHasAboveClient);
+ services.setTreatLikeActivity(mTreatLikeActivity);
+ services.setExecServicesFg(mExecServicesFg);
+ for (int i = 0; i < mNumOfExecutingServices; i++) {
+ services.startExecutingService(mock(ServiceRecord.class));
+ }
+ for (int i = 0; i < mNumOfCurReceivers; i++) {
+ receivers.addCurReceiver(mock(BroadcastRecord.class));
+ }
+ providers.setLastProviderTime(mLastProviderTime);
+ return app;
+ }
+ }
}
diff --git a/services/tests/servicestests/src/com/android/server/media/projection/MediaProjectionManagerServiceTest.java b/services/tests/servicestests/src/com/android/server/media/projection/MediaProjectionManagerServiceTest.java
index aefa6de..abd3abe 100644
--- a/services/tests/servicestests/src/com/android/server/media/projection/MediaProjectionManagerServiceTest.java
+++ b/services/tests/servicestests/src/com/android/server/media/projection/MediaProjectionManagerServiceTest.java
@@ -75,12 +75,12 @@
import androidx.test.filters.SmallTest;
import androidx.test.platform.app.InstrumentationRegistry;
-import com.android.internal.util.test.LocalServiceKeeperRule;
+import com.android.server.LocalServices;
import com.android.server.testutils.OffsettableClock;
import com.android.server.wm.WindowManagerInternal;
+import org.junit.After;
import org.junit.Before;
-import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
@@ -164,17 +164,15 @@
@Captor
private ArgumentCaptor<ContentRecordingSession> mSessionCaptor;
- @Rule
- public LocalServiceKeeperRule mLocalServiceKeeperRule = new LocalServiceKeeperRule();
-
@Before
public void setup() throws Exception {
MockitoAnnotations.initMocks(this);
when(mWatcherCallback.asBinder()).thenReturn(new Binder());
- mLocalServiceKeeperRule.overrideLocalService(ActivityManagerInternal.class, mAmInternal);
- mLocalServiceKeeperRule.overrideLocalService(WindowManagerInternal.class,
- mWindowManagerInternal);
+ LocalServices.removeServiceForTest(ActivityManagerInternal.class);
+ LocalServices.addService(ActivityManagerInternal.class, mAmInternal);
+ LocalServices.removeServiceForTest(WindowManagerInternal.class);
+ LocalServices.addService(WindowManagerInternal.class, mWindowManagerInternal);
mContext = spy(new ContextWrapper(
InstrumentationRegistry.getInstrumentation().getTargetContext()));
@@ -189,6 +187,12 @@
mService = new MediaProjectionManagerService(mContext);
}
+ @After
+ public void tearDown() {
+ LocalServices.removeServiceForTest(ActivityManagerInternal.class);
+ LocalServices.removeServiceForTest(WindowManagerInternal.class);
+ }
+
@Test
public void testGetActiveProjectionInfoInternal() throws NameNotFoundException {
assertThat(mService.getActiveProjectionInfo()).isNull();
@@ -384,16 +388,16 @@
MediaProjectionManagerService.MediaProjection projection = startProjectionPreconditions(
service);
// No starts yet, and not timed out yet - so still valid.
- assertThat(projection.isValidInternal()).isTrue();
+ assertThat(projection.isValid()).isTrue();
// Only one start - so still valid.
projection.start(mIMediaProjectionCallback);
- assertThat(projection.isValidInternal()).isTrue();
+ assertThat(projection.isValid()).isTrue();
// Second start - technically allowed to start again, without stopping in between.
// Token should no longer be valid.
projection.start(mIMediaProjectionCallback);
- assertThat(projection.isValidInternal()).isFalse();
+ assertThat(projection.isValid()).isFalse();
}
@Test
@@ -403,17 +407,17 @@
MediaProjectionManagerService.MediaProjection projection = startProjectionPreconditions(
service);
// No starts yet, and not timed out yet - so still valid.
- assertThat(projection.isValidInternal()).isTrue();
+ assertThat(projection.isValid()).isTrue();
// Only one start - so still valid.
projection.start(mIMediaProjectionCallback);
- assertThat(projection.isValidInternal()).isTrue();
+ assertThat(projection.isValid()).isTrue();
projection.stop();
// Second start - so not valid.
projection.start(mIMediaProjectionCallback);
- assertThat(projection.isValidInternal()).isFalse();
+ assertThat(projection.isValid()).isFalse();
}
@Test
@@ -438,7 +442,7 @@
mClock.fastForward(projection.mDefaultTimeoutMs + 10);
// Immediate timeout - so no longer valid.
- assertThat(projection.isValidInternal()).isFalse();
+ assertThat(projection.isValid()).isFalse();
}
@Test
@@ -448,10 +452,10 @@
MediaProjectionManagerService.MediaProjection projection = startProjectionPreconditions(
service);
// Simulate MediaProjection#createVirtualDisplay being invoked previously.
- projection.notifyVirtualDisplayCreatedInternal(10);
+ projection.notifyVirtualDisplayCreated(10);
// Trying to re-use token on another MediaProjection#createVirtualDisplay - no longer valid.
- assertThat(projection.isValidInternal()).isFalse();
+ assertThat(projection.isValid()).isFalse();
}
// TODO(269273190): Test flag using compat annotations instead.
@@ -467,7 +471,7 @@
// Second start - so not valid.
projection.start(mIMediaProjectionCallback);
- assertThrows(SecurityException.class, projection::isValidInternal);
+ assertThrows(SecurityException.class, projection::isValid);
}
// TODO(269273190): Test flag using compat annotations instead.
@@ -484,7 +488,7 @@
// Second start - so not valid.
projection.start(mIMediaProjectionCallback);
- assertThat(projection.isValidInternal()).isFalse();
+ assertThat(projection.isValid()).isFalse();
}
@Test
@@ -623,7 +627,7 @@
mService.setUserReviewGrantedConsentResult(RECORD_CONTENT_DISPLAY, projection);
// Virtual Display is finally created.
- projection.notifyVirtualDisplayCreatedInternal(10);
+ projection.notifyVirtualDisplayCreated(10);
verifySetSessionWithContent(ContentRecordingSession.RECORD_CONTENT_DISPLAY);
}
@@ -726,7 +730,7 @@
throws Exception {
MediaProjectionManagerService.MediaProjection projection = startProjectionPreconditions();
projection.start(mIMediaProjectionCallback);
- projection.notifyVirtualDisplayCreatedInternal(10);
+ projection.notifyVirtualDisplayCreated(10);
// Waiting for user to review consent.
assertThat(mService.isCurrentProjection(projection)).isTrue();
doReturn(true).when(mWindowManagerInternal).setContentRecordingSession(
@@ -781,9 +785,9 @@
@RecordContent int recordedContent)
throws NameNotFoundException {
MediaProjectionManagerService.MediaProjection projection = startProjectionPreconditions();
- projection.setLaunchCookieInternal(new LaunchCookie());
+ projection.setLaunchCookie(new LaunchCookie());
projection.start(mIMediaProjectionCallback);
- projection.notifyVirtualDisplayCreatedInternal(10);
+ projection.notifyVirtualDisplayCreated(10);
// Waiting for user to review consent.
doReturn(true).when(mWindowManagerInternal).setContentRecordingSession(
any(ContentRecordingSession.class));
@@ -804,7 +808,7 @@
throws NameNotFoundException {
MediaProjectionManagerService.MediaProjection projection = startProjectionPreconditions();
projection.start(mIMediaProjectionCallback);
- projection.notifyVirtualDisplayCreatedInternal(10);
+ projection.notifyVirtualDisplayCreated(10);
// Waiting for user to review consent.
doReturn(true).when(mWindowManagerInternal).setContentRecordingSession(
eq(mWaitingDisplaySession));
@@ -822,7 +826,7 @@
public void testSetUserReviewGrantedConsentResult_displayMirroring_noPriorSession()
throws NameNotFoundException {
MediaProjectionManagerService.MediaProjection projection = startProjectionPreconditions();
- projection.setLaunchCookieInternal(new LaunchCookie());
+ projection.setLaunchCookie(new LaunchCookie());
projection.start(mIMediaProjectionCallback);
// Skip setting the prior session details.
@@ -841,7 +845,7 @@
public void testSetUserReviewGrantedConsentResult_displayMirroring_sessionNotWaiting()
throws NameNotFoundException {
MediaProjectionManagerService.MediaProjection projection = startProjectionPreconditions();
- projection.setLaunchCookieInternal(new LaunchCookie());
+ projection.setLaunchCookie(new LaunchCookie());
projection.start(mIMediaProjectionCallback);
// Session is not waiting for user's consent.
doReturn(true).when(mWindowManagerInternal).setContentRecordingSession(
diff --git a/services/tests/wmtests/src/com/android/server/wm/ContentRecorderTests.java b/services/tests/wmtests/src/com/android/server/wm/ContentRecorderTests.java
index 60dfe6f..887e5ee 100644
--- a/services/tests/wmtests/src/com/android/server/wm/ContentRecorderTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/ContentRecorderTests.java
@@ -811,7 +811,7 @@
@Test
public void testDisplayContentUpdatesRecording_withSurface() {
- createContentRecorder(createDefaultDisplayInfo());
+ defaultInit();
// GIVEN MediaProjection has already initialized the WindowToken of the DisplayArea to
// mirror.
setUpDefaultTaskDisplayAreaWindowToken();
@@ -820,7 +820,6 @@
// getDisplaySurfaceDefaultSize (done by surfaceControlMirrors in setUp).
final DisplayContent virtualDisplay =
mRootWindowContainer.getDisplayContent(mDisplaySession.getVirtualDisplayId());
- virtualDisplay.setContentRecorder(mContentRecorder);
mWm.mContentRecordingController.setContentRecordingSessionLocked(mDisplaySession, mWm);
virtualDisplay.updateRecording();
@@ -845,7 +844,6 @@
// WHEN getting the DisplayContent for the new virtual display.
final DisplayContent virtualDisplay =
mRootWindowContainer.getDisplayContent(mDisplaySession.getVirtualDisplayId());
- virtualDisplay.setContentRecorder(mContentRecorder);
// Return the default display as the value to mirror to ensure the VD with flag mirroring
// creates a ContentRecordingSession automatically.
doReturn(DEFAULT_DISPLAY).when(mWm.mDisplayManagerInternal).getDisplayIdToMirror(anyInt());
diff --git a/services/tests/wmtests/src/com/android/server/wm/ContentRecordingControllerTests.java b/services/tests/wmtests/src/com/android/server/wm/ContentRecordingControllerTests.java
index 42004c3..c84fe08 100644
--- a/services/tests/wmtests/src/com/android/server/wm/ContentRecordingControllerTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/ContentRecordingControllerTests.java
@@ -24,7 +24,6 @@
import static com.google.common.truth.Truth.assertThat;
import static org.mockito.Mockito.atLeastOnce;
-import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
import android.platform.test.annotations.Presubmit;
@@ -32,8 +31,6 @@
import androidx.test.filters.SmallTest;
-import com.android.server.wm.ContentRecorder.MediaProjectionManagerWrapper;
-
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -71,11 +68,6 @@
mVirtualDisplayId = mVirtualDisplayContent.getDisplayId();
mWm.mRoot.onDisplayAdded(mVirtualDisplayId);
spyOn(mVirtualDisplayContent);
- final MediaProjectionManagerWrapper
- mediaProjectionManagerWrapper = mock(MediaProjectionManagerWrapper.class);
- final ContentRecorder contentRecorder = new ContentRecorder(mVirtualDisplayContent,
- mediaProjectionManagerWrapper, /* correctForAnisotropicPixels= */ false);
- mVirtualDisplayContent.setContentRecorder(contentRecorder);
mDefaultSession.setVirtualDisplayId(mVirtualDisplayId);
mWaitingDisplaySession.setVirtualDisplayId(mVirtualDisplayId);
diff --git a/telecomm/java/android/telecom/CallAttributes.java b/telecomm/java/android/telecom/CallAttributes.java
index 8c6e101..afd34fc 100644
--- a/telecomm/java/android/telecom/CallAttributes.java
+++ b/telecomm/java/android/telecom/CallAttributes.java
@@ -16,6 +16,7 @@
package android.telecom;
+import android.annotation.FlaggedApi;
import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.Nullable;
@@ -24,6 +25,8 @@
import android.os.Parcelable;
import android.text.TextUtils;
+import com.android.server.telecom.flags.Flags;
+
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.Objects;
@@ -113,7 +116,8 @@
public static final int VIDEO_CALL = 2;
/** @hide */
- @IntDef(value = {SUPPORTS_SET_INACTIVE, SUPPORTS_STREAM, SUPPORTS_TRANSFER}, flag = true)
+ @IntDef(value = {SUPPORTS_SET_INACTIVE, SUPPORTS_STREAM, SUPPORTS_TRANSFER,
+ SUPPORTS_VIDEO_CALLING}, flag = true)
@Retention(RetentionPolicy.SOURCE)
public @interface CallCapability {
}
@@ -133,6 +137,12 @@
* The call can be completely transferred from one endpoint to another.
*/
public static final int SUPPORTS_TRANSFER = 1 << 3;
+ /**
+ * The call supports video calling. This allows clients to gate video calling on a per call
+ * basis as opposed to re-registering the phone account.
+ */
+ @FlaggedApi(Flags.FLAG_TRANSACTIONAL_VIDEO_STATE)
+ public static final int SUPPORTS_VIDEO_CALLING = 1 << 4;
/**
* Build an instance of {@link CallAttributes}. In order to build a valid instance, a
diff --git a/telecomm/java/android/telecom/CallControl.java b/telecomm/java/android/telecom/CallControl.java
index a1407869..808a575 100644
--- a/telecomm/java/android/telecom/CallControl.java
+++ b/telecomm/java/android/telecom/CallControl.java
@@ -293,12 +293,50 @@
try {
mServerInterface.setMuteState(isMuted,
new CallControlResultReceiver("requestMuteState", executor, callback));
-
} catch (RemoteException e) {
throw e.rethrowAsRuntimeException();
}
}
+ /**
+ * Request a new video state for the ongoing call. This can only be changed if the application
+ * has registered a {@link PhoneAccount} with the
+ * {@link PhoneAccount#CAPABILITY_SUPPORTS_VIDEO_CALLING} and set the
+ * {@link CallAttributes#SUPPORTS_VIDEO_CALLING} when adding the call via
+ * {@link TelecomManager#addCall(CallAttributes, Executor, OutcomeReceiver,
+ * CallControlCallback, CallEventCallback)}
+ *
+ * @param videoState to report to Telecom. To see the valid argument to pass,
+ * see {@link CallAttributes.CallType}.
+ * @param executor The {@link Executor} on which the {@link OutcomeReceiver} callback
+ * will be called on.
+ * @param callback that will be completed on the Telecom side that details success or failure
+ * of the requested operation.
+ *
+ * {@link OutcomeReceiver#onResult} will be called if Telecom has successfully
+ * switched the video state.
+ *
+ * {@link OutcomeReceiver#onError} will be called if Telecom has failed to set
+ * the new video state. A {@link CallException} will be passed
+ * that details why the operation failed.
+ * @throws IllegalArgumentException if the argument passed for videoState is invalid. To see a
+ * list of valid states, see {@link CallAttributes.CallType}.
+ */
+ @FlaggedApi(Flags.FLAG_TRANSACTIONAL_VIDEO_STATE)
+ public void requestVideoState(@CallAttributes.CallType int videoState,
+ @CallbackExecutor @NonNull Executor executor,
+ @NonNull OutcomeReceiver<Void, CallException> callback) {
+ validateVideoState(videoState);
+ Objects.requireNonNull(executor);
+ Objects.requireNonNull(callback);
+ try {
+ mServerInterface.requestVideoState(videoState, mCallId,
+ new CallControlResultReceiver("requestVideoState", executor, callback));
+ } catch (RemoteException e) {
+ throw e.rethrowAsRuntimeException();
+ }
+ }
+
/**
* Raises an event to the {@link android.telecom.InCallService} implementations tracking this
* call via {@link android.telecom.Call.Callback#onConnectionEvent(Call, String, Bundle)}.
diff --git a/telecomm/java/android/telecom/CallEventCallback.java b/telecomm/java/android/telecom/CallEventCallback.java
index a41c011..b0438bf 100644
--- a/telecomm/java/android/telecom/CallEventCallback.java
+++ b/telecomm/java/android/telecom/CallEventCallback.java
@@ -16,9 +16,12 @@
package android.telecom;
+import android.annotation.FlaggedApi;
import android.annotation.NonNull;
import android.os.Bundle;
+import com.android.server.telecom.flags.Flags;
+
import java.util.List;
/**
@@ -51,6 +54,14 @@
void onMuteStateChanged(boolean isMuted);
/**
+ * Called when the video state changes.
+ *
+ * @param videoState The current video state.
+ */
+ @FlaggedApi(Flags.FLAG_TRANSACTIONAL_VIDEO_STATE)
+ default void onVideoStateChanged(@CallAttributes.CallType int videoState) {}
+
+ /**
* Telecom is informing the client user requested call streaming but the stream can't be
* started.
*
diff --git a/telecomm/java/com/android/internal/telecom/ClientTransactionalServiceWrapper.java b/telecomm/java/com/android/internal/telecom/ClientTransactionalServiceWrapper.java
index 467e89c..a2c6086 100644
--- a/telecomm/java/com/android/internal/telecom/ClientTransactionalServiceWrapper.java
+++ b/telecomm/java/com/android/internal/telecom/ClientTransactionalServiceWrapper.java
@@ -33,6 +33,8 @@
import android.text.TextUtils;
import android.util.Log;
+import com.android.server.telecom.flags.Flags;
+
import java.util.List;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
@@ -148,6 +150,7 @@
private static final String ON_REQ_ENDPOINT_CHANGE = "onRequestEndpointChange";
private static final String ON_AVAILABLE_CALL_ENDPOINTS = "onAvailableCallEndpointsChanged";
private static final String ON_MUTE_STATE_CHANGED = "onMuteStateChanged";
+ private static final String ON_VIDEO_STATE_CHANGED = "onVideoStateChanged";
private static final String ON_CALL_STREAMING_FAILED = "onCallStreamingFailed";
private static final String ON_EVENT = "onEvent";
@@ -261,6 +264,11 @@
handleEventCallback(callId, ON_MUTE_STATE_CHANGED, isMuted);
}
+ @Override
+ public void onVideoStateChanged(String callId, int videoState) {
+ handleEventCallback(callId, ON_VIDEO_STATE_CHANGED, videoState);
+ }
+
public void handleEventCallback(String callId, String action, Object arg) {
Log.d(TAG, TextUtils.formatSimple("hEC: [%s], callId=[%s]", action, callId));
// lookup the callEventCallback associated with the particular call
@@ -281,6 +289,11 @@
case ON_MUTE_STATE_CHANGED:
callback.onMuteStateChanged((boolean) arg);
break;
+ case ON_VIDEO_STATE_CHANGED:
+ if (Flags.transactionalVideoState()) {
+ callback.onVideoStateChanged((int) arg);
+ }
+ break;
case ON_CALL_STREAMING_FAILED:
callback.onCallStreamingFailed((int) arg /* reason */);
break;
diff --git a/telecomm/java/com/android/internal/telecom/ICallControl.aidl b/telecomm/java/com/android/internal/telecom/ICallControl.aidl
index 372e4a12..ac49660 100644
--- a/telecomm/java/com/android/internal/telecom/ICallControl.aidl
+++ b/telecomm/java/com/android/internal/telecom/ICallControl.aidl
@@ -34,4 +34,5 @@
void requestCallEndpointChange(in CallEndpoint callEndpoint, in ResultReceiver callback);
void setMuteState(boolean isMuted, in ResultReceiver callback);
void sendEvent(String callId, String event, in Bundle extras);
+ void requestVideoState(int videoState, String callId, in ResultReceiver callback);
}
\ No newline at end of file
diff --git a/telecomm/java/com/android/internal/telecom/ICallEventCallback.aidl b/telecomm/java/com/android/internal/telecom/ICallEventCallback.aidl
index 213cafb..e4d6b0c 100644
--- a/telecomm/java/com/android/internal/telecom/ICallEventCallback.aidl
+++ b/telecomm/java/com/android/internal/telecom/ICallEventCallback.aidl
@@ -45,6 +45,8 @@
void onCallEndpointChanged(String callId, in CallEndpoint endpoint);
void onAvailableCallEndpointsChanged(String callId, in List<CallEndpoint> endpoint);
void onMuteStateChanged(String callId, boolean isMuted);
+ // -- Video Related
+ void onVideoStateChanged(String callId, int videoState);
// -- Events
void onEvent(String callId, String event, in Bundle extras);
// hidden methods that help with cleanup
diff --git a/telephony/java/android/telephony/DomainSelectionService.java b/telephony/java/android/telephony/DomainSelectionService.java
index 4ff9712..633694a 100644
--- a/telephony/java/android/telephony/DomainSelectionService.java
+++ b/telephony/java/android/telephony/DomainSelectionService.java
@@ -20,6 +20,7 @@
import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.Nullable;
+import android.annotation.SuppressLint;
import android.annotation.SystemApi;
import android.app.Service;
import android.content.Intent;
@@ -855,7 +856,8 @@
*
* @return an {@link Executor} used to execute methods called remotely by the framework.
*/
- public @NonNull Executor onCreateExecutor() {
+ @SuppressLint("OnNameExpected")
+ public @NonNull Executor getCreateExecutor() {
return Runnable::run;
}
@@ -869,7 +871,7 @@
public final @NonNull Executor getCachedExecutor() {
synchronized (mExecutorLock) {
if (mExecutor == null) {
- Executor e = onCreateExecutor();
+ Executor e = getCreateExecutor();
mExecutor = (e != null) ? e : Runnable::run;
}
return mExecutor;
diff --git a/tools/hoststubgen/scripts/run-all-tests.sh b/tools/hoststubgen/scripts/run-all-tests.sh
deleted file mode 100755
index a6847ae..0000000
--- a/tools/hoststubgen/scripts/run-all-tests.sh
+++ /dev/null
@@ -1,54 +0,0 @@
-#!/bin/bash
-# Copyright (C) 2023 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.
-
-source "${0%/*}"/../common.sh
-
-# Move to the top directory of hoststubgen
-cd ..
-
-ATEST_ARGS="--host"
-
-# These tests are known to pass.
-READY_TEST_MODULES=(
- hoststubgen-test-tiny-test
- CtsUtilTestCasesRavenwood
- CtsOsTestCasesRavenwood # This one uses native sustitution, so let's run it too.
-)
-
-MUST_BUILD_MODULES=(
- "${NOT_READY_TEST_MODULES[*]}"
-)
-
-# First, build all the test / etc modules. This shouldn't fail.
-run m "${MUST_BUILD_MODULES[@]}"
-
-# Run the hoststubgen unittests / etc
-run atest $ATEST_ARGS hoststubgentest hoststubgen-invoke-test
-
-# Next, run the golden check. This should always pass too.
-# The following scripts _should_ pass too, but they depend on the internal paths to soong generated
-# files, and they may fail when something changes in the build system.
-run ./hoststubgen/test-tiny-framework/diff-and-update-golden.sh
-
-run ./hoststubgen/test-tiny-framework/run-test-manually.sh
-run atest $ATEST_ARGS tiny-framework-dump-test
-
-# This script is already broken on goog/master
-# run ./scripts/build-framework-hostside-jars-without-genrules.sh
-
-# These tests should all pass.
-run atest $ATEST_ARGS ${READY_TEST_MODULES[*]}
-
-echo ""${0##*/}" finished, with no failures. Ready to submit!"