summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Android.bp1
-rw-r--r--cmds/locksettings/src/com/android/commands/locksettings/LockSettingsCmd.java32
-rw-r--r--core/java/android/app/ActivityThread.java7
-rw-r--r--core/java/android/app/admin/DevicePolicyManager.java8
-rw-r--r--core/java/android/app/servertransaction/LaunchActivityItem.java21
-rw-r--r--core/java/android/view/Display.java6
-rw-r--r--core/java/android/view/DisplayInfo.java13
-rw-r--r--core/java/android/view/View.java2
-rw-r--r--core/java/android/view/ViewRootImpl.java7
-rw-r--r--core/res/res/values/symbols.xml1
-rw-r--r--core/tests/coretests/src/android/app/servertransaction/ObjectPoolTests.java2
-rw-r--r--core/tests/coretests/src/android/app/servertransaction/TestUtils.java8
-rw-r--r--core/tests/coretests/src/android/app/servertransaction/TransactionParcelTests.java1
-rw-r--r--core/tests/mockingcoretests/src/android/app/activity/ActivityThreadClientTest.java2
-rw-r--r--libs/WindowManager/Jetpack/src/androidx/window/extensions/embedding/SplitController.java42
-rw-r--r--libs/WindowManager/Jetpack/src/androidx/window/extensions/embedding/TaskFragmentContainer.java2
-rw-r--r--packages/SettingsLib/src/com/android/settingslib/media/LocalMediaManager.java42
-rw-r--r--packages/SystemUI/docs/device-entry/bouncer.md (renamed from packages/SystemUI/docs/keyguard/bouncer.md)2
-rw-r--r--packages/SystemUI/docs/device-entry/doze.md (renamed from packages/SystemUI/docs/keyguard/doze.md)2
-rw-r--r--packages/SystemUI/docs/device-entry/glossary.md48
-rw-r--r--packages/SystemUI/docs/device-entry/imgs/aod.pngbin0 -> 11001 bytes
-rw-r--r--packages/SystemUI/docs/device-entry/imgs/bouncer_pin.pngbin0 -> 16086 bytes
-rw-r--r--packages/SystemUI/docs/device-entry/imgs/bypass.pngbin0 -> 33963 bytes
-rw-r--r--packages/SystemUI/docs/device-entry/imgs/lockscreen.pngbin0 -> 40789 bytes
-rw-r--r--packages/SystemUI/docs/device-entry/keyguard.md (renamed from packages/SystemUI/docs/keyguard.md)17
-rw-r--r--packages/SystemUI/docs/user-switching.md2
-rw-r--r--packages/SystemUI/res/drawable/ic_media_connecting_container.xml40
-rw-r--r--packages/SystemUI/res/values/strings.xml2
-rw-r--r--packages/SystemUI/src/com/android/systemui/media/MediaControlPanel.java81
-rw-r--r--packages/SystemUI/src/com/android/systemui/media/MediaData.kt7
-rw-r--r--packages/SystemUI/src/com/android/systemui/media/MediaDataManager.kt17
-rw-r--r--packages/SystemUI/src/com/android/systemui/media/MediaDeviceManager.kt48
-rw-r--r--packages/SystemUI/src/com/android/systemui/media/MediaUiEventLogger.kt20
-rw-r--r--packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputController.java2
-rw-r--r--packages/SystemUI/src/com/android/systemui/media/muteawait/MediaMuteAwaitConnectionManager.kt10
-rw-r--r--packages/SystemUI/src/com/android/systemui/people/PeopleSpaceUtils.java4
-rw-r--r--packages/SystemUI/src/com/android/systemui/people/widget/PeopleSpaceWidgetManager.java24
-rw-r--r--packages/SystemUI/src/com/android/systemui/screenshot/SaveImageInBackgroundTask.java5
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/NotificationMediaManager.java16
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackSizeCalculator.kt6
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationActivityStarter.java6
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationActivityStarterLogger.kt19
-rw-r--r--packages/SystemUI/src/com/android/systemui/wmshell/BubblesManager.java4
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/media/MediaDataManagerTest.kt19
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/media/MediaDeviceManagerTest.kt54
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/media/muteawait/MediaMuteAwaitConnectionManagerTest.kt25
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackSizeCalculatorTest.kt28
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/wmshell/NewNotifPipelineBubblesTest.java4
-rw-r--r--services/backup/backuplib/java/com/android/server/backup/transport/BackupTransportClient.java10
-rw-r--r--services/core/Android.bp4
-rw-r--r--services/core/java/com/android/server/audio/SpatializerHelper.java25
-rw-r--r--services/core/java/com/android/server/display/DisplayManagerService.java20
-rw-r--r--services/core/java/com/android/server/display/DisplayManagerShellCommand.java16
-rw-r--r--services/core/java/com/android/server/display/LogicalDisplay.java2
-rw-r--r--services/core/java/com/android/server/locales/LocaleManagerService.java4
-rw-r--r--services/core/java/com/android/server/pm/UserManagerService.java306
-rw-r--r--services/core/java/com/android/server/policy/AppOpsPolicy.java8
-rw-r--r--services/core/java/com/android/server/wm/ActivityTaskSupervisor.java3
-rw-r--r--services/core/java/com/android/server/wm/TaskFragment.java2
-rw-r--r--services/core/java/com/android/server/wm/WindowState.java13
-rw-r--r--services/devicepolicy/TEST_MAPPING10
-rw-r--r--services/tests/servicestests/src/com/android/server/backup/transport/BackupTransportClientTest.java7
62 files changed, 725 insertions, 414 deletions
diff --git a/Android.bp b/Android.bp
index 8ac7de944fe7..df6fdaa5fdf6 100644
--- a/Android.bp
+++ b/Android.bp
@@ -65,7 +65,6 @@ filegroup {
// Java/AIDL sources under frameworks/base
":framework-annotations",
":framework-blobstore-sources",
- ":framework-connectivity-tiramisu-sources",
":framework-core-sources",
":framework-drm-sources",
":framework-graphics-nonupdatable-sources",
diff --git a/cmds/locksettings/src/com/android/commands/locksettings/LockSettingsCmd.java b/cmds/locksettings/src/com/android/commands/locksettings/LockSettingsCmd.java
index 6a4a4beaa763..7d9260a77158 100644
--- a/cmds/locksettings/src/com/android/commands/locksettings/LockSettingsCmd.java
+++ b/cmds/locksettings/src/com/android/commands/locksettings/LockSettingsCmd.java
@@ -28,43 +28,13 @@ import java.io.PrintStream;
public final class LockSettingsCmd extends BaseCommand {
- private static final String USAGE =
- "usage: locksettings set-pattern [--old OLD_CREDENTIAL] NEW_PATTERN\n" +
- " locksettings set-pin [--old OLD_CREDENTIAL] NEW_PIN\n" +
- " locksettings set-password [--old OLD_CREDENTIAL] NEW_PASSWORD\n" +
- " locksettings clear [--old OLD_CREDENTIAL]\n" +
- " locksettings verify [--old OLD_CREDENTIAL]\n" +
- " locksettings set-disabled DISABLED\n" +
- " locksettings get-disabled\n" +
- "\n" +
- "flags: \n" +
- " --user USER_ID: specify the user, default value is current user\n" +
- "\n" +
- "locksettings set-pattern: sets a pattern\n" +
- " A pattern is specified by a non-separated list of numbers that index the cell\n" +
- " on the pattern in a 1-based manner in left to right and top to bottom order,\n" +
- " i.e. the top-left cell is indexed with 1, whereas the bottom-right cell\n" +
- " is indexed with 9. Example: 1234\n" +
- "\n" +
- "locksettings set-pin: sets a PIN\n" +
- "\n" +
- "locksettings set-password: sets a password\n" +
- "\n" +
- "locksettings clear: clears the unlock credential\n" +
- "\n" +
- "locksettings verify: verifies the credential and unlocks the user\n" +
- "\n" +
- "locksettings set-disabled: sets whether the lock screen should be disabled\n" +
- "\n" +
- "locksettings get-disabled: retrieves whether the lock screen is disabled\n";
-
public static void main(String[] args) {
(new LockSettingsCmd()).run(args);
}
@Override
public void onShowUsage(PrintStream out) {
- out.println(USAGE);
+ main(new String[] { "help" });
}
@Override
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java
index 3b843a9c622a..852dd974ae42 100644
--- a/core/java/android/app/ActivityThread.java
+++ b/core/java/android/app/ActivityThread.java
@@ -536,6 +536,9 @@ public final class ActivityThread extends ClientTransactionHandler
// A reusable token for other purposes, e.g. content capture, translation. It shouldn't be
// used without security checks
public IBinder shareableActivityToken;
+ // The token of the initial TaskFragment that embedded this activity. Do not rely on it
+ // after creation because the activity could be reparented.
+ @Nullable public IBinder mInitialTaskFragmentToken;
int ident;
@UnsupportedAppUsage
Intent intent;
@@ -618,7 +621,8 @@ public final class ActivityThread extends ClientTransactionHandler
PersistableBundle persistentState, List<ResultInfo> pendingResults,
List<ReferrerIntent> pendingNewIntents, ActivityOptions activityOptions,
boolean isForward, ProfilerInfo profilerInfo, ClientTransactionHandler client,
- IBinder assistToken, IBinder shareableActivityToken, boolean launchedFromBubble) {
+ IBinder assistToken, IBinder shareableActivityToken, boolean launchedFromBubble,
+ IBinder initialTaskFragmentToken) {
this.token = token;
this.assistToken = assistToken;
this.shareableActivityToken = shareableActivityToken;
@@ -639,6 +643,7 @@ public final class ActivityThread extends ClientTransactionHandler
compatInfo);
mActivityOptions = activityOptions;
mLaunchedFromBubble = launchedFromBubble;
+ mInitialTaskFragmentToken = initialTaskFragmentToken;
init();
}
diff --git a/core/java/android/app/admin/DevicePolicyManager.java b/core/java/android/app/admin/DevicePolicyManager.java
index 88ffdecfb537..d375a9e1ba26 100644
--- a/core/java/android/app/admin/DevicePolicyManager.java
+++ b/core/java/android/app/admin/DevicePolicyManager.java
@@ -1682,7 +1682,7 @@ public class DevicePolicyManager {
public @interface ProvisioningConfiguration {}
/**
- * A String extra holding the provisioning trigger. It could be one of
+ * An int extra holding the provisioning trigger. It could be one of
* {@link #PROVISIONING_TRIGGER_CLOUD_ENROLLMENT}, {@link #PROVISIONING_TRIGGER_QR_CODE},
* {@link #PROVISIONING_TRIGGER_MANAGED_ACCOUNT} or {@link
* #PROVISIONING_TRIGGER_UNSPECIFIED}.
@@ -3298,9 +3298,9 @@ public class DevicePolicyManager {
* Activity action: Starts the device policy management role holder updater.
*
* <p>The activity must handle the device policy management role holder update and set the
- * intent result to either {@link Activity#RESULT_OK} if the update was successful, {@link
- * #RESULT_UPDATE_DEVICE_POLICY_MANAGEMENT_ROLE_HOLDER_RECOVERABLE_ERROR} if it encounters a
- * problem that may be solved by relaunching it again, {@link
+ * intent result to either {@link Activity#RESULT_OK} if the update was successful or not
+ * necessary, {@link #RESULT_UPDATE_DEVICE_POLICY_MANAGEMENT_ROLE_HOLDER_RECOVERABLE_ERROR} if
+ * it encounters a problem that may be solved by relaunching it again, {@link
* #RESULT_UPDATE_DEVICE_POLICY_MANAGEMENT_ROLE_HOLDER_PROVISIONING_DISABLED} if role holder
* provisioning is disabled, or {@link
* #RESULT_UPDATE_DEVICE_POLICY_MANAGEMENT_ROLE_HOLDER_UNRECOVERABLE_ERROR} if it encounters
diff --git a/core/java/android/app/servertransaction/LaunchActivityItem.java b/core/java/android/app/servertransaction/LaunchActivityItem.java
index d7e09519bfb7..076dbef9ebc4 100644
--- a/core/java/android/app/servertransaction/LaunchActivityItem.java
+++ b/core/java/android/app/servertransaction/LaunchActivityItem.java
@@ -72,6 +72,7 @@ public class LaunchActivityItem extends ClientTransactionItem {
private IBinder mAssistToken;
private IBinder mShareableActivityToken;
private boolean mLaunchedFromBubble;
+ private IBinder mTaskFragmentToken;
/**
* It is only non-null if the process is the first time to launch activity. It is only an
* optimization for quick look up of the interface so the field is ignored for comparison.
@@ -95,7 +96,8 @@ public class LaunchActivityItem extends ClientTransactionItem {
ActivityClientRecord r = new ActivityClientRecord(token, mIntent, mIdent, mInfo,
mOverrideConfig, mCompatInfo, mReferrer, mVoiceInteractor, mState, mPersistentState,
mPendingResults, mPendingNewIntents, mActivityOptions, mIsForward, mProfilerInfo,
- client, mAssistToken, mShareableActivityToken, mLaunchedFromBubble);
+ client, mAssistToken, mShareableActivityToken, mLaunchedFromBubble,
+ mTaskFragmentToken);
client.handleLaunchActivity(r, pendingActions, null /* customIntent */);
Trace.traceEnd(TRACE_TAG_ACTIVITY_MANAGER);
}
@@ -119,7 +121,7 @@ public class LaunchActivityItem extends ClientTransactionItem {
List<ReferrerIntent> pendingNewIntents, ActivityOptions activityOptions,
boolean isForward, ProfilerInfo profilerInfo, IBinder assistToken,
IActivityClientController activityClientController, IBinder shareableActivityToken,
- boolean launchedFromBubble) {
+ boolean launchedFromBubble, IBinder taskFragmentToken) {
LaunchActivityItem instance = ObjectPool.obtain(LaunchActivityItem.class);
if (instance == null) {
instance = new LaunchActivityItem();
@@ -128,7 +130,7 @@ public class LaunchActivityItem extends ClientTransactionItem {
voiceInteractor, procState, state, persistentState, pendingResults,
pendingNewIntents, activityOptions, isForward, profilerInfo, assistToken,
activityClientController, shareableActivityToken,
- launchedFromBubble);
+ launchedFromBubble, taskFragmentToken);
return instance;
}
@@ -136,7 +138,7 @@ public class LaunchActivityItem extends ClientTransactionItem {
@Override
public void recycle() {
setValues(this, null, 0, null, null, null, null, null, null, 0, null, null, null, null,
- null, false, null, null, null, null, false);
+ null, false, null, null, null, null, false, null);
ObjectPool.recycle(this);
}
@@ -166,6 +168,7 @@ public class LaunchActivityItem extends ClientTransactionItem {
dest.writeStrongInterface(mActivityClientController);
dest.writeStrongBinder(mShareableActivityToken);
dest.writeBoolean(mLaunchedFromBubble);
+ dest.writeStrongBinder(mTaskFragmentToken);
}
/** Read from Parcel. */
@@ -184,7 +187,8 @@ public class LaunchActivityItem extends ClientTransactionItem {
in.readStrongBinder(),
IActivityClientController.Stub.asInterface(in.readStrongBinder()),
in.readStrongBinder(),
- in.readBoolean());
+ in.readBoolean(),
+ in.readStrongBinder());
}
public static final @NonNull Creator<LaunchActivityItem> CREATOR =
@@ -222,7 +226,8 @@ public class LaunchActivityItem extends ClientTransactionItem {
&& mIsForward == other.mIsForward
&& Objects.equals(mProfilerInfo, other.mProfilerInfo)
&& Objects.equals(mAssistToken, other.mAssistToken)
- && Objects.equals(mShareableActivityToken, other.mShareableActivityToken);
+ && Objects.equals(mShareableActivityToken, other.mShareableActivityToken)
+ && Objects.equals(mTaskFragmentToken, other.mTaskFragmentToken);
}
@Override
@@ -244,6 +249,7 @@ public class LaunchActivityItem extends ClientTransactionItem {
result = 31 * result + Objects.hashCode(mProfilerInfo);
result = 31 * result + Objects.hashCode(mAssistToken);
result = 31 * result + Objects.hashCode(mShareableActivityToken);
+ result = 31 * result + Objects.hashCode(mTaskFragmentToken);
return result;
}
@@ -291,7 +297,7 @@ public class LaunchActivityItem extends ClientTransactionItem {
List<ResultInfo> pendingResults, List<ReferrerIntent> pendingNewIntents,
ActivityOptions activityOptions, boolean isForward, ProfilerInfo profilerInfo,
IBinder assistToken, IActivityClientController activityClientController,
- IBinder shareableActivityToken, boolean launchedFromBubble) {
+ IBinder shareableActivityToken, boolean launchedFromBubble, IBinder taskFragmentToken) {
instance.mIntent = intent;
instance.mIdent = ident;
instance.mInfo = info;
@@ -312,5 +318,6 @@ public class LaunchActivityItem extends ClientTransactionItem {
instance.mActivityClientController = activityClientController;
instance.mShareableActivityToken = shareableActivityToken;
instance.mLaunchedFromBubble = launchedFromBubble;
+ instance.mTaskFragmentToken = taskFragmentToken;
}
}
diff --git a/core/java/android/view/Display.java b/core/java/android/view/Display.java
index 5f0098c25e55..0c4d9bf08583 100644
--- a/core/java/android/view/Display.java
+++ b/core/java/android/view/Display.java
@@ -1584,10 +1584,10 @@ public final class Display {
return false;
}
final Configuration config = mResources.getConfiguration();
- // TODO(b/179308296) Temporarily - never report max bounds to only Launcher if the feature
- // is disabled.
+ // TODO(b/179308296) Temporarily exclude Launcher from being given max bounds, by checking
+ // if the caller is the recents component.
return config != null && !config.windowConfiguration.getMaxBounds().isEmpty()
- && (mDisplayInfo.shouldConstrainMetricsForLauncher || !isRecentsComponent());
+ && !isRecentsComponent();
}
/**
diff --git a/core/java/android/view/DisplayInfo.java b/core/java/android/view/DisplayInfo.java
index 6917d664327f..9264d2ed42a3 100644
--- a/core/java/android/view/DisplayInfo.java
+++ b/core/java/android/view/DisplayInfo.java
@@ -306,13 +306,6 @@ public final class DisplayInfo implements Parcelable {
public float brightnessDefault;
/**
- * @hide
- * True if Display#getRealSize and getRealMetrics should be constrained for Launcher, false
- * otherwise.
- */
- public boolean shouldConstrainMetricsForLauncher = false;
-
- /**
* The {@link RoundedCorners} if present, otherwise {@code null}.
*/
@Nullable
@@ -395,7 +388,6 @@ public final class DisplayInfo implements Parcelable {
&& brightnessMaximum == other.brightnessMaximum
&& brightnessDefault == other.brightnessDefault
&& Objects.equals(roundedCorners, other.roundedCorners)
- && shouldConstrainMetricsForLauncher == other.shouldConstrainMetricsForLauncher
&& installOrientation == other.installOrientation;
}
@@ -447,7 +439,6 @@ public final class DisplayInfo implements Parcelable {
brightnessMaximum = other.brightnessMaximum;
brightnessDefault = other.brightnessDefault;
roundedCorners = other.roundedCorners;
- shouldConstrainMetricsForLauncher = other.shouldConstrainMetricsForLauncher;
installOrientation = other.installOrientation;
}
@@ -505,7 +496,6 @@ public final class DisplayInfo implements Parcelable {
for (int i = 0; i < numUserDisabledFormats; i++) {
userDisabledHdrTypes[i] = source.readInt();
}
- shouldConstrainMetricsForLauncher = source.readBoolean();
installOrientation = source.readInt();
}
@@ -561,7 +551,6 @@ public final class DisplayInfo implements Parcelable {
for (int i = 0; i < userDisabledHdrTypes.length; i++) {
dest.writeInt(userDisabledHdrTypes[i]);
}
- dest.writeBoolean(shouldConstrainMetricsForLauncher);
dest.writeInt(installOrientation);
}
@@ -817,8 +806,6 @@ public final class DisplayInfo implements Parcelable {
sb.append(brightnessMaximum);
sb.append(", brightnessDefault ");
sb.append(brightnessDefault);
- sb.append(", shouldConstrainMetricsForLauncher ");
- sb.append(shouldConstrainMetricsForLauncher);
sb.append(", installOrientation ");
sb.append(Surface.rotationToString(installOrientation));
sb.append("}");
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index d7940e2de98c..8b9a86b9eec6 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -12033,7 +12033,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
@Nullable
public Rect getHandwritingArea() {
final ListenerInfo info = mListenerInfo;
- if (info != null) {
+ if (info != null && info.mHandwritingArea != null) {
return new Rect(info.mHandwritingArea);
}
return null;
diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java
index 7b3fed74a9be..ee1e80defb6b 100644
--- a/core/java/android/view/ViewRootImpl.java
+++ b/core/java/android/view/ViewRootImpl.java
@@ -1742,7 +1742,7 @@ public final class ViewRootImpl implements ViewParent,
mForceNextWindowRelayout = forceNextWindowRelayout;
mPendingAlwaysConsumeSystemBars = args.argi2 != 0;
- mSyncSeqId = args.argi4;
+ mSyncSeqId = args.argi4 > mSyncSeqId ? args.argi4 : mSyncSeqId;
if (msg == MSG_RESIZED_REPORT) {
reportNextDraw();
@@ -7986,7 +7986,10 @@ public final class ViewRootImpl implements ViewParent,
insetsPending ? WindowManagerGlobal.RELAYOUT_INSETS_PENDING : 0,
mTmpFrames, mPendingMergedConfiguration, mSurfaceControl, mTempInsets,
mTempControls, mRelayoutBundle);
- mSyncSeqId = mRelayoutBundle.getInt("seqid");
+ final int maybeSyncSeqId = mRelayoutBundle.getInt("seqid");
+ if (maybeSyncSeqId > 0) {
+ mSyncSeqId = maybeSyncSeqId;
+ }
if (mTranslator != null) {
mTranslator.translateRectInScreenToAppWindow(mTmpFrames.frame);
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index 7069e716087d..dd69fa0bebb2 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -2303,6 +2303,7 @@
<java-symbol type="drawable" name="scrubber_control_disabled_holo" />
<java-symbol type="drawable" name="scrubber_control_selector_holo" />
<java-symbol type="drawable" name="scrubber_progress_horizontal_holo_dark" />
+ <java-symbol type="drawable" name="progress_small_material" />
<java-symbol type="string" name="chooseUsbActivity" />
<java-symbol type="string" name="ext_media_badremoval_notification_message" />
<java-symbol type="string" name="ext_media_badremoval_notification_title" />
diff --git a/core/tests/coretests/src/android/app/servertransaction/ObjectPoolTests.java b/core/tests/coretests/src/android/app/servertransaction/ObjectPoolTests.java
index 3e261a7113ac..50639be57f22 100644
--- a/core/tests/coretests/src/android/app/servertransaction/ObjectPoolTests.java
+++ b/core/tests/coretests/src/android/app/servertransaction/ObjectPoolTests.java
@@ -157,7 +157,7 @@ public class ObjectPoolTests {
.setPendingResults(resultInfoList()).setPendingNewIntents(referrerIntentList())
.setIsForward(true).setAssistToken(assistToken)
.setShareableActivityToken(shareableActivityToken)
- .build();
+ .setTaskFragmentToken(new Binder()).build();
LaunchActivityItem emptyItem = new LaunchActivityItemBuilder().build();
LaunchActivityItem item = itemSupplier.get();
diff --git a/core/tests/coretests/src/android/app/servertransaction/TestUtils.java b/core/tests/coretests/src/android/app/servertransaction/TestUtils.java
index 1467fed898c4..26d9628ba55b 100644
--- a/core/tests/coretests/src/android/app/servertransaction/TestUtils.java
+++ b/core/tests/coretests/src/android/app/servertransaction/TestUtils.java
@@ -110,6 +110,7 @@ class TestUtils {
private IBinder mAssistToken;
private IBinder mShareableActivityToken;
private boolean mLaunchedFromBubble;
+ private IBinder mTaskFragmentToken;
LaunchActivityItemBuilder setIntent(Intent intent) {
mIntent = intent;
@@ -206,13 +207,18 @@ class TestUtils {
return this;
}
+ LaunchActivityItemBuilder setTaskFragmentToken(IBinder taskFragmentToken) {
+ mTaskFragmentToken = taskFragmentToken;
+ return this;
+ }
+
LaunchActivityItem build() {
return LaunchActivityItem.obtain(mIntent, mIdent, mInfo,
mCurConfig, mOverrideConfig, mCompatInfo, mReferrer, mVoiceInteractor,
mProcState, mState, mPersistentState, mPendingResults, mPendingNewIntents,
mActivityOptions, mIsForward, mProfilerInfo, mAssistToken,
null /* activityClientController */, mShareableActivityToken,
- mLaunchedFromBubble);
+ mLaunchedFromBubble, mTaskFragmentToken);
}
}
}
diff --git a/core/tests/coretests/src/android/app/servertransaction/TransactionParcelTests.java b/core/tests/coretests/src/android/app/servertransaction/TransactionParcelTests.java
index beadc4464516..8276d10be4cd 100644
--- a/core/tests/coretests/src/android/app/servertransaction/TransactionParcelTests.java
+++ b/core/tests/coretests/src/android/app/servertransaction/TransactionParcelTests.java
@@ -203,6 +203,7 @@ public class TransactionParcelTests {
.setPendingResults(resultInfoList()).setActivityOptions(ActivityOptions.makeBasic())
.setPendingNewIntents(referrerIntentList()).setIsForward(true)
.setAssistToken(new Binder()).setShareableActivityToken(new Binder())
+ .setTaskFragmentToken(new Binder())
.build();
writeAndPrepareForReading(item);
diff --git a/core/tests/mockingcoretests/src/android/app/activity/ActivityThreadClientTest.java b/core/tests/mockingcoretests/src/android/app/activity/ActivityThreadClientTest.java
index b006a1681a99..8d3751e6ad6c 100644
--- a/core/tests/mockingcoretests/src/android/app/activity/ActivityThreadClientTest.java
+++ b/core/tests/mockingcoretests/src/android/app/activity/ActivityThreadClientTest.java
@@ -345,7 +345,7 @@ public class ActivityThreadClientTest {
null /* pendingResults */, null /* pendingNewIntents */,
null /* activityOptions */, true /* isForward */, null /* profilerInfo */,
mThread /* client */, null /* asssitToken */, null /* shareableActivityToken */,
- false /* launchedFromBubble */);
+ false /* launchedFromBubble */, null /* taskfragmentToken */);
}
@Override
diff --git a/libs/WindowManager/Jetpack/src/androidx/window/extensions/embedding/SplitController.java b/libs/WindowManager/Jetpack/src/androidx/window/extensions/embedding/SplitController.java
index c76fa9658c67..01f5feb9b13e 100644
--- a/libs/WindowManager/Jetpack/src/androidx/window/extensions/embedding/SplitController.java
+++ b/libs/WindowManager/Jetpack/src/androidx/window/extensions/embedding/SplitController.java
@@ -615,14 +615,22 @@ public class SplitController implements JetpackTaskFragmentOrganizer.TaskFragmen
return null;
}
+ private void updateCallbackIfNecessary() {
+ updateCallbackIfNecessary(true /* deferCallbackUntilAllActivitiesCreated */);
+ }
+
/**
* Notifies listeners about changes to split states if necessary.
+ *
+ * @param deferCallbackUntilAllActivitiesCreated boolean to indicate whether the split info
+ * callback should be deferred until all the
+ * organized activities have been created.
*/
- private void updateCallbackIfNecessary() {
+ private void updateCallbackIfNecessary(boolean deferCallbackUntilAllActivitiesCreated) {
if (mEmbeddingCallback == null) {
return;
}
- if (!allActivitiesCreated()) {
+ if (deferCallbackUntilAllActivitiesCreated && !allActivitiesCreated()) {
return;
}
List<SplitInfo> currentSplitStates = getActiveSplitStates();
@@ -838,6 +846,36 @@ public class SplitController implements JetpackTaskFragmentOrganizer.TaskFragmen
private final class LifecycleCallbacks extends EmptyLifecycleCallbacksAdapter {
@Override
+ public void onActivityPreCreated(Activity activity, Bundle savedInstanceState) {
+ final IBinder activityToken = activity.getActivityToken();
+ final IBinder initialTaskFragmentToken = ActivityThread.currentActivityThread()
+ .getActivityClient(activityToken).mInitialTaskFragmentToken;
+ // If the activity is not embedded, then it will not have an initial task fragment token
+ // so no further action is needed.
+ if (initialTaskFragmentToken == null) {
+ return;
+ }
+ for (int i = mTaskContainers.size() - 1; i >= 0; i--) {
+ final List<TaskFragmentContainer> containers = mTaskContainers.valueAt(i)
+ .mContainers;
+ for (int j = containers.size() - 1; j >= 0; j--) {
+ final TaskFragmentContainer container = containers.get(j);
+ if (!container.hasActivity(activityToken)
+ && container.getTaskFragmentToken().equals(initialTaskFragmentToken)) {
+ // The onTaskFragmentInfoChanged callback containing this activity has not
+ // reached the client yet, so add the activity to the pending appeared
+ // activities and send a split info callback to the client before
+ // {@link Activity#onCreate} is called.
+ container.addPendingAppearedActivity(activity);
+ updateCallbackIfNecessary(
+ false /* deferCallbackUntilAllActivitiesCreated */);
+ return;
+ }
+ }
+ }
+ }
+
+ @Override
public void onActivityPostCreated(Activity activity, Bundle savedInstanceState) {
// Calling after Activity#onCreate is complete to allow the app launch something
// first. In case of a configured placeholder activity we want to make sure
diff --git a/libs/WindowManager/Jetpack/src/androidx/window/extensions/embedding/TaskFragmentContainer.java b/libs/WindowManager/Jetpack/src/androidx/window/extensions/embedding/TaskFragmentContainer.java
index e49af41d4eac..9a12669f078a 100644
--- a/libs/WindowManager/Jetpack/src/androidx/window/extensions/embedding/TaskFragmentContainer.java
+++ b/libs/WindowManager/Jetpack/src/androidx/window/extensions/embedding/TaskFragmentContainer.java
@@ -120,7 +120,7 @@ class TaskFragmentContainer {
}
ActivityStack toActivityStack() {
- return new ActivityStack(collectActivities(), mInfo.getRunningActivityCount() == 0);
+ return new ActivityStack(collectActivities(), isEmpty());
}
void addPendingAppearedActivity(@NonNull Activity pendingAppearedActivity) {
diff --git a/packages/SettingsLib/src/com/android/settingslib/media/LocalMediaManager.java b/packages/SettingsLib/src/com/android/settingslib/media/LocalMediaManager.java
index c2e36b79b753..e1a2e8daf971 100644
--- a/packages/SettingsLib/src/com/android/settingslib/media/LocalMediaManager.java
+++ b/packages/SettingsLib/src/com/android/settingslib/media/LocalMediaManager.java
@@ -28,6 +28,7 @@ import android.text.TextUtils;
import android.util.Log;
import androidx.annotation.IntDef;
+import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
@@ -239,13 +240,24 @@ public class LocalMediaManager implements BluetoothCallback {
/**
* Dispatch a change in the about-to-connect device. See
- * {@link DeviceCallback#onAboutToConnectDeviceChanged} for more information.
+ * {@link DeviceCallback#onAboutToConnectDeviceAdded} for more information.
*/
- public void dispatchAboutToConnectDeviceChanged(
- @Nullable String deviceName,
+ public void dispatchAboutToConnectDeviceAdded(
+ @NonNull String deviceAddress,
+ @NonNull String deviceName,
@Nullable Drawable deviceIcon) {
for (DeviceCallback callback : getCallbacks()) {
- callback.onAboutToConnectDeviceChanged(deviceName, deviceIcon);
+ callback.onAboutToConnectDeviceAdded(deviceAddress, deviceName, deviceIcon);
+ }
+ }
+
+ /**
+ * Dispatch a change in the about-to-connect device. See
+ * {@link DeviceCallback#onAboutToConnectDeviceRemoved} for more information.
+ */
+ public void dispatchAboutToConnectDeviceRemoved() {
+ for (DeviceCallback callback : getCallbacks()) {
+ callback.onAboutToConnectDeviceRemoved();
}
}
@@ -705,13 +717,27 @@ public class LocalMediaManager implements BluetoothCallback {
* connect imminently and should be displayed as the current device in the media player.
* See [AudioManager.muteAwaitConnection] for more details.
*
- * @param deviceName the name of the device (displayed to the user).
- * @param deviceIcon the icon that should be used with the device.
+ * The information in the most recent callback should override information from any previous
+ * callbacks.
+ *
+ * @param deviceAddress the address of the device. {@see AudioDeviceAttributes.address}.
+ * If present, we'll use this address to fetch the full information
+ * about the device (if we can find that information).
+ * @param deviceName the name of the device (displayed to the user). Used as a backup in
+ * case using deviceAddress doesn't work.
+ * @param deviceIcon the icon that should be used with the device. Used as a backup in case
+ * using deviceAddress doesn't work.
*/
- default void onAboutToConnectDeviceChanged(
- @Nullable String deviceName,
+ default void onAboutToConnectDeviceAdded(
+ @NonNull String deviceAddress,
+ @NonNull String deviceName,
@Nullable Drawable deviceIcon
) {}
+
+ /**
+ * Callback for notifying that we no longer have an about-to-connect device.
+ */
+ default void onAboutToConnectDeviceRemoved() {}
}
/**
diff --git a/packages/SystemUI/docs/keyguard/bouncer.md b/packages/SystemUI/docs/device-entry/bouncer.md
index 4bfe7340db30..589cb5d300d3 100644
--- a/packages/SystemUI/docs/keyguard/bouncer.md
+++ b/packages/SystemUI/docs/device-entry/bouncer.md
@@ -2,6 +2,8 @@
[KeyguardBouncer][1] is the component responsible for displaying the security method set by the user (password, PIN, pattern) as well as SIM-related security methods, allowing the user to unlock the device or SIM.
+![ss-bouncer](./imgs/bouncer_pin.png)
+
## Supported States
1. Phone, portrait mode - The default and typically only way to view the bouncer. Screen cannot rotate.
diff --git a/packages/SystemUI/docs/keyguard/doze.md b/packages/SystemUI/docs/device-entry/doze.md
index a6ccab9698d4..5ff8851b4c69 100644
--- a/packages/SystemUI/docs/keyguard/doze.md
+++ b/packages/SystemUI/docs/device-entry/doze.md
@@ -2,6 +2,8 @@
Always-on Display (AOD) provides an alternative 'screen-off' experience. Instead, of completely turning the display off, it provides a distraction-free, glanceable experience for the phone in a low-powered mode. In this low-powered mode, the display will have a lower refresh rate and the UI should frequently shift its displayed contents in order to prevent burn-in. The recommended max on-pixel-ratio (OPR) is 5% to reduce battery consumption.
+![ss-aod](./imgs/aod.png)
+
The default doze component controls AOD and is specified by `config_dozeComponent` in the [framework config][1]. SystemUI provides a default Doze Component: [DozeService][2]. [DozeService][2] builds a [DozeMachine][3] with dependencies specified in [DozeModule][4] and configurations in [AmbientDisplayConfiguration][13] and [DozeParameters][14].
Note: The default UI used in AOD shares views with the Lock Screen and does not create its own new views. Once dozing begins, [DozeUI][17] informs SystemUI's [DozeServiceHost][18] that dozing has begun - which sends this signal to relevant SystemUI Lock Screen views to animate accordingly. Within SystemUI, [StatusBarStateController][19] #isDozing and #getDozeAmount can be used to query dozing state.
diff --git a/packages/SystemUI/docs/device-entry/glossary.md b/packages/SystemUI/docs/device-entry/glossary.md
new file mode 100644
index 000000000000..f3d12c21a3a5
--- /dev/null
+++ b/packages/SystemUI/docs/device-entry/glossary.md
@@ -0,0 +1,48 @@
+# Device Entry Glossary
+
+## Keyguard
+
+| Term | Description |
+| :-----------: | ----------- |
+| Keyguard, [keyguard.md][1] | Coordinates the first experience when turning on the display of a device, as long as the user has not specified a security method of NONE. Consists of the lock screen and bouncer.|
+| Lock screen<br><br>![ss_aod](imgs/lockscreen.png)| The first screen available when turning on the display of a device, as long as the user has not specified a security method of NONE. On the lock screen, users can access:<ul><li>Quick Settings - users can swipe down from the top of the screen to interact with quick settings tiles</li><li>[Keyguard Status Bar][9] - This special status bar shows SIM related information and system icons.</li><li>Clock - uses the font specified at [clock.xml][8]. If the clock font supports variable weights, users will experience delightful clock weight animations - in particular, on transitions between the lock screen and AOD.</li><li>Notifications - ability to view and interact with notifications depending on user lock screen notification settings: `Settings > Display > Lock screen > Privacy`</li><li>Message area - contains device information like biometric errors, charging information and device policy information. Also includes user configured information from `Settings > Display > Lock screen > Add text on lock screen`. </li><li>Bouncer - if the user has a primary authentication method, they can swipe up from the bottom of the screen to bring up the bouncer.</li></ul>The lock screen is one state of the notification shade. See [StatusBarState#KEYGUARD][10] and [StatusBarState#SHADE_LOCKED][10].|
+| Bouncer, [bouncer.md][2]<br><br>![ss_aod](imgs/bouncer_pin.png)| The component responsible for displaying the primary security method set by the user (password, PIN, pattern). The bouncer can also show SIM-related security methods, allowing the user to unlock the device or SIM.|
+| Split shade | State of the shade (which keyguard is a part of) in which notifications are on the right side and Quick Settings on the left. For keyguard that means notifications being on the right side and clock with media being on the left.<br><br>Split shade is automatically activated - using resources - for big screens in landscape, see [sw600dp-land/config.xml][3] `config_use_split_notification_shade`.<br><br>In that state we can see the big clock more often - every time when media is not visible on the lock screen. When there is no media and no notifications - or we enter AOD - big clock is always positioned in the center of the screen.<br><br>The magic of positioning views happens by changing constraints of [NotificationsQuickSettingsContainer][4] and positioning elements vertically in [KeyguardClockPositionAlgorithm][5]|
+| Ambient display (AOD), [doze.md][6]<br><br>![ss_aod](imgs/aod.png)| UI shown when the device is in a low-powered display state. This is controlled by the doze component. The same lock screen views (ie: clock, notification shade) are used on AOD. The AOSP image on the left shows the usage of a clock that does not support variable weights which is why the clock is thicker in that image than what users see on Pixel devices.|
+
+## General Authentication Terms
+| Term | Description |
+| ----------- | ----------- |
+| Primary Authentication | The strongest form of authentication. Includes: Pin, pattern and password input.|
+| Biometric Authentication | Face or fingerprint input. Biometric authentication is categorized into different classes of security. See [Measuring Biometric Security][7].|
+
+## Face Authentication Terms
+| Term | Description |
+| ----------- | ----------- |
+| Passive Authentication | When a user hasn't explicitly requested an authentication method; however, it may still put the device in an unlocked state.<br><br>For example, face authentication is triggered immediately when waking the device; however, users may not have the intent of unlocking their device. Instead, they could have wanted to just check the lock screen. Because of this, SystemUI provides the option for a bypass OR non-bypass face authentication experience which have different user flows.<br><br>In contrast, fingerprint authentication is considered an active authentication method since users need to actively put their finger on the fingerprint sensor to authenticate. Therefore, it's an explicit request for authentication and SystemUI knows the user has the intent for device-entry.|
+| Bypass | Used to refer to the face authentication bypass device entry experience. We have this distinction because face auth is a passive authentication method (see above).|
+| Bypass User Journey <br><br>![ss_bypass](imgs/bypass.png)| Once the user successfully authenticates with face, the keyguard immediately dismisses and the user is brought to the home screen/last app. This CUJ prioritizes speed of device entry. SystemUI hides interactive views (notifications) on the lock screen to avoid putting users in a state where the lock screen could immediately disappear while they're interacting with affordances on the lock screen.|
+| Non-bypass User Journey | Once the user successfully authenticates with face, the device remains on keyguard until the user performs an action to indicate they'd like to enter the device (ie: swipe up on the lock screen or long press on the unlocked icon). This CUJ prioritizes notification visibility.|
+
+## Fingerprint Authentication Terms
+| Term | Description |
+| ----------- | ----------- |
+| Under-display fingerprint sensor (UDFPS) | References the HW affordance for a fingerprint sensor that is under the display, which requires a software visual affordance. System UI supports showing the UDFPS affordance on the lock screen and on AOD. Users cannot authenticate from the screen-off state.<br><br>Supported SystemUI CUJs include:<ul><li> sliding finger on the screen to the UDFPS area to being authentication (as opposed to directly placing finger in the UDFPS area) </li><li> when a11y services are enabled, there is a haptic played when a touch is detected on UDFPS</li><li>after two hard-fingerprint-failures, the primary authentication bouncer is shown</li><li> when tapping on an affordance that requests to dismiss the lock screen, the user may see the UDFPS icon highlighted - see UDFPS bouncer</li></ul>|
+| UDFPS Bouncer | UI that highlights the UDFPS sensor. Users can get into this state after tapping on a notification from the lock screen or locked expanded shade.|
+
+## Other Authentication Terms
+| Term | Description |
+| ---------- | ----------- |
+| Trust Agents | Provides signals to the keyguard to allow it to lock less frequently.|
+
+
+[1]: /frameworks/base/packages/SystemUI/docs/device-entry/keyguard.md
+[2]: /frameworks/base/packages/SystemUI/docs/device-entry/bouncer.md
+[3]: /frameworks/base/packages/SystemUI/res/values-sw600dp-land/config.xml
+[4]: /frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationsQuickSettingsContainer.java
+[5]: /frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithm.java
+[6]: /frameworks/base/packages/SystemUI/docs/device-entry/doze.md
+[7]: https://source.android.com/security/biometric/measure
+[8]: /frameworks/base/packages/SystemUI/res-keyguard/font/clock.xml
+[9]: /frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardStatusBarViewController.java
+[10]: /frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarState.java
diff --git a/packages/SystemUI/docs/device-entry/imgs/aod.png b/packages/SystemUI/docs/device-entry/imgs/aod.png
new file mode 100644
index 000000000000..abd554a8936f
--- /dev/null
+++ b/packages/SystemUI/docs/device-entry/imgs/aod.png
Binary files differ
diff --git a/packages/SystemUI/docs/device-entry/imgs/bouncer_pin.png b/packages/SystemUI/docs/device-entry/imgs/bouncer_pin.png
new file mode 100644
index 000000000000..da15e4115ab9
--- /dev/null
+++ b/packages/SystemUI/docs/device-entry/imgs/bouncer_pin.png
Binary files differ
diff --git a/packages/SystemUI/docs/device-entry/imgs/bypass.png b/packages/SystemUI/docs/device-entry/imgs/bypass.png
new file mode 100644
index 000000000000..f4cbd3efb6fc
--- /dev/null
+++ b/packages/SystemUI/docs/device-entry/imgs/bypass.png
Binary files differ
diff --git a/packages/SystemUI/docs/device-entry/imgs/lockscreen.png b/packages/SystemUI/docs/device-entry/imgs/lockscreen.png
new file mode 100644
index 000000000000..d1fe0853f578
--- /dev/null
+++ b/packages/SystemUI/docs/device-entry/imgs/lockscreen.png
Binary files differ
diff --git a/packages/SystemUI/docs/keyguard.md b/packages/SystemUI/docs/device-entry/keyguard.md
index 8914042ee3cd..337f73b79260 100644
--- a/packages/SystemUI/docs/keyguard.md
+++ b/packages/SystemUI/docs/device-entry/keyguard.md
@@ -30,6 +30,12 @@ An indication to power off the device most likely comes from one of two signals:
### How the device locks
+## Debugging Tips
+Enable verbose keyguard logs that will print to logcat. Should only be used temporarily for debugging. See [KeyguardConstants][5].
+```
+adb shell setprop log.tag.Keyguard DEBUG && adb shell am crash com.android.systemui
+```
+
More coming
* Screen timeout
* Smart lock
@@ -38,9 +44,8 @@ More coming
* Lock timeout after screen timeout setting
-[1]: /frameworks/base/packages/SystemUI/docs/keyguard/bouncer.md
-[2]: /frameworks/base/services/core/java/com/android/server/power/PowerManagerService.java
-[3]: /frameworks/base/packages/SystemUI/docs/keyguard/doze.md
-[4]: /frameworks/base/services/core/java/com/android/server/policy/PhoneWindowManager.java
-
-
+[1]: /frameworks/base/packages/SystemUI/docs/device-entry/bouncer.md
+[2]: /com/android/server/power/PowerManagerService.java
+[3]: /frameworks/base/packages/SystemUI/docs/device-entry/doze.md
+[4]: /com/android/server/policy/PhoneWindowManager.java
+[5]: /frameworks/base/packages/SystemUI/src/com/android/keyguard/KeyguardConstants.java
diff --git a/packages/SystemUI/docs/user-switching.md b/packages/SystemUI/docs/user-switching.md
index dcf66b943f1d..b9509eb41c3c 100644
--- a/packages/SystemUI/docs/user-switching.md
+++ b/packages/SystemUI/docs/user-switching.md
@@ -37,7 +37,7 @@ A fullscreen user switching activity, supporting add guest/user actions if confi
Renders user switching as a dialog over the current surface, and supports add guest user/actions if configured.
-[1]: /frameworks/base/packages/SystemUI/docs/keyguard/bouncer.md
+[1]: /frameworks/base/packages/SystemUI/docs/device-entry/bouncer.md
[2]: /frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/MultiUserController.java
[3]: /frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/policy/UserSwitcherController.java
[4]: /frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardQsUserSwitchController.java
diff --git a/packages/SystemUI/res/drawable/ic_media_connecting_container.xml b/packages/SystemUI/res/drawable/ic_media_connecting_container.xml
new file mode 100644
index 000000000000..79d2a0601e08
--- /dev/null
+++ b/packages/SystemUI/res/drawable/ic_media_connecting_container.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2022 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
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:height="48dp"
+ android:width="48dp"
+ android:viewportHeight="48"
+ android:viewportWidth="48">
+ <group android:name="_R_G">
+ <group android:name="_R_G_L_1_G"
+ android:translateX="24"
+ android:translateY="24"
+ android:scaleX="0.5"
+ android:scaleY="0.5"/>
+ <group android:name="_R_G_L_0_G"
+ android:translateX="24"
+ android:translateY="24"
+ android:scaleX="0.5"
+ android:scaleY="0.5">
+ <path android:name="_R_G_L_0_G_D_0_P_0"
+ android:fillColor="#ffddb3"
+ android:fillAlpha="1"
+ android:fillType="nonZero"
+ android:pathData=" M48 -16 C48,-16 48,16 48,16 C48,33.67 33.67,48 16,48 C16,48 -16,48 -16,48 C-33.67,48 -48,33.67 -48,16 C-48,16 -48,-16 -48,-16 C-48,-33.67 -33.67,-48 -16,-48 C-16,-48 16,-48 16,-48 C33.67,-48 48,-33.67 48,-16c "/>
+ </group>
+ </group>
+</vector> \ No newline at end of file
diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml
index 33ed7b8421db..b248efe93e98 100644
--- a/packages/SystemUI/res/values/strings.xml
+++ b/packages/SystemUI/res/values/strings.xml
@@ -2199,6 +2199,8 @@
<string name="controls_media_button_prev">Previous track</string>
<!-- Description for button in media controls. Pressing button goes to next track [CHAR_LIMIT=NONE] -->
<string name="controls_media_button_next">Next track</string>
+ <!-- Description for button in media controls. Used when media is connecting to a remote device (via something like chromecast). Pressing button does nothing [CHAR_LIMIT=NONE] -->
+ <string name="controls_media_button_connecting">Connecting</string>
<!-- Title for Smartspace recommendation card within media controls. The "Play" means the action to play a media [CHAR_LIMIT=10] -->
<string name="controls_media_smartspace_rec_title">Play</string>
diff --git a/packages/SystemUI/src/com/android/systemui/media/MediaControlPanel.java b/packages/SystemUI/src/com/android/systemui/media/MediaControlPanel.java
index fffb30720af6..05b2c5055e44 100644
--- a/packages/SystemUI/src/com/android/systemui/media/MediaControlPanel.java
+++ b/packages/SystemUI/src/com/android/systemui/media/MediaControlPanel.java
@@ -660,38 +660,43 @@ public class MediaControlPanel {
final ImageButton button, MediaAction mediaAction, ConstraintSet collapsedSet,
ConstraintSet expandedSet, boolean showInCompact) {
- animHandler.unregisterAll();
if (mediaAction != null) {
- final Drawable icon = mediaAction.getIcon();
- button.setImageDrawable(icon);
- button.setContentDescription(mediaAction.getContentDescription());
- final Drawable bgDrawable = mediaAction.getBackground();
- button.setBackground(bgDrawable);
-
- animHandler.tryRegister(icon);
- animHandler.tryRegister(bgDrawable);
-
- Runnable action = mediaAction.getAction();
- if (action == null) {
- button.setEnabled(false);
- } else {
- button.setEnabled(true);
- button.setOnClickListener(v -> {
- if (!mFalsingManager.isFalseTap(FalsingManager.LOW_PENALTY)) {
- mLogger.logTapAction(button.getId(), mUid, mPackageName, mInstanceId);
- logSmartspaceCardReported(SMARTSPACE_CARD_CLICK_EVENT);
- action.run();
-
- if (icon instanceof Animatable) {
- ((Animatable) icon).start();
- }
- if (bgDrawable instanceof Animatable) {
- ((Animatable) bgDrawable).start();
+ if (animHandler.updateRebindId(mediaAction.getRebindId())) {
+ animHandler.unregisterAll();
+
+ final Drawable icon = mediaAction.getIcon();
+ button.setImageDrawable(icon);
+ button.setContentDescription(mediaAction.getContentDescription());
+ final Drawable bgDrawable = mediaAction.getBackground();
+ button.setBackground(bgDrawable);
+
+ animHandler.tryRegister(icon);
+ animHandler.tryRegister(bgDrawable);
+
+ Runnable action = mediaAction.getAction();
+ if (action == null) {
+ button.setEnabled(false);
+ } else {
+ button.setEnabled(true);
+ button.setOnClickListener(v -> {
+ if (!mFalsingManager.isFalseTap(FalsingManager.LOW_PENALTY)) {
+ mLogger.logTapAction(button.getId(), mUid, mPackageName, mInstanceId);
+ mLogger.logTapAction(button.getId(), mUid, mPackageName, mInstanceId);
+ logSmartspaceCardReported(SMARTSPACE_CARD_CLICK_EVENT);
+ action.run();
+
+ if (icon instanceof Animatable) {
+ ((Animatable) icon).start();
+ }
+ if (bgDrawable instanceof Animatable) {
+ ((Animatable) bgDrawable).start();
+ }
}
- }
- });
+ });
+ }
}
} else {
+ animHandler.unregisterAll();
button.setImageDrawable(null);
button.setContentDescription(null);
button.setEnabled(false);
@@ -702,9 +707,29 @@ public class MediaControlPanel {
setVisibleAndAlpha(expandedSet, button.getId(), mediaAction != null);
}
+ // AnimationBindHandler is responsible for tracking the bound animation state and preventing
+ // jank and conflicts due to media notifications arriving at any time during an animation. It
+ // does this in two parts.
+ // - Exit animations fired as a result of user input are tracked. When these are running, any
+ // bind actions are delayed until the animation completes (and then fired in sequence).
+ // - Continuous animations are tracked using their rebind id. Later calls using the same
+ // rebind id will be totally ignored to prevent the continuous animation from restarting.
private static class AnimationBindHandler extends Animatable2.AnimationCallback {
private ArrayList<Runnable> mOnAnimationsComplete = new ArrayList<>();
private ArrayList<Animatable2> mRegistrations = new ArrayList<>();
+ private Integer mRebindId = null;
+
+ // This check prevents rebinding to the action button if the identifier has not changed. A
+ // null value is always considered to be changed. This is used to prevent the connecting
+ // animation from rebinding (and restarting) if multiple buffer PlaybackStates are pushed by
+ // an application in a row.
+ public boolean updateRebindId(Integer rebindId) {
+ if (mRebindId == null || rebindId == null || !mRebindId.equals(rebindId)) {
+ mRebindId = rebindId;
+ return true;
+ }
+ return false;
+ }
public void tryRegister(Drawable drawable) {
if (drawable instanceof Animatable2) {
diff --git a/packages/SystemUI/src/com/android/systemui/media/MediaData.kt b/packages/SystemUI/src/com/android/systemui/media/MediaData.kt
index a4d2f7bc96c4..bc8cca55154d 100644
--- a/packages/SystemUI/src/com/android/systemui/media/MediaData.kt
+++ b/packages/SystemUI/src/com/android/systemui/media/MediaData.kt
@@ -184,7 +184,12 @@ data class MediaAction(
val icon: Drawable?,
val action: Runnable?,
val contentDescription: CharSequence?,
- val background: Drawable?
+ val background: Drawable?,
+
+ // Rebind Id is used to detect identical rebinds and ignore them. It is intended
+ // to prevent continuously looping animations from restarting due to the arrival
+ // of repeated media notifications that are visually identical.
+ val rebindId: Int? = null
)
/** State of the media device. */
diff --git a/packages/SystemUI/src/com/android/systemui/media/MediaDataManager.kt b/packages/SystemUI/src/com/android/systemui/media/MediaDataManager.kt
index 908aef41034e..57c93bae3bbf 100644
--- a/packages/SystemUI/src/com/android/systemui/media/MediaDataManager.kt
+++ b/packages/SystemUI/src/com/android/systemui/media/MediaDataManager.kt
@@ -30,6 +30,7 @@ import android.content.IntentFilter
import android.content.pm.PackageManager
import android.graphics.Bitmap
import android.graphics.ImageDecoder
+import android.graphics.drawable.Animatable
import android.graphics.drawable.Icon
import android.media.MediaDescription
import android.media.MediaMetadata
@@ -57,6 +58,7 @@ import com.android.systemui.dump.DumpManager
import com.android.systemui.plugins.ActivityStarter
import com.android.systemui.plugins.BcSmartspaceDataPlugin
import com.android.systemui.statusbar.NotificationMediaManager.isPlayingState
+import com.android.systemui.statusbar.NotificationMediaManager.isConnectingState
import com.android.systemui.statusbar.notification.row.HybridGroupManager
import com.android.systemui.tuner.TunerService
import com.android.systemui.util.Assert
@@ -777,7 +779,20 @@ class MediaDataManager(
val actions = MediaButton()
controller.playbackState?.let { state ->
// First, check for standard actions
- actions.playOrPause = if (isPlayingState(state.state)) {
+ actions.playOrPause = if (isConnectingState(state.state)) {
+ // Spinner needs to be animating to render anything. Start it here.
+ val drawable = context.getDrawable(
+ com.android.internal.R.drawable.progress_small_material)
+ (drawable as Animatable).start()
+ MediaAction(
+ drawable,
+ null, // no action to perform when clicked
+ context.getString(R.string.controls_media_button_connecting),
+ context.getDrawable(R.drawable.ic_media_connecting_container),
+ // Specify a rebind id to prevent the spinner from restarting on later binds.
+ com.android.internal.R.drawable.progress_small_material
+ )
+ } else if (isPlayingState(state.state)) {
getStandardAction(controller, state.actions, PlaybackState.ACTION_PAUSE)
} else {
getStandardAction(controller, state.actions, PlaybackState.ACTION_PLAY)
diff --git a/packages/SystemUI/src/com/android/systemui/media/MediaDeviceManager.kt b/packages/SystemUI/src/com/android/systemui/media/MediaDeviceManager.kt
index 824a6fd9d96e..d6231911244f 100644
--- a/packages/SystemUI/src/com/android/systemui/media/MediaDeviceManager.kt
+++ b/packages/SystemUI/src/com/android/systemui/media/MediaDeviceManager.kt
@@ -164,7 +164,7 @@ class MediaDeviceManager @Inject constructor(
}
// A device that is not yet connected but is expected to connect imminently. Because it's
// expected to connect imminently, it should be displayed as the current device.
- private var aboutToConnectDeviceOverride: MediaDeviceData? = null
+ private var aboutToConnectDeviceOverride: AboutToConnectDevice? = null
@AnyThread
fun start() = bgExecutor.execute {
@@ -222,22 +222,34 @@ class MediaDeviceManager @Inject constructor(
}
}
- override fun onAboutToConnectDeviceChanged(deviceName: String?, deviceIcon: Drawable?) {
- aboutToConnectDeviceOverride = if (deviceName == null || deviceIcon == null) {
- null
- } else {
- MediaDeviceData(enabled = true, deviceIcon, deviceName)
- }
+ override fun onAboutToConnectDeviceAdded(
+ deviceAddress: String,
+ deviceName: String,
+ deviceIcon: Drawable?
+ ) {
+ aboutToConnectDeviceOverride = AboutToConnectDevice(
+ fullMediaDevice = localMediaManager.getMediaDeviceById(deviceAddress),
+ backupMediaDeviceData = MediaDeviceData(enabled = true, deviceIcon, deviceName)
+ )
+ updateCurrent()
+ }
+
+ override fun onAboutToConnectDeviceRemoved() {
+ aboutToConnectDeviceOverride = null
updateCurrent()
}
@WorkerThread
private fun updateCurrent() {
- if (aboutToConnectDeviceOverride != null) {
- current = aboutToConnectDeviceOverride
- return
+ val aboutToConnect = aboutToConnectDeviceOverride
+ if (aboutToConnect != null &&
+ aboutToConnect.fullMediaDevice == null &&
+ aboutToConnect.backupMediaDeviceData != null) {
+ // Only use [backupMediaDeviceData] when we don't have [fullMediaDevice].
+ current = aboutToConnect.backupMediaDeviceData
+ return
}
- val device = localMediaManager.currentConnectedDevice
+ val device = aboutToConnect?.fullMediaDevice ?: localMediaManager.currentConnectedDevice
val route = controller?.let { mr2manager.getRoutingSessionForMediaController(it) }
// If we have a controller but get a null route, then don't trust the device
@@ -247,3 +259,17 @@ class MediaDeviceManager @Inject constructor(
}
}
}
+
+/**
+ * A class storing information for the about-to-connect device. See
+ * [LocalMediaManager.DeviceCallback.onAboutToConnectDeviceAdded] for more information.
+ *
+ * @property fullMediaDevice a full-fledged [MediaDevice] object representing the device. If
+ * non-null, prefer using [fullMediaDevice] over [backupMediaDeviceData].
+ * @property backupMediaDeviceData a backup [MediaDeviceData] object containing the minimum
+ * information required to display the device. Only use if [fullMediaDevice] is null.
+ */
+private data class AboutToConnectDevice(
+ val fullMediaDevice: MediaDevice? = null,
+ val backupMediaDeviceData: MediaDeviceData? = null
+)
diff --git a/packages/SystemUI/src/com/android/systemui/media/MediaUiEventLogger.kt b/packages/SystemUI/src/com/android/systemui/media/MediaUiEventLogger.kt
index 0fc58132b4d7..3eba3b55b7e8 100644
--- a/packages/SystemUI/src/com/android/systemui/media/MediaUiEventLogger.kt
+++ b/packages/SystemUI/src/com/android/systemui/media/MediaUiEventLogger.kt
@@ -178,7 +178,7 @@ enum class MediaUiEvent(val metricId: Int) : UiEventLogger.UiEventEnum {
@UiEvent(doc = "An existing active media control was converted into resumable media")
ACTIVE_TO_RESUME(1014),
- @UiEvent(doc = "Media timed out")
+ @UiEvent(doc = "A media control timed out")
MEDIA_TIMEOUT(1015),
@UiEvent(doc = "A media control was removed from the carousel")
@@ -190,31 +190,31 @@ enum class MediaUiEvent(val metricId: Int) : UiEventLogger.UiEventEnum {
@UiEvent(doc = "The user swiped away the media carousel")
DISMISS_SWIPE(1018),
- @UiEvent(doc = "The user opened the long press menu")
+ @UiEvent(doc = "The user long pressed on a media control")
OPEN_LONG_PRESS(1019),
- @UiEvent(doc = "The user dismissed via long press menu")
+ @UiEvent(doc = "The user dismissed a media control via its long press menu")
DISMISS_LONG_PRESS(1020),
- @UiEvent(doc = "The user opened settings from long press menu")
+ @UiEvent(doc = "The user opened media settings from a media control's long press menu")
OPEN_SETTINGS_LONG_PRESS(1021),
- @UiEvent(doc = "The user opened settings from the carousel")
+ @UiEvent(doc = "The user opened media settings from the media carousel")
OPEN_SETTINGS_CAROUSEL(1022),
- @UiEvent(doc = "The play/pause button was tapped")
+ @UiEvent(doc = "The play/pause button on a media control was tapped")
TAP_ACTION_PLAY_PAUSE(1023),
- @UiEvent(doc = "The previous button was tapped")
+ @UiEvent(doc = "The previous button on a media control was tapped")
TAP_ACTION_PREV(1024),
- @UiEvent(doc = "The next button was tapped")
+ @UiEvent(doc = "The next button on a media control was tapped")
TAP_ACTION_NEXT(1025),
- @UiEvent(doc = "A custom or generic action button was tapped")
+ @UiEvent(doc = "A custom or generic action button on a media control was tapped")
TAP_ACTION_OTHER(1026),
- @UiEvent(doc = "The user seeked using the seekbar")
+ @UiEvent(doc = "The user seeked on a media control using the seekbar")
ACTION_SEEK(1027),
@UiEvent(doc = "The user opened the output switcher from a media control")
diff --git a/packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputController.java b/packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputController.java
index 807f0f1bb0ba..ec2a950051b7 100644
--- a/packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputController.java
+++ b/packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputController.java
@@ -721,7 +721,7 @@ public class MediaOutputController implements LocalMediaManager.DeviceCallback,
boolean isVolumeControlEnabled(@NonNull MediaDevice device) {
return isPlayBackInfoLocal()
- || mLocalMediaManager.isMediaSessionAvailableForVolumeControl();
+ || device.getDeviceType() != MediaDevice.MediaDeviceType.TYPE_CAST_GROUP_DEVICE;
}
@Override
diff --git a/packages/SystemUI/src/com/android/systemui/media/muteawait/MediaMuteAwaitConnectionManager.kt b/packages/SystemUI/src/com/android/systemui/media/muteawait/MediaMuteAwaitConnectionManager.kt
index 22bc5572f5a5..2783532aff97 100644
--- a/packages/SystemUI/src/com/android/systemui/media/muteawait/MediaMuteAwaitConnectionManager.kt
+++ b/packages/SystemUI/src/com/android/systemui/media/muteawait/MediaMuteAwaitConnectionManager.kt
@@ -52,7 +52,9 @@ class MediaMuteAwaitConnectionManager constructor(
// There should only be one device that's mutedUntilConnection at a time, so we can
// safely override any previous value.
currentMutedDevice = device
- localMediaManager.dispatchAboutToConnectDeviceChanged(device.name, device.getIcon())
+ localMediaManager.dispatchAboutToConnectDeviceAdded(
+ device.address, device.name, device.getIcon()
+ )
}
}
@@ -63,7 +65,7 @@ class MediaMuteAwaitConnectionManager constructor(
) {
if (currentMutedDevice == device && USAGE_MEDIA in mutedUsages) {
currentMutedDevice = null
- localMediaManager.dispatchAboutToConnectDeviceChanged(null, null)
+ localMediaManager.dispatchAboutToConnectDeviceRemoved()
}
}
}
@@ -76,8 +78,8 @@ class MediaMuteAwaitConnectionManager constructor(
val currentDevice = audioManager.mutingExpectedDevice
if (currentDevice != null) {
currentMutedDevice = currentDevice
- localMediaManager.dispatchAboutToConnectDeviceChanged(
- currentDevice.name, currentDevice.getIcon()
+ localMediaManager.dispatchAboutToConnectDeviceAdded(
+ currentDevice.address, currentDevice.name, currentDevice.getIcon()
)
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/people/PeopleSpaceUtils.java b/packages/SystemUI/src/com/android/systemui/people/PeopleSpaceUtils.java
index c01d6dcd7d64..c6c9aca0b161 100644
--- a/packages/SystemUI/src/com/android/systemui/people/PeopleSpaceUtils.java
+++ b/packages/SystemUI/src/com/android/systemui/people/PeopleSpaceUtils.java
@@ -466,7 +466,7 @@ public class PeopleSpaceUtils {
}
}
} catch (SQLException e) {
- Log.e(TAG, "Failed to query contact: " + e);
+ Log.e(TAG, "Failed to query contact", e);
} finally {
if (cursor != null) {
cursor.close();
@@ -527,7 +527,7 @@ public class PeopleSpaceUtils {
lookupKeysWithBirthdaysToday.add(lookupKey);
}
} catch (SQLException e) {
- Log.e(TAG, "Failed to query birthdays: " + e);
+ Log.e(TAG, "Failed to query birthdays", e);
} finally {
if (cursor != null) {
cursor.close();
diff --git a/packages/SystemUI/src/com/android/systemui/people/widget/PeopleSpaceWidgetManager.java b/packages/SystemUI/src/com/android/systemui/people/widget/PeopleSpaceWidgetManager.java
index 08249a3d493e..1a7bd8cb6cf9 100644
--- a/packages/SystemUI/src/com/android/systemui/people/widget/PeopleSpaceWidgetManager.java
+++ b/packages/SystemUI/src/com/android/systemui/people/widget/PeopleSpaceWidgetManager.java
@@ -275,7 +275,7 @@ public class PeopleSpaceWidgetManager {
updateSingleConversationWidgets(widgetIds);
}
} catch (Exception e) {
- Log.e(TAG, "Exception: " + e);
+ Log.e(TAG, "failed to update widgets", e);
}
}
@@ -348,7 +348,7 @@ public class PeopleSpaceWidgetManager {
try {
return getTileForExistingWidgetThrowing(appWidgetId);
} catch (Exception e) {
- Log.e(TAG, "Failed to retrieve conversation for tile: " + e);
+ Log.e(TAG, "failed to retrieve tile for widget ID " + appWidgetId, e);
return null;
}
}
@@ -423,7 +423,7 @@ public class PeopleSpaceWidgetManager {
// Add current state.
return getTileWithCurrentState(storedTile.build(), ACTION_BOOT_COMPLETED);
} catch (RemoteException e) {
- Log.e(TAG, "Could not retrieve data: " + e);
+ Log.e(TAG, "getTileFromPersistentStorage failing", e);
return null;
}
}
@@ -476,7 +476,7 @@ public class PeopleSpaceWidgetManager {
updateWidgetIdsBasedOnNotifications(tilesUpdated, notifications);
}
} catch (Exception e) {
- Log.e(TAG, "Throwing exception: " + e);
+ Log.e(TAG, "updateWidgetsWithNotificationChangedInBackground failing", e);
}
}
@@ -499,7 +499,7 @@ public class PeopleSpaceWidgetManager {
id -> getAugmentedTileForExistingWidget(id, groupedNotifications)))
.forEach((id, tile) -> updateAppWidgetOptionsAndViewOptional(id, tile));
} catch (Exception e) {
- Log.e(TAG, "Exception updating widgets: " + e);
+ Log.e(TAG, "updateWidgetIdsBasedOnNotifications failing", e);
}
}
@@ -851,7 +851,7 @@ public class PeopleSpaceWidgetManager {
Collections.singletonList(tile.getId()),
tile.getUserHandle(), LauncherApps.FLAG_CACHE_PEOPLE_TILE_SHORTCUTS);
} catch (Exception e) {
- Log.w(TAG, "Exception caching shortcut:" + e);
+ Log.w(TAG, "failed to cache shortcut", e);
}
PeopleSpaceTile finalTile = tile;
mBgExecutor.execute(
@@ -959,7 +959,7 @@ public class PeopleSpaceWidgetManager {
UserHandle.of(key.getUserId()),
LauncherApps.FLAG_CACHE_PEOPLE_TILE_SHORTCUTS);
} catch (Exception e) {
- Log.d(TAG, "Exception uncaching shortcut:" + e);
+ Log.d(TAG, "failed to uncache shortcut", e);
}
}
@@ -1042,7 +1042,7 @@ public class PeopleSpaceWidgetManager {
packageName, userHandle.getIdentifier(), shortcutId);
tile = PeopleSpaceUtils.getTile(channel, mLauncherApps);
} catch (Exception e) {
- Log.w(TAG, "Exception getting tiles: " + e);
+ Log.w(TAG, "failed to get conversation or tile", e);
return null;
}
if (tile == null) {
@@ -1091,7 +1091,7 @@ public class PeopleSpaceWidgetManager {
}
} catch (PackageManager.NameNotFoundException e) {
// Delete data for uninstalled widgets.
- Log.e(TAG, "Package no longer found for tile: " + e);
+ Log.e(TAG, "package no longer found for tile", e);
JobScheduler jobScheduler = mContext.getSystemService(JobScheduler.class);
if (jobScheduler != null
&& jobScheduler.getPendingJob(PeopleBackupFollowUpJob.JOB_ID) != null) {
@@ -1301,7 +1301,7 @@ public class PeopleSpaceWidgetManager {
try {
editor.putString(newId, (String) entry.getValue());
} catch (Exception e) {
- Log.e(TAG, "Malformed entry value: " + entry.getValue());
+ Log.e(TAG, "malformed entry value: " + entry.getValue(), e);
}
editor.remove(key);
break;
@@ -1311,7 +1311,7 @@ public class PeopleSpaceWidgetManager {
try {
oldWidgetIds = (Set<String>) entry.getValue();
} catch (Exception e) {
- Log.e(TAG, "Malformed entry value: " + entry.getValue());
+ Log.e(TAG, "malformed entry value: " + entry.getValue(), e);
editor.remove(key);
break;
}
@@ -1342,7 +1342,7 @@ public class PeopleSpaceWidgetManager {
try {
oldWidgetIds = (Set<String>) entry.getValue();
} catch (Exception e) {
- Log.e(TAG, "Malformed entry value: " + entry.getValue());
+ Log.e(TAG, "malformed entry value: " + entry.getValue(), e);
followUpEditor.remove(key);
continue;
}
diff --git a/packages/SystemUI/src/com/android/systemui/screenshot/SaveImageInBackgroundTask.java b/packages/SystemUI/src/com/android/systemui/screenshot/SaveImageInBackgroundTask.java
index 41e468d382a3..50ee1f7ba97a 100644
--- a/packages/SystemUI/src/com/android/systemui/screenshot/SaveImageInBackgroundTask.java
+++ b/packages/SystemUI/src/com/android/systemui/screenshot/SaveImageInBackgroundTask.java
@@ -246,7 +246,9 @@ class SaveImageInBackgroundTask extends AsyncTask<Void, Void, Void> {
new ClipData.Item(uri));
sharingIntent.setClipData(clipdata);
sharingIntent.putExtra(Intent.EXTRA_SUBJECT, subject);
- sharingIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
+ sharingIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
+ .addFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
+
// Make sure pending intents for the system user are still unique across users
// by setting the (otherwise unused) request code to the current user id.
@@ -256,6 +258,7 @@ class SaveImageInBackgroundTask extends AsyncTask<Void, Void, Void> {
.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK)
.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
+
// cancel current pending intent (if any) since clipData isn't used for matching
PendingIntent pendingIntent = PendingIntent.getActivityAsUser(
context, 0, sharingChooserIntent,
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationMediaManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationMediaManager.java
index 7239d0cc361b..1df40915a52c 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationMediaManager.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationMediaManager.java
@@ -102,12 +102,14 @@ public class NotificationMediaManager implements Dumpable {
KeyguardStateController.class);
private final KeyguardBypassController mKeyguardBypassController;
private static final HashSet<Integer> PAUSED_MEDIA_STATES = new HashSet<>();
+ private static final HashSet<Integer> CONNECTING_MEDIA_STATES = new HashSet<>();
static {
PAUSED_MEDIA_STATES.add(PlaybackState.STATE_NONE);
PAUSED_MEDIA_STATES.add(PlaybackState.STATE_STOPPED);
PAUSED_MEDIA_STATES.add(PlaybackState.STATE_PAUSED);
PAUSED_MEDIA_STATES.add(PlaybackState.STATE_ERROR);
- PAUSED_MEDIA_STATES.add(PlaybackState.STATE_CONNECTING);
+ CONNECTING_MEDIA_STATES.add(PlaybackState.STATE_CONNECTING);
+ CONNECTING_MEDIA_STATES.add(PlaybackState.STATE_BUFFERING);
}
private final NotificationVisibilityProvider mVisibilityProvider;
@@ -363,7 +365,17 @@ public class NotificationMediaManager implements Dumpable {
* @return true if playing
*/
public static boolean isPlayingState(int state) {
- return !PAUSED_MEDIA_STATES.contains(state);
+ return !PAUSED_MEDIA_STATES.contains(state)
+ && !CONNECTING_MEDIA_STATES.contains(state);
+ }
+
+ /**
+ * Check if a state should be considered as connecting
+ * @param state a PlaybackState
+ * @return true if connecting or buffering
+ */
+ public static boolean isConnectingState(int state) {
+ return CONNECTING_MEDIA_STATES.contains(state);
}
public void setUpWithPresenter(NotificationPresenter presenter) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackSizeCalculator.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackSizeCalculator.kt
index 6c6ed850f45a..d68f37103510 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackSizeCalculator.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackSizeCalculator.kt
@@ -139,6 +139,8 @@ constructor(
height += spaceNeeded
count += 1
} else {
+ val gapBeforeFirstViewInShelf = current.calculateGapHeight(stack, previous, count)
+ height += gapBeforeFirstViewInShelf
height += shelfHeight
log { "returning height with shelf -> $height" }
return height
@@ -178,7 +180,9 @@ constructor(
if (visibleIndex != 0) {
size += notificationPadding
}
- size += calculateGapHeight(stack, previousView, visibleIndex)
+ val gapHeight = calculateGapHeight(stack, previousView, visibleIndex)
+ log { "\ti=$visibleIndex gapHeight=$gapHeight"}
+ size += gapHeight
return size
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationActivityStarter.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationActivityStarter.java
index 6fe92fafc075..87ca942edff2 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationActivityStarter.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationActivityStarter.java
@@ -489,7 +489,7 @@ class StatusBarNotificationActivityStarter implements NotificationActivityStarte
ExpandableNotificationRow row,
boolean animate,
boolean isActivityIntent) {
- mLogger.logStartNotificationIntent(entry.getKey(), intent);
+ mLogger.logStartNotificationIntent(entry.getKey());
try {
Runnable onFinishAnimationCallback = animate
? () -> mLaunchEventsEmitter.notifyFinishLaunchNotifActivity(entry)
@@ -513,8 +513,10 @@ class StatusBarNotificationActivityStarter implements NotificationActivityStarte
mKeyguardStateController.isShowing(),
eventTime)
: getActivityOptions(mCentralSurfaces.getDisplayId(), adapter);
- return intent.sendAndReturnResult(mContext, 0, fillInIntent, null,
+ int result = intent.sendAndReturnResult(mContext, 0, fillInIntent, null,
null, null, options);
+ mLogger.logSendPendingIntent(entry.getKey(), intent, result);
+ return result;
});
} catch (PendingIntent.CanceledException e) {
// the stack trace isn't very helpful here.
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationActivityStarterLogger.kt b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationActivityStarterLogger.kt
index d118747a0365..2fbe520a4b61 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationActivityStarterLogger.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationActivityStarterLogger.kt
@@ -32,7 +32,7 @@ class StatusBarNotificationActivityStarterLogger @Inject constructor(
buffer.log(TAG, DEBUG, {
str1 = key
}, {
- "(1/4) onNotificationClicked: $str1"
+ "(1/5) onNotificationClicked: $str1"
})
}
@@ -40,7 +40,7 @@ class StatusBarNotificationActivityStarterLogger @Inject constructor(
buffer.log(TAG, DEBUG, {
str1 = key
}, {
- "(2/4) handleNotificationClickAfterKeyguardDismissed: $str1"
+ "(2/5) handleNotificationClickAfterKeyguardDismissed: $str1"
})
}
@@ -48,16 +48,25 @@ class StatusBarNotificationActivityStarterLogger @Inject constructor(
buffer.log(TAG, DEBUG, {
str1 = key
}, {
- "(3/4) handleNotificationClickAfterPanelCollapsed: $str1"
+ "(3/5) handleNotificationClickAfterPanelCollapsed: $str1"
})
}
- fun logStartNotificationIntent(key: String, pendingIntent: PendingIntent) {
+ fun logStartNotificationIntent(key: String) {
+ buffer.log(TAG, INFO, {
+ str1 = key
+ }, {
+ "(4/5) startNotificationIntent: $str1"
+ })
+ }
+
+ fun logSendPendingIntent(key: String, pendingIntent: PendingIntent, result: Int) {
buffer.log(TAG, INFO, {
str1 = key
str2 = pendingIntent.intent.toString()
+ int1 = result
}, {
- "(4/4) Starting $str2 for notification $str1"
+ "(5/5) Started intent $str2 for notification $str1 with result code $int1"
})
}
diff --git a/packages/SystemUI/src/com/android/systemui/wmshell/BubblesManager.java b/packages/SystemUI/src/com/android/systemui/wmshell/BubblesManager.java
index 4d34aa38b3cd..b70220d09749 100644
--- a/packages/SystemUI/src/com/android/systemui/wmshell/BubblesManager.java
+++ b/packages/SystemUI/src/com/android/systemui/wmshell/BubblesManager.java
@@ -576,7 +576,9 @@ public class BubblesManager implements Dumpable {
@Override
public void onEntryRemoved(NotificationEntry entry,
@NotifCollection.CancellationReason int reason) {
- BubblesManager.this.onEntryRemoved(entry);
+ if (reason == REASON_APP_CANCEL || reason == REASON_APP_CANCEL_ALL) {
+ BubblesManager.this.onEntryRemoved(entry);
+ }
}
@Override
diff --git a/packages/SystemUI/tests/src/com/android/systemui/media/MediaDataManagerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/media/MediaDataManagerTest.kt
index b9ff8775f2b8..1921cb624fde 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/media/MediaDataManagerTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/media/MediaDataManagerTest.kt
@@ -726,6 +726,25 @@ class MediaDataManagerTest : SysuiTestCase() {
}
@Test
+ fun testPlaybackActions_connecting() {
+ whenever(mediaFlags.areMediaSessionActionsEnabled(any(), any())).thenReturn(true)
+ val stateActions = PlaybackState.ACTION_PLAY
+ val stateBuilder = PlaybackState.Builder()
+ .setState(PlaybackState.STATE_BUFFERING, 0, 10f)
+ .setActions(stateActions)
+ whenever(controller.playbackState).thenReturn(stateBuilder.build())
+
+ addNotificationAndLoad()
+
+ assertThat(mediaDataCaptor.value!!.semanticActions).isNotNull()
+ val actions = mediaDataCaptor.value!!.semanticActions!!
+
+ assertThat(actions.playOrPause).isNotNull()
+ assertThat(actions.playOrPause!!.contentDescription).isEqualTo(
+ context.getString(R.string.controls_media_button_connecting))
+ }
+
+ @Test
fun testPlaybackActions_reservedSpace() {
val customDesc = arrayOf("custom 1", "custom 2", "custom 3", "custom 4")
whenever(mediaFlags.areMediaSessionActionsEnabled(any(), any())).thenReturn(true)
diff --git a/packages/SystemUI/tests/src/com/android/systemui/media/MediaDeviceManagerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/media/MediaDeviceManagerTest.kt
index e6f48ecd37de..10eeb11faa05 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/media/MediaDeviceManagerTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/media/MediaDeviceManagerTest.kt
@@ -265,20 +265,58 @@ public class MediaDeviceManagerTest : SysuiTestCase() {
}
@Test
- fun onAboutToConnectDeviceChangedWithNonNullParams() {
+ fun onAboutToConnectDeviceAdded_findsDeviceInfoFromAddress() {
manager.onMediaDataLoaded(KEY, null, mediaData)
// Run and reset the executors and listeners so we only focus on new events.
fakeBgExecutor.runAllReady()
fakeFgExecutor.runAllReady()
reset(listener)
+ // Ensure we'll get device info when using the address
+ val fullMediaDevice = mock(MediaDevice::class.java)
+ val address = "fakeAddress"
+ val nameFromDevice = "nameFromDevice"
+ val iconFromDevice = mock(Drawable::class.java)
+ whenever(lmm.getMediaDeviceById(eq(address))).thenReturn(fullMediaDevice)
+ whenever(fullMediaDevice.name).thenReturn(nameFromDevice)
+ whenever(fullMediaDevice.iconWithoutBackground).thenReturn(iconFromDevice)
+
+ // WHEN the about-to-connect device changes to non-null
val deviceCallback = captureCallback()
+ val nameFromParam = "nameFromParam"
+ val iconFromParam = mock(Drawable::class.java)
+ deviceCallback.onAboutToConnectDeviceAdded(address, nameFromParam, iconFromParam)
+ assertThat(fakeFgExecutor.runAllReady()).isEqualTo(1)
+
+ // THEN the about-to-connect device based on the address is returned
+ val data = captureDeviceData(KEY)
+ assertThat(data.enabled).isTrue()
+ assertThat(data.name).isEqualTo(nameFromDevice)
+ assertThat(data.name).isNotEqualTo(nameFromParam)
+ assertThat(data.icon).isEqualTo(iconFromDevice)
+ assertThat(data.icon).isNotEqualTo(iconFromParam)
+ }
+
+ @Test
+ fun onAboutToConnectDeviceAdded_cantFindDeviceInfoFromAddress() {
+ manager.onMediaDataLoaded(KEY, null, mediaData)
+ // Run and reset the executors and listeners so we only focus on new events.
+ fakeBgExecutor.runAllReady()
+ fakeFgExecutor.runAllReady()
+ reset(listener)
+
+ // Ensure we can't get device info based on the address
+ val address = "fakeAddress"
+ whenever(lmm.getMediaDeviceById(eq(address))).thenReturn(null)
+
// WHEN the about-to-connect device changes to non-null
+ val deviceCallback = captureCallback()
val name = "AboutToConnectDeviceName"
val mockIcon = mock(Drawable::class.java)
- deviceCallback.onAboutToConnectDeviceChanged(name, mockIcon)
+ deviceCallback.onAboutToConnectDeviceAdded(address, name, mockIcon)
assertThat(fakeFgExecutor.runAllReady()).isEqualTo(1)
- // THEN the about-to-connect device is returned
+
+ // THEN the about-to-connect device based on the parameters is returned
val data = captureDeviceData(KEY)
assertThat(data.enabled).isTrue()
assertThat(data.name).isEqualTo(name)
@@ -286,21 +324,21 @@ public class MediaDeviceManagerTest : SysuiTestCase() {
}
@Test
- fun onAboutToConnectDeviceChangedWithNullParams() {
+ fun onAboutToConnectDeviceAddedThenRemoved_usesNormalDevice() {
manager.onMediaDataLoaded(KEY, null, mediaData)
fakeBgExecutor.runAllReady()
val deviceCallback = captureCallback()
// First set a non-null about-to-connect device
- deviceCallback.onAboutToConnectDeviceChanged(
- "AboutToConnectDeviceName", mock(Drawable::class.java)
+ deviceCallback.onAboutToConnectDeviceAdded(
+ "fakeAddress", "AboutToConnectDeviceName", mock(Drawable::class.java)
)
// Run and reset the executors and listeners so we only focus on new events.
fakeBgExecutor.runAllReady()
fakeFgExecutor.runAllReady()
reset(listener)
- // WHEN the about-to-connect device changes to null
- deviceCallback.onAboutToConnectDeviceChanged(null, null)
+ // WHEN hasDevice switches to false
+ deviceCallback.onAboutToConnectDeviceRemoved()
assertThat(fakeFgExecutor.runAllReady()).isEqualTo(1)
// THEN the normal device is returned
val data = captureDeviceData(KEY)
diff --git a/packages/SystemUI/tests/src/com/android/systemui/media/muteawait/MediaMuteAwaitConnectionManagerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/media/muteawait/MediaMuteAwaitConnectionManagerTest.kt
index 88c451499d21..27c039dcf29c 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/media/muteawait/MediaMuteAwaitConnectionManagerTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/media/muteawait/MediaMuteAwaitConnectionManagerTest.kt
@@ -24,7 +24,7 @@ import android.media.AudioDeviceAttributes
import android.media.AudioDeviceInfo
import android.media.AudioManager
import android.media.AudioManager.MuteAwaitConnectionCallback.EVENT_CONNECTION
-import android.test.suitebuilder.annotation.SmallTest
+import androidx.test.filters.SmallTest
import com.android.settingslib.media.DeviceIconUtil
import com.android.settingslib.media.LocalMediaManager
import com.android.systemui.R
@@ -95,7 +95,7 @@ class MediaMuteAwaitConnectionManagerTest : SysuiTestCase() {
muteAwaitConnectionManager.startListening()
- verify(localMediaManager, never()).dispatchAboutToConnectDeviceChanged(any(), any())
+ verify(localMediaManager, never()).dispatchAboutToConnectDeviceAdded(any(), any(), any())
}
@Test
@@ -104,7 +104,9 @@ class MediaMuteAwaitConnectionManagerTest : SysuiTestCase() {
muteAwaitConnectionManager.startListening()
- verify(localMediaManager).dispatchAboutToConnectDeviceChanged(eq(DEVICE_NAME), eq(icon))
+ verify(localMediaManager).dispatchAboutToConnectDeviceAdded(
+ eq(DEVICE_ADDRESS), eq(DEVICE_NAME), eq(icon)
+ )
}
@Test
@@ -114,7 +116,7 @@ class MediaMuteAwaitConnectionManagerTest : SysuiTestCase() {
muteAwaitListener.onMutedUntilConnection(DEVICE, intArrayOf(USAGE_UNKNOWN))
- verify(localMediaManager, never()).dispatchAboutToConnectDeviceChanged(any(), any())
+ verify(localMediaManager, never()).dispatchAboutToConnectDeviceAdded(any(), any(), any())
}
@Test
@@ -125,7 +127,9 @@ class MediaMuteAwaitConnectionManagerTest : SysuiTestCase() {
muteAwaitListener.onMutedUntilConnection(DEVICE, intArrayOf(USAGE_MEDIA))
- verify(localMediaManager).dispatchAboutToConnectDeviceChanged(eq(DEVICE_NAME), eq(icon))
+ verify(localMediaManager).dispatchAboutToConnectDeviceAdded(
+ eq(DEVICE_ADDRESS), eq(DEVICE_NAME), eq(icon)
+ )
}
@Test
@@ -135,7 +139,7 @@ class MediaMuteAwaitConnectionManagerTest : SysuiTestCase() {
muteAwaitListener.onUnmutedEvent(EVENT_CONNECTION, DEVICE, intArrayOf(USAGE_MEDIA))
- verify(localMediaManager, never()).dispatchAboutToConnectDeviceChanged(any(), any())
+ verify(localMediaManager, never()).dispatchAboutToConnectDeviceAdded(any(), any(), any())
}
@Test
@@ -155,7 +159,7 @@ class MediaMuteAwaitConnectionManagerTest : SysuiTestCase() {
)
muteAwaitListener.onUnmutedEvent(EVENT_CONNECTION, otherDevice, intArrayOf(USAGE_MEDIA))
- verify(localMediaManager, never()).dispatchAboutToConnectDeviceChanged(any(), any())
+ verify(localMediaManager, never()).dispatchAboutToConnectDeviceAdded(any(), any(), any())
}
@Test
@@ -167,7 +171,7 @@ class MediaMuteAwaitConnectionManagerTest : SysuiTestCase() {
muteAwaitListener.onUnmutedEvent(EVENT_CONNECTION, DEVICE, intArrayOf(USAGE_UNKNOWN))
- verify(localMediaManager, never()).dispatchAboutToConnectDeviceChanged(any(), any())
+ verify(localMediaManager, never()).dispatchAboutToConnectDeviceAdded(any(), any(), any())
}
@Test
@@ -179,7 +183,7 @@ class MediaMuteAwaitConnectionManagerTest : SysuiTestCase() {
muteAwaitListener.onUnmutedEvent(EVENT_CONNECTION, DEVICE, intArrayOf(USAGE_MEDIA))
- verify(localMediaManager).dispatchAboutToConnectDeviceChanged(eq(null), eq(null))
+ verify(localMediaManager).dispatchAboutToConnectDeviceRemoved()
}
private fun getMuteAwaitListener(): AudioManager.MuteAwaitConnectionCallback {
@@ -191,11 +195,12 @@ class MediaMuteAwaitConnectionManagerTest : SysuiTestCase() {
}
}
+private const val DEVICE_ADDRESS = "DeviceAddress"
private const val DEVICE_NAME = "DeviceName"
private val DEVICE = AudioDeviceAttributes(
AudioDeviceAttributes.ROLE_OUTPUT,
AudioDeviceInfo.TYPE_USB_HEADSET,
- "address",
+ DEVICE_ADDRESS,
DEVICE_NAME,
listOf(),
listOf(),
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackSizeCalculatorTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackSizeCalculatorTest.kt
index 9a4e10cec159..497a857d1deb 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackSizeCalculatorTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackSizeCalculatorTest.kt
@@ -22,8 +22,6 @@ import android.view.View.VISIBLE
import androidx.test.filters.SmallTest
import com.android.systemui.R
import com.android.systemui.SysuiTestCase
-import com.android.systemui.statusbar.StatusBarState.KEYGUARD
-import com.android.systemui.statusbar.StatusBarState.SHADE
import com.android.systemui.statusbar.SysuiStatusBarStateController
import com.android.systemui.statusbar.notification.collection.NotificationEntry
import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow
@@ -142,11 +140,13 @@ class NotificationStackSizeCalculatorTest : SysuiTestCase() {
}
@Test
- fun computeHeight_returnsLessThanAvailableSpaceUsedToCalculateMaxNotifications() {
+ fun computeHeight_returnsAtMostSpaceAvailable_withGapBeforeShelf() {
val rowHeight = ROW_HEIGHT
val shelfHeight = SHELF_HEIGHT
val totalSpaceForEachRow = GAP_HEIGHT + rowHeight + NOTIFICATION_PADDING
val availableSpace = totalSpaceForEachRow * 2
+
+ // All rows in separate sections (default setup).
val rows =
listOf(
createMockRow(rowHeight),
@@ -157,6 +157,28 @@ class NotificationStackSizeCalculatorTest : SysuiTestCase() {
assertThat(maxNotifications).isEqualTo(2)
val height = sizeCalculator.computeHeight(stackLayout, maxNotifications, SHELF_HEIGHT)
+ assertThat(height).isAtMost(availableSpace + GAP_HEIGHT + SHELF_HEIGHT)
+ }
+
+ @Test
+ fun computeHeight_returnsAtMostSpaceAvailable_noGapBeforeShelf() {
+ val rowHeight = ROW_HEIGHT
+ val shelfHeight = SHELF_HEIGHT
+ val totalSpaceForEachRow = GAP_HEIGHT + rowHeight + NOTIFICATION_PADDING
+ val availableSpace = totalSpaceForEachRow * 1
+
+ // Both rows are in the same section.
+ whenever(stackLayout.calculateGapHeight(nullable(), nullable(), any()))
+ .thenReturn(0f)
+ val rows =
+ listOf(
+ createMockRow(rowHeight),
+ createMockRow(rowHeight))
+
+ val maxNotifications = computeMaxKeyguardNotifications(rows, availableSpace, shelfHeight)
+ assertThat(maxNotifications).isEqualTo(1)
+
+ val height = sizeCalculator.computeHeight(stackLayout, maxNotifications, SHELF_HEIGHT)
assertThat(height).isAtMost(availableSpace + SHELF_HEIGHT)
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/wmshell/NewNotifPipelineBubblesTest.java b/packages/SystemUI/tests/src/com/android/systemui/wmshell/NewNotifPipelineBubblesTest.java
index 40657fb61412..ce7924a2a4a2 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/wmshell/NewNotifPipelineBubblesTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/wmshell/NewNotifPipelineBubblesTest.java
@@ -807,7 +807,7 @@ public class NewNotifPipelineBubblesTest extends SysuiTestCase {
assertTrue(mBubbleController.hasBubbles());
// Removes the notification
- mEntryListener.onEntryRemoved(mRow, 0);
+ mEntryListener.onEntryRemoved(mRow, REASON_APP_CANCEL);
assertFalse(mBubbleController.hasBubbles());
}
@@ -938,7 +938,7 @@ public class NewNotifPipelineBubblesTest extends SysuiTestCase {
mBubblesManager.handleDismissalInterception(groupSummary.getEntry());
// WHEN the summary is cancelled by the app
- mEntryListener.onEntryRemoved(groupSummary.getEntry(), 0);
+ mEntryListener.onEntryRemoved(groupSummary.getEntry(), REASON_APP_CANCEL);
// THEN the summary and its children are removed from bubble data
assertFalse(mBubbleData.hasBubbleInStackWithKey(groupedBubble.getEntry().getKey()));
diff --git a/services/backup/backuplib/java/com/android/server/backup/transport/BackupTransportClient.java b/services/backup/backuplib/java/com/android/server/backup/transport/BackupTransportClient.java
index 7e3ede15aa04..d75d6484bec3 100644
--- a/services/backup/backuplib/java/com/android/server/backup/transport/BackupTransportClient.java
+++ b/services/backup/backuplib/java/com/android/server/backup/transport/BackupTransportClient.java
@@ -34,6 +34,7 @@ import java.util.HashSet;
import java.util.List;
import java.util.Queue;
import java.util.Set;
+import java.util.concurrent.CancellationException;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
@@ -374,7 +375,8 @@ public class BackupTransportClient {
private <T> T getFutureResult(AndroidFuture<T> future) {
try {
return future.get(600, TimeUnit.SECONDS);
- } catch (InterruptedException | ExecutionException | TimeoutException e) {
+ } catch (InterruptedException | ExecutionException | TimeoutException
+ | CancellationException e) {
Slog.w(TAG, "Failed to get result from transport:", e);
return null;
} finally {
@@ -403,7 +405,11 @@ public class BackupTransportClient {
void cancelActiveFutures() {
synchronized (mActiveFuturesLock) {
for (AndroidFuture<?> future : mActiveFutures) {
- future.cancel(true);
+ try {
+ future.cancel(true);
+ } catch (CancellationException ignored) {
+ // This is expected, so ignore the exception.
+ }
}
mActiveFutures.clear();
}
diff --git a/services/core/Android.bp b/services/core/Android.bp
index 5406f711b73d..89c8ca567dd9 100644
--- a/services/core/Android.bp
+++ b/services/core/Android.bp
@@ -120,7 +120,6 @@ java_library_static {
"java/com/android/server/am/EventLogTags.logtags",
"java/com/android/server/wm/EventLogTags.logtags",
"java/com/android/server/policy/EventLogTags.logtags",
- ":services.connectivity-tiramisu-sources",
],
libs: [
@@ -174,9 +173,6 @@ java_library_static {
"overlayable_policy_aidl-java",
"SurfaceFlingerProperties",
"com.android.sysprop.watchdog",
- // This is used for services.connectivity-tiramisu-sources.
- // TODO: delete when NetworkStatsService is moved to the mainline module.
- "net-utils-device-common-bpf",
],
javac_shard_size: 50,
}
diff --git a/services/core/java/com/android/server/audio/SpatializerHelper.java b/services/core/java/com/android/server/audio/SpatializerHelper.java
index d22a562651dc..04fcda7835fa 100644
--- a/services/core/java/com/android/server/audio/SpatializerHelper.java
+++ b/services/core/java/com/android/server/audio/SpatializerHelper.java
@@ -327,15 +327,29 @@ public class SpatializerHelper {
setDispatchAvailableState(false);
}
- if (able && enabledAvailable.first) {
+ boolean enabled = able && enabledAvailable.first;
+ if (enabled) {
loglogi("Enabling Spatial Audio since enabled for media device:"
+ ROUTING_DEVICES[0]);
} else {
loglogi("Disabling Spatial Audio since disabled for media device:"
+ ROUTING_DEVICES[0]);
}
- setDispatchFeatureEnabledState(able && enabledAvailable.first,
- "onRoutingUpdated");
+ if (mSpat != null) {
+ byte level = enabled ? (byte) Spatializer.SPATIALIZER_IMMERSIVE_LEVEL_MULTICHANNEL
+ : (byte) Spatializer.SPATIALIZER_IMMERSIVE_LEVEL_NONE;
+ loglogi("Setting spatialization level to: " + level);
+ try {
+ mSpat.setLevel(level);
+ } catch (RemoteException e) {
+ Log.e(TAG, "Can't set spatializer level", e);
+ mState = STATE_NOT_SUPPORTED;
+ mCapableSpatLevel = Spatializer.SPATIALIZER_IMMERSIVE_LEVEL_NONE;
+ enabled = false;
+ }
+ }
+
+ setDispatchFeatureEnabledState(enabled, "onRoutingUpdated");
if (mDesiredHeadTrackingMode != Spatializer.HEAD_TRACKING_MODE_UNSUPPORTED
&& mDesiredHeadTrackingMode != Spatializer.HEAD_TRACKING_MODE_DISABLED) {
@@ -635,7 +649,6 @@ public class SpatializerHelper {
init(true);
}
setSpatializerEnabledInt(true);
- onRoutingUpdated();
} else {
setSpatializerEnabledInt(false);
}
@@ -657,6 +670,7 @@ public class SpatializerHelper {
case STATE_DISABLED_AVAILABLE:
if (enabled) {
createSpat();
+ onRoutingUpdated();
break;
} else {
// already in disabled state
@@ -823,14 +837,13 @@ public class SpatializerHelper {
mSpatHeadTrackingCallback = new SpatializerHeadTrackingCallback();
mSpat = AudioSystem.getSpatializer(mSpatCallback);
try {
- mSpat.setLevel((byte) Spatializer.SPATIALIZER_IMMERSIVE_LEVEL_MULTICHANNEL);
mIsHeadTrackingSupported = mSpat.isHeadTrackingSupported();
//TODO: register heatracking callback only when sensors are registered
if (mIsHeadTrackingSupported) {
mSpat.registerHeadTrackingCallback(mSpatHeadTrackingCallback);
}
} catch (RemoteException e) {
- Log.e(TAG, "Can't set spatializer level", e);
+ Log.e(TAG, "Can't configure head tracking", e);
mState = STATE_NOT_SUPPORTED;
mCapableSpatLevel = Spatializer.SPATIALIZER_IMMERSIVE_LEVEL_NONE;
}
diff --git a/services/core/java/com/android/server/display/DisplayManagerService.java b/services/core/java/com/android/server/display/DisplayManagerService.java
index 5a105f551ab2..5fcdc8a08b5d 100644
--- a/services/core/java/com/android/server/display/DisplayManagerService.java
+++ b/services/core/java/com/android/server/display/DisplayManagerService.java
@@ -70,6 +70,8 @@ import android.hardware.display.DisplayManagerGlobal;
import android.hardware.display.DisplayManagerInternal;
import android.hardware.display.DisplayManagerInternal.DisplayGroupListener;
import android.hardware.display.DisplayManagerInternal.DisplayTransactionListener;
+import android.hardware.display.DisplayManagerInternal.RefreshRateLimitation;
+import android.hardware.display.DisplayManagerInternal.RefreshRateRange;
import android.hardware.display.DisplayViewport;
import android.hardware.display.DisplayedContentSample;
import android.hardware.display.DisplayedContentSamplingAttributes;
@@ -708,9 +710,6 @@ public final class DisplayManagerService extends SystemService {
synchronized (mSyncRoot) {
final LogicalDisplay display = mLogicalDisplayMapper.getDisplayLocked(displayId);
if (display != null) {
- // Do not let constrain be overwritten by override from WindowManager.
- info.shouldConstrainMetricsForLauncher =
- display.getDisplayInfoLocked().shouldConstrainMetricsForLauncher;
if (display.setDisplayInfoOverrideFromWindowManagerLocked(info)) {
handleLogicalDisplayChangedLocked(display);
}
@@ -2212,21 +2211,6 @@ public final class DisplayManagerService extends SystemService {
}
}
- void setShouldConstrainMetricsForLauncher(boolean constrain) {
- // Apply constrain for every display.
- synchronized (mSyncRoot) {
- int[] displayIds = mLogicalDisplayMapper.getDisplayIdsLocked(Process.myUid());
- for (int i : displayIds) {
- final LogicalDisplay display = mLogicalDisplayMapper.getDisplayLocked(i);
- if (display == null) {
- return;
- }
- display.getDisplayInfoLocked().shouldConstrainMetricsForLauncher = constrain;
- setDisplayInfoOverrideFromWindowManagerInternal(i, display.getDisplayInfoLocked());
- }
- }
- }
-
void setDockedAndIdleEnabled(boolean enabled, int displayId) {
synchronized (mSyncRoot) {
final DisplayPowerController displayPowerController = mDisplayPowerControllers.get(
diff --git a/services/core/java/com/android/server/display/DisplayManagerShellCommand.java b/services/core/java/com/android/server/display/DisplayManagerShellCommand.java
index bfdac5781b75..7dce2380407e 100644
--- a/services/core/java/com/android/server/display/DisplayManagerShellCommand.java
+++ b/services/core/java/com/android/server/display/DisplayManagerShellCommand.java
@@ -60,8 +60,6 @@ class DisplayManagerShellCommand extends ShellCommand {
return setDisplayModeDirectorLoggingEnabled(false);
case "dwb-set-cct":
return setAmbientColorTemperatureOverride();
- case "constrain-launcher-metrics":
- return setConstrainLauncherMetrics();
case "set-user-preferred-display-mode":
return setUserPreferredDisplayMode();
case "clear-user-preferred-display-mode":
@@ -112,9 +110,6 @@ class DisplayManagerShellCommand extends ShellCommand {
pw.println(" Disable display mode director logging.");
pw.println(" dwb-set-cct CCT");
pw.println(" Sets the ambient color temperature override to CCT (use -1 to disable).");
- pw.println(" constrain-launcher-metrics [true|false]");
- pw.println(" Sets if Display#getRealSize and getRealMetrics should be constrained for ");
- pw.println(" Launcher.");
pw.println(" set-user-preferred-display-mode WIDTH HEIGHT REFRESH-RATE "
+ "DISPLAY_ID (optional)");
pw.println(" Sets the user preferred display mode which has fields WIDTH, HEIGHT and "
@@ -205,17 +200,6 @@ class DisplayManagerShellCommand extends ShellCommand {
return 0;
}
- private int setConstrainLauncherMetrics() {
- String constrainText = getNextArg();
- if (constrainText == null) {
- getErrPrintWriter().println("Error: no value specified");
- return 1;
- }
- boolean constrain = Boolean.parseBoolean(constrainText);
- mService.setShouldConstrainMetricsForLauncher(constrain);
- return 0;
- }
-
private int setUserPreferredDisplayMode() {
final String widthText = getNextArg();
if (widthText == null) {
diff --git a/services/core/java/com/android/server/display/LogicalDisplay.java b/services/core/java/com/android/server/display/LogicalDisplay.java
index b7ad4ed4f98d..a640497d7e10 100644
--- a/services/core/java/com/android/server/display/LogicalDisplay.java
+++ b/services/core/java/com/android/server/display/LogicalDisplay.java
@@ -233,8 +233,6 @@ final class LogicalDisplay {
info.displayCutout = mOverrideDisplayInfo.displayCutout;
info.logicalDensityDpi = mOverrideDisplayInfo.logicalDensityDpi;
info.roundedCorners = mOverrideDisplayInfo.roundedCorners;
- info.shouldConstrainMetricsForLauncher =
- mOverrideDisplayInfo.shouldConstrainMetricsForLauncher;
}
mInfo.set(info);
}
diff --git a/services/core/java/com/android/server/locales/LocaleManagerService.java b/services/core/java/com/android/server/locales/LocaleManagerService.java
index 9ef14cc38993..fc7be7ff8d1c 100644
--- a/services/core/java/com/android/server/locales/LocaleManagerService.java
+++ b/services/core/java/com/android/server/locales/LocaleManagerService.java
@@ -186,7 +186,7 @@ public class LocaleManagerService extends SystemService {
userId = mActivityManagerInternal.handleIncomingUser(
Binder.getCallingPid(), Binder.getCallingUid(), userId,
false /* allowAll */, ActivityManagerInternal.ALLOW_NON_FULL,
- "setApplicationLocales", appPackageName);
+ "setApplicationLocales", /* callerPackage= */ null);
// This function handles two types of set operations:
// 1.) A normal, non-privileged app setting its own locale.
@@ -355,7 +355,7 @@ public class LocaleManagerService extends SystemService {
userId = mActivityManagerInternal.handleIncomingUser(
Binder.getCallingPid(), Binder.getCallingUid(), userId,
false /* allowAll */, ActivityManagerInternal.ALLOW_NON_FULL,
- "getApplicationLocales", appPackageName);
+ "getApplicationLocales", /* callerPackage= */ null);
// This function handles three types of query operations:
// 1.) A normal, non-privileged app querying its own locale.
diff --git a/services/core/java/com/android/server/pm/UserManagerService.java b/services/core/java/com/android/server/pm/UserManagerService.java
index d340561c2862..ee0fdc07f841 100644
--- a/services/core/java/com/android/server/pm/UserManagerService.java
+++ b/services/core/java/com/android/server/pm/UserManagerService.java
@@ -5413,190 +5413,170 @@ public class UserManagerService extends IUserManager.Stub {
(new Shell()).exec(this, in, out, err, args, callback, resultReceiver);
}
- private static final String PREFIX_HELP_COMMAND = " ";
- private static final String PREFIX_HELP_DESCRIPTION = " ";
- private static final String PREFIX_HELP_DESCRIPTION_EXTRA_LINES = " ";
-
- private static final String CMD_HELP = "help";
- private static final String CMD_LIST = "list";
- private static final String CMD_REPORT_SYSTEM_USER_PACKAGE_ALLOWLIST_PROBLEMS =
- "report-system-user-package-whitelist-problems";
-
- private static final String ARG_V = "-v";
- private static final String ARG_VERBOSE = "--verbose";
- private static final String ARG_ALL = "--all";
- private static final String ARG_CRITICAL_ONLY = "--critical-only";
- private static final String ARG_MODE = "--mode";
-
private final class Shell extends ShellCommand {
- @Override
- public void onHelp() {
- final PrintWriter pw = getOutPrintWriter();
- pw.printf("User manager (user) commands:\n");
-
- pw.printf("%s%s\n", PREFIX_HELP_COMMAND, CMD_HELP);
- pw.printf("%sPrints this help text.\n\n", PREFIX_HELP_DESCRIPTION);
-
- pw.printf("%s%s [%s] [%s]\n", PREFIX_HELP_COMMAND, CMD_LIST, ARG_V, ARG_ALL);
- pw.printf("%sPrints all users on the system.\n\n", PREFIX_HELP_DESCRIPTION);
-
- pw.printf("%s%s [%s | %s] [%s] [%s MODE]\n", PREFIX_HELP_COMMAND,
- CMD_REPORT_SYSTEM_USER_PACKAGE_ALLOWLIST_PROBLEMS,
- ARG_V, ARG_VERBOSE, ARG_CRITICAL_ONLY, ARG_MODE);
-
- pw.printf("%sReports all issues on user-type package allowlist XML files. Options:\n",
- PREFIX_HELP_DESCRIPTION);
- pw.printf("%s%s | %s: shows extra info, like number of issues\n",
- PREFIX_HELP_DESCRIPTION, ARG_V, ARG_VERBOSE);
- pw.printf("%s%s: show only critical issues, excluding warnings\n",
- PREFIX_HELP_DESCRIPTION, ARG_CRITICAL_ONLY);
- pw.printf("%s%s MODE: shows what errors would be if device used mode MODE\n"
- + "%s(where MODE is the allowlist mode integer as defined by "
- + "config_userTypePackageWhitelistMode)\n\n",
- PREFIX_HELP_DESCRIPTION, ARG_MODE, PREFIX_HELP_DESCRIPTION_EXTRA_LINES);
- }
-
- @Override
- public int onCommand(String cmd) {
- if (cmd == null) {
- return handleDefaultCommands(cmd);
+ @Override
+ public void onHelp() {
+ final PrintWriter pw = getOutPrintWriter();
+ pw.println("User manager (user) commands:");
+ pw.println(" help");
+ pw.println(" Prints this help text.");
+ pw.println();
+ pw.println(" list [-v | --verbose] [--all]");
+ pw.println(" Prints all users on the system.");
+ pw.println();
+ pw.println(" report-system-user-package-whitelist-problems [-v | --verbose] "
+ + "[--critical-only] [--mode MODE]");
+ pw.println(" Reports all issues on user-type package allowlist XML files. Options:");
+ pw.println(" -v | --verbose: shows extra info, like number of issues");
+ pw.println(" --critical-only: show only critical issues, excluding warnings");
+ pw.println(" --mode MODE: shows what errors would be if device used mode MODE");
+ pw.println(" (where MODE is the allowlist mode integer as defined by "
+ + "config_userTypePackageWhitelistMode)");
}
- try {
- switch(cmd) {
- case CMD_LIST:
- return runList();
- case CMD_REPORT_SYSTEM_USER_PACKAGE_ALLOWLIST_PROBLEMS:
- return runReportPackageAllowlistProblems();
- default:
- return handleDefaultCommands(cmd);
+ @Override
+ public int onCommand(String cmd) {
+ if (cmd == null) {
+ return handleDefaultCommands(cmd);
}
- } catch (RemoteException e) {
- getOutPrintWriter().println("Remote exception: " + e);
+
+ try {
+ switch(cmd) {
+ case "list":
+ return runList();
+ case "report-system-user-package-whitelist-problems":
+ return runReportPackageAllowlistProblems();
+ default:
+ return handleDefaultCommands(cmd);
+ }
+ } catch (RemoteException e) {
+ getOutPrintWriter().println("Remote exception: " + e);
+ }
+ return -1;
}
- return -1;
- }
- private int runList() throws RemoteException {
- final PrintWriter pw = getOutPrintWriter();
- boolean all = false;
- boolean verbose = false;
- String opt;
- while ((opt = getNextOption()) != null) {
- switch (opt) {
- case ARG_V:
- verbose = true;
- break;
- case ARG_ALL:
- all = true;
- break;
- default:
- pw.println("Invalid option: " + opt);
- return -1;
- }
- }
- final IActivityManager am = ActivityManager.getService();
- final List<UserInfo> users = getUsers(/* excludePartial= */ !all,
- /* excludingDying=*/ false, /* excludePreCreated= */ !all);
- if (users == null) {
- pw.println("Error: couldn't get users");
- return 1;
- } else {
- final int size = users.size();
- int currentUser = UserHandle.USER_NULL;
- if (verbose) {
- pw.printf("%d users:\n\n", size);
- currentUser = am.getCurrentUser().id;
- } else {
- // NOTE: the standard "list users" command is used by integration tests and
- // hence should not be changed. If you need to add more info, use the
- // verbose option.
- pw.println("Users:");
+ private int runList() throws RemoteException {
+ final PrintWriter pw = getOutPrintWriter();
+ boolean all = false;
+ boolean verbose = false;
+ String opt;
+ while ((opt = getNextOption()) != null) {
+ switch (opt) {
+ case "-v":
+ case "--verbose":
+ verbose = true;
+ break;
+ case "--all":
+ all = true;
+ break;
+ default:
+ pw.println("Invalid option: " + opt);
+ return -1;
+ }
}
- for (int i = 0; i < size; i++) {
- final UserInfo user = users.get(i);
- final boolean running = am.isUserRunning(user.id, 0);
- final boolean current = user.id == currentUser;
- final boolean hasParent = user.profileGroupId != user.id
- && user.profileGroupId != UserInfo.NO_PROFILE_GROUP_ID;
+ final IActivityManager am = ActivityManager.getService();
+ final List<UserInfo> users = getUsers(/* excludePartial= */ !all,
+ /* excludeDying= */ false, /* excludePreCreated= */ !all);
+ if (users == null) {
+ pw.println("Error: couldn't get users");
+ return 1;
+ } else {
+ final int size = users.size();
+ int currentUser = UserHandle.USER_NULL;
if (verbose) {
- final DevicePolicyManagerInternal dpm = getDevicePolicyManagerInternal();
- String deviceOwner = "";
- String profileOwner = "";
- if (dpm != null) {
- final long ident = Binder.clearCallingIdentity();
- // NOTE: dpm methods below CANNOT be called while holding the mUsersLock
- try {
- if (dpm.getDeviceOwnerUserId() == user.id) {
- deviceOwner = " (device-owner)";
- }
- if (dpm.getProfileOwnerAsUser(user.id) != null) {
- profileOwner = " (profile-owner)";
- }
- } finally {
- Binder.restoreCallingIdentity(ident);
- }
- }
- pw.printf("%d: id=%d, name=%s, type=%s, flags=%s%s%s%s%s%s%s%s%s\n",
- i,
- user.id,
- user.name,
- user.userType.replace("android.os.usertype.", ""),
- UserInfo.flagsToString(user.flags),
- hasParent ? " (parentId=" + user.profileGroupId + ")" : "",
- running ? " (running)" : "",
- user.partial ? " (partial)" : "",
- user.preCreated ? " (pre-created)" : "",
- user.convertedFromPreCreated ? " (converted)" : "",
- deviceOwner, profileOwner,
- current ? " (current)" : "");
+ pw.printf("%d users:\n\n", size);
+ currentUser = am.getCurrentUser().id;
} else {
// NOTE: the standard "list users" command is used by integration tests and
// hence should not be changed. If you need to add more info, use the
// verbose option.
- pw.printf("\t%s%s\n", user, running ? " running" : "");
+ pw.println("Users:");
}
+ for (int i = 0; i < size; i++) {
+ final UserInfo user = users.get(i);
+ final boolean running = am.isUserRunning(user.id, 0);
+ final boolean current = user.id == currentUser;
+ final boolean hasParent = user.profileGroupId != user.id
+ && user.profileGroupId != UserInfo.NO_PROFILE_GROUP_ID;
+ if (verbose) {
+ final DevicePolicyManagerInternal dpm = getDevicePolicyManagerInternal();
+ String deviceOwner = "";
+ String profileOwner = "";
+ if (dpm != null) {
+ final long ident = Binder.clearCallingIdentity();
+ // NOTE: dpm methods below CANNOT be called while holding the mUsersLock
+ try {
+ if (dpm.getDeviceOwnerUserId() == user.id) {
+ deviceOwner = " (device-owner)";
+ }
+ if (dpm.getProfileOwnerAsUser(user.id) != null) {
+ profileOwner = " (profile-owner)";
+ }
+ } finally {
+ Binder.restoreCallingIdentity(ident);
+ }
+ }
+ pw.printf("%d: id=%d, name=%s, type=%s, flags=%s%s%s%s%s%s%s%s%s\n",
+ i,
+ user.id,
+ user.name,
+ user.userType.replace("android.os.usertype.", ""),
+ UserInfo.flagsToString(user.flags),
+ hasParent ? " (parentId=" + user.profileGroupId + ")" : "",
+ running ? " (running)" : "",
+ user.partial ? " (partial)" : "",
+ user.preCreated ? " (pre-created)" : "",
+ user.convertedFromPreCreated ? " (converted)" : "",
+ deviceOwner, profileOwner,
+ current ? " (current)" : "");
+ } else {
+ // NOTE: the standard "list users" command is used by integration tests and
+ // hence should not be changed. If you need to add more info, use the
+ // verbose option.
+ pw.printf("\t%s%s\n", user, running ? " running" : "");
+ }
+ }
+ return 0;
}
- return 0;
}
- }
- private int runReportPackageAllowlistProblems() {
- final PrintWriter pw = getOutPrintWriter();
- boolean verbose = false;
- boolean criticalOnly = false;
- int mode = UserSystemPackageInstaller.USER_TYPE_PACKAGE_WHITELIST_MODE_NONE;
- String opt;
- while ((opt = getNextOption()) != null) {
- switch (opt) {
- case ARG_V:
- case ARG_VERBOSE:
- verbose = true;
- break;
- case ARG_CRITICAL_ONLY:
- criticalOnly = true;
- break;
- case ARG_MODE:
- mode = Integer.parseInt(getNextArgRequired());
- break;
- default:
- pw.println("Invalid option: " + opt);
- return -1;
+ private int runReportPackageAllowlistProblems() {
+ final PrintWriter pw = getOutPrintWriter();
+ boolean verbose = false;
+ boolean criticalOnly = false;
+ int mode = UserSystemPackageInstaller.USER_TYPE_PACKAGE_WHITELIST_MODE_NONE;
+ String opt;
+ while ((opt = getNextOption()) != null) {
+ switch (opt) {
+ case "-v":
+ case "--verbose":
+ verbose = true;
+ break;
+ case "--critical-only":
+ criticalOnly = true;
+ break;
+ case "--mode":
+ mode = Integer.parseInt(getNextArgRequired());
+ break;
+ default:
+ pw.println("Invalid option: " + opt);
+ return -1;
+ }
}
- }
- Slog.d(LOG_TAG, "runReportPackageAllowlistProblems(): verbose=" + verbose
- + ", criticalOnly=" + criticalOnly
- + ", mode=" + UserSystemPackageInstaller.modeToString(mode));
+ Slog.d(LOG_TAG, "runReportPackageAllowlistProblems(): verbose=" + verbose
+ + ", criticalOnly=" + criticalOnly
+ + ", mode=" + UserSystemPackageInstaller.modeToString(mode));
- try (IndentingPrintWriter ipw = new IndentingPrintWriter(pw, " ")) {
- mSystemPackageInstaller.dumpPackageWhitelistProblems(ipw, mode, verbose,
- criticalOnly);
+ try (IndentingPrintWriter ipw = new IndentingPrintWriter(pw, " ")) {
+ mSystemPackageInstaller.dumpPackageWhitelistProblems(ipw, mode, verbose,
+ criticalOnly);
+ }
+ return 0;
}
- return 0;
- }
- }
+
+ } // class Shell
@Override
protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
diff --git a/services/core/java/com/android/server/policy/AppOpsPolicy.java b/services/core/java/com/android/server/policy/AppOpsPolicy.java
index 70d69c663572..e157a277366f 100644
--- a/services/core/java/com/android/server/policy/AppOpsPolicy.java
+++ b/services/core/java/com/android/server/policy/AppOpsPolicy.java
@@ -187,8 +187,12 @@ public final class AppOpsPolicy implements AppOpsManagerInternal.CheckOpsDelegat
initializeActivityRecognizersTags();
- // If this device does not have telephony, restrict the phone call ops
- if (!mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
+ // Restrict phone call ops if the TelecomService will not start (conditioned on having
+ // FEATURE_MICROPHONE, FEATURE_TELECOM, or FEATURE_TELEPHONY).
+ PackageManager pm = mContext.getPackageManager();
+ if (!pm.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)
+ && !pm.hasSystemFeature(PackageManager.FEATURE_MICROPHONE)
+ && !pm.hasSystemFeature(PackageManager.FEATURE_TELECOM)) {
AppOpsManager appOps = mContext.getSystemService(AppOpsManager.class);
appOps.setUserRestrictionForUser(AppOpsManager.OP_PHONE_CALL_MICROPHONE, true, mToken,
null, UserHandle.USER_ALL);
diff --git a/services/core/java/com/android/server/wm/ActivityTaskSupervisor.java b/services/core/java/com/android/server/wm/ActivityTaskSupervisor.java
index eb5ca9c2f43b..95de040551b1 100644
--- a/services/core/java/com/android/server/wm/ActivityTaskSupervisor.java
+++ b/services/core/java/com/android/server/wm/ActivityTaskSupervisor.java
@@ -897,6 +897,7 @@ public class ActivityTaskSupervisor implements RecentTasks.Callbacks {
proc.getThread(), r.token);
final boolean isTransitionForward = r.isTransitionForward();
+ final IBinder fragmentToken = r.getTaskFragment().getFragmentToken();
clientTransaction.addCallback(LaunchActivityItem.obtain(new Intent(r.intent),
System.identityHashCode(r), r.info,
// TODO: Have this take the merged configuration instead of separate global
@@ -907,7 +908,7 @@ public class ActivityTaskSupervisor implements RecentTasks.Callbacks {
proc.getReportedProcState(), r.getSavedState(), r.getPersistentSavedState(),
results, newIntents, r.takeOptions(), isTransitionForward,
proc.createProfilerInfoIfNeeded(), r.assistToken, activityClientController,
- r.shareableActivityToken, r.getLaunchedFromBubble()));
+ r.shareableActivityToken, r.getLaunchedFromBubble(), fragmentToken));
// Set desired final state.
final ActivityLifecycleItem lifecycleItem;
diff --git a/services/core/java/com/android/server/wm/TaskFragment.java b/services/core/java/com/android/server/wm/TaskFragment.java
index 3a458fdc75bb..900963e29bd6 100644
--- a/services/core/java/com/android/server/wm/TaskFragment.java
+++ b/services/core/java/com/android/server/wm/TaskFragment.java
@@ -2262,7 +2262,7 @@ class TaskFragment extends WindowContainer<WindowContainer> {
mFragmentToken,
mRemoteToken.toWindowContainerToken(),
getConfiguration(),
- getChildCount() == 0,
+ runningActivityCount[0] == 0,
runningActivityCount[0],
isVisible(),
childActivities,
diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java
index 8546e8002602..51d68bc0177a 100644
--- a/services/core/java/com/android/server/wm/WindowState.java
+++ b/services/core/java/com/android/server/wm/WindowState.java
@@ -6125,14 +6125,21 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
applyHere = true;
}
- for (int i = mDrawHandlers.size() - 1; i >= 0; i--) {
- DrawHandler h = mDrawHandlers.get(i);
+ final List<DrawHandler> handlersToRemove = new ArrayList<>();
+ // Iterate forwards to ensure we process in the same order
+ // we added.
+ for (int i = 0; i < mDrawHandlers.size(); i++) {
+ final DrawHandler h = mDrawHandlers.get(i);
if (h.mSeqId <= seqId) {
h.mConsumer.accept(t);
- mDrawHandlers.remove(h);
+ handlersToRemove.add(h);
hadHandlers = true;
}
}
+ for (int i = 0; i < handlersToRemove.size(); i++) {
+ final DrawHandler h = handlersToRemove.get(i);
+ mDrawHandlers.remove(h);
+ }
if (hadHandlers) {
mWmService.mH.removeMessages(WINDOW_STATE_BLAST_SYNC_TIMEOUT, this);
diff --git a/services/devicepolicy/TEST_MAPPING b/services/devicepolicy/TEST_MAPPING
index 3d86cf30f38e..72bba11c5366 100644
--- a/services/devicepolicy/TEST_MAPPING
+++ b/services/devicepolicy/TEST_MAPPING
@@ -16,5 +16,15 @@
{
"name": "CtsDevicePolicyManagerTestCases"
}
+ ],
+ "presubmit": [
+ {
+ "name": "CtsDevicePolicyManagerTestCases",
+ "options": [
+ {
+ "include-filter": "com.android.cts.devicepolicy.ManagedProfileTest#testParentProfileApiDisabled"
+ }
+ ]
+ }
]
}
diff --git a/services/tests/servicestests/src/com/android/server/backup/transport/BackupTransportClientTest.java b/services/tests/servicestests/src/com/android/server/backup/transport/BackupTransportClientTest.java
index b154d6f6db0c..1171518130cc 100644
--- a/services/tests/servicestests/src/com/android/server/backup/transport/BackupTransportClientTest.java
+++ b/services/tests/servicestests/src/com/android/server/backup/transport/BackupTransportClientTest.java
@@ -110,10 +110,7 @@ public class BackupTransportClientTest {
Thread thread = new Thread(() -> {
try {
- /*String name =*/ client.transportDirName();
- fail("transportDirName should be cancelled");
- } catch (CancellationException ex) {
- // This is expected.
+ assertThat(client.transportDirName()).isNull();
} catch (Exception ex) {
fail("unexpected Exception: " + ex.getClass().getCanonicalName());
}
@@ -189,7 +186,7 @@ public class BackupTransportClientTest {
}
@Test
- public void testFinishBackup_canceledBeforeCompletion_throwsException() throws Exception {
+ public void testFinishBackup_canceledBeforeCompletion_returnsError() throws Exception {
TestCallbacksFakeTransportBinder binder = new TestCallbacksFakeTransportBinder();
BackupTransportClient client = new BackupTransportClient(binder);