From 560abbcc4914d1ad552a9f59b9236957d3afc9f8 Mon Sep 17 00:00:00 2001 From: Alice Kuo Date: Tue, 9 May 2023 06:28:50 +0000 Subject: [PATCH 1/8] Revert "Revert "Remove CSIP/VCP enable/disable from Setting"" This reverts commit 6edb515a9fc91e4d29764c2a22a892151e91fcc3. Reason for revert: we need this change and need to merge together with prebuilt Bug: 280626194 Change-Id: Id883c6c7c778154038c249f7be8e9fabf52299c3 --- .../BluetoothDetailsProfilesController.java | 20 ++----------------- 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/src/com/android/settings/bluetooth/BluetoothDetailsProfilesController.java b/src/com/android/settings/bluetooth/BluetoothDetailsProfilesController.java index f69cf580d51..6b58b2c786c 100644 --- a/src/com/android/settings/bluetooth/BluetoothDetailsProfilesController.java +++ b/src/com/android/settings/bluetooth/BluetoothDetailsProfilesController.java @@ -320,7 +320,7 @@ public class BluetoothDetailsProfilesController extends BluetoothDetailsControll } /** - * Disable the Le Audio profile, VCP, and CSIP for each of the Le Audio devices. + * Disable the Le Audio profile for each of the Le Audio devices. * * @param profile the LeAudio profile */ @@ -329,20 +329,12 @@ public class BluetoothDetailsProfilesController extends BluetoothDetailsControll Log.e(TAG, "There is no the LE profile or no device in mProfileDeviceMap. Do nothing."); return; } - LocalBluetoothProfile vcp = mProfileManager.getVolumeControlProfile(); - LocalBluetoothProfile csip = mProfileManager.getCsipSetCoordinatorProfile(); for (CachedBluetoothDevice leAudioDevice : mProfileDeviceMap.get(profile.toString())) { Log.d(TAG, "device:" + leAudioDevice.getDevice().getAnonymizedAddress() + "disable LE profile"); profile.setEnabled(leAudioDevice.getDevice(), false); - if (vcp != null) { - vcp.setEnabled(leAudioDevice.getDevice(), false); - } - if (csip != null) { - csip.setEnabled(leAudioDevice.getDevice(), false); - } } if (!SystemProperties.getBoolean(ENABLE_DUAL_MODE_AUDIO, false)) { @@ -353,7 +345,7 @@ public class BluetoothDetailsProfilesController extends BluetoothDetailsControll } /** - * Enable the Le Audio profile, VCP, and CSIP for each of the Le Audio devices. + * Enable the Le Audio profile for each of the Le Audio devices. * * @param profile the LeAudio profile */ @@ -369,19 +361,11 @@ public class BluetoothDetailsProfilesController extends BluetoothDetailsControll disableProfileBeforeUserEnablesLeAudio(mProfileManager.getHeadsetProfile()); } - LocalBluetoothProfile vcp = mProfileManager.getVolumeControlProfile(); - LocalBluetoothProfile csip = mProfileManager.getCsipSetCoordinatorProfile(); for (CachedBluetoothDevice leAudioDevice : mProfileDeviceMap.get(profile.toString())) { Log.d(TAG, "device:" + leAudioDevice.getDevice().getAnonymizedAddress() + "enable LE profile"); profile.setEnabled(leAudioDevice.getDevice(), true); - if (vcp != null) { - vcp.setEnabled(leAudioDevice.getDevice(), true); - } - if (csip != null) { - csip.setEnabled(leAudioDevice.getDevice(), true); - } } } From d9f60d9a1a39bdc3481d6505fbbc247bc8fef796 Mon Sep 17 00:00:00 2001 From: Himanshu Gupta Date: Tue, 16 May 2023 14:25:55 +0100 Subject: [PATCH 2/8] Clearing obsolete cloneUserId from CloneBackend. When cloned user is removed from device, the previous clonedUserId present with the CloneBackend instance becomes obsolete, and does not update to reflect the new clonedUserId, when the cloned user is re-created. To fix this we set cloneUserId to -1 when cloned user is removed, causing CloneBackend#installCloneApp to update clonedUserId when the cloned profile is re-created. Bug: 280431074, 275062025 Test: Manual by flashing the local build. Change-Id: If0d7960998865b4081502e84d0d4125b3b05c69c --- .../settings/applications/AppStateClonedAppsBridge.java | 5 +++++ .../applications/manageapplications/CloneBackend.java | 9 +++++++++ .../manageapplications/ManageApplications.java | 9 +++++++-- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/com/android/settings/applications/AppStateClonedAppsBridge.java b/src/com/android/settings/applications/AppStateClonedAppsBridge.java index 3348079b294..719023d10e2 100644 --- a/src/com/android/settings/applications/AppStateClonedAppsBridge.java +++ b/src/com/android/settings/applications/AppStateClonedAppsBridge.java @@ -58,6 +58,11 @@ public class AppStateClonedAppsBridge extends AppStateBaseBridge{ mCloneProfileApps = mContext.getPackageManager() .getInstalledPackagesAsUser(GET_ACTIVITIES, mCloneUserId).stream().map(x -> x.packageName).toList(); + } else if (!mCloneProfileApps.isEmpty()) { + // In case we remove clone profile (mCloneUserId becomes -1), the bridge state should + // reflect the same by setting cloneProfileApps as empty, without building the entire + // page. + mCloneProfileApps = new ArrayList<>(); } final List allApps = mAppSession.getAllApps(); diff --git a/src/com/android/settings/applications/manageapplications/CloneBackend.java b/src/com/android/settings/applications/manageapplications/CloneBackend.java index 568631ec460..406c9304386 100644 --- a/src/com/android/settings/applications/manageapplications/CloneBackend.java +++ b/src/com/android/settings/applications/manageapplications/CloneBackend.java @@ -165,4 +165,13 @@ public class CloneBackend { public int getCloneUserId() { return mCloneUserId; } + + /** + * Resets {@link #mCloneUserId} to -1. + * Typically called after the cloneUser is removed, so that the obsolete clonedUserId present + * with the CloneBackend instance can be cleared. + */ + public void resetCloneUserId() { + mCloneUserId = -1; + } } diff --git a/src/com/android/settings/applications/manageapplications/ManageApplications.java b/src/com/android/settings/applications/manageapplications/ManageApplications.java index e0f1b5f702d..548ca553b40 100644 --- a/src/com/android/settings/applications/manageapplications/ManageApplications.java +++ b/src/com/android/settings/applications/manageapplications/ManageApplications.java @@ -923,10 +923,15 @@ public class ManageApplications extends InstrumentedFragment } IUserManager um = IUserManager.Stub.asInterface( ServiceManager.getService(Context.USER_SERVICE)); + CloneBackend cloneBackend = CloneBackend.getInstance(getContext()); try { // Warning: This removes all the data, media & images present in cloned user. - um.removeUser(clonedUserId); - mApplications.rebuild(); + if (um.removeUser(clonedUserId)) { + cloneBackend.resetCloneUserId(); + mApplications.rebuild(); + } else if (ManageApplications.DEBUG) { + Log.e(TAG, "Failed to remove cloned user"); + } } catch (RemoteException e) { Log.e(TAG, "Failed to remove cloned apps", e); Toast.makeText(getContext(), From 657be564ace035647333585d3db7f31843ea9ade Mon Sep 17 00:00:00 2001 From: Aleksandar Kiridzic Date: Fri, 28 Apr 2023 16:37:16 +0100 Subject: [PATCH 3/8] speech: Re-add on-device speech recognition settings entry After `Settings > System > Languages & input` was separated into `Settings > System > Languages` and `Settings > System > Keyboard`, `On-device speech recognition` was lost. This CL adds it in the same `Speech` preference category where it was before and moves the category to `Settings > System > Languages`. Bug: 278279110 Test: Manual, already existing robotests Change-Id: I040c284dd3596f35ceacb6980ff89e611e29971c --- res/xml/keyboard_settings.xml | 15 ------ res/xml/language_and_input.xml | 7 --- res/xml/language_settings.xml | 22 +++++++++ .../inputmethod/KeyboardSettings.java | 15 ------ .../settings/language/LanguageSettings.java | 46 +++++++++++++++++++ ...DeviceRecognitionPreferenceController.java | 10 ++++ .../language/TtsPreferenceController.java | 10 ++++ 7 files changed, 88 insertions(+), 37 deletions(-) diff --git a/res/xml/keyboard_settings.xml b/res/xml/keyboard_settings.xml index bb1c3dad3dd..b18338bef8f 100644 --- a/res/xml/keyboard_settings.xml +++ b/res/xml/keyboard_settings.xml @@ -33,21 +33,6 @@ android:summary="@string/summary_placeholder"/> - - - - - - diff --git a/res/xml/language_and_input.xml b/res/xml/language_and_input.xml index 601ba8e3537..a5f6f63855d 100644 --- a/res/xml/language_and_input.xml +++ b/res/xml/language_and_input.xml @@ -73,13 +73,6 @@ android:title="@string/voice_input_settings_title" android:fragment="com.android.settings.language.DefaultVoiceInputPicker" /> - - + + + + + + + + \ No newline at end of file diff --git a/src/com/android/settings/inputmethod/KeyboardSettings.java b/src/com/android/settings/inputmethod/KeyboardSettings.java index 2d6ac885cd6..9fddb9328a6 100644 --- a/src/com/android/settings/inputmethod/KeyboardSettings.java +++ b/src/com/android/settings/inputmethod/KeyboardSettings.java @@ -30,9 +30,7 @@ import androidx.annotation.Nullable; import com.android.settings.R; import com.android.settings.dashboard.DashboardFragment; -import com.android.settings.language.DefaultVoiceInputPreferenceController; import com.android.settings.language.PointerSpeedController; -import com.android.settings.language.TtsPreferenceController; import com.android.settings.search.BaseSearchIndexProvider; import com.android.settings.widget.PreferenceCategoryController; import com.android.settingslib.core.AbstractPreferenceController; @@ -49,8 +47,6 @@ public class KeyboardSettings extends DashboardFragment { private static final String TAG = "KeyboardSettings"; private static final String KEY_KEYBOARDS_CATEGORY = "keyboards_category"; - private static final String KEY_SPEECH_CATEGORY = "speech_category"; - private static final String KEY_TEXT_TO_SPEECH = "tts_settings_summary"; private static final String KEY_POINTER_CATEGORY = "pointer_category"; @Override @@ -102,17 +98,6 @@ public class KeyboardSettings extends DashboardFragment { Arrays.asList(virtualKeyboardPreferenceController, physicalKeyboardPreferenceController))); - // Speech - final DefaultVoiceInputPreferenceController defaultVoiceInputPreferenceController = - new DefaultVoiceInputPreferenceController(context, lifecycle); - final TtsPreferenceController ttsPreferenceController = - new TtsPreferenceController(context, KEY_TEXT_TO_SPEECH); - controllers.add(defaultVoiceInputPreferenceController); - controllers.add(ttsPreferenceController); - controllers.add(new PreferenceCategoryController(context, - KEY_SPEECH_CATEGORY).setChildren( - Arrays.asList(defaultVoiceInputPreferenceController, ttsPreferenceController))); - // Pointer final PointerSpeedController pointerController = new PointerSpeedController(context); controllers.add(pointerController); diff --git a/src/com/android/settings/language/LanguageSettings.java b/src/com/android/settings/language/LanguageSettings.java index f814e36f275..5da0f2f769a 100644 --- a/src/com/android/settings/language/LanguageSettings.java +++ b/src/com/android/settings/language/LanguageSettings.java @@ -21,14 +21,25 @@ import android.app.settings.SettingsEnums; import android.content.Context; import android.util.FeatureFlagUtils; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + import com.android.settings.R; import com.android.settings.dashboard.DashboardFragment; import com.android.settings.search.BaseSearchIndexProvider; +import com.android.settings.widget.PreferenceCategoryController; +import com.android.settingslib.core.AbstractPreferenceController; +import com.android.settingslib.core.lifecycle.Lifecycle; import com.android.settingslib.search.SearchIndexable; +import java.util.ArrayList; +import java.util.List; + @SearchIndexable public class LanguageSettings extends DashboardFragment { + private static final String KEY_SPEECH_CATEGORY = "speech_category"; + private static final String TAG = "LanguageSettings"; @Override @@ -59,8 +70,43 @@ public class LanguageSettings extends DashboardFragment { return R.xml.language_settings; } + protected List createPreferenceControllers(Context context) { + return buildPreferenceControllers(context, getSettingsLifecycle()); + } + + private static List buildPreferenceControllers( + @NonNull Context context, @Nullable Lifecycle lifecycle) { + final List controllers = new ArrayList<>(); + + final DefaultVoiceInputPreferenceController defaultVoiceInputPreferenceController = + new DefaultVoiceInputPreferenceController(context, lifecycle); + final TtsPreferenceController ttsPreferenceController = + new TtsPreferenceController(context); + final OnDeviceRecognitionPreferenceController onDeviceRecognitionPreferenceController = + new OnDeviceRecognitionPreferenceController(context); + + controllers.add(defaultVoiceInputPreferenceController); + controllers.add(ttsPreferenceController); + List speechCategoryChildren = new ArrayList<>( + List.of(defaultVoiceInputPreferenceController, ttsPreferenceController)); + + if (onDeviceRecognitionPreferenceController.isAvailable()) { + controllers.add(onDeviceRecognitionPreferenceController); + speechCategoryChildren.add(onDeviceRecognitionPreferenceController); + } + + controllers.add(new PreferenceCategoryController(context, KEY_SPEECH_CATEGORY) + .setChildren(speechCategoryChildren)); + + return controllers; + } + public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER = new BaseSearchIndexProvider(R.xml.language_settings) { + public List createPreferenceControllers( + Context context) { + return buildPreferenceControllers(context, null); + } @Override protected boolean isPageSearchEnabled(Context context) { return FeatureFlagUtils diff --git a/src/com/android/settings/language/OnDeviceRecognitionPreferenceController.java b/src/com/android/settings/language/OnDeviceRecognitionPreferenceController.java index 318663957c9..35b42187c8f 100644 --- a/src/com/android/settings/language/OnDeviceRecognitionPreferenceController.java +++ b/src/com/android/settings/language/OnDeviceRecognitionPreferenceController.java @@ -33,10 +33,16 @@ import java.util.Optional; /** Controller of the On-device recognition preference. */ public class OnDeviceRecognitionPreferenceController extends BasePreferenceController { + private static final String KEY_ON_DEVICE_RECOGNITION = "on_device_recognition_settings"; + private static final String TAG = "OnDeviceRecognitionPreferenceController"; private Optional mIntent; + public OnDeviceRecognitionPreferenceController(Context context) { + this(context, KEY_ON_DEVICE_RECOGNITION); + } + public OnDeviceRecognitionPreferenceController(Context context, String preferenceKey) { super(context, preferenceKey); } @@ -51,6 +57,10 @@ public class OnDeviceRecognitionPreferenceController extends BasePreferenceContr : CONDITIONALLY_UNAVAILABLE; } + public String getPreferenceKey() { + return KEY_ON_DEVICE_RECOGNITION; + } + @Override public void updateState(Preference preference) { super.updateState(preference); diff --git a/src/com/android/settings/language/TtsPreferenceController.java b/src/com/android/settings/language/TtsPreferenceController.java index 6507785cda3..b38920606cf 100644 --- a/src/com/android/settings/language/TtsPreferenceController.java +++ b/src/com/android/settings/language/TtsPreferenceController.java @@ -26,9 +26,15 @@ import com.android.settings.core.BasePreferenceController; public class TtsPreferenceController extends BasePreferenceController { + private static final String KEY_TEXT_TO_SPEECH = "tts_settings_summary"; + @VisibleForTesting TtsEngines mTtsEngines; + public TtsPreferenceController(Context context) { + this(context, KEY_TEXT_TO_SPEECH); + } + public TtsPreferenceController(Context context, String key) { super(context, key); mTtsEngines = new TtsEngines(context); @@ -40,4 +46,8 @@ public class TtsPreferenceController extends BasePreferenceController { mContext.getResources().getBoolean(R.bool.config_show_tts_settings_summary) ? AVAILABLE : CONDITIONALLY_UNAVAILABLE; } + + public String getPreferenceKey() { + return KEY_TEXT_TO_SPEECH; + } } From 63d37a3d78e1bba7bb4572833422fc239208384a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Narajowski?= Date: Wed, 17 May 2023 13:38:48 +0000 Subject: [PATCH 4/8] bt: Add late bonding confirmation mechanism If a coordinated set member is bonding late the user will be notified and asked for confirmation on pairing with this device. The dialog box will display specific message for this case. Bug: 282193044 Test: manual Tag: #feature Change-Id: Ie9d79282dd432a542ea02ef477019be6dfbce997 --- res/values/strings.xml | 3 +++ .../bluetooth/BluetoothPairingController.java | 16 +++++++++++++- .../BluetoothPairingDialogFragment.java | 4 ++++ .../bluetooth/BluetoothPairingRequest.java | 22 ++++++++++++++----- 4 files changed, 39 insertions(+), 6 deletions(-) diff --git a/res/values/strings.xml b/res/values/strings.xml index df82b29c60b..7676d869fa3 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -1444,6 +1444,9 @@ Pair with %1$s? + + Add new member to the existing coordinated set + Bluetooth pairing code diff --git a/src/com/android/settings/bluetooth/BluetoothPairingController.java b/src/com/android/settings/bluetooth/BluetoothPairingController.java index 535e04086c0..f75d301ad22 100644 --- a/src/com/android/settings/bluetooth/BluetoothPairingController.java +++ b/src/com/android/settings/bluetooth/BluetoothPairingController.java @@ -72,6 +72,7 @@ public class BluetoothPairingController implements OnCheckedChangeListener, private boolean mIsCoordinatedSetMember; private boolean mIsLeAudio; private boolean mIsLeContactSharingEnabled; + private boolean mIsLateBonding; /** * Creates an instance of a BluetoothPairingController. @@ -98,6 +99,7 @@ public class BluetoothPairingController implements OnCheckedChangeListener, mDeviceName = mBluetoothManager.getCachedDeviceManager().getName(mDevice); mPbapClientProfile = mBluetoothManager.getProfileManager().getPbapClientProfile(); mPasskeyFormatted = formatKey(mPasskey); + mIsLateBonding = mBluetoothManager.getCachedDeviceManager().isLateBonding(mDevice); final CachedBluetoothDevice cachedDevice = mBluetoothManager.getCachedDeviceManager().findDevice(mDevice); @@ -116,7 +118,10 @@ public class BluetoothPairingController implements OnCheckedChangeListener, mIsLeContactSharingEnabled = DeviceConfig.getBoolean(DeviceConfig.NAMESPACE_SETTINGS_UI, SettingsUIDeviceConfig.BT_LE_AUDIO_CONTACT_SHARING_ENABLED, true); - Log.d(TAG, "BT_LE_AUDIO_CONTACT_SHARING_ENABLED is " + mIsLeContactSharingEnabled); + Log.d(TAG, + "BT_LE_AUDIO_CONTACT_SHARING_ENABLED is " + + mIsLeContactSharingEnabled + " isCooridnatedSetMember " + + mIsCoordinatedSetMember); } } @@ -192,6 +197,15 @@ public class BluetoothPairingController implements OnCheckedChangeListener, return mIsCoordinatedSetMember; } + /** + * A method for querying if the bluetooth device from a coordinated set is bonding late. + * + * @return - A boolean indicating if the device is bonding late. + */ + public boolean isLateBonding() { + return mIsLateBonding; + } + /** * A method for querying if the bluetooth device has a profile already set up on this device. * diff --git a/src/com/android/settings/bluetooth/BluetoothPairingDialogFragment.java b/src/com/android/settings/bluetooth/BluetoothPairingDialogFragment.java index ad38fa1296b..3d6a44fb58b 100644 --- a/src/com/android/settings/bluetooth/BluetoothPairingDialogFragment.java +++ b/src/com/android/settings/bluetooth/BluetoothPairingDialogFragment.java @@ -357,6 +357,10 @@ public class BluetoothPairingDialogFragment extends InstrumentedDialogFragment i pairingViewContent.setText(mPairingController.getPairingContent()); } final TextView messagePairingSet = (TextView) view.findViewById(R.id.pairing_group_message); + if (mPairingController.isLateBonding()) { + messagePairingSet.setText(getString(R.string.bluetooth_pairing_group_late_bonding)); + } + messagePairingSet.setVisibility(mPairingController.isCoordinatedSetMemberDevice() ? View.VISIBLE : View.GONE); return view; diff --git a/src/com/android/settings/bluetooth/BluetoothPairingRequest.java b/src/com/android/settings/bluetooth/BluetoothPairingRequest.java index ed477c84602..ace0643ee7b 100644 --- a/src/com/android/settings/bluetooth/BluetoothPairingRequest.java +++ b/src/com/android/settings/bluetooth/BluetoothPairingRequest.java @@ -26,6 +26,7 @@ import android.os.UserHandle; import android.text.TextUtils; import android.util.Log; +import com.android.settingslib.bluetooth.CachedBluetoothDevice; import com.android.settingslib.bluetooth.LocalBluetoothManager; /** @@ -53,17 +54,28 @@ public final class BluetoothPairingRequest extends BroadcastReceiver { boolean shouldShowDialog = LocalBluetoothPreferences.shouldShowDialogInForeground( context, device); - // Skips consent pairing dialog if the device was recently associated with CDM + Log.d(TAG, + "Receive ACTION_PAIRING_REQUEST pairingVariant=" + pairingVariant + + " canBondWithoutDialog=" + device.canBondWithoutDialog() + + " isOngoingPairByCsip=" + + mBluetoothManager.getCachedDeviceManager().isOngoingPairByCsip(device) + + " isLateBonding=" + + mBluetoothManager.getCachedDeviceManager().isLateBonding(device)); + + /* Skips consent pairing dialog if the device was recently associated with CDM + * or if the device is a member of the coordinated set and is not bonding late. + */ if (pairingVariant == BluetoothDevice.PAIRING_VARIANT_CONSENT - && (device.canBondWithoutDialog() - || mBluetoothManager.getCachedDeviceManager().isOngoingPairByCsip(device))) { + && (device.canBondWithoutDialog() + || (mBluetoothManager.getCachedDeviceManager().isOngoingPairByCsip(device) + && !mBluetoothManager.getCachedDeviceManager().isLateBonding(device)))) { device.setPairingConfirmation(true); } else if (powerManager.isInteractive() && shouldShowDialog) { // Since the screen is on and the BT-related activity is in the foreground, // just open the dialog // convert broadcast intent into activity intent (same action string) - Intent pairingIntent = BluetoothPairingService.getPairingDialogIntent(context, - intent, BluetoothDevice.EXTRA_PAIRING_INITIATOR_FOREGROUND); + Intent pairingIntent = BluetoothPairingService.getPairingDialogIntent( + context, intent, BluetoothDevice.EXTRA_PAIRING_INITIATOR_FOREGROUND); context.startActivityAsUser(pairingIntent, UserHandle.CURRENT); } else { From 01164fd414dbfde91a18913bbd99dc3a0592f6ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Narajowski?= Date: Thu, 18 May 2023 15:43:29 +0000 Subject: [PATCH 5/8] bt: Show additional message when is late bond Sometimes the cached bluetooth device is not found and we the BluetoothPairingController does not know if this device is a member of a set. But if this is a late bond then it is a set member so we still want to display that additional message. Bug: 282193044 Test: manual Tag: #feature Change-Id: I9e7da093b118a81097dc83460e9b93ce2e477482 --- .../settings/bluetooth/BluetoothPairingDialogFragment.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/com/android/settings/bluetooth/BluetoothPairingDialogFragment.java b/src/com/android/settings/bluetooth/BluetoothPairingDialogFragment.java index 3d6a44fb58b..e11c275bded 100644 --- a/src/com/android/settings/bluetooth/BluetoothPairingDialogFragment.java +++ b/src/com/android/settings/bluetooth/BluetoothPairingDialogFragment.java @@ -361,8 +361,10 @@ public class BluetoothPairingDialogFragment extends InstrumentedDialogFragment i messagePairingSet.setText(getString(R.string.bluetooth_pairing_group_late_bonding)); } - messagePairingSet.setVisibility(mPairingController.isCoordinatedSetMemberDevice() - ? View.VISIBLE : View.GONE); + boolean setPairingMessage = + mPairingController.isCoordinatedSetMemberDevice() || mPairingController.isLateBonding(); + + messagePairingSet.setVisibility(setPairingMessage ? View.VISIBLE : View.GONE); return view; } } From 8b7e0d7c88a85d9e1e25aef00e90d6a09a13959e Mon Sep 17 00:00:00 2001 From: Weng Su Date: Fri, 19 May 2023 11:37:46 +0800 Subject: [PATCH 6/8] Avoid hotspot band updates when country code is inactive - The SAP usable channels cannot be queried when the country code is not activated, causing UI to display wrong design Bug: 280554293 Test: Manual test atest -c WifiHotspotRepositoryTest Change-Id: I58e8879438d7a630808aa2c4b69f21eb19968ab1 --- .../settings/wifi/repository/WifiHotspotRepository.java | 6 ------ .../settings/wifi/repository/WifiHotspotRepositoryTest.java | 2 -- 2 files changed, 8 deletions(-) diff --git a/src/com/android/settings/wifi/repository/WifiHotspotRepository.java b/src/com/android/settings/wifi/repository/WifiHotspotRepository.java index c46fb2b0053..676421472a2 100644 --- a/src/com/android/settings/wifi/repository/WifiHotspotRepository.java +++ b/src/com/android/settings/wifi/repository/WifiHotspotRepository.java @@ -102,7 +102,6 @@ public class WifiHotspotRepository { protected Boolean mIs6gBandSupported; protected Boolean mIs6gAvailable; protected MutableLiveData m6gAvailable; - protected String mCurrentCountryCode; protected ActiveCountryCodeChangedCallback mActiveCountryCodeChangedCallback; @VisibleForTesting @@ -568,17 +567,12 @@ public class WifiHotspotRepository { @Override public void onActiveCountryCodeChanged(String country) { log("onActiveCountryCodeChanged(), country:" + country); - mCurrentCountryCode = country; purgeRefreshData(); refresh(); } @Override public void onCountryCodeInactive() { - log("onCountryCodeInactive()"); - mCurrentCountryCode = null; - purgeRefreshData(); - refresh(); } } diff --git a/tests/unit/src/com/android/settings/wifi/repository/WifiHotspotRepositoryTest.java b/tests/unit/src/com/android/settings/wifi/repository/WifiHotspotRepositoryTest.java index 7110a1b2a52..af3b8f13ad4 100644 --- a/tests/unit/src/com/android/settings/wifi/repository/WifiHotspotRepositoryTest.java +++ b/tests/unit/src/com/android/settings/wifi/repository/WifiHotspotRepositoryTest.java @@ -78,7 +78,6 @@ import java.util.List; public class WifiHotspotRepositoryTest { static final String WIFI_SSID = "wifi_ssid"; static final String WIFI_PASSWORD = "wifi_password"; - static final String WIFI_CURRENT_COUNTRY_CODE = "US"; static final int WIFI_5GHZ_BAND_PREFERRED = BAND_2GHZ_5GHZ; static final int WIFI_6GHZ_BAND_PREFERRED = BAND_2GHZ_5GHZ_6GHZ; @@ -112,7 +111,6 @@ public class WifiHotspotRepositoryTest { mRepository = new WifiHotspotRepository(mContext, mWifiManager, mTetheringManager); mRepository.mSecurityType = mSecurityType; mRepository.mSpeedType = mSpeedType; - mRepository.mCurrentCountryCode = WIFI_CURRENT_COUNTRY_CODE; mRepository.mIsDualBand = true; mRepository.mIs5gAvailable = true; mRepository.mIs6gAvailable = true; From 46b106c4873fc60d1641c1677ce4b31d3ea8b915 Mon Sep 17 00:00:00 2001 From: Ankita Vyas Date: Fri, 19 May 2023 05:46:31 +0000 Subject: [PATCH 7/8] Remove GET_ACTIVITIES flag while fetching installed apps from package manager. This flag adds more info in return data(not required for this usecase) which increases parcel size. Bug: 278294334 Test: manual Change-Id: Ifba7a184aa8c3f5a70d85ddd3910f17bf91f9444 --- .../applications/ClonedAppsPreferenceController.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/com/android/settings/applications/ClonedAppsPreferenceController.java b/src/com/android/settings/applications/ClonedAppsPreferenceController.java index a8a79f487e7..bb16147ab02 100644 --- a/src/com/android/settings/applications/ClonedAppsPreferenceController.java +++ b/src/com/android/settings/applications/ClonedAppsPreferenceController.java @@ -16,8 +16,6 @@ package com.android.settings.applications; -import static android.content.pm.PackageManager.GET_ACTIVITIES; - import static com.android.settings.Utils.PROPERTY_CLONED_APPS_ENABLED; import android.content.Context; @@ -84,8 +82,8 @@ public class ClonedAppsPreferenceController extends BasePreferenceController mContext.getResources().getStringArray( com.android.internal.R.array.cloneable_apps)); List primaryUserApps = mContext.getPackageManager() - .getInstalledPackagesAsUser(GET_ACTIVITIES, - UserHandle.myUserId()).stream().map(x -> x.packageName).toList(); + .getInstalledPackagesAsUser(/* flags*/ 0, UserHandle.myUserId()).stream() + .map(x -> x.packageName).toList(); // Count number of installed apps in system user. int availableAppsCount = (int) cloneableApps.stream() .filter(x -> primaryUserApps.contains(x)).count(); @@ -96,8 +94,8 @@ public class ClonedAppsPreferenceController extends BasePreferenceController } // Get all apps in clone profile if present. List cloneProfileApps = mContext.getPackageManager() - .getInstalledPackagesAsUser(GET_ACTIVITIES, - cloneUserId).stream().map(x -> x.packageName).toList(); + .getInstalledPackagesAsUser(/* flags*/ 0, cloneUserId).stream() + .map(x -> x.packageName).toList(); // Count number of allowlisted app present in clone profile. int clonedAppsCount = (int) cloneableApps.stream() .filter(x -> cloneProfileApps.contains(x)).count(); From f3241ee339b4325217c3cdade2c4c639405abcb2 Mon Sep 17 00:00:00 2001 From: nsl Date: Fri, 19 May 2023 12:26:26 +0000 Subject: [PATCH 8/8] Remove GET_ACTIVITIES in InteractAcrossProfiles in Settings Remove the GET_ACTIVITIES flag in InteractAcrossProfiles in Settings to follow ag/23343098 Bug: 283407612 Test: InteractAcrossProfilesSettingsTest Change-Id: I299a4a40af3e59f729027b964e938d7783eb7d92 --- .../InteractAcrossProfilesSettings.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/com/android/settings/applications/specialaccess/interactacrossprofiles/InteractAcrossProfilesSettings.java b/src/com/android/settings/applications/specialaccess/interactacrossprofiles/InteractAcrossProfilesSettings.java index ba0d9afd97f..8169072d868 100644 --- a/src/com/android/settings/applications/specialaccess/interactacrossprofiles/InteractAcrossProfilesSettings.java +++ b/src/com/android/settings/applications/specialaccess/interactacrossprofiles/InteractAcrossProfilesSettings.java @@ -16,10 +16,8 @@ package com.android.settings.applications.specialaccess.interactacrossprofiles; import static android.app.admin.DevicePolicyResources.Strings.Settings.CONNECTED_WORK_AND_PERSONAL_APPS_TITLE; -import static android.content.pm.PackageManager.GET_ACTIVITIES; import android.annotation.Nullable; -import android.app.admin.DevicePolicyManager; import android.app.settings.SettingsEnums; import android.content.Context; import android.content.pm.ApplicationInfo; @@ -157,9 +155,9 @@ public class InteractAcrossProfilesSettings extends EmptyTextSettings { private static List getAllInstalledPackages( PackageManager packageManager, UserHandle personalProfile, UserHandle workProfile) { List personalPackages = packageManager.getInstalledPackagesAsUser( - GET_ACTIVITIES, personalProfile.getIdentifier()); + /* flags= */ 0, personalProfile.getIdentifier()); List workPackages = packageManager.getInstalledPackagesAsUser( - GET_ACTIVITIES, workProfile.getIdentifier()); + /* flags= */ 0, workProfile.getIdentifier()); List allPackages = new ArrayList<>(personalPackages); for (PackageInfo workPackage : workPackages) { if (allPackages.stream().noneMatch(