Merge "Allow WebViewAppPicker can be launched when dev-option disabled" into main
diff --git a/res/layout/fingerprint_rename_dialog.xml b/res/layout/fingerprint_rename_dialog.xml
index 1e1ef11..070d924 100644
--- a/res/layout/fingerprint_rename_dialog.xml
+++ b/res/layout/fingerprint_rename_dialog.xml
@@ -39,6 +39,7 @@
android:id="@+id/fingerprint_rename_field"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:inputType="textCapWords"/>
+ android:inputType="textCapWords"
+ android:minHeight = "48dp"/>
</LinearLayout>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index e14a107..f999a3d 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -672,8 +672,10 @@
<string name="location_settings_footer_learn_more_content_description">
Learn more about Location settings
</string>
- <!-- Tooltip for switchbar on Chrome devices. [CHAR LIMIT=90]-->
- <string name="location_settings_tooltip_text_for_chrome">To change location access, go to Settings > Security and Privacy > Privacy controls</string>
+ <!-- Tooltip for switchbar on ChromeOS devices. [CHAR LIMIT=NONE]-->
+ <string name="location_settings_tooltip_text_for_chrome">
+ To change go to ChromeOS Settings > Privacy and security > Privacy controls > Location access
+ </string>
<!-- Main Settings screen setting option title for the item to take you to the accounts screen [CHAR LIMIT=22] -->
<string name="account_settings_title">Accounts</string>
diff --git a/tests/robotests/src/com/android/settings/bluetooth/ConnectedBluetoothDeviceUpdaterTest.java b/tests/robotests/src/com/android/settings/bluetooth/ConnectedBluetoothDeviceUpdaterTest.java
index ee00068..b2449da 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/ConnectedBluetoothDeviceUpdaterTest.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/ConnectedBluetoothDeviceUpdaterTest.java
@@ -30,7 +30,7 @@
import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothProfile;
import android.content.Context;
-import android.content.pm.PackageInfo;
+import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.graphics.drawable.Drawable;
import android.media.AudioManager;
@@ -44,7 +44,6 @@
import com.android.settings.testutils.shadow.ShadowAudioManager;
import com.android.settings.testutils.shadow.ShadowBluetoothAdapter;
import com.android.settings.testutils.shadow.ShadowCachedBluetoothDeviceManager;
-import com.android.settingslib.bluetooth.BluetoothUtils;
import com.android.settingslib.bluetooth.CachedBluetoothDevice;
import com.android.settingslib.flags.Flags;
@@ -68,7 +67,7 @@
public class ConnectedBluetoothDeviceUpdaterTest {
private static final String MAC_ADDRESS = "04:52:C7:0B:D8:3C";
- private static final String FAKE_EXCLUSIVE_MANAGER_NAME = "com.fake.name";
+ private static final String TEST_EXCLUSIVE_MANAGER = "com.test.manager";
@Rule
public final CheckFlagsRule mCheckFlagsRule = DeviceFlagsValueProvider.createCheckFlagsRule();
@@ -355,13 +354,16 @@
@Test
@RequiresFlagsEnabled(Flags.FLAG_ENABLE_HIDE_EXCLUSIVELY_MANAGED_BLUETOOTH_DEVICE)
- public void update_notAllowedExclusiveManagedDevice_addDevice() {
+ public void update_exclusivelyManagedDevice_packageNotInstalled_addDevice()
+ throws Exception {
mAudioManager.setMode(AudioManager.MODE_NORMAL);
when(mBluetoothDeviceUpdater
.isDeviceConnected(any(CachedBluetoothDevice.class))).thenReturn(true);
when(mCachedBluetoothDevice.isConnectedHfpDevice()).thenReturn(true);
when(mBluetoothDevice.getMetadata(BluetoothDevice.METADATA_EXCLUSIVE_MANAGER)).thenReturn(
- FAKE_EXCLUSIVE_MANAGER_NAME.getBytes());
+ TEST_EXCLUSIVE_MANAGER.getBytes());
+ doThrow(new PackageManager.NameNotFoundException()).when(mPackageManager)
+ .getApplicationInfo(TEST_EXCLUSIVE_MANAGER, 0);
mBluetoothDeviceUpdater.update(mCachedBluetoothDevice);
@@ -370,64 +372,39 @@
@Test
@RequiresFlagsEnabled(Flags.FLAG_ENABLE_HIDE_EXCLUSIVELY_MANAGED_BLUETOOTH_DEVICE)
- public void update_existingExclusivelyManagedDeviceWithPackageInstalled_removePreference()
+ public void update_exclusivelyManagedDevice_packageNotEnabled_addDevice()
throws Exception {
- final String exclusiveManagerName =
- BluetoothUtils.getExclusiveManagers().stream().findAny().orElse(
- FAKE_EXCLUSIVE_MANAGER_NAME);
+ ApplicationInfo appInfo = new ApplicationInfo();
+ appInfo.enabled = false;
mAudioManager.setMode(AudioManager.MODE_NORMAL);
when(mBluetoothDeviceUpdater
- .isDeviceConnected(any(CachedBluetoothDevice.class))).thenReturn(true);
+ .isDeviceConnected(any(CachedBluetoothDevice.class))).thenReturn(true);
when(mCachedBluetoothDevice.isConnectedHfpDevice()).thenReturn(true);
when(mBluetoothDevice.getMetadata(BluetoothDevice.METADATA_EXCLUSIVE_MANAGER)).thenReturn(
- exclusiveManagerName.getBytes());
- doReturn(new PackageInfo()).when(mPackageManager).getPackageInfo(exclusiveManagerName, 0);
-
- mBluetoothDeviceUpdater.update(mCachedBluetoothDevice);
-
- verify(mBluetoothDeviceUpdater).removePreference(mCachedBluetoothDevice);
- verify(mBluetoothDeviceUpdater, never()).addPreference(mCachedBluetoothDevice);
- }
-
- @Test
- @RequiresFlagsEnabled(Flags.FLAG_ENABLE_HIDE_EXCLUSIVELY_MANAGED_BLUETOOTH_DEVICE)
- public void update_newExclusivelyManagedDeviceWithPackageInstalled_doNotAddPreference()
- throws Exception {
- final String exclusiveManagerName =
- BluetoothUtils.getExclusiveManagers().stream().findAny().orElse(
- FAKE_EXCLUSIVE_MANAGER_NAME);
- mAudioManager.setMode(AudioManager.MODE_NORMAL);
- when(mBluetoothDeviceUpdater
- .isDeviceConnected(any(CachedBluetoothDevice.class))).thenReturn(true);
- when(mCachedBluetoothDevice.isConnectedHfpDevice()).thenReturn(true);
- when(mBluetoothDevice.getMetadata(BluetoothDevice.METADATA_EXCLUSIVE_MANAGER)).thenReturn(
- exclusiveManagerName.getBytes());
- doReturn(new PackageInfo()).when(mPackageManager).getPackageInfo(exclusiveManagerName, 0);
-
- mBluetoothDeviceUpdater.update(mCachedBluetoothDevice);
-
- verify(mBluetoothDeviceUpdater).removePreference(mCachedBluetoothDevice);
- verify(mBluetoothDeviceUpdater, never()).addPreference(mCachedBluetoothDevice);
- }
-
- @Test
- @RequiresFlagsEnabled(Flags.FLAG_ENABLE_HIDE_EXCLUSIVELY_MANAGED_BLUETOOTH_DEVICE)
- public void update_exclusivelyManagedDeviceWithoutPackageInstalled_addDevice()
- throws Exception {
- final String exclusiveManagerName =
- BluetoothUtils.getExclusiveManagers().stream().findAny().orElse(
- FAKE_EXCLUSIVE_MANAGER_NAME);
- mAudioManager.setMode(AudioManager.MODE_NORMAL);
- when(mBluetoothDeviceUpdater
- .isDeviceConnected(any(CachedBluetoothDevice.class))).thenReturn(true);
- when(mCachedBluetoothDevice.isConnectedHfpDevice()).thenReturn(true);
- when(mBluetoothDevice.getMetadata(BluetoothDevice.METADATA_EXCLUSIVE_MANAGER)).thenReturn(
- exclusiveManagerName.getBytes());
- doThrow(new PackageManager.NameNotFoundException()).when(mPackageManager).getPackageInfo(
- exclusiveManagerName, 0);
+ TEST_EXCLUSIVE_MANAGER.getBytes());
+ doReturn(appInfo).when(mPackageManager).getApplicationInfo(TEST_EXCLUSIVE_MANAGER, 0);
mBluetoothDeviceUpdater.update(mCachedBluetoothDevice);
verify(mBluetoothDeviceUpdater).addPreference(mCachedBluetoothDevice);
}
+
+ @Test
+ @RequiresFlagsEnabled(Flags.FLAG_ENABLE_HIDE_EXCLUSIVELY_MANAGED_BLUETOOTH_DEVICE)
+ public void update_exclusivelyManagedDevice_packageInstalledAndEnabled_removePreference()
+ throws Exception {
+ mAudioManager.setMode(AudioManager.MODE_NORMAL);
+ when(mBluetoothDeviceUpdater
+ .isDeviceConnected(any(CachedBluetoothDevice.class))).thenReturn(true);
+ when(mCachedBluetoothDevice.isConnectedHfpDevice()).thenReturn(true);
+ when(mBluetoothDevice.getMetadata(BluetoothDevice.METADATA_EXCLUSIVE_MANAGER)).thenReturn(
+ TEST_EXCLUSIVE_MANAGER.getBytes());
+ doReturn(new ApplicationInfo()).when(mPackageManager).getApplicationInfo(
+ TEST_EXCLUSIVE_MANAGER, 0);
+
+ mBluetoothDeviceUpdater.update(mCachedBluetoothDevice);
+
+ verify(mBluetoothDeviceUpdater).removePreference(mCachedBluetoothDevice);
+ verify(mBluetoothDeviceUpdater, never()).addPreference(mCachedBluetoothDevice);
+ }
}
diff --git a/tests/robotests/src/com/android/settings/bluetooth/SavedBluetoothDeviceUpdaterTest.java b/tests/robotests/src/com/android/settings/bluetooth/SavedBluetoothDeviceUpdaterTest.java
index 796120d..e2cf148 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/SavedBluetoothDeviceUpdaterTest.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/SavedBluetoothDeviceUpdaterTest.java
@@ -29,7 +29,7 @@
import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothProfile;
import android.content.Context;
-import android.content.pm.PackageInfo;
+import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.graphics.drawable.Drawable;
import android.platform.test.annotations.RequiresFlagsDisabled;
@@ -41,7 +41,6 @@
import com.android.settings.connecteddevice.DevicePreferenceCallback;
import com.android.settings.dashboard.DashboardFragment;
import com.android.settings.testutils.shadow.ShadowBluetoothAdapter;
-import com.android.settingslib.bluetooth.BluetoothUtils;
import com.android.settingslib.bluetooth.CachedBluetoothDevice;
import com.android.settingslib.bluetooth.CachedBluetoothDeviceManager;
import com.android.settingslib.bluetooth.LocalBluetoothManager;
@@ -66,7 +65,7 @@
public class SavedBluetoothDeviceUpdaterTest {
private static final String MAC_ADDRESS = "04:52:C7:0B:D8:3C";
- private static final String FAKE_EXCLUSIVE_MANAGER_NAME = "com.fake.name";
+ private static final String TEST_EXCLUSIVE_MANAGER = "com.test.manager";
@Rule
public final CheckFlagsRule mCheckFlagsRule = DeviceFlagsValueProvider.createCheckFlagsRule();
@@ -339,42 +338,18 @@
@Test
@RequiresFlagsEnabled(Flags.FLAG_ENABLE_HIDE_EXCLUSIVELY_MANAGED_BLUETOOTH_DEVICE)
- public void update_notAllowedExclusivelyManagedDevice_addDevice() {
- final Collection<CachedBluetoothDevice> cachedDevices = new ArrayList<>();
- cachedDevices.add(mCachedBluetoothDevice);
-
- when(mBluetoothAdapter.isEnabled()).thenReturn(true);
- when(mBluetoothManager.getCachedDeviceManager()).thenReturn(mDeviceManager);
- when(mDeviceManager.getCachedDevicesCopy()).thenReturn(cachedDevices);
- when(mBluetoothDevice.getBondState()).thenReturn(BluetoothDevice.BOND_BONDED);
- when(mBluetoothDevice.isConnected()).thenReturn(false);
- when(mBluetoothDevice.getMetadata(BluetoothDevice.METADATA_EXCLUSIVE_MANAGER)).thenReturn(
- FAKE_EXCLUSIVE_MANAGER_NAME.getBytes());
-
- mBluetoothDeviceUpdater.update(mCachedBluetoothDevice);
-
- verify(mBluetoothDeviceUpdater).addPreference(mCachedBluetoothDevice,
- BluetoothDevicePreference.SortType.TYPE_NO_SORT);
- }
-
- @Test
- @RequiresFlagsEnabled(Flags.FLAG_ENABLE_HIDE_EXCLUSIVELY_MANAGED_BLUETOOTH_DEVICE)
- public void update_existingExclusivelyManagedDeviceWithPackageInstalled_removePreference()
+ public void update_existingExclusivelyManagedDevice_packageEnabled_removePreference()
throws Exception {
final Collection<CachedBluetoothDevice> cachedDevices = new ArrayList<>();
- final String exclusiveManagerName =
- BluetoothUtils.getExclusiveManagers().stream().findAny().orElse(
- FAKE_EXCLUSIVE_MANAGER_NAME);
-
when(mBluetoothAdapter.isEnabled()).thenReturn(true);
when(mBluetoothManager.getCachedDeviceManager()).thenReturn(mDeviceManager);
when(mDeviceManager.getCachedDevicesCopy()).thenReturn(cachedDevices);
when(mBluetoothDevice.getBondState()).thenReturn(BluetoothDevice.BOND_BONDED);
when(mBluetoothDevice.isConnected()).thenReturn(false);
when(mBluetoothDevice.getMetadata(BluetoothDevice.METADATA_EXCLUSIVE_MANAGER)).thenReturn(
- exclusiveManagerName.getBytes());
-
- doReturn(new PackageInfo()).when(mPackageManager).getPackageInfo(exclusiveManagerName, 0);
+ TEST_EXCLUSIVE_MANAGER.getBytes());
+ doReturn(new ApplicationInfo()).when(mPackageManager).getApplicationInfo(
+ TEST_EXCLUSIVE_MANAGER, 0);
mBluetoothDeviceUpdater.mPreferenceMap.put(mBluetoothDevice, mPreference);
mBluetoothDeviceUpdater.update(mCachedBluetoothDevice);
@@ -386,23 +361,19 @@
@Test
@RequiresFlagsEnabled(Flags.FLAG_ENABLE_HIDE_EXCLUSIVELY_MANAGED_BLUETOOTH_DEVICE)
- public void update_newExclusivelyManagedDeviceWithPackageInstalled_doNotAddPreference()
+ public void update_newExclusivelyManagedDevice_packageEnabled_doNotAddPreference()
throws Exception {
final Collection<CachedBluetoothDevice> cachedDevices = new ArrayList<>();
- final String exclusiveManagerName =
- BluetoothUtils.getExclusiveManagers().stream().findAny().orElse(
- FAKE_EXCLUSIVE_MANAGER_NAME);
cachedDevices.add(mCachedBluetoothDevice);
-
when(mBluetoothAdapter.isEnabled()).thenReturn(true);
when(mBluetoothManager.getCachedDeviceManager()).thenReturn(mDeviceManager);
when(mDeviceManager.getCachedDevicesCopy()).thenReturn(cachedDevices);
when(mBluetoothDevice.getBondState()).thenReturn(BluetoothDevice.BOND_BONDED);
when(mBluetoothDevice.isConnected()).thenReturn(false);
when(mBluetoothDevice.getMetadata(BluetoothDevice.METADATA_EXCLUSIVE_MANAGER)).thenReturn(
- exclusiveManagerName.getBytes());
-
- doReturn(new PackageInfo()).when(mPackageManager).getPackageInfo(exclusiveManagerName, 0);
+ TEST_EXCLUSIVE_MANAGER.getBytes());
+ doReturn(new ApplicationInfo()).when(mPackageManager).getApplicationInfo(
+ TEST_EXCLUSIVE_MANAGER, 0);
mBluetoothDeviceUpdater.update(mCachedBluetoothDevice);
@@ -413,24 +384,42 @@
@Test
@RequiresFlagsEnabled(Flags.FLAG_ENABLE_HIDE_EXCLUSIVELY_MANAGED_BLUETOOTH_DEVICE)
- public void update_exclusivelyManagedDeviceWithoutPackageInstalled_addDevice()
+ public void update_exclusivelyManagedDevice_packageNotInstalled_addDevice()
throws Exception {
final Collection<CachedBluetoothDevice> cachedDevices = new ArrayList<>();
- final String exclusiveManagerName =
- BluetoothUtils.getExclusiveManagers().stream().findAny().orElse(
- FAKE_EXCLUSIVE_MANAGER_NAME);
cachedDevices.add(mCachedBluetoothDevice);
-
when(mBluetoothAdapter.isEnabled()).thenReturn(true);
when(mBluetoothManager.getCachedDeviceManager()).thenReturn(mDeviceManager);
when(mDeviceManager.getCachedDevicesCopy()).thenReturn(cachedDevices);
when(mBluetoothDevice.getBondState()).thenReturn(BluetoothDevice.BOND_BONDED);
when(mBluetoothDevice.isConnected()).thenReturn(false);
when(mBluetoothDevice.getMetadata(BluetoothDevice.METADATA_EXCLUSIVE_MANAGER)).thenReturn(
- exclusiveManagerName.getBytes());
+ TEST_EXCLUSIVE_MANAGER.getBytes());
+ doThrow(new PackageManager.NameNotFoundException()).when(mPackageManager)
+ .getApplicationInfo(TEST_EXCLUSIVE_MANAGER, 0);
- doThrow(new PackageManager.NameNotFoundException()).when(mPackageManager).getPackageInfo(
- exclusiveManagerName, 0);
+ mBluetoothDeviceUpdater.update(mCachedBluetoothDevice);
+
+ verify(mBluetoothDeviceUpdater).addPreference(mCachedBluetoothDevice,
+ BluetoothDevicePreference.SortType.TYPE_NO_SORT);
+ }
+
+ @Test
+ @RequiresFlagsEnabled(Flags.FLAG_ENABLE_HIDE_EXCLUSIVELY_MANAGED_BLUETOOTH_DEVICE)
+ public void update_exclusivelyManagedDevice_packageNotEnabled_addDevice()
+ throws Exception {
+ final Collection<CachedBluetoothDevice> cachedDevices = new ArrayList<>();
+ cachedDevices.add(mCachedBluetoothDevice);
+ ApplicationInfo appInfo = new ApplicationInfo();
+ appInfo.enabled = false;
+ when(mBluetoothAdapter.isEnabled()).thenReturn(true);
+ when(mBluetoothManager.getCachedDeviceManager()).thenReturn(mDeviceManager);
+ when(mDeviceManager.getCachedDevicesCopy()).thenReturn(cachedDevices);
+ when(mBluetoothDevice.getBondState()).thenReturn(BluetoothDevice.BOND_BONDED);
+ when(mBluetoothDevice.isConnected()).thenReturn(false);
+ when(mBluetoothDevice.getMetadata(BluetoothDevice.METADATA_EXCLUSIVE_MANAGER)).thenReturn(
+ TEST_EXCLUSIVE_MANAGER.getBytes());
+ doReturn(appInfo).when(mPackageManager).getApplicationInfo(TEST_EXCLUSIVE_MANAGER, 0);
mBluetoothDeviceUpdater.update(mCachedBluetoothDevice);