Skip to content

Commit f39743e

Browse files
author
Android Build Coastguard Worker
committed
Merge cherrypicks of ['googleplex-android-review.googlesource.com/22624779', 'googleplex-android-review.googlesource.com/22648361', 'googleplex-android-review.googlesource.com/22650441'] into tm-qpr3-release.
Change-Id: I35b4aed63370cadfdfe76b42a48eaff100bb5ab4
2 parents d4aa0f6 + 6c52d0e commit f39743e

4 files changed

Lines changed: 56 additions & 6 deletions

File tree

libs/WindowManager/Shell/src/com/android/wm/shell/common/split/SplitDecorManager.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,10 @@ public void release(SurfaceControl.Transaction t) {
164164
t.remove(mGapBackgroundLeash);
165165
mGapBackgroundLeash = null;
166166
}
167+
if (mScreenshot != null) {
168+
t.remove(mScreenshot);
169+
mScreenshot = null;
170+
}
167171
mHostLeash = null;
168172
mIcon = null;
169173
mResizingIconView = null;
@@ -323,6 +327,8 @@ public void screenshotIfNeeded(SurfaceControl.Transaction t) {
323327
if (!mShown && mIsResizing && !mOldBounds.equals(mResizingBounds)) {
324328
if (mScreenshotAnimator != null && mScreenshotAnimator.isRunning()) {
325329
mScreenshotAnimator.cancel();
330+
} else if (mScreenshot != null) {
331+
t.remove(mScreenshot);
326332
}
327333

328334
mTempRect.set(mOldBounds);
@@ -339,6 +345,8 @@ public void setScreenshotIfNeeded(SurfaceControl screenshot, SurfaceControl.Tran
339345
if (!mShown && mIsResizing && !mOldBounds.equals(mResizingBounds)) {
340346
if (mScreenshotAnimator != null && mScreenshotAnimator.isRunning()) {
341347
mScreenshotAnimator.cancel();
348+
} else if (mScreenshot != null) {
349+
t.remove(mScreenshot);
342350
}
343351

344352
mScreenshot = screenshot;

packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/OccludedToLockscreenTransitionViewModel.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ constructor(
4747
duration = TO_LOCKSCREEN_DURATION,
4848
onStep = { value -> -translatePx + value * translatePx },
4949
interpolator = EMPHASIZED_DECELERATE,
50+
onCancel = { 0f },
5051
)
5152
}
5253

packages/SystemUI/tests/src/com/android/systemui/keyguard/ui/viewmodel/OccludedToLockscreenTransitionViewModelTest.kt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,21 @@ class OccludedToLockscreenTransitionViewModelTest : SysuiTestCase() {
9292
job.cancel()
9393
}
9494

95+
@Test
96+
fun lockscreenTranslationYResettedAfterJobCancelled() =
97+
runTest(UnconfinedTestDispatcher()) {
98+
val values = mutableListOf<Float>()
99+
100+
val pixels = 100
101+
val job =
102+
underTest.lockscreenTranslationY(pixels).onEach { values.add(it) }.launchIn(this)
103+
repository.sendTransitionStep(step(0.5f, TransitionState.CANCELED))
104+
105+
assertThat(values.last()).isEqualTo(0f)
106+
107+
job.cancel()
108+
}
109+
95110
private fun step(
96111
value: Float,
97112
state: TransitionState = TransitionState.RUNNING

services/core/java/com/android/server/audio/AudioService.java

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2251,8 +2251,8 @@ private void updateStreamVolumeAlias(boolean updateVolumes, String caller) {
22512251
synchronized (VolumeStreamState.class) {
22522252
mStreamStates[AudioSystem.STREAM_DTMF]
22532253
.setAllIndexes(mStreamStates[dtmfStreamAlias], caller);
2254-
mStreamStates[AudioSystem.STREAM_ACCESSIBILITY].mVolumeIndexSettingName =
2255-
System.VOLUME_SETTINGS_INT[a11yStreamAlias];
2254+
mStreamStates[AudioSystem.STREAM_ACCESSIBILITY].setSettingName(
2255+
System.VOLUME_SETTINGS_INT[a11yStreamAlias]);
22562256
mStreamStates[AudioSystem.STREAM_ACCESSIBILITY].setAllIndexes(
22572257
mStreamStates[a11yStreamAlias], caller);
22582258
}
@@ -7505,7 +7505,7 @@ private class VolumeGroupState {
75057505
private int mPublicStreamType = AudioSystem.STREAM_MUSIC;
75067506
private AudioAttributes mAudioAttributes = AudioProductStrategy.getDefaultAttributes();
75077507
private boolean mIsMuted = false;
7508-
private final String mSettingName;
7508+
private String mSettingName;
75097509

75107510
// No API in AudioSystem to get a device from strategy or from attributes.
75117511
// Need a valid public stream type to use current API getDeviceForStream
@@ -7834,15 +7834,19 @@ public void clearIndexCache() {
78347834
}
78357835

78367836
private void persistVolumeGroup(int device) {
7837-
if (mUseFixedVolume) {
7837+
// No need to persist the index if the volume group is backed up
7838+
// by a public stream type as this is redundant
7839+
if (mUseFixedVolume || mHasValidStreamType) {
78387840
return;
78397841
}
78407842
if (DEBUG_VOL) {
78417843
Log.v(TAG, "persistVolumeGroup: storing index " + getIndex(device) + " for group "
78427844
+ mAudioVolumeGroup.name()
78437845
+ ", device " + AudioSystem.getOutputDeviceName(device)
7844-
+ " and User=" + getCurrentUserId());
7846+
+ " and User=" + getCurrentUserId()
7847+
+ " mSettingName: " + mSettingName);
78457848
}
7849+
78467850
boolean success = mSettings.putSystemIntForUser(mContentResolver,
78477851
getSettingNameForDevice(device),
78487852
getIndex(device),
@@ -7905,6 +7909,14 @@ private int getValidIndex(int index) {
79057909
return mSettingName + "_" + AudioSystem.getOutputDeviceName(device);
79067910
}
79077911

7912+
void setSettingName(String settingName) {
7913+
mSettingName = settingName;
7914+
}
7915+
7916+
String getSettingName() {
7917+
return mSettingName;
7918+
}
7919+
79087920
private void dump(PrintWriter pw) {
79097921
pw.println("- VOLUME GROUP " + mAudioVolumeGroup.name() + ":");
79107922
pw.print(" Muted: ");
@@ -8029,6 +8041,9 @@ private VolumeStreamState(String settingName, int streamType) {
80298041
*/
80308042
public void setVolumeGroupState(VolumeGroupState volumeGroupState) {
80318043
mVolumeGroupState = volumeGroupState;
8044+
if (mVolumeGroupState != null) {
8045+
mVolumeGroupState.setSettingName(mVolumeIndexSettingName);
8046+
}
80328047
}
80338048
/**
80348049
* Update the minimum index that can be used without MODIFY_AUDIO_SETTINGS permission
@@ -8099,6 +8114,17 @@ private boolean hasValidSettingsName() {
80998114
return (mVolumeIndexSettingName != null && !mVolumeIndexSettingName.isEmpty());
81008115
}
81018116

8117+
void setSettingName(String settingName) {
8118+
mVolumeIndexSettingName = settingName;
8119+
if (mVolumeGroupState != null) {
8120+
mVolumeGroupState.setSettingName(mVolumeIndexSettingName);
8121+
}
8122+
}
8123+
8124+
String getSettingName() {
8125+
return mVolumeIndexSettingName;
8126+
}
8127+
81028128
public void readSettings() {
81038129
synchronized (mSettingsLock) {
81048130
synchronized (VolumeStreamState.class) {
@@ -8747,7 +8773,7 @@ private void persistVolume(VolumeStreamState streamState, int device) {
87478773
if (streamState.hasValidSettingsName()) {
87488774
mSettings.putSystemIntForUser(mContentResolver,
87498775
streamState.getSettingNameForDevice(device),
8750-
(streamState.getIndex(device) + 5)/ 10,
8776+
(streamState.getIndex(device) + 5) / 10,
87518777
UserHandle.USER_CURRENT);
87528778
}
87538779
}

0 commit comments

Comments
 (0)