Merge "Add a toggle on whether or not to prompt the user on long-running FGS" into tm-dev
diff --git a/core/java/android/app/admin/FullyManagedDeviceProvisioningParams.java b/core/java/android/app/admin/FullyManagedDeviceProvisioningParams.java
index 4999245..ca00154 100644
--- a/core/java/android/app/admin/FullyManagedDeviceProvisioningParams.java
+++ b/core/java/android/app/admin/FullyManagedDeviceProvisioningParams.java
@@ -301,6 +301,7 @@
* Sets a {@link PersistableBundle} that contains admin-specific extras.
*/
@NonNull
+ //TODO(b/235783053) The adminExtras parameter is actually @Nullable.
public Builder setAdminExtras(@NonNull PersistableBundle adminExtras) {
mAdminExtras = adminExtras != null
? new PersistableBundle(adminExtras)
@@ -333,7 +334,7 @@
mLocalTime,
mLocale,
mDeviceOwnerCanGrantSensorsPermissions,
- mAdminExtras,
+ mAdminExtras != null ? mAdminExtras : new PersistableBundle(),
mDemoDevice);
}
}
diff --git a/core/java/android/app/admin/ManagedProfileProvisioningParams.java b/core/java/android/app/admin/ManagedProfileProvisioningParams.java
index f91d60a..474f785 100644
--- a/core/java/android/app/admin/ManagedProfileProvisioningParams.java
+++ b/core/java/android/app/admin/ManagedProfileProvisioningParams.java
@@ -252,6 +252,7 @@
* Sets a {@link Bundle} that contains admin-specific extras.
*/
@NonNull
+ //TODO(b/235783053) The adminExtras parameter is actually @Nullable.
public Builder setAdminExtras(@NonNull PersistableBundle adminExtras) {
mAdminExtras = adminExtras != null
? new PersistableBundle(adminExtras)
@@ -274,7 +275,7 @@
mLeaveAllSystemAppsEnabled,
mOrganizationOwnedProvisioning,
mKeepingAccountOnMigration,
- mAdminExtras);
+ mAdminExtras != null ? mAdminExtras : new PersistableBundle());
}
}
diff --git a/core/java/android/hardware/camera2/CameraDevice.java b/core/java/android/hardware/camera2/CameraDevice.java
index 73735ed..0f1b39c 100644
--- a/core/java/android/hardware/camera2/CameraDevice.java
+++ b/core/java/android/hardware/camera2/CameraDevice.java
@@ -892,9 +892,9 @@
* <tr><th colspan="7">Preview stabilization guaranteed stream configurations</th></tr>
* <tr><th colspan="2" id="rb">Target 1</th><th colspan="2" id="rb">Target 2</th><th rowspan="2">Sample use case(s)</th> </tr>
* <tr><th>Type</th><th id="rb">Max size</th><th>Type</th><th id="rb">Max size</th></tr>
- * <tr> <td>{@code PRIV / YUV}</td><td id="rb">{@code RECORD}</td><td colspan="4" id="rb"></td> <td>Stabilized preview, GPU video processing, or no-preview stabilized video recording.</td> </tr>
- * <tr> <td>{@code PRIV / YUV}</td><td id="rb">{@code PREVIEW}</td> <td>{@code JPEG / YUV}</td><td id="rb">{@code MAXIMUM }</td><td>Standard still imaging with stabilized preview.</td> </tr>
- * <tr> <td>{@code PRIV / YUV}</td><td id="rb">{@code PREVIEW}</td> <td>{@code PRIV / YUV}</td><td id="rb">{@code RECORD }</td><td>High-resolution recording with stabilized preview and recording stream.</td> </tr>
+ * <tr> <td>{@code PRIV / YUV}</td><td id="rb">{@code s1440p}</td><td colspan="4" id="rb"></td> <td>Stabilized preview, GPU video processing, or no-preview stabilized video recording.</td> </tr>
+ * <tr> <td>{@code PRIV / YUV}</td><td id="rb">{@code s1440p}</td> <td>{@code JPEG / YUV}</td><td id="rb">{@code MAXIMUM }</td><td>Standard still imaging with stabilized preview.</td> </tr>
+ * <tr> <td>{@code PRIV / YUV}</td><td id="rb">{@code PREVIEW}</td> <td>{@code PRIV / YUV}</td><td id="rb">{@code s1440p }</td><td>High-resolution recording with stabilized preview and recording stream.</td> </tr>
* </table><br>
* <p>
* For the maximum size column, PREVIEW refers to the best size match to the device's screen
diff --git a/core/java/android/hardware/camera2/params/MandatoryStreamCombination.java b/core/java/android/hardware/camera2/params/MandatoryStreamCombination.java
index a3bc665..e5b9cdb 100644
--- a/core/java/android/hardware/camera2/params/MandatoryStreamCombination.java
+++ b/core/java/android/hardware/camera2/params/MandatoryStreamCombination.java
@@ -1265,43 +1265,43 @@
private static StreamCombinationTemplate sPreviewStabilizedStreamCombinations[] = {
// 1 stream combinations
new StreamCombinationTemplate(new StreamTemplate [] {
- new StreamTemplate(ImageFormat.PRIVATE, SizeThreshold.RECORD)},
+ new StreamTemplate(ImageFormat.PRIVATE, SizeThreshold.s1440p)},
"Stabilized preview, GPU video processing, or no-preview stabilized recording"),
new StreamCombinationTemplate(new StreamTemplate [] {
- new StreamTemplate(ImageFormat.YUV_420_888, SizeThreshold.RECORD)},
+ new StreamTemplate(ImageFormat.YUV_420_888, SizeThreshold.s1440p)},
"Stabilized preview, GPU video processing, or no-preview stabilized recording"),
//2 stream combinations
new StreamCombinationTemplate(new StreamTemplate [] {
new StreamTemplate(ImageFormat.JPEG, SizeThreshold.MAXIMUM),
- new StreamTemplate(ImageFormat.PRIVATE, SizeThreshold.PREVIEW)},
+ new StreamTemplate(ImageFormat.PRIVATE, SizeThreshold.s1440p)},
"Standard JPEG still imaging with stabilized preview"),
new StreamCombinationTemplate(new StreamTemplate [] {
new StreamTemplate(ImageFormat.YUV_420_888, SizeThreshold.MAXIMUM),
- new StreamTemplate(ImageFormat.PRIVATE, SizeThreshold.PREVIEW)},
+ new StreamTemplate(ImageFormat.PRIVATE, SizeThreshold.s1440p)},
"Standard YUV still imaging with stabilized preview"),
new StreamCombinationTemplate(new StreamTemplate [] {
new StreamTemplate(ImageFormat.YUV_420_888, SizeThreshold.MAXIMUM),
- new StreamTemplate(ImageFormat.YUV_420_888, SizeThreshold.PREVIEW)},
+ new StreamTemplate(ImageFormat.YUV_420_888, SizeThreshold.s1440p)},
"Standard YUV still imaging with stabilized in-app image processing stream"),
new StreamCombinationTemplate(new StreamTemplate [] {
new StreamTemplate(ImageFormat.JPEG, SizeThreshold.MAXIMUM),
- new StreamTemplate(ImageFormat.YUV_420_888, SizeThreshold.PREVIEW)},
+ new StreamTemplate(ImageFormat.YUV_420_888, SizeThreshold.s1440p)},
"Standard JPEG still imaging with stabilized in-app image processing stream"),
new StreamCombinationTemplate(new StreamTemplate [] {
- new StreamTemplate(ImageFormat.PRIVATE, SizeThreshold.RECORD),
+ new StreamTemplate(ImageFormat.PRIVATE, SizeThreshold.s1440p),
new StreamTemplate(ImageFormat.PRIVATE, SizeThreshold.PREVIEW)},
"High-resolution video recording with preview both streams stabilized"),
new StreamCombinationTemplate(new StreamTemplate [] {
- new StreamTemplate(ImageFormat.PRIVATE, SizeThreshold.RECORD),
+ new StreamTemplate(ImageFormat.PRIVATE, SizeThreshold.s1440p),
new StreamTemplate(ImageFormat.YUV_420_888, SizeThreshold.PREVIEW)},
"High-resolution video recording with preview both streams stabilized"),
new StreamCombinationTemplate(new StreamTemplate [] {
- new StreamTemplate(ImageFormat.YUV_420_888, SizeThreshold.RECORD),
+ new StreamTemplate(ImageFormat.YUV_420_888, SizeThreshold.s1440p),
new StreamTemplate(ImageFormat.YUV_420_888, SizeThreshold.PREVIEW)},
"High-resolution video recording with preview both streams stabilized"),
new StreamCombinationTemplate(new StreamTemplate [] {
- new StreamTemplate(ImageFormat.YUV_420_888, SizeThreshold.RECORD),
+ new StreamTemplate(ImageFormat.YUV_420_888, SizeThreshold.s1440p),
new StreamTemplate(ImageFormat.PRIVATE, SizeThreshold.PREVIEW)},
"High-resolution video recording with preview both streams stabilized"),
};
@@ -1430,7 +1430,7 @@
StreamCombinationTemplate []chosenStreamCombinations =
sPreviewStabilizedStreamCombinations;
- if (mIsPreviewStabilizationSupported) {
+ if (!mIsPreviewStabilizationSupported) {
Log.v(TAG, "Device does not support preview stabilization");
return null;
}
diff --git a/media/java/android/media/MediaMetadata.java b/media/java/android/media/MediaMetadata.java
index 9976fa1..db5e52a 100644
--- a/media/java/android/media/MediaMetadata.java
+++ b/media/java/android/media/MediaMetadata.java
@@ -429,6 +429,15 @@
private MediaMetadata(Parcel in) {
mBundle = in.readBundle();
mBitmapDimensionLimit = Math.max(in.readInt(), 1);
+
+ // Proactively read bitmaps from known bitmap keys, to ensure that they're unparceled and
+ // added to mBundle's internal map. This ensures that the GC accounts for the underlying
+ // allocations, which it does not do if the bitmaps remain parceled (see b/215820910).
+ // TODO(b/223225532): Remove this workaround once the underlying allocations are properly
+ // tracked in NativeAllocationsRegistry.
+ getBitmap(METADATA_KEY_ART);
+ getBitmap(METADATA_KEY_ALBUM_ART);
+ getBitmap(METADATA_KEY_DISPLAY_ICON);
}
/**
diff --git a/packages/SystemUI/AndroidManifest.xml b/packages/SystemUI/AndroidManifest.xml
index 490a3f5..6f22b49 100644
--- a/packages/SystemUI/AndroidManifest.xml
+++ b/packages/SystemUI/AndroidManifest.xml
@@ -723,7 +723,7 @@
android:excludeFromRecents="true"
android:stateNotNeeded="true"
android:resumeWhilePausing="true"
- android:theme="@style/Theme.AppCompat.DayNight.NoActionBar">
+ android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen">
<intent-filter>
<action android:name="android.app.action.CONFIRM_DEVICE_CREDENTIAL_WITH_USER" />
<category android:name="android.intent.category.DEFAULT" />
diff --git a/packages/SystemUI/res/layout/auth_biometric_background.xml b/packages/SystemUI/res/layout/auth_biometric_background.xml
index 7ce81ad..995aea1 100644
--- a/packages/SystemUI/res/layout/auth_biometric_background.xml
+++ b/packages/SystemUI/res/layout/auth_biometric_background.xml
@@ -16,6 +16,8 @@
-->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
+ android:theme="@style/Theme.AppCompat.DayNight"
+ android:background="?android:colorBackground"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
diff --git a/packages/SystemUI/src/com/android/systemui/qs/FooterActionsView.kt b/packages/SystemUI/src/com/android/systemui/qs/FooterActionsView.kt
index 3417d49..05038b7 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/FooterActionsView.kt
+++ b/packages/SystemUI/src/com/android/systemui/qs/FooterActionsView.kt
@@ -22,6 +22,8 @@
import android.graphics.drawable.RippleDrawable
import android.os.UserManager
import android.util.AttributeSet
+import android.util.Log
+import android.view.MotionEvent
import android.view.View
import android.widget.ImageView
import android.widget.LinearLayout
@@ -101,4 +103,18 @@
}
multiUserAvatar.setImageDrawable(pictureToSet)
}
-}
\ No newline at end of file
+
+ override fun onInterceptTouchEvent(ev: MotionEvent?): Boolean {
+ if (VERBOSE) Log.d(TAG, "FooterActionsView onInterceptTouchEvent ${ev?.string}")
+ return super.onInterceptTouchEvent(ev)
+ }
+
+ override fun onTouchEvent(event: MotionEvent?): Boolean {
+ if (VERBOSE) Log.d(TAG, "FooterActionsView onTouchEvent ${event?.string}")
+ return super.onTouchEvent(event)
+ }
+}
+private const val TAG = "FooterActionsView"
+private val VERBOSE = Log.isLoggable(TAG, Log.VERBOSE)
+private val MotionEvent.string
+ get() = "($id): ($x,$y)"
\ No newline at end of file
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java
index 557c995..2cac001 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java
@@ -4142,6 +4142,11 @@
@Override
public boolean onInterceptTouchEvent(MotionEvent event) {
+ if (SPEW_LOGCAT) {
+ Log.v(TAG,
+ "NPVC onInterceptTouchEvent (" + event.getId() + "): (" + event.getX()
+ + "," + event.getY() + ")");
+ }
if (mBlockTouches || mQs.disallowPanelTouches()) {
return false;
}
diff --git a/services/core/java/com/android/server/am/ProcessList.java b/services/core/java/com/android/server/am/ProcessList.java
index a2048a3..92a8dcd 100644
--- a/services/core/java/com/android/server/am/ProcessList.java
+++ b/services/core/java/com/android/server/am/ProcessList.java
@@ -2794,15 +2794,6 @@
}
int N = procs.size();
- for (int i = 0; i < N; ++i) {
- final ProcessRecord proc = procs.get(i).first;
- try {
- Process.setProcessFrozen(proc.getPid(), proc.uid, true);
- } catch (Exception e) {
- Slog.w(TAG, "Unable to freeze " + proc.getPid() + " " + proc.processName);
- }
- }
-
for (int i=0; i<N; i++) {
final Pair<ProcessRecord, Boolean> proc = procs.get(i);
removeProcessLocked(proc.first, callerWillRestart, allowRestart || proc.second,
diff --git a/services/core/java/com/android/server/pm/AppsFilterImpl.java b/services/core/java/com/android/server/pm/AppsFilterImpl.java
index 9fddc76..181c39e 100644
--- a/services/core/java/com/android/server/pm/AppsFilterImpl.java
+++ b/services/core/java/com/android/server/pm/AppsFilterImpl.java
@@ -418,7 +418,9 @@
} else if (changed) {
invalidateCache("grantImplicitAccess: " + recipientUid + " -> " + visibleUid);
}
- onChanged();
+ if (changed) {
+ onChanged();
+ }
return changed;
}
diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java
index 4f8c792..94e8ec5 100644
--- a/services/core/java/com/android/server/pm/PackageManagerService.java
+++ b/services/core/java/com/android/server/pm/PackageManagerService.java
@@ -2859,12 +2859,15 @@
mDexOptHelper.performPackageDexOptUpgradeIfNeeded();
}
-
private void notifyPackageUseInternal(String packageName, int reason) {
long time = System.currentTimeMillis();
- commitPackageStateMutation(null, packageName, packageState -> {
- packageState.setLastPackageUsageTime(reason, time);
- });
+ synchronized (mLock) {
+ final PackageSetting pkgSetting = mSettings.getPackageLPr(packageName);
+ if (pkgSetting == null) {
+ return;
+ }
+ pkgSetting.getPkgState().setLastPackageUsageTimeInMills(reason, time);
+ }
}
/*package*/ DexManager getDexManager() {
diff --git a/services/core/java/com/android/server/pm/permission/DefaultPermissionGrantPolicy.java b/services/core/java/com/android/server/pm/permission/DefaultPermissionGrantPolicy.java
index cc1c943..0ae92b4 100644
--- a/services/core/java/com/android/server/pm/permission/DefaultPermissionGrantPolicy.java
+++ b/services/core/java/com/android/server/pm/permission/DefaultPermissionGrantPolicy.java
@@ -911,6 +911,11 @@
grantSystemFixedPermissionsToSystemPackage(pm,
MidiManager.BLUETOOTH_MIDI_SERVICE_PACKAGE, userId,
NEARBY_DEVICES_PERMISSIONS);
+
+ // Ad Service
+ String commonServiceAction = "android.adservices.AD_SERVICES_COMMON_SERVICE";
+ grantPermissionsToSystemPackage(pm, getDefaultSystemHandlerServicePackage(pm,
+ commonServiceAction, userId), userId, NOTIFICATION_PERMISSIONS);
}
private String getDefaultSystemHandlerActivityPackageForCategory(PackageManagerWrapper pm,
diff --git a/services/core/java/com/android/server/pm/pkg/PackageStateUnserialized.java b/services/core/java/com/android/server/pm/pkg/PackageStateUnserialized.java
index 7bd720a..5251fe0 100644
--- a/services/core/java/com/android/server/pm/pkg/PackageStateUnserialized.java
+++ b/services/core/java/com/android/server/pm/pkg/PackageStateUnserialized.java
@@ -79,7 +79,10 @@
return this;
}
getLastPackageUsageTimeInMills()[reason] = time;
- mPackageSetting.onChanged();
+ // TODO(b/236180425): This method does not notify snapshot changes because it's called too
+ // frequently, causing too many re-takes. This should be moved to a separate data structure
+ // or merged with the general UsageStats to avoid tracking heavily mutated data in the
+ // package data snapshot.
return this;
}
diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java
index 3bb40b0..4c32edc 100644
--- a/services/core/java/com/android/server/wm/WindowState.java
+++ b/services/core/java/com/android/server/wm/WindowState.java
@@ -884,7 +884,9 @@
* {@link InsetsStateController#notifyInsetsChanged}.
*/
boolean isReadyToDispatchInsetsState() {
- return isVisibleRequested() && mFrozenInsetsState == null;
+ final boolean visible = shouldCheckTokenVisibleRequested()
+ ? isVisibleRequested() : isVisible();
+ return visible && mFrozenInsetsState == null;
}
void seamlesslyRotateIfAllowed(Transaction transaction, @Rotation int oldRotation,
diff --git a/services/tests/wmtests/src/com/android/server/wm/WindowStateTests.java b/services/tests/wmtests/src/com/android/server/wm/WindowStateTests.java
index e8f343e..20935f1 100644
--- a/services/tests/wmtests/src/com/android/server/wm/WindowStateTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/WindowStateTests.java
@@ -927,6 +927,15 @@
assertTrue(app.isReadyToDispatchInsetsState());
mDisplayContent.getInsetsStateController().notifyInsetsChanged();
verify(app).notifyInsetsChanged();
+
+ // Verify that invisible non-activity window won't dispatch insets changed.
+ final WindowState overlay = createWindow(null, TYPE_APPLICATION_OVERLAY, "overlay");
+ makeWindowVisible(overlay);
+ assertTrue(overlay.isReadyToDispatchInsetsState());
+ overlay.mHasSurface = false;
+ assertFalse(overlay.isReadyToDispatchInsetsState());
+ mDisplayContent.getInsetsStateController().notifyInsetsChanged();
+ assertFalse(overlay.getWindowFrames().hasInsetsChanged());
}
@UseTestDisplay(addWindows = {W_INPUT_METHOD, W_ACTIVITY})