Merge "Adds accessibility team to OWNERS for AccessibilityInteractionControllerTest"
diff --git a/core/tests/coretests/src/android/content/pm/TEST_MAPPING b/core/tests/coretests/src/android/content/pm/TEST_MAPPING
index 15e04d1..978d80c 100644
--- a/core/tests/coretests/src/android/content/pm/TEST_MAPPING
+++ b/core/tests/coretests/src/android/content/pm/TEST_MAPPING
@@ -1,5 +1,5 @@
{
- "presubmit-large": [
+ "presubmit": [
{
"name": "FrameworksCoreTests",
"options": [
diff --git a/graphics/java/android/graphics/ColorSpace.java b/graphics/java/android/graphics/ColorSpace.java
index ca3c847..6e60e9e 100644
--- a/graphics/java/android/graphics/ColorSpace.java
+++ b/graphics/java/android/graphics/ColorSpace.java
@@ -170,7 +170,7 @@
/**
* Standard CIE 1931 2° illuminant D65, encoded in xyY.
* This illuminant has a color temperature of 6504K. This illuminant
- * is commonly used in RGB color spaces such as sRGB, BT.209, etc.
+ * is commonly used in RGB color spaces such as sRGB, BT.709, etc.
*/
public static final float[] ILLUMINANT_D65 = { 0.31271f, 0.32902f };
/**
@@ -832,8 +832,8 @@
public enum Model {
/**
* The RGB model is a color model with 3 components that
- * refer to the three additive primiaries: red, green
- * andd blue.
+ * refer to the three additive primaries: red, green
+ * and blue.
*/
RGB(3),
/**
@@ -2405,7 +2405,7 @@
* does not need to be specified and is assumed to be 1.0. Only the xy components
* are required.</p>
*
- * <p class="note">The ID, areturned by {@link #getId()}, of an object created by
+ * <p class="note">The ID, as returned by {@link #getId()}, of an object created by
* this constructor is always {@link #MIN_ID}.</p>
*
* @param name Name of the color space, cannot be null, its length must be >= 1
@@ -3832,7 +3832,7 @@
*
* <p>We can only connect color spaces if they use the same profile
* connection space. We assume the connection space is always
- * CIE XYZ but we maye need to perform a chromatic adaptation to
+ * CIE XYZ but we maybe need to perform a chromatic adaptation to
* match the white points. If an adaptation is needed, we use the
* CIE standard illuminant D50. The unmatched color space is adapted
* using the von Kries transform and the {@link Adaptation#BRADFORD}
diff --git a/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java b/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java
index c8187b8..8b2eebe 100644
--- a/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java
+++ b/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java
@@ -208,7 +208,7 @@
synchronized (mProfileLock) {
if (profile instanceof A2dpProfile || profile instanceof HeadsetProfile
- || profile instanceof HearingAidProfile) {
+ || profile instanceof HearingAidProfile || profile instanceof LeAudioProfile) {
setProfileConnectedStatus(profile.getProfileId(), false);
switch (newProfileState) {
case BluetoothProfile.STATE_CONNECTED:
@@ -226,7 +226,20 @@
case BluetoothProfile.STATE_DISCONNECTED:
if (mHandler.hasMessages(profile.getProfileId())) {
mHandler.removeMessages(profile.getProfileId());
- setProfileConnectedStatus(profile.getProfileId(), true);
+ if (profile.getConnectionPolicy(mDevice) >
+ BluetoothProfile.CONNECTION_POLICY_FORBIDDEN) {
+ /*
+ * If we received state DISCONNECTED and previous state was
+ * CONNECTING and connection policy is FORBIDDEN or UNKNOWN
+ * then it's not really a failure to connect.
+ *
+ * Connection profile is considered as failed when connection
+ * policy indicates that profile should be connected
+ * but it got disconnected.
+ */
+ Log.w(TAG, "onProfileStateChanged(): Failed to connect profile");
+ setProfileConnectedStatus(profile.getProfileId(), true);
+ }
}
break;
default:
@@ -1188,6 +1201,13 @@
}
private boolean isProfileConnectedFail() {
+ Log.d(TAG, "anonymizedAddress=" + mDevice.getAnonymizedAddress()
+ + " mIsA2dpProfileConnectedFail=" + mIsA2dpProfileConnectedFail
+ + " mIsHearingAidProfileConnectedFail=" + mIsHearingAidProfileConnectedFail
+ + " mIsLeAudioProfileConnectedFail=" + mIsLeAudioProfileConnectedFail
+ + " mIsHeadsetProfileConnectedFail=" + mIsHeadsetProfileConnectedFail
+ + " isConnectedSapDevice()=" + isConnectedSapDevice());
+
return mIsA2dpProfileConnectedFail || mIsHearingAidProfileConnectedFail
|| (!isConnectedSapDevice() && mIsHeadsetProfileConnectedFail)
|| mIsLeAudioProfileConnectedFail;
diff --git a/packages/SettingsLib/tests/robotests/src/com/android/settingslib/bluetooth/CachedBluetoothDeviceTest.java b/packages/SettingsLib/tests/robotests/src/com/android/settingslib/bluetooth/CachedBluetoothDeviceTest.java
index 315ab0a..df3861a 100644
--- a/packages/SettingsLib/tests/robotests/src/com/android/settingslib/bluetooth/CachedBluetoothDeviceTest.java
+++ b/packages/SettingsLib/tests/robotests/src/com/android/settingslib/bluetooth/CachedBluetoothDeviceTest.java
@@ -74,6 +74,8 @@
@Mock
private HearingAidProfile mHearingAidProfile;
@Mock
+ private LeAudioProfile mLeAudioProfile;
+ @Mock
private BluetoothDevice mDevice;
@Mock
private BluetoothDevice mSubDevice;
@@ -92,15 +94,76 @@
mShadowBluetoothAdapter = Shadow.extract(BluetoothAdapter.getDefaultAdapter());
when(mDevice.getAddress()).thenReturn(DEVICE_ADDRESS);
when(mHfpProfile.isProfileReady()).thenReturn(true);
+ when(mHfpProfile.getProfileId()).thenReturn(BluetoothProfile.HEADSET);
when(mA2dpProfile.isProfileReady()).thenReturn(true);
+ when(mA2dpProfile.getProfileId()).thenReturn(BluetoothProfile.A2DP);
when(mPanProfile.isProfileReady()).thenReturn(true);
+ when(mPanProfile.getProfileId()).thenReturn(BluetoothProfile.PAN);
when(mHearingAidProfile.isProfileReady()).thenReturn(true);
+ when(mHearingAidProfile.getProfileId()).thenReturn(BluetoothProfile.HEARING_AID);
+ when(mLeAudioProfile.isProfileReady()).thenReturn(true);
+ when(mLeAudioProfile.getProfileId()).thenReturn(BluetoothProfile.LE_AUDIO);
mCachedDevice = spy(new CachedBluetoothDevice(mContext, mProfileManager, mDevice));
mSubCachedDevice = spy(new CachedBluetoothDevice(mContext, mProfileManager, mSubDevice));
doAnswer((invocation) -> mBatteryLevel).when(mCachedDevice).getBatteryLevel();
doAnswer((invocation) -> mBatteryLevel).when(mSubCachedDevice).getBatteryLevel();
}
+ private void testTransitionFromConnectingToDisconnected(
+ LocalBluetoothProfile connectingProfile, LocalBluetoothProfile connectedProfile,
+ int connectionPolicy, String expectedSummary) {
+ // Arrange:
+ // At least one profile has to be connected
+ updateProfileStatus(connectedProfile, BluetoothProfile.STATE_CONNECTED);
+ // Set profile under test to CONNECTING
+ updateProfileStatus(connectingProfile, BluetoothProfile.STATE_CONNECTING);
+ // Set connection policy
+ when(connectingProfile.getConnectionPolicy(mDevice)).thenReturn(connectionPolicy);
+
+ // Act & Assert:
+ // Get the expected connection summary.
+ updateProfileStatus(connectingProfile, BluetoothProfile.STATE_DISCONNECTED);
+ assertThat(mCachedDevice.getConnectionSummary()).isEqualTo(expectedSummary);
+ }
+
+ @Test
+ public void onProfileStateChanged_testConnectingToDisconnected_policyAllowed_problem() {
+ String connectTimeoutString = mContext.getString(R.string.profile_connect_timeout_subtext);
+
+ testTransitionFromConnectingToDisconnected(mA2dpProfile, mLeAudioProfile,
+ BluetoothProfile.CONNECTION_POLICY_ALLOWED, connectTimeoutString);
+ testTransitionFromConnectingToDisconnected(mHearingAidProfile, mLeAudioProfile,
+ BluetoothProfile.CONNECTION_POLICY_ALLOWED, connectTimeoutString);
+ testTransitionFromConnectingToDisconnected(mHfpProfile, mLeAudioProfile,
+ BluetoothProfile.CONNECTION_POLICY_ALLOWED, connectTimeoutString);
+ testTransitionFromConnectingToDisconnected(mLeAudioProfile, mA2dpProfile,
+ BluetoothProfile.CONNECTION_POLICY_ALLOWED, connectTimeoutString);
+ }
+
+ @Test
+ public void onProfileStateChanged_testConnectingToDisconnected_policyForbidden_noProblem() {
+ testTransitionFromConnectingToDisconnected(mA2dpProfile, mLeAudioProfile,
+ BluetoothProfile.CONNECTION_POLICY_FORBIDDEN, null);
+ testTransitionFromConnectingToDisconnected(mHearingAidProfile, mLeAudioProfile,
+ BluetoothProfile.CONNECTION_POLICY_FORBIDDEN, null);
+ testTransitionFromConnectingToDisconnected(mHfpProfile, mLeAudioProfile,
+ BluetoothProfile.CONNECTION_POLICY_FORBIDDEN, null);
+ testTransitionFromConnectingToDisconnected(mLeAudioProfile, mA2dpProfile,
+ BluetoothProfile.CONNECTION_POLICY_FORBIDDEN, null);
+ }
+
+ @Test
+ public void onProfileStateChanged_testConnectingToDisconnected_policyUnknown_noProblem() {
+ testTransitionFromConnectingToDisconnected(mA2dpProfile, mLeAudioProfile,
+ BluetoothProfile.CONNECTION_POLICY_UNKNOWN, null);
+ testTransitionFromConnectingToDisconnected(mHearingAidProfile, mLeAudioProfile,
+ BluetoothProfile.CONNECTION_POLICY_UNKNOWN, null);
+ testTransitionFromConnectingToDisconnected(mHfpProfile, mLeAudioProfile,
+ BluetoothProfile.CONNECTION_POLICY_UNKNOWN, null);
+ testTransitionFromConnectingToDisconnected(mLeAudioProfile, mA2dpProfile,
+ BluetoothProfile.CONNECTION_POLICY_UNKNOWN, null);
+ }
+
@Test
public void getConnectionSummary_testProfilesInactive_returnPairing() {
// Arrange:
diff --git a/services/core/java/com/android/server/wm/ActivityRecord.java b/services/core/java/com/android/server/wm/ActivityRecord.java
index b8486e7..cae0234 100644
--- a/services/core/java/com/android/server/wm/ActivityRecord.java
+++ b/services/core/java/com/android/server/wm/ActivityRecord.java
@@ -557,6 +557,8 @@
Drawable mEnterpriseThumbnailDrawable;
+ boolean mPauseSchedulePendingForPip = false;
+
private void updateEnterpriseThumbnailDrawable(Context context) {
DevicePolicyManager dpm = context.getSystemService(DevicePolicyManager.class);
mEnterpriseThumbnailDrawable = dpm.getResources().getDrawable(
diff --git a/services/core/java/com/android/server/wm/ActivityTaskManagerService.java b/services/core/java/com/android/server/wm/ActivityTaskManagerService.java
index 12714ed..14927f9 100644
--- a/services/core/java/com/android/server/wm/ActivityTaskManagerService.java
+++ b/services/core/java/com/android/server/wm/ActivityTaskManagerService.java
@@ -3583,7 +3583,7 @@
null /* launchIntoPipHostActivity */, "enterPictureInPictureMode",
transition);
// Continue the pausing process after entering pip.
- if (r.isState(PAUSING)) {
+ if (r.isState(PAUSING) && r.mPauseSchedulePendingForPip) {
r.getTask().schedulePauseActivity(r, false /* userLeaving */,
false /* pauseImmediately */, true /* autoEnteringPip */, "auto-pip");
}
diff --git a/services/core/java/com/android/server/wm/TaskFragment.java b/services/core/java/com/android/server/wm/TaskFragment.java
index 1a3e7d1..ab979ad 100644
--- a/services/core/java/com/android/server/wm/TaskFragment.java
+++ b/services/core/java/com/android/server/wm/TaskFragment.java
@@ -1619,6 +1619,7 @@
if (prev.attachedToProcess()) {
if (shouldAutoPip) {
+ prev.mPauseSchedulePendingForPip = true;
boolean didAutoPip = mAtmService.enterPictureInPictureMode(
prev, prev.pictureInPictureArgs, false /* fromClient */);
ProtoLog.d(WM_DEBUG_STATES, "Auto-PIP allowed, entering PIP mode "
@@ -1682,6 +1683,7 @@
boolean pauseImmediately, boolean autoEnteringPip, String reason) {
ProtoLog.v(WM_DEBUG_STATES, "Enqueueing pending pause: %s", prev);
try {
+ prev.mPauseSchedulePendingForPip = false;
EventLogTags.writeWmPauseActivity(prev.mUserId, System.identityHashCode(prev),
prev.shortComponentName, "userLeaving=" + userLeaving, reason);