Merge "Allow package names to be retrieved for HotwordDetectionService" into udc-dev
diff --git a/core/java/android/app/WallpaperManager.java b/core/java/android/app/WallpaperManager.java
index ebd525e..6592019 100644
--- a/core/java/android/app/WallpaperManager.java
+++ b/core/java/android/app/WallpaperManager.java
@@ -303,7 +303,7 @@
private final Context mContext;
private final boolean mWcgEnabled;
private final ColorManagementProxy mCmProxy;
- private Boolean mIsLockscreenLiveWallpaperEnabled = null;
+ private static Boolean sIsLockscreenLiveWallpaperEnabled = null;
/**
* Special drawable that draws a wallpaper as fast as possible. Assumes
@@ -823,18 +823,18 @@
@TestApi
public boolean isLockscreenLiveWallpaperEnabled() {
if (sGlobals == null) {
- mIsLockscreenLiveWallpaperEnabled = SystemProperties.getBoolean(
+ sIsLockscreenLiveWallpaperEnabled = SystemProperties.getBoolean(
"persist.wm.debug.lockscreen_live_wallpaper", false);
}
- if (mIsLockscreenLiveWallpaperEnabled == null) {
+ if (sIsLockscreenLiveWallpaperEnabled == null) {
try {
- mIsLockscreenLiveWallpaperEnabled =
+ sIsLockscreenLiveWallpaperEnabled =
sGlobals.mService.isLockscreenLiveWallpaperEnabled();
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
}
- return mIsLockscreenLiveWallpaperEnabled;
+ return sIsLockscreenLiveWallpaperEnabled;
}
/**
@@ -2757,7 +2757,7 @@
public static InputStream openDefaultWallpaper(Context context, @SetWallpaperFlags int which) {
final String whichProp;
final int defaultResId;
- if (which == FLAG_LOCK) {
+ if (which == FLAG_LOCK && !sIsLockscreenLiveWallpaperEnabled) {
/* Factory-default lock wallpapers are not yet supported
whichProp = PROP_LOCK_WALLPAPER;
defaultResId = com.android.internal.R.drawable.default_lock_wallpaper;
diff --git a/core/java/android/hardware/face/FaceManager.java b/core/java/android/hardware/face/FaceManager.java
index 55b20e1..e0af913 100644
--- a/core/java/android/hardware/face/FaceManager.java
+++ b/core/java/android/hardware/face/FaceManager.java
@@ -342,6 +342,14 @@
return;
}
+ if (getEnrolledFaces(userId).size()
+ >= mContext.getResources().getInteger(R.integer.config_faceMaxTemplatesPerUser)) {
+ callback.onEnrollmentError(FACE_ERROR_HW_UNAVAILABLE,
+ getErrorString(mContext, FACE_ERROR_HW_UNAVAILABLE,
+ 0 /* vendorCode */));
+ return;
+ }
+
if (mService != null) {
try {
mEnrollmentCallback = callback;
diff --git a/core/java/com/android/internal/os/anr/AnrLatencyTracker.java b/core/java/com/android/internal/os/anr/AnrLatencyTracker.java
index 096d1cd..6fa6fa5 100644
--- a/core/java/com/android/internal/os/anr/AnrLatencyTracker.java
+++ b/core/java/com/android/internal/os/anr/AnrLatencyTracker.java
@@ -28,12 +28,15 @@
import static com.android.internal.util.FrameworkStatsLog.ANRLATENCY_REPORTED__ANR_TYPE__START_FOREGROUND_SERVICE;
import static com.android.internal.util.FrameworkStatsLog.ANRLATENCY_REPORTED__ANR_TYPE__UNKNOWN_ANR_TYPE;
+import android.annotation.IntDef;
import android.os.SystemClock;
import android.os.Trace;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.util.FrameworkStatsLog;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
import java.util.concurrent.atomic.AtomicInteger;
/**
@@ -44,6 +47,22 @@
*/
public class AnrLatencyTracker implements AutoCloseable {
+ /** Status of the early dumped pid. */
+ @IntDef(value = {
+ EarlyDumpStatus.UNKNOWN,
+ EarlyDumpStatus.SUCCEEDED,
+ EarlyDumpStatus.FAILED_TO_CREATE_FILE,
+ EarlyDumpStatus.TIMED_OUT
+ })
+
+ @Retention(RetentionPolicy.SOURCE)
+ private @interface EarlyDumpStatus {
+ int UNKNOWN = 1;
+ int SUCCEEDED = 2;
+ int FAILED_TO_CREATE_FILE = 3;
+ int TIMED_OUT = 4;
+ }
+
private static final AtomicInteger sNextAnrRecordPlacedOnQueueCookieGenerator =
new AtomicInteger();
@@ -77,7 +96,16 @@
private int mAnrQueueSize;
private int mAnrType;
- private int mDumpedProcessesCount = 0;
+ private final AtomicInteger mDumpedProcessesCount = new AtomicInteger(0);
+
+ private volatile @EarlyDumpStatus int mEarlyDumpStatus =
+ EarlyDumpStatus.UNKNOWN;
+ private volatile long mTempFileDumpingStartUptime;
+ private volatile long mTempFileDumpingDuration = 0;
+ private long mCopyingFirstPidStartUptime;
+ private long mCopyingFirstPidDuration = 0;
+ private long mEarlyDumpRequestSubmissionUptime = 0;
+ private long mEarlyDumpExecutorPidCount = 0;
private long mFirstPidsDumpingStartUptime;
private long mFirstPidsDumpingDuration = 0;
@@ -88,7 +116,7 @@
private boolean mIsPushed = false;
private boolean mIsSkipped = false;
-
+ private boolean mCopyingFirstPidSucceeded = false;
private final int mAnrRecordPlacedOnQueueCookie =
sNextAnrRecordPlacedOnQueueCookieGenerator.incrementAndGet();
@@ -111,6 +139,15 @@
Trace.traceEnd(TRACE_TAG_ACTIVITY_MANAGER);
}
+ /**
+ * Records the number of processes we are currently early-dumping, this number includes the
+ * current ANR's main process.
+ */
+ public void earlyDumpRequestSubmittedWithSize(int currentProcessedPidCount) {
+ mEarlyDumpRequestSubmissionUptime = getUptimeMillis();
+ mEarlyDumpExecutorPidCount = currentProcessedPidCount;
+ }
+
/** Records the placing of the AnrHelper.AnrRecord instance on the processing queue. */
public void anrRecordPlacingOnQueueWithSize(int queueSize) {
mAnrRecordPlacedOnQueueUptime = getUptimeMillis();
@@ -210,48 +247,89 @@
Trace.traceEnd(TRACE_TAG_ACTIVITY_MANAGER);
}
- /** Records the start of pid dumping to file (subject and criticalEventSection). */
+ /** Records the start of pid dumping to file. */
public void dumpingPidStarted(int pid) {
Trace.traceBegin(TRACE_TAG_ACTIVITY_MANAGER, "dumpingPid#" + pid);
}
- /** Records the end of pid dumping to file (subject and criticalEventSection). */
+ /** Records the end of pid dumping to file. */
public void dumpingPidEnded() {
- mDumpedProcessesCount++;
+ mDumpedProcessesCount.incrementAndGet();
Trace.traceEnd(TRACE_TAG_ACTIVITY_MANAGER);
}
- /** Records the start of pid dumping to file (subject and criticalEventSection). */
+ /** Records the start of first pids dumping to file. */
public void dumpingFirstPidsStarted() {
mFirstPidsDumpingStartUptime = getUptimeMillis();
Trace.traceBegin(TRACE_TAG_ACTIVITY_MANAGER, "dumpingFirstPids");
}
- /** Records the end of pid dumping to file (subject and criticalEventSection). */
+ /** Records the end of first pids dumping to file. */
public void dumpingFirstPidsEnded() {
mFirstPidsDumpingDuration = getUptimeMillis() - mFirstPidsDumpingStartUptime;
Trace.traceEnd(TRACE_TAG_ACTIVITY_MANAGER);
}
- /** Records the start of pid dumping to file (subject and criticalEventSection). */
+
+ /** Records the start of the copying of the pre-dumped first pid. */
+ public void copyingFirstPidStarted() {
+ mCopyingFirstPidStartUptime = getUptimeMillis();
+ Trace.traceBegin(TRACE_TAG_ACTIVITY_MANAGER, "copyingFirstPid");
+ }
+
+ /** Records the end of the copying of the pre-dumped first pid. */
+ public void copyingFirstPidEnded(boolean copySucceeded) {
+ mCopyingFirstPidDuration = getUptimeMillis() - mCopyingFirstPidStartUptime;
+ mCopyingFirstPidSucceeded = copySucceeded;
+ Trace.traceEnd(TRACE_TAG_ACTIVITY_MANAGER);
+ }
+
+ /** Records the start of pre-dumping. */
+ public void dumpStackTracesTempFileStarted() {
+ mTempFileDumpingStartUptime = getUptimeMillis();
+ Trace.traceBegin(TRACE_TAG_ACTIVITY_MANAGER, "dumpStackTracesTempFile");
+ }
+
+ /** Records the end of pre-dumping. */
+ public void dumpStackTracesTempFileEnded() {
+ mTempFileDumpingDuration = getUptimeMillis() - mTempFileDumpingStartUptime;
+ if (mEarlyDumpStatus == EarlyDumpStatus.UNKNOWN) {
+ mEarlyDumpStatus = EarlyDumpStatus.SUCCEEDED;
+ }
+ Trace.traceEnd(TRACE_TAG_ACTIVITY_MANAGER);
+ }
+
+ /** Records file creation failure events in dumpStackTracesTempFile. */
+ public void dumpStackTracesTempFileCreationFailed() {
+ mEarlyDumpStatus = EarlyDumpStatus.FAILED_TO_CREATE_FILE;
+ Trace.instant(TRACE_TAG_ACTIVITY_MANAGER, "dumpStackTracesTempFileCreationFailed");
+ }
+
+ /** Records timeout events in dumpStackTracesTempFile. */
+ public void dumpStackTracesTempFileTimedOut() {
+ mEarlyDumpStatus = EarlyDumpStatus.TIMED_OUT;
+ Trace.instant(TRACE_TAG_ACTIVITY_MANAGER, "dumpStackTracesTempFileTimedOut");
+ }
+
+ /** Records the start of native pids dumping to file. */
public void dumpingNativePidsStarted() {
mNativePidsDumpingStartUptime = getUptimeMillis();
Trace.traceBegin(TRACE_TAG_ACTIVITY_MANAGER, "dumpingNativePids");
}
- /** Records the end of pid dumping to file (subject and criticalEventSection). */
+ /** Records the end of native pids dumping to file . */
public void dumpingNativePidsEnded() {
mNativePidsDumpingDuration = getUptimeMillis() - mNativePidsDumpingStartUptime;
Trace.traceEnd(TRACE_TAG_ACTIVITY_MANAGER);
}
- /** Records the start of pid dumping to file (subject and criticalEventSection). */
+ /** Records the start of extra pids dumping to file. */
public void dumpingExtraPidsStarted() {
mExtraPidsDumpingStartUptime = getUptimeMillis();
Trace.traceBegin(TRACE_TAG_ACTIVITY_MANAGER, "dumpingExtraPids");
}
- /** Records the end of pid dumping to file (subject and criticalEventSection). */
+ /** Records the end of extra pids dumping to file. */
public void dumpingExtraPidsEnded() {
mExtraPidsDumpingDuration = getUptimeMillis() - mExtraPidsDumpingStartUptime;
Trace.traceEnd(TRACE_TAG_ACTIVITY_MANAGER);
@@ -337,7 +415,7 @@
* Returns latency data as a comma separated value string for inclusion in ANR report.
*/
public String dumpAsCommaSeparatedArrayWithHeader() {
- return "DurationsV2: " + mAnrTriggerUptime
+ return "DurationsV3: " + mAnrTriggerUptime
/* triggering_to_app_not_responding_duration = */
+ "," + (mAppNotRespondingStartUptime - mAnrTriggerUptime)
/* app_not_responding_duration = */
@@ -370,7 +448,22 @@
/* anr_queue_size_when_pushed = */
+ "," + mAnrQueueSize
/* dump_stack_traces_io_time = */
- + "," + (mFirstPidsDumpingStartUptime - mDumpStackTracesStartUptime)
+ // We use copyingFirstPidUptime if we're dumping the durations list before the
+ // first pids ie after copying the early dump stacks.
+ + "," + ((mFirstPidsDumpingStartUptime > 0 ? mFirstPidsDumpingStartUptime
+ : mCopyingFirstPidStartUptime) - mDumpStackTracesStartUptime)
+ /* temp_file_dump_duration = */
+ + "," + mTempFileDumpingDuration
+ /* temp_dump_request_on_queue_duration = */
+ + "," + (mTempFileDumpingStartUptime - mEarlyDumpRequestSubmissionUptime)
+ /* temp_dump_pid_count_when_pushed = */
+ + "," + mEarlyDumpExecutorPidCount
+ /* first_pid_copying_time = */
+ + "," + mCopyingFirstPidDuration
+ /* early_dump_status = */
+ + "," + mEarlyDumpStatus
+ /* copying_first_pid_succeeded = */
+ + "," + (mCopyingFirstPidSucceeded ? 1 : 0)
+ "\n\n";
}
@@ -449,7 +542,7 @@
/* anr_queue_size_when_pushed = */ mAnrQueueSize,
/* anr_type = */ mAnrType,
- /* dumped_processes_count = */ mDumpedProcessesCount);
+ /* dumped_processes_count = */ mDumpedProcessesCount.get());
}
private void anrSkipped(String method) {
diff --git a/core/java/com/android/internal/widget/ILockSettings.aidl b/core/java/com/android/internal/widget/ILockSettings.aidl
index dfcde3d..4065055 100644
--- a/core/java/com/android/internal/widget/ILockSettings.aidl
+++ b/core/java/com/android/internal/widget/ILockSettings.aidl
@@ -57,6 +57,7 @@
void removeGatekeeperPasswordHandle(long gatekeeperPasswordHandle);
int getCredentialType(int userId);
int getPinLength(int userId);
+ boolean refreshStoredPinLength(int userId);
byte[] getHashFactor(in LockscreenCredential currentCredential, int userId);
void setSeparateProfileChallengeEnabled(int userId, boolean enabled, in LockscreenCredential managedUserPassword);
boolean getSeparateProfileChallengeEnabled(int userId);
diff --git a/core/java/com/android/internal/widget/LockPatternUtils.java b/core/java/com/android/internal/widget/LockPatternUtils.java
index 38632d1..fbad4b9 100644
--- a/core/java/com/android/internal/widget/LockPatternUtils.java
+++ b/core/java/com/android/internal/widget/LockPatternUtils.java
@@ -622,6 +622,24 @@
return PIN_LENGTH_UNAVAILABLE;
}
}
+
+ /**
+ * This method saves the pin length value to disk based on the user's auto pin
+ * confirmation flag setting. If the auto pin confirmation flag is disabled, or if the
+ * user does not have a PIN setup, or if length of PIN is less than minimum storable PIN length
+ * value, the pin length value is set to PIN_LENGTH_UNAVAILABLE. Otherwise, if the
+ * flag is enabled, the pin length value is set to the actual length of the user's PIN.
+ * @param userId user id of the user whose pin length we want to save
+ * @return true/false depending on whether PIN length has been saved or not
+ */
+ public boolean refreshStoredPinLength(int userId) {
+ try {
+ return getLockSettings().refreshStoredPinLength(userId);
+ } catch (RemoteException e) {
+ Log.e(TAG, "Could not store PIN length on disk " + e);
+ return false;
+ }
+ }
/**
* Records that the user has chosen a pattern at some time, even if the pattern is
* currently cleared.
diff --git a/core/proto/android/companion/OWNERS b/core/proto/android/companion/OWNERS
new file mode 100644
index 0000000..edf9e56
--- /dev/null
+++ b/core/proto/android/companion/OWNERS
@@ -0,0 +1 @@
+include /core/java/android/companion/OWNERS
diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml
index 947dc2d..ccd0dcc 100644
--- a/core/res/res/values/strings.xml
+++ b/core/res/res/values/strings.xml
@@ -1970,8 +1970,8 @@
<string name="face_error_user_canceled">Face Unlock canceled by user</string>
<!-- Generic error message shown when the face operation fails because too many attempts have been made. [CHAR LIMIT=50] -->
<string name="face_error_lockout">Too many attempts. Try again later.</string>
- <!-- Generic error message shown when the face operation fails because strong authentication is required. [CHAR LIMIT=90] -->
- <string name="face_error_lockout_permanent">Too many attempts. Face Unlock disabled.</string>
+ <!-- Generic error message shown when the face operation fails because strong authentication is required. [CHAR LIMIT=100] -->
+ <string name="face_error_lockout_permanent">Too many attempts. Face Unlock unavailable.</string>
<!-- Generic error message shown when the face operation fails because strong authentication is required. [CHAR LIMIT=90] -->
<string name="face_error_lockout_screen_lock">Too many attempts. Enter screen lock instead.</string>
<!-- Generic error message shown when the face hardware can't recognize the face. [CHAR LIMIT=50] -->
diff --git a/core/tests/coretests/src/android/hardware/face/FaceManagerTest.java b/core/tests/coretests/src/android/hardware/face/FaceManagerTest.java
index 9a202ae..1075d44 100644
--- a/core/tests/coretests/src/android/hardware/face/FaceManagerTest.java
+++ b/core/tests/coretests/src/android/hardware/face/FaceManagerTest.java
@@ -21,8 +21,11 @@
import static com.google.common.truth.Truth.assertThat;
import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.ArgumentMatchers.anyLong;
+import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.Mockito.atMost;
import static org.mockito.Mockito.eq;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
@@ -38,6 +41,8 @@
import android.os.test.TestLooper;
import android.platform.test.annotations.Presubmit;
+import com.android.internal.R;
+
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
@@ -50,6 +55,7 @@
import org.mockito.junit.MockitoRule;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
@Presubmit
@@ -70,6 +76,8 @@
private IFaceService mService;
@Mock
private FaceManager.AuthenticationCallback mAuthCallback;
+ @Mock
+ private FaceManager.EnrollmentCallback mEnrollmentCallback;
@Captor
private ArgumentCaptor<IFaceAuthenticatorsRegisteredCallback> mCaptor;
@@ -107,9 +115,7 @@
@Test
public void getSensorPropertiesInternal_noBinderCalls() throws RemoteException {
- verify(mService).addAuthenticatorsRegisteredCallback(mCaptor.capture());
-
- mCaptor.getValue().onAllAuthenticatorsRegistered(mProps);
+ initializeProperties();
List<FaceSensorPropertiesInternal> actual = mFaceManager.getSensorPropertiesInternal();
assertThat(actual).containsExactlyElementsIn(mProps);
@@ -148,4 +154,33 @@
verify(mAuthCallback).onAuthenticationError(eq(FACE_ERROR_HW_UNAVAILABLE), any());
}
+
+ @Test
+ public void enrollment_errorWhenFaceEnrollmentExists() throws RemoteException {
+ when(mResources.getInteger(R.integer.config_faceMaxTemplatesPerUser)).thenReturn(1);
+ when(mService.getEnrolledFaces(anyInt(), anyInt(), anyString()))
+ .thenReturn(Collections.emptyList())
+ .thenReturn(Collections.singletonList(new Face("Face" /* name */, 0 /* faceId */,
+ 0 /* deviceId */)));
+
+ initializeProperties();
+ mFaceManager.enroll(USER_ID, new byte[]{},
+ new CancellationSignal(), mEnrollmentCallback, null /* disabledFeatures */);
+
+ verify(mService).enroll(eq(USER_ID), any(), any(), any(), anyString(), any(), any(),
+ anyBoolean());
+
+ mFaceManager.enroll(USER_ID, new byte[]{},
+ new CancellationSignal(), mEnrollmentCallback, null /* disabledFeatures */);
+
+ verify(mService, atMost(1 /* maxNumberOfInvocations */)).enroll(eq(USER_ID), any(), any(),
+ any(), anyString(), any(), any(), anyBoolean());
+ verify(mEnrollmentCallback).onEnrollmentError(eq(FACE_ERROR_HW_UNAVAILABLE), anyString());
+ }
+
+ private void initializeProperties() throws RemoteException {
+ verify(mService).addAuthenticatorsRegisteredCallback(mCaptor.capture());
+
+ mCaptor.getValue().onAllAuthenticatorsRegistered(mProps);
+ }
}
diff --git a/core/tests/coretests/src/android/internal/os/anr/AnrLatencyTrackerTests.java b/core/tests/coretests/src/android/internal/os/anr/AnrLatencyTrackerTests.java
index 4eea076..7d5a0364 100644
--- a/core/tests/coretests/src/android/internal/os/anr/AnrLatencyTrackerTests.java
+++ b/core/tests/coretests/src/android/internal/os/anr/AnrLatencyTrackerTests.java
@@ -59,7 +59,10 @@
.thenReturn(175L)
.thenReturn(198L)
.thenReturn(203L)
- .thenReturn(209L);
+ .thenReturn(209L)
+ .thenReturn(211L)
+ .thenReturn(212L)
+ .thenReturn(220L);
}
@Test
@@ -68,6 +71,7 @@
mLatencyTracker.appNotRespondingStarted();
mLatencyTracker.waitingOnAnrRecordLockStarted();
mLatencyTracker.waitingOnAnrRecordLockEnded();
+ mLatencyTracker.earlyDumpRequestSubmittedWithSize(5);
mLatencyTracker.anrRecordPlacingOnQueueWithSize(3);
mLatencyTracker.appNotRespondingEnded();
@@ -90,7 +94,16 @@
mLatencyTracker.waitingOnProcLockStarted();
mLatencyTracker.waitingOnProcLockEnded();
+ mLatencyTracker.dumpStackTracesTempFileStarted();
+ mLatencyTracker.dumpingPidStarted(5);
+
mLatencyTracker.dumpStackTracesStarted();
+ mLatencyTracker.copyingFirstPidStarted();
+
+ mLatencyTracker.dumpingPidEnded();
+ mLatencyTracker.dumpStackTracesTempFileEnded();
+
+ mLatencyTracker.copyingFirstPidEnded(true);
mLatencyTracker.dumpingFirstPidsStarted();
mLatencyTracker.dumpingPidStarted(1);
mLatencyTracker.dumpingPidEnded();
@@ -111,7 +124,7 @@
mLatencyTracker.close();
assertThat(mLatencyTracker.dumpAsCommaSeparatedArrayWithHeader())
- .isEqualTo("DurationsV2: 50,5,25,8,115,2,3,7,8,15,2,7,23,10,3,6\n\n");
+ .isEqualTo("DurationsV3: 50,5,33,11,112,4,2,4,6,5,1,10,5,10,3,9,11,129,5,8,1\n\n");
verify(mLatencyTracker, times(1)).pushAtom();
}
@@ -121,6 +134,7 @@
mLatencyTracker.appNotRespondingStarted();
mLatencyTracker.waitingOnAnrRecordLockStarted();
mLatencyTracker.waitingOnAnrRecordLockEnded();
+ mLatencyTracker.earlyDumpRequestSubmittedWithSize(5);
mLatencyTracker.anrRecordPlacingOnQueueWithSize(3);
mLatencyTracker.appNotRespondingEnded();
@@ -143,7 +157,18 @@
mLatencyTracker.waitingOnProcLockStarted();
mLatencyTracker.waitingOnProcLockEnded();
+
+
+ mLatencyTracker.dumpStackTracesTempFileStarted();
+ mLatencyTracker.dumpingPidStarted(5);
+
mLatencyTracker.dumpStackTracesStarted();
+ mLatencyTracker.copyingFirstPidStarted();
+
+ mLatencyTracker.dumpingPidEnded();
+ mLatencyTracker.dumpStackTracesTempFileEnded();
+
+ mLatencyTracker.copyingFirstPidEnded(true);
mLatencyTracker.dumpingFirstPidsStarted();
mLatencyTracker.dumpingPidStarted(1);
mLatencyTracker.dumpingPidEnded();
diff --git a/libs/WindowManager/Shell/res/layout/desktop_mode_app_controls_window_decor.xml b/libs/WindowManager/Shell/res/layout/desktop_mode_app_controls_window_decor.xml
index f6b21ba..fb1980a 100644
--- a/libs/WindowManager/Shell/res/layout/desktop_mode_app_controls_window_decor.xml
+++ b/libs/WindowManager/Shell/res/layout/desktop_mode_app_controls_window_decor.xml
@@ -31,8 +31,7 @@
android:orientation="horizontal"
android:clickable="true"
android:focusable="true"
- android:paddingStart="8dp"
- android:background="?android:selectableItemBackgroundBorderless">
+ android:paddingStart="8dp">
<ImageView
android:id="@+id/application_icon"
@@ -88,6 +87,6 @@
android:src="@drawable/decor_close_button_dark"
android:scaleType="fitCenter"
android:gravity="end"
- android:background="?android:selectableItemBackgroundBorderless"
+ android:background="@null"
android:tint="@color/desktop_mode_caption_close_button_dark"/>
</com.android.wm.shell.windowdecor.WindowDecorLinearLayout>
\ No newline at end of file
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/Bubble.java b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/Bubble.java
index 026ea069..79e0a48 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/Bubble.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/Bubble.java
@@ -47,7 +47,6 @@
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.logging.InstanceId;
-import com.android.launcher3.icons.BubbleBadgeIconFactory;
import com.android.launcher3.icons.BubbleIconFactory;
import com.android.wm.shell.bubbles.bar.BubbleBarExpandedView;
import com.android.wm.shell.bubbles.bar.BubbleBarLayerView;
@@ -436,7 +435,6 @@
* @param stackView the view the bubble is added to, iff showing as floating.
* @param layerView the layer the bubble is added to, iff showing in the bubble bar.
* @param iconFactory the icon factory use to create images for the bubble.
- * @param badgeIconFactory the icon factory to create app badges for the bubble.
*/
void inflate(BubbleViewInfoTask.Callback callback,
Context context,
@@ -444,7 +442,6 @@
@Nullable BubbleStackView stackView,
@Nullable BubbleBarLayerView layerView,
BubbleIconFactory iconFactory,
- BubbleBadgeIconFactory badgeIconFactory,
boolean skipInflation) {
if (isBubbleLoading()) {
mInflationTask.cancel(true /* mayInterruptIfRunning */);
@@ -455,7 +452,6 @@
stackView,
layerView,
iconFactory,
- badgeIconFactory,
skipInflation,
callback,
mMainExecutor);
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleController.java b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleController.java
index fd66153..c407b06 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleController.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleController.java
@@ -89,7 +89,6 @@
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.statusbar.IStatusBarService;
-import com.android.launcher3.icons.BubbleBadgeIconFactory;
import com.android.launcher3.icons.BubbleIconFactory;
import com.android.wm.shell.R;
import com.android.wm.shell.ShellTaskOrganizer;
@@ -209,7 +208,6 @@
@Nullable private BubbleStackView mStackView;
@Nullable private BubbleBarLayerView mLayerView;
private BubbleIconFactory mBubbleIconFactory;
- private BubbleBadgeIconFactory mBubbleBadgeIconFactory;
private BubblePositioner mBubblePositioner;
private Bubbles.SysuiProxy mSysuiProxy;
@@ -321,8 +319,7 @@
mBubbleData = data;
mSavedUserBubbleData = new SparseArray<>();
mBubbleIconFactory = new BubbleIconFactory(context,
- context.getResources().getDimensionPixelSize(R.dimen.bubble_size));
- mBubbleBadgeIconFactory = new BubbleBadgeIconFactory(context,
+ context.getResources().getDimensionPixelSize(R.dimen.bubble_size),
context.getResources().getDimensionPixelSize(R.dimen.bubble_badge_size),
context.getResources().getColor(R.color.important_conversation),
context.getResources().getDimensionPixelSize(
@@ -700,6 +697,10 @@
return mBubblePositioner;
}
+ BubbleIconFactory getIconFactory() {
+ return mBubbleIconFactory;
+ }
+
public Bubbles.SysuiProxy getSysuiProxy() {
return mSysuiProxy;
}
@@ -936,8 +937,7 @@
mStackView.onThemeChanged();
}
mBubbleIconFactory = new BubbleIconFactory(mContext,
- mContext.getResources().getDimensionPixelSize(R.dimen.bubble_size));
- mBubbleBadgeIconFactory = new BubbleBadgeIconFactory(mContext,
+ mContext.getResources().getDimensionPixelSize(R.dimen.bubble_size),
mContext.getResources().getDimensionPixelSize(R.dimen.bubble_badge_size),
mContext.getResources().getColor(R.color.important_conversation),
mContext.getResources().getDimensionPixelSize(
@@ -951,7 +951,6 @@
mStackView,
mLayerView,
mBubbleIconFactory,
- mBubbleBadgeIconFactory,
false /* skipInflation */);
}
for (Bubble b : mBubbleData.getOverflowBubbles()) {
@@ -961,7 +960,6 @@
mStackView,
mLayerView,
mBubbleIconFactory,
- mBubbleBadgeIconFactory,
false /* skipInflation */);
}
}
@@ -978,8 +976,7 @@
mScreenBounds.set(newConfig.windowConfiguration.getBounds());
mBubbleData.onMaxBubblesChanged();
mBubbleIconFactory = new BubbleIconFactory(mContext,
- mContext.getResources().getDimensionPixelSize(R.dimen.bubble_size));
- mBubbleBadgeIconFactory = new BubbleBadgeIconFactory(mContext,
+ mContext.getResources().getDimensionPixelSize(R.dimen.bubble_size),
mContext.getResources().getDimensionPixelSize(R.dimen.bubble_badge_size),
mContext.getResources().getColor(R.color.important_conversation),
mContext.getResources().getDimensionPixelSize(
@@ -1275,7 +1272,6 @@
mStackView,
mLayerView,
mBubbleIconFactory,
- mBubbleBadgeIconFactory,
true /* skipInflation */);
});
return null;
@@ -1351,7 +1347,7 @@
bubble.setInflateSynchronously(mInflateSynchronously);
bubble.inflate(b -> mBubbleData.notificationEntryUpdated(b, suppressFlyout, showInShade),
mContext, this, mStackView, mLayerView,
- mBubbleIconFactory, mBubbleBadgeIconFactory,
+ mBubbleIconFactory,
false /* skipInflation */);
}
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleData.java b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleData.java
index f9cf9d3..92b969b 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleData.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleData.java
@@ -38,6 +38,7 @@
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.util.FrameworkStatsLog;
+import com.android.launcher3.icons.BubbleIconFactory;
import com.android.wm.shell.R;
import com.android.wm.shell.bubbles.Bubbles.DismissReason;
import com.android.wm.shell.common.bubbles.BubbleBarUpdate;
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleOverflow.kt b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleOverflow.kt
index c2a05b7..c49451d 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleOverflow.kt
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleOverflow.kt
@@ -95,7 +95,11 @@
overflowBtn?.iconDrawable?.setTint(shapeColor)
val iconFactory = BubbleIconFactory(context,
- context.getResources().getDimensionPixelSize(R.dimen.bubble_size))
+ context.getResources().getDimensionPixelSize(R.dimen.bubble_size),
+ context.getResources().getDimensionPixelSize(R.dimen.bubble_badge_size),
+ context.getResources().getColor(R.color.important_conversation),
+ context.getResources().getDimensionPixelSize(
+ com.android.internal.R.dimen.importance_ring_stroke_width))
// Update bitmap
val fg = InsetDrawable(overflowBtn?.iconDrawable, overflowIconInset)
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleViewInfoTask.java b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleViewInfoTask.java
index d1081de..8ab9841 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleViewInfoTask.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleViewInfoTask.java
@@ -42,7 +42,6 @@
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.graphics.ColorUtils;
import com.android.launcher3.icons.BitmapInfo;
-import com.android.launcher3.icons.BubbleBadgeIconFactory;
import com.android.launcher3.icons.BubbleIconFactory;
import com.android.wm.shell.R;
import com.android.wm.shell.bubbles.bar.BubbleBarExpandedView;
@@ -75,7 +74,6 @@
private WeakReference<BubbleStackView> mStackView;
private WeakReference<BubbleBarLayerView> mLayerView;
private BubbleIconFactory mIconFactory;
- private BubbleBadgeIconFactory mBadgeIconFactory;
private boolean mSkipInflation;
private Callback mCallback;
private Executor mMainExecutor;
@@ -90,7 +88,6 @@
@Nullable BubbleStackView stackView,
@Nullable BubbleBarLayerView layerView,
BubbleIconFactory factory,
- BubbleBadgeIconFactory badgeFactory,
boolean skipInflation,
Callback c,
Executor mainExecutor) {
@@ -100,7 +97,6 @@
mStackView = new WeakReference<>(stackView);
mLayerView = new WeakReference<>(layerView);
mIconFactory = factory;
- mBadgeIconFactory = badgeFactory;
mSkipInflation = skipInflation;
mCallback = c;
mMainExecutor = mainExecutor;
@@ -110,10 +106,10 @@
protected BubbleViewInfo doInBackground(Void... voids) {
if (mController.get().isShowingAsBubbleBar()) {
return BubbleViewInfo.populateForBubbleBar(mContext.get(), mController.get(),
- mLayerView.get(), mBadgeIconFactory, mBubble, mSkipInflation);
+ mLayerView.get(), mIconFactory, mBubble, mSkipInflation);
} else {
return BubbleViewInfo.populate(mContext.get(), mController.get(), mStackView.get(),
- mIconFactory, mBadgeIconFactory, mBubble, mSkipInflation);
+ mIconFactory, mBubble, mSkipInflation);
}
}
@@ -156,7 +152,7 @@
@Nullable
public static BubbleViewInfo populateForBubbleBar(Context c, BubbleController controller,
- BubbleBarLayerView layerView, BubbleBadgeIconFactory badgeIconFactory, Bubble b,
+ BubbleBarLayerView layerView, BubbleIconFactory iconFactory, Bubble b,
boolean skipInflation) {
BubbleViewInfo info = new BubbleViewInfo();
@@ -195,7 +191,7 @@
return null;
}
- info.rawBadgeBitmap = badgeIconFactory.getBadgeBitmap(badgedIcon, false).icon;
+ info.rawBadgeBitmap = iconFactory.getBadgeBitmap(badgedIcon, false).icon;
return info;
}
@@ -203,8 +199,7 @@
@VisibleForTesting
@Nullable
public static BubbleViewInfo populate(Context c, BubbleController controller,
- BubbleStackView stackView, BubbleIconFactory iconFactory,
- BubbleBadgeIconFactory badgeIconFactory, Bubble b,
+ BubbleStackView stackView, BubbleIconFactory iconFactory, Bubble b,
boolean skipInflation) {
BubbleViewInfo info = new BubbleViewInfo();
@@ -256,16 +251,16 @@
bubbleDrawable = appIcon;
}
- BitmapInfo badgeBitmapInfo = badgeIconFactory.getBadgeBitmap(badgedIcon,
+ BitmapInfo badgeBitmapInfo = iconFactory.getBadgeBitmap(badgedIcon,
b.isImportantConversation());
info.badgeBitmap = badgeBitmapInfo.icon;
// Raw badge bitmap never includes the important conversation ring
info.rawBadgeBitmap = b.isImportantConversation()
- ? badgeIconFactory.getBadgeBitmap(badgedIcon, false).icon
+ ? iconFactory.getBadgeBitmap(badgedIcon, false).icon
: badgeBitmapInfo.icon;
float[] bubbleBitmapScale = new float[1];
- info.bubbleBitmap = iconFactory.createIconBitmap(bubbleDrawable, bubbleBitmapScale);
+ info.bubbleBitmap = iconFactory.getBubbleBitmap(bubbleDrawable, bubbleBitmapScale);
// Dot color & placement
Path iconPath = PathParser.createPathFromPathData(
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecorViewModel.java b/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecorViewModel.java
index 5226eee..e137bc4 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecorViewModel.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecorViewModel.java
@@ -335,7 +335,8 @@
@Override
public boolean onTouch(View v, MotionEvent e) {
final int id = v.getId();
- if (id != R.id.caption_handle && id != R.id.desktop_mode_caption) {
+ if (id != R.id.caption_handle && id != R.id.desktop_mode_caption
+ && id != R.id.open_menu_button && id != R.id.close_window) {
return false;
}
moveTaskToFront(mTaskOrganizer.getRunningTaskInfo(mTaskId));
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/viewholder/DesktopModeAppControlsWindowDecorationViewHolder.kt b/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/viewholder/DesktopModeAppControlsWindowDecorationViewHolder.kt
index 78cfcbd..b67acd5 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/viewholder/DesktopModeAppControlsWindowDecorationViewHolder.kt
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/viewholder/DesktopModeAppControlsWindowDecorationViewHolder.kt
@@ -35,7 +35,9 @@
captionView.setOnTouchListener(onCaptionTouchListener)
captionHandle.setOnTouchListener(onCaptionTouchListener)
openMenuButton.setOnClickListener(onCaptionButtonClickListener)
+ openMenuButton.setOnTouchListener(onCaptionTouchListener)
closeWindowButton.setOnClickListener(onCaptionButtonClickListener)
+ closeWindowButton.setOnTouchListener(onCaptionTouchListener)
appNameTextView.text = appName
appIconImageView.setImageDrawable(appIcon)
}
diff --git a/libs/hwui/pipeline/skia/RenderNodeDrawable.cpp b/libs/hwui/pipeline/skia/RenderNodeDrawable.cpp
index 1a47db5..da4f66d 100644
--- a/libs/hwui/pipeline/skia/RenderNodeDrawable.cpp
+++ b/libs/hwui/pipeline/skia/RenderNodeDrawable.cpp
@@ -293,8 +293,10 @@
// with the same canvas transformation + clip into the target
// canvas then draw the layer on top
if (renderNode->hasHolePunches()) {
+ canvas->save();
TransformCanvas transformCanvas(canvas, SkBlendMode::kDstOut);
displayList->draw(&transformCanvas);
+ canvas->restore();
}
canvas->drawImageRect(snapshotImage, SkRect::Make(srcBounds),
SkRect::Make(dstBounds), sampling, &paint,
diff --git a/media/java/android/media/AudioSystem.java b/media/java/android/media/AudioSystem.java
index 3123ee6..e73cf87 100644
--- a/media/java/android/media/AudioSystem.java
+++ b/media/java/android/media/AudioSystem.java
@@ -1237,9 +1237,6 @@
public static final Set<Integer> DEVICE_IN_ALL_SCO_SET;
/** @hide */
public static final Set<Integer> DEVICE_IN_ALL_USB_SET;
- /** @hide */
- public static final Set<Integer> DEVICE_IN_ALL_BLE_SET;
-
static {
DEVICE_IN_ALL_SET = new HashSet<>();
DEVICE_IN_ALL_SET.add(DEVICE_IN_COMMUNICATION);
@@ -1279,66 +1276,6 @@
DEVICE_IN_ALL_USB_SET.add(DEVICE_IN_USB_ACCESSORY);
DEVICE_IN_ALL_USB_SET.add(DEVICE_IN_USB_DEVICE);
DEVICE_IN_ALL_USB_SET.add(DEVICE_IN_USB_HEADSET);
-
- DEVICE_IN_ALL_BLE_SET = new HashSet<>();
- DEVICE_IN_ALL_BLE_SET.add(DEVICE_IN_BLE_HEADSET);
- }
-
- /** @hide */
- public static boolean isBluetoothDevice(int deviceType) {
- return isBluetoothA2dpOutDevice(deviceType)
- || isBluetoothScoDevice(deviceType)
- || isBluetoothLeDevice(deviceType);
- }
-
- /** @hide */
- public static boolean isBluetoothOutDevice(int deviceType) {
- return isBluetoothA2dpOutDevice(deviceType)
- || isBluetoothScoOutDevice(deviceType)
- || isBluetoothLeOutDevice(deviceType);
- }
-
- /** @hide */
- public static boolean isBluetoothInDevice(int deviceType) {
- return isBluetoothScoInDevice(deviceType)
- || isBluetoothLeInDevice(deviceType);
- }
-
- /** @hide */
- public static boolean isBluetoothA2dpOutDevice(int deviceType) {
- return DEVICE_OUT_ALL_A2DP_SET.contains(deviceType);
- }
-
- /** @hide */
- public static boolean isBluetoothScoOutDevice(int deviceType) {
- return DEVICE_OUT_ALL_SCO_SET.contains(deviceType);
- }
-
- /** @hide */
- public static boolean isBluetoothScoInDevice(int deviceType) {
- return DEVICE_IN_ALL_SCO_SET.contains(deviceType);
- }
-
- /** @hide */
- public static boolean isBluetoothScoDevice(int deviceType) {
- return isBluetoothScoOutDevice(deviceType)
- || isBluetoothScoInDevice(deviceType);
- }
-
- /** @hide */
- public static boolean isBluetoothLeOutDevice(int deviceType) {
- return DEVICE_OUT_ALL_BLE_SET.contains(deviceType);
- }
-
- /** @hide */
- public static boolean isBluetoothLeInDevice(int deviceType) {
- return DEVICE_IN_ALL_BLE_SET.contains(deviceType);
- }
-
- /** @hide */
- public static boolean isBluetoothLeDevice(int deviceType) {
- return isBluetoothLeOutDevice(deviceType)
- || isBluetoothLeInDevice(deviceType);
}
/** @hide */
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardViewController.java b/packages/SystemUI/src/com/android/keyguard/KeyguardViewController.java
index 7661b8d..281067d 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardViewController.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardViewController.java
@@ -23,8 +23,8 @@
import androidx.annotation.Nullable;
import com.android.systemui.keyguard.KeyguardViewMediator;
-import com.android.systemui.shade.NotificationPanelViewController;
import com.android.systemui.shade.ShadeExpansionStateManager;
+import com.android.systemui.shade.ShadeViewController;
import com.android.systemui.statusbar.phone.BiometricUnlockController;
import com.android.systemui.statusbar.phone.CentralSurfaces;
import com.android.systemui.statusbar.phone.KeyguardBypassController;
@@ -178,7 +178,7 @@
* Registers the CentralSurfaces to which this Keyguard View is mounted.
*/
void registerCentralSurfaces(CentralSurfaces centralSurfaces,
- NotificationPanelViewController notificationPanelViewController,
+ ShadeViewController shadeViewController,
@Nullable ShadeExpansionStateManager shadeExpansionStateManager,
BiometricUnlockController biometricUnlockController,
View notificationContainer,
diff --git a/packages/SystemUI/src/com/android/keyguard/dagger/KeyguardStatusBarViewComponent.java b/packages/SystemUI/src/com/android/keyguard/dagger/KeyguardStatusBarViewComponent.java
index d01c98a..91dd1d6 100644
--- a/packages/SystemUI/src/com/android/keyguard/dagger/KeyguardStatusBarViewComponent.java
+++ b/packages/SystemUI/src/com/android/keyguard/dagger/KeyguardStatusBarViewComponent.java
@@ -17,7 +17,7 @@
package com.android.keyguard.dagger;
import com.android.keyguard.KeyguardStatusViewController;
-import com.android.systemui.shade.NotificationPanelViewController;
+import com.android.systemui.shade.ShadeViewStateProvider;
import com.android.systemui.statusbar.phone.KeyguardStatusBarView;
import com.android.systemui.statusbar.phone.KeyguardStatusBarViewController;
@@ -37,8 +37,8 @@
interface Factory {
KeyguardStatusBarViewComponent build(
@BindsInstance KeyguardStatusBarView view,
- @BindsInstance NotificationPanelViewController.NotificationPanelViewStateProvider
- notificationPanelViewStateProvider);
+ @BindsInstance ShadeViewStateProvider
+ shadeViewStateProvider);
}
/** Builds a {@link KeyguardStatusViewController}. */
diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/AuthBiometricFingerprintAndFaceView.kt b/packages/SystemUI/src/com/android/systemui/biometrics/AuthBiometricFingerprintAndFaceView.kt
index 7f5a67f..57ffd24 100644
--- a/packages/SystemUI/src/com/android/systemui/biometrics/AuthBiometricFingerprintAndFaceView.kt
+++ b/packages/SystemUI/src/com/android/systemui/biometrics/AuthBiometricFingerprintAndFaceView.kt
@@ -19,6 +19,8 @@
import android.content.Context
import android.hardware.biometrics.BiometricAuthenticator.Modality
import android.hardware.biometrics.BiometricAuthenticator.TYPE_FACE
+import android.hardware.biometrics.BiometricConstants
+import android.hardware.face.FaceManager
import android.util.AttributeSet
import com.android.systemui.R
@@ -27,6 +29,7 @@
context: Context,
attrs: AttributeSet?
) : AuthBiometricFingerprintView(context, attrs) {
+ var isFaceClass3 = false
constructor (context: Context) : this(context, null)
@@ -34,10 +37,22 @@
override fun forceRequireConfirmation(@Modality modality: Int) = modality == TYPE_FACE
- override fun ignoreUnsuccessfulEventsFrom(@Modality modality: Int) = modality == TYPE_FACE
+ override fun ignoreUnsuccessfulEventsFrom(@Modality modality: Int, unsuccessfulReason: String) =
+ modality == TYPE_FACE && !(isFaceClass3 && isLockoutErrorString(unsuccessfulReason))
override fun onPointerDown(failedModalities: Set<Int>) = failedModalities.contains(TYPE_FACE)
override fun createIconController(): AuthIconController =
AuthBiometricFingerprintAndFaceIconController(mContext, mIconView, mIconViewOverlay)
+
+ private fun isLockoutErrorString(unsuccessfulReason: String) =
+ unsuccessfulReason == FaceManager.getErrorString(
+ mContext,
+ BiometricConstants.BIOMETRIC_ERROR_LOCKOUT,
+ 0 /*vendorCode */
+ ) || unsuccessfulReason == FaceManager.getErrorString(
+ mContext,
+ BiometricConstants.BIOMETRIC_ERROR_LOCKOUT_PERMANENT,
+ 0 /*vendorCode */
+ )
}
diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/AuthBiometricView.java b/packages/SystemUI/src/com/android/systemui/biometrics/AuthBiometricView.java
index 13bb6d3..e04dd06 100644
--- a/packages/SystemUI/src/com/android/systemui/biometrics/AuthBiometricView.java
+++ b/packages/SystemUI/src/com/android/systemui/biometrics/AuthBiometricView.java
@@ -258,7 +258,8 @@
}
/** Ignore all events from this (secondary) modality except successful authentication. */
- protected boolean ignoreUnsuccessfulEventsFrom(@Modality int modality) {
+ protected boolean ignoreUnsuccessfulEventsFrom(@Modality int modality,
+ String unsuccessfulReason) {
return false;
}
@@ -541,7 +542,7 @@
*/
public void onAuthenticationFailed(
@Modality int modality, @Nullable String failureReason) {
- if (ignoreUnsuccessfulEventsFrom(modality)) {
+ if (ignoreUnsuccessfulEventsFrom(modality, failureReason)) {
return;
}
@@ -556,7 +557,7 @@
* @param error message
*/
public void onError(@Modality int modality, String error) {
- if (ignoreUnsuccessfulEventsFrom(modality)) {
+ if (ignoreUnsuccessfulEventsFrom(modality, error)) {
return;
}
@@ -586,7 +587,7 @@
* @param help message
*/
public void onHelp(@Modality int modality, String help) {
- if (ignoreUnsuccessfulEventsFrom(modality)) {
+ if (ignoreUnsuccessfulEventsFrom(modality, help)) {
return;
}
if (mSize != AuthDialog.SIZE_MEDIUM) {
diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/AuthContainerView.java b/packages/SystemUI/src/com/android/systemui/biometrics/AuthContainerView.java
index 517f94f..f435b22 100644
--- a/packages/SystemUI/src/com/android/systemui/biometrics/AuthContainerView.java
+++ b/packages/SystemUI/src/com/android/systemui/biometrics/AuthContainerView.java
@@ -18,6 +18,7 @@
import static android.hardware.biometrics.BiometricManager.BIOMETRIC_MULTI_SENSOR_DEFAULT;
import static android.hardware.biometrics.BiometricManager.BiometricMultiSensorMode;
+import static android.hardware.biometrics.SensorProperties.STRENGTH_STRONG;
import static com.android.internal.jank.InteractionJankMonitor.CUJ_BIOMETRIC_PROMPT_TRANSITION;
@@ -383,6 +384,8 @@
fingerprintAndFaceView.setSensorProperties(fpProperties);
fingerprintAndFaceView.setScaleFactorProvider(config.mScaleProvider);
fingerprintAndFaceView.updateOverrideIconLayoutParamsSize();
+ fingerprintAndFaceView.setFaceClass3(
+ faceProperties.sensorStrength == STRENGTH_STRONG);
mBiometricView = fingerprintAndFaceView;
} else if (fpProperties != null) {
final AuthBiometricFingerprintView fpView =
diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/AuthController.java b/packages/SystemUI/src/com/android/systemui/biometrics/AuthController.java
index 0999229..6eb3c70 100644
--- a/packages/SystemUI/src/com/android/systemui/biometrics/AuthController.java
+++ b/packages/SystemUI/src/com/android/systemui/biometrics/AuthController.java
@@ -1349,7 +1349,7 @@
default void onEnrollmentsChanged(@Modality int modality) {}
/**
- * Called when UDFPS enrollments have changed. This is called after boot and on changes to
+ * Called when enrollments have changed. This is called after boot and on changes to
* enrollment.
*/
default void onEnrollmentsChanged(
diff --git a/packages/SystemUI/src/com/android/systemui/dreams/touch/ShadeTouchHandler.java b/packages/SystemUI/src/com/android/systemui/dreams/touch/ShadeTouchHandler.java
index 58b70b0..99451f2 100644
--- a/packages/SystemUI/src/com/android/systemui/dreams/touch/ShadeTouchHandler.java
+++ b/packages/SystemUI/src/com/android/systemui/dreams/touch/ShadeTouchHandler.java
@@ -23,7 +23,7 @@
import android.view.GestureDetector;
import android.view.MotionEvent;
-import com.android.systemui.shade.NotificationPanelViewController;
+import com.android.systemui.shade.ShadeViewController;
import com.android.systemui.statusbar.phone.CentralSurfaces;
import java.util.Optional;
@@ -54,8 +54,8 @@
}
session.registerInputListener(ev -> {
- final NotificationPanelViewController viewController =
- mSurfaces.map(CentralSurfaces::getNotificationPanelViewController).orElse(null);
+ final ShadeViewController viewController =
+ mSurfaces.map(CentralSurfaces::getShadeViewController).orElse(null);
if (viewController != null) {
viewController.handleExternalTouch((MotionEvent) ev);
diff --git a/packages/SystemUI/src/com/android/systemui/dreams/touch/dagger/BouncerSwipeModule.java b/packages/SystemUI/src/com/android/systemui/dreams/touch/dagger/BouncerSwipeModule.java
index 081bab0..5f03743 100644
--- a/packages/SystemUI/src/com/android/systemui/dreams/touch/dagger/BouncerSwipeModule.java
+++ b/packages/SystemUI/src/com/android/systemui/dreams/touch/dagger/BouncerSwipeModule.java
@@ -25,16 +25,16 @@
import com.android.systemui.dagger.qualifiers.Main;
import com.android.systemui.dreams.touch.BouncerSwipeTouchHandler;
import com.android.systemui.dreams.touch.DreamTouchHandler;
-import com.android.systemui.shade.NotificationPanelViewController;
+import com.android.systemui.shade.ShadeViewController;
import com.android.wm.shell.animation.FlingAnimationUtils;
-import javax.inject.Named;
-import javax.inject.Provider;
-
import dagger.Module;
import dagger.Provides;
import dagger.multibindings.IntoSet;
+import javax.inject.Named;
+import javax.inject.Provider;
+
/**
* This module captures the components associated with {@link BouncerSwipeTouchHandler}.
*/
@@ -78,8 +78,8 @@
return flingAnimationUtilsBuilderProvider.get()
.reset()
.setMaxLengthSeconds(
- NotificationPanelViewController.FLING_CLOSING_MAX_LENGTH_SECONDS)
- .setSpeedUpFactor(NotificationPanelViewController.FLING_SPEED_UP_FACTOR)
+ ShadeViewController.FLING_CLOSING_MAX_LENGTH_SECONDS)
+ .setSpeedUpFactor(ShadeViewController.FLING_SPEED_UP_FACTOR)
.build();
}
@@ -92,8 +92,8 @@
Provider<FlingAnimationUtils.Builder> flingAnimationUtilsBuilderProvider) {
return flingAnimationUtilsBuilderProvider.get()
.reset()
- .setMaxLengthSeconds(NotificationPanelViewController.FLING_MAX_LENGTH_SECONDS)
- .setSpeedUpFactor(NotificationPanelViewController.FLING_SPEED_UP_FACTOR)
+ .setMaxLengthSeconds(ShadeViewController.FLING_MAX_LENGTH_SECONDS)
+ .setSpeedUpFactor(ShadeViewController.FLING_SPEED_UP_FACTOR)
.build();
}
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
index 0fd479a..e0af5ce 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
@@ -134,9 +134,9 @@
import com.android.systemui.navigationbar.NavigationModeController;
import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.settings.UserTracker;
-import com.android.systemui.shade.NotificationPanelViewController;
import com.android.systemui.shade.ShadeController;
import com.android.systemui.shade.ShadeExpansionStateManager;
+import com.android.systemui.shade.ShadeViewController;
import com.android.systemui.shared.system.QuickStepContract;
import com.android.systemui.statusbar.CommandQueue;
import com.android.systemui.statusbar.NotificationShadeDepthController;
@@ -3098,7 +3098,7 @@
* @return the View Controller for the Keyguard View this class is mediating.
*/
public KeyguardViewController registerCentralSurfaces(CentralSurfaces centralSurfaces,
- NotificationPanelViewController panelView,
+ ShadeViewController panelView,
@Nullable ShadeExpansionStateManager shadeExpansionStateManager,
BiometricUnlockController biometricUnlockController,
View notificationContainer, KeyguardBypassController bypassController) {
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/data/repository/BiometricSettingsRepository.kt b/packages/SystemUI/src/com/android/systemui/keyguard/data/repository/BiometricSettingsRepository.kt
index 09002fd..0055f9a 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/data/repository/BiometricSettingsRepository.kt
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/data/repository/BiometricSettingsRepository.kt
@@ -212,14 +212,9 @@
userId: Int,
hasEnrollments: Boolean
) {
- // TODO(b/242022358), use authController.isFaceAuthEnrolled after
- // ag/20176811 is available.
- if (
- sensorBiometricType == BiometricType.FACE &&
- userId == selectedUserId
- ) {
+ if (sensorBiometricType == BiometricType.FACE) {
trySendWithFailureLogging(
- hasEnrollments,
+ authController.isFaceAuthEnrolled(selectedUserId),
TAG,
"Face enrollment changed"
)
diff --git a/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBar.java b/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBar.java
index c2d73f3..b0fb349 100644
--- a/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBar.java
+++ b/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBar.java
@@ -741,7 +741,7 @@
mView.setComponents(mRecentsOptional);
if (mCentralSurfacesOptionalLazy.get().isPresent()) {
mView.setComponents(
- mCentralSurfacesOptionalLazy.get().get().getNotificationPanelViewController());
+ mCentralSurfacesOptionalLazy.get().get().getShadeViewController());
}
mView.setDisabledFlags(mDisabledFlags1, mSysUiFlagsContainer);
mView.setOnVerticalChangedListener(this::onVerticalChanged);
@@ -1343,8 +1343,8 @@
private void onVerticalChanged(boolean isVertical) {
Optional<CentralSurfaces> cs = mCentralSurfacesOptionalLazy.get();
- if (cs.isPresent() && cs.get().getNotificationPanelViewController() != null) {
- cs.get().getNotificationPanelViewController().setQsScrimEnabled(!isVertical);
+ if (cs.isPresent() && cs.get().getShadeViewController() != null) {
+ cs.get().getShadeViewController().setQsScrimEnabled(!isVertical);
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarView.java b/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarView.java
index 5d598e8..94f01b8 100644
--- a/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarView.java
+++ b/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarView.java
@@ -74,7 +74,7 @@
import com.android.systemui.navigationbar.gestural.EdgeBackGestureHandler;
import com.android.systemui.recents.Recents;
import com.android.systemui.settings.DisplayTracker;
-import com.android.systemui.shade.NotificationPanelViewController;
+import com.android.systemui.shade.ShadeViewController;
import com.android.systemui.shared.rotation.FloatingRotationButton;
import com.android.systemui.shared.rotation.RotationButton.RotationButtonUpdatesCallback;
import com.android.systemui.shared.rotation.RotationButtonController;
@@ -149,7 +149,7 @@
private NavigationBarInflaterView mNavigationInflaterView;
private Optional<Recents> mRecentsOptional = Optional.empty();
@Nullable
- private NotificationPanelViewController mPanelView;
+ private ShadeViewController mPanelView;
private RotationContextButton mRotationContextButton;
private FloatingRotationButton mFloatingRotationButton;
private RotationButtonController mRotationButtonController;
@@ -346,7 +346,8 @@
mRecentsOptional = recentsOptional;
}
- public void setComponents(NotificationPanelViewController panel) {
+ /** */
+ public void setComponents(ShadeViewController panel) {
mPanelView = panel;
updatePanelSystemUiStateFlags();
}
diff --git a/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java b/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java
index 0a188e0..a43f520 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java
@@ -99,7 +99,7 @@
import com.android.systemui.recents.OverviewProxyService.OverviewProxyListener;
import com.android.systemui.settings.DisplayTracker;
import com.android.systemui.settings.UserTracker;
-import com.android.systemui.shade.NotificationPanelViewController;
+import com.android.systemui.shade.ShadeViewController;
import com.android.systemui.shared.recents.IOverviewProxy;
import com.android.systemui.shared.recents.ISystemUiProxy;
import com.android.systemui.shared.system.QuickStepContract;
@@ -205,7 +205,7 @@
// TODO move this logic to message queue
mCentralSurfacesOptionalLazy.get().ifPresent(centralSurfaces -> {
if (event.getActionMasked() == ACTION_DOWN) {
- centralSurfaces.getNotificationPanelViewController()
+ centralSurfaces.getShadeViewController()
.startExpandLatencyTracking();
}
mHandler.post(() -> {
@@ -676,9 +676,9 @@
mNavBarControllerLazy.get().getDefaultNavigationBar();
final NavigationBarView navBarView =
mNavBarControllerLazy.get().getNavigationBarView(mContext.getDisplayId());
- final NotificationPanelViewController panelController =
+ final ShadeViewController panelController =
mCentralSurfacesOptionalLazy.get()
- .map(CentralSurfaces::getNotificationPanelViewController)
+ .map(CentralSurfaces::getShadeViewController)
.orElse(null);
if (SysUiState.DEBUG) {
Log.d(TAG_OPS, "Updating sysui state flags: navBarFragment=" + navBarFragment
diff --git a/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java b/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java
index f77be3a..9e204e4 100644
--- a/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java
+++ b/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java
@@ -224,6 +224,8 @@
import com.android.systemui.util.time.SystemClock;
import com.android.wm.shell.animation.FlingAnimationUtils;
+import kotlin.Unit;
+
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
@@ -234,18 +236,12 @@
import javax.inject.Inject;
import javax.inject.Provider;
-import kotlin.Unit;
import kotlinx.coroutines.CoroutineDispatcher;
@CentralSurfacesComponent.CentralSurfacesScope
public final class NotificationPanelViewController implements ShadeSurface, Dumpable {
public static final String TAG = NotificationPanelView.class.getSimpleName();
- public static final float FLING_MAX_LENGTH_SECONDS = 0.6f;
- public static final float FLING_SPEED_UP_FACTOR = 0.6f;
- public static final float FLING_CLOSING_MAX_LENGTH_SECONDS = 0.6f;
- public static final float FLING_CLOSING_SPEED_UP_FACTOR = 0.6f;
- public static final int WAKEUP_ANIMATION_DELAY_MS = 250;
private static final boolean DEBUG_LOGCAT = Compile.IS_DEBUG && Log.isLoggable(TAG, Log.DEBUG);
private static final boolean SPEW_LOGCAT = Compile.IS_DEBUG && Log.isLoggable(TAG, Log.VERBOSE);
private static final boolean DEBUG_DRAWABLE = false;
@@ -253,12 +249,6 @@
VibrationEffect.get(VibrationEffect.EFFECT_STRENGTH_MEDIUM, false);
/** The parallax amount of the quick settings translation when dragging down the panel. */
public static final float QS_PARALLAX_AMOUNT = 0.175f;
- /** Fling expanding QS. */
- public static final int FLING_EXPAND = 0;
- /** Fling collapsing QS, potentially stopping when QS becomes QQS. */
- public static final int FLING_COLLAPSE = 1;
- /** Fling until QS is completely hidden. */
- public static final int FLING_HIDE = 2;
/** The delay to reset the hint text when the hint animation is finished running. */
private static final int HINT_RESET_DELAY_MS = 1200;
private static final long ANIMATION_DELAY_ICON_FADE_IN =
@@ -868,8 +858,8 @@
mKeyguardBypassController = bypassController;
mUpdateMonitor = keyguardUpdateMonitor;
mLockscreenShadeTransitionController = lockscreenShadeTransitionController;
- lockscreenShadeTransitionController.setNotificationPanelController(this);
- shadeTransitionController.setNotificationPanelViewController(this);
+ lockscreenShadeTransitionController.setShadeViewController(this);
+ shadeTransitionController.setShadeViewController(this);
dynamicPrivacyController.addListener(this::onDynamicPrivacyChanged);
quickSettingsController.setExpansionHeightListener(this::onQsSetExpansionHeightCalled);
quickSettingsController.setQsStateUpdateListener(this::onQsStateUpdated);
@@ -1021,7 +1011,7 @@
mKeyguardStatusBarViewController =
mKeyguardStatusBarViewComponentFactory.build(
mKeyguardStatusBar,
- mNotificationPanelViewStateProvider)
+ mShadeViewStateProvider)
.getKeyguardStatusBarViewController();
mKeyguardStatusBarViewController.init();
@@ -1616,10 +1606,7 @@
return isOnAod();
}
- /**
- * Notify us that {@link NotificationWakeUpCoordinator} is going to play the doze wakeup
- * animation after a delay. If so, we'll keep the clock centered until that animation starts.
- */
+ @Override
public void setWillPlayDelayedDozeAmountAnimation(boolean willPlay) {
if (mWillPlayDelayedDozeAmountAnimation == willPlay) return;
@@ -4379,29 +4366,8 @@
}
}
- /**
- * An interface that provides the current state of the notification panel and related views,
- * which is needed to calculate {@link KeyguardStatusBarView}'s state in
- * {@link KeyguardStatusBarViewController}.
- */
- public interface NotificationPanelViewStateProvider {
- /** Returns the expanded height of the panel view. */
- float getPanelViewExpandedHeight();
-
- /**
- * Returns true if heads up should be visible.
- *
- * TODO(b/138786270): If HeadsUpAppearanceController was injectable, we could inject it into
- * {@link KeyguardStatusBarViewController} and remove this method.
- */
- boolean shouldHeadsUpBeVisible();
-
- /** Return the fraction of the shade that's expanded, when in lockscreen. */
- float getLockscreenShadeDragProgress();
- }
-
- private final NotificationPanelViewStateProvider mNotificationPanelViewStateProvider =
- new NotificationPanelViewStateProvider() {
+ private final ShadeViewStateProvider mShadeViewStateProvider =
+ new ShadeViewStateProvider() {
@Override
public float getPanelViewExpandedHeight() {
return getExpandedHeight();
@@ -4418,13 +4384,7 @@
}
};
- /**
- * Reconfigures the shade to show the AOD UI (clock, smartspace, etc). This is called by the
- * screen off animation controller in order to animate in AOD without "actually" fully switching
- * to the KEYGUARD state, which is a heavy transition that causes jank as 10+ files react to the
- * change.
- */
- @VisibleForTesting
+ @Override
public void showAodUi() {
setDozing(true /* dozing */, false /* animate */);
mStatusBarStateController.setUpcomingState(KEYGUARD);
diff --git a/packages/SystemUI/src/com/android/systemui/shade/ShadeLogger.kt b/packages/SystemUI/src/com/android/systemui/shade/ShadeLogger.kt
index a931838..1839e13 100644
--- a/packages/SystemUI/src/com/android/systemui/shade/ShadeLogger.kt
+++ b/packages/SystemUI/src/com/android/systemui/shade/ShadeLogger.kt
@@ -20,9 +20,9 @@
import com.android.systemui.log.dagger.ShadeLog
import com.android.systemui.plugins.log.LogBuffer
import com.android.systemui.plugins.log.LogLevel
-import com.android.systemui.shade.NotificationPanelViewController.FLING_COLLAPSE
-import com.android.systemui.shade.NotificationPanelViewController.FLING_EXPAND
-import com.android.systemui.shade.NotificationPanelViewController.FLING_HIDE
+import com.android.systemui.shade.ShadeViewController.Companion.FLING_COLLAPSE
+import com.android.systemui.shade.ShadeViewController.Companion.FLING_EXPAND
+import com.android.systemui.shade.ShadeViewController.Companion.FLING_HIDE
import com.google.errorprone.annotations.CompileTimeConstant
import javax.inject.Inject
diff --git a/packages/SystemUI/src/com/android/systemui/shade/ShadeSurface.kt b/packages/SystemUI/src/com/android/systemui/shade/ShadeSurface.kt
index b698bd3..5ac36bf 100644
--- a/packages/SystemUI/src/com/android/systemui/shade/ShadeSurface.kt
+++ b/packages/SystemUI/src/com/android/systemui/shade/ShadeSurface.kt
@@ -94,6 +94,12 @@
fun setTouchAndAnimationDisabled(disabled: Boolean)
/**
+ * Notify us that {@link NotificationWakeUpCoordinator} is going to play the doze wakeup
+ * animation after a delay. If so, we'll keep the clock centered until that animation starts.
+ */
+ fun setWillPlayDelayedDozeAmountAnimation(willPlay: Boolean)
+
+ /**
* Sets the dozing state.
*
* @param dozing `true` when dozing.
@@ -104,18 +110,12 @@
/** @see view.setImportantForAccessibility */
fun setImportantForAccessibility(mode: Int)
- /** Sets Qs ScrimEnabled and updates QS state. */
- fun setQsScrimEnabled(qsScrimEnabled: Boolean)
-
/** Sets the view's X translation to zero. */
fun resetTranslation()
/** Sets the view's alpha to max. */
fun resetAlpha()
- /** @see ViewGroupFadeHelper.reset */
- fun resetViewGroupFade()
-
/** Called when Back gesture has been committed (i.e. a back event has definitely occurred) */
fun onBackPressed()
diff --git a/packages/SystemUI/src/com/android/systemui/shade/ShadeViewController.kt b/packages/SystemUI/src/com/android/systemui/shade/ShadeViewController.kt
index b6a2a8a..d5a9e95 100644
--- a/packages/SystemUI/src/com/android/systemui/shade/ShadeViewController.kt
+++ b/packages/SystemUI/src/com/android/systemui/shade/ShadeViewController.kt
@@ -22,6 +22,8 @@
import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayoutController
import com.android.systemui.statusbar.phone.HeadsUpAppearanceController
import com.android.systemui.statusbar.phone.KeyguardBottomAreaView
+import com.android.systemui.statusbar.phone.KeyguardStatusBarView
+import com.android.systemui.statusbar.phone.KeyguardStatusBarViewController
import java.util.function.Consumer
/**
@@ -147,6 +149,9 @@
/** Sets whether the screen has temporarily woken up to display notifications. */
fun setPulsing(pulsing: Boolean)
+ /** Sets Qs ScrimEnabled and updates QS state. */
+ fun setQsScrimEnabled(qsScrimEnabled: Boolean)
+
/** Sets the top spacing for the ambient indicator. */
fun setAmbientIndicationTop(ambientIndicationTop: Int, ambientTextVisible: Boolean)
@@ -166,6 +171,9 @@
*/
val isUnlockHintRunning: Boolean
+ /** @see ViewGroupFadeHelper.reset */
+ fun resetViewGroupFade()
+
/**
* Set the alpha and translationY of the keyguard elements which only show on the lockscreen,
* but not in shade locked / shade. This is used when dragging down to the full shade.
@@ -183,6 +191,14 @@
fun setKeyguardStatusBarAlpha(alpha: Float)
/**
+ * Reconfigures the shade to show the AOD UI (clock, smartspace, etc). This is called by the
+ * screen off animation controller in order to animate in AOD without "actually" fully switching
+ * to the KEYGUARD state, which is a heavy transition that causes jank as 10+ files react to the
+ * change.
+ */
+ fun showAodUi()
+
+ /**
* This method should not be used anymore, you should probably use [.isShadeFullyOpen] instead.
* It was overused as indicating if shade is open or we're on keyguard/AOD. Moving forward we
* should be explicit about the what state we're checking.
@@ -208,6 +224,23 @@
/** Returns the ShadeNotificationPresenter. */
val shadeNotificationPresenter: ShadeNotificationPresenter
+
+ companion object {
+ const val WAKEUP_ANIMATION_DELAY_MS = 250
+ const val FLING_MAX_LENGTH_SECONDS = 0.6f
+ const val FLING_SPEED_UP_FACTOR = 0.6f
+ const val FLING_CLOSING_MAX_LENGTH_SECONDS = 0.6f
+ const val FLING_CLOSING_SPEED_UP_FACTOR = 0.6f
+
+ /** Fling expanding QS. */
+ const val FLING_EXPAND = 0
+
+ /** Fling collapsing QS, potentially stopping when QS becomes QQS. */
+ const val FLING_COLLAPSE = 1
+
+ /** Fling until QS is completely hidden. */
+ const val FLING_HIDE = 2
+ }
}
/** Manages listeners for when users begin expanding the shade from a HUN. */
@@ -254,3 +287,23 @@
/** Returns whether the screen has temporarily woken up to display notifications. */
fun hasPulsingNotifications(): Boolean
}
+
+/**
+ * An interface that provides the current state of the notification panel and related views, which
+ * is needed to calculate [KeyguardStatusBarView]'s state in [KeyguardStatusBarViewController].
+ */
+interface ShadeViewStateProvider {
+ /** Returns the expanded height of the panel view. */
+ val panelViewExpandedHeight: Float
+
+ /**
+ * Returns true if heads up should be visible.
+ *
+ * TODO(b/138786270): If HeadsUpAppearanceController was injectable, we could inject it into
+ * [KeyguardStatusBarViewController] and remove this method.
+ */
+ fun shouldHeadsUpBeVisible(): Boolean
+
+ /** Return the fraction of the shade that's expanded, when in lockscreen. */
+ val lockscreenShadeDragProgress: Float
+}
diff --git a/packages/SystemUI/src/com/android/systemui/shade/transition/ShadeTransitionController.kt b/packages/SystemUI/src/com/android/systemui/shade/transition/ShadeTransitionController.kt
index 129d09e..41be526 100644
--- a/packages/SystemUI/src/com/android/systemui/shade/transition/ShadeTransitionController.kt
+++ b/packages/SystemUI/src/com/android/systemui/shade/transition/ShadeTransitionController.kt
@@ -22,10 +22,10 @@
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.dump.DumpManager
import com.android.systemui.plugins.qs.QS
-import com.android.systemui.shade.NotificationPanelViewController
import com.android.systemui.shade.PanelState
import com.android.systemui.shade.ShadeExpansionChangeEvent
import com.android.systemui.shade.ShadeExpansionStateManager
+import com.android.systemui.shade.ShadeViewController
import com.android.systemui.shade.panelStateToString
import com.android.systemui.statusbar.StatusBarState
import com.android.systemui.statusbar.SysuiStatusBarStateController
@@ -47,7 +47,7 @@
private val statusBarStateController: SysuiStatusBarStateController,
) {
- lateinit var notificationPanelViewController: NotificationPanelViewController
+ lateinit var shadeViewController: ShadeViewController
lateinit var notificationStackScrollLayoutController: NotificationStackScrollLayoutController
lateinit var qs: QS
@@ -93,7 +93,7 @@
currentPanelState: ${currentPanelState?.panelStateToString()}
lastPanelExpansionChangeEvent: $lastShadeExpansionChangeEvent
qs.isInitialized: ${this::qs.isInitialized}
- npvc.isInitialized: ${this::notificationPanelViewController.isInitialized}
+ npvc.isInitialized: ${this::shadeViewController.isInitialized}
nssl.isInitialized: ${this::notificationStackScrollLayoutController.isInitialized}
""".trimIndent())
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/LockscreenShadeKeyguardTransitionController.kt b/packages/SystemUI/src/com/android/systemui/statusbar/LockscreenShadeKeyguardTransitionController.kt
index 5fb5002..fec6112 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/LockscreenShadeKeyguardTransitionController.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/LockscreenShadeKeyguardTransitionController.kt
@@ -6,7 +6,7 @@
import com.android.systemui.R
import com.android.systemui.dump.DumpManager
import com.android.systemui.media.controls.ui.MediaHierarchyManager
-import com.android.systemui.shade.NotificationPanelViewController
+import com.android.systemui.shade.ShadeViewController
import com.android.systemui.statusbar.policy.ConfigurationController
import dagger.assisted.Assisted
import dagger.assisted.AssistedFactory
@@ -17,7 +17,7 @@
@AssistedInject
constructor(
private val mediaHierarchyManager: MediaHierarchyManager,
- @Assisted private val notificationPanelController: NotificationPanelViewController,
+ @Assisted private val notificationPanelController: ShadeViewController,
context: Context,
configurationController: ConfigurationController,
dumpManager: DumpManager
@@ -114,7 +114,7 @@
@AssistedFactory
fun interface Factory {
fun create(
- notificationPanelController: NotificationPanelViewController
+ notificationPanelController: ShadeViewController
): LockscreenShadeKeyguardTransitionController
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/LockscreenShadeTransitionController.kt b/packages/SystemUI/src/com/android/systemui/statusbar/LockscreenShadeTransitionController.kt
index 792939b..faf592e 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/LockscreenShadeTransitionController.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/LockscreenShadeTransitionController.kt
@@ -30,7 +30,7 @@
import com.android.systemui.plugins.FalsingManager
import com.android.systemui.plugins.qs.QS
import com.android.systemui.plugins.statusbar.StatusBarStateController
-import com.android.systemui.shade.NotificationPanelViewController
+import com.android.systemui.shade.ShadeViewController
import com.android.systemui.statusbar.notification.collection.NotificationEntry
import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow
import com.android.systemui.statusbar.notification.row.ExpandableView
@@ -79,7 +79,7 @@
private set
private var useSplitShade: Boolean = false
private lateinit var nsslController: NotificationStackScrollLayoutController
- lateinit var notificationPanelController: NotificationPanelViewController
+ lateinit var shadeViewController: ShadeViewController
lateinit var centralSurfaces: CentralSurfaces
lateinit var qS: QS
@@ -182,7 +182,7 @@
}
private val keyguardTransitionController by lazy {
- keyguardTransitionControllerFactory.create(notificationPanelController)
+ keyguardTransitionControllerFactory.create(shadeViewController)
}
private val qsTransitionController = qsTransitionControllerFactory.create { qS }
@@ -319,7 +319,7 @@
startingChild.onExpandedByGesture(
true /* drag down is always an open */)
}
- notificationPanelController.transitionToExpandedShade(delay)
+ shadeViewController.transitionToExpandedShade(delay)
callbacks.forEach { it.setTransitionToFullShadeAmount(0f,
true /* animated */, delay) }
@@ -530,7 +530,7 @@
} else {
// Let's only animate notifications
animationHandler = { delay: Long ->
- notificationPanelController.transitionToExpandedShade(delay)
+ shadeViewController.transitionToExpandedShade(delay)
}
}
goToLockedShadeInternal(expandedView, animationHandler,
@@ -648,7 +648,7 @@
*/
private fun performDefaultGoToFullShadeAnimation(delay: Long) {
logger.logDefaultGoToFullShadeAnimation(delay)
- notificationPanelController.transitionToExpandedShade(delay)
+ shadeViewController.transitionToExpandedShade(delay)
animateAppear(delay)
}
@@ -673,7 +673,7 @@
} else {
pulseHeight = height
val overflow = nsslController.setPulseHeight(height)
- notificationPanelController.setOverStretchAmount(overflow)
+ shadeViewController.setOverStretchAmount(overflow)
val transitionHeight = if (keyguardBypassController.bypassEnabled) height else 0.0f
transitionToShadeAmountCommon(transitionHeight)
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationMediaManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationMediaManager.java
index ea9817c..72ae16e 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationMediaManager.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationMediaManager.java
@@ -24,6 +24,7 @@
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.app.Notification;
+import android.app.WallpaperManager;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
@@ -43,6 +44,7 @@
import android.view.View;
import android.widget.ImageView;
+import com.android.internal.annotations.VisibleForTesting;
import com.android.systemui.Dumpable;
import com.android.systemui.animation.Interpolators;
import com.android.systemui.colorextraction.SysuiColorExtractor;
@@ -117,6 +119,8 @@
private ScrimController mScrimController;
@Nullable
private LockscreenWallpaper mLockscreenWallpaper;
+ @VisibleForTesting
+ boolean mIsLockscreenLiveWallpaperEnabled;
private final DelayableExecutor mMainExecutor;
@@ -179,7 +183,8 @@
StatusBarStateController statusBarStateController,
SysuiColorExtractor colorExtractor,
KeyguardStateController keyguardStateController,
- DumpManager dumpManager) {
+ DumpManager dumpManager,
+ WallpaperManager wallpaperManager) {
mContext = context;
mMediaArtworkProcessor = mediaArtworkProcessor;
mKeyguardBypassController = keyguardBypassController;
@@ -195,6 +200,7 @@
mStatusBarStateController = statusBarStateController;
mColorExtractor = colorExtractor;
mKeyguardStateController = keyguardStateController;
+ mIsLockscreenLiveWallpaperEnabled = wallpaperManager.isLockscreenLiveWallpaperEnabled();
setupNotifPipeline();
@@ -474,13 +480,16 @@
* Refresh or remove lockscreen artwork from media metadata or the lockscreen wallpaper.
*/
public void updateMediaMetaData(boolean metaDataChanged, boolean allowEnterAnimation) {
+
+ if (mIsLockscreenLiveWallpaperEnabled) return;
+
Trace.beginSection("CentralSurfaces#updateMediaMetaData");
if (!SHOW_LOCKSCREEN_MEDIA_ARTWORK) {
Trace.endSection();
return;
}
- if (mBackdrop == null) {
+ if (getBackDropView() == null) {
Trace.endSection();
return; // called too early
}
@@ -709,6 +718,12 @@
&& (mBackdropFront.isVisibleToUser() || mBackdropBack.isVisibleToUser());
}
+ // TODO(b/273443374) temporary test helper; remove
+ @VisibleForTesting
+ BackDropView getBackDropView() {
+ return mBackdrop;
+ }
+
/**
* {@link AsyncTask} to prepare album art for use as backdrop on lock screen.
*/
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/dagger/CentralSurfacesDependenciesModule.java b/packages/SystemUI/src/com/android/systemui/statusbar/dagger/CentralSurfacesDependenciesModule.java
index 34300c7..f6c9a5c 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/dagger/CentralSurfacesDependenciesModule.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/dagger/CentralSurfacesDependenciesModule.java
@@ -17,6 +17,7 @@
package com.android.systemui.statusbar.dagger;
import android.app.IActivityManager;
+import android.app.WallpaperManager;
import android.content.Context;
import android.os.RemoteException;
import android.service.dreams.IDreamManager;
@@ -142,7 +143,8 @@
StatusBarStateController statusBarStateController,
SysuiColorExtractor colorExtractor,
KeyguardStateController keyguardStateController,
- DumpManager dumpManager) {
+ DumpManager dumpManager,
+ WallpaperManager wallpaperManager) {
return new NotificationMediaManager(
context,
centralSurfacesOptionalLazy,
@@ -157,7 +159,8 @@
statusBarStateController,
colorExtractor,
keyguardStateController,
- dumpManager);
+ dumpManager,
+ wallpaperManager);
}
/** */
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationWakeUpCoordinator.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationWakeUpCoordinator.kt
index 20af6ca..fe0b28d 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationWakeUpCoordinator.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationWakeUpCoordinator.kt
@@ -26,9 +26,9 @@
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.dump.DumpManager
import com.android.systemui.plugins.statusbar.StatusBarStateController
-import com.android.systemui.shade.NotificationPanelViewController.WAKEUP_ANIMATION_DELAY_MS
import com.android.systemui.shade.ShadeExpansionChangeEvent
import com.android.systemui.shade.ShadeExpansionListener
+import com.android.systemui.shade.ShadeViewController
import com.android.systemui.statusbar.StatusBarState
import com.android.systemui.statusbar.notification.collection.NotificationEntry
import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayoutController
@@ -383,7 +383,7 @@
ObjectAnimator.ofFloat(this, delayedDozeAmount, 0.0f).apply {
interpolator = InterpolatorsAndroidX.LINEAR
duration = StackStateAnimator.ANIMATION_DURATION_WAKEUP.toLong()
- startDelay = WAKEUP_ANIMATION_DELAY_MS.toLong()
+ startDelay = ShadeViewController.WAKEUP_ANIMATION_DELAY_MS.toLong()
doOnStart {
wakeUpListeners.forEach { it.onDelayedDozeAmountAnimationRunning(true) }
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfaces.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfaces.java
index 00928b2..f579d30 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfaces.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfaces.java
@@ -48,9 +48,9 @@
import com.android.systemui.plugins.ActivityStarter;
import com.android.systemui.plugins.statusbar.NotificationSwipeActionHelper;
import com.android.systemui.qs.QSPanelController;
-import com.android.systemui.shade.NotificationPanelViewController;
import com.android.systemui.shade.NotificationShadeWindowView;
import com.android.systemui.shade.NotificationShadeWindowViewController;
+import com.android.systemui.shade.ShadeViewController;
import com.android.systemui.statusbar.LightRevealScrim;
import com.android.systemui.statusbar.NotificationPresenter;
import com.android.systemui.util.Compile;
@@ -218,7 +218,8 @@
NotificationShadeWindowViewController getNotificationShadeWindowViewController();
- NotificationPanelViewController getNotificationPanelViewController();
+ /** */
+ ShadeViewController getShadeViewController();
/** Get the Keyguard Message Area that displays auth messages. */
AuthKeyguardMessageArea getKeyguardMessageArea();
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesCommandQueueCallbacks.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesCommandQueueCallbacks.java
index 8b6617b..c0a7a34 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesCommandQueueCallbacks.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesCommandQueueCallbacks.java
@@ -54,9 +54,9 @@
import com.android.systemui.qs.QSPanelController;
import com.android.systemui.settings.UserTracker;
import com.android.systemui.shade.CameraLauncher;
-import com.android.systemui.shade.NotificationPanelViewController;
import com.android.systemui.shade.QuickSettingsController;
import com.android.systemui.shade.ShadeController;
+import com.android.systemui.shade.ShadeViewController;
import com.android.systemui.statusbar.CommandQueue;
import com.android.systemui.statusbar.VibratorHelper;
import com.android.systemui.statusbar.disableflags.DisableFlagsLogger;
@@ -80,7 +80,7 @@
private final Context mContext;
private final com.android.systemui.shade.ShadeController mShadeController;
private final CommandQueue mCommandQueue;
- private final NotificationPanelViewController mNotificationPanelViewController;
+ private final ShadeViewController mShadeViewController;
private final RemoteInputQuickSettingsDisabler mRemoteInputQuickSettingsDisabler;
private final MetricsLogger mMetricsLogger;
private final KeyguardUpdateMonitor mKeyguardUpdateMonitor;
@@ -117,7 +117,7 @@
@Main Resources resources,
ShadeController shadeController,
CommandQueue commandQueue,
- NotificationPanelViewController notificationPanelViewController,
+ ShadeViewController shadeViewController,
RemoteInputQuickSettingsDisabler remoteInputQuickSettingsDisabler,
MetricsLogger metricsLogger,
KeyguardUpdateMonitor keyguardUpdateMonitor,
@@ -144,7 +144,7 @@
mContext = context;
mShadeController = shadeController;
mCommandQueue = commandQueue;
- mNotificationPanelViewController = notificationPanelViewController;
+ mShadeViewController = shadeViewController;
mRemoteInputQuickSettingsDisabler = remoteInputQuickSettingsDisabler;
mMetricsLogger = metricsLogger;
mKeyguardUpdateMonitor = keyguardUpdateMonitor;
@@ -218,7 +218,7 @@
return;
}
- mNotificationPanelViewController.expandToNotifications();
+ mShadeViewController.expandToNotifications();
}
@Override
@@ -234,7 +234,7 @@
// Settings are not available in setup
if (!mDeviceProvisionedController.isCurrentUserSetup()) return;
- mNotificationPanelViewController.expandToQs();
+ mShadeViewController.expandToQs();
}
@Override
@@ -300,7 +300,7 @@
}
}
- mNotificationPanelViewController.disableHeader(state1, state2, animate);
+ mShadeViewController.disableHeader(state1, state2, animate);
}
/**
@@ -322,22 +322,22 @@
if (KeyEvent.KEYCODE_SYSTEM_NAVIGATION_UP == key.getKeyCode()) {
mMetricsLogger.action(MetricsEvent.ACTION_SYSTEM_NAVIGATION_KEY_UP);
- mNotificationPanelViewController.collapse(
+ mShadeViewController.collapse(
false /* delayed */, 1.0f /* speedUpFactor */);
} else if (KeyEvent.KEYCODE_SYSTEM_NAVIGATION_DOWN == key.getKeyCode()) {
mMetricsLogger.action(MetricsEvent.ACTION_SYSTEM_NAVIGATION_KEY_DOWN);
- if (mNotificationPanelViewController.isFullyCollapsed()) {
+ if (mShadeViewController.isFullyCollapsed()) {
if (mVibrateOnOpening) {
mVibratorHelper.vibrate(VibrationEffect.EFFECT_TICK);
}
- mNotificationPanelViewController.expand(true /* animate */);
+ mShadeViewController.expand(true /* animate */);
mNotificationStackScrollLayoutController.setWillExpand(true);
mHeadsUpManager.unpinAll(true /* userUnpinned */);
mMetricsLogger.count("panel_open", 1);
} else if (!mQsController.getExpanded()
- && !mNotificationPanelViewController.isExpanding()) {
+ && !mShadeViewController.isExpanding()) {
mQsController.flingQs(0 /* velocity */,
- NotificationPanelViewController.FLING_EXPAND);
+ ShadeViewController.FLING_EXPAND);
mMetricsLogger.count("panel_open_qs", 1);
}
}
@@ -355,7 +355,7 @@
return;
}
if (!mCameraLauncherLazy.get().canCameraGestureBeLaunched(
- mNotificationPanelViewController.getBarState())) {
+ mShadeViewController.getBarState())) {
if (CentralSurfaces.DEBUG_CAMERA_LIFT) {
Slog.d(CentralSurfaces.TAG, "Can't launch camera right now");
}
@@ -394,7 +394,7 @@
mStatusBarKeyguardViewManager.reset(true /* hide */);
}
mCameraLauncherLazy.get().launchCamera(source,
- mNotificationPanelViewController.isFullyCollapsed());
+ mShadeViewController.isFullyCollapsed());
mCentralSurfaces.updateScrimController();
} else {
// We need to defer the camera launch until the screen comes on, since otherwise
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java
index cf2c9de..fab334c 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java
@@ -193,6 +193,8 @@
import com.android.systemui.shade.ShadeExpansionStateManager;
import com.android.systemui.shared.recents.utilities.Utilities;
import com.android.systemui.shade.ShadeLogger;
+import com.android.systemui.shade.ShadeSurface;
+import com.android.systemui.shade.ShadeViewController;
import com.android.systemui.statusbar.AutoHideUiElement;
import com.android.systemui.statusbar.BackDropView;
import com.android.systemui.statusbar.CircleReveal;
@@ -505,7 +507,7 @@
/** Controller for the Shade. */
@VisibleForTesting
- NotificationPanelViewController mNotificationPanelViewController;
+ ShadeSurface mShadeSurface;
private final ShadeLogger mShadeLogger;
// settings
@@ -698,9 +700,9 @@
@Override
public void onBackProgressed(BackEvent event) {
if (shouldBackBeHandled()) {
- if (mNotificationPanelViewController.canBeCollapsed()) {
+ if (mShadeSurface.canBeCollapsed()) {
float fraction = event.getProgress();
- mNotificationPanelViewController.onBackProgressed(fraction);
+ mShadeSurface.onBackProgressed(fraction);
}
}
}
@@ -1085,7 +1087,7 @@
this,
mStatusBarKeyguardViewManager,
mNotificationShadeWindowViewController,
- mNotificationPanelViewController,
+ mShadeSurface,
mAmbientIndicationContainer);
updateLightRevealScrimVisibility();
@@ -1271,7 +1273,7 @@
// re-display the notification panel if necessary (for example, if
// a heads-up notification was being displayed and should continue being
// displayed).
- mNotificationPanelViewController.updateExpansionAndVisibility();
+ mShadeSurface.updateExpansionAndVisibility();
setBouncerShowingForStatusBarComponents(mBouncerShowing);
checkBarModes();
});
@@ -1346,7 +1348,7 @@
mScreenOffAnimationController.initialize(this, mLightRevealScrim);
updateLightRevealScrimVisibility();
- mNotificationPanelViewController.initDependencies(
+ mShadeSurface.initDependencies(
this,
mGestureRec,
mShadeController::makeExpandedInvisible,
@@ -1354,8 +1356,13 @@
mHeadsUpManager);
BackDropView backdrop = mNotificationShadeWindowView.findViewById(R.id.backdrop);
- mMediaManager.setup(backdrop, backdrop.findViewById(R.id.backdrop_front),
- backdrop.findViewById(R.id.backdrop_back), mScrimController, mLockscreenWallpaper);
+ if (mWallpaperManager.isLockscreenLiveWallpaperEnabled()) {
+ mMediaManager.setup(null, null, null, mScrimController, null);
+ } else {
+ mMediaManager.setup(backdrop, backdrop.findViewById(R.id.backdrop_front),
+ backdrop.findViewById(R.id.backdrop_back), mScrimController,
+ mLockscreenWallpaper);
+ }
float maxWallpaperZoom = mContext.getResources().getFloat(
com.android.internal.R.dimen.config_wallpaperMaxScale);
mNotificationShadeDepthControllerLazy.get().addListener(depth -> {
@@ -1383,7 +1390,7 @@
.build());
mBrightnessMirrorController = new BrightnessMirrorController(
mNotificationShadeWindowView,
- mNotificationPanelViewController,
+ mShadeSurface,
mNotificationShadeDepthControllerLazy.get(),
mBrightnessSliderFactory,
(visible) -> {
@@ -1483,7 +1490,7 @@
|| !mKeyguardStateController.canDismissLockScreen()
|| mKeyguardViewMediator.isAnySimPinSecure()
|| (mQsController.getExpanded() && trackingTouch)
- || mNotificationPanelViewController.getBarState() == StatusBarState.SHADE_LOCKED) {
+ || mShadeSurface.getBarState() == StatusBarState.SHADE_LOCKED) {
return;
}
@@ -1503,8 +1510,8 @@
boolean tracking = event.getTracking();
dispatchPanelExpansionForKeyguardDismiss(fraction, tracking);
- if (getNotificationPanelViewController() != null) {
- getNotificationPanelViewController().updateSystemUiStateFlags();
+ if (getShadeViewController() != null) {
+ getShadeViewController().updateSystemUiStateFlags();
}
if (fraction == 0 || fraction == 1) {
@@ -1632,9 +1639,10 @@
.getNotificationShadeWindowViewController();
mNotificationShadeWindowController.setNotificationShadeView(mNotificationShadeWindowView);
mNotificationShadeWindowViewController.setupExpandedStatusBar();
- mNotificationPanelViewController =
+ NotificationPanelViewController npvc =
mCentralSurfacesComponent.getNotificationPanelViewController();
- mShadeController.setNotificationPanelViewController(mNotificationPanelViewController);
+ mShadeSurface = npvc;
+ mShadeController.setNotificationPanelViewController(npvc);
mShadeController.setNotificationShadeWindowViewController(
mNotificationShadeWindowViewController);
mCentralSurfacesComponent.getLockIconViewController().init();
@@ -1700,7 +1708,7 @@
});
mKeyguardViewMediator.registerCentralSurfaces(
/* statusBar= */ this,
- mNotificationPanelViewController,
+ mShadeSurface,
mShadeExpansionStateManager,
mBiometricUnlockController,
mStackScroller,
@@ -1728,8 +1736,8 @@
}
@Override
- public NotificationPanelViewController getNotificationPanelViewController() {
- return mNotificationPanelViewController;
+ public ShadeViewController getShadeViewController() {
+ return mShadeSurface;
}
@Override
@@ -2086,16 +2094,16 @@
}
if (start) {
- mNotificationPanelViewController.startWaitingForExpandGesture();
+ mShadeSurface.startWaitingForExpandGesture();
} else {
- mNotificationPanelViewController.stopWaitingForExpandGesture(cancel, velocity);
+ mShadeSurface.stopWaitingForExpandGesture(cancel, velocity);
}
}
@Override
public void animateCollapseQuickSettings() {
if (mState == StatusBarState.SHADE) {
- mNotificationPanelViewController.collapse(
+ mShadeSurface.collapse(
true, false /* delayed */, 1.0f /* speedUpFactor */);
}
}
@@ -2720,7 +2728,7 @@
*/
@Override
public void setLockscreenUser(int newUserId) {
- if (mLockscreenWallpaper != null) {
+ if (mLockscreenWallpaper != null && !mWallpaperManager.isLockscreenLiveWallpaperEnabled()) {
mLockscreenWallpaper.setCurrentUser(newUserId);
}
mScrimController.setCurrentUser(newUserId);
@@ -2746,8 +2754,8 @@
mStatusBarWindowController.refreshStatusBarHeight();
}
- if (mNotificationPanelViewController != null) {
- mNotificationPanelViewController.updateResources();
+ if (mShadeSurface != null) {
+ mShadeSurface.updateResources();
}
if (mBrightnessMirrorController != null) {
mBrightnessMirrorController.updateResources();
@@ -3005,7 +3013,7 @@
public void showKeyguardImpl() {
Trace.beginSection("CentralSurfaces#showKeyguard");
if (mKeyguardStateController.isLaunchTransitionFadingAway()) {
- mNotificationPanelViewController.cancelAnimation();
+ mShadeSurface.cancelAnimation();
onLaunchTransitionFadingEnded();
}
mMessageRouter.cancelMessages(MSG_LAUNCH_TRANSITION_TIMEOUT);
@@ -3024,7 +3032,7 @@
}
private void onLaunchTransitionFadingEnded() {
- mNotificationPanelViewController.resetAlpha();
+ mShadeSurface.resetAlpha();
mCameraLauncherLazy.get().setLaunchingAffordance(false);
releaseGestureWakeLock();
runLaunchTransitionEndRunnable();
@@ -3054,8 +3062,8 @@
}
updateScrimController();
mPresenter.updateMediaMetaData(false, true);
- mNotificationPanelViewController.resetAlpha();
- mNotificationPanelViewController.fadeOut(
+ mShadeSurface.resetAlpha();
+ mShadeSurface.fadeOut(
FADE_KEYGUARD_START_DELAY, FADE_KEYGUARD_DURATION,
this::onLaunchTransitionFadingEnded);
mCommandQueue.appTransitionStarting(mDisplayId, SystemClock.uptimeMillis(),
@@ -3087,7 +3095,7 @@
Log.w(TAG, "Launch transition: Timeout!");
mCameraLauncherLazy.get().setLaunchingAffordance(false);
releaseGestureWakeLock();
- mNotificationPanelViewController.resetViews(false /* animate */);
+ mShadeSurface.resetViews(false /* animate */);
}
private void runLaunchTransitionEndRunnable() {
@@ -3127,7 +3135,7 @@
// Disable layout transitions in navbar for this transition because the load is just
// too heavy for the CPU and GPU on any device.
mNavigationBarController.disableAnimationsDuringHide(mDisplayId, delay);
- } else if (!mNotificationPanelViewController.isCollapsing()) {
+ } else if (!mShadeSurface.isCollapsing()) {
mShadeController.instantCollapseShade();
}
@@ -3139,9 +3147,9 @@
mMessageRouter.cancelMessages(MSG_LAUNCH_TRANSITION_TIMEOUT);
releaseGestureWakeLock();
mCameraLauncherLazy.get().setLaunchingAffordance(false);
- mNotificationPanelViewController.resetAlpha();
- mNotificationPanelViewController.resetTranslation();
- mNotificationPanelViewController.resetViewGroupFade();
+ mShadeSurface.resetAlpha();
+ mShadeSurface.resetTranslation();
+ mShadeSurface.resetViewGroupFade();
updateDozingState();
updateScrimController();
Trace.endSection();
@@ -3243,7 +3251,7 @@
boolean animate = (!mDozing && shouldAnimateDozeWakeup())
|| (mDozing && mDozeParameters.shouldControlScreenOff() && keyguardVisibleOrWillBe);
- mNotificationPanelViewController.setDozing(mDozing, animate);
+ mShadeSurface.setDozing(mDozing, animate);
updateQsExpansionEnabled();
Trace.endSection();
}
@@ -3323,16 +3331,16 @@
return true;
}
if (mQsController.getExpanded()) {
- mNotificationPanelViewController.animateCollapseQs(false);
+ mShadeSurface.animateCollapseQs(false);
return true;
}
- if (mNotificationPanelViewController.closeUserSwitcherIfOpen()) {
+ if (mShadeSurface.closeUserSwitcherIfOpen()) {
return true;
}
if (shouldBackBeHandled()) {
- if (mNotificationPanelViewController.canBeCollapsed()) {
+ if (mShadeSurface.canBeCollapsed()) {
// this is the Shade dismiss animation, so make sure QQS closes when it ends.
- mNotificationPanelViewController.onBackPressed();
+ mShadeSurface.onBackPressed();
mShadeController.animateCollapseShade();
}
return true;
@@ -3508,8 +3516,8 @@
if (mPhoneStatusBarViewController != null) {
mPhoneStatusBarViewController.setImportantForAccessibility(importance);
}
- mNotificationPanelViewController.setImportantForAccessibility(importance);
- mNotificationPanelViewController.setBouncerShowing(bouncerShowing);
+ mShadeSurface.setImportantForAccessibility(importance);
+ mShadeSurface.setBouncerShowing(bouncerShowing);
}
/**
@@ -3517,7 +3525,7 @@
*/
@Override
public void collapseShade() {
- if (mNotificationPanelViewController.isTracking()) {
+ if (mShadeSurface.isTracking()) {
mNotificationShadeWindowViewController.cancelCurrentTouch();
}
if (mPanelExpanded && mState == StatusBarState.SHADE) {
@@ -3621,7 +3629,7 @@
}
}
- mNotificationPanelViewController.setWillPlayDelayedDozeAmountAnimation(
+ mShadeSurface.setWillPlayDelayedDozeAmountAnimation(
mShouldDelayWakeUpAnimation);
mWakeUpCoordinator.setWakingUp(
/* wakingUp= */ true,
@@ -3663,12 +3671,12 @@
// So if AOD is off or unsupported we need to trigger these updates at screen on
// when the keyguard is occluded.
mLockscreenUserManager.updatePublicMode();
- mNotificationPanelViewController.getNotificationStackScrollLayoutController()
+ mShadeSurface.getNotificationStackScrollLayoutController()
.updateSensitivenessForOccludedWakeup();
}
if (mLaunchCameraWhenFinishedWaking) {
mCameraLauncherLazy.get().launchCamera(mLastCameraLaunchSource,
- mNotificationPanelViewController.isFullyCollapsed());
+ mShadeSurface.isFullyCollapsed());
mLaunchCameraWhenFinishedWaking = false;
}
if (mLaunchEmergencyActionWhenFinishedWaking) {
@@ -3699,7 +3707,7 @@
!mDozeParameters.shouldControlScreenOff(), !mDeviceInteractive,
!mDozeServiceHost.isPulsing(), mDeviceProvisionedController.isFrpActive());
- mNotificationPanelViewController.setTouchAndAnimationDisabled(disabled);
+ mShadeSurface.setTouchAndAnimationDisabled(disabled);
mNotificationIconAreaController.setAnimationsEnabled(!disabled);
}
@@ -3707,7 +3715,7 @@
@Override
public void onScreenTurningOn() {
mFalsingCollector.onScreenTurningOn();
- mNotificationPanelViewController.onScreenTurningOn();
+ mShadeSurface.onScreenTurningOn();
}
@Override
@@ -4351,7 +4359,7 @@
}
// We need the new R.id.keyguard_indication_area before recreating
// mKeyguardIndicationController
- mNotificationPanelViewController.onThemeChanged();
+ mShadeSurface.onThemeChanged();
if (mStatusBarKeyguardViewManager != null) {
mStatusBarKeyguardViewManager.onThemeChanged();
@@ -4397,7 +4405,7 @@
mNavigationBarController.touchAutoDim(mDisplayId);
Trace.beginSection("CentralSurfaces#updateKeyguardState");
if (mState == StatusBarState.KEYGUARD) {
- mNotificationPanelViewController.cancelPendingCollapse();
+ mShadeSurface.cancelPendingCollapse();
}
updateDozingState();
checkBarModes();
@@ -4423,7 +4431,7 @@
&& mDozeParameters.shouldControlScreenOff();
// resetting views is already done when going into doze, there's no need to
// reset them again when we're waking up
- mNotificationPanelViewController.resetViews(dozingAnimated && isDozing);
+ mShadeSurface.resetViews(dozingAnimated && isDozing);
updateQsExpansionEnabled();
mKeyguardViewMediator.setDozing(mDozing);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/DozeServiceHost.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/DozeServiceHost.java
index 5196e10..89c3946 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/DozeServiceHost.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/DozeServiceHost.java
@@ -37,8 +37,8 @@
import com.android.systemui.doze.DozeLog;
import com.android.systemui.doze.DozeReceiver;
import com.android.systemui.keyguard.WakefulnessLifecycle;
-import com.android.systemui.shade.NotificationPanelViewController;
import com.android.systemui.shade.NotificationShadeWindowViewController;
+import com.android.systemui.shade.ShadeViewController;
import com.android.systemui.statusbar.NotificationShadeWindowController;
import com.android.systemui.statusbar.PulseExpansionHandler;
import com.android.systemui.statusbar.StatusBarState;
@@ -50,12 +50,12 @@
import com.android.systemui.statusbar.policy.OnHeadsUpChangedListener;
import com.android.systemui.util.Assert;
+import dagger.Lazy;
+
import java.util.ArrayList;
import javax.inject.Inject;
-import dagger.Lazy;
-
/**
* Implementation of DozeHost for SystemUI.
*/
@@ -90,7 +90,7 @@
private final AuthController mAuthController;
private final NotificationIconAreaController mNotificationIconAreaController;
private StatusBarKeyguardViewManager mStatusBarKeyguardViewManager;
- private NotificationPanelViewController mNotificationPanel;
+ private ShadeViewController mNotificationPanel;
private View mAmbientIndicationContainer;
private CentralSurfaces mCentralSurfaces;
private boolean mAlwaysOnSuppressed;
@@ -141,7 +141,7 @@
CentralSurfaces centralSurfaces,
StatusBarKeyguardViewManager statusBarKeyguardViewManager,
NotificationShadeWindowViewController notificationShadeWindowViewController,
- NotificationPanelViewController notificationPanel,
+ ShadeViewController notificationPanel,
View ambientIndicationContainer) {
mCentralSurfaces = centralSurfaces;
mStatusBarKeyguardViewManager = statusBarKeyguardViewManager;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpAppearanceController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpAppearanceController.java
index 171e3d0..e705afc 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpAppearanceController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpAppearanceController.java
@@ -31,8 +31,8 @@
import com.android.systemui.flags.Flags;
import com.android.systemui.plugins.DarkIconDispatcher;
import com.android.systemui.plugins.statusbar.StatusBarStateController;
-import com.android.systemui.shade.NotificationPanelViewController;
import com.android.systemui.shade.ShadeHeadsUpTracker;
+import com.android.systemui.shade.ShadeViewController;
import com.android.systemui.statusbar.CommandQueue;
import com.android.systemui.statusbar.CrossFadeHelper;
import com.android.systemui.statusbar.HeadsUpStatusBarView;
@@ -76,7 +76,7 @@
private final NotificationStackScrollLayoutController mStackScrollerController;
private final DarkIconDispatcher mDarkIconDispatcher;
- private final NotificationPanelViewController mNotificationPanelViewController;
+ private final ShadeViewController mShadeViewController;
private final NotificationRoundnessManager mNotificationRoundnessManager;
private final boolean mUseRoundnessSourceTypes;
private final Consumer<ExpandableNotificationRow>
@@ -118,7 +118,7 @@
KeyguardStateController keyguardStateController,
CommandQueue commandQueue,
NotificationStackScrollLayoutController stackScrollerController,
- NotificationPanelViewController notificationPanelViewController,
+ ShadeViewController shadeViewController,
NotificationRoundnessManager notificationRoundnessManager,
FeatureFlags featureFlags,
HeadsUpStatusBarView headsUpStatusBarView,
@@ -134,13 +134,13 @@
// has started pulling down the notification shade from the HUN and then the font size
// changes). We need to re-fetch these values since they're used to correctly display the
// HUN during this shade expansion.
- mTrackedChild = notificationPanelViewController.getShadeHeadsUpTracker()
+ mTrackedChild = shadeViewController.getShadeHeadsUpTracker()
.getTrackedHeadsUpNotification();
mAppearFraction = stackScrollerController.getAppearFraction();
mExpandedHeight = stackScrollerController.getExpandedHeight();
mStackScrollerController = stackScrollerController;
- mNotificationPanelViewController = notificationPanelViewController;
+ mShadeViewController = shadeViewController;
mStackScrollerController.setHeadsUpAppearanceController(this);
mClockView = clockView;
mOperatorNameViewOptional = operatorNameViewOptional;
@@ -179,7 +179,7 @@
}
private ShadeHeadsUpTracker getShadeHeadsUpTracker() {
- return mNotificationPanelViewController.getShadeHeadsUpTracker();
+ return mShadeViewController.getShadeHeadsUpTracker();
}
@Override
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithm.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithm.java
index c163a89..90a6d0f 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithm.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithm.java
@@ -27,7 +27,7 @@
import com.android.keyguard.KeyguardStatusView;
import com.android.systemui.R;
import com.android.systemui.animation.Interpolators;
-import com.android.systemui.shade.NotificationPanelViewController;
+import com.android.systemui.shade.ShadeViewController;
import com.android.systemui.statusbar.policy.KeyguardUserSwitcherListView;
/**
@@ -84,7 +84,7 @@
private int mSplitShadeTargetTopMargin;
/**
- * @see NotificationPanelViewController#getExpandedFraction()
+ * @see ShadeViewController#getExpandedFraction()
*/
private float mPanelExpansion;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardStatusBarViewController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardStatusBarViewController.java
index 2814e8d..e835c5ce 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardStatusBarViewController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardStatusBarViewController.java
@@ -47,7 +47,7 @@
import com.android.systemui.dagger.qualifiers.Main;
import com.android.systemui.plugins.log.LogLevel;
import com.android.systemui.plugins.statusbar.StatusBarStateController;
-import com.android.systemui.shade.NotificationPanelViewController;
+import com.android.systemui.shade.ShadeViewStateProvider;
import com.android.systemui.statusbar.CommandQueue;
import com.android.systemui.statusbar.NotificationMediaManager;
import com.android.systemui.statusbar.StatusBarState;
@@ -69,6 +69,8 @@
import com.android.systemui.util.ViewController;
import com.android.systemui.util.settings.SecureSettings;
+import kotlin.Unit;
+
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;
@@ -76,8 +78,6 @@
import javax.inject.Inject;
-import kotlin.Unit;
-
/** View Controller for {@link com.android.systemui.statusbar.phone.KeyguardStatusBarView}. */
public class KeyguardStatusBarViewController extends ViewController<KeyguardStatusBarView> {
private static final String TAG = "KeyguardStatusBarViewController";
@@ -104,8 +104,7 @@
private final StatusBarIconController mStatusBarIconController;
private final StatusBarIconController.TintedIconManager.Factory mTintedIconManagerFactory;
private final BatteryMeterViewController mBatteryMeterViewController;
- private final NotificationPanelViewController.NotificationPanelViewStateProvider
- mNotificationPanelViewStateProvider;
+ private final ShadeViewStateProvider mShadeViewStateProvider;
private final KeyguardStateController mKeyguardStateController;
private final KeyguardBypassController mKeyguardBypassController;
private final KeyguardUpdateMonitor mKeyguardUpdateMonitor;
@@ -274,8 +273,7 @@
StatusBarIconController statusBarIconController,
StatusBarIconController.TintedIconManager.Factory tintedIconManagerFactory,
BatteryMeterViewController batteryMeterViewController,
- NotificationPanelViewController.NotificationPanelViewStateProvider
- notificationPanelViewStateProvider,
+ ShadeViewStateProvider shadeViewStateProvider,
KeyguardStateController keyguardStateController,
KeyguardBypassController bypassController,
KeyguardUpdateMonitor keyguardUpdateMonitor,
@@ -299,7 +297,7 @@
mStatusBarIconController = statusBarIconController;
mTintedIconManagerFactory = tintedIconManagerFactory;
mBatteryMeterViewController = batteryMeterViewController;
- mNotificationPanelViewStateProvider = notificationPanelViewStateProvider;
+ mShadeViewStateProvider = shadeViewStateProvider;
mKeyguardStateController = keyguardStateController;
mKeyguardBypassController = bypassController;
mKeyguardUpdateMonitor = keyguardUpdateMonitor;
@@ -470,7 +468,7 @@
/**
* Updates the {@link KeyguardStatusBarView} state based on what the
- * {@link NotificationPanelViewController.NotificationPanelViewStateProvider} and other
+ * {@link ShadeViewController.NotificationPanelViewStateProvider} and other
* controllers provide.
*/
public void updateViewState() {
@@ -479,7 +477,7 @@
}
float alphaQsExpansion = 1 - Math.min(
- 1, mNotificationPanelViewStateProvider.getLockscreenShadeDragProgress() * 2);
+ 1, mShadeViewStateProvider.getLockscreenShadeDragProgress() * 2);
float newAlpha;
if (mExplicitAlpha != -1) {
@@ -530,12 +528,12 @@
if (isKeyguardShowing()) {
// When on Keyguard, we hide the header as soon as we expanded close enough to the
// header
- alpha = mNotificationPanelViewStateProvider.getPanelViewExpandedHeight()
+ alpha = mShadeViewStateProvider.getPanelViewExpandedHeight()
/ (mView.getHeight() + mNotificationsHeaderCollideDistance);
} else {
// In SHADE_LOCKED, the top card is already really close to the header. Hide it as
// soon as we start translating the stack.
- alpha = mNotificationPanelViewStateProvider.getPanelViewExpandedHeight()
+ alpha = mShadeViewStateProvider.getPanelViewExpandedHeight()
/ mView.getHeight();
}
alpha = MathUtils.saturate(alpha);
@@ -585,7 +583,7 @@
void updateForHeadsUp(boolean animate) {
boolean showingKeyguardHeadsUp =
- isKeyguardShowing() && mNotificationPanelViewStateProvider.shouldHeadsUpBeVisible();
+ isKeyguardShowing() && mShadeViewStateProvider.shouldHeadsUpBeVisible();
if (mShowingKeyguardHeadsUp != showingKeyguardHeadsUp) {
mShowingKeyguardHeadsUp = showingKeyguardHeadsUp;
if (isKeyguardShowing()) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockscreenWallpaper.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockscreenWallpaper.java
index c16877a..c07b5e0 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockscreenWallpaper.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockscreenWallpaper.java
@@ -63,6 +63,11 @@
private static final String TAG = "LockscreenWallpaper";
+ // TODO(b/253507223): temporary; remove this
+ private static final String DISABLED_ERROR_MESSAGE = "Methods from LockscreenWallpaper.java "
+ + "should not be called in this version. The lock screen wallpaper should be "
+ + "managed by the WallpaperManagerService and not by this class.";
+
private final NotificationMediaManager mMediaManager;
private final WallpaperManager mWallpaperManager;
private final KeyguardUpdateMonitor mUpdateMonitor;
@@ -91,7 +96,7 @@
mMediaManager = mediaManager;
mH = mainHandler;
- if (iWallpaperManager != null) {
+ if (iWallpaperManager != null && !mWallpaperManager.isLockscreenLiveWallpaperEnabled()) {
// Service is disabled on some devices like Automotive
try {
iWallpaperManager.setLockWallpaperCallback(this);
@@ -102,6 +107,8 @@
}
public Bitmap getBitmap() {
+ assertLockscreenLiveWallpaperNotEnabled();
+
if (mCached) {
return mCache;
}
@@ -122,9 +129,8 @@
public LoaderResult loadBitmap(int currentUserId, UserHandle selectedUser) {
// May be called on any thread - only use thread safe operations.
- if (mWallpaperManager.isLockscreenLiveWallpaperEnabled()) {
- return LoaderResult.success(null);
- }
+ assertLockscreenLiveWallpaperNotEnabled();
+
if (!mWallpaperManager.isWallpaperSupported()) {
// When wallpaper is not supported, show the system wallpaper
@@ -164,6 +170,8 @@
}
public void setCurrentUser(int user) {
+ assertLockscreenLiveWallpaperNotEnabled();
+
if (user != mCurrentUserId) {
if (mSelectedUser == null || user != mSelectedUser.getIdentifier()) {
mCached = false;
@@ -173,6 +181,8 @@
}
public void setSelectedUser(UserHandle selectedUser) {
+ assertLockscreenLiveWallpaperNotEnabled();
+
if (Objects.equals(selectedUser, mSelectedUser)) {
return;
}
@@ -182,16 +192,18 @@
@Override
public void onWallpaperChanged() {
+ assertLockscreenLiveWallpaperNotEnabled();
// Called on Binder thread.
postUpdateWallpaper();
}
@Override
public void onWallpaperColorsChanged(WallpaperColors colors, int which, int userId) {
-
+ assertLockscreenLiveWallpaperNotEnabled();
}
private void postUpdateWallpaper() {
+ assertLockscreenLiveWallpaperNotEnabled();
if (mH == null) {
Log.wtfStack(TAG, "Trying to use LockscreenWallpaper before initialization.");
return;
@@ -199,11 +211,12 @@
mH.removeCallbacks(this);
mH.post(this);
}
-
@Override
public void run() {
// Called in response to onWallpaperChanged on the main thread.
+ assertLockscreenLiveWallpaperNotEnabled();
+
if (mLoader != null) {
mLoader.cancel(false /* interrupt */);
}
@@ -358,4 +371,16 @@
}
}
}
+
+ /**
+ * Feature b/253507223 will adapt the logic to always use the
+ * WallpaperManagerService to render the lock screen wallpaper.
+ * Methods of this class should not be called at all if the project flag is enabled.
+ * TODO(b/253507223) temporary assertion; remove this
+ */
+ private void assertLockscreenLiveWallpaperNotEnabled() {
+ if (mWallpaperManager.isLockscreenLiveWallpaperEnabled()) {
+ throw new IllegalStateException(DISABLED_ERROR_MESSAGE);
+ }
+ }
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarViewController.kt b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarViewController.kt
index 62d302f..e6cb68f 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarViewController.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarViewController.kt
@@ -165,19 +165,19 @@
if (event.action == MotionEvent.ACTION_DOWN) {
// If the view that would receive the touch is disabled, just have status
// bar eat the gesture.
- if (!centralSurfaces.notificationPanelViewController.isViewEnabled) {
+ if (!centralSurfaces.shadeViewController.isViewEnabled) {
shadeLogger.logMotionEvent(event,
"onTouchForwardedFromStatusBar: panel view disabled")
return true
}
- if (centralSurfaces.notificationPanelViewController.isFullyCollapsed &&
+ if (centralSurfaces.shadeViewController.isFullyCollapsed &&
event.y < 1f) {
// b/235889526 Eat events on the top edge of the phone when collapsed
shadeLogger.logMotionEvent(event, "top edge touch ignored")
return true
}
}
- return centralSurfaces.notificationPanelViewController.handleExternalTouch(event)
+ return centralSurfaces.shadeViewController.handleExternalTouch(event)
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java
index d3aa4bf..51c56a0 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java
@@ -64,7 +64,7 @@
import com.android.systemui.keyguard.shared.model.TransitionStep;
import com.android.systemui.keyguard.ui.viewmodel.PrimaryBouncerToGoneTransitionViewModel;
import com.android.systemui.scrim.ScrimView;
-import com.android.systemui.shade.NotificationPanelViewController;
+import com.android.systemui.shade.ShadeViewController;
import com.android.systemui.shade.transition.LargeScreenShadeInterpolator;
import com.android.systemui.statusbar.notification.stack.ViewState;
import com.android.systemui.statusbar.policy.ConfigurationController;
@@ -649,7 +649,7 @@
calculateAndUpdatePanelExpansion();
}
- /** See {@link NotificationPanelViewController#setPanelScrimMinFraction(float)}. */
+ /** See {@link ShadeViewController#setPanelScrimMinFraction(float)}. */
public void setPanelScrimMinFraction(float minFraction) {
if (isNaN(minFraction)) {
throw new IllegalArgumentException("minFraction should not be NaN");
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarHeadsUpChangeListener.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarHeadsUpChangeListener.java
index a7413d5..481cf3c 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarHeadsUpChangeListener.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarHeadsUpChangeListener.java
@@ -17,7 +17,7 @@
package com.android.systemui.statusbar.phone;
import com.android.systemui.plugins.statusbar.StatusBarStateController;
-import com.android.systemui.shade.NotificationPanelViewController;
+import com.android.systemui.shade.ShadeViewController;
import com.android.systemui.statusbar.NotificationRemoteInputManager;
import com.android.systemui.statusbar.NotificationShadeWindowController;
import com.android.systemui.statusbar.StatusBarState;
@@ -34,7 +34,7 @@
public class StatusBarHeadsUpChangeListener implements OnHeadsUpChangedListener {
private final NotificationShadeWindowController mNotificationShadeWindowController;
private final StatusBarWindowController mStatusBarWindowController;
- private final NotificationPanelViewController mNotificationPanelViewController;
+ private final ShadeViewController mShadeViewController;
private final KeyguardBypassController mKeyguardBypassController;
private final HeadsUpManagerPhone mHeadsUpManager;
private final StatusBarStateController mStatusBarStateController;
@@ -44,7 +44,7 @@
StatusBarHeadsUpChangeListener(
NotificationShadeWindowController notificationShadeWindowController,
StatusBarWindowController statusBarWindowController,
- NotificationPanelViewController notificationPanelViewController,
+ ShadeViewController shadeViewController,
KeyguardBypassController keyguardBypassController,
HeadsUpManagerPhone headsUpManager,
StatusBarStateController statusBarStateController,
@@ -52,7 +52,7 @@
mNotificationShadeWindowController = notificationShadeWindowController;
mStatusBarWindowController = statusBarWindowController;
- mNotificationPanelViewController = notificationPanelViewController;
+ mShadeViewController = shadeViewController;
mKeyguardBypassController = keyguardBypassController;
mHeadsUpManager = headsUpManager;
mStatusBarStateController = statusBarStateController;
@@ -64,14 +64,14 @@
if (inPinnedMode) {
mNotificationShadeWindowController.setHeadsUpShowing(true);
mStatusBarWindowController.setForceStatusBarVisible(true);
- if (mNotificationPanelViewController.isFullyCollapsed()) {
- mNotificationPanelViewController.updateTouchableRegion();
+ if (mShadeViewController.isFullyCollapsed()) {
+ mShadeViewController.updateTouchableRegion();
}
} else {
boolean bypassKeyguard = mKeyguardBypassController.getBypassEnabled()
&& mStatusBarStateController.getState() == StatusBarState.KEYGUARD;
- if (!mNotificationPanelViewController.isFullyCollapsed()
- || mNotificationPanelViewController.isTracking()
+ if (!mShadeViewController.isFullyCollapsed()
+ || mShadeViewController.isTracking()
|| bypassKeyguard) {
// We are currently tracking or is open and the shade doesn't need to
//be kept
@@ -85,7 +85,7 @@
//animation
// is finished.
mHeadsUpManager.setHeadsUpGoingAway(true);
- mNotificationPanelViewController.getNotificationStackScrollLayoutController()
+ mShadeViewController.getNotificationStackScrollLayoutController()
.runAfterAnimationFinished(() -> {
if (!mHeadsUpManager.hasPinnedHeadsUp()) {
mNotificationShadeWindowController.setHeadsUpShowing(false);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
index 70aab61..f7646d7 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
@@ -69,11 +69,11 @@
import com.android.systemui.navigationbar.NavigationModeController;
import com.android.systemui.navigationbar.TaskbarDelegate;
import com.android.systemui.plugins.statusbar.StatusBarStateController;
-import com.android.systemui.shade.NotificationPanelViewController;
import com.android.systemui.shade.ShadeController;
import com.android.systemui.shade.ShadeExpansionChangeEvent;
import com.android.systemui.shade.ShadeExpansionListener;
import com.android.systemui.shade.ShadeExpansionStateManager;
+import com.android.systemui.shade.ShadeViewController;
import com.android.systemui.shared.system.QuickStepContract;
import com.android.systemui.shared.system.SysUiStatsLog;
import com.android.systemui.statusbar.NotificationMediaManager;
@@ -251,7 +251,7 @@
protected LockPatternUtils mLockPatternUtils;
protected ViewMediatorCallback mViewMediatorCallback;
@Nullable protected CentralSurfaces mCentralSurfaces;
- private NotificationPanelViewController mNotificationPanelViewController;
+ private ShadeViewController mShadeViewController;
private BiometricUnlockController mBiometricUnlockController;
private boolean mCentralSurfacesRegistered;
@@ -371,7 +371,7 @@
@Override
public void registerCentralSurfaces(CentralSurfaces centralSurfaces,
- NotificationPanelViewController notificationPanelViewController,
+ ShadeViewController shadeViewController,
ShadeExpansionStateManager shadeExpansionStateManager,
BiometricUnlockController biometricUnlockController,
View notificationContainer,
@@ -380,7 +380,7 @@
mBiometricUnlockController = biometricUnlockController;
mPrimaryBouncerCallbackInteractor.addBouncerExpansionCallback(mExpansionCallback);
- mNotificationPanelViewController = notificationPanelViewController;
+ mShadeViewController = shadeViewController;
if (shadeExpansionStateManager != null) {
shadeExpansionStateManager.addExpansionListener(this);
}
@@ -482,8 +482,8 @@
// Avoid having the shade and the bouncer open at the same time over a dream.
final boolean hideBouncerOverDream =
mDreamOverlayStateController.isOverlayActive()
- && (mNotificationPanelViewController.isExpanded()
- || mNotificationPanelViewController.isExpanding());
+ && (mShadeViewController.isExpanded()
+ || mShadeViewController.isExpanding());
final boolean isUserTrackingStarted =
event.getFraction() != EXPANSION_HIDDEN && event.getTracking();
@@ -495,7 +495,7 @@
&& !mKeyguardStateController.isOccluded()
&& !mKeyguardStateController.canDismissLockScreen()
&& !bouncerIsAnimatingAway()
- && !mNotificationPanelViewController.isUnlockHintRunning()
+ && !mShadeViewController.isUnlockHintRunning()
&& !(mStatusBarStateController.getState() == StatusBarState.SHADE_LOCKED);
}
@@ -699,7 +699,7 @@
if (mKeyguardStateController.isShowing()) {
final boolean isOccluded = mKeyguardStateController.isOccluded();
// Hide quick settings.
- mNotificationPanelViewController.resetViews(/* animate= */ !isOccluded);
+ mShadeViewController.resetViews(/* animate= */ !isOccluded);
// Hide bouncer and quick-quick settings.
if (isOccluded && !mDozing) {
mCentralSurfaces.hideKeyguard();
@@ -862,7 +862,7 @@
public void startPreHideAnimation(Runnable finishRunnable) {
if (primaryBouncerIsShowing()) {
mPrimaryBouncerInteractor.startDisappearAnimation(finishRunnable);
- mNotificationPanelViewController.startBouncerPreHideAnimation();
+ mShadeViewController.startBouncerPreHideAnimation();
// We update the state (which will show the keyguard) only if an animation will run on
// the keyguard. If there is no animation, we wait before updating the state so that we
@@ -873,12 +873,12 @@
} else if (finishRunnable != null) {
finishRunnable.run();
}
- mNotificationPanelViewController.blockExpansionForCurrentTouch();
+ mShadeViewController.blockExpansionForCurrentTouch();
}
@Override
public void blockPanelExpansionFromCurrentTouch() {
- mNotificationPanelViewController.blockExpansionForCurrentTouch();
+ mShadeViewController.blockExpansionForCurrentTouch();
}
@Override
@@ -975,7 +975,7 @@
public void onKeyguardFadedAway() {
mNotificationContainer.postDelayed(() -> mNotificationShadeWindowController
.setKeyguardFadingAway(false), 100);
- mNotificationPanelViewController.resetViewGroupFade();
+ mShadeViewController.resetViewGroupFade();
mCentralSurfaces.finishKeyguardFadingAway();
mBiometricUnlockController.finishKeyguardFadingAway();
WindowManagerGlobal.getInstance().trimMemory(
@@ -1050,7 +1050,7 @@
if (hideImmediately) {
mStatusBarStateController.setLeaveOpenOnKeyguardHide(false);
} else {
- mNotificationPanelViewController.expandToNotifications();
+ mShadeViewController.expandToNotifications();
}
}
return;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarLaunchAnimatorController.kt b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarLaunchAnimatorController.kt
index b1642d6..9f69db9 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarLaunchAnimatorController.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarLaunchAnimatorController.kt
@@ -21,7 +21,7 @@
override fun onIntentStarted(willAnimate: Boolean) {
delegate.onIntentStarted(willAnimate)
if (willAnimate) {
- centralSurfaces.notificationPanelViewController.setIsLaunchAnimationRunning(true)
+ centralSurfaces.shadeViewController.setIsLaunchAnimationRunning(true)
} else {
centralSurfaces.collapsePanelOnMainThread()
}
@@ -29,16 +29,16 @@
override fun onLaunchAnimationStart(isExpandingFullyAbove: Boolean) {
delegate.onLaunchAnimationStart(isExpandingFullyAbove)
- centralSurfaces.notificationPanelViewController.setIsLaunchAnimationRunning(true)
+ centralSurfaces.shadeViewController.setIsLaunchAnimationRunning(true)
if (!isExpandingFullyAbove) {
- centralSurfaces.notificationPanelViewController.collapseWithDuration(
+ centralSurfaces.shadeViewController.collapseWithDuration(
ActivityLaunchAnimator.TIMINGS.totalDuration.toInt())
}
}
override fun onLaunchAnimationEnd(isExpandingFullyAbove: Boolean) {
delegate.onLaunchAnimationEnd(isExpandingFullyAbove)
- centralSurfaces.notificationPanelViewController.setIsLaunchAnimationRunning(false)
+ centralSurfaces.shadeViewController.setIsLaunchAnimationRunning(false)
centralSurfaces.onLaunchAnimationEnd(isExpandingFullyAbove)
}
@@ -48,12 +48,12 @@
linearProgress: Float
) {
delegate.onLaunchAnimationProgress(state, progress, linearProgress)
- centralSurfaces.notificationPanelViewController.applyLaunchAnimationProgress(linearProgress)
+ centralSurfaces.shadeViewController.applyLaunchAnimationProgress(linearProgress)
}
override fun onLaunchAnimationCancelled(newKeyguardOccludedState: Boolean?) {
delegate.onLaunchAnimationCancelled()
- centralSurfaces.notificationPanelViewController.setIsLaunchAnimationRunning(false)
+ centralSurfaces.shadeViewController.setIsLaunchAnimationRunning(false)
centralSurfaces.onLaunchAnimationCancelled(isLaunchForActivity)
}
}
\ No newline at end of file
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 c623201..bd5815aa 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationActivityStarter.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationActivityStarter.java
@@ -55,11 +55,10 @@
import com.android.systemui.animation.ActivityLaunchAnimator;
import com.android.systemui.assist.AssistManager;
import com.android.systemui.flags.FeatureFlags;
-import com.android.systemui.flags.Flags;
import com.android.systemui.plugins.ActivityStarter;
import com.android.systemui.settings.UserTracker;
-import com.android.systemui.shade.NotificationPanelViewController;
import com.android.systemui.shade.ShadeController;
+import com.android.systemui.shade.ShadeViewController;
import com.android.systemui.statusbar.NotificationClickNotifier;
import com.android.systemui.statusbar.NotificationLockscreenUserManager;
import com.android.systemui.statusbar.NotificationPresenter;
@@ -122,7 +121,7 @@
private final CentralSurfaces mCentralSurfaces;
private final NotificationPresenter mPresenter;
- private final NotificationPanelViewController mNotificationPanel;
+ private final ShadeViewController mNotificationPanel;
private final ActivityLaunchAnimator mActivityLaunchAnimator;
private final NotificationLaunchAnimatorControllerProvider mNotificationAnimationProvider;
private final UserTracker mUserTracker;
@@ -157,7 +156,7 @@
OnUserInteractionCallback onUserInteractionCallback,
CentralSurfaces centralSurfaces,
NotificationPresenter presenter,
- NotificationPanelViewController panel,
+ ShadeViewController panel,
ActivityLaunchAnimator activityLaunchAnimator,
NotificationLaunchAnimatorControllerProvider notificationAnimationProvider,
LaunchFullScreenIntentProvider launchFullScreenIntentProvider,
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenter.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenter.java
index 7fc0996..dfaee4c 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenter.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenter.java
@@ -36,9 +36,9 @@
import com.android.systemui.R;
import com.android.systemui.plugins.ActivityStarter;
import com.android.systemui.plugins.ActivityStarter.OnDismissAction;
-import com.android.systemui.shade.NotificationPanelViewController;
import com.android.systemui.shade.NotificationShadeWindowView;
import com.android.systemui.shade.QuickSettingsController;
+import com.android.systemui.shade.ShadeViewController;
import com.android.systemui.statusbar.CommandQueue;
import com.android.systemui.statusbar.KeyguardIndicationController;
import com.android.systemui.statusbar.LockscreenShadeTransitionController;
@@ -82,7 +82,7 @@
private final NotificationMediaManager mMediaManager;
private final NotificationGutsManager mGutsManager;
- private final NotificationPanelViewController mNotificationPanel;
+ private final ShadeViewController mNotificationPanel;
private final HeadsUpManagerPhone mHeadsUpManager;
private final AboveShelfObserver mAboveShelfObserver;
private final DozeScrimController mDozeScrimController;
@@ -105,7 +105,7 @@
@Inject
StatusBarNotificationPresenter(
Context context,
- NotificationPanelViewController panel,
+ ShadeViewController panel,
QuickSettingsController quickSettingsController,
HeadsUpManagerPhone headsUp,
NotificationShadeWindowView statusBarWindow,
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/UnlockedScreenOffAnimationController.kt b/packages/SystemUI/src/com/android/systemui/statusbar/phone/UnlockedScreenOffAnimationController.kt
index 0cd3401..8fa803e 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/UnlockedScreenOffAnimationController.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/UnlockedScreenOffAnimationController.kt
@@ -277,7 +277,7 @@
// Show AOD. That'll cause the KeyguardVisibilityHelper to call
// #animateInKeyguard.
- mCentralSurfaces.notificationPanelViewController.showAodUi()
+ mCentralSurfaces.shadeViewController.showAodUi()
}
}, (ANIMATE_IN_KEYGUARD_DELAY * animatorDurationScale).toLong())
@@ -326,7 +326,7 @@
// already expanded and showing notifications/QS, the animation looks really messy. For now,
// disable it if the notification panel is expanded.
if ((!this::mCentralSurfaces.isInitialized ||
- mCentralSurfaces.notificationPanelViewController.isPanelExpanded) &&
+ mCentralSurfaces.shadeViewController.isPanelExpanded) &&
// Status bar might be expanded because we have started
// playing the animation already
!isAnimationPlaying()
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/dagger/StatusBarViewModule.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/dagger/StatusBarViewModule.java
index b96001f..015ee7b 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/dagger/StatusBarViewModule.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/dagger/StatusBarViewModule.java
@@ -21,7 +21,9 @@
import android.os.Handler;
import android.view.LayoutInflater;
import android.view.ViewStub;
+
import androidx.constraintlayout.motion.widget.MotionLayout;
+
import com.android.keyguard.KeyguardUpdateMonitor;
import com.android.keyguard.LockIconView;
import com.android.systemui.R;
@@ -42,6 +44,7 @@
import com.android.systemui.shade.NotificationShadeWindowView;
import com.android.systemui.shade.NotificationsQuickSettingsContainer;
import com.android.systemui.shade.ShadeExpansionStateManager;
+import com.android.systemui.shade.ShadeViewController;
import com.android.systemui.statusbar.CommandQueue;
import com.android.systemui.statusbar.LegacyNotificationShelfControllerImpl;
import com.android.systemui.statusbar.NotificationShelf;
@@ -74,11 +77,14 @@
import com.android.systemui.tuner.TunerService;
import com.android.systemui.util.CarrierConfigTracker;
import com.android.systemui.util.settings.SecureSettings;
+
import dagger.Binds;
import dagger.Module;
import dagger.Provides;
import dagger.multibindings.IntoSet;
+
import java.util.concurrent.Executor;
+
import javax.inject.Named;
import javax.inject.Provider;
@@ -160,6 +166,12 @@
}
/** */
+ @Binds
+ @CentralSurfacesComponent.CentralSurfacesScope
+ abstract ShadeViewController bindsShadeViewController(
+ NotificationPanelViewController notificationPanelViewController);
+
+ /** */
@Provides
@CentralSurfacesComponent.CentralSurfacesScope
public static LockIconView getLockIconView(
@@ -298,7 +310,7 @@
StatusBarIconController.DarkIconManager.Factory darkIconManagerFactory,
StatusBarHideIconsForBouncerManager statusBarHideIconsForBouncerManager,
KeyguardStateController keyguardStateController,
- NotificationPanelViewController notificationPanelViewController,
+ ShadeViewController shadeViewController,
StatusBarStateController statusBarStateController,
CommandQueue commandQueue,
CarrierConfigTracker carrierConfigTracker,
@@ -321,7 +333,7 @@
darkIconManagerFactory,
statusBarHideIconsForBouncerManager,
keyguardStateController,
- notificationPanelViewController,
+ shadeViewController,
statusBarStateController,
commandQueue,
carrierConfigTracker,
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/fragment/CollapsedStatusBarFragment.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/fragment/CollapsedStatusBarFragment.java
index fe63994..453dd1b 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/fragment/CollapsedStatusBarFragment.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/fragment/CollapsedStatusBarFragment.java
@@ -52,8 +52,8 @@
import com.android.systemui.dump.DumpManager;
import com.android.systemui.flags.FeatureFlags;
import com.android.systemui.plugins.statusbar.StatusBarStateController;
-import com.android.systemui.shade.NotificationPanelViewController;
import com.android.systemui.shade.ShadeExpansionStateManager;
+import com.android.systemui.shade.ShadeViewController;
import com.android.systemui.statusbar.CommandQueue;
import com.android.systemui.statusbar.OperatorNameView;
import com.android.systemui.statusbar.OperatorNameViewController;
@@ -107,7 +107,7 @@
private PhoneStatusBarView mStatusBar;
private final StatusBarStateController mStatusBarStateController;
private final KeyguardStateController mKeyguardStateController;
- private final NotificationPanelViewController mNotificationPanelViewController;
+ private final ShadeViewController mShadeViewController;
private LinearLayout mEndSideContent;
private View mClockView;
private View mOngoingCallChip;
@@ -198,7 +198,7 @@
StatusBarIconController.DarkIconManager.Factory darkIconManagerFactory,
StatusBarHideIconsForBouncerManager statusBarHideIconsForBouncerManager,
KeyguardStateController keyguardStateController,
- NotificationPanelViewController notificationPanelViewController,
+ ShadeViewController shadeViewController,
StatusBarStateController statusBarStateController,
CommandQueue commandQueue,
CarrierConfigTracker carrierConfigTracker,
@@ -221,7 +221,7 @@
mStatusBarHideIconsForBouncerManager = statusBarHideIconsForBouncerManager;
mDarkIconManagerFactory = darkIconManagerFactory;
mKeyguardStateController = keyguardStateController;
- mNotificationPanelViewController = notificationPanelViewController;
+ mShadeViewController = shadeViewController;
mStatusBarStateController = statusBarStateController;
mCommandQueue = commandQueue;
mCarrierConfigTracker = carrierConfigTracker;
@@ -509,7 +509,7 @@
private boolean shouldHideNotificationIcons() {
if (!mShadeExpansionStateManager.isClosed()
- && mNotificationPanelViewController.shouldHideStatusBarIconsWhenExpanded()) {
+ && mShadeViewController.shouldHideStatusBarIconsWhenExpanded()) {
return true;
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/BrightnessMirrorController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/BrightnessMirrorController.java
index a4cb99b..6186c43 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/BrightnessMirrorController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/BrightnessMirrorController.java
@@ -28,8 +28,8 @@
import com.android.systemui.R;
import com.android.systemui.settings.brightness.BrightnessSliderController;
import com.android.systemui.settings.brightness.ToggleSlider;
-import com.android.systemui.shade.NotificationPanelViewController;
import com.android.systemui.shade.NotificationShadeWindowView;
+import com.android.systemui.shade.ShadeViewController;
import com.android.systemui.statusbar.NotificationShadeDepthController;
import java.util.Objects;
@@ -43,7 +43,7 @@
private final NotificationShadeWindowView mStatusBarWindow;
private final Consumer<Boolean> mVisibilityCallback;
- private final NotificationPanelViewController mNotificationPanel;
+ private final ShadeViewController mNotificationPanel;
private final NotificationShadeDepthController mDepthController;
private final ArraySet<BrightnessMirrorListener> mBrightnessMirrorListeners = new ArraySet<>();
private final BrightnessSliderController.Factory mToggleSliderFactory;
@@ -54,7 +54,7 @@
private int mLastBrightnessSliderWidth = -1;
public BrightnessMirrorController(NotificationShadeWindowView statusBarWindow,
- NotificationPanelViewController notificationPanelViewController,
+ ShadeViewController shadeViewController,
NotificationShadeDepthController notificationShadeDepthController,
BrightnessSliderController.Factory factory,
@NonNull Consumer<Boolean> visibilityCallback) {
@@ -62,7 +62,7 @@
mToggleSliderFactory = factory;
mBrightnessMirror = statusBarWindow.findViewById(R.id.brightness_mirror_container);
mToggleSliderController = setMirrorLayout();
- mNotificationPanel = notificationPanelViewController;
+ mNotificationPanel = shadeViewController;
mDepthController = notificationShadeDepthController;
mNotificationPanel.setAlphaChangeAnimationEndAction(() -> {
mBrightnessMirror.setVisibility(View.INVISIBLE);
diff --git a/packages/SystemUI/src/com/android/systemui/unfold/FoldAodAnimationController.kt b/packages/SystemUI/src/com/android/systemui/unfold/FoldAodAnimationController.kt
index d1bd73a..d74906a 100644
--- a/packages/SystemUI/src/com/android/systemui/unfold/FoldAodAnimationController.kt
+++ b/packages/SystemUI/src/com/android/systemui/unfold/FoldAodAnimationController.kt
@@ -39,11 +39,11 @@
import com.android.systemui.util.concurrency.DelayableExecutor
import com.android.systemui.util.settings.GlobalSettings
import dagger.Lazy
-import java.util.function.Consumer
-import javax.inject.Inject
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Job
import kotlinx.coroutines.launch
+import java.util.function.Consumer
+import javax.inject.Inject
/**
* Controls folding to AOD animation: when AOD is enabled and foldable device is folded we play a
@@ -128,7 +128,7 @@
}
private fun getShadeFoldAnimator(): ShadeFoldAnimator =
- centralSurfaces.notificationPanelViewController.shadeFoldAnimator
+ centralSurfaces.shadeViewController.shadeFoldAnimator
private fun setAnimationState(playing: Boolean) {
shouldPlayAnimation = playing
diff --git a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java
index aa26e68..77210b7 100644
--- a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java
@@ -2344,7 +2344,7 @@
}
@VisibleForTesting
- void clearInternalHandleAfterTest() {
+ void clearInternalHandlerAfterTest() {
if (mHandler != null) {
mHandler.removeCallbacksAndMessages(null);
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/biometrics/AuthBiometricFingerprintAndFaceViewTest.kt b/packages/SystemUI/tests/src/com/android/systemui/biometrics/AuthBiometricFingerprintAndFaceViewTest.kt
index dd87f6e..f4dacab 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/biometrics/AuthBiometricFingerprintAndFaceViewTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/biometrics/AuthBiometricFingerprintAndFaceViewTest.kt
@@ -18,6 +18,8 @@
import android.hardware.biometrics.BiometricAuthenticator.TYPE_FACE
import android.hardware.biometrics.BiometricAuthenticator.TYPE_FINGERPRINT
+import android.hardware.biometrics.BiometricConstants
+import android.hardware.face.FaceManager
import android.testing.TestableLooper
import android.testing.TestableLooper.RunWithLooper
import android.view.View
@@ -34,6 +36,7 @@
import org.mockito.Mock
import org.mockito.Mockito.never
import org.mockito.Mockito.verify
+import org.mockito.Mockito.times
import org.mockito.junit.MockitoJUnit
@@ -98,7 +101,7 @@
}
@Test
- fun ignoresFaceErrors() {
+ fun ignoresFaceErrors_faceIsNotClass3_notLockoutError() {
biometricView.onDialogAnimatedIn()
biometricView.onError(TYPE_FACE, "not a face")
waitForIdleSync()
@@ -113,5 +116,47 @@
verify(callback).onAction(AuthBiometricView.Callback.ACTION_ERROR)
}
+ @Test
+ fun doNotIgnoresFaceErrors_faceIsClass3_notLockoutError() {
+ biometricView.isFaceClass3 = true
+ biometricView.onDialogAnimatedIn()
+ biometricView.onError(TYPE_FACE, "not a face")
+ waitForIdleSync()
+
+ assertThat(biometricView.isAuthenticating).isTrue()
+ verify(callback, never()).onAction(AuthBiometricView.Callback.ACTION_ERROR)
+
+ biometricView.onError(TYPE_FINGERPRINT, "that's a nope")
+ TestableLooper.get(this).moveTimeForward(1000)
+ waitForIdleSync()
+
+ verify(callback).onAction(AuthBiometricView.Callback.ACTION_ERROR)
+ }
+
+ @Test
+ fun doNotIgnoresFaceErrors_faceIsClass3_lockoutError() {
+ biometricView.isFaceClass3 = true
+ biometricView.onDialogAnimatedIn()
+ biometricView.onError(
+ TYPE_FACE,
+ FaceManager.getErrorString(
+ biometricView.context,
+ BiometricConstants.BIOMETRIC_ERROR_LOCKOUT_PERMANENT,
+ 0 /*vendorCode */
+ )
+ )
+ waitForIdleSync()
+
+ assertThat(biometricView.isAuthenticating).isTrue()
+ verify(callback).onAction(AuthBiometricView.Callback.ACTION_ERROR)
+
+ biometricView.onError(TYPE_FINGERPRINT, "that's a nope")
+ TestableLooper.get(this).moveTimeForward(1000)
+ waitForIdleSync()
+
+ verify(callback, times(2)).onAction(AuthBiometricView.Callback.ACTION_ERROR)
+ }
+
+
override fun waitForIdleSync() = TestableLooper.get(this).processAllMessages()
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/dreams/touch/ShadeTouchHandlerTest.java b/packages/SystemUI/tests/src/com/android/systemui/dreams/touch/ShadeTouchHandlerTest.java
index 5704ef3..872c079 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/dreams/touch/ShadeTouchHandlerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/dreams/touch/ShadeTouchHandlerTest.java
@@ -28,7 +28,7 @@
import androidx.test.filters.SmallTest;
import com.android.systemui.SysuiTestCase;
-import com.android.systemui.shade.NotificationPanelViewController;
+import com.android.systemui.shade.ShadeViewController;
import com.android.systemui.shared.system.InputChannelCompat;
import com.android.systemui.statusbar.phone.CentralSurfaces;
@@ -49,7 +49,7 @@
CentralSurfaces mCentralSurfaces;
@Mock
- NotificationPanelViewController mNotificationPanelViewController;
+ ShadeViewController mShadeViewController;
@Mock
DreamTouchHandler.TouchSession mTouchSession;
@@ -63,8 +63,8 @@
MockitoAnnotations.initMocks(this);
mTouchHandler = new ShadeTouchHandler(Optional.of(mCentralSurfaces),
TOUCH_HEIGHT);
- when(mCentralSurfaces.getNotificationPanelViewController())
- .thenReturn(mNotificationPanelViewController);
+ when(mCentralSurfaces.getShadeViewController())
+ .thenReturn(mShadeViewController);
}
/**
@@ -97,7 +97,7 @@
}
/**
- * Ensure touches are propagated to the {@link NotificationPanelViewController}.
+ * Ensure touches are propagated to the {@link ShadeViewController}.
*/
@Test
public void testEventPropagation() {
@@ -110,7 +110,7 @@
mTouchHandler.onSessionStart(mTouchSession);
verify(mTouchSession).registerInputListener(inputEventListenerArgumentCaptor.capture());
inputEventListenerArgumentCaptor.getValue().onInputEvent(motionEvent);
- verify(mNotificationPanelViewController).handleExternalTouch(motionEvent);
+ verify(mShadeViewController).handleExternalTouch(motionEvent);
}
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/keyguard/data/repository/BiometricSettingsRepositoryTest.kt b/packages/SystemUI/tests/src/com/android/systemui/keyguard/data/repository/BiometricSettingsRepositoryTest.kt
index 5d83f56..726728a 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/keyguard/data/repository/BiometricSettingsRepositoryTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/keyguard/data/repository/BiometricSettingsRepositoryTest.kt
@@ -227,10 +227,14 @@
assertThat(faceEnrolled()).isFalse()
+ whenever(authController.isFaceAuthEnrolled(ANOTHER_USER_ID)).thenReturn(true)
+
enrollmentChange(FACE, ANOTHER_USER_ID, true)
assertThat(faceEnrolled()).isFalse()
+ whenever(authController.isFaceAuthEnrolled(PRIMARY_USER_ID)).thenReturn(true)
+
enrollmentChange(FACE, PRIMARY_USER_ID, true)
assertThat(faceEnrolled()).isTrue()
@@ -264,6 +268,7 @@
verify(authController).addCallback(authControllerCallback.capture())
+ whenever(authController.isFaceAuthEnrolled(ANOTHER_USER_ID)).thenReturn(true)
enrollmentChange(FACE, ANOTHER_USER_ID, true)
assertThat(faceEnrolled()).isTrue()
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/LockscreenShadeTransitionControllerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/LockscreenShadeTransitionControllerTest.kt
index 932a1f9..d017ffd 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/LockscreenShadeTransitionControllerTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/LockscreenShadeTransitionControllerTest.kt
@@ -13,7 +13,7 @@
import com.android.systemui.media.controls.ui.MediaHierarchyManager
import com.android.systemui.plugins.FalsingManager
import com.android.systemui.plugins.qs.QS
-import com.android.systemui.shade.NotificationPanelViewController
+import com.android.systemui.shade.ShadeViewController
import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow
import com.android.systemui.statusbar.notification.row.NotificationTestHelper
import com.android.systemui.statusbar.notification.stack.AmbientState
@@ -44,8 +44,8 @@
import org.mockito.Mockito.never
import org.mockito.Mockito.verify
import org.mockito.Mockito.verifyZeroInteractions
-import org.mockito.Mockito.`when` as whenever
import org.mockito.junit.MockitoJUnit
+import org.mockito.Mockito.`when` as whenever
private fun <T> anyObject(): T {
return Mockito.anyObject<T>()
@@ -69,7 +69,7 @@
@Mock lateinit var mediaHierarchyManager: MediaHierarchyManager
@Mock lateinit var scrimController: ScrimController
@Mock lateinit var falsingManager: FalsingManager
- @Mock lateinit var notificationPanelController: NotificationPanelViewController
+ @Mock lateinit var shadeViewController: ShadeViewController
@Mock lateinit var nsslController: NotificationStackScrollLayoutController
@Mock lateinit var depthController: NotificationShadeDepthController
@Mock lateinit var stackscroller: NotificationStackScrollLayout
@@ -128,7 +128,7 @@
transitionController.addCallback(transitionControllerCallback)
whenever(nsslController.view).thenReturn(stackscroller)
whenever(nsslController.expandHelperCallback).thenReturn(expandHelperCallback)
- transitionController.notificationPanelController = notificationPanelController
+ transitionController.shadeViewController = shadeViewController
transitionController.centralSurfaces = mCentralSurfaces
transitionController.qS = qS
transitionController.setStackScroller(nsslController)
@@ -223,7 +223,7 @@
fun testGoToLockedShadeCreatesQSAnimation() {
transitionController.goToLockedShade(null)
verify(statusbarStateController).setState(StatusBarState.SHADE_LOCKED)
- verify(notificationPanelController).transitionToExpandedShade(anyLong())
+ verify(shadeViewController).transitionToExpandedShade(anyLong())
assertNotNull(transitionController.dragDownAnimator)
}
@@ -231,7 +231,7 @@
fun testGoToLockedShadeDoesntCreateQSAnimation() {
transitionController.goToLockedShade(null, needsQSAnimation = false)
verify(statusbarStateController).setState(StatusBarState.SHADE_LOCKED)
- verify(notificationPanelController).transitionToExpandedShade(anyLong())
+ verify(shadeViewController).transitionToExpandedShade(anyLong())
assertNull(transitionController.dragDownAnimator)
}
@@ -239,7 +239,7 @@
fun testGoToLockedShadeAlwaysCreatesQSAnimationInSplitShade() {
enableSplitShade()
transitionController.goToLockedShade(null, needsQSAnimation = true)
- verify(notificationPanelController).transitionToExpandedShade(anyLong())
+ verify(shadeViewController).transitionToExpandedShade(anyLong())
assertNotNull(transitionController.dragDownAnimator)
}
@@ -293,7 +293,7 @@
fun setDragAmount_setsKeyguardTransitionProgress() {
transitionController.dragDownAmount = 10f
- verify(notificationPanelController).setKeyguardTransitionProgress(anyFloat(), anyInt())
+ verify(shadeViewController).setKeyguardTransitionProgress(anyFloat(), anyInt())
}
@Test
@@ -303,7 +303,7 @@
transitionController.dragDownAmount = 10f
val expectedAlpha = 1 - 10f / alphaDistance
- verify(notificationPanelController)
+ verify(shadeViewController)
.setKeyguardTransitionProgress(eq(expectedAlpha), anyInt())
}
@@ -317,7 +317,7 @@
transitionController.dragDownAmount = 10f
- verify(notificationPanelController).setKeyguardTransitionProgress(anyFloat(), eq(0))
+ verify(shadeViewController).setKeyguardTransitionProgress(anyFloat(), eq(0))
}
@Test
@@ -330,7 +330,7 @@
transitionController.dragDownAmount = 10f
- verify(notificationPanelController)
+ verify(shadeViewController)
.setKeyguardTransitionProgress(anyFloat(), eq(mediaTranslationY))
}
@@ -349,7 +349,7 @@
context.resources.getDimensionPixelSize(
R.dimen.lockscreen_shade_keyguard_transition_vertical_offset)
val expectedTranslation = 10f / distance * offset
- verify(notificationPanelController)
+ verify(shadeViewController)
.setKeyguardTransitionProgress(anyFloat(), eq(expectedTranslation.toInt()))
}
@@ -468,7 +468,7 @@
transitionController.dragDownAmount = dragDownAmount
val expectedAlpha = 1 - dragDownAmount / alphaDistance
- verify(notificationPanelController).setKeyguardStatusBarAlpha(expectedAlpha)
+ verify(shadeViewController).setKeyguardStatusBarAlpha(expectedAlpha)
}
@Test
@@ -477,7 +477,7 @@
transitionController.dragDownAmount = 10f
- verify(notificationPanelController).setKeyguardStatusBarAlpha(-1f)
+ verify(shadeViewController).setKeyguardStatusBarAlpha(-1f)
}
private fun enableSplitShade() {
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationMediaManagerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationMediaManagerTest.kt
new file mode 100644
index 0000000..9d6ea85
--- /dev/null
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationMediaManagerTest.kt
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.systemui.statusbar
+
+import android.testing.AndroidTestingRunner
+import androidx.test.filters.SmallTest
+import com.android.systemui.SysuiTestCase
+import com.android.systemui.util.mockito.whenever
+import org.junit.After
+import org.junit.Before
+import org.junit.Test
+import org.junit.runner.RunWith
+import org.mockito.Mock
+import org.mockito.Mockito.anyBoolean
+import org.mockito.Mockito.doCallRealMethod
+import org.mockito.Mockito.doReturn
+import org.mockito.Mockito.never
+import org.mockito.Mockito.verify
+import org.mockito.MockitoAnnotations
+
+/**
+ * Temporary test for the lock screen live wallpaper project.
+ *
+ * TODO(b/273443374): remove this test
+ */
+@RunWith(AndroidTestingRunner::class)
+@SmallTest
+class NotificationMediaManagerTest : SysuiTestCase() {
+
+ @Mock private lateinit var notificationMediaManager: NotificationMediaManager
+
+ @Mock private lateinit var mockBackDropView: BackDropView
+
+ @Before
+ fun setUp() {
+ MockitoAnnotations.initMocks(this)
+ doCallRealMethod()
+ .whenever(notificationMediaManager)
+ .updateMediaMetaData(anyBoolean(), anyBoolean())
+ doReturn(mockBackDropView).whenever(notificationMediaManager).backDropView
+ }
+
+ @After fun tearDown() {}
+
+ /** Check that updateMediaMetaData is a no-op with mIsLockscreenLiveWallpaperEnabled = true */
+ @Test
+ fun testUpdateMediaMetaDataDisabled() {
+ notificationMediaManager.mIsLockscreenLiveWallpaperEnabled = true
+ for (metaDataChanged in listOf(true, false)) {
+ for (allowEnterAnimation in listOf(true, false)) {
+ notificationMediaManager.updateMediaMetaData(metaDataChanged, allowEnterAnimation)
+ verify(notificationMediaManager, never()).mediaMetadata
+ }
+ }
+ }
+}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/NotificationWakeUpCoordinatorTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/NotificationWakeUpCoordinatorTest.kt
index aff705f..da3a9f6 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/NotificationWakeUpCoordinatorTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/NotificationWakeUpCoordinatorTest.kt
@@ -23,7 +23,7 @@
import com.android.systemui.SysuiTestCase
import com.android.systemui.dump.DumpManager
import com.android.systemui.plugins.statusbar.StatusBarStateController
-import com.android.systemui.shade.NotificationPanelViewController.WAKEUP_ANIMATION_DELAY_MS
+import com.android.systemui.shade.ShadeViewController.Companion.WAKEUP_ANIMATION_DELAY_MS
import com.android.systemui.statusbar.StatusBarState
import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayoutController
import com.android.systemui.statusbar.notification.stack.StackStateAnimator.ANIMATION_DURATION_WAKEUP
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CentralSurfacesCommandQueueCallbacksTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CentralSurfacesCommandQueueCallbacksTest.java
index 775d267..872c560 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CentralSurfacesCommandQueueCallbacksTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CentralSurfacesCommandQueueCallbacksTest.java
@@ -46,9 +46,9 @@
import com.android.systemui.qs.QSHost;
import com.android.systemui.settings.UserTracker;
import com.android.systemui.shade.CameraLauncher;
-import com.android.systemui.shade.NotificationPanelViewController;
import com.android.systemui.shade.QuickSettingsController;
import com.android.systemui.shade.ShadeController;
+import com.android.systemui.shade.ShadeViewController;
import com.android.systemui.statusbar.CommandQueue;
import com.android.systemui.statusbar.VibratorHelper;
import com.android.systemui.statusbar.disableflags.DisableFlagsLogger;
@@ -76,7 +76,7 @@
@Mock private ShadeController mShadeController;
@Mock private CommandQueue mCommandQueue;
@Mock private QuickSettingsController mQuickSettingsController;
- @Mock private NotificationPanelViewController mNotificationPanelViewController;
+ @Mock private ShadeViewController mShadeViewController;
@Mock private RemoteInputQuickSettingsDisabler mRemoteInputQuickSettingsDisabler;
private final MetricsLogger mMetricsLogger = new FakeMetricsLogger();
@Mock private KeyguardUpdateMonitor mKeyguardUpdateMonitor;
@@ -110,7 +110,7 @@
mContext.getResources(),
mShadeController,
mCommandQueue,
- mNotificationPanelViewController,
+ mShadeViewController,
mRemoteInputQuickSettingsDisabler,
mMetricsLogger,
mKeyguardUpdateMonitor,
@@ -153,9 +153,9 @@
// Trying to open it does nothing.
mSbcqCallbacks.animateExpandNotificationsPanel();
- verify(mNotificationPanelViewController, never()).expandToNotifications();
+ verify(mShadeViewController, never()).expandToNotifications();
mSbcqCallbacks.animateExpandSettingsPanel(null);
- verify(mNotificationPanelViewController, never()).expand(anyBoolean());
+ verify(mShadeViewController, never()).expand(anyBoolean());
}
@Test
@@ -171,9 +171,9 @@
// Can now be opened.
mSbcqCallbacks.animateExpandNotificationsPanel();
- verify(mNotificationPanelViewController).expandToNotifications();
+ verify(mShadeViewController).expandToNotifications();
mSbcqCallbacks.animateExpandSettingsPanel(null);
- verify(mNotificationPanelViewController).expandToQs();
+ verify(mShadeViewController).expandToQs();
}
@Test
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CentralSurfacesImplTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CentralSurfacesImplTest.java
index 589c8bc..ff3cea5 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CentralSurfacesImplTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CentralSurfacesImplTest.java
@@ -561,7 +561,7 @@
// TODO: we should be able to call mCentralSurfaces.start() and have all the below values
// initialized automatically and make NPVC private.
mCentralSurfaces.mNotificationShadeWindowView = mNotificationShadeWindowView;
- mCentralSurfaces.mNotificationPanelViewController = mNotificationPanelViewController;
+ mCentralSurfaces.mShadeSurface = mNotificationPanelViewController;
mCentralSurfaces.mQsController = mQuickSettingsController;
mCentralSurfaces.mDozeScrimController = mDozeScrimController;
mCentralSurfaces.mPresenter = mNotificationPresenter;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/DozeServiceHostTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/DozeServiceHostTest.java
index 996851e..2831d2f 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/DozeServiceHostTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/DozeServiceHostTest.java
@@ -41,8 +41,8 @@
import com.android.systemui.doze.DozeHost;
import com.android.systemui.doze.DozeLog;
import com.android.systemui.keyguard.WakefulnessLifecycle;
-import com.android.systemui.shade.NotificationPanelViewController;
import com.android.systemui.shade.NotificationShadeWindowViewController;
+import com.android.systemui.shade.ShadeViewController;
import com.android.systemui.statusbar.NotificationShadeWindowController;
import com.android.systemui.statusbar.PulseExpansionHandler;
import com.android.systemui.statusbar.StatusBarState;
@@ -87,7 +87,7 @@
@Mock private NotificationIconAreaController mNotificationIconAreaController;
@Mock private NotificationShadeWindowViewController mNotificationShadeWindowViewController;
@Mock private StatusBarKeyguardViewManager mStatusBarKeyguardViewManager;
- @Mock private NotificationPanelViewController mNotificationPanel;
+ @Mock private ShadeViewController mShadeViewController;
@Mock private View mAmbientIndicationContainer;
@Mock private BiometricUnlockController mBiometricUnlockController;
@Mock private AuthController mAuthController;
@@ -108,7 +108,7 @@
mCentralSurfaces,
mStatusBarKeyguardViewManager,
mNotificationShadeWindowViewController,
- mNotificationPanel,
+ mShadeViewController,
mAmbientIndicationContainer);
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/HeadsUpAppearanceControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/HeadsUpAppearanceControllerTest.java
index 3372dc3..205cebd 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/HeadsUpAppearanceControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/HeadsUpAppearanceControllerTest.java
@@ -38,8 +38,8 @@
import com.android.systemui.flags.Flags;
import com.android.systemui.plugins.DarkIconDispatcher;
import com.android.systemui.plugins.statusbar.StatusBarStateController;
-import com.android.systemui.shade.NotificationPanelViewController;
import com.android.systemui.shade.ShadeHeadsUpTracker;
+import com.android.systemui.shade.ShadeViewController;
import com.android.systemui.statusbar.CommandQueue;
import com.android.systemui.statusbar.HeadsUpStatusBarView;
import com.android.systemui.statusbar.notification.NotificationWakeUpCoordinator;
@@ -65,8 +65,8 @@
private final NotificationStackScrollLayoutController mStackScrollerController =
mock(NotificationStackScrollLayoutController.class);
- private final NotificationPanelViewController mPanelView =
- mock(NotificationPanelViewController.class);
+ private final ShadeViewController mShadeViewController =
+ mock(ShadeViewController.class);
private final ShadeHeadsUpTracker mShadeHeadsUpTracker = mock(ShadeHeadsUpTracker.class);
private final DarkIconDispatcher mDarkIconDispatcher = mock(DarkIconDispatcher.class);
private HeadsUpAppearanceController mHeadsUpAppearanceController;
@@ -104,7 +104,7 @@
mCommandQueue = mock(CommandQueue.class);
mNotificationRoundnessManager = mock(NotificationRoundnessManager.class);
mFeatureFlag = mock(FeatureFlags.class);
- when(mPanelView.getShadeHeadsUpTracker()).thenReturn(mShadeHeadsUpTracker);
+ when(mShadeViewController.getShadeHeadsUpTracker()).thenReturn(mShadeHeadsUpTracker);
when(mFeatureFlag.isEnabled(Flags.USE_ROUNDNESS_SOURCETYPES)).thenReturn(true);
mHeadsUpAppearanceController = new HeadsUpAppearanceController(
mock(NotificationIconAreaController.class),
@@ -116,7 +116,7 @@
mKeyguardStateController,
mCommandQueue,
mStackScrollerController,
- mPanelView,
+ mShadeViewController,
mNotificationRoundnessManager,
mFeatureFlag,
mHeadsUpStatusBarView,
@@ -200,7 +200,7 @@
mKeyguardStateController,
mCommandQueue,
mStackScrollerController,
- mPanelView,
+ mShadeViewController,
mNotificationRoundnessManager,
mFeatureFlag,
mHeadsUpStatusBarView,
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardStatusBarViewControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardStatusBarViewControllerTest.java
index 760a90b..e838a480 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardStatusBarViewControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardStatusBarViewControllerTest.java
@@ -52,7 +52,7 @@
import com.android.systemui.SysuiTestCase;
import com.android.systemui.battery.BatteryMeterViewController;
import com.android.systemui.plugins.statusbar.StatusBarStateController;
-import com.android.systemui.shade.NotificationPanelViewController;
+import com.android.systemui.shade.ShadeViewStateProvider;
import com.android.systemui.statusbar.CommandQueue;
import com.android.systemui.statusbar.NotificationMediaManager;
import com.android.systemui.statusbar.SysuiStatusBarStateController;
@@ -123,14 +123,14 @@
@Mock private NotificationMediaManager mNotificationMediaManager;
- private TestNotificationPanelViewStateProvider mNotificationPanelViewStateProvider;
+ private TestShadeViewStateProvider mShadeViewStateProvider;
private KeyguardStatusBarView mKeyguardStatusBarView;
private KeyguardStatusBarViewController mController;
private FakeExecutor mFakeExecutor = new FakeExecutor(new FakeSystemClock());
@Before
public void setup() throws Exception {
- mNotificationPanelViewStateProvider = new TestNotificationPanelViewStateProvider();
+ mShadeViewStateProvider = new TestShadeViewStateProvider();
MockitoAnnotations.initMocks(this);
@@ -158,7 +158,7 @@
mStatusBarIconController,
mIconManagerFactory,
mBatteryMeterViewController,
- mNotificationPanelViewStateProvider,
+ mShadeViewStateProvider,
mKeyguardStateController,
mKeyguardBypassController,
mKeyguardUpdateMonitor,
@@ -358,7 +358,7 @@
mController.onViewAttached();
updateStateToKeyguard();
- mNotificationPanelViewStateProvider.setPanelViewExpandedHeight(0);
+ mShadeViewStateProvider.setPanelViewExpandedHeight(0);
mController.updateViewState();
@@ -370,7 +370,7 @@
mController.onViewAttached();
updateStateToKeyguard();
- mNotificationPanelViewStateProvider.setLockscreenShadeDragProgress(1f);
+ mShadeViewStateProvider.setLockscreenShadeDragProgress(1f);
mController.updateViewState();
@@ -451,7 +451,7 @@
updateStateToKeyguard();
mKeyguardStatusBarView.setVisibility(View.VISIBLE);
- mNotificationPanelViewStateProvider.setShouldHeadsUpBeVisible(true);
+ mShadeViewStateProvider.setShouldHeadsUpBeVisible(true);
mController.updateForHeadsUp(/* animate= */ false);
assertThat(mKeyguardStatusBarView.getVisibility()).isEqualTo(View.INVISIBLE);
@@ -463,10 +463,10 @@
updateStateToKeyguard();
// Start with the opposite state.
- mNotificationPanelViewStateProvider.setShouldHeadsUpBeVisible(true);
+ mShadeViewStateProvider.setShouldHeadsUpBeVisible(true);
mController.updateForHeadsUp(/* animate= */ false);
- mNotificationPanelViewStateProvider.setShouldHeadsUpBeVisible(false);
+ mShadeViewStateProvider.setShouldHeadsUpBeVisible(false);
mController.updateForHeadsUp(/* animate= */ false);
assertThat(mKeyguardStatusBarView.getVisibility()).isEqualTo(View.VISIBLE);
@@ -591,10 +591,10 @@
return captor.getValue();
}
- private static class TestNotificationPanelViewStateProvider
- implements NotificationPanelViewController.NotificationPanelViewStateProvider {
+ private static class TestShadeViewStateProvider
+ implements ShadeViewStateProvider {
- TestNotificationPanelViewStateProvider() {}
+ TestShadeViewStateProvider() {}
private float mPanelViewExpandedHeight = 100f;
private boolean mShouldHeadsUpBeVisible = false;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/PhoneStatusBarViewControllerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/PhoneStatusBarViewControllerTest.kt
index 3edf33b..2d96e59 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/PhoneStatusBarViewControllerTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/PhoneStatusBarViewControllerTest.kt
@@ -27,9 +27,9 @@
import com.android.systemui.SysuiTestCase
import com.android.systemui.flags.FeatureFlags
import com.android.systemui.flags.Flags
-import com.android.systemui.shade.NotificationPanelViewController
import com.android.systemui.shade.ShadeControllerImpl
import com.android.systemui.shade.ShadeLogger
+import com.android.systemui.shade.ShadeViewController
import com.android.systemui.statusbar.policy.ConfigurationController
import com.android.systemui.unfold.SysUIUnfoldComponent
import com.android.systemui.unfold.config.UnfoldTransitionConfig
@@ -43,11 +43,11 @@
import org.junit.Test
import org.mockito.ArgumentCaptor
import org.mockito.Mock
-import org.mockito.Mockito.`when`
import org.mockito.Mockito.mock
import org.mockito.Mockito.never
import org.mockito.Mockito.spy
import org.mockito.Mockito.verify
+import org.mockito.Mockito.`when`
import org.mockito.MockitoAnnotations
import java.util.Optional
@@ -55,7 +55,7 @@
class PhoneStatusBarViewControllerTest : SysuiTestCase() {
@Mock
- private lateinit var notificationPanelViewController: NotificationPanelViewController
+ private lateinit var shadeViewController: ShadeViewController
@Mock
private lateinit var featureFlags: FeatureFlags
@Mock
@@ -134,58 +134,58 @@
val returnVal = view.onTouchEvent(
MotionEvent.obtain(0L, 0L, MotionEvent.ACTION_DOWN, 0f, 0f, 0))
assertThat(returnVal).isFalse()
- verify(notificationPanelViewController, never()).handleExternalTouch(any())
+ verify(shadeViewController, never()).handleExternalTouch(any())
}
@Test
fun handleTouchEventFromStatusBar_viewNotEnabled_returnsTrueAndNoViewEvent() {
`when`(centralSurfacesImpl.commandQueuePanelsEnabled).thenReturn(true)
- `when`(centralSurfacesImpl.notificationPanelViewController)
- .thenReturn(notificationPanelViewController)
- `when`(notificationPanelViewController.isViewEnabled).thenReturn(false)
+ `when`(centralSurfacesImpl.shadeViewController)
+ .thenReturn(shadeViewController)
+ `when`(shadeViewController.isViewEnabled).thenReturn(false)
val returnVal = view.onTouchEvent(
MotionEvent.obtain(0L, 0L, MotionEvent.ACTION_DOWN, 0f, 0f, 0))
assertThat(returnVal).isTrue()
- verify(notificationPanelViewController, never()).handleExternalTouch(any())
+ verify(shadeViewController, never()).handleExternalTouch(any())
}
@Test
fun handleTouchEventFromStatusBar_viewNotEnabledButIsMoveEvent_viewReceivesEvent() {
`when`(centralSurfacesImpl.commandQueuePanelsEnabled).thenReturn(true)
- `when`(centralSurfacesImpl.notificationPanelViewController)
- .thenReturn(notificationPanelViewController)
- `when`(notificationPanelViewController.isViewEnabled).thenReturn(false)
+ `when`(centralSurfacesImpl.shadeViewController)
+ .thenReturn(shadeViewController)
+ `when`(shadeViewController.isViewEnabled).thenReturn(false)
val event = MotionEvent.obtain(0L, 0L, MotionEvent.ACTION_MOVE, 0f, 0f, 0)
view.onTouchEvent(event)
- verify(notificationPanelViewController).handleExternalTouch(event)
+ verify(shadeViewController).handleExternalTouch(event)
}
@Test
fun handleTouchEventFromStatusBar_panelAndViewEnabled_viewReceivesEvent() {
`when`(centralSurfacesImpl.commandQueuePanelsEnabled).thenReturn(true)
- `when`(centralSurfacesImpl.notificationPanelViewController)
- .thenReturn(notificationPanelViewController)
- `when`(notificationPanelViewController.isViewEnabled).thenReturn(true)
+ `when`(centralSurfacesImpl.shadeViewController)
+ .thenReturn(shadeViewController)
+ `when`(shadeViewController.isViewEnabled).thenReturn(true)
val event = MotionEvent.obtain(0L, 0L, MotionEvent.ACTION_DOWN, 0f, 2f, 0)
view.onTouchEvent(event)
- verify(notificationPanelViewController).handleExternalTouch(event)
+ verify(shadeViewController).handleExternalTouch(event)
}
@Test
fun handleTouchEventFromStatusBar_topEdgeTouch_viewNeverReceivesEvent() {
`when`(centralSurfacesImpl.commandQueuePanelsEnabled).thenReturn(true)
- `when`(centralSurfacesImpl.notificationPanelViewController)
- .thenReturn(notificationPanelViewController)
- `when`(notificationPanelViewController.isFullyCollapsed).thenReturn(true)
+ `when`(centralSurfacesImpl.shadeViewController)
+ .thenReturn(shadeViewController)
+ `when`(shadeViewController.isFullyCollapsed).thenReturn(true)
val event = MotionEvent.obtain(0L, 0L, MotionEvent.ACTION_DOWN, 0f, 0f, 0)
view.onTouchEvent(event)
- verify(notificationPanelViewController, never()).handleExternalTouch(any())
+ verify(shadeViewController, never()).handleExternalTouch(any())
}
private fun createViewMock(): PhoneStatusBarView {
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/PhoneStatusBarViewTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/PhoneStatusBarViewTest.kt
index 3ed454f..9c10131 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/PhoneStatusBarViewTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/PhoneStatusBarViewTest.kt
@@ -21,7 +21,7 @@
import androidx.test.filters.SmallTest
import com.android.systemui.Gefingerpoken
import com.android.systemui.SysuiTestCase
-import com.android.systemui.shade.NotificationPanelViewController
+import com.android.systemui.shade.ShadeViewController
import com.google.common.truth.Truth.assertThat
import org.junit.Before
import org.junit.Test
@@ -32,7 +32,7 @@
class PhoneStatusBarViewTest : SysuiTestCase() {
@Mock
- private lateinit var notificationPanelViewController: NotificationPanelViewController
+ private lateinit var shadeViewController: ShadeViewController
@Mock
private lateinit var panelView: ViewGroup
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManagerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManagerTest.java
index 14aee4e..4ff225c 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManagerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManagerTest.java
@@ -73,11 +73,11 @@
import com.android.systemui.navigationbar.NavigationModeController;
import com.android.systemui.navigationbar.TaskbarDelegate;
import com.android.systemui.plugins.ActivityStarter.OnDismissAction;
-import com.android.systemui.shade.NotificationPanelViewController;
import com.android.systemui.shade.NotificationShadeWindowView;
import com.android.systemui.shade.ShadeController;
import com.android.systemui.shade.ShadeExpansionChangeEvent;
import com.android.systemui.shade.ShadeExpansionStateManager;
+import com.android.systemui.shade.ShadeViewController;
import com.android.systemui.statusbar.NotificationMediaManager;
import com.android.systemui.statusbar.NotificationShadeWindowController;
import com.android.systemui.statusbar.StatusBarState;
@@ -110,7 +110,7 @@
@Mock private LockPatternUtils mLockPatternUtils;
@Mock private CentralSurfaces mCentralSurfaces;
@Mock private ViewGroup mContainer;
- @Mock private NotificationPanelViewController mNotificationPanelView;
+ @Mock private ShadeViewController mShadeViewController;
@Mock private BiometricUnlockController mBiometricUnlockController;
@Mock private SysuiStatusBarStateController mStatusBarStateController;
@Mock private KeyguardUpdateMonitor mKeyguardUpdateMonitor;
@@ -202,7 +202,7 @@
.thenReturn(mOnBackInvokedDispatcher);
mStatusBarKeyguardViewManager.registerCentralSurfaces(
mCentralSurfaces,
- mNotificationPanelView,
+ mShadeViewController,
new ShadeExpansionStateManager(),
mBiometricUnlockController,
mNotificationContainer,
@@ -250,7 +250,7 @@
@Test
public void onPanelExpansionChanged_neverShowsDuringHintAnimation() {
- when(mNotificationPanelView.isUnlockHintRunning()).thenReturn(true);
+ when(mShadeViewController.isUnlockHintRunning()).thenReturn(true);
mStatusBarKeyguardViewManager.onPanelExpansionChanged(EXPANSION_EVENT);
verify(mPrimaryBouncerInteractor, never()).setPanelExpansion(anyFloat());
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarNotificationActivityStarterTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarNotificationActivityStarterTest.java
index ee7e082..d6ae2b7 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarNotificationActivityStarterTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarNotificationActivityStarterTest.java
@@ -66,9 +66,9 @@
import com.android.systemui.plugins.ActivityStarter.OnDismissAction;
import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.settings.UserTracker;
-import com.android.systemui.shade.NotificationPanelViewController;
import com.android.systemui.shade.NotificationShadeWindowViewController;
import com.android.systemui.shade.ShadeControllerImpl;
+import com.android.systemui.shade.ShadeViewController;
import com.android.systemui.statusbar.NotificationClickNotifier;
import com.android.systemui.statusbar.NotificationLockscreenUserManager;
import com.android.systemui.statusbar.NotificationPresenter;
@@ -232,7 +232,7 @@
mOnUserInteractionCallback,
mCentralSurfaces,
mock(NotificationPresenter.class),
- mock(NotificationPanelViewController.class),
+ mock(ShadeViewController.class),
mActivityLaunchAnimator,
notificationAnimationProvider,
mock(LaunchFullScreenIntentProvider.class),
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenterTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenterTest.java
index c16d140..fdfe028 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenterTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenterTest.java
@@ -38,11 +38,11 @@
import com.android.systemui.plugins.ActivityStarter;
import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.settings.FakeDisplayTracker;
-import com.android.systemui.shade.NotificationPanelViewController;
import com.android.systemui.shade.NotificationShadeWindowView;
import com.android.systemui.shade.QuickSettingsController;
import com.android.systemui.shade.ShadeController;
import com.android.systemui.shade.ShadeNotificationPresenter;
+import com.android.systemui.shade.ShadeViewController;
import com.android.systemui.statusbar.CommandQueue;
import com.android.systemui.statusbar.KeyguardIndicationController;
import com.android.systemui.statusbar.LockscreenShadeTransitionController;
@@ -107,12 +107,12 @@
mock(NotificationStackScrollLayout.class));
when(notificationShadeWindowView.getResources()).thenReturn(mContext.getResources());
- NotificationPanelViewController npvc = mock(NotificationPanelViewController.class);
- when(npvc.getShadeNotificationPresenter())
+ ShadeViewController shadeViewController = mock(ShadeViewController.class);
+ when(shadeViewController.getShadeNotificationPresenter())
.thenReturn(mock(ShadeNotificationPresenter.class));
mStatusBarNotificationPresenter = new StatusBarNotificationPresenter(
mContext,
- npvc,
+ shadeViewController,
mock(QuickSettingsController.class),
mock(HeadsUpManagerPhone.class),
notificationShadeWindowView,
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/UnlockedScreenOffAnimationControllerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/UnlockedScreenOffAnimationControllerTest.kt
index 02c459b..3c644a5 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/UnlockedScreenOffAnimationControllerTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/UnlockedScreenOffAnimationControllerTest.kt
@@ -25,7 +25,7 @@
import com.android.systemui.SysuiTestCase
import com.android.systemui.keyguard.KeyguardViewMediator
import com.android.systemui.keyguard.WakefulnessLifecycle
-import com.android.systemui.shade.NotificationPanelViewController
+import com.android.systemui.shade.ShadeViewController
import com.android.systemui.statusbar.LightRevealScrim
import com.android.systemui.statusbar.StatusBarStateControllerImpl
import com.android.systemui.statusbar.policy.KeyguardStateController
@@ -59,9 +59,9 @@
@Mock
private lateinit var globalSettings: GlobalSettings
@Mock
- private lateinit var mCentralSurfaces: CentralSurfaces
+ private lateinit var centralSurfaces: CentralSurfaces
@Mock
- private lateinit var notificationPanelViewController: NotificationPanelViewController
+ private lateinit var shadeViewController: ShadeViewController
@Mock
private lateinit var lightRevealScrim: LightRevealScrim
@Mock
@@ -91,13 +91,13 @@
powerManager,
handler = handler
)
- controller.initialize(mCentralSurfaces, lightRevealScrim)
- `when`(mCentralSurfaces.notificationPanelViewController).thenReturn(
- notificationPanelViewController)
+ controller.initialize(centralSurfaces, lightRevealScrim)
+ `when`(centralSurfaces.shadeViewController).thenReturn(
+ shadeViewController)
// Screen off does not run if the panel is expanded, so we should say it's collapsed to test
// screen off.
- `when`(notificationPanelViewController.isFullyCollapsed).thenReturn(true)
+ `when`(shadeViewController.isFullyCollapsed).thenReturn(true)
}
@After
@@ -127,7 +127,7 @@
callbackCaptor.value.run()
- verify(notificationPanelViewController, times(1)).showAodUi()
+ verify(shadeViewController, times(1)).showAodUi()
}
/**
@@ -149,7 +149,7 @@
verify(handler).postDelayed(callbackCaptor.capture(), anyLong())
callbackCaptor.value.run()
- verify(notificationPanelViewController, never()).showAodUi()
+ verify(shadeViewController, never()).showAodUi()
}
@Test
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/fragment/CollapsedStatusBarFragmentTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/fragment/CollapsedStatusBarFragmentTest.java
index be0c83f..2a3c775 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/fragment/CollapsedStatusBarFragmentTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/fragment/CollapsedStatusBarFragmentTest.java
@@ -56,8 +56,8 @@
import com.android.systemui.plugins.log.LogBuffer;
import com.android.systemui.plugins.log.LogcatEchoTracker;
import com.android.systemui.plugins.statusbar.StatusBarStateController;
-import com.android.systemui.shade.NotificationPanelViewController;
import com.android.systemui.shade.ShadeExpansionStateManager;
+import com.android.systemui.shade.ShadeViewController;
import com.android.systemui.statusbar.CommandQueue;
import com.android.systemui.statusbar.OperatorNameViewController;
import com.android.systemui.statusbar.disableflags.DisableFlagsLogger;
@@ -117,7 +117,7 @@
@Mock
private HeadsUpAppearanceController mHeadsUpAppearanceController;
@Mock
- private NotificationPanelViewController mNotificationPanelViewController;
+ private ShadeViewController mShadeViewController;
@Mock
private StatusBarIconController.DarkIconManager.Factory mIconManagerFactory;
@Mock
@@ -507,7 +507,7 @@
mIconManagerFactory,
mStatusBarHideIconsForBouncerManager,
mKeyguardStateController,
- mNotificationPanelViewController,
+ mShadeViewController,
mStatusBarStateController,
mCommandQueue,
mCarrierConfigTracker,
diff --git a/packages/SystemUI/tests/src/com/android/systemui/unfold/FoldAodAnimationControllerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/unfold/FoldAodAnimationControllerTest.kt
index dfbd61b..8fc0a1a 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/unfold/FoldAodAnimationControllerTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/unfold/FoldAodAnimationControllerTest.kt
@@ -31,8 +31,8 @@
import com.android.systemui.keyguard.data.repository.FakeKeyguardBouncerRepository
import com.android.systemui.keyguard.data.repository.FakeKeyguardRepository
import com.android.systemui.keyguard.domain.interactor.KeyguardInteractor
-import com.android.systemui.shade.NotificationPanelViewController
import com.android.systemui.shade.ShadeFoldAnimator
+import com.android.systemui.shade.ShadeViewController
import com.android.systemui.statusbar.CommandQueue
import com.android.systemui.statusbar.LightRevealScrim
import com.android.systemui.statusbar.phone.CentralSurfaces
@@ -74,7 +74,7 @@
@Mock lateinit var lightRevealScrim: LightRevealScrim
- @Mock lateinit var notificationPanelViewController: NotificationPanelViewController
+ @Mock lateinit var shadeViewController: ShadeViewController
@Mock lateinit var viewGroup: ViewGroup
@@ -100,13 +100,12 @@
deviceStates = FoldableTestUtils.findDeviceStates(context)
// TODO(b/254878364): remove this call to NPVC.getView()
- whenever(notificationPanelViewController.shadeFoldAnimator).thenReturn(shadeFoldAnimator)
+ whenever(shadeViewController.shadeFoldAnimator).thenReturn(shadeFoldAnimator)
whenever(shadeFoldAnimator.view).thenReturn(viewGroup)
whenever(viewGroup.viewTreeObserver).thenReturn(viewTreeObserver)
whenever(wakefulnessLifecycle.lastSleepReason)
.thenReturn(PowerManager.GO_TO_SLEEP_REASON_DEVICE_FOLD)
- whenever(centralSurfaces.notificationPanelViewController)
- .thenReturn(notificationPanelViewController)
+ whenever(centralSurfaces.shadeViewController).thenReturn(shadeViewController)
whenever(shadeFoldAnimator.startFoldToAodAnimation(any(), any(), any())).then {
val onActionStarted = it.arguments[0] as Runnable
onActionStarted.run()
diff --git a/packages/SystemUI/tests/src/com/android/systemui/volume/VolumeDialogImplTest.java b/packages/SystemUI/tests/src/com/android/systemui/volume/VolumeDialogImplTest.java
index e33bfd7..e06b43a 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/volume/VolumeDialogImplTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/volume/VolumeDialogImplTest.java
@@ -374,7 +374,7 @@
@After
public void teardown() {
if (mDialog != null) {
- mDialog.clearInternalHandleAfterTest();
+ mDialog.clearInternalHandlerAfterTest();
}
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/wmshell/BubblesTest.java b/packages/SystemUI/tests/src/com/android/systemui/wmshell/BubblesTest.java
index a42acd3..9a99538 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/wmshell/BubblesTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/wmshell/BubblesTest.java
@@ -85,7 +85,6 @@
import com.android.internal.colorextraction.ColorExtractor;
import com.android.internal.logging.UiEventLogger;
import com.android.internal.statusbar.IStatusBarService;
-import com.android.launcher3.icons.BubbleBadgeIconFactory;
import com.android.launcher3.icons.BubbleIconFactory;
import com.android.systemui.R;
import com.android.systemui.SysuiTestCase;
@@ -1227,8 +1226,7 @@
mBubbleController,
mBubbleController.getStackView(),
new BubbleIconFactory(mContext,
- mContext.getResources().getDimensionPixelSize(R.dimen.bubble_size)),
- new BubbleBadgeIconFactory(mContext,
+ mContext.getResources().getDimensionPixelSize(R.dimen.bubble_size),
mContext.getResources().getDimensionPixelSize(R.dimen.bubble_badge_size),
mContext.getResources().getColor(R.color.important_conversation),
mContext.getResources().getDimensionPixelSize(
diff --git a/services/autofill/java/com/android/server/autofill/ui/SaveUi.java b/services/autofill/java/com/android/server/autofill/ui/SaveUi.java
index 756dcd2..b68adab 100644
--- a/services/autofill/java/com/android/server/autofill/ui/SaveUi.java
+++ b/services/autofill/java/com/android/server/autofill/ui/SaveUi.java
@@ -361,6 +361,7 @@
params.width = WindowManager.LayoutParams.MATCH_PARENT;
params.accessibilityTitle = context.getString(R.string.autofill_save_accessibility_title);
params.windowAnimations = R.style.AutofillSaveAnimation;
+ params.setTrustedOverlay();
show();
}
diff --git a/services/companion/java/com/android/server/companion/CompanionDeviceManagerService.java b/services/companion/java/com/android/server/companion/CompanionDeviceManagerService.java
index d2c41a4..efff112 100644
--- a/services/companion/java/com/android/server/companion/CompanionDeviceManagerService.java
+++ b/services/companion/java/com/android/server/companion/CompanionDeviceManagerService.java
@@ -900,7 +900,7 @@
String[] args, ShellCallback callback, ResultReceiver resultReceiver)
throws RemoteException {
new CompanionDeviceShellCommand(CompanionDeviceManagerService.this, mAssociationStore,
- mDevicePresenceMonitor, mTransportManager)
+ mDevicePresenceMonitor, mTransportManager, mSystemDataTransferRequestStore)
.exec(this, in, out, err, args, callback, resultReceiver);
}
diff --git a/services/companion/java/com/android/server/companion/CompanionDeviceShellCommand.java b/services/companion/java/com/android/server/companion/CompanionDeviceShellCommand.java
index 6de3585..669686ad 100644
--- a/services/companion/java/com/android/server/companion/CompanionDeviceShellCommand.java
+++ b/services/companion/java/com/android/server/companion/CompanionDeviceShellCommand.java
@@ -17,10 +17,12 @@
package com.android.server.companion;
import android.companion.AssociationInfo;
+import android.companion.datatransfer.PermissionSyncRequest;
import android.net.MacAddress;
import android.os.Binder;
import android.os.ShellCommand;
+import com.android.server.companion.datatransfer.SystemDataTransferRequestStore;
import com.android.server.companion.presence.CompanionDevicePresenceMonitor;
import com.android.server.companion.transport.CompanionTransportManager;
@@ -35,14 +37,18 @@
private final CompanionDevicePresenceMonitor mDevicePresenceMonitor;
private final CompanionTransportManager mTransportManager;
+ private final SystemDataTransferRequestStore mSystemDataTransferRequestStore;
+
CompanionDeviceShellCommand(CompanionDeviceManagerService service,
AssociationStore associationStore,
CompanionDevicePresenceMonitor devicePresenceMonitor,
- CompanionTransportManager transportManager) {
+ CompanionTransportManager transportManager,
+ SystemDataTransferRequestStore systemDataTransferRequestStore) {
mService = service;
mAssociationStore = associationStore;
mDevicePresenceMonitor = devicePresenceMonitor;
mTransportManager = transportManager;
+ mSystemDataTransferRequestStore = systemDataTransferRequestStore;
}
@Override
@@ -59,7 +65,7 @@
// TODO(b/212535524): use AssociationInfo.toShortString(), once it's not
// longer referenced in tests.
out.println(association.getPackageName() + " "
- + association.getDeviceMacAddress());
+ + association.getDeviceMacAddress() + " " + association.getId());
}
}
break;
@@ -117,6 +123,17 @@
mTransportManager.createDummyTransport(associationId);
break;
+ case "allow-permission-sync": {
+ int userId = getNextIntArgRequired();
+ associationId = getNextIntArgRequired();
+ boolean enabled = getNextBooleanArgRequired();
+ PermissionSyncRequest request = new PermissionSyncRequest(associationId);
+ request.setUserId(userId);
+ request.setUserConsented(enabled);
+ mSystemDataTransferRequestStore.writeRequest(userId, request);
+ }
+ break;
+
default:
return handleDefaultCommands(cmd);
}
@@ -134,6 +151,15 @@
return Integer.parseInt(getNextArgRequired());
}
+ private boolean getNextBooleanArgRequired() {
+ String arg = getNextArgRequired();
+ if ("true".equalsIgnoreCase(arg) || "false".equalsIgnoreCase(arg)) {
+ return Boolean.parseBoolean(arg);
+ } else {
+ throw new IllegalArgumentException("Expected a boolean argument but was: " + arg);
+ }
+ }
+
@Override
public void onHelp() {
PrintWriter pw = getOutPrintWriter();
diff --git a/services/companion/java/com/android/server/companion/datatransfer/SystemDataTransferRequestStore.java b/services/companion/java/com/android/server/companion/datatransfer/SystemDataTransferRequestStore.java
index 2c5d582..720cefa 100644
--- a/services/companion/java/com/android/server/companion/datatransfer/SystemDataTransferRequestStore.java
+++ b/services/companion/java/com/android/server/companion/datatransfer/SystemDataTransferRequestStore.java
@@ -120,12 +120,14 @@
return requestsByAssociationId;
}
- void writeRequest(@UserIdInt int userId, SystemDataTransferRequest request) {
+ public void writeRequest(@UserIdInt int userId, SystemDataTransferRequest request) {
Slog.i(LOG_TAG, "Writing request=" + request + " to store.");
ArrayList<SystemDataTransferRequest> cachedRequests;
synchronized (mLock) {
// Write to cache
cachedRequests = readRequestsFromCache(userId);
+ cachedRequests.removeIf(
+ request1 -> request1.getAssociationId() == request.getAssociationId());
cachedRequests.add(request);
mCachedPerUser.set(userId, cachedRequests);
}
diff --git a/services/companion/java/com/android/server/companion/securechannel/SecureChannel.java b/services/companion/java/com/android/server/companion/securechannel/SecureChannel.java
index a8519e3..0457e9a 100644
--- a/services/companion/java/com/android/server/companion/securechannel/SecureChannel.java
+++ b/services/companion/java/com/android/server/companion/securechannel/SecureChannel.java
@@ -28,7 +28,6 @@
import com.google.security.cryptauth.lib.securegcm.D2DConnectionContextV1;
import com.google.security.cryptauth.lib.securegcm.D2DHandshakeContext;
import com.google.security.cryptauth.lib.securegcm.D2DHandshakeContext.Role;
-import com.google.security.cryptauth.lib.securegcm.DefaultUkey2Logger;
import com.google.security.cryptauth.lib.securegcm.HandshakeException;
import libcore.io.IoUtils;
@@ -329,7 +328,7 @@
}
mRole = Role.Initiator;
- mHandshakeContext = D2DHandshakeContext.forInitiator(DefaultUkey2Logger.INSTANCE);
+ mHandshakeContext = D2DHandshakeContext.forInitiator();
// Send Client Init
if (DEBUG) {
@@ -350,7 +349,7 @@
if (mHandshakeContext == null) { // Server-side logic
mRole = Role.Responder;
- mHandshakeContext = D2DHandshakeContext.forResponder(DefaultUkey2Logger.INSTANCE);
+ mHandshakeContext = D2DHandshakeContext.forResponder();
// Receive Client Init
if (DEBUG) {
diff --git a/services/core/java/com/android/server/SystemConfig.java b/services/core/java/com/android/server/SystemConfig.java
index 4b76127..7fae31c 100644
--- a/services/core/java/com/android/server/SystemConfig.java
+++ b/services/core/java/com/android/server/SystemConfig.java
@@ -338,6 +338,9 @@
// marked as stopped by the system
@NonNull private final Set<String> mInitialNonStoppedSystemPackages = new ArraySet<>();
+ // A map of preloaded package names and the path to its app metadata file path.
+ private final ArrayMap<String, String> mAppMetadataFilePaths = new ArrayMap<>();
+
/**
* Map of system pre-defined, uniquely named actors; keys are namespace,
* value maps actor name to package name.
@@ -536,6 +539,10 @@
return mInitialNonStoppedSystemPackages;
}
+ public ArrayMap<String, String> getAppMetadataFilePaths() {
+ return mAppMetadataFilePaths;
+ }
+
/**
* Only use for testing. Do NOT use in production code.
* @param readPermissions false to create an empty SystemConfig; true to read the permissions.
@@ -1466,7 +1473,20 @@
} else if (!Boolean.parseBoolean(stopped)) {
mInitialNonStoppedSystemPackages.add(pkgName);
}
- }
+ } break;
+ case "asl-file": {
+ String packageName = parser.getAttributeValue(null, "package");
+ String path = parser.getAttributeValue(null, "path");
+ if (TextUtils.isEmpty(packageName)) {
+ Slog.w(TAG, "<" + name + "> without valid package in " + permFile
+ + " at " + parser.getPositionDescription());
+ } else if (TextUtils.isEmpty(path)) {
+ Slog.w(TAG, "<" + name + "> without valid path in " + permFile
+ + " at " + parser.getPositionDescription());
+ } else {
+ mAppMetadataFilePaths.put(packageName, path);
+ }
+ } break;
default: {
Slog.w(TAG, "Tag " + name + " is unknown in "
+ permFile + " at " + parser.getPositionDescription());
diff --git a/services/core/java/com/android/server/am/AnrHelper.java b/services/core/java/com/android/server/am/AnrHelper.java
index 16219cd..7d98443 100644
--- a/services/core/java/com/android/server/am/AnrHelper.java
+++ b/services/core/java/com/android/server/am/AnrHelper.java
@@ -22,6 +22,7 @@
import android.content.pm.ApplicationInfo;
import android.os.SystemClock;
import android.os.Trace;
+import android.util.ArraySet;
import android.util.Slog;
import com.android.internal.annotations.GuardedBy;
@@ -29,8 +30,12 @@
import com.android.internal.os.TimeoutRecord;
import com.android.server.wm.WindowProcessController;
+import java.io.File;
import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Set;
import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Future;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.ThreadPoolExecutor;
@@ -59,13 +64,19 @@
/**
* The keep alive time for the threads in the helper threadpool executor
*/
- private static final int AUX_THREAD_KEEP_ALIVE_SECOND = 10;
+ private static final int DEFAULT_THREAD_KEEP_ALIVE_SECOND = 10;
private static final ThreadFactory sDefaultThreadFactory = r ->
new Thread(r, "AnrAuxiliaryTaskExecutor");
+ private static final ThreadFactory sMainProcessDumpThreadFactory = r ->
+ new Thread(r, "AnrMainProcessDumpThread");
@GuardedBy("mAnrRecords")
private final ArrayList<AnrRecord> mAnrRecords = new ArrayList<>();
+
+ private final Set<Integer> mTempDumpedPids =
+ Collections.synchronizedSet(new ArraySet<Integer>());
+
private final AtomicBoolean mRunning = new AtomicBoolean(false);
private final ActivityManagerService mService;
@@ -80,17 +91,21 @@
private int mProcessingPid = -1;
private final ExecutorService mAuxiliaryTaskExecutor;
+ private final ExecutorService mEarlyDumpExecutor;
AnrHelper(final ActivityManagerService service) {
- this(service, new ThreadPoolExecutor(/* corePoolSize= */ 0, /* maximumPoolSize= */ 1,
- /* keepAliveTime= */ AUX_THREAD_KEEP_ALIVE_SECOND, TimeUnit.SECONDS,
- new LinkedBlockingQueue<>(), sDefaultThreadFactory));
+ // All the ANR threads need to expire after a period of inactivity, given the
+ // ephemeral nature of ANRs and how infrequent they are.
+ this(service, makeExpiringThreadPoolWithSize(1, sDefaultThreadFactory),
+ makeExpiringThreadPoolWithSize(2, sMainProcessDumpThreadFactory));
}
@VisibleForTesting
- AnrHelper(ActivityManagerService service, ExecutorService auxExecutor) {
+ AnrHelper(ActivityManagerService service, ExecutorService auxExecutor,
+ ExecutorService earlyDumpExecutor) {
mService = service;
mAuxiliaryTaskExecutor = auxExecutor;
+ mEarlyDumpExecutor = earlyDumpExecutor;
}
void appNotResponding(ProcessRecord anrProcess, TimeoutRecord timeoutRecord) {
@@ -121,6 +136,12 @@
+ timeoutRecord.mReason);
return;
}
+ if (!mTempDumpedPids.add(incomingPid)) {
+ Slog.i(TAG,
+ "Skip ANR being predumped, pid=" + incomingPid + " "
+ + timeoutRecord.mReason);
+ return;
+ }
for (int i = mAnrRecords.size() - 1; i >= 0; i--) {
if (mAnrRecords.get(i).mPid == incomingPid) {
Slog.i(TAG,
@@ -129,10 +150,24 @@
return;
}
}
+ // We dump the main process as soon as we can on a different thread,
+ // this is done as the main process's dump can go stale in a few hundred
+ // milliseconds and the average full ANR dump takes a few seconds.
+ timeoutRecord.mLatencyTracker.earlyDumpRequestSubmittedWithSize(
+ mTempDumpedPids.size());
+ Future<File> firstPidDumpPromise = mEarlyDumpExecutor.submit(() -> {
+ // the class AnrLatencyTracker is not generally thread safe but the values
+ // recorded/touched by the Temporary dump thread(s) are all volatile/atomic.
+ File tracesFile = StackTracesDumpHelper.dumpStackTracesTempFile(incomingPid,
+ timeoutRecord.mLatencyTracker);
+ mTempDumpedPids.remove(incomingPid);
+ return tracesFile;
+ });
+
timeoutRecord.mLatencyTracker.anrRecordPlacingOnQueueWithSize(mAnrRecords.size());
mAnrRecords.add(new AnrRecord(anrProcess, activityShortComponentName, aInfo,
- parentShortComponentName, parentProcess, aboveSystem,
- mAuxiliaryTaskExecutor, timeoutRecord, isContinuousAnr));
+ parentShortComponentName, parentProcess, aboveSystem, timeoutRecord,
+ isContinuousAnr, firstPidDumpPromise));
}
startAnrConsumerIfNeeded();
} finally {
@@ -147,6 +182,16 @@
}
}
+ private static ThreadPoolExecutor makeExpiringThreadPoolWithSize(int size,
+ ThreadFactory factory) {
+ ThreadPoolExecutor pool = new ThreadPoolExecutor(/* corePoolSize= */ size,
+ /* maximumPoolSize= */ size, /* keepAliveTime= */ DEFAULT_THREAD_KEEP_ALIVE_SECOND,
+ TimeUnit.SECONDS, new LinkedBlockingQueue<>(), factory);
+ // We allow the core threads to expire after the keepAliveTime.
+ pool.allowCoreThreadTimeOut(true);
+ return pool;
+ }
+
/**
* The thread to execute {@link ProcessErrorStateRecord#appNotResponding}. It will terminate if
* all records are handled.
@@ -219,7 +264,7 @@
}
}
- private static class AnrRecord {
+ private class AnrRecord {
final ProcessRecord mApp;
final int mPid;
final String mActivityShortComponentName;
@@ -228,14 +273,14 @@
final ApplicationInfo mAppInfo;
final WindowProcessController mParentProcess;
final boolean mAboveSystem;
- final ExecutorService mAuxiliaryTaskExecutor;
final long mTimestamp = SystemClock.uptimeMillis();
final boolean mIsContinuousAnr;
+ final Future<File> mFirstPidFilePromise;
AnrRecord(ProcessRecord anrProcess, String activityShortComponentName,
ApplicationInfo aInfo, String parentShortComponentName,
WindowProcessController parentProcess, boolean aboveSystem,
- ExecutorService auxiliaryTaskExecutor, TimeoutRecord timeoutRecord,
- boolean isContinuousAnr) {
+ TimeoutRecord timeoutRecord, boolean isContinuousAnr,
+ Future<File> firstPidFilePromise) {
mApp = anrProcess;
mPid = anrProcess.mPid;
mActivityShortComponentName = activityShortComponentName;
@@ -244,8 +289,8 @@
mAppInfo = aInfo;
mParentProcess = parentProcess;
mAboveSystem = aboveSystem;
- mAuxiliaryTaskExecutor = auxiliaryTaskExecutor;
mIsContinuousAnr = isContinuousAnr;
+ mFirstPidFilePromise = firstPidFilePromise;
}
void appNotResponding(boolean onlyDumpSelf) {
@@ -254,7 +299,7 @@
mApp.mErrorState.appNotResponding(mActivityShortComponentName, mAppInfo,
mParentShortComponentName, mParentProcess, mAboveSystem,
mTimeoutRecord, mAuxiliaryTaskExecutor, onlyDumpSelf,
- mIsContinuousAnr);
+ mIsContinuousAnr, mFirstPidFilePromise);
} finally {
mTimeoutRecord.mLatencyTracker.anrProcessingEnded();
}
diff --git a/services/core/java/com/android/server/am/ForegroundServiceTypeLoggerModule.java b/services/core/java/com/android/server/am/ForegroundServiceTypeLoggerModule.java
index 993595b..8f84b08 100644
--- a/services/core/java/com/android/server/am/ForegroundServiceTypeLoggerModule.java
+++ b/services/core/java/com/android/server/am/ForegroundServiceTypeLoggerModule.java
@@ -190,6 +190,10 @@
// and also clean up the start calls stack by UID
final ArrayList<Integer> apiTypes = convertFgsTypeToApiTypes(record.foregroundServiceType);
final UidState uidState = mUids.get(uid);
+ if (uidState == null) {
+ Log.e(TAG, "FGS stop call being logged with no start call for UID " + uid);
+ return;
+ }
final ArrayList<Integer> apisFound = new ArrayList<>();
final ArrayList<Long> timestampsFound = new ArrayList<>();
for (int i = 0, size = apiTypes.size(); i < size; i++) {
diff --git a/services/core/java/com/android/server/am/OomAdjuster.java b/services/core/java/com/android/server/am/OomAdjuster.java
index 365dcd9..c3519d2 100644
--- a/services/core/java/com/android/server/am/OomAdjuster.java
+++ b/services/core/java/com/android/server/am/OomAdjuster.java
@@ -1482,7 +1482,10 @@
}
if (uidRec.isIdle() && !uidRec.isSetIdle()) {
uidChange |= UidRecord.CHANGE_IDLE;
- becameIdle.add(uidRec);
+ if (uidRec.getSetProcState() != PROCESS_STATE_NONEXISTENT) {
+ // don't stop the bg services if it's just started.
+ becameIdle.add(uidRec);
+ }
}
} else {
if (uidRec.isIdle()) {
diff --git a/services/core/java/com/android/server/am/ProcessErrorStateRecord.java b/services/core/java/com/android/server/am/ProcessErrorStateRecord.java
index ca41f42..e498384 100644
--- a/services/core/java/com/android/server/am/ProcessErrorStateRecord.java
+++ b/services/core/java/com/android/server/am/ProcessErrorStateRecord.java
@@ -290,7 +290,7 @@
String parentShortComponentName, WindowProcessController parentProcess,
boolean aboveSystem, TimeoutRecord timeoutRecord,
ExecutorService auxiliaryTaskExecutor, boolean onlyDumpSelf,
- boolean isContinuousAnr) {
+ boolean isContinuousAnr, Future<File> firstPidFilePromise) {
String annotation = timeoutRecord.mReason;
AnrLatencyTracker latencyTracker = timeoutRecord.mLatencyTracker;
Future<?> updateCpuStatsNowFirstCall = null;
@@ -335,7 +335,6 @@
Counter.logIncrement("stability_anr.value_skipped_anrs");
return;
}
-
// In case we come through here for the same app before completing
// this one, mark as anring now so we will bail out.
latencyTracker.waitingOnProcLockStarted();
@@ -369,6 +368,9 @@
firstPids.add(pid);
// Don't dump other PIDs if it's a background ANR or is requested to only dump self.
+ // Note that the primary pid is added here just in case, as it should normally be
+ // dumped on the early dump thread, and would only be dumped on the Anr consumer thread
+ // as a fallback.
isSilentAnr = isSilentAnr();
if (!isSilentAnr && !onlyDumpSelf) {
int parentPid = pid;
@@ -501,7 +503,8 @@
File tracesFile = StackTracesDumpHelper.dumpStackTraces(firstPids,
isSilentAnr ? null : processCpuTracker, isSilentAnr ? null : lastPids,
nativePidsFuture, tracesFileException, firstPidEndOffset, annotation,
- criticalEventLog, memoryHeaders, auxiliaryTaskExecutor, latencyTracker);
+ criticalEventLog, memoryHeaders, auxiliaryTaskExecutor, firstPidFilePromise,
+ latencyTracker);
if (isMonitorCpuUsage()) {
// Wait for the first call to finish
diff --git a/services/core/java/com/android/server/am/StackTracesDumpHelper.java b/services/core/java/com/android/server/am/StackTracesDumpHelper.java
index 10ddc2f..01fb0d1 100644
--- a/services/core/java/com/android/server/am/StackTracesDumpHelper.java
+++ b/services/core/java/com/android/server/am/StackTracesDumpHelper.java
@@ -41,6 +41,7 @@
import java.io.PrintWriter;
import java.io.StringWriter;
import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
@@ -50,6 +51,8 @@
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Executor;
import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
import java.util.concurrent.atomic.AtomicLong;
import java.util.function.Supplier;
@@ -65,11 +68,16 @@
new SimpleDateFormat("yyyy-MM-dd-HH-mm-ss-SSS");
static final String ANR_FILE_PREFIX = "anr_";
- public static final String ANR_TRACE_DIR = "/data/anr";
+ static final String ANR_TEMP_FILE_PREFIX = "temp_anr_";
+ public static final String ANR_TRACE_DIR = "/data/anr";
private static final int NATIVE_DUMP_TIMEOUT_MS =
2000 * Build.HW_TIMEOUT_MULTIPLIER; // 2 seconds;
private static final int JAVA_DUMP_MINIMUM_SIZE = 100; // 100 bytes.
+ // The time limit for a single process's dump
+ private static final int TEMP_DUMP_TIME_LIMIT =
+ 10 * 1000 * Build.HW_TIMEOUT_MULTIPLIER; // 10 seconds
+
/**
* If a stack trace dump file is configured, dump process stack traces.
@@ -85,7 +93,7 @@
Future<ArrayList<Integer>> nativePidsFuture, StringWriter logExceptionCreatingFile,
@NonNull Executor auxiliaryTaskExecutor, AnrLatencyTracker latencyTracker) {
return dumpStackTraces(firstPids, processCpuTracker, lastPids, nativePidsFuture,
- logExceptionCreatingFile, null, null, null, null, auxiliaryTaskExecutor,
+ logExceptionCreatingFile, null, null, null, null, auxiliaryTaskExecutor, null,
latencyTracker);
}
@@ -96,11 +104,11 @@
public static File dumpStackTraces(ArrayList<Integer> firstPids,
ProcessCpuTracker processCpuTracker, SparseBooleanArray lastPids,
Future<ArrayList<Integer>> nativePidsFuture, StringWriter logExceptionCreatingFile,
- String subject, String criticalEventSection, @NonNull Executor auxiliaryTaskExecutor,
- AnrLatencyTracker latencyTracker) {
+ String subject, String criticalEventSection,
+ @NonNull Executor auxiliaryTaskExecutor, AnrLatencyTracker latencyTracker) {
return dumpStackTraces(firstPids, processCpuTracker, lastPids, nativePidsFuture,
logExceptionCreatingFile, null, subject, criticalEventSection,
- /* memoryHeaders= */ null, auxiliaryTaskExecutor, latencyTracker);
+ /* memoryHeaders= */ null, auxiliaryTaskExecutor, null, latencyTracker);
}
/**
@@ -112,7 +120,7 @@
Future<ArrayList<Integer>> nativePidsFuture, StringWriter logExceptionCreatingFile,
AtomicLong firstPidEndOffset, String subject, String criticalEventSection,
String memoryHeaders, @NonNull Executor auxiliaryTaskExecutor,
- AnrLatencyTracker latencyTracker) {
+ Future<File> firstPidFilePromise, AnrLatencyTracker latencyTracker) {
try {
if (latencyTracker != null) {
@@ -161,7 +169,7 @@
long firstPidEndPos = dumpStackTraces(
tracesFile.getAbsolutePath(), firstPids, nativePidsFuture,
- extraPidsFuture, latencyTracker);
+ extraPidsFuture, firstPidFilePromise, latencyTracker);
if (firstPidEndOffset != null) {
firstPidEndOffset.set(firstPidEndPos);
}
@@ -175,7 +183,6 @@
latencyTracker.dumpStackTracesEnded();
}
}
-
}
/**
@@ -183,7 +190,8 @@
*/
public static long dumpStackTraces(String tracesFile,
ArrayList<Integer> firstPids, Future<ArrayList<Integer>> nativePidsFuture,
- Future<ArrayList<Integer>> extraPidsFuture, AnrLatencyTracker latencyTracker) {
+ Future<ArrayList<Integer>> extraPidsFuture, Future<File> firstPidFilePromise,
+ AnrLatencyTracker latencyTracker) {
Slog.i(TAG, "Dumping to " + tracesFile);
@@ -194,33 +202,52 @@
// We must complete all stack dumps within 20 seconds.
long remainingTime = 20 * 1000 * Build.HW_TIMEOUT_MULTIPLIER;
- // As applications are usually interested with the ANR stack traces, but we can't share with
- // them the stack traces other than their own stacks. So after the very first PID is
+ // As applications are usually interested with the ANR stack traces, but we can't share
+ // with them the stack traces other than their own stacks. So after the very first PID is
// dumped, remember the current file size.
long firstPidEnd = -1;
- // First collect all of the stacks of the most important pids.
- if (firstPids != null) {
+ // Was the first pid copied from the temporary file that was created in the predump phase?
+ boolean firstPidTempDumpCopied = false;
+
+ // First copy the first pid's dump from the temporary file it was dumped into earlier,
+ // The first pid should always exist in firstPids but we check the size just in case.
+ if (firstPidFilePromise != null && firstPids != null && firstPids.size() > 0) {
+ final int primaryPid = firstPids.get(0);
+ final long start = SystemClock.elapsedRealtime();
+ firstPidTempDumpCopied = copyFirstPidTempDump(tracesFile, firstPidFilePromise,
+ remainingTime, latencyTracker);
+ final long timeTaken = SystemClock.elapsedRealtime() - start;
+ remainingTime -= timeTaken;
+ if (remainingTime <= 0) {
+ Slog.e(TAG, "Aborting stack trace dump (currently copying primary pid" + primaryPid
+ + "); deadline exceeded.");
+ return firstPidEnd;
+ }
+ // We don't copy ANR traces from the system_server intentionally.
+ if (firstPidTempDumpCopied && primaryPid != ActivityManagerService.MY_PID) {
+ firstPidEnd = new File(tracesFile).length();
+ }
+ // Append the Durations/latency comma separated array after the first PID.
+ if (latencyTracker != null) {
+ appendtoANRFile(tracesFile,
+ latencyTracker.dumpAsCommaSeparatedArrayWithHeader());
+ }
+ }
+ // Next collect all of the stacks of the most important pids.
+ if (firstPids != null) {
if (latencyTracker != null) {
latencyTracker.dumpingFirstPidsStarted();
}
int num = firstPids.size();
- for (int i = 0; i < num; i++) {
+ for (int i = firstPidTempDumpCopied ? 1 : 0; i < num; i++) {
final int pid = firstPids.get(i);
// We don't copy ANR traces from the system_server intentionally.
final boolean firstPid = i == 0 && ActivityManagerService.MY_PID != pid;
- if (latencyTracker != null) {
- latencyTracker.dumpingPidStarted(pid);
- }
-
Slog.i(TAG, "Collecting stacks for pid " + pid);
- final long timeTaken = dumpJavaTracesTombstoned(pid, tracesFile,
- remainingTime);
- if (latencyTracker != null) {
- latencyTracker.dumpingPidEnded();
- }
-
+ final long timeTaken = dumpJavaTracesTombstoned(pid, tracesFile, remainingTime,
+ latencyTracker);
remainingTime -= timeTaken;
if (remainingTime <= 0) {
Slog.e(TAG, "Aborting stack trace dump (current firstPid=" + pid
@@ -304,13 +331,8 @@
}
for (int pid : extraPids) {
Slog.i(TAG, "Collecting stacks for extra pid " + pid);
- if (latencyTracker != null) {
- latencyTracker.dumpingPidStarted(pid);
- }
- final long timeTaken = dumpJavaTracesTombstoned(pid, tracesFile, remainingTime);
- if (latencyTracker != null) {
- latencyTracker.dumpingPidEnded();
- }
+ final long timeTaken = dumpJavaTracesTombstoned(pid, tracesFile, remainingTime,
+ latencyTracker);
remainingTime -= timeTaken;
if (remainingTime <= 0) {
Slog.e(TAG, "Aborting stack trace dump (current extra pid=" + pid
@@ -333,6 +355,99 @@
return firstPidEnd;
}
+ /**
+ * Dumps the supplied pid to a temporary file.
+ * @param pid the PID to be dumped
+ * @param latencyTracker the latency tracker instance of the current ANR.
+ */
+ public static File dumpStackTracesTempFile(int pid, AnrLatencyTracker latencyTracker) {
+ try {
+ if (latencyTracker != null) {
+ latencyTracker.dumpStackTracesTempFileStarted();
+ }
+
+ File tmpTracesFile;
+ try {
+ tmpTracesFile = File.createTempFile(ANR_TEMP_FILE_PREFIX, ".txt",
+ new File(ANR_TRACE_DIR));
+ Slog.d(TAG, "created ANR temporary file:" + tmpTracesFile.getAbsolutePath());
+ } catch (IOException e) {
+ Slog.w(TAG, "Exception creating temporary ANR dump file:", e);
+ if (latencyTracker != null) {
+ latencyTracker.dumpStackTracesTempFileCreationFailed();
+ }
+ return null;
+ }
+
+ Slog.i(TAG, "Collecting stacks for pid " + pid + " into temporary file "
+ + tmpTracesFile.getName());
+ if (latencyTracker != null) {
+ latencyTracker.dumpingPidStarted(pid);
+ }
+ final long timeTaken = dumpJavaTracesTombstoned(pid, tmpTracesFile.getAbsolutePath(),
+ TEMP_DUMP_TIME_LIMIT);
+ if (latencyTracker != null) {
+ latencyTracker.dumpingPidEnded();
+ }
+ if (TEMP_DUMP_TIME_LIMIT <= timeTaken) {
+ Slog.e(TAG, "Aborted stack trace dump (current primary pid=" + pid
+ + "); deadline exceeded.");
+ tmpTracesFile.delete();
+ if (latencyTracker != null) {
+ latencyTracker.dumpStackTracesTempFileTimedOut();
+ }
+ return null;
+ }
+ if (DEBUG_ANR) {
+ Slog.d(TAG, "Done with primary pid " + pid + " in " + timeTaken + "ms"
+ + " dumped into temporary file " + tmpTracesFile.getName());
+ }
+ return tmpTracesFile;
+ } finally {
+ if (latencyTracker != null) {
+ latencyTracker.dumpStackTracesTempFileEnded();
+ }
+ }
+ }
+
+ private static boolean copyFirstPidTempDump(String tracesFile, Future<File> firstPidFilePromise,
+ long timeLimitMs, AnrLatencyTracker latencyTracker) {
+
+ boolean copySucceeded = false;
+ try (FileOutputStream fos = new FileOutputStream(tracesFile, true)) {
+ if (latencyTracker != null) {
+ latencyTracker.copyingFirstPidStarted();
+ }
+ final File tempfile = firstPidFilePromise.get(timeLimitMs, TimeUnit.MILLISECONDS);
+ if (tempfile != null) {
+ Files.copy(tempfile.toPath(), fos);
+ // Delete the temporary first pid dump file
+ tempfile.delete();
+ copySucceeded = true;
+ return copySucceeded;
+ }
+ return false;
+ } catch (ExecutionException e) {
+ Slog.w(TAG, "Failed to collect the first pid's predump to the main ANR file",
+ e.getCause());
+ return false;
+ } catch (InterruptedException e) {
+ Slog.w(TAG, "Interrupted while collecting the first pid's predump"
+ + " to the main ANR file", e);
+ return false;
+ } catch (IOException e) {
+ Slog.w(TAG, "Failed to read the first pid's predump file", e);
+ return false;
+ } catch (TimeoutException e) {
+ Slog.w(TAG, "Copying the first pid timed out", e);
+ return false;
+ } finally {
+ if (latencyTracker != null) {
+ latencyTracker.copyingFirstPidEnded(copySucceeded);
+ }
+ }
+ }
+
private static synchronized File createAnrDumpFile(File tracesDir) throws IOException {
final String formattedDate = ANR_FILE_DATE_FORMAT.format(new Date());
final File anrFile = new File(tracesDir, ANR_FILE_PREFIX + formattedDate);
@@ -409,6 +524,21 @@
Slog.w(TAG, "tombstone modification times changed while sorting; not pruning", e);
}
}
+
+ private static long dumpJavaTracesTombstoned(int pid, String fileName, long timeoutMs,
+ AnrLatencyTracker latencyTracker) {
+ try {
+ if (latencyTracker != null) {
+ latencyTracker.dumpingPidStarted(pid);
+ }
+ return dumpJavaTracesTombstoned(pid, fileName, timeoutMs);
+ } finally {
+ if (latencyTracker != null) {
+ latencyTracker.dumpingPidEnded();
+ }
+ }
+ }
+
/**
* Dump java traces for process {@code pid} to the specified file. If java trace dumping
* fails, a native backtrace is attempted. Note that the timeout {@code timeoutMs} only applies
diff --git a/services/core/java/com/android/server/audio/AudioDeviceBroker.java b/services/core/java/com/android/server/audio/AudioDeviceBroker.java
index 462942e..2da9fa6 100644
--- a/services/core/java/com/android/server/audio/AudioDeviceBroker.java
+++ b/services/core/java/com/android/server/audio/AudioDeviceBroker.java
@@ -87,14 +87,14 @@
private final @NonNull Context mContext;
/** ID for Communication strategy retrieved form audio policy manager */
- /*package*/ int mCommunicationStrategyId = -1;
+ private int mCommunicationStrategyId = -1;
/** ID for Accessibility strategy retrieved form audio policy manager */
private int mAccessibilityStrategyId = -1;
/** Active communication device reported by audio policy manager */
- /*package*/ AudioDeviceInfo mActiveCommunicationDevice;
+ private AudioDeviceInfo mActiveCommunicationDevice;
/** Last preferred device set for communication strategy */
private AudioDeviceAttributes mPreferredCommunicationDevice;
@@ -750,19 +750,6 @@
mIsLeOutput = false;
}
- BtDeviceInfo(@NonNull BtDeviceInfo src, int state) {
- mDevice = src.mDevice;
- mState = state;
- mProfile = src.mProfile;
- mSupprNoisy = src.mSupprNoisy;
- mVolume = src.mVolume;
- mIsLeOutput = src.mIsLeOutput;
- mEventSource = src.mEventSource;
- mAudioSystemDevice = src.mAudioSystemDevice;
- mMusicDevice = src.mMusicDevice;
- mCodec = src.mCodec;
- }
-
// redefine equality op so we can match messages intended for this device
@Override
public boolean equals(Object o) {
@@ -829,7 +816,7 @@
* @param info struct with the (dis)connection information
*/
/*package*/ void queueOnBluetoothActiveDeviceChanged(@NonNull BtDeviceChangedData data) {
- if (data.mPreviousDevice != null
+ if (data.mInfo.getProfile() == BluetoothProfile.A2DP && data.mPreviousDevice != null
&& data.mPreviousDevice.equals(data.mNewDevice)) {
final String name = TextUtils.emptyIfNull(data.mNewDevice.getName());
new MediaMetrics.Item(MediaMetrics.Name.AUDIO_DEVICE + MediaMetrics.SEPARATOR
@@ -838,8 +825,7 @@
.set(MediaMetrics.Property.STATUS, data.mInfo.getProfile())
.record();
synchronized (mDeviceStateLock) {
- postBluetoothDeviceConfigChange(createBtDeviceInfo(data, data.mNewDevice,
- BluetoothProfile.STATE_CONNECTED));
+ postBluetoothA2dpDeviceConfigChange(data.mNewDevice);
}
} else {
synchronized (mDeviceStateLock) {
@@ -1064,8 +1050,8 @@
new AudioModeInfo(mode, pid, uid));
}
- /*package*/ void postBluetoothDeviceConfigChange(@NonNull BtDeviceInfo info) {
- sendLMsgNoDelay(MSG_L_BLUETOOTH_DEVICE_CONFIG_CHANGE, SENDMSG_QUEUE, info);
+ /*package*/ void postBluetoothA2dpDeviceConfigChange(@NonNull BluetoothDevice device) {
+ sendLMsgNoDelay(MSG_L_A2DP_DEVICE_CONFIG_CHANGE, SENDMSG_QUEUE, device);
}
/*package*/ void startBluetoothScoForClient(IBinder cb, int pid, int scoAudioMode,
@@ -1322,10 +1308,6 @@
sendIMsgNoDelay(MSG_I_SCO_AUDIO_STATE_CHANGED, SENDMSG_QUEUE, state);
}
- /*package*/ void postNotifyPreferredAudioProfileApplied(BluetoothDevice btDevice) {
- sendLMsgNoDelay(MSG_L_NOTIFY_PREFERRED_AUDIOPROFILE_APPLIED, SENDMSG_QUEUE, btDevice);
- }
-
/*package*/ static final class CommunicationDeviceInfo {
final @NonNull IBinder mCb; // Identifies the requesting client for death handler
final int mPid; // Requester process ID
@@ -1401,11 +1383,9 @@
}
}
- /*package*/ boolean handleDeviceConnection(AudioDeviceAttributes attributes,
- boolean connect, @Nullable BluetoothDevice btDevice) {
+ /*package*/ boolean handleDeviceConnection(AudioDeviceAttributes attributes, boolean connect) {
synchronized (mDeviceStateLock) {
- return mDeviceInventory.handleDeviceConnection(
- attributes, connect, false /*for test*/, btDevice);
+ return mDeviceInventory.handleDeviceConnection(attributes, connect, false /*for test*/);
}
}
@@ -1646,10 +1626,13 @@
(String) msg.obj, msg.arg1);
}
break;
- case MSG_L_BLUETOOTH_DEVICE_CONFIG_CHANGE:
+ case MSG_L_A2DP_DEVICE_CONFIG_CHANGE:
+ final BluetoothDevice btDevice = (BluetoothDevice) msg.obj;
synchronized (mDeviceStateLock) {
- mDeviceInventory.onBluetoothDeviceConfigChange(
- (BtDeviceInfo) msg.obj, BtHelper.EVENT_DEVICE_CONFIG_CHANGE);
+ final int a2dpCodec = mBtHelper.getA2dpCodec(btDevice);
+ mDeviceInventory.onBluetoothA2dpDeviceConfigChange(
+ new BtHelper.BluetoothA2dpDeviceInfo(btDevice, -1, a2dpCodec),
+ BtHelper.EVENT_DEVICE_CONFIG_CHANGE);
}
break;
case MSG_BROADCAST_AUDIO_BECOMING_NOISY:
@@ -1807,10 +1790,6 @@
final int capturePreset = msg.arg1;
mDeviceInventory.onSaveClearPreferredDevicesForCapturePreset(capturePreset);
} break;
- case MSG_L_NOTIFY_PREFERRED_AUDIOPROFILE_APPLIED: {
- final BluetoothDevice btDevice = (BluetoothDevice) msg.obj;
- BtHelper.onNotifyPreferredAudioProfileApplied(btDevice);
- } break;
default:
Log.wtf(TAG, "Invalid message " + msg.what);
}
@@ -1846,7 +1825,7 @@
private static final int MSG_IL_BTA2DP_TIMEOUT = 10;
// process change of A2DP device configuration, obj is BluetoothDevice
- private static final int MSG_L_BLUETOOTH_DEVICE_CONFIG_CHANGE = 11;
+ private static final int MSG_L_A2DP_DEVICE_CONFIG_CHANGE = 11;
private static final int MSG_BROADCAST_AUDIO_BECOMING_NOISY = 12;
private static final int MSG_REPORT_NEW_ROUTES = 13;
@@ -1886,15 +1865,13 @@
private static final int MSG_IL_SAVE_REMOVE_NDEF_DEVICE_FOR_STRATEGY = 48;
private static final int MSG_IL_BTLEAUDIO_TIMEOUT = 49;
- private static final int MSG_L_NOTIFY_PREFERRED_AUDIOPROFILE_APPLIED = 50;
-
private static boolean isMessageHandledUnderWakelock(int msgId) {
switch(msgId) {
case MSG_L_SET_WIRED_DEVICE_CONNECTION_STATE:
case MSG_L_SET_BT_ACTIVE_DEVICE:
case MSG_IL_BTA2DP_TIMEOUT:
case MSG_IL_BTLEAUDIO_TIMEOUT:
- case MSG_L_BLUETOOTH_DEVICE_CONFIG_CHANGE:
+ case MSG_L_A2DP_DEVICE_CONFIG_CHANGE:
case MSG_TOGGLE_HDMI:
case MSG_L_A2DP_DEVICE_CONNECTION_CHANGE_EXT:
case MSG_L_HEARING_AID_DEVICE_CONNECTION_CHANGE_EXT:
@@ -1986,7 +1963,7 @@
case MSG_L_SET_WIRED_DEVICE_CONNECTION_STATE:
case MSG_IL_BTA2DP_TIMEOUT:
case MSG_IL_BTLEAUDIO_TIMEOUT:
- case MSG_L_BLUETOOTH_DEVICE_CONFIG_CHANGE:
+ case MSG_L_A2DP_DEVICE_CONFIG_CHANGE:
if (sLastDeviceConnectMsgTime >= time) {
// add a little delay to make sure messages are ordered as expected
time = sLastDeviceConnectMsgTime + 30;
@@ -2006,7 +1983,7 @@
static {
MESSAGES_MUTE_MUSIC = new HashSet<>();
MESSAGES_MUTE_MUSIC.add(MSG_L_SET_BT_ACTIVE_DEVICE);
- MESSAGES_MUTE_MUSIC.add(MSG_L_BLUETOOTH_DEVICE_CONFIG_CHANGE);
+ MESSAGES_MUTE_MUSIC.add(MSG_L_A2DP_DEVICE_CONFIG_CHANGE);
MESSAGES_MUTE_MUSIC.add(MSG_L_A2DP_DEVICE_CONNECTION_CHANGE_EXT);
MESSAGES_MUTE_MUSIC.add(MSG_IIL_SET_FORCE_BT_A2DP_USE);
}
@@ -2027,7 +2004,7 @@
// Do not mute on bluetooth event if music is playing on a wired headset.
if ((message == MSG_L_SET_BT_ACTIVE_DEVICE
|| message == MSG_L_A2DP_DEVICE_CONNECTION_CHANGE_EXT
- || message == MSG_L_BLUETOOTH_DEVICE_CONFIG_CHANGE)
+ || message == MSG_L_A2DP_DEVICE_CONFIG_CHANGE)
&& AudioSystem.isStreamActive(AudioSystem.STREAM_MUSIC, 0)
&& hasIntersection(mDeviceInventory.DEVICE_OVERRIDE_A2DP_ROUTE_ON_PLUG_SET,
mAudioService.getDeviceSetForStream(AudioSystem.STREAM_MUSIC))) {
@@ -2166,19 +2143,18 @@
if (preferredCommunicationDevice == null) {
AudioDeviceAttributes defaultDevice = getDefaultCommunicationDevice();
if (defaultDevice != null) {
- mDeviceInventory.setPreferredDevicesForStrategy(
+ setPreferredDevicesForStrategySync(
mCommunicationStrategyId, Arrays.asList(defaultDevice));
- mDeviceInventory.setPreferredDevicesForStrategy(
+ setPreferredDevicesForStrategySync(
mAccessibilityStrategyId, Arrays.asList(defaultDevice));
} else {
- mDeviceInventory.removePreferredDevicesForStrategy(mCommunicationStrategyId);
- mDeviceInventory.removePreferredDevicesForStrategy(mAccessibilityStrategyId);
+ removePreferredDevicesForStrategySync(mCommunicationStrategyId);
+ removePreferredDevicesForStrategySync(mAccessibilityStrategyId);
}
- mDeviceInventory.applyConnectedDevicesRoles();
} else {
- mDeviceInventory.setPreferredDevicesForStrategy(
+ setPreferredDevicesForStrategySync(
mCommunicationStrategyId, Arrays.asList(preferredCommunicationDevice));
- mDeviceInventory.setPreferredDevicesForStrategy(
+ setPreferredDevicesForStrategySync(
mAccessibilityStrategyId, Arrays.asList(preferredCommunicationDevice));
}
onUpdatePhoneStrategyDevice(preferredCommunicationDevice);
diff --git a/services/core/java/com/android/server/audio/AudioDeviceInventory.java b/services/core/java/com/android/server/audio/AudioDeviceInventory.java
index 1eb39f7..228bc87 100644
--- a/services/core/java/com/android/server/audio/AudioDeviceInventory.java
+++ b/services/core/java/com/android/server/audio/AudioDeviceInventory.java
@@ -34,36 +34,26 @@
import android.media.IStrategyNonDefaultDevicesDispatcher;
import android.media.IStrategyPreferredDevicesDispatcher;
import android.media.MediaMetrics;
-import android.media.MediaRecorder.AudioSource;
-import android.media.audiopolicy.AudioProductStrategy;
import android.media.permission.ClearCallingIdentityContext;
import android.media.permission.SafeCloseable;
import android.os.Binder;
-import android.os.Bundle;
import android.os.RemoteCallbackList;
import android.os.RemoteException;
-import android.os.SystemProperties;
import android.text.TextUtils;
import android.util.ArrayMap;
import android.util.ArraySet;
import android.util.Log;
-import android.util.Pair;
import android.util.Slog;
import com.android.internal.annotations.GuardedBy;
import com.android.internal.annotations.VisibleForTesting;
import com.android.server.utils.EventLogger;
-import com.google.android.collect.Sets;
-
import java.io.PrintWriter;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
-import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.UUID;
@@ -185,26 +175,18 @@
final RemoteCallbackList<ICapturePresetDevicesRoleDispatcher> mDevRoleCapturePresetDispatchers =
new RemoteCallbackList<ICapturePresetDevicesRoleDispatcher>();
- final List<AudioProductStrategy> mStrategies;
-
/*package*/ AudioDeviceInventory(@NonNull AudioDeviceBroker broker) {
- this(broker, AudioSystemAdapter.getDefaultAdapter());
+ mDeviceBroker = broker;
+ mAudioSystem = AudioSystemAdapter.getDefaultAdapter();
}
//-----------------------------------------------------------
/** for mocking only, allows to inject AudioSystem adapter */
/*package*/ AudioDeviceInventory(@NonNull AudioSystemAdapter audioSystem) {
- this(null, audioSystem);
+ mDeviceBroker = null;
+ mAudioSystem = audioSystem;
}
- private AudioDeviceInventory(@Nullable AudioDeviceBroker broker,
- @Nullable AudioSystemAdapter audioSystem) {
- mDeviceBroker = broker;
- mAudioSystem = audioSystem;
- mStrategies = AudioProductStrategy.getAudioProductStrategies();
- mBluetoothDualModeEnabled = SystemProperties.getBoolean(
- "persist.bluetooth.enable_dual_mode_audio", false);
- }
/*package*/ void setDeviceBroker(@NonNull AudioDeviceBroker broker) {
mDeviceBroker = broker;
}
@@ -221,13 +203,8 @@
int mDeviceCodecFormat;
final UUID mSensorUuid;
- /** Disabled operating modes for this device. Use a negative logic so that by default
- * an empty list means all modes are allowed.
- * See BluetoothAdapter.AUDIO_MODE_DUPLEX and BluetoothAdapter.AUDIO_MODE_OUTPUT_ONLY */
- @NonNull ArraySet<String> mDisabledModes = new ArraySet(0);
-
DeviceInfo(int deviceType, String deviceName, String deviceAddress,
- int deviceCodecFormat, @Nullable UUID sensorUuid) {
+ int deviceCodecFormat, UUID sensorUuid) {
mDeviceType = deviceType;
mDeviceName = deviceName == null ? "" : deviceName;
mDeviceAddress = deviceAddress == null ? "" : deviceAddress;
@@ -235,31 +212,11 @@
mSensorUuid = sensorUuid;
}
- void setModeDisabled(String mode) {
- mDisabledModes.add(mode);
- }
- void setModeEnabled(String mode) {
- mDisabledModes.remove(mode);
- }
- boolean isModeEnabled(String mode) {
- return !mDisabledModes.contains(mode);
- }
- boolean isOutputOnlyModeEnabled() {
- return isModeEnabled(BluetoothAdapter.AUDIO_MODE_OUTPUT_ONLY);
- }
- boolean isDuplexModeEnabled() {
- return isModeEnabled(BluetoothAdapter.AUDIO_MODE_DUPLEX);
- }
-
DeviceInfo(int deviceType, String deviceName, String deviceAddress,
int deviceCodecFormat) {
this(deviceType, deviceName, deviceAddress, deviceCodecFormat, null);
}
- DeviceInfo(int deviceType, String deviceName, String deviceAddress) {
- this(deviceType, deviceName, deviceAddress, AudioSystem.AUDIO_FORMAT_DEFAULT);
- }
-
@Override
public String toString() {
return "[DeviceInfo: type:0x" + Integer.toHexString(mDeviceType)
@@ -267,8 +224,7 @@
+ ") name:" + mDeviceName
+ " addr:" + mDeviceAddress
+ " codec: " + Integer.toHexString(mDeviceCodecFormat)
- + " sensorUuid: " + Objects.toString(mSensorUuid)
- + " disabled modes: " + mDisabledModes + "]";
+ + " sensorUuid: " + Objects.toString(mSensorUuid) + "]";
}
@NonNull String getKey() {
@@ -320,18 +276,9 @@
pw.println(" " + prefix + " type:0x" + Integer.toHexString(keyType)
+ " (" + AudioSystem.getDeviceName(keyType)
+ ") addr:" + valueAddress); });
- pw.println("\n" + prefix + "Preferred devices for capture preset:");
mPreferredDevicesForCapturePreset.forEach((capturePreset, devices) -> {
pw.println(" " + prefix + "capturePreset:" + capturePreset
+ " devices:" + devices); });
- pw.println("\n" + prefix + "Applied devices roles for strategies:");
- mAppliedStrategyRoles.forEach((key, devices) -> {
- pw.println(" " + prefix + "strategy: " + key.first
- + " role:" + key.second + " devices:" + devices); });
- pw.println("\n" + prefix + "Applied devices roles for presets:");
- mAppliedPresetRoles.forEach((key, devices) -> {
- pw.println(" " + prefix + "preset: " + key.first
- + " role:" + key.second + " devices:" + devices); });
}
//------------------------------------------------------------
@@ -352,16 +299,15 @@
AudioSystem.DEVICE_STATE_AVAILABLE,
di.mDeviceCodecFormat);
}
- mAppliedStrategyRoles.clear();
- applyConnectedDevicesRoles_l();
}
synchronized (mPreferredDevices) {
mPreferredDevices.forEach((strategy, devices) -> {
- setPreferredDevicesForStrategy(strategy, devices); });
+ mAudioSystem.setDevicesRoleForStrategy(
+ strategy, AudioSystem.DEVICE_ROLE_PREFERRED, devices); });
}
synchronized (mNonDefaultDevices) {
mNonDefaultDevices.forEach((strategy, devices) -> {
- addDevicesRoleForStrategy(
+ mAudioSystem.setDevicesRoleForStrategy(
strategy, AudioSystem.DEVICE_ROLE_DISABLED, devices); });
}
synchronized (mPreferredDevicesForCapturePreset) {
@@ -434,7 +380,8 @@
btInfo.mVolume * 10, btInfo.mAudioSystemDevice,
"onSetBtActiveDevice");
}
- makeA2dpDeviceAvailable(btInfo, "onSetBtActiveDevice");
+ makeA2dpDeviceAvailable(address, BtHelper.getName(btInfo.mDevice),
+ "onSetBtActiveDevice", btInfo.mCodec);
}
break;
case BluetoothProfile.HEARING_AID:
@@ -450,7 +397,10 @@
if (switchToUnavailable) {
makeLeAudioDeviceUnavailableNow(address, btInfo.mAudioSystemDevice);
} else if (switchToAvailable) {
- makeLeAudioDeviceAvailable(btInfo, streamType, "onSetBtActiveDevice");
+ makeLeAudioDeviceAvailable(address, BtHelper.getName(btInfo.mDevice),
+ streamType, btInfo.mVolume == -1 ? -1 : btInfo.mVolume * 10,
+ btInfo.mAudioSystemDevice,
+ "onSetBtActiveDevice");
}
break;
default: throw new IllegalArgumentException("Invalid profile "
@@ -461,30 +411,30 @@
@GuardedBy("AudioDeviceBroker.mDeviceStateLock")
- /*package*/ void onBluetoothDeviceConfigChange(
- @NonNull AudioDeviceBroker.BtDeviceInfo btInfo, int event) {
+ /*package*/ void onBluetoothA2dpDeviceConfigChange(
+ @NonNull BtHelper.BluetoothA2dpDeviceInfo btInfo, int event) {
MediaMetrics.Item mmi = new MediaMetrics.Item(mMetricsId
- + "onBluetoothDeviceConfigChange")
- .set(MediaMetrics.Property.EVENT, BtHelper.deviceEventToString(event));
+ + "onBluetoothA2dpDeviceConfigChange")
+ .set(MediaMetrics.Property.EVENT, BtHelper.a2dpDeviceEventToString(event));
- final BluetoothDevice btDevice = btInfo.mDevice;
+ final BluetoothDevice btDevice = btInfo.getBtDevice();
if (btDevice == null) {
mmi.set(MediaMetrics.Property.EARLY_RETURN, "btDevice null").record();
return;
}
if (AudioService.DEBUG_DEVICES) {
- Log.d(TAG, "onBluetoothDeviceConfigChange btDevice=" + btDevice);
+ Log.d(TAG, "onBluetoothA2dpDeviceConfigChange btDevice=" + btDevice);
}
- int volume = btInfo.mVolume;
- @AudioSystem.AudioFormatNativeEnumForBtCodec final int audioCodec = btInfo.mCodec;
+ int a2dpVolume = btInfo.getVolume();
+ @AudioSystem.AudioFormatNativeEnumForBtCodec final int a2dpCodec = btInfo.getCodec();
String address = btDevice.getAddress();
if (!BluetoothAdapter.checkBluetoothAddress(address)) {
address = "";
}
AudioService.sDeviceLogger.enqueue(new EventLogger.StringEvent(
- "onBluetoothDeviceConfigChange addr=" + address
- + " event=" + BtHelper.deviceEventToString(event)));
+ "onBluetoothA2dpDeviceConfigChange addr=" + address
+ + " event=" + BtHelper.a2dpDeviceEventToString(event)));
synchronized (mDevicesLock) {
if (mDeviceBroker.hasScheduledA2dpConnection(btDevice)) {
@@ -499,55 +449,54 @@
AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP, address);
final DeviceInfo di = mConnectedDevices.get(key);
if (di == null) {
- Log.e(TAG, "invalid null DeviceInfo in onBluetoothDeviceConfigChange");
+ Log.e(TAG, "invalid null DeviceInfo in onBluetoothA2dpDeviceConfigChange");
mmi.set(MediaMetrics.Property.EARLY_RETURN, "null DeviceInfo").record();
return;
}
mmi.set(MediaMetrics.Property.ADDRESS, address)
.set(MediaMetrics.Property.ENCODING,
- AudioSystem.audioFormatToString(audioCodec))
- .set(MediaMetrics.Property.INDEX, volume)
+ AudioSystem.audioFormatToString(a2dpCodec))
+ .set(MediaMetrics.Property.INDEX, a2dpVolume)
.set(MediaMetrics.Property.NAME, di.mDeviceName);
-
- if (event == BtHelper.EVENT_DEVICE_CONFIG_CHANGE) {
- boolean a2dpCodecChange = false;
- if (btInfo.mProfile == BluetoothProfile.A2DP) {
- if (di.mDeviceCodecFormat != audioCodec) {
- di.mDeviceCodecFormat = audioCodec;
- mConnectedDevices.replace(key, di);
- a2dpCodecChange = true;
- }
- final int res = mAudioSystem.handleDeviceConfigChange(
- btInfo.mAudioSystemDevice, address,
- BtHelper.getName(btDevice), audioCodec);
-
- if (res != AudioSystem.AUDIO_STATUS_OK) {
- AudioService.sDeviceLogger.enqueue(new EventLogger.StringEvent(
- "APM handleDeviceConfigChange failed for A2DP device addr="
- + address + " codec="
- + AudioSystem.audioFormatToString(audioCodec))
- .printLog(TAG));
-
- // force A2DP device disconnection in case of error so that AudioService
- // state is consistent with audio policy manager state
- setBluetoothActiveDevice(new AudioDeviceBroker.BtDeviceInfo(btInfo,
- BluetoothProfile.STATE_DISCONNECTED));
- } else {
- AudioService.sDeviceLogger.enqueue(new EventLogger.StringEvent(
- "APM handleDeviceConfigChange success for A2DP device addr="
- + address
- + " codec=" + AudioSystem.audioFormatToString(audioCodec))
- .printLog(TAG));
-
- }
+ if (event == BtHelper.EVENT_ACTIVE_DEVICE_CHANGE) {
+ // Device is connected
+ if (a2dpVolume != -1) {
+ mDeviceBroker.postSetVolumeIndexOnDevice(AudioSystem.STREAM_MUSIC,
+ // convert index to internal representation in VolumeStreamState
+ a2dpVolume * 10,
+ AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP,
+ "onBluetoothA2dpDeviceConfigChange");
}
- if (!a2dpCodecChange) {
- updateBluetoothPreferredModes_l();
- mDeviceBroker.postNotifyPreferredAudioProfileApplied(btDevice);
+ } else if (event == BtHelper.EVENT_DEVICE_CONFIG_CHANGE) {
+ if (di.mDeviceCodecFormat != a2dpCodec) {
+ di.mDeviceCodecFormat = a2dpCodec;
+ mConnectedDevices.replace(key, di);
}
}
+ final int res = mAudioSystem.handleDeviceConfigChange(
+ AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP, address,
+ BtHelper.getName(btDevice), a2dpCodec);
+
+ if (res != AudioSystem.AUDIO_STATUS_OK) {
+ AudioService.sDeviceLogger.enqueue(new EventLogger.StringEvent(
+ "APM handleDeviceConfigChange failed for A2DP device addr=" + address
+ + " codec=" + AudioSystem.audioFormatToString(a2dpCodec))
+ .printLog(TAG));
+
+ int musicDevice = mDeviceBroker.getDeviceForStream(AudioSystem.STREAM_MUSIC);
+ // force A2DP device disconnection in case of error so that AudioService state is
+ // consistent with audio policy manager state
+ setBluetoothActiveDevice(new AudioDeviceBroker.BtDeviceInfo(btDevice,
+ BluetoothProfile.A2DP, BluetoothProfile.STATE_DISCONNECTED,
+ musicDevice, AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP));
+ } else {
+ AudioService.sDeviceLogger.enqueue(new EventLogger.StringEvent(
+ "APM handleDeviceConfigChange success for A2DP device addr=" + address
+ + " codec=" + AudioSystem.audioFormatToString(a2dpCodec))
+ .printLog(TAG));
+ }
}
mmi.record();
}
@@ -629,7 +578,7 @@
}
if (!handleDeviceConnection(wdcs.mAttributes,
- wdcs.mState == AudioService.CONNECTION_STATE_CONNECTED, wdcs.mForTest, null)) {
+ wdcs.mState == AudioService.CONNECTION_STATE_CONNECTED, wdcs.mForTest)) {
// change of connection state failed, bailout
mmi.set(MediaMetrics.Property.EARLY_RETURN, "change of connection state failed")
.record();
@@ -763,35 +712,23 @@
/*package*/ int setPreferredDevicesForStrategySync(int strategy,
@NonNull List<AudioDeviceAttributes> devices) {
- final int status = setPreferredDevicesForStrategy(strategy, devices);
+ int status = AudioSystem.ERROR;
+
+ try (SafeCloseable ignored = ClearCallingIdentityContext.create()) {
+ AudioService.sDeviceLogger.enqueue((new EventLogger.StringEvent(
+ "setPreferredDevicesForStrategySync, strategy: " + strategy
+ + " devices: " + devices)).printLog(TAG));
+ status = mAudioSystem.setDevicesRoleForStrategy(
+ strategy, AudioSystem.DEVICE_ROLE_PREFERRED, devices);
+ }
+
if (status == AudioSystem.SUCCESS) {
mDeviceBroker.postSaveSetPreferredDevicesForStrategy(strategy, devices);
}
return status;
}
- /*package*/ int setPreferredDevicesForStrategy(int strategy,
- @NonNull List<AudioDeviceAttributes> devices) {
- int status = AudioSystem.ERROR;
- try (SafeCloseable ignored = ClearCallingIdentityContext.create()) {
- AudioService.sDeviceLogger.enqueue((new EventLogger.StringEvent(
- "setPreferredDevicesForStrategy, strategy: " + strategy
- + " devices: " + devices)).printLog(TAG));
- status = setDevicesRoleForStrategy(
- strategy, AudioSystem.DEVICE_ROLE_PREFERRED, devices);
- }
- return status;
- }
-
/*package*/ int removePreferredDevicesForStrategySync(int strategy) {
- final int status = removePreferredDevicesForStrategy(strategy);
- if (status == AudioSystem.SUCCESS) {
- mDeviceBroker.postSaveRemovePreferredDevicesForStrategy(strategy);
- }
- return status;
- }
-
- /*package*/ int removePreferredDevicesForStrategy(int strategy) {
int status = AudioSystem.ERROR;
try (SafeCloseable ignored = ClearCallingIdentityContext.create()) {
@@ -799,9 +736,13 @@
"removePreferredDevicesForStrategySync, strategy: "
+ strategy)).printLog(TAG));
- status = clearDevicesRoleForStrategy(
+ status = mAudioSystem.clearDevicesRoleForStrategy(
strategy, AudioSystem.DEVICE_ROLE_PREFERRED);
}
+
+ if (status == AudioSystem.SUCCESS) {
+ mDeviceBroker.postSaveRemovePreferredDevicesForStrategy(strategy);
+ }
return status;
}
@@ -816,7 +757,7 @@
AudioService.sDeviceLogger.enqueue((new EventLogger.StringEvent(
"setDeviceAsNonDefaultForStrategySync, strategy: " + strategy
+ " device: " + device)).printLog(TAG));
- status = addDevicesRoleForStrategy(
+ status = mAudioSystem.setDevicesRoleForStrategy(
strategy, AudioSystem.DEVICE_ROLE_DISABLED, devices);
}
@@ -838,7 +779,7 @@
"removeDeviceAsNonDefaultForStrategySync, strategy: "
+ strategy + " devices: " + device)).printLog(TAG));
- status = removeDevicesRoleForStrategy(
+ status = mAudioSystem.removeDevicesRoleForStrategy(
strategy, AudioSystem.DEVICE_ROLE_DISABLED, devices);
}
@@ -871,70 +812,33 @@
/*package*/ int setPreferredDevicesForCapturePresetSync(
int capturePreset, @NonNull List<AudioDeviceAttributes> devices) {
- final int status = setPreferredDevicesForCapturePreset(capturePreset, devices);
+ int status = AudioSystem.ERROR;
+
+ try (SafeCloseable ignored = ClearCallingIdentityContext.create()) {
+ status = mAudioSystem.setDevicesRoleForCapturePreset(
+ capturePreset, AudioSystem.DEVICE_ROLE_PREFERRED, devices);
+ }
+
if (status == AudioSystem.SUCCESS) {
mDeviceBroker.postSaveSetPreferredDevicesForCapturePreset(capturePreset, devices);
}
return status;
}
- private int setPreferredDevicesForCapturePreset(
- int capturePreset, @NonNull List<AudioDeviceAttributes> devices) {
- int status = AudioSystem.ERROR;
- try (SafeCloseable ignored = ClearCallingIdentityContext.create()) {
- status = setDevicesRoleForCapturePreset(
- capturePreset, AudioSystem.DEVICE_ROLE_PREFERRED, devices);
- }
- return status;
- }
-
/*package*/ int clearPreferredDevicesForCapturePresetSync(int capturePreset) {
- final int status = clearPreferredDevicesForCapturePreset(capturePreset);
+ int status = AudioSystem.ERROR;
+
+ try (SafeCloseable ignored = ClearCallingIdentityContext.create()) {
+ status = mAudioSystem.clearDevicesRoleForCapturePreset(
+ capturePreset, AudioSystem.DEVICE_ROLE_PREFERRED);
+ }
+
if (status == AudioSystem.SUCCESS) {
mDeviceBroker.postSaveClearPreferredDevicesForCapturePreset(capturePreset);
}
return status;
}
- private int clearPreferredDevicesForCapturePreset(int capturePreset) {
- int status = AudioSystem.ERROR;
-
- try (SafeCloseable ignored = ClearCallingIdentityContext.create()) {
- status = clearDevicesRoleForCapturePreset(
- capturePreset, AudioSystem.DEVICE_ROLE_PREFERRED);
- }
- return status;
- }
-
- private int addDevicesRoleForCapturePreset(int capturePreset, int role,
- @NonNull List<AudioDeviceAttributes> devices) {
- return addDevicesRole(mAppliedPresetRoles, (p, r, d) -> {
- return mAudioSystem.addDevicesRoleForCapturePreset(p, r, d);
- }, capturePreset, role, devices);
- }
-
- private int removeDevicesRoleForCapturePreset(int capturePreset, int role,
- @NonNull List<AudioDeviceAttributes> devices) {
- return removeDevicesRole(mAppliedPresetRoles, (p, r, d) -> {
- return mAudioSystem.removeDevicesRoleForCapturePreset(p, r, d);
- }, capturePreset, role, devices);
- }
-
- private int setDevicesRoleForCapturePreset(int capturePreset, int role,
- @NonNull List<AudioDeviceAttributes> devices) {
- return setDevicesRole(mAppliedPresetRoles, (p, r, d) -> {
- return mAudioSystem.addDevicesRoleForCapturePreset(p, r, d);
- }, (p, r, d) -> {
- return mAudioSystem.clearDevicesRoleForCapturePreset(p, r);
- }, capturePreset, role, devices);
- }
-
- private int clearDevicesRoleForCapturePreset(int capturePreset, int role) {
- return clearDevicesRole(mAppliedPresetRoles, (p, r, d) -> {
- return mAudioSystem.clearDevicesRoleForCapturePreset(p, r);
- }, capturePreset, role);
- }
-
/*package*/ void registerCapturePresetDevicesRoleDispatcher(
@NonNull ICapturePresetDevicesRoleDispatcher dispatcher) {
mDevRoleCapturePresetDispatchers.register(dispatcher);
@@ -945,208 +849,7 @@
mDevRoleCapturePresetDispatchers.unregister(dispatcher);
}
- private int addDevicesRoleForStrategy(int strategy, int role,
- @NonNull List<AudioDeviceAttributes> devices) {
- return addDevicesRole(mAppliedStrategyRoles, (s, r, d) -> {
- return mAudioSystem.setDevicesRoleForStrategy(s, r, d);
- }, strategy, role, devices);
- }
-
- private int removeDevicesRoleForStrategy(int strategy, int role,
- @NonNull List<AudioDeviceAttributes> devices) {
- return removeDevicesRole(mAppliedStrategyRoles, (s, r, d) -> {
- return mAudioSystem.removeDevicesRoleForStrategy(s, r, d);
- }, strategy, role, devices);
- }
-
- private int setDevicesRoleForStrategy(int strategy, int role,
- @NonNull List<AudioDeviceAttributes> devices) {
- return setDevicesRole(mAppliedStrategyRoles, (s, r, d) -> {
- return mAudioSystem.setDevicesRoleForStrategy(s, r, d);
- }, (s, r, d) -> {
- return mAudioSystem.clearDevicesRoleForStrategy(s, r);
- }, strategy, role, devices);
- }
-
- private int clearDevicesRoleForStrategy(int strategy, int role) {
- return clearDevicesRole(mAppliedStrategyRoles, (s, r, d) -> {
- return mAudioSystem.clearDevicesRoleForStrategy(s, r);
- }, strategy, role);
- }
-
- //------------------------------------------------------------
- // Cache for applied roles for strategies and devices. The cache avoids reapplying the
- // same list of devices for a given role and strategy and the corresponding systematic
- // redundant work in audio policy manager and audio flinger.
- // The key is the pair <Strategy , Role> and the value is the current list of devices.
-
- private final ArrayMap<Pair<Integer, Integer>, List<AudioDeviceAttributes>>
- mAppliedStrategyRoles = new ArrayMap<>();
-
- // Cache for applied roles for capture presets and devices. The cache avoids reapplying the
- // same list of devices for a given role and capture preset and the corresponding systematic
- // redundant work in audio policy manager and audio flinger.
- // The key is the pair <Preset , Role> and the value is the current list of devices.
- private final ArrayMap<Pair<Integer, Integer>, List<AudioDeviceAttributes>>
- mAppliedPresetRoles = new ArrayMap<>();
-
- interface AudioSystemInterface {
- int deviceRoleAction(int usecase, int role, @Nullable List<AudioDeviceAttributes> devices);
- }
-
- private int addDevicesRole(
- ArrayMap<Pair<Integer, Integer>, List<AudioDeviceAttributes>> rolesMap,
- AudioSystemInterface asi,
- int useCase, int role, @NonNull List<AudioDeviceAttributes> devices) {
- synchronized (rolesMap) {
- Pair<Integer, Integer> key = new Pair<>(useCase, role);
- List<AudioDeviceAttributes> roleDevices = new ArrayList<>();
- List<AudioDeviceAttributes> appliedDevices = new ArrayList<>();
-
- if (rolesMap.containsKey(key)) {
- roleDevices = rolesMap.get(key);
- for (AudioDeviceAttributes device : devices) {
- if (!roleDevices.contains(device)) {
- appliedDevices.add(device);
- }
- }
- } else {
- appliedDevices.addAll(devices);
- }
- if (appliedDevices.isEmpty()) {
- return AudioSystem.SUCCESS;
- }
- final int status = asi.deviceRoleAction(useCase, role, appliedDevices);
- if (status == AudioSystem.SUCCESS) {
- roleDevices.addAll(appliedDevices);
- rolesMap.put(key, roleDevices);
- }
- return status;
- }
- }
-
- private int removeDevicesRole(
- ArrayMap<Pair<Integer, Integer>, List<AudioDeviceAttributes>> rolesMap,
- AudioSystemInterface asi,
- int useCase, int role, @NonNull List<AudioDeviceAttributes> devices) {
- synchronized (rolesMap) {
- Pair<Integer, Integer> key = new Pair<>(useCase, role);
- if (!rolesMap.containsKey(key)) {
- return AudioSystem.SUCCESS;
- }
- List<AudioDeviceAttributes> roleDevices = rolesMap.get(key);
- List<AudioDeviceAttributes> appliedDevices = new ArrayList<>();
- for (AudioDeviceAttributes device : devices) {
- if (roleDevices.contains(device)) {
- appliedDevices.add(device);
- }
- }
- if (appliedDevices.isEmpty()) {
- return AudioSystem.SUCCESS;
- }
- final int status = asi.deviceRoleAction(useCase, role, appliedDevices);
- if (status == AudioSystem.SUCCESS) {
- roleDevices.removeAll(appliedDevices);
- if (roleDevices.isEmpty()) {
- rolesMap.remove(key);
- } else {
- rolesMap.put(key, roleDevices);
- }
- }
- return status;
- }
- }
-
- private int setDevicesRole(
- ArrayMap<Pair<Integer, Integer>, List<AudioDeviceAttributes>> rolesMap,
- AudioSystemInterface addOp,
- AudioSystemInterface clearOp,
- int useCase, int role, @NonNull List<AudioDeviceAttributes> devices) {
- synchronized (rolesMap) {
- Pair<Integer, Integer> key = new Pair<>(useCase, role);
- List<AudioDeviceAttributes> roleDevices = new ArrayList<>();
- List<AudioDeviceAttributes> appliedDevices = new ArrayList<>();
-
- if (rolesMap.containsKey(key)) {
- roleDevices = rolesMap.get(key);
- boolean equal = false;
- if (roleDevices.size() == devices.size()) {
- roleDevices.retainAll(devices);
- equal = roleDevices.size() == devices.size();
- }
- if (!equal) {
- clearOp.deviceRoleAction(useCase, role, null);
- roleDevices.clear();
- appliedDevices.addAll(devices);
- }
- } else {
- appliedDevices.addAll(devices);
- }
- if (appliedDevices.isEmpty()) {
- return AudioSystem.SUCCESS;
- }
- final int status = addOp.deviceRoleAction(useCase, role, appliedDevices);
- if (status == AudioSystem.SUCCESS) {
- roleDevices.addAll(appliedDevices);
- rolesMap.put(key, roleDevices);
- }
- return status;
- }
- }
-
- private int clearDevicesRole(
- ArrayMap<Pair<Integer, Integer>, List<AudioDeviceAttributes>> rolesMap,
- AudioSystemInterface asi, int useCase, int role) {
- synchronized (rolesMap) {
- Pair<Integer, Integer> key = new Pair<>(useCase, role);
- if (!rolesMap.containsKey(key)) {
- return AudioSystem.SUCCESS;
- }
- final int status = asi.deviceRoleAction(useCase, role, null);
- if (status == AudioSystem.SUCCESS) {
- rolesMap.remove(key);
- }
- return status;
- }
- }
-
- @GuardedBy("mDevicesLock")
- private void purgeDevicesRoles_l() {
- purgeRoles(mAppliedStrategyRoles, (s, r, d) -> {
- return mAudioSystem.removeDevicesRoleForStrategy(s, r, d); });
- purgeRoles(mAppliedPresetRoles, (p, r, d) -> {
- return mAudioSystem.removeDevicesRoleForCapturePreset(p, r, d); });
- }
-
- @GuardedBy("mDevicesLock")
- private void purgeRoles(
- ArrayMap<Pair<Integer, Integer>, List<AudioDeviceAttributes>> rolesMap,
- AudioSystemInterface asi) {
- synchronized (rolesMap) {
- Iterator<Map.Entry<Pair<Integer, Integer>, List<AudioDeviceAttributes>>> itRole =
- rolesMap.entrySet().iterator();
- while (itRole.hasNext()) {
- Map.Entry<Pair<Integer, Integer>, List<AudioDeviceAttributes>> entry =
- itRole.next();
- Pair<Integer, Integer> keyRole = entry.getKey();
- Iterator<AudioDeviceAttributes> itDev = rolesMap.get(keyRole).iterator();
- while (itDev.hasNext()) {
- AudioDeviceAttributes ada = itDev.next();
- final String devKey = DeviceInfo.makeDeviceListKey(ada.getInternalType(),
- ada.getAddress());
- if (mConnectedDevices.get(devKey) == null) {
- asi.deviceRoleAction(keyRole.first, keyRole.second, Arrays.asList(ada));
- itDev.remove();
- }
- }
- if (rolesMap.get(keyRole).isEmpty()) {
- itRole.remove();
- }
- }
- }
- }
-
-//-----------------------------------------------------------------------
+ //-----------------------------------------------------------------------
/**
* Check if a device is in the list of connected devices
@@ -1168,11 +871,10 @@
* @param connect true if connection
* @param isForTesting if true, not calling AudioSystem for the connection as this is
* just for testing
- * @param btDevice the corresponding Bluetooth device when relevant.
* @return false if an error was reported by AudioSystem
*/
/*package*/ boolean handleDeviceConnection(AudioDeviceAttributes attributes, boolean connect,
- boolean isForTesting, @Nullable BluetoothDevice btDevice) {
+ boolean isForTesting) {
int device = attributes.getInternalType();
String address = attributes.getAddress();
String deviceName = attributes.getName();
@@ -1187,7 +889,6 @@
.set(MediaMetrics.Property.MODE, connect
? MediaMetrics.Value.CONNECT : MediaMetrics.Value.DISCONNECT)
.set(MediaMetrics.Property.NAME, deviceName);
- boolean status = false;
synchronized (mDevicesLock) {
final String deviceKey = DeviceInfo.makeDeviceListKey(device, address);
if (AudioService.DEBUG_DEVICES) {
@@ -1215,33 +916,24 @@
.record();
return false;
}
- mConnectedDevices.put(deviceKey, new DeviceInfo(device, deviceName, address));
+ mConnectedDevices.put(deviceKey, new DeviceInfo(
+ device, deviceName, address, AudioSystem.AUDIO_FORMAT_DEFAULT));
mDeviceBroker.postAccessoryPlugMediaUnmute(device);
- status = true;
+ mmi.set(MediaMetrics.Property.STATE, MediaMetrics.Value.CONNECTED).record();
+ return true;
} else if (!connect && isConnected) {
mAudioSystem.setDeviceConnectionState(attributes,
AudioSystem.DEVICE_STATE_UNAVAILABLE, AudioSystem.AUDIO_FORMAT_DEFAULT);
// always remove even if disconnection failed
mConnectedDevices.remove(deviceKey);
- status = true;
- }
- if (status) {
- if (AudioSystem.isBluetoothScoDevice(device)) {
- updateBluetoothPreferredModes_l();
- if (connect) {
- mDeviceBroker.postNotifyPreferredAudioProfileApplied(btDevice);
- } else {
- purgeDevicesRoles_l();
- }
- }
mmi.set(MediaMetrics.Property.STATE, MediaMetrics.Value.CONNECTED).record();
- } else {
- Log.w(TAG, "handleDeviceConnection() failed, deviceKey=" + deviceKey
- + ", deviceSpec=" + di + ", connect=" + connect);
- mmi.set(MediaMetrics.Property.STATE, MediaMetrics.Value.DISCONNECTED).record();
+ return true;
}
+ Log.w(TAG, "handleDeviceConnection() failed, deviceKey=" + deviceKey
+ + ", deviceSpec=" + di + ", connect=" + connect);
}
- return status;
+ mmi.set(MediaMetrics.Property.STATE, MediaMetrics.Value.DISCONNECTED).record();
+ return false;
}
@@ -1450,20 +1142,15 @@
// Internal utilities
@GuardedBy("mDevicesLock")
- private void makeA2dpDeviceAvailable(AudioDeviceBroker.BtDeviceInfo btInfo,
- String eventSource) {
- final String address = btInfo.mDevice.getAddress();
- final String name = BtHelper.getName(btInfo.mDevice);
- final int a2dpCodec = btInfo.mCodec;
-
+ private void makeA2dpDeviceAvailable(String address, String name, String eventSource,
+ int a2dpCodec) {
// enable A2DP before notifying A2DP connection to avoid unnecessary processing in
// audio policy manager
mDeviceBroker.setBluetoothA2dpOnInt(true, true /*fromA2dp*/, eventSource);
// at this point there could be another A2DP device already connected in APM, but it
// doesn't matter as this new one will overwrite the previous one
- AudioDeviceAttributes ada = new AudioDeviceAttributes(
- AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP, address, name);
- final int res = mAudioSystem.setDeviceConnectionState(ada,
+ final int res = mAudioSystem.setDeviceConnectionState(new AudioDeviceAttributes(
+ AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP, address, name),
AudioSystem.DEVICE_STATE_AVAILABLE, a2dpCodec);
// TODO: log in MediaMetrics once distinction between connection failure and
@@ -1485,7 +1172,8 @@
// The convention for head tracking sensors associated with A2DP devices is to
// use a UUID derived from the MAC address as follows:
// time_low = 0, time_mid = 0, time_hi = 0, clock_seq = 0, node = MAC Address
- UUID sensorUuid = UuidUtils.uuidFromAudioDeviceAttributes(ada);
+ UUID sensorUuid = UuidUtils.uuidFromAudioDeviceAttributes(
+ new AudioDeviceAttributes(AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP, address));
final DeviceInfo di = new DeviceInfo(AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP, name,
address, a2dpCodec, sensorUuid);
final String diKey = di.getKey();
@@ -1496,206 +1184,6 @@
mDeviceBroker.postAccessoryPlugMediaUnmute(AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP);
setCurrentAudioRouteNameIfPossible(name, true /*fromA2dp*/);
-
- updateBluetoothPreferredModes_l();
- mDeviceBroker.postNotifyPreferredAudioProfileApplied(btInfo.mDevice);
- }
-
- static final int[] CAPTURE_PRESETS = new int[] {AudioSource.MIC, AudioSource.CAMCORDER,
- AudioSource.VOICE_RECOGNITION, AudioSource.VOICE_COMMUNICATION,
- AudioSource.UNPROCESSED, AudioSource.VOICE_PERFORMANCE, AudioSource.HOTWORD};
-
- // reflects system property persist.bluetooth.enable_dual_mode_audio
- final boolean mBluetoothDualModeEnabled;
- /**
- * Goes over all connected Bluetooth devices and set the audio policy device role to DISABLED
- * or not according to their own and other devices modes.
- * The top priority is given to LE devices, then SCO ,then A2DP.
- */
- @GuardedBy("mDevicesLock")
- private void applyConnectedDevicesRoles_l() {
- if (!mBluetoothDualModeEnabled) {
- return;
- }
- DeviceInfo leOutDevice =
- getFirstConnectedDeviceOfTypes(AudioSystem.DEVICE_OUT_ALL_BLE_SET);
- DeviceInfo leInDevice =
- getFirstConnectedDeviceOfTypes(AudioSystem.DEVICE_IN_ALL_BLE_SET);
- DeviceInfo a2dpDevice =
- getFirstConnectedDeviceOfTypes(AudioSystem.DEVICE_OUT_ALL_A2DP_SET);
- DeviceInfo scoOutDevice =
- getFirstConnectedDeviceOfTypes(AudioSystem.DEVICE_OUT_ALL_SCO_SET);
- DeviceInfo scoInDevice =
- getFirstConnectedDeviceOfTypes(AudioSystem.DEVICE_IN_ALL_SCO_SET);
- boolean disableA2dp = (leOutDevice != null && leOutDevice.isOutputOnlyModeEnabled());
- boolean disableSco = (leOutDevice != null && leOutDevice.isDuplexModeEnabled())
- || (leInDevice != null && leInDevice.isDuplexModeEnabled());
- AudioDeviceAttributes communicationDevice =
- mDeviceBroker.mActiveCommunicationDevice == null
- ? null : ((mDeviceBroker.isInCommunication()
- && mDeviceBroker.mActiveCommunicationDevice != null)
- ? new AudioDeviceAttributes(mDeviceBroker.mActiveCommunicationDevice)
- : null);
-
- if (AudioService.DEBUG_DEVICES) {
- Log.i(TAG, "applyConnectedDevicesRoles_l\n - leOutDevice: " + leOutDevice
- + "\n - leInDevice: " + leInDevice
- + "\n - a2dpDevice: " + a2dpDevice
- + "\n - scoOutDevice: " + scoOutDevice
- + "\n - scoInDevice: " + scoInDevice
- + "\n - disableA2dp: " + disableA2dp
- + ", disableSco: " + disableSco);
- }
-
- for (DeviceInfo di : mConnectedDevices.values()) {
- if (!AudioSystem.isBluetoothDevice(di.mDeviceType)) {
- continue;
- }
- AudioDeviceAttributes ada =
- new AudioDeviceAttributes(di.mDeviceType, di.mDeviceAddress, di.mDeviceName);
- if (AudioService.DEBUG_DEVICES) {
- Log.i(TAG, " + checking Device: " + ada);
- }
- if (ada.equalTypeAddress(communicationDevice)) {
- continue;
- }
-
- if (AudioSystem.isBluetoothOutDevice(di.mDeviceType)) {
- for (AudioProductStrategy strategy : mStrategies) {
- boolean disable = false;
- if (strategy.getId() == mDeviceBroker.mCommunicationStrategyId) {
- if (AudioSystem.isBluetoothScoDevice(di.mDeviceType)) {
- disable = disableSco || !di.isDuplexModeEnabled();
- } else if (AudioSystem.isBluetoothLeDevice(di.mDeviceType)) {
- disable = !di.isDuplexModeEnabled();
- }
- } else {
- if (AudioSystem.isBluetoothA2dpOutDevice(di.mDeviceType)) {
- disable = disableA2dp || !di.isOutputOnlyModeEnabled();
- } else if (AudioSystem.isBluetoothScoDevice(di.mDeviceType)) {
- disable = disableSco || !di.isOutputOnlyModeEnabled();
- } else if (AudioSystem.isBluetoothLeDevice(di.mDeviceType)) {
- disable = !di.isOutputOnlyModeEnabled();
- }
- }
- if (AudioService.DEBUG_DEVICES) {
- Log.i(TAG, " - strategy: " + strategy.getId()
- + ", disable: " + disable);
- }
- if (disable) {
- addDevicesRoleForStrategy(strategy.getId(),
- AudioSystem.DEVICE_ROLE_DISABLED, Arrays.asList(ada));
- } else {
- removeDevicesRoleForStrategy(strategy.getId(),
- AudioSystem.DEVICE_ROLE_DISABLED, Arrays.asList(ada));
- }
- }
- }
- if (AudioSystem.isBluetoothInDevice(di.mDeviceType)) {
- for (int capturePreset : CAPTURE_PRESETS) {
- boolean disable = false;
- if (AudioSystem.isBluetoothScoDevice(di.mDeviceType)) {
- disable = disableSco || !di.isDuplexModeEnabled();
- } else if (AudioSystem.isBluetoothLeDevice(di.mDeviceType)) {
- disable = !di.isDuplexModeEnabled();
- }
- if (AudioService.DEBUG_DEVICES) {
- Log.i(TAG, " - capturePreset: " + capturePreset
- + ", disable: " + disable);
- }
- if (disable) {
- addDevicesRoleForCapturePreset(capturePreset,
- AudioSystem.DEVICE_ROLE_DISABLED, Arrays.asList(ada));
- } else {
- removeDevicesRoleForCapturePreset(capturePreset,
- AudioSystem.DEVICE_ROLE_DISABLED, Arrays.asList(ada));
- }
- }
- }
- }
- }
-
- /* package */ void applyConnectedDevicesRoles() {
- synchronized (mDevicesLock) {
- applyConnectedDevicesRoles_l();
- }
- }
-
- @GuardedBy("mDevicesLock")
- int checkProfileIsConnected(int profile) {
- switch (profile) {
- case BluetoothProfile.HEADSET:
- if (getFirstConnectedDeviceOfTypes(
- AudioSystem.DEVICE_OUT_ALL_SCO_SET) != null
- || getFirstConnectedDeviceOfTypes(
- AudioSystem.DEVICE_IN_ALL_SCO_SET) != null) {
- return profile;
- }
- break;
- case BluetoothProfile.A2DP:
- if (getFirstConnectedDeviceOfTypes(
- AudioSystem.DEVICE_OUT_ALL_A2DP_SET) != null) {
- return profile;
- }
- break;
- case BluetoothProfile.LE_AUDIO:
- case BluetoothProfile.LE_AUDIO_BROADCAST:
- if (getFirstConnectedDeviceOfTypes(
- AudioSystem.DEVICE_OUT_ALL_BLE_SET) != null
- || getFirstConnectedDeviceOfTypes(
- AudioSystem.DEVICE_IN_ALL_BLE_SET) != null) {
- return profile;
- }
- break;
- default:
- break;
- }
- return 0;
- }
-
- @GuardedBy("mDevicesLock")
- private void updateBluetoothPreferredModes_l() {
- if (!mBluetoothDualModeEnabled) {
- return;
- }
- HashSet<String> processedAddresses = new HashSet<>(0);
- for (DeviceInfo di : mConnectedDevices.values()) {
- if (!AudioSystem.isBluetoothDevice(di.mDeviceType)
- || processedAddresses.contains(di.mDeviceAddress)) {
- continue;
- }
- Bundle preferredProfiles = BtHelper.getPreferredAudioProfiles(di.mDeviceAddress);
- if (AudioService.DEBUG_DEVICES) {
- Log.i(TAG, "updateBluetoothPreferredModes_l processing device address: "
- + di.mDeviceAddress + ", preferredProfiles: " + preferredProfiles);
- }
- for (DeviceInfo di2 : mConnectedDevices.values()) {
- if (!AudioSystem.isBluetoothDevice(di2.mDeviceType)
- || !di.mDeviceAddress.equals(di2.mDeviceAddress)) {
- continue;
- }
- int profile = BtHelper.getProfileFromType(di2.mDeviceType);
- if (profile == 0) {
- continue;
- }
- int preferredProfile = checkProfileIsConnected(
- preferredProfiles.getInt(BluetoothAdapter.AUDIO_MODE_DUPLEX));
- if (preferredProfile == profile || preferredProfile == 0) {
- di2.setModeEnabled(BluetoothAdapter.AUDIO_MODE_DUPLEX);
- } else {
- di2.setModeDisabled(BluetoothAdapter.AUDIO_MODE_DUPLEX);
- }
- preferredProfile = checkProfileIsConnected(
- preferredProfiles.getInt(BluetoothAdapter.AUDIO_MODE_OUTPUT_ONLY));
- if (preferredProfile == profile || preferredProfile == 0) {
- di2.setModeEnabled(BluetoothAdapter.AUDIO_MODE_OUTPUT_ONLY);
- } else {
- di2.setModeDisabled(BluetoothAdapter.AUDIO_MODE_OUTPUT_ONLY);
- }
- }
- processedAddresses.add(di.mDeviceAddress);
- }
- applyConnectedDevicesRoles_l();
}
@GuardedBy("mDevicesLock")
@@ -1743,9 +1231,6 @@
// Remove A2DP routes as well
setCurrentAudioRouteNameIfPossible(null, true /*fromA2dp*/);
mmi.record();
-
- updateBluetoothPreferredModes_l();
- purgeDevicesRoles_l();
}
@GuardedBy("mDevicesLock")
@@ -1775,7 +1260,8 @@
AudioSystem.AUDIO_FORMAT_DEFAULT);
mConnectedDevices.put(
DeviceInfo.makeDeviceListKey(AudioSystem.DEVICE_IN_BLUETOOTH_A2DP, address),
- new DeviceInfo(AudioSystem.DEVICE_IN_BLUETOOTH_A2DP, "", address));
+ new DeviceInfo(AudioSystem.DEVICE_IN_BLUETOOTH_A2DP, "",
+ address, AudioSystem.AUDIO_FORMAT_DEFAULT));
}
@GuardedBy("mDevicesLock")
@@ -1801,7 +1287,8 @@
AudioSystem.AUDIO_FORMAT_DEFAULT);
mConnectedDevices.put(
DeviceInfo.makeDeviceListKey(AudioSystem.DEVICE_OUT_HEARING_AID, address),
- new DeviceInfo(AudioSystem.DEVICE_OUT_HEARING_AID, name, address));
+ new DeviceInfo(AudioSystem.DEVICE_OUT_HEARING_AID, name,
+ address, AudioSystem.AUDIO_FORMAT_DEFAULT));
mDeviceBroker.postAccessoryPlugMediaUnmute(AudioSystem.DEVICE_OUT_HEARING_AID);
mDeviceBroker.postApplyVolumeOnDevice(streamType,
AudioSystem.DEVICE_OUT_HEARING_AID, "makeHearingAidDeviceAvailable");
@@ -1839,56 +1326,29 @@
* @return true if a DEVICE_OUT_HEARING_AID is connected, false otherwise.
*/
boolean isHearingAidConnected() {
- return getFirstConnectedDeviceOfTypes(
- Sets.newHashSet(AudioSystem.DEVICE_OUT_HEARING_AID)) != null;
- }
-
- /**
- * Returns a DeviceInfo for the fist connected device matching one of the supplied types
- */
- private DeviceInfo getFirstConnectedDeviceOfTypes(Set<Integer> internalTypes) {
- List<DeviceInfo> devices = getConnectedDevicesOfTypes(internalTypes);
- return devices.isEmpty() ? null : devices.get(0);
- }
-
- /**
- * Returns a list of connected devices matching one one of the supplied types
- */
- private List<DeviceInfo> getConnectedDevicesOfTypes(Set<Integer> internalTypes) {
- ArrayList<DeviceInfo> devices = new ArrayList<>();
synchronized (mDevicesLock) {
for (DeviceInfo di : mConnectedDevices.values()) {
- if (internalTypes.contains(di.mDeviceType)) {
- devices.add(di);
+ if (di.mDeviceType == AudioSystem.DEVICE_OUT_HEARING_AID) {
+ return true;
}
}
+ return false;
}
- return devices;
- }
-
- /* package */ AudioDeviceAttributes getDeviceOfType(int type) {
- DeviceInfo di = getFirstConnectedDeviceOfTypes(Sets.newHashSet(type));
- return di == null ? null : new AudioDeviceAttributes(
- di.mDeviceType, di.mDeviceAddress, di.mDeviceName);
}
@GuardedBy("mDevicesLock")
- private void makeLeAudioDeviceAvailable(
- AudioDeviceBroker.BtDeviceInfo btInfo, int streamType, String eventSource) {
- final String address = btInfo.mDevice.getAddress();
- final String name = BtHelper.getName(btInfo.mDevice);
- final int volumeIndex = btInfo.mVolume == -1 ? -1 : btInfo.mVolume * 10;
- final int device = btInfo.mAudioSystemDevice;
-
+ private void makeLeAudioDeviceAvailable(String address, String name, int streamType,
+ int volumeIndex, int device, String eventSource) {
if (device != AudioSystem.DEVICE_NONE) {
/* Audio Policy sees Le Audio similar to A2DP. Let's make sure
* AUDIO_POLICY_FORCE_NO_BT_A2DP is not set
*/
mDeviceBroker.setBluetoothA2dpOnInt(true, false /*fromA2dp*/, eventSource);
- AudioDeviceAttributes ada = new AudioDeviceAttributes(device, address, name);
- final int res = AudioSystem.setDeviceConnectionState(ada,
- AudioSystem.DEVICE_STATE_AVAILABLE, AudioSystem.AUDIO_FORMAT_DEFAULT);
+ final int res = AudioSystem.setDeviceConnectionState(new AudioDeviceAttributes(
+ device, address, name),
+ AudioSystem.DEVICE_STATE_AVAILABLE,
+ AudioSystem.AUDIO_FORMAT_DEFAULT);
if (res != AudioSystem.AUDIO_STATUS_OK) {
AudioService.sDeviceLogger.enqueue(new EventLogger.StringEvent(
"APM failed to make available LE Audio device addr=" + address
@@ -1899,13 +1359,12 @@
AudioService.sDeviceLogger.enqueue(new EventLogger.StringEvent(
"LE Audio device addr=" + address + " now available").printLog(TAG));
}
+
// Reset LEA suspend state each time a new sink is connected
mDeviceBroker.clearLeAudioSuspended();
- UUID sensorUuid = UuidUtils.uuidFromAudioDeviceAttributes(ada);
mConnectedDevices.put(DeviceInfo.makeDeviceListKey(device, address),
- new DeviceInfo(device, name, address, AudioSystem.AUDIO_FORMAT_DEFAULT,
- sensorUuid));
+ new DeviceInfo(device, name, address, AudioSystem.AUDIO_FORMAT_DEFAULT));
mDeviceBroker.postAccessoryPlugMediaUnmute(device);
setCurrentAudioRouteNameIfPossible(name, /*fromA2dp=*/false);
}
@@ -1921,9 +1380,6 @@
final int maxIndex = mDeviceBroker.getMaxVssVolumeForStream(streamType);
mDeviceBroker.postSetLeAudioVolumeIndex(leAudioVolIndex, maxIndex, streamType);
mDeviceBroker.postApplyVolumeOnDevice(streamType, device, "makeLeAudioDeviceAvailable");
-
- updateBluetoothPreferredModes_l();
- mDeviceBroker.postNotifyPreferredAudioProfileApplied(btInfo.mDevice);
}
@GuardedBy("mDevicesLock")
@@ -1948,9 +1404,6 @@
}
setCurrentAudioRouteNameIfPossible(null, false /*fromA2dp*/);
-
- updateBluetoothPreferredModes_l();
- purgeDevicesRoles_l();
}
@GuardedBy("mDevicesLock")
@@ -2286,6 +1739,18 @@
}
}
+ /* package */ AudioDeviceAttributes getDeviceOfType(int type) {
+ synchronized (mDevicesLock) {
+ for (DeviceInfo di : mConnectedDevices.values()) {
+ if (di.mDeviceType == type) {
+ return new AudioDeviceAttributes(
+ di.mDeviceType, di.mDeviceAddress, di.mDeviceName);
+ }
+ }
+ }
+ return null;
+ }
+
//----------------------------------------------------------
// For tests only
@@ -2296,12 +1761,10 @@
*/
@VisibleForTesting
public boolean isA2dpDeviceConnected(@NonNull BluetoothDevice device) {
- for (DeviceInfo di : getConnectedDevicesOfTypes(
- Sets.newHashSet(AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP))) {
- if (di.mDeviceAddress.equals(device.getAddress())) {
- return true;
- }
+ final String key = DeviceInfo.makeDeviceListKey(AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP,
+ device.getAddress());
+ synchronized (mDevicesLock) {
+ return (mConnectedDevices.get(key) != null);
}
- return false;
}
}
diff --git a/services/core/java/com/android/server/audio/AudioSystemAdapter.java b/services/core/java/com/android/server/audio/AudioSystemAdapter.java
index 1142a8d..7af7ed5 100644
--- a/services/core/java/com/android/server/audio/AudioSystemAdapter.java
+++ b/services/core/java/com/android/server/audio/AudioSystemAdapter.java
@@ -435,7 +435,7 @@
}
/**
- * Same as {@link AudioSystem#removeDevicesRoleForCapturePreset(int, int, List)}
+ * Same as {@link AudioSystem#removeDevicesRoleForCapturePreset(int, int, int[], String[])}
* @param capturePreset
* @param role
* @param devicesToRemove
@@ -448,19 +448,6 @@
}
/**
- * Same as {@link AudioSystem#addDevicesRoleForCapturePreset(int, int, List)}
- * @param capturePreset the capture preset to configure
- * @param role the role of the devices
- * @param devices the list of devices to be added as role for the given capture preset
- * @return {@link #SUCCESS} if successfully add
- */
- public int addDevicesRoleForCapturePreset(
- int capturePreset, int role, @NonNull List<AudioDeviceAttributes> devices) {
- invalidateRoutingCache();
- return AudioSystem.addDevicesRoleForCapturePreset(capturePreset, role, devices);
- }
-
- /**
* Same as {@link AudioSystem#}
* @param capturePreset
* @param role
diff --git a/services/core/java/com/android/server/audio/BtHelper.java b/services/core/java/com/android/server/audio/BtHelper.java
index e46c3cc..8c27c3e 100644
--- a/services/core/java/com/android/server/audio/BtHelper.java
+++ b/services/core/java/com/android/server/audio/BtHelper.java
@@ -33,7 +33,6 @@
import android.media.AudioSystem;
import android.media.BluetoothProfileConnectionInfo;
import android.os.Binder;
-import android.os.Bundle;
import android.os.UserHandle;
import android.provider.Settings;
import android.text.TextUtils;
@@ -151,12 +150,60 @@
}
}
+ //----------------------------------------------------------------------
+ /*package*/ static class BluetoothA2dpDeviceInfo {
+ private final @NonNull BluetoothDevice mBtDevice;
+ private final int mVolume;
+ private final @AudioSystem.AudioFormatNativeEnumForBtCodec int mCodec;
+
+ BluetoothA2dpDeviceInfo(@NonNull BluetoothDevice btDevice) {
+ this(btDevice, -1, AudioSystem.AUDIO_FORMAT_DEFAULT);
+ }
+
+ BluetoothA2dpDeviceInfo(@NonNull BluetoothDevice btDevice, int volume, int codec) {
+ mBtDevice = btDevice;
+ mVolume = volume;
+ mCodec = codec;
+ }
+
+ public @NonNull BluetoothDevice getBtDevice() {
+ return mBtDevice;
+ }
+
+ public int getVolume() {
+ return mVolume;
+ }
+
+ public @AudioSystem.AudioFormatNativeEnumForBtCodec int getCodec() {
+ return mCodec;
+ }
+
+ // redefine equality op so we can match messages intended for this device
+ @Override
+ public boolean equals(Object o) {
+ if (o == null) {
+ return false;
+ }
+ if (this == o) {
+ return true;
+ }
+ if (o instanceof BluetoothA2dpDeviceInfo) {
+ return mBtDevice.equals(((BluetoothA2dpDeviceInfo) o).getBtDevice());
+ }
+ return false;
+ }
+
+
+ }
+
// A2DP device events
/*package*/ static final int EVENT_DEVICE_CONFIG_CHANGE = 0;
+ /*package*/ static final int EVENT_ACTIVE_DEVICE_CHANGE = 1;
- /*package*/ static String deviceEventToString(int event) {
+ /*package*/ static String a2dpDeviceEventToString(int event) {
switch (event) {
case EVENT_DEVICE_CONFIG_CHANGE: return "DEVICE_CONFIG_CHANGE";
+ case EVENT_ACTIVE_DEVICE_CHANGE: return "ACTIVE_DEVICE_CHANGE";
default:
return new String("invalid event:" + event);
}
@@ -573,12 +620,11 @@
return btHeadsetDeviceToAudioDevice(mBluetoothHeadsetDevice);
}
- private static AudioDeviceAttributes btHeadsetDeviceToAudioDevice(BluetoothDevice btDevice) {
+ private AudioDeviceAttributes btHeadsetDeviceToAudioDevice(BluetoothDevice btDevice) {
if (btDevice == null) {
return new AudioDeviceAttributes(AudioSystem.DEVICE_OUT_BLUETOOTH_SCO, "");
}
String address = btDevice.getAddress();
- String name = getName(btDevice);
if (!BluetoothAdapter.checkBluetoothAddress(address)) {
address = "";
}
@@ -600,7 +646,7 @@
+ " btClass: " + (btClass == null ? "Unknown" : btClass)
+ " nativeType: " + nativeType + " address: " + address);
}
- return new AudioDeviceAttributes(nativeType, address, name);
+ return new AudioDeviceAttributes(nativeType, address);
}
private boolean handleBtScoActiveDeviceChange(BluetoothDevice btDevice, boolean isActive) {
@@ -609,9 +655,12 @@
}
int inDevice = AudioSystem.DEVICE_IN_BLUETOOTH_SCO_HEADSET;
AudioDeviceAttributes audioDevice = btHeadsetDeviceToAudioDevice(btDevice);
+ String btDeviceName = getName(btDevice);
boolean result = false;
if (isActive) {
- result |= mDeviceBroker.handleDeviceConnection(audioDevice, isActive, btDevice);
+ result |= mDeviceBroker.handleDeviceConnection(new AudioDeviceAttributes(
+ audioDevice.getInternalType(), audioDevice.getAddress(), btDeviceName),
+ isActive);
} else {
int[] outDeviceTypes = {
AudioSystem.DEVICE_OUT_BLUETOOTH_SCO,
@@ -620,14 +669,14 @@
};
for (int outDeviceType : outDeviceTypes) {
result |= mDeviceBroker.handleDeviceConnection(new AudioDeviceAttributes(
- outDeviceType, audioDevice.getAddress(), audioDevice.getName()),
- isActive, btDevice);
+ outDeviceType, audioDevice.getAddress(), btDeviceName),
+ isActive);
}
}
// handleDeviceConnection() && result to make sure the method get executed
result = mDeviceBroker.handleDeviceConnection(new AudioDeviceAttributes(
- inDevice, audioDevice.getAddress(), audioDevice.getName()),
- isActive, btDevice) && result;
+ inDevice, audioDevice.getAddress(), btDeviceName),
+ isActive) && result;
return result;
}
@@ -924,30 +973,6 @@
}
}
- /*package */ static int getProfileFromType(int deviceType) {
- if (AudioSystem.isBluetoothA2dpOutDevice(deviceType)) {
- return BluetoothProfile.A2DP;
- } else if (AudioSystem.isBluetoothScoDevice(deviceType)) {
- return BluetoothProfile.HEADSET;
- } else if (AudioSystem.isBluetoothLeDevice(deviceType)) {
- return BluetoothProfile.LE_AUDIO;
- }
- return 0; // 0 is not a valid profile
- }
-
- /*package */ static Bundle getPreferredAudioProfiles(String address) {
- BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();
- return adapter.getPreferredAudioProfiles(adapter.getRemoteDevice(address));
- }
-
- /**
- * Notifies Bluetooth framework that new preferred audio profiles for Bluetooth devices
- * have been applied.
- */
- public static void onNotifyPreferredAudioProfileApplied(BluetoothDevice btDevice) {
- BluetoothAdapter.getDefaultAdapter().notifyActiveDeviceChangeApplied(btDevice);
- }
-
/**
* Returns the string equivalent for the btDeviceClass class.
*/
diff --git a/services/core/java/com/android/server/audio/SoundDoseHelper.java b/services/core/java/com/android/server/audio/SoundDoseHelper.java
index 31f0c05..a57dd40 100644
--- a/services/core/java/com/android/server/audio/SoundDoseHelper.java
+++ b/services/core/java/com/android/server/audio/SoundDoseHelper.java
@@ -303,8 +303,9 @@
SAFE_MEDIA_VOLUME_UNINITIALIZED);
mSafeMediaVolumeDevices.append(AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES,
SAFE_MEDIA_VOLUME_UNINITIALIZED);
- mSafeMediaVolumeDevices.append(AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP,
- SAFE_MEDIA_VOLUME_UNINITIALIZED);
+ // TODO(b/278265907): enable A2DP when we can distinguish A2DP headsets
+ // mSafeMediaVolumeDevices.append(AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP,
+ // SAFE_MEDIA_VOLUME_UNINITIALIZED);
}
float getOutputRs2UpperBound() {
diff --git a/services/core/java/com/android/server/locksettings/LockSettingsService.java b/services/core/java/com/android/server/locksettings/LockSettingsService.java
index ee4a6fe..a7e704e 100644
--- a/services/core/java/com/android/server/locksettings/LockSettingsService.java
+++ b/services/core/java/com/android/server/locksettings/LockSettingsService.java
@@ -116,6 +116,7 @@
import android.util.ArrayMap;
import android.util.ArraySet;
import android.util.EventLog;
+import android.util.Log;
import android.util.LongSparseArray;
import android.util.Slog;
import android.util.SparseArray;
@@ -1229,6 +1230,26 @@
}
/**
+ * {@link LockPatternUtils#refreshStoredPinLength(int)}
+ * @param userId user id of the user whose pin length we want to save
+ * @return true/false depending on whether PIN length has been saved or not
+ */
+ @Override
+ public boolean refreshStoredPinLength(int userId) {
+ checkPasswordHavePermission();
+ synchronized (mSpManager) {
+ PasswordMetrics passwordMetrics = getUserPasswordMetrics(userId);
+ if (passwordMetrics != null) {
+ final long protectorId = getCurrentLskfBasedProtectorId(userId);
+ return mSpManager.refreshPinLengthOnDisk(passwordMetrics, protectorId, userId);
+ } else {
+ Log.w(TAG, "PasswordMetrics is not available");
+ return false;
+ }
+ }
+ }
+
+ /**
* This API is cached; whenever the result would change,
* {@link com.android.internal.widget.LockPatternUtils#invalidateCredentialTypeCache}
* must be called.
diff --git a/services/core/java/com/android/server/locksettings/LockSettingsStorage.java b/services/core/java/com/android/server/locksettings/LockSettingsStorage.java
index de3a7ef..731ecad 100644
--- a/services/core/java/com/android/server/locksettings/LockSettingsStorage.java
+++ b/services/core/java/com/android/server/locksettings/LockSettingsStorage.java
@@ -121,6 +121,11 @@
}
@VisibleForTesting
+ public boolean isAutoPinConfirmSettingEnabled(int userId) {
+ return getBoolean(LockPatternUtils.AUTO_PIN_CONFIRM, false, userId);
+ }
+
+ @VisibleForTesting
public void writeKeyValue(SQLiteDatabase db, String key, String value, int userId) {
ContentValues cv = new ContentValues();
cv.put(COLUMN_KEY, key);
diff --git a/services/core/java/com/android/server/locksettings/SyntheticPasswordManager.java b/services/core/java/com/android/server/locksettings/SyntheticPasswordManager.java
index a4dab72..8b8c5f6 100644
--- a/services/core/java/com/android/server/locksettings/SyntheticPasswordManager.java
+++ b/services/core/java/com/android/server/locksettings/SyntheticPasswordManager.java
@@ -16,6 +16,7 @@
package com.android.server.locksettings;
+import static com.android.internal.widget.LockPatternUtils.CREDENTIAL_TYPE_PIN;
import static com.android.internal.widget.LockPatternUtils.EscrowTokenStateChangeCallback;
import static com.android.internal.widget.LockPatternUtils.PIN_LENGTH_UNAVAILABLE;
@@ -545,6 +546,11 @@
return null;
}
+ @VisibleForTesting
+ public boolean isAutoPinConfirmationFeatureAvailable() {
+ return LockPatternUtils.isAutoPinConfirmFeatureAvailable();
+ }
+
private synchronized boolean isWeaverAvailable() {
if (mWeaver != null) {
return true;
@@ -901,8 +907,8 @@
LockscreenCredential credential, SyntheticPassword sp, int userId) {
long protectorId = generateProtectorId();
int pinLength = PIN_LENGTH_UNAVAILABLE;
- if (LockPatternUtils.isAutoPinConfirmFeatureAvailable()) {
- pinLength = derivePinLength(credential, userId);
+ if (isAutoPinConfirmationFeatureAvailable()) {
+ pinLength = derivePinLength(credential.size(), credential.isPin(), userId);
}
// There's no need to store password data about an empty LSKF.
PasswordData pwd = credential.isNone() ? null :
@@ -978,13 +984,13 @@
return protectorId;
}
- private int derivePinLength(LockscreenCredential credential, int userId) {
- if (!credential.isPin()
- || !mStorage.getBoolean(LockPatternUtils.AUTO_PIN_CONFIRM, false, userId)
- || credential.size() < LockPatternUtils.MIN_AUTO_PIN_REQUIREMENT_LENGTH) {
+ private int derivePinLength(int sizeOfCredential, boolean isPinCredential, int userId) {
+ if (!isPinCredential
+ || !mStorage.isAutoPinConfirmSettingEnabled(userId)
+ || sizeOfCredential < LockPatternUtils.MIN_AUTO_PIN_REQUIREMENT_LENGTH) {
return PIN_LENGTH_UNAVAILABLE;
}
- return credential.size();
+ return sizeOfCredential;
}
public VerifyCredentialResponse verifyFrpCredential(IGateKeeperService gatekeeper,
@@ -1347,19 +1353,39 @@
savePasswordMetrics(credential, result.syntheticPassword, protectorId, userId);
syncState(userId); // Not strictly needed as the upgrade can be re-done, but be safe.
}
- if (LockPatternUtils.isAutoPinConfirmFeatureAvailable()
- && result.syntheticPassword != null && pwd != null) {
- int expectedPinLength = derivePinLength(credential, userId);
- if (pwd.pinLength != expectedPinLength) {
- pwd.pinLength = expectedPinLength;
- saveState(PASSWORD_DATA_NAME, pwd.toBytes(), protectorId, userId);
- syncState(userId);
- }
- }
return result;
}
/**
+ * {@link LockPatternUtils#refreshStoredPinLength(int)}
+ * @param passwordMetrics passwordMetrics object containing the cached pin length
+ * @param userId userId of the user whose pin length we want to store on disk
+ * @param protectorId current LSKF based protectorId
+ * @return true/false depending on whether PIN length has been saved on disk
+ */
+ public boolean refreshPinLengthOnDisk(PasswordMetrics passwordMetrics,
+ long protectorId, int userId) {
+ if (!isAutoPinConfirmationFeatureAvailable()) {
+ return false;
+ }
+
+ byte[] pwdDataBytes = loadState(PASSWORD_DATA_NAME, protectorId, userId);
+ if (pwdDataBytes == null) {
+ return false;
+ }
+
+ PasswordData pwd = PasswordData.fromBytes(pwdDataBytes);
+ int pinLength = derivePinLength(passwordMetrics.length,
+ passwordMetrics.credType == CREDENTIAL_TYPE_PIN, userId);
+ if (pwd.pinLength != pinLength) {
+ pwd.pinLength = pinLength;
+ saveState(PASSWORD_DATA_NAME, pwd.toBytes(), protectorId, userId);
+ syncState(userId);
+ }
+ return true;
+ }
+
+ /**
* Tries to unlock a token-based SP protector (weak or strong), given its ID and the claimed
* token. On success, returns the user's synthetic password, and also does a Gatekeeper
* verification to refresh the SID and HardwareAuthToken maintained by the system.
diff --git a/services/core/java/com/android/server/pm/DefaultCrossProfileIntentFilter.java b/services/core/java/com/android/server/pm/DefaultCrossProfileIntentFilter.java
index 9683469..dc5915d 100644
--- a/services/core/java/com/android/server/pm/DefaultCrossProfileIntentFilter.java
+++ b/services/core/java/com/android/server/pm/DefaultCrossProfileIntentFilter.java
@@ -37,7 +37,7 @@
Direction.TO_PROFILE
})
@Retention(RetentionPolicy.SOURCE)
- @interface Direction {
+ public @interface Direction {
int TO_PARENT = 0;
int TO_PROFILE = 1;
}
diff --git a/services/core/java/com/android/server/pm/DefaultCrossProfileIntentFiltersUtils.java b/services/core/java/com/android/server/pm/DefaultCrossProfileIntentFiltersUtils.java
index 9eb73aa..48ee64f 100644
--- a/services/core/java/com/android/server/pm/DefaultCrossProfileIntentFiltersUtils.java
+++ b/services/core/java/com/android/server/pm/DefaultCrossProfileIntentFiltersUtils.java
@@ -25,6 +25,7 @@
import android.provider.AlarmClock;
import android.provider.MediaStore;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@@ -88,6 +89,23 @@
.addDataType("vnd.android.cursor.item/calls")
.build();
+ /** Dial intent with mime type exclusively handled by managed profile. */
+ private static final DefaultCrossProfileIntentFilter DIAL_MIME_MANAGED_PROFILE =
+ new DefaultCrossProfileIntentFilter.Builder(
+ DefaultCrossProfileIntentFilter.Direction.TO_PROFILE,
+ SKIP_CURRENT_PROFILE,
+ /* letsPersonalDataIntoProfile= */ false)
+ .addAction(Intent.ACTION_DIAL)
+ .addAction(Intent.ACTION_VIEW)
+ .addCategory(Intent.CATEGORY_DEFAULT)
+ .addCategory(Intent.CATEGORY_BROWSABLE)
+ .addDataType("vnd.android.cursor.item/phone")
+ .addDataType("vnd.android.cursor.item/phone_v2")
+ .addDataType("vnd.android.cursor.item/person")
+ .addDataType("vnd.android.cursor.dir/calls")
+ .addDataType("vnd.android.cursor.item/calls")
+ .build();
+
/** Dial intent with data scheme can be handled by either managed profile or its parent user. */
private static final DefaultCrossProfileIntentFilter DIAL_DATA =
new DefaultCrossProfileIntentFilter.Builder(
@@ -103,6 +121,21 @@
.addDataScheme("voicemail")
.build();
+ /** Dial intent with data scheme exclusively handled by managed profile. */
+ private static final DefaultCrossProfileIntentFilter DIAL_DATA_MANAGED_PROFILE =
+ new DefaultCrossProfileIntentFilter.Builder(
+ DefaultCrossProfileIntentFilter.Direction.TO_PROFILE,
+ SKIP_CURRENT_PROFILE,
+ /* letsPersonalDataIntoProfile= */ false)
+ .addAction(Intent.ACTION_DIAL)
+ .addAction(Intent.ACTION_VIEW)
+ .addCategory(Intent.CATEGORY_DEFAULT)
+ .addCategory(Intent.CATEGORY_BROWSABLE)
+ .addDataScheme("tel")
+ .addDataScheme("sip")
+ .addDataScheme("voicemail")
+ .build();
+
/**
* Dial intent with no data scheme or type can be handled by either managed profile or its
* parent user.
@@ -117,6 +150,19 @@
.addCategory(Intent.CATEGORY_BROWSABLE)
.build();
+ /**
+ * Dial intent with no data scheme or type exclusively handled by managed profile.
+ */
+ private static final DefaultCrossProfileIntentFilter DIAL_RAW_MANAGED_PROFILE =
+ new DefaultCrossProfileIntentFilter.Builder(
+ DefaultCrossProfileIntentFilter.Direction.TO_PROFILE,
+ SKIP_CURRENT_PROFILE,
+ /* letsPersonalDataIntoProfile= */ false)
+ .addAction(Intent.ACTION_DIAL)
+ .addCategory(Intent.CATEGORY_DEFAULT)
+ .addCategory(Intent.CATEGORY_BROWSABLE)
+ .build();
+
/** Pressing the call button can be handled by either managed profile or its parent user. */
private static final DefaultCrossProfileIntentFilter CALL_BUTTON =
new DefaultCrossProfileIntentFilter.Builder(
@@ -143,6 +189,22 @@
.addDataScheme("mmsto")
.build();
+ /** SMS and MMS intent exclusively handled by the managed profile. */
+ private static final DefaultCrossProfileIntentFilter SMS_MMS_MANAGED_PROFILE =
+ new DefaultCrossProfileIntentFilter.Builder(
+ DefaultCrossProfileIntentFilter.Direction.TO_PROFILE,
+ SKIP_CURRENT_PROFILE,
+ /* letsPersonalDataIntoProfile= */ false)
+ .addAction(Intent.ACTION_VIEW)
+ .addAction(Intent.ACTION_SENDTO)
+ .addCategory(Intent.CATEGORY_DEFAULT)
+ .addCategory(Intent.CATEGORY_BROWSABLE)
+ .addDataScheme("sms")
+ .addDataScheme("smsto")
+ .addDataScheme("mms")
+ .addDataScheme("mmsto")
+ .build();
+
/** Mobile network settings is always shown in the primary user. */
private static final DefaultCrossProfileIntentFilter
MOBILE_NETWORK_SETTINGS =
@@ -297,14 +359,12 @@
.build();
public static List<DefaultCrossProfileIntentFilter> getDefaultManagedProfileFilters() {
- return Arrays.asList(
+ List<DefaultCrossProfileIntentFilter> filters =
+ new ArrayList<DefaultCrossProfileIntentFilter>();
+ filters.addAll(Arrays.asList(
EMERGENCY_CALL_MIME,
EMERGENCY_CALL_DATA,
- DIAL_MIME,
- DIAL_DATA,
- DIAL_RAW,
CALL_BUTTON,
- SMS_MMS,
SET_ALARM,
MEDIA_CAPTURE,
RECOGNIZE_SPEECH,
@@ -317,11 +377,13 @@
USB_DEVICE_ATTACHED,
ACTION_SEND,
HOME,
- MOBILE_NETWORK_SETTINGS);
+ MOBILE_NETWORK_SETTINGS));
+ filters.addAll(getDefaultCrossProfileTelephonyIntentFilters(false));
+ return filters;
}
- /** Call intent with tel scheme */
- private static final DefaultCrossProfileIntentFilter CALL =
+ /** Call intent with tel scheme exclusively handled my managed profile. */
+ private static final DefaultCrossProfileIntentFilter CALL_MANAGED_PROFILE =
new DefaultCrossProfileIntentFilter.Builder(
DefaultCrossProfileIntentFilter.Direction.TO_PROFILE,
SKIP_CURRENT_PROFILE,
@@ -334,13 +396,22 @@
/**
* Returns default telephony related intent filters for managed profile.
*/
- public static List<DefaultCrossProfileIntentFilter> getDefaultManagedProfileTelephonyFilters() {
- return Arrays.asList(
- DIAL_DATA,
- DIAL_MIME,
- DIAL_RAW,
- CALL,
- SMS_MMS);
+ public static List<DefaultCrossProfileIntentFilter>
+ getDefaultCrossProfileTelephonyIntentFilters(boolean telephonyOnlyInManagedProfile) {
+ if (telephonyOnlyInManagedProfile) {
+ return Arrays.asList(
+ DIAL_DATA_MANAGED_PROFILE,
+ DIAL_MIME_MANAGED_PROFILE,
+ DIAL_RAW_MANAGED_PROFILE,
+ CALL_MANAGED_PROFILE,
+ SMS_MMS_MANAGED_PROFILE);
+ } else {
+ return Arrays.asList(
+ DIAL_DATA,
+ DIAL_MIME,
+ DIAL_RAW,
+ SMS_MMS);
+ }
}
/**
diff --git a/services/core/java/com/android/server/pm/InstallPackageHelper.java b/services/core/java/com/android/server/pm/InstallPackageHelper.java
index ad8a9ba..89d2d124 100644
--- a/services/core/java/com/android/server/pm/InstallPackageHelper.java
+++ b/services/core/java/com/android/server/pm/InstallPackageHelper.java
@@ -49,6 +49,7 @@
import static com.android.server.pm.InstructionSets.getAppDexInstructionSets;
import static com.android.server.pm.InstructionSets.getDexCodeInstructionSet;
import static com.android.server.pm.InstructionSets.getPreferredInstructionSet;
+import static com.android.server.pm.PackageManagerService.APP_METADATA_FILE_NAME;
import static com.android.server.pm.PackageManagerService.DEBUG_BACKUP;
import static com.android.server.pm.PackageManagerService.DEBUG_COMPRESSION;
import static com.android.server.pm.PackageManagerService.DEBUG_INSTALL;
@@ -497,6 +498,13 @@
mPm.setUpCustomResolverActivity(pkg, pkgSetting);
}
+ File appMetadataFile = new File(pkgSetting.getPath(), APP_METADATA_FILE_NAME);
+ if (appMetadataFile.exists()) {
+ pkgSetting.setAppMetadataFilePath(appMetadataFile.getAbsolutePath());
+ } else {
+ pkgSetting.setAppMetadataFilePath(null);
+ }
+
if (pkg.getPackageName().equals("android")) {
mPm.setPlatformPackage(pkg, pkgSetting);
}
diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java
index 3e1a1ac..ccade60 100644
--- a/services/core/java/com/android/server/pm/PackageManagerService.java
+++ b/services/core/java/com/android/server/pm/PackageManagerService.java
@@ -2364,6 +2364,32 @@
SystemClock.uptimeMillis() - startTime);
}
+ // If this is first boot or first boot after OTA then set the file path to the app
+ // metadata files for preloaded packages.
+ if (mFirstBoot || isDeviceUpgrading()) {
+ ArrayMap<String, String> paths = systemConfig.getAppMetadataFilePaths();
+ for (Map.Entry<String, String> entry : paths.entrySet()) {
+ String pkgName = entry.getKey();
+ String path = entry.getValue();
+ File file = new File(path);
+ if (!file.exists()) {
+ path = null;
+ }
+ PackageSetting disabledPkgSetting = mSettings.getDisabledSystemPkgLPr(pkgName);
+ if (disabledPkgSetting == null) {
+ PackageSetting pkgSetting = mSettings.getPackageLPr(pkgName);
+ if (pkgSetting != null) {
+ pkgSetting.setAppMetadataFilePath(path);
+ } else {
+ Slog.w(TAG, "Cannot set app metadata file for nonexistent package "
+ + pkgName);
+ }
+ } else {
+ disabledPkgSetting.setAppMetadataFilePath(path);
+ }
+ }
+ }
+
// Rebuild the live computer since some attributes have been rebuilt.
mLiveComputer = createLiveComputer();
@@ -5164,12 +5190,16 @@
throw new ParcelableException(
new PackageManager.NameNotFoundException(packageName));
}
- try {
- File file = new File(ps.getPath(), APP_METADATA_FILE_NAME);
- return ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY);
- } catch (FileNotFoundException e) {
- return null;
+ String filePath = ps.getAppMetadataFilePath();
+ if (filePath != null) {
+ File file = new File(filePath);
+ try {
+ return ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY);
+ } catch (FileNotFoundException e) {
+ return null;
+ }
}
+ return null;
}
@Override
diff --git a/services/core/java/com/android/server/pm/PackageManagerShellCommand.java b/services/core/java/com/android/server/pm/PackageManagerShellCommand.java
index 89f46fe..eea6720 100644
--- a/services/core/java/com/android/server/pm/PackageManagerShellCommand.java
+++ b/services/core/java/com/android/server/pm/PackageManagerShellCommand.java
@@ -124,10 +124,12 @@
import libcore.io.IoUtils;
import libcore.io.Streams;
+import java.io.BufferedReader;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
+import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.net.URISyntaxException;
@@ -348,6 +350,8 @@
return runDisableVerificationForUid();
case "set-silent-updates-policy":
return runSetSilentUpdatesPolicy();
+ case "get-app-metadata":
+ return runGetAppMetadata();
default: {
if (ART_SERVICE_COMMANDS.contains(cmd)) {
if (DexOptHelper.useArtService()) {
@@ -3541,6 +3545,30 @@
return 1;
}
+ private int runGetAppMetadata() {
+ final PrintWriter pw = getOutPrintWriter();
+ String pkgName = getNextArgRequired();
+ ParcelFileDescriptor pfd = null;
+ try {
+ pfd = mInterface.getAppMetadataFd(pkgName, mContext.getUserId());
+ } catch (RemoteException e) {
+ pw.println("Failure [" + e.getClass().getName() + " - " + e.getMessage() + "]");
+ return -1;
+ }
+ if (pfd != null) {
+ try (BufferedReader br = new BufferedReader(
+ new InputStreamReader(new ParcelFileDescriptor.AutoCloseInputStream(pfd)))) {
+ while (br.ready()) {
+ pw.println(br.readLine());
+ }
+ } catch (IOException e) {
+ pw.println("Failure [" + e.getClass().getName() + " - " + e.getMessage() + "]");
+ return -1;
+ }
+ }
+ return 1;
+ }
+
private int runArtServiceCommand() {
try (var in = ParcelFileDescriptor.dup(getInFileDescriptor());
var out = ParcelFileDescriptor.dup(getOutFileDescriptor());
diff --git a/services/core/java/com/android/server/pm/PackageSetting.java b/services/core/java/com/android/server/pm/PackageSetting.java
index 839ff41..7fda092 100644
--- a/services/core/java/com/android/server/pm/PackageSetting.java
+++ b/services/core/java/com/android/server/pm/PackageSetting.java
@@ -189,6 +189,9 @@
@NonNull
private UUID mDomainSetId;
+ @Nullable
+ private String mAppMetadataFilePath;
+
/**
* Snapshot support.
*/
@@ -655,6 +658,7 @@
updateAvailable = other.updateAvailable;
forceQueryableOverride = other.forceQueryableOverride;
mDomainSetId = other.mDomainSetId;
+ mAppMetadataFilePath = other.mAppMetadataFilePath;
usesSdkLibraries = other.usesSdkLibraries != null
? Arrays.copyOf(other.usesSdkLibraries,
@@ -1171,6 +1175,15 @@
return this;
}
+ /**
+ * @param path to app metadata file
+ */
+ public PackageSetting setAppMetadataFilePath(String path) {
+ mAppMetadataFilePath = path;
+ onChanged();
+ return this;
+ }
+
@NonNull
@Override
public long getVersionCode() {
@@ -1579,11 +1592,16 @@
return mDomainSetId;
}
+ @DataClass.Generated.Member
+ public @Nullable String getAppMetadataFilePath() {
+ return mAppMetadataFilePath;
+ }
+
@DataClass.Generated(
- time = 1678228625853L,
+ time = 1680917079522L,
codegenVersion = "1.0.23",
sourceFile = "frameworks/base/services/core/java/com/android/server/pm/PackageSetting.java",
- inputSignatures = "private int mSharedUserAppId\nprivate @android.annotation.Nullable java.util.Map<java.lang.String,java.util.Set<java.lang.String>> mimeGroups\nprivate @java.lang.Deprecated @android.annotation.Nullable java.util.Set<java.lang.String> mOldCodePaths\nprivate @android.annotation.Nullable java.lang.String[] usesSdkLibraries\nprivate @android.annotation.Nullable long[] usesSdkLibrariesVersionsMajor\nprivate @android.annotation.Nullable java.lang.String[] usesStaticLibraries\nprivate @android.annotation.Nullable long[] usesStaticLibrariesVersions\nprivate @android.annotation.Nullable @java.lang.Deprecated java.lang.String legacyNativeLibraryPath\nprivate @android.annotation.NonNull java.lang.String mName\nprivate @android.annotation.Nullable java.lang.String mRealName\nprivate int mAppId\nprivate @android.annotation.Nullable com.android.server.pm.parsing.pkg.AndroidPackageInternal pkg\nprivate @android.annotation.NonNull java.io.File mPath\nprivate @android.annotation.NonNull java.lang.String mPathString\nprivate float mLoadingProgress\nprivate long mLoadingCompletedTime\nprivate @android.annotation.Nullable java.lang.String mPrimaryCpuAbi\nprivate @android.annotation.Nullable java.lang.String mSecondaryCpuAbi\nprivate @android.annotation.Nullable java.lang.String mCpuAbiOverride\nprivate long mLastModifiedTime\nprivate long lastUpdateTime\nprivate long versionCode\nprivate @android.annotation.NonNull com.android.server.pm.PackageSignatures signatures\nprivate boolean installPermissionsFixed\nprivate @android.annotation.NonNull com.android.server.pm.PackageKeySetData keySetData\nprivate final @android.annotation.NonNull android.util.SparseArray<com.android.server.pm.pkg.PackageUserStateImpl> mUserStates\nprivate @android.annotation.NonNull com.android.server.pm.InstallSource installSource\nprivate @android.annotation.Nullable java.lang.String volumeUuid\nprivate int categoryOverride\nprivate boolean updateAvailable\nprivate boolean forceQueryableOverride\nprivate final @android.annotation.NonNull com.android.server.pm.pkg.PackageStateUnserialized pkgState\nprivate @android.annotation.NonNull java.util.UUID mDomainSetId\nprivate final @android.annotation.NonNull com.android.server.utils.SnapshotCache<com.android.server.pm.PackageSetting> mSnapshot\nprivate com.android.server.utils.SnapshotCache<com.android.server.pm.PackageSetting> makeCache()\npublic com.android.server.pm.PackageSetting snapshot()\npublic void dumpDebug(android.util.proto.ProtoOutputStream,long,java.util.List<android.content.pm.UserInfo>,com.android.server.pm.permission.LegacyPermissionDataProvider)\npublic com.android.server.pm.PackageSetting setAppId(int)\npublic com.android.server.pm.PackageSetting setCpuAbiOverride(java.lang.String)\npublic com.android.server.pm.PackageSetting setFirstInstallTimeFromReplaced(com.android.server.pm.pkg.PackageStateInternal,int[])\npublic com.android.server.pm.PackageSetting setFirstInstallTime(long,int)\npublic com.android.server.pm.PackageSetting setForceQueryableOverride(boolean)\npublic com.android.server.pm.PackageSetting setInstallerPackage(java.lang.String,int)\npublic com.android.server.pm.PackageSetting setUpdateOwnerPackage(java.lang.String)\npublic com.android.server.pm.PackageSetting setInstallSource(com.android.server.pm.InstallSource)\n com.android.server.pm.PackageSetting removeInstallerPackage(java.lang.String)\npublic com.android.server.pm.PackageSetting setIsOrphaned(boolean)\npublic com.android.server.pm.PackageSetting setKeySetData(com.android.server.pm.PackageKeySetData)\npublic com.android.server.pm.PackageSetting setLastModifiedTime(long)\npublic com.android.server.pm.PackageSetting setLastUpdateTime(long)\npublic com.android.server.pm.PackageSetting setLongVersionCode(long)\npublic boolean setMimeGroup(java.lang.String,android.util.ArraySet<java.lang.String>)\npublic com.android.server.pm.PackageSetting setPkg(com.android.server.pm.pkg.AndroidPackage)\npublic com.android.server.pm.PackageSetting setPkgStateLibraryFiles(java.util.Collection<java.lang.String>)\npublic com.android.server.pm.PackageSetting setPrimaryCpuAbi(java.lang.String)\npublic com.android.server.pm.PackageSetting setSecondaryCpuAbi(java.lang.String)\npublic com.android.server.pm.PackageSetting setSignatures(com.android.server.pm.PackageSignatures)\npublic com.android.server.pm.PackageSetting setVolumeUuid(java.lang.String)\npublic @java.lang.Override boolean isExternalStorage()\npublic com.android.server.pm.PackageSetting setUpdateAvailable(boolean)\npublic void setSharedUserAppId(int)\npublic @java.lang.Override int getSharedUserAppId()\npublic @java.lang.Override boolean hasSharedUser()\npublic @java.lang.Override java.lang.String toString()\nprotected void copyMimeGroups(java.util.Map<java.lang.String,java.util.Set<java.lang.String>>)\npublic void updateFrom(com.android.server.pm.PackageSetting)\n com.android.server.pm.PackageSetting updateMimeGroups(java.util.Set<java.lang.String>)\npublic @java.lang.Deprecated @java.lang.Override com.android.server.pm.permission.LegacyPermissionState getLegacyPermissionState()\npublic com.android.server.pm.PackageSetting setInstallPermissionsFixed(boolean)\npublic boolean isPrivileged()\npublic boolean isOem()\npublic boolean isVendor()\npublic boolean isProduct()\npublic @java.lang.Override boolean isRequiredForSystemUser()\npublic boolean isSystemExt()\npublic boolean isOdm()\npublic boolean isSystem()\npublic android.content.pm.SigningDetails getSigningDetails()\npublic com.android.server.pm.PackageSetting setSigningDetails(android.content.pm.SigningDetails)\npublic void copyPackageSetting(com.android.server.pm.PackageSetting,boolean)\n @com.android.internal.annotations.VisibleForTesting com.android.server.pm.pkg.PackageUserStateImpl modifyUserState(int)\npublic com.android.server.pm.pkg.PackageUserStateImpl getOrCreateUserState(int)\npublic @android.annotation.NonNull com.android.server.pm.pkg.PackageUserStateInternal readUserState(int)\n void setEnabled(int,int,java.lang.String)\n int getEnabled(int)\n void setInstalled(boolean,int)\n boolean getInstalled(int)\n int getInstallReason(int)\n void setInstallReason(int,int)\n int getUninstallReason(int)\n void setUninstallReason(int,int)\n @android.annotation.NonNull android.content.pm.overlay.OverlayPaths getOverlayPaths(int)\n boolean setOverlayPathsForLibrary(java.lang.String,android.content.pm.overlay.OverlayPaths,int)\n boolean isAnyInstalled(int[])\n int[] queryInstalledUsers(int[],boolean)\n long getCeDataInode(int)\n void setCeDataInode(long,int)\n boolean getStopped(int)\n void setStopped(boolean,int)\n boolean getNotLaunched(int)\n void setNotLaunched(boolean,int)\n boolean getHidden(int)\n void setHidden(boolean,int)\n int getDistractionFlags(int)\n void setDistractionFlags(int,int)\npublic boolean getInstantApp(int)\n void setInstantApp(boolean,int)\n boolean getVirtualPreload(int)\n void setVirtualPreload(boolean,int)\n void setUserState(int,long,int,boolean,boolean,boolean,boolean,int,android.util.ArrayMap<java.lang.String,com.android.server.pm.pkg.SuspendParams>,boolean,boolean,java.lang.String,android.util.ArraySet<java.lang.String>,android.util.ArraySet<java.lang.String>,int,int,java.lang.String,java.lang.String,long)\n void setUserState(int,com.android.server.pm.pkg.PackageUserStateInternal)\n com.android.server.utils.WatchedArraySet<java.lang.String> getEnabledComponents(int)\n com.android.server.utils.WatchedArraySet<java.lang.String> getDisabledComponents(int)\n void setEnabledComponents(com.android.server.utils.WatchedArraySet<java.lang.String>,int)\n void setDisabledComponents(com.android.server.utils.WatchedArraySet<java.lang.String>,int)\n void setEnabledComponentsCopy(com.android.server.utils.WatchedArraySet<java.lang.String>,int)\n void setDisabledComponentsCopy(com.android.server.utils.WatchedArraySet<java.lang.String>,int)\n com.android.server.pm.pkg.PackageUserStateImpl modifyUserStateComponents(int,boolean,boolean)\n void addDisabledComponent(java.lang.String,int)\n void addEnabledComponent(java.lang.String,int)\n boolean enableComponentLPw(java.lang.String,int)\n boolean disableComponentLPw(java.lang.String,int)\n boolean restoreComponentLPw(java.lang.String,int)\n int getCurrentEnabledStateLPr(java.lang.String,int)\n void removeUser(int)\npublic int[] getNotInstalledUserIds()\n void writePackageUserPermissionsProto(android.util.proto.ProtoOutputStream,long,java.util.List<android.content.pm.UserInfo>,com.android.server.pm.permission.LegacyPermissionDataProvider)\nprotected void writeUsersInfoToProto(android.util.proto.ProtoOutputStream,long)\n com.android.server.pm.PackageSetting setPath(java.io.File)\npublic @com.android.internal.annotations.VisibleForTesting boolean overrideNonLocalizedLabelAndIcon(android.content.ComponentName,java.lang.String,java.lang.Integer,int)\npublic void resetOverrideComponentLabelIcon(int)\npublic @android.annotation.Nullable java.lang.String getSplashScreenTheme(int)\npublic boolean isIncremental()\npublic boolean isLoading()\npublic com.android.server.pm.PackageSetting setLoadingProgress(float)\npublic com.android.server.pm.PackageSetting setLoadingCompletedTime(long)\npublic @android.annotation.NonNull @java.lang.Override long getVersionCode()\npublic @android.annotation.Nullable @java.lang.Override java.util.Map<java.lang.String,java.util.Set<java.lang.String>> getMimeGroups()\npublic @android.annotation.NonNull @java.lang.Override java.lang.String getPackageName()\npublic @android.annotation.Nullable @java.lang.Override com.android.server.pm.pkg.AndroidPackage getAndroidPackage()\npublic @android.annotation.NonNull android.content.pm.SigningInfo getSigningInfo()\npublic @android.annotation.NonNull @java.lang.Override java.lang.String[] getUsesSdkLibraries()\npublic @android.annotation.NonNull @java.lang.Override long[] getUsesSdkLibrariesVersionsMajor()\npublic @android.annotation.NonNull @java.lang.Override java.lang.String[] getUsesStaticLibraries()\npublic @android.annotation.NonNull @java.lang.Override long[] getUsesStaticLibrariesVersions()\npublic @android.annotation.NonNull @java.lang.Override java.util.List<com.android.server.pm.pkg.SharedLibrary> getSharedLibraryDependencies()\npublic @android.annotation.NonNull com.android.server.pm.PackageSetting addUsesLibraryInfo(android.content.pm.SharedLibraryInfo)\npublic @android.annotation.NonNull @java.lang.Override java.util.List<java.lang.String> getUsesLibraryFiles()\npublic @android.annotation.NonNull com.android.server.pm.PackageSetting addUsesLibraryFile(java.lang.String)\npublic @java.lang.Override boolean isHiddenUntilInstalled()\npublic @android.annotation.NonNull @java.lang.Override long[] getLastPackageUsageTime()\npublic @java.lang.Override boolean isUpdatedSystemApp()\npublic @java.lang.Override boolean isApkInUpdatedApex()\npublic @android.annotation.Nullable @java.lang.Override java.lang.String getApexModuleName()\npublic com.android.server.pm.PackageSetting setDomainSetId(java.util.UUID)\npublic com.android.server.pm.PackageSetting setCategoryOverride(int)\npublic com.android.server.pm.PackageSetting setLegacyNativeLibraryPath(java.lang.String)\npublic com.android.server.pm.PackageSetting setMimeGroups(java.util.Map<java.lang.String,java.util.Set<java.lang.String>>)\npublic com.android.server.pm.PackageSetting setOldCodePaths(java.util.Set<java.lang.String>)\npublic com.android.server.pm.PackageSetting setUsesSdkLibraries(java.lang.String[])\npublic com.android.server.pm.PackageSetting setUsesSdkLibrariesVersionsMajor(long[])\npublic com.android.server.pm.PackageSetting setUsesStaticLibraries(java.lang.String[])\npublic com.android.server.pm.PackageSetting setUsesStaticLibrariesVersions(long[])\npublic com.android.server.pm.PackageSetting setApexModuleName(java.lang.String)\npublic @android.annotation.NonNull @java.lang.Override com.android.server.pm.pkg.PackageStateUnserialized getTransientState()\npublic @android.annotation.NonNull android.util.SparseArray<? extends PackageUserStateInternal> getUserStates()\npublic com.android.server.pm.PackageSetting addMimeTypes(java.lang.String,java.util.Set<java.lang.String>)\npublic @android.annotation.NonNull @java.lang.Override com.android.server.pm.pkg.PackageUserState getStateForUser(android.os.UserHandle)\npublic @android.annotation.Nullable java.lang.String getPrimaryCpuAbi()\npublic @android.annotation.Nullable java.lang.String getSecondaryCpuAbi()\npublic @android.annotation.Nullable @java.lang.Override java.lang.String getSeInfo()\npublic @android.annotation.Nullable java.lang.String getPrimaryCpuAbiLegacy()\npublic @android.annotation.Nullable java.lang.String getSecondaryCpuAbiLegacy()\npublic @android.content.pm.ApplicationInfo.HiddenApiEnforcementPolicy @java.lang.Override int getHiddenApiEnforcementPolicy()\npublic @java.lang.Override boolean isApex()\nclass PackageSetting extends com.android.server.pm.SettingBase implements [com.android.server.pm.pkg.PackageStateInternal]\n@com.android.internal.util.DataClass(genGetters=true, genConstructor=false, genSetters=false, genBuilder=false)")
+ inputSignatures = "private int mSharedUserAppId\nprivate @android.annotation.Nullable java.util.Map<java.lang.String,java.util.Set<java.lang.String>> mimeGroups\nprivate @java.lang.Deprecated @android.annotation.Nullable java.util.Set<java.lang.String> mOldCodePaths\nprivate @android.annotation.Nullable java.lang.String[] usesSdkLibraries\nprivate @android.annotation.Nullable long[] usesSdkLibrariesVersionsMajor\nprivate @android.annotation.Nullable java.lang.String[] usesStaticLibraries\nprivate @android.annotation.Nullable long[] usesStaticLibrariesVersions\nprivate @android.annotation.Nullable @java.lang.Deprecated java.lang.String legacyNativeLibraryPath\nprivate @android.annotation.NonNull java.lang.String mName\nprivate @android.annotation.Nullable java.lang.String mRealName\nprivate int mAppId\nprivate @android.annotation.Nullable com.android.server.pm.parsing.pkg.AndroidPackageInternal pkg\nprivate @android.annotation.NonNull java.io.File mPath\nprivate @android.annotation.NonNull java.lang.String mPathString\nprivate float mLoadingProgress\nprivate long mLoadingCompletedTime\nprivate @android.annotation.Nullable java.lang.String mPrimaryCpuAbi\nprivate @android.annotation.Nullable java.lang.String mSecondaryCpuAbi\nprivate @android.annotation.Nullable java.lang.String mCpuAbiOverride\nprivate long mLastModifiedTime\nprivate long lastUpdateTime\nprivate long versionCode\nprivate @android.annotation.NonNull com.android.server.pm.PackageSignatures signatures\nprivate boolean installPermissionsFixed\nprivate @android.annotation.NonNull com.android.server.pm.PackageKeySetData keySetData\nprivate final @android.annotation.NonNull android.util.SparseArray<com.android.server.pm.pkg.PackageUserStateImpl> mUserStates\nprivate @android.annotation.NonNull com.android.server.pm.InstallSource installSource\nprivate @android.annotation.Nullable java.lang.String volumeUuid\nprivate int categoryOverride\nprivate boolean updateAvailable\nprivate boolean forceQueryableOverride\nprivate final @android.annotation.NonNull com.android.server.pm.pkg.PackageStateUnserialized pkgState\nprivate @android.annotation.NonNull java.util.UUID mDomainSetId\nprivate @android.annotation.Nullable java.lang.String mAppMetadataFilePath\nprivate final @android.annotation.NonNull com.android.server.utils.SnapshotCache<com.android.server.pm.PackageSetting> mSnapshot\nprivate com.android.server.utils.SnapshotCache<com.android.server.pm.PackageSetting> makeCache()\npublic com.android.server.pm.PackageSetting snapshot()\npublic void dumpDebug(android.util.proto.ProtoOutputStream,long,java.util.List<android.content.pm.UserInfo>,com.android.server.pm.permission.LegacyPermissionDataProvider)\npublic com.android.server.pm.PackageSetting setAppId(int)\npublic com.android.server.pm.PackageSetting setCpuAbiOverride(java.lang.String)\npublic com.android.server.pm.PackageSetting setFirstInstallTimeFromReplaced(com.android.server.pm.pkg.PackageStateInternal,int[])\npublic com.android.server.pm.PackageSetting setFirstInstallTime(long,int)\npublic com.android.server.pm.PackageSetting setForceQueryableOverride(boolean)\npublic com.android.server.pm.PackageSetting setInstallerPackage(java.lang.String,int)\npublic com.android.server.pm.PackageSetting setUpdateOwnerPackage(java.lang.String)\npublic com.android.server.pm.PackageSetting setInstallSource(com.android.server.pm.InstallSource)\n com.android.server.pm.PackageSetting removeInstallerPackage(java.lang.String)\npublic com.android.server.pm.PackageSetting setIsOrphaned(boolean)\npublic com.android.server.pm.PackageSetting setKeySetData(com.android.server.pm.PackageKeySetData)\npublic com.android.server.pm.PackageSetting setLastModifiedTime(long)\npublic com.android.server.pm.PackageSetting setLastUpdateTime(long)\npublic com.android.server.pm.PackageSetting setLongVersionCode(long)\npublic boolean setMimeGroup(java.lang.String,android.util.ArraySet<java.lang.String>)\npublic com.android.server.pm.PackageSetting setPkg(com.android.server.pm.pkg.AndroidPackage)\npublic com.android.server.pm.PackageSetting setPkgStateLibraryFiles(java.util.Collection<java.lang.String>)\npublic com.android.server.pm.PackageSetting setPrimaryCpuAbi(java.lang.String)\npublic com.android.server.pm.PackageSetting setSecondaryCpuAbi(java.lang.String)\npublic com.android.server.pm.PackageSetting setSignatures(com.android.server.pm.PackageSignatures)\npublic com.android.server.pm.PackageSetting setVolumeUuid(java.lang.String)\npublic @java.lang.Override boolean isExternalStorage()\npublic com.android.server.pm.PackageSetting setUpdateAvailable(boolean)\npublic void setSharedUserAppId(int)\npublic @java.lang.Override int getSharedUserAppId()\npublic @java.lang.Override boolean hasSharedUser()\npublic @java.lang.Override java.lang.String toString()\nprotected void copyMimeGroups(java.util.Map<java.lang.String,java.util.Set<java.lang.String>>)\npublic void updateFrom(com.android.server.pm.PackageSetting)\n com.android.server.pm.PackageSetting updateMimeGroups(java.util.Set<java.lang.String>)\npublic @java.lang.Deprecated @java.lang.Override com.android.server.pm.permission.LegacyPermissionState getLegacyPermissionState()\npublic com.android.server.pm.PackageSetting setInstallPermissionsFixed(boolean)\npublic boolean isPrivileged()\npublic boolean isOem()\npublic boolean isVendor()\npublic boolean isProduct()\npublic @java.lang.Override boolean isRequiredForSystemUser()\npublic boolean isSystemExt()\npublic boolean isOdm()\npublic boolean isSystem()\npublic android.content.pm.SigningDetails getSigningDetails()\npublic com.android.server.pm.PackageSetting setSigningDetails(android.content.pm.SigningDetails)\npublic void copyPackageSetting(com.android.server.pm.PackageSetting,boolean)\n @com.android.internal.annotations.VisibleForTesting com.android.server.pm.pkg.PackageUserStateImpl modifyUserState(int)\npublic com.android.server.pm.pkg.PackageUserStateImpl getOrCreateUserState(int)\npublic @android.annotation.NonNull com.android.server.pm.pkg.PackageUserStateInternal readUserState(int)\n void setEnabled(int,int,java.lang.String)\n int getEnabled(int)\n void setInstalled(boolean,int)\n boolean getInstalled(int)\n int getInstallReason(int)\n void setInstallReason(int,int)\n int getUninstallReason(int)\n void setUninstallReason(int,int)\n @android.annotation.NonNull android.content.pm.overlay.OverlayPaths getOverlayPaths(int)\n boolean setOverlayPathsForLibrary(java.lang.String,android.content.pm.overlay.OverlayPaths,int)\n boolean isAnyInstalled(int[])\n int[] queryInstalledUsers(int[],boolean)\n long getCeDataInode(int)\n void setCeDataInode(long,int)\n boolean getStopped(int)\n void setStopped(boolean,int)\n boolean getNotLaunched(int)\n void setNotLaunched(boolean,int)\n boolean getHidden(int)\n void setHidden(boolean,int)\n int getDistractionFlags(int)\n void setDistractionFlags(int,int)\npublic boolean getInstantApp(int)\n void setInstantApp(boolean,int)\n boolean getVirtualPreload(int)\n void setVirtualPreload(boolean,int)\n void setUserState(int,long,int,boolean,boolean,boolean,boolean,int,android.util.ArrayMap<java.lang.String,com.android.server.pm.pkg.SuspendParams>,boolean,boolean,java.lang.String,android.util.ArraySet<java.lang.String>,android.util.ArraySet<java.lang.String>,int,int,java.lang.String,java.lang.String,long)\n void setUserState(int,com.android.server.pm.pkg.PackageUserStateInternal)\n com.android.server.utils.WatchedArraySet<java.lang.String> getEnabledComponents(int)\n com.android.server.utils.WatchedArraySet<java.lang.String> getDisabledComponents(int)\n void setEnabledComponents(com.android.server.utils.WatchedArraySet<java.lang.String>,int)\n void setDisabledComponents(com.android.server.utils.WatchedArraySet<java.lang.String>,int)\n void setEnabledComponentsCopy(com.android.server.utils.WatchedArraySet<java.lang.String>,int)\n void setDisabledComponentsCopy(com.android.server.utils.WatchedArraySet<java.lang.String>,int)\n com.android.server.pm.pkg.PackageUserStateImpl modifyUserStateComponents(int,boolean,boolean)\n void addDisabledComponent(java.lang.String,int)\n void addEnabledComponent(java.lang.String,int)\n boolean enableComponentLPw(java.lang.String,int)\n boolean disableComponentLPw(java.lang.String,int)\n boolean restoreComponentLPw(java.lang.String,int)\n int getCurrentEnabledStateLPr(java.lang.String,int)\n void removeUser(int)\npublic int[] getNotInstalledUserIds()\n void writePackageUserPermissionsProto(android.util.proto.ProtoOutputStream,long,java.util.List<android.content.pm.UserInfo>,com.android.server.pm.permission.LegacyPermissionDataProvider)\nprotected void writeUsersInfoToProto(android.util.proto.ProtoOutputStream,long)\n com.android.server.pm.PackageSetting setPath(java.io.File)\npublic @com.android.internal.annotations.VisibleForTesting boolean overrideNonLocalizedLabelAndIcon(android.content.ComponentName,java.lang.String,java.lang.Integer,int)\npublic void resetOverrideComponentLabelIcon(int)\npublic @android.annotation.Nullable java.lang.String getSplashScreenTheme(int)\npublic boolean isIncremental()\npublic boolean isLoading()\npublic com.android.server.pm.PackageSetting setLoadingProgress(float)\npublic com.android.server.pm.PackageSetting setLoadingCompletedTime(long)\npublic com.android.server.pm.PackageSetting setAppMetadataFilePath(java.lang.String)\npublic @android.annotation.NonNull @java.lang.Override long getVersionCode()\npublic @android.annotation.Nullable @java.lang.Override java.util.Map<java.lang.String,java.util.Set<java.lang.String>> getMimeGroups()\npublic @android.annotation.NonNull @java.lang.Override java.lang.String getPackageName()\npublic @android.annotation.Nullable @java.lang.Override com.android.server.pm.pkg.AndroidPackage getAndroidPackage()\npublic @android.annotation.NonNull android.content.pm.SigningInfo getSigningInfo()\npublic @android.annotation.NonNull @java.lang.Override java.lang.String[] getUsesSdkLibraries()\npublic @android.annotation.NonNull @java.lang.Override long[] getUsesSdkLibrariesVersionsMajor()\npublic @android.annotation.NonNull @java.lang.Override java.lang.String[] getUsesStaticLibraries()\npublic @android.annotation.NonNull @java.lang.Override long[] getUsesStaticLibrariesVersions()\npublic @android.annotation.NonNull @java.lang.Override java.util.List<com.android.server.pm.pkg.SharedLibrary> getSharedLibraryDependencies()\npublic @android.annotation.NonNull com.android.server.pm.PackageSetting addUsesLibraryInfo(android.content.pm.SharedLibraryInfo)\npublic @android.annotation.NonNull @java.lang.Override java.util.List<java.lang.String> getUsesLibraryFiles()\npublic @android.annotation.NonNull com.android.server.pm.PackageSetting addUsesLibraryFile(java.lang.String)\npublic @java.lang.Override boolean isHiddenUntilInstalled()\npublic @android.annotation.NonNull @java.lang.Override long[] getLastPackageUsageTime()\npublic @java.lang.Override boolean isUpdatedSystemApp()\npublic @java.lang.Override boolean isApkInUpdatedApex()\npublic @android.annotation.Nullable @java.lang.Override java.lang.String getApexModuleName()\npublic com.android.server.pm.PackageSetting setDomainSetId(java.util.UUID)\npublic com.android.server.pm.PackageSetting setCategoryOverride(int)\npublic com.android.server.pm.PackageSetting setLegacyNativeLibraryPath(java.lang.String)\npublic com.android.server.pm.PackageSetting setMimeGroups(java.util.Map<java.lang.String,java.util.Set<java.lang.String>>)\npublic com.android.server.pm.PackageSetting setOldCodePaths(java.util.Set<java.lang.String>)\npublic com.android.server.pm.PackageSetting setUsesSdkLibraries(java.lang.String[])\npublic com.android.server.pm.PackageSetting setUsesSdkLibrariesVersionsMajor(long[])\npublic com.android.server.pm.PackageSetting setUsesStaticLibraries(java.lang.String[])\npublic com.android.server.pm.PackageSetting setUsesStaticLibrariesVersions(long[])\npublic com.android.server.pm.PackageSetting setApexModuleName(java.lang.String)\npublic @android.annotation.NonNull @java.lang.Override com.android.server.pm.pkg.PackageStateUnserialized getTransientState()\npublic @android.annotation.NonNull android.util.SparseArray<? extends PackageUserStateInternal> getUserStates()\npublic com.android.server.pm.PackageSetting addMimeTypes(java.lang.String,java.util.Set<java.lang.String>)\npublic @android.annotation.NonNull @java.lang.Override com.android.server.pm.pkg.PackageUserState getStateForUser(android.os.UserHandle)\npublic @android.annotation.Nullable java.lang.String getPrimaryCpuAbi()\npublic @android.annotation.Nullable java.lang.String getSecondaryCpuAbi()\npublic @android.annotation.Nullable @java.lang.Override java.lang.String getSeInfo()\npublic @android.annotation.Nullable java.lang.String getPrimaryCpuAbiLegacy()\npublic @android.annotation.Nullable java.lang.String getSecondaryCpuAbiLegacy()\npublic @android.content.pm.ApplicationInfo.HiddenApiEnforcementPolicy @java.lang.Override int getHiddenApiEnforcementPolicy()\npublic @java.lang.Override boolean isApex()\nclass PackageSetting extends com.android.server.pm.SettingBase implements [com.android.server.pm.pkg.PackageStateInternal]\n@com.android.internal.util.DataClass(genGetters=true, genConstructor=false, genSetters=false, genBuilder=false)")
@Deprecated
private void __metadata() {}
diff --git a/services/core/java/com/android/server/pm/Settings.java b/services/core/java/com/android/server/pm/Settings.java
index 417ba07..e8f89d3 100644
--- a/services/core/java/com/android/server/pm/Settings.java
+++ b/services/core/java/com/android/server/pm/Settings.java
@@ -2905,6 +2905,11 @@
serializer.attributeLongHex(null, "loadingCompletedTime",
pkg.getLoadingCompletedTime());
+ if (pkg.getAppMetadataFilePath() != null) {
+ serializer.attribute(null, "appMetadataFilePath",
+ pkg.getAppMetadataFilePath());
+ }
+
writeUsesSdkLibLPw(serializer, pkg.getUsesSdkLibraries(),
pkg.getUsesSdkLibrariesVersionsMajor());
@@ -2994,6 +2999,10 @@
serializer.attribute(null, "domainSetId", pkg.getDomainSetId().toString());
+ if (pkg.getAppMetadataFilePath() != null) {
+ serializer.attribute(null, "appMetadataFilePath", pkg.getAppMetadataFilePath());
+ }
+
writeUsesSdkLibLPw(serializer, pkg.getUsesSdkLibraries(),
pkg.getUsesSdkLibrariesVersionsMajor());
@@ -3762,6 +3771,7 @@
float loadingProgress = 0;
long loadingCompletedTime = 0;
UUID domainSetId;
+ String appMetadataFilePath = null;
try {
name = parser.getAttributeValue(null, ATTR_NAME);
realName = parser.getAttributeValue(null, "realName");
@@ -3799,6 +3809,7 @@
volumeUuid = parser.getAttributeValue(null, "volumeUuid");
categoryHint = parser.getAttributeInt(null, "categoryHint",
ApplicationInfo.CATEGORY_UNDEFINED);
+ appMetadataFilePath = parser.getAttributeValue(null, "appMetadataFilePath");
String domainSetIdString = parser.getAttributeValue(null, "domainSetId");
@@ -3942,7 +3953,8 @@
.setUpdateAvailable(updateAvailable)
.setForceQueryableOverride(installedForceQueryable)
.setLoadingProgress(loadingProgress)
- .setLoadingCompletedTime(loadingCompletedTime);
+ .setLoadingCompletedTime(loadingCompletedTime)
+ .setAppMetadataFilePath(appMetadataFilePath);
// Handle legacy string here for single-user mode
final String enabledStr = parser.getAttributeValue(null, ATTR_ENABLED);
if (enabledStr != null) {
diff --git a/services/core/java/com/android/server/pm/pkg/PackageStateInternal.java b/services/core/java/com/android/server/pm/pkg/PackageStateInternal.java
index 3a0ff27..f839648 100644
--- a/services/core/java/com/android/server/pm/pkg/PackageStateInternal.java
+++ b/services/core/java/com/android/server/pm/pkg/PackageStateInternal.java
@@ -105,4 +105,10 @@
*/
@Nullable
String getSecondaryCpuAbiLegacy();
+
+ /**
+ * @return the app metadata file path.
+ */
+ @Nullable
+ String getAppMetadataFilePath();
}
diff --git a/services/core/java/com/android/server/stats/pull/StatsPullAtomService.java b/services/core/java/com/android/server/stats/pull/StatsPullAtomService.java
index 433d807..8640377 100644
--- a/services/core/java/com/android/server/stats/pull/StatsPullAtomService.java
+++ b/services/core/java/com/android/server/stats/pull/StatsPullAtomService.java
@@ -21,6 +21,7 @@
import static android.content.pm.PackageInfo.REQUESTED_PERMISSION_GRANTED;
import static android.content.pm.PermissionInfo.PROTECTION_DANGEROUS;
import static android.hardware.display.HdrConversionMode.HDR_CONVERSION_PASSTHROUGH;
+import static android.hardware.display.HdrConversionMode.HDR_CONVERSION_UNSUPPORTED;
import static android.hardware.graphics.common.Hdr.DOLBY_VISION;
import static android.net.NetworkCapabilities.TRANSPORT_CELLULAR;
import static android.net.NetworkCapabilities.TRANSPORT_ETHERNET;
@@ -4721,9 +4722,12 @@
boolean userDisabledHdrConversion = hdrConversionMode == HDR_CONVERSION_PASSTHROUGH;
int forceHdrFormat = preferredHdrType == HDR_TYPE_INVALID ? 0 : preferredHdrType;
boolean hasDolbyVisionIssue = hasDolbyVisionIssue(display);
+ byte[] hdrOutputTypes = toBytes(displayManager.getSupportedHdrOutputTypes());
+ boolean hdrOutputControlSupported = hdrConversionMode != HDR_CONVERSION_UNSUPPORTED;
- pulledData.add(FrameworkStatsLog.buildStatsEvent(atomTag,
- new byte[0], userDisabledHdrConversion, forceHdrFormat, hasDolbyVisionIssue));
+ pulledData.add(FrameworkStatsLog.buildStatsEvent(atomTag, hdrOutputTypes,
+ userDisabledHdrConversion, forceHdrFormat, hasDolbyVisionIssue,
+ hdrOutputControlSupported));
return StatsManager.PULL_SUCCESS;
}
diff --git a/services/core/java/com/android/server/wm/ActivityTaskManagerService.java b/services/core/java/com/android/server/wm/ActivityTaskManagerService.java
index 431f82a..401c16f 100644
--- a/services/core/java/com/android/server/wm/ActivityTaskManagerService.java
+++ b/services/core/java/com/android/server/wm/ActivityTaskManagerService.java
@@ -5356,7 +5356,7 @@
if (app != null && app.getPid() > 0) {
ArrayList<Integer> firstPids = new ArrayList<Integer>();
firstPids.add(app.getPid());
- dumpStackTraces(tracesFile.getAbsolutePath(), firstPids, null, null, null);
+ dumpStackTraces(tracesFile.getAbsolutePath(), firstPids, null, null, null, null);
}
File lastTracesFile = null;
diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java
index e5a49c3..d1618e9 100644
--- a/services/core/java/com/android/server/wm/WindowState.java
+++ b/services/core/java/com/android/server/wm/WindowState.java
@@ -5330,6 +5330,17 @@
&& imeTarget.compareTo(this) <= 0;
return inTokenWithAndAboveImeTarget;
}
+
+ // The condition is for the system dialog not belonging to any Activity.
+ // (^FLAG_NOT_FOCUSABLE & FLAG_ALT_FOCUSABLE_IM) means the dialog is still focusable but
+ // should be placed above the IME window.
+ if ((mAttrs.flags & (FLAG_NOT_FOCUSABLE | FLAG_ALT_FOCUSABLE_IM))
+ == FLAG_ALT_FOCUSABLE_IM && isTrustedOverlay() && canAddInternalSystemWindow()) {
+ // Check the current IME target so that it does not lift this window above the IME if
+ // the Z-order of the current IME layering target is greater than it.
+ final WindowState imeTarget = getImeLayeringTarget();
+ return imeTarget != null && imeTarget != this && imeTarget.compareTo(this) <= 0;
+ }
return false;
}
diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
index 5cad4e2..8557348 100644
--- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
+++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
@@ -7711,30 +7711,72 @@
private void updateTelephonyCrossProfileIntentFilters(int parentUserId, int profileUserId,
boolean enableWorkTelephony) {
try {
- String packageName = mContext.getOpPackageName();
- if (enableWorkTelephony) {
- // Reset call/sms cross profile intent filters to be handled by managed profile.
- for (DefaultCrossProfileIntentFilter filter :
- DefaultCrossProfileIntentFiltersUtils
- .getDefaultManagedProfileTelephonyFilters()) {
- IntentFilter intentFilter = filter.filter.getIntentFilter();
- if (!mIPackageManager.removeCrossProfileIntentFilter(intentFilter, packageName,
- profileUserId, parentUserId, filter.flags)) {
- Slogf.w(LOG_TAG,
- "Failed to remove cross-profile intent filter: " + intentFilter);
- }
-
- mIPackageManager.addCrossProfileIntentFilter(intentFilter, packageName,
- parentUserId, profileUserId, PackageManager.SKIP_CURRENT_PROFILE);
+ // This should only occur when managed profile is being removed.
+ if (!enableWorkTelephony && profileUserId == UserHandle.USER_NULL) {
+ mIPackageManager.clearCrossProfileIntentFilters(parentUserId,
+ mContext.getPackageName());
+ return;
+ }
+ for (DefaultCrossProfileIntentFilter filter :
+ DefaultCrossProfileIntentFiltersUtils
+ .getDefaultCrossProfileTelephonyIntentFilters(!enableWorkTelephony)) {
+ if (removeCrossProfileIntentFilter(filter, parentUserId, profileUserId)) {
+ Slogf.w(LOG_TAG,
+ "Failed to remove cross-profile intent filter: "
+ + filter.filter.getIntentFilter() + ", enableWorkTelephony: "
+ + enableWorkTelephony);
}
- } else {
- mIPackageManager.clearCrossProfileIntentFilters(parentUserId, packageName);
+ }
+ for (DefaultCrossProfileIntentFilter filter :
+ DefaultCrossProfileIntentFiltersUtils
+ .getDefaultCrossProfileTelephonyIntentFilters(enableWorkTelephony)) {
+ addCrossProfileIntentFilter(filter, parentUserId, profileUserId);
}
} catch (RemoteException re) {
Slogf.wtf(LOG_TAG, "Error updating telephony cross profile intent filters", re);
}
}
+ void addCrossProfileIntentFilter(DefaultCrossProfileIntentFilter filter, int parentUserId,
+ int profileUserId)
+ throws RemoteException {
+ if (filter.direction == DefaultCrossProfileIntentFilter.Direction.TO_PROFILE) {
+ mIPackageManager.addCrossProfileIntentFilter(
+ filter.filter.getIntentFilter(),
+ mContext.getOpPackageName(),
+ parentUserId,
+ profileUserId,
+ filter.flags);
+ } else {
+ mIPackageManager.addCrossProfileIntentFilter(
+ filter.filter.getIntentFilter(),
+ mContext.getOpPackageName(),
+ profileUserId,
+ parentUserId,
+ filter.flags);
+ }
+ }
+
+ boolean removeCrossProfileIntentFilter(DefaultCrossProfileIntentFilter filter, int parentUserId,
+ int profileUserId)
+ throws RemoteException {
+ if (filter.direction == DefaultCrossProfileIntentFilter.Direction.TO_PROFILE) {
+ return mIPackageManager.removeCrossProfileIntentFilter(
+ filter.filter.getIntentFilter(),
+ mContext.getOpPackageName(),
+ parentUserId,
+ profileUserId,
+ filter.flags);
+ } else {
+ return mIPackageManager.removeCrossProfileIntentFilter(
+ filter.filter.getIntentFilter(),
+ mContext.getOpPackageName(),
+ profileUserId,
+ parentUserId,
+ filter.flags);
+ }
+ }
+
/**
* @param factoryReset null: legacy behaviour, false: attempt to remove user, true: attempt to
* factory reset
@@ -23346,14 +23388,16 @@
applyManagedSubscriptionsPolicyIfRequired();
int policyType = getManagedSubscriptionsPolicy().getPolicyType();
- if (policyType == ManagedSubscriptionsPolicy.TYPE_ALL_MANAGED_SUBSCRIPTIONS) {
- final long id = mInjector.binderClearCallingIdentity();
- try {
+ final long id = mInjector.binderClearCallingIdentity();
+ try {
+ if (policyType == ManagedSubscriptionsPolicy.TYPE_ALL_MANAGED_SUBSCRIPTIONS) {
installOemDefaultDialerAndSmsApp(caller.getUserId());
updateTelephonyCrossProfileIntentFilters(parentUserId, caller.getUserId(), true);
- } finally {
- mInjector.binderRestoreCallingIdentity(id);
+ } else if (policyType == ManagedSubscriptionsPolicy.TYPE_ALL_PERSONAL_SUBSCRIPTIONS) {
+ updateTelephonyCrossProfileIntentFilters(parentUserId, caller.getUserId(), false);
}
+ } finally {
+ mInjector.binderRestoreCallingIdentity(id);
}
}
diff --git a/services/tests/mockingservicestests/src/com/android/server/pm/MockSystem.kt b/services/tests/mockingservicestests/src/com/android/server/pm/MockSystem.kt
index 06ba5dd..931a2bf 100644
--- a/services/tests/mockingservicestests/src/com/android/server/pm/MockSystem.kt
+++ b/services/tests/mockingservicestests/src/com/android/server/pm/MockSystem.kt
@@ -308,6 +308,7 @@
whenever(mocks.systemConfig.sharedLibraries).thenReturn(DEFAULT_SHARED_LIBRARIES_LIST)
whenever(mocks.systemConfig.defaultVrComponents).thenReturn(ArraySet())
whenever(mocks.systemConfig.hiddenApiWhitelistedApps).thenReturn(ArraySet())
+ whenever(mocks.systemConfig.appMetadataFilePaths).thenReturn(ArrayMap())
wheneverStatic { SystemProperties.set(anyString(), anyString()) }.thenDoNothing()
wheneverStatic { SystemProperties.getBoolean("fw.free_cache_v2", true) }.thenReturn(true)
wheneverStatic { Environment.getApexDirectory() }.thenReturn(apexDirectory)
diff --git a/services/tests/servicestests/src/com/android/server/am/AnrHelperTest.java b/services/tests/servicestests/src/com/android/server/am/AnrHelperTest.java
index 9578993..acdfee9 100644
--- a/services/tests/servicestests/src/com/android/server/am/AnrHelperTest.java
+++ b/services/tests/servicestests/src/com/android/server/am/AnrHelperTest.java
@@ -26,6 +26,7 @@
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.doAnswer;
+import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.timeout;
import static org.mockito.Mockito.verify;
@@ -48,8 +49,10 @@
import java.io.File;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
+import java.util.concurrent.Callable;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
/**
@@ -63,8 +66,9 @@
private AnrHelper mAnrHelper;
private ProcessRecord mAnrApp;
- private ExecutorService mExecutorService;
+ private ExecutorService mAuxExecutorService;
+ private Future<File> mEarlyDumpFuture;
@Rule
public ServiceThreadRule mServiceThreadRule = new ServiceThreadRule();
@@ -91,9 +95,12 @@
return mServiceThreadRule.getThread().getThreadHandler();
}
}, mServiceThreadRule.getThread());
- mExecutorService = mock(ExecutorService.class);
+ mAuxExecutorService = mock(ExecutorService.class);
+ final ExecutorService earlyDumpExecutorService = mock(ExecutorService.class);
+ mEarlyDumpFuture = mock(Future.class);
+ doReturn(mEarlyDumpFuture).when(earlyDumpExecutorService).submit(any(Callable.class));
- mAnrHelper = new AnrHelper(service, mExecutorService);
+ mAnrHelper = new AnrHelper(service, mAuxExecutorService, earlyDumpExecutorService);
});
}
@@ -125,8 +132,8 @@
verify(mAnrApp.mErrorState, timeout(TIMEOUT_MS)).appNotResponding(
eq(activityShortComponentName), eq(appInfo), eq(parentShortComponentName),
- eq(parentProcess), eq(aboveSystem), eq(timeoutRecord), eq(mExecutorService),
- eq(false) /* onlyDumpSelf */, eq(false) /*isContinuousAnr*/);
+ eq(parentProcess), eq(aboveSystem), eq(timeoutRecord), eq(mAuxExecutorService),
+ eq(false) /* onlyDumpSelf */, eq(false) /*isContinuousAnr*/, eq(mEarlyDumpFuture));
}
@Test
@@ -139,7 +146,7 @@
processingLatch.await();
return null;
}).when(mAnrApp.mErrorState).appNotResponding(anyString(), any(), any(), any(),
- anyBoolean(), any(), any(), anyBoolean(), anyBoolean());
+ anyBoolean(), any(), any(), anyBoolean(), anyBoolean(), any());
final ApplicationInfo appInfo = new ApplicationInfo();
final TimeoutRecord timeoutRecord = TimeoutRecord.forInputDispatchWindowUnresponsive(
"annotation");
@@ -162,7 +169,7 @@
processingLatch.countDown();
// There is only one ANR reported.
verify(mAnrApp.mErrorState, timeout(TIMEOUT_MS).only()).appNotResponding(
- anyString(), any(), any(), any(), anyBoolean(), any(), eq(mExecutorService),
- anyBoolean(), anyBoolean());
+ anyString(), any(), any(), any(), anyBoolean(), any(), eq(mAuxExecutorService),
+ anyBoolean(), anyBoolean(), any());
}
}
diff --git a/services/tests/servicestests/src/com/android/server/am/ProcessRecordTests.java b/services/tests/servicestests/src/com/android/server/am/ProcessRecordTests.java
index 6350e22..d92b9f8 100644
--- a/services/tests/servicestests/src/com/android/server/am/ProcessRecordTests.java
+++ b/services/tests/servicestests/src/com/android/server/am/ProcessRecordTests.java
@@ -203,6 +203,6 @@
processErrorState.appNotResponding(null /* activityShortComponentName */, null /* aInfo */,
null /* parentShortComponentName */, null /* parentProcess */,
false /* aboveSystem */, timeoutRecord, mExecutorService, false /* onlyDumpSelf */,
- false /*isContinuousAnr*/);
+ false /*isContinuousAnr*/, null);
}
}
diff --git a/services/tests/servicestests/src/com/android/server/locksettings/BaseLockSettingsServiceTests.java b/services/tests/servicestests/src/com/android/server/locksettings/BaseLockSettingsServiceTests.java
index ad63da5..e960e99 100644
--- a/services/tests/servicestests/src/com/android/server/locksettings/BaseLockSettingsServiceTests.java
+++ b/services/tests/servicestests/src/com/android/server/locksettings/BaseLockSettingsServiceTests.java
@@ -16,9 +16,6 @@
package com.android.server.locksettings;
-import static android.app.admin.DevicePolicyManager.DEPRECATE_USERMANAGERINTERNAL_DEVICEPOLICY_FLAG;
-import static android.provider.DeviceConfig.NAMESPACE_DEVICE_POLICY_MANAGER;
-
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.any;
@@ -50,7 +47,6 @@
import android.os.UserManager;
import android.os.storage.IStorageManager;
import android.os.storage.StorageManager;
-import android.provider.DeviceConfig;
import android.provider.Settings;
import android.security.KeyStore;
@@ -235,9 +231,6 @@
// Adding a fake Device Owner app which will enable escrow token support in LSS.
when(mDevicePolicyManager.getDeviceOwnerComponentOnAnyUser()).thenReturn(
new ComponentName("com.dummy.package", ".FakeDeviceOwner"));
- // TODO(b/258213147): Remove
- DeviceConfig.setProperty(NAMESPACE_DEVICE_POLICY_MANAGER,
- DEPRECATE_USERMANAGERINTERNAL_DEVICEPOLICY_FLAG, "true", /* makeDefault= */ false);
when(mUserManagerInternal.isDeviceManaged()).thenReturn(true);
when(mDeviceStateCache.isUserOrganizationManaged(anyInt())).thenReturn(true);
when(mDeviceStateCache.isDeviceProvisioned()).thenReturn(true);
diff --git a/services/tests/servicestests/src/com/android/server/locksettings/LockSettingsStorageTestable.java b/services/tests/servicestests/src/com/android/server/locksettings/LockSettingsStorageTestable.java
index 3f3b8d7..36dc6c5 100644
--- a/services/tests/servicestests/src/com/android/server/locksettings/LockSettingsStorageTestable.java
+++ b/services/tests/servicestests/src/com/android/server/locksettings/LockSettingsStorageTestable.java
@@ -87,7 +87,10 @@
PersistentDataBlockManagerInternal getPersistentDataBlockManager() {
return mPersistentDataBlockManager;
}
-
+ @Override
+ public boolean isAutoPinConfirmSettingEnabled(int userId) {
+ return true;
+ }
private File remapToStorageDir(File origPath) {
File mappedPath = new File(mStorageDir, origPath.toString());
mappedPath.getParentFile().mkdirs();
diff --git a/services/tests/servicestests/src/com/android/server/locksettings/MockSyntheticPasswordManager.java b/services/tests/servicestests/src/com/android/server/locksettings/MockSyntheticPasswordManager.java
index e8ef398..a48d2cc 100644
--- a/services/tests/servicestests/src/com/android/server/locksettings/MockSyntheticPasswordManager.java
+++ b/services/tests/servicestests/src/com/android/server/locksettings/MockSyntheticPasswordManager.java
@@ -113,6 +113,11 @@
}
@Override
+ public boolean isAutoPinConfirmationFeatureAvailable() {
+ return true;
+ }
+
+ @Override
protected IWeaver getWeaverHidlService() throws RemoteException {
return mWeaverService;
}
diff --git a/services/tests/servicestests/src/com/android/server/locksettings/SyntheticPasswordTests.java b/services/tests/servicestests/src/com/android/server/locksettings/SyntheticPasswordTests.java
index bdc5be6..bfb6b0f1 100644
--- a/services/tests/servicestests/src/com/android/server/locksettings/SyntheticPasswordTests.java
+++ b/services/tests/servicestests/src/com/android/server/locksettings/SyntheticPasswordTests.java
@@ -607,6 +607,24 @@
}
@Test
+ public void testStorePinLengthOnDisk() {
+ int userId = 1;
+ LockscreenCredential lockscreenCredentialPin = LockscreenCredential.createPin("123456");
+ MockSyntheticPasswordManager manager = new MockSyntheticPasswordManager(mContext, mStorage,
+ mGateKeeperService, mUserManager, mPasswordSlotManager);
+ SyntheticPassword sp = manager.newSyntheticPassword(userId);
+ long protectorId = manager.createLskfBasedProtector(mGateKeeperService,
+ lockscreenCredentialPin, sp,
+ userId);
+ PasswordMetrics passwordMetrics =
+ PasswordMetrics.computeForCredential(lockscreenCredentialPin);
+ boolean result = manager.refreshPinLengthOnDisk(passwordMetrics, protectorId, userId);
+
+ assertEquals(manager.getPinLength(protectorId, userId), lockscreenCredentialPin.size());
+ assertTrue(result);
+ }
+
+ @Test
public void testPasswordDataV2VersionCredentialTypePin_deserialize() {
// Test that we can deserialize existing PasswordData and don't inadvertently change the
// wire format.
diff --git a/services/tests/wmtests/src/com/android/server/wm/WindowStateTests.java b/services/tests/wmtests/src/com/android/server/wm/WindowStateTests.java
index fdb3502..766e74c 100644
--- a/services/tests/wmtests/src/com/android/server/wm/WindowStateTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/WindowStateTests.java
@@ -43,6 +43,8 @@
import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_SUB_PANEL;
import static android.view.WindowManager.LayoutParams.TYPE_BASE_APPLICATION;
import static android.view.WindowManager.LayoutParams.TYPE_INPUT_METHOD;
+import static android.view.WindowManager.LayoutParams.TYPE_NOTIFICATION_SHADE;
+import static android.view.WindowManager.LayoutParams.TYPE_SECURE_SYSTEM_OVERLAY;
import static android.view.WindowManager.LayoutParams.TYPE_TOAST;
import static com.android.dx.mockito.inline.extended.ExtendedMockito.doReturn;
@@ -969,6 +971,33 @@
assertFalse(sameTokenWindow.needsRelativeLayeringToIme());
}
+ @UseTestDisplay(addWindows = {W_ACTIVITY, W_INPUT_METHOD})
+ @Test
+ public void testNeedsRelativeLayeringToIme_systemDialog() {
+ WindowState systemDialogWindow = createWindow(null, TYPE_SECURE_SYSTEM_OVERLAY,
+ mDisplayContent,
+ "SystemDialog", true);
+ mDisplayContent.setImeLayeringTarget(mAppWindow);
+ mAppWindow.getRootTask().setWindowingMode(WINDOWING_MODE_MULTI_WINDOW);
+ makeWindowVisible(mImeWindow);
+ systemDialogWindow.mAttrs.flags |= FLAG_ALT_FOCUSABLE_IM;
+ assertTrue(systemDialogWindow.needsRelativeLayeringToIme());
+ }
+
+ @UseTestDisplay(addWindows = {W_INPUT_METHOD})
+ @Test
+ public void testNeedsRelativeLayeringToIme_notificationShadeShouldNotHideSystemDialog() {
+ WindowState systemDialogWindow = createWindow(null, TYPE_SECURE_SYSTEM_OVERLAY,
+ mDisplayContent,
+ "SystemDialog", true);
+ mDisplayContent.setImeLayeringTarget(systemDialogWindow);
+ makeWindowVisible(mImeWindow);
+ WindowState notificationShade = createWindow(null, TYPE_NOTIFICATION_SHADE,
+ mDisplayContent, "NotificationShade", true);
+ notificationShade.mAttrs.flags |= FLAG_ALT_FOCUSABLE_IM;
+ assertFalse(notificationShade.needsRelativeLayeringToIme());
+ }
+
@Test
public void testSetFreezeInsetsState() {
final WindowState app = createWindow(null, TYPE_APPLICATION, "app");
diff --git a/services/tests/wmtests/src/com/android/server/wm/ZOrderingTests.java b/services/tests/wmtests/src/com/android/server/wm/ZOrderingTests.java
index 74ba45c..3ec6f42 100644
--- a/services/tests/wmtests/src/com/android/server/wm/ZOrderingTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/ZOrderingTests.java
@@ -22,6 +22,7 @@
import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;
import static android.app.WindowConfiguration.WINDOWING_MODE_MULTI_WINDOW;
import static android.app.WindowConfiguration.WINDOWING_MODE_PINNED;
+import static android.view.WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM;
import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION;
import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_ABOVE_SUB_PANEL;
import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_ATTACHED_DIALOG;
@@ -31,6 +32,7 @@
import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_SUB_PANEL;
import static android.view.WindowManager.LayoutParams.TYPE_BASE_APPLICATION;
import static android.view.WindowManager.LayoutParams.TYPE_NAVIGATION_BAR_PANEL;
+import static android.view.WindowManager.LayoutParams.TYPE_SECURE_SYSTEM_OVERLAY;
import static android.view.WindowManager.LayoutParams.TYPE_STATUS_BAR_ADDITIONAL;
import static android.view.WindowManager.LayoutParams.TYPE_STATUS_BAR_SUB_PANEL;
import static android.view.WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY;
@@ -553,6 +555,30 @@
}
@Test
+ public void testSystemDialogWindow_expectHigherThanIme_inMultiWindow() {
+ // Simulate the app window is in multi windowing mode and being IME target
+ mAppWindow.getConfiguration().windowConfiguration.setWindowingMode(
+ WINDOWING_MODE_MULTI_WINDOW);
+ mDisplayContent.setImeLayeringTarget(mAppWindow);
+ mDisplayContent.setImeInputTarget(mAppWindow);
+ makeWindowVisible(mImeWindow);
+
+ // Create a popupWindow
+ final WindowState systemDialogWindow = createWindow(null, TYPE_SECURE_SYSTEM_OVERLAY,
+ mDisplayContent, "SystemDialog", true);
+ systemDialogWindow.mAttrs.flags |= FLAG_ALT_FOCUSABLE_IM;
+ spyOn(systemDialogWindow);
+
+ mDisplayContent.assignChildLayers(mTransaction);
+
+ // Verify the surface layer of the popupWindow should higher than IME
+ verify(systemDialogWindow).needsRelativeLayeringToIme();
+ assertThat(systemDialogWindow.needsRelativeLayeringToIme()).isTrue();
+ assertZOrderGreaterThan(mTransaction, systemDialogWindow.getSurfaceControl(),
+ mDisplayContent.getImeContainer().getSurfaceControl());
+ }
+
+ @Test
public void testImeScreenshotLayer() {
final Task task = createTask(mDisplayContent);
final WindowState imeAppTarget = createAppWindow(task, TYPE_APPLICATION, "imeAppTarget");
diff --git a/services/voiceinteraction/java/com/android/server/soundtrigger/SoundTriggerService.java b/services/voiceinteraction/java/com/android/server/soundtrigger/SoundTriggerService.java
index 1bbea89..790be8d 100644
--- a/services/voiceinteraction/java/com/android/server/soundtrigger/SoundTriggerService.java
+++ b/services/voiceinteraction/java/com/android/server/soundtrigger/SoundTriggerService.java
@@ -73,7 +73,6 @@
import android.os.Handler;
import android.os.IBinder;
import android.os.Looper;
-import android.os.Parcel;
import android.os.ParcelUuid;
import android.os.PowerManager;
import android.os.RemoteException;
@@ -342,21 +341,6 @@
}
@Override
- public boolean onTransact(int code, Parcel data, Parcel reply, int flags)
- throws RemoteException {
- try {
- return super.onTransact(code, data, reply, flags);
- } catch (RuntimeException e) {
- // The activity manager only throws security exceptions, so let's
- // log all others.
- if (!(e instanceof SecurityException)) {
- Slog.wtf(TAG, "SoundTriggerService Crash", e);
- }
- throw e;
- }
- }
-
- @Override
public int startRecognition(GenericSoundModel soundModel,
IRecognitionStatusCallback callback,
RecognitionConfig config, boolean runInBatterySaverMode) {
diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppFromLockNotificationCold.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppFromLockNotificationCold.kt
index 862efbd..b1a267a 100644
--- a/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppFromLockNotificationCold.kt
+++ b/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppFromLockNotificationCold.kt
@@ -80,6 +80,11 @@
/** {@inheritDoc} */
@Test
@Ignore("Display is off at the start")
+ override fun taskBarWindowIsAlwaysVisible() {}
+
+ /** {@inheritDoc} */
+ @Test
+ @Ignore("Display is off at the start")
override fun statusBarLayerIsVisibleAtStartAndEnd() =
super.statusBarLayerIsVisibleAtStartAndEnd()
diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppFromLockNotificationWarm.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppFromLockNotificationWarm.kt
index 0ace647..e414325 100644
--- a/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppFromLockNotificationWarm.kt
+++ b/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppFromLockNotificationWarm.kt
@@ -97,6 +97,11 @@
/** {@inheritDoc} */
@Test
+ @Ignore("Not applicable to this CUJ. Display starts locked and app is full screen at the end")
+ override fun taskBarWindowIsAlwaysVisible() {}
+
+ /** {@inheritDoc} */
+ @Test
@Ignore("Not applicable to this CUJ. Display starts off and app is full screen at the end")
override fun statusBarLayerPositionAtStartAndEnd() {}
diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppFromNotificationWarm.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppFromNotificationWarm.kt
index 4a9507a..23cb1d4 100644
--- a/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppFromNotificationWarm.kt
+++ b/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppFromNotificationWarm.kt
@@ -191,12 +191,6 @@
@Postsubmit
override fun taskBarWindowIsAlwaysVisible() = super.taskBarWindowIsAlwaysVisible()
- /** {@inheritDoc} */
- @Postsubmit
- @Test
- override fun visibleLayersShownMoreThanOneConsecutiveEntry() =
- super.visibleLayersShownMoreThanOneConsecutiveEntry()
-
companion object {
/**
* Creates the test configurations.
diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppNonResizeableTest.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppNonResizeableTest.kt
index 9ab6156..17f5638 100644
--- a/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppNonResizeableTest.kt
+++ b/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppNonResizeableTest.kt
@@ -17,7 +17,6 @@
package com.android.server.wm.flicker.launch
import android.platform.test.annotations.FlakyTest
-import android.platform.test.annotations.Postsubmit
import android.platform.test.annotations.Presubmit
import android.tools.common.NavBar
import android.tools.common.Rotation
@@ -70,7 +69,7 @@
* Checks that the [ComponentNameMatcher.NAV_BAR] layer starts invisible, becomes visible during
* unlocking animation and remains visible at the end
*/
- @FlakyTest(bugId = 227083463)
+ @Presubmit
@Test
fun navBarLayerVisibilityChanges() {
Assume.assumeFalse(flicker.scenario.isTablet)
@@ -155,8 +154,19 @@
@Ignore("Not applicable to this CUJ. Display starts off and app is full screen at the end")
override fun statusBarWindowIsAlwaysVisible() {}
+ /** {@inheritDoc} */
+ @Presubmit
+ @Test
+ override fun appWindowBecomesFirstAndOnlyTopWindow() =
+ super.appWindowBecomesFirstAndOnlyTopWindow()
+
+ /** {@inheritDoc} */
+ @Presubmit
+ @Test
+ override fun appWindowBecomesVisible() = super.appWindowBecomesVisible()
+
/** Checks the [ComponentNameMatcher.NAV_BAR] is visible at the end of the transition */
- @Postsubmit
+ @Presubmit
@Test
fun navBarLayerIsVisibleAtEnd() {
Assume.assumeFalse(flicker.scenario.isTablet)
@@ -185,18 +195,11 @@
super.appLayerBecomesVisible()
}
- /** {@inheritDoc} */
- @FlakyTest @Test override fun entireScreenCovered() = super.entireScreenCovered()
-
- @FlakyTest(bugId = 218470989)
+ @Presubmit
@Test
override fun visibleWindowsShownMoreThanOneConsecutiveEntry() =
super.visibleWindowsShownMoreThanOneConsecutiveEntry()
- @FlakyTest(bugId = 227143265)
- @Test
- override fun appWindowBecomesTopWindow() = super.appWindowBecomesTopWindow()
-
@FlakyTest(bugId = 251217585)
@Test
override fun focusChanges() {