diff --git a/res/values/integers.xml b/res/values/integers.xml index 3d73f64fabe..d110de253e7 100644 --- a/res/values/integers.xml +++ b/res/values/integers.xml @@ -21,4 +21,9 @@ 102 103 104 + + + 1 + + 1 diff --git a/src/com/android/settings/applications/intentpicker/AppLaunchSettings.java b/src/com/android/settings/applications/intentpicker/AppLaunchSettings.java index 43c377aff7b..88ce786a314 100644 --- a/src/com/android/settings/applications/intentpicker/AppLaunchSettings.java +++ b/src/com/android/settings/applications/intentpicker/AppLaunchSettings.java @@ -105,6 +105,11 @@ public class AppLaunchSettings extends AppInfoBase implements @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + if (mAppEntry == null) { + Log.w(TAG, "onCreate: mAppEntry is null, please check the reason!!!"); + getActivity().finish(); + return; + } addPreferencesFromResource(R.xml.installed_app_launch_settings); mDomainVerificationManager = mContext.getSystemService(DomainVerificationManager.class); initUIComponents(); diff --git a/src/com/android/settings/biometrics/BiometricEnrollActivity.java b/src/com/android/settings/biometrics/BiometricEnrollActivity.java index 44a874bd8d3..88622e931c4 100644 --- a/src/com/android/settings/biometrics/BiometricEnrollActivity.java +++ b/src/com/android/settings/biometrics/BiometricEnrollActivity.java @@ -182,9 +182,12 @@ public class BiometricEnrollActivity extends InstrumentedActivity { final FaceManager faceManager = getSystemService(FaceManager.class); final List faceProperties = faceManager.getSensorPropertiesInternal(); + final int maxFacesEnrollableIfSUW = getApplicationContext().getResources() + .getInteger(R.integer.suw_max_faces_enrollable); if (!faceProperties.isEmpty()) { final int maxEnrolls = - isSetupWizard ? 1 : faceProperties.get(0).maxEnrollmentsPerUser; + isSetupWizard ? maxFacesEnrollableIfSUW + : faceProperties.get(0).maxEnrollmentsPerUser; mIsFaceEnrollable = faceManager.getEnrolledFaces(mUserId).size() < maxEnrolls; } @@ -193,9 +196,12 @@ public class BiometricEnrollActivity extends InstrumentedActivity { final FingerprintManager fpManager = getSystemService(FingerprintManager.class); final List fpProperties = fpManager.getSensorPropertiesInternal(); + final int maxFingerprintsEnrollableIfSUW = getApplicationContext().getResources() + .getInteger(R.integer.suw_max_fingerprints_enrollable); if (!fpProperties.isEmpty()) { final int maxEnrolls = - isSetupWizard ? 1 : fpProperties.get(0).maxEnrollmentsPerUser; + isSetupWizard ? maxFingerprintsEnrollableIfSUW + : fpProperties.get(0).maxEnrollmentsPerUser; mIsFingerprintEnrollable = fpManager.getEnrolledFingerprints(mUserId).size() < maxEnrolls; } diff --git a/src/com/android/settings/biometrics/BiometricEnrollIntroduction.java b/src/com/android/settings/biometrics/BiometricEnrollIntroduction.java index 89b43509b7a..f80b01f39c3 100644 --- a/src/com/android/settings/biometrics/BiometricEnrollIntroduction.java +++ b/src/com/android/settings/biometrics/BiometricEnrollIntroduction.java @@ -257,8 +257,12 @@ public abstract class BiometricEnrollIntroduction extends BiometricEnrollBase // Lock thingy is already set up, launch directly to the next page launchNextEnrollingActivity(mToken); } else { - setResult(RESULT_FINISHED); - finish(); + boolean couldStartNextBiometric = BiometricUtils.tryStartingNextBiometricEnroll(this, + ENROLL_NEXT_BIOMETRIC_REQUEST, "enrollIntroduction#onNextButtonClicked"); + if (!couldStartNextBiometric) { + setResult(RESULT_FINISHED); + finish(); + } } } diff --git a/src/com/android/settings/biometrics/face/FaceEnrollIntroduction.java b/src/com/android/settings/biometrics/face/FaceEnrollIntroduction.java index 707dea9c3a1..74ea27b9d88 100644 --- a/src/com/android/settings/biometrics/face/FaceEnrollIntroduction.java +++ b/src/com/android/settings/biometrics/face/FaceEnrollIntroduction.java @@ -234,13 +234,20 @@ public class FaceEnrollIntroduction extends BiometricEnrollIntroduction { } private boolean maxFacesEnrolled() { + final boolean isSetupWizard = WizardManagerHelper.isAnySetupWizard(getIntent()); if (mFaceManager != null) { final List props = mFaceManager.getSensorPropertiesInternal(); // This will need to be updated for devices with multiple face sensors. final int max = props.get(0).maxEnrollmentsPerUser; final int numEnrolledFaces = mFaceManager.getEnrolledFaces(mUserId).size(); - return numEnrolledFaces >= max; + final int maxFacesEnrollableIfSUW = getApplicationContext().getResources() + .getInteger(R.integer.suw_max_faces_enrollable); + if (isSetupWizard) { + return numEnrolledFaces >= maxFacesEnrollableIfSUW; + } else { + return numEnrolledFaces >= max; + } } else { return false; } diff --git a/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollIntroduction.java b/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollIntroduction.java index 3ab77b666c1..f70a663c1f8 100644 --- a/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollIntroduction.java +++ b/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollIntroduction.java @@ -44,6 +44,7 @@ import com.android.settingslib.HelpUtils; import com.android.settingslib.RestrictedLockUtilsInternal; import com.google.android.setupcompat.template.FooterButton; +import com.google.android.setupcompat.util.WizardManagerHelper; import com.google.android.setupdesign.span.LinkSpan; import java.util.List; @@ -203,6 +204,7 @@ public class FingerprintEnrollIntroduction extends BiometricEnrollIntroduction { @Override protected int checkMaxEnrolled() { + final boolean isSetupWizard = WizardManagerHelper.isAnySetupWizard(getIntent()); if (mFingerprintManager != null) { final List props = mFingerprintManager.getSensorPropertiesInternal(); @@ -210,13 +212,22 @@ public class FingerprintEnrollIntroduction extends BiometricEnrollIntroduction { final int max = props.get(0).maxEnrollmentsPerUser; final int numEnrolledFingerprints = mFingerprintManager.getEnrolledFingerprints(mUserId).size(); - if (numEnrolledFingerprints >= max) { + final int maxFingerprintsEnrollableIfSUW = getApplicationContext().getResources() + .getInteger(R.integer.suw_max_fingerprints_enrollable); + if (isSetupWizard) { + if (numEnrolledFingerprints >= maxFingerprintsEnrollableIfSUW) { + return R.string.fingerprint_intro_error_max; + } else { + return 0; + } + } else if (numEnrolledFingerprints >= max) { return R.string.fingerprint_intro_error_max; + } else { + return 0; } } else { return R.string.fingerprint_intro_error_unknown; } - return 0; } @Override diff --git a/src/com/android/settings/bluetooth/AvailableMediaBluetoothDeviceUpdater.java b/src/com/android/settings/bluetooth/AvailableMediaBluetoothDeviceUpdater.java index 27d63bfdb74..14c20f196ab 100644 --- a/src/com/android/settings/bluetooth/AvailableMediaBluetoothDeviceUpdater.java +++ b/src/com/android/settings/bluetooth/AvailableMediaBluetoothDeviceUpdater.java @@ -70,9 +70,10 @@ public class AvailableMediaBluetoothDeviceUpdater extends BluetoothDeviceUpdater if (DBG) { Log.d(TAG, "isFilterMatched() current audio profile : " + currentAudioProfile); } - // If device is Hearing Aid, it is compatible with HFP and A2DP. + // If device is Hearing Aid or LE Audio, it is compatible with HFP and A2DP. // It would show in Available Devices group. - if (cachedDevice.isConnectedHearingAidDevice()) { + if (cachedDevice.isConnectedHearingAidDevice() + || cachedDevice.isConnectedLeAudioDevice()) { return true; } // According to the current audio profile type, diff --git a/src/com/android/settings/bluetooth/ConnectedBluetoothDeviceUpdater.java b/src/com/android/settings/bluetooth/ConnectedBluetoothDeviceUpdater.java index fc1b9b734b6..d1c45b61f45 100644 --- a/src/com/android/settings/bluetooth/ConnectedBluetoothDeviceUpdater.java +++ b/src/com/android/settings/bluetooth/ConnectedBluetoothDeviceUpdater.java @@ -70,9 +70,10 @@ public class ConnectedBluetoothDeviceUpdater extends BluetoothDeviceUpdater { if (DBG) { Log.d(TAG, "isFilterMatched() current audio profile : " + currentAudioProfile); } - // If device is Hearing Aid, it is compatible with HFP and A2DP. + // If device is Hearing Aid or LE Audio, it is compatible with HFP and A2DP. // It would not show in Connected Devices group. - if (cachedDevice.isConnectedHearingAidDevice()) { + if (cachedDevice.isConnectedHearingAidDevice() + || cachedDevice.isConnectedLeAudioDevice()) { return false; } // According to the current audio profile type, diff --git a/tests/robotests/src/com/android/settings/bluetooth/AvailableMediaBluetoothDeviceUpdaterTest.java b/tests/robotests/src/com/android/settings/bluetooth/AvailableMediaBluetoothDeviceUpdaterTest.java index 924e2468de6..013ef5221f6 100644 --- a/tests/robotests/src/com/android/settings/bluetooth/AvailableMediaBluetoothDeviceUpdaterTest.java +++ b/tests/robotests/src/com/android/settings/bluetooth/AvailableMediaBluetoothDeviceUpdaterTest.java @@ -234,6 +234,32 @@ public class AvailableMediaBluetoothDeviceUpdaterTest { verify(mBluetoothDeviceUpdater).addPreference(mCachedBluetoothDevice); } + @Test + public void onProfileConnectionStateChanged_leAudioDeviceConnected_notInCall_addPreference() { + mAudioManager.setMode(AudioManager.MODE_NORMAL); + when(mBluetoothDeviceUpdater + .isDeviceConnected(any(CachedBluetoothDevice.class))).thenReturn(true); + when(mCachedBluetoothDevice.isConnectedLeAudioDevice()).thenReturn(true); + + mBluetoothDeviceUpdater.onProfileConnectionStateChanged(mCachedBluetoothDevice, + BluetoothProfile.STATE_CONNECTED, BluetoothProfile.LE_AUDIO); + + verify(mBluetoothDeviceUpdater).addPreference(mCachedBluetoothDevice); + } + + @Test + public void onProfileConnectionStateChanged_leAudioDeviceConnected_inCall_addPreference() { + mAudioManager.setMode(AudioManager.MODE_IN_CALL); + when(mBluetoothDeviceUpdater + .isDeviceConnected(any(CachedBluetoothDevice.class))).thenReturn(true); + when(mCachedBluetoothDevice.isConnectedLeAudioDevice()).thenReturn(true); + + mBluetoothDeviceUpdater.onProfileConnectionStateChanged(mCachedBluetoothDevice, + BluetoothProfile.STATE_CONNECTED, BluetoothProfile.LE_AUDIO); + + verify(mBluetoothDeviceUpdater).addPreference(mCachedBluetoothDevice); + } + @Test public void onProfileConnectionStateChanged_deviceDisconnected_removePreference() { mBluetoothDeviceUpdater.onProfileConnectionStateChanged(mCachedBluetoothDevice, diff --git a/tests/robotests/src/com/android/settings/bluetooth/ConnectedBluetoothDeviceUpdaterTest.java b/tests/robotests/src/com/android/settings/bluetooth/ConnectedBluetoothDeviceUpdaterTest.java index ea91fed19fc..40b20dcaea3 100644 --- a/tests/robotests/src/com/android/settings/bluetooth/ConnectedBluetoothDeviceUpdaterTest.java +++ b/tests/robotests/src/com/android/settings/bluetooth/ConnectedBluetoothDeviceUpdaterTest.java @@ -234,6 +234,33 @@ public class ConnectedBluetoothDeviceUpdaterTest { verify(mBluetoothDeviceUpdater).removePreference(mCachedBluetoothDevice); } + @Test + public void onProfileConnectionStateChanged_leAudioDeviceConnected_inCall_removePreference() { + mAudioManager.setMode(AudioManager.MODE_IN_CALL); + when(mBluetoothDeviceUpdater + .isDeviceConnected(any(CachedBluetoothDevice.class))).thenReturn(true); + when(mCachedBluetoothDevice.isConnectedLeAudioDevice()).thenReturn(true); + + mBluetoothDeviceUpdater.onProfileConnectionStateChanged(mCachedBluetoothDevice, + BluetoothProfile.STATE_CONNECTED, BluetoothProfile.LE_AUDIO); + + verify(mBluetoothDeviceUpdater).removePreference(mCachedBluetoothDevice); + } + + @Test + public void onProfileConnectionStateChanged_leAudioDeviceConnected_notInCall_removePreference() + { + mAudioManager.setMode(AudioManager.MODE_NORMAL); + when(mBluetoothDeviceUpdater + .isDeviceConnected(any(CachedBluetoothDevice.class))).thenReturn(true); + when(mCachedBluetoothDevice.isConnectedLeAudioDevice()).thenReturn(true); + + mBluetoothDeviceUpdater.onProfileConnectionStateChanged(mCachedBluetoothDevice, + BluetoothProfile.STATE_CONNECTED, BluetoothProfile.LE_AUDIO); + + verify(mBluetoothDeviceUpdater).removePreference(mCachedBluetoothDevice); + } + @Test public void onProfileConnectionStateChanged_deviceDisconnected_removePreference() { mBluetoothDeviceUpdater.onProfileConnectionStateChanged(mCachedBluetoothDevice,