Snap for 10277391 from 060250ded2 to udc-qpr1-release

Change-Id: I33fe4d57bd8413f80081bb59ed0aa0368e25df56
This commit is contained in:
Android Build Coastguard Worker
2023-06-08 01:19:45 +00:00
8 changed files with 89 additions and 21 deletions

View File

@@ -746,6 +746,10 @@
<string name="security_settings_face_settings_remove_dialog_details">Your face model will be permanently and securely deleted.\n\nAfter deletion, you will need your PIN, pattern, or password to unlock your phone or for authentication in apps.</string> <string name="security_settings_face_settings_remove_dialog_details">Your face model will be permanently and securely deleted.\n\nAfter deletion, you will need your PIN, pattern, or password to unlock your phone or for authentication in apps.</string>
<!-- Dialog contents shown when the user removes an enrollment when configured as a convenience [CHAR LIMIT=NONE] --> <!-- Dialog contents shown when the user removes an enrollment when configured as a convenience [CHAR LIMIT=NONE] -->
<string name="security_settings_face_settings_remove_dialog_details_convenience">Your face model will be permanently and securely deleted.\n\nAfter deletion, you will need your PIN, pattern, or password to unlock your phone.</string> <string name="security_settings_face_settings_remove_dialog_details_convenience">Your face model will be permanently and securely deleted.\n\nAfter deletion, you will need your PIN, pattern, or password to unlock your phone.</string>
<!-- Dialog contents shown when the user removes an enrollment [CHAR LIMIT=NONE] -->
<string name="security_settings_face_remove_dialog_details_fingerprint">Your face model will be permanently and securely deleted.\n\nAfter deletion, you will need your fingerprint, PIN, pattern, or password to unlock your phone or for authentication in apps.</string>
<!-- Dialog contents shown when the user removes an enrollment when configured as a convenience [CHAR LIMIT=NONE] -->
<string name="security_settings_face_remove_dialog_details_fingerprint_conv">Your face model will be permanently and securely deleted.\n\nAfter deletion, you will need your fingerprint, PIN, pattern, or password to unlock your phone.</string>
<!-- Subtitle shown for contextual setting face enrollment [CHAR LIMIT=NONE] --> <!-- Subtitle shown for contextual setting face enrollment [CHAR LIMIT=NONE] -->
<string name="security_settings_face_settings_context_subtitle">Use Face Unlock to unlock your phone</string> <string name="security_settings_face_settings_context_subtitle">Use Face Unlock to unlock your phone</string>
@@ -10573,7 +10577,7 @@
<string name="change_nfc_tag_apps_detail_switch">Allow launch on NFC scan</string> <string name="change_nfc_tag_apps_detail_switch">Allow launch on NFC scan</string>
<!-- Special app access > Launch via NFC > Description. [CHAR LIMIT=NONE] --> <!-- Special app access > Launch via NFC > Description. [CHAR LIMIT=NONE] -->
<string name="change_nfc_tag_apps_detail_summary">Allow this app to launch when a NFC tag is scanned.\nIf this permission is on, the app will be available as an option whenever a tag is detected.</string> <string name="change_nfc_tag_apps_detail_summary">Allow this app to launch when an NFC tag is scanned.\nIf this permission is on, the app will be available as an option whenever a tag is detected.</string>
<!-- Title for media output settings --> <!-- Title for media output settings -->
<string name="media_output_title">Play media to</string> <string name="media_output_title">Play media to</string>

View File

@@ -21,6 +21,7 @@ import android.app.Dialog;
import android.app.settings.SettingsEnums; import android.app.settings.SettingsEnums;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.pm.PackageManager;
import android.hardware.face.Face; import android.hardware.face.Face;
import android.hardware.face.FaceManager; import android.hardware.face.FaceManager;
import android.os.Bundle; import android.os.Bundle;
@@ -69,10 +70,22 @@ public class FaceSettingsRemoveButtonPreferenceController extends BasePreference
public Dialog onCreateDialog(Bundle savedInstanceState) { public Dialog onCreateDialog(Bundle savedInstanceState) {
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
final PackageManager pm = getContext().getPackageManager();
final boolean hasFingerprint = pm.hasSystemFeature(PackageManager.FEATURE_FINGERPRINT);
final int dialogMessageRes;
if (hasFingerprint) {
dialogMessageRes = mIsConvenience
? R.string.security_settings_face_remove_dialog_details_fingerprint_conv
: R.string.security_settings_face_remove_dialog_details_fingerprint;
} else {
dialogMessageRes = mIsConvenience
? R.string.security_settings_face_settings_remove_dialog_details_convenience
: R.string.security_settings_face_settings_remove_dialog_details;
}
builder.setTitle(R.string.security_settings_face_settings_remove_dialog_title) builder.setTitle(R.string.security_settings_face_settings_remove_dialog_title)
.setMessage(mIsConvenience .setMessage(dialogMessageRes)
? R.string.security_settings_face_settings_remove_dialog_details_convenience
: R.string.security_settings_face_settings_remove_dialog_details)
.setPositiveButton(R.string.delete, mOnClickListener) .setPositiveButton(R.string.delete, mOnClickListener)
.setNegativeButton(R.string.cancel, mOnClickListener); .setNegativeButton(R.string.cancel, mOnClickListener);
AlertDialog dialog = builder.create(); AlertDialog dialog = builder.create();

View File

@@ -113,15 +113,27 @@ public class BlockingPrefWithSliceController extends BasePreferenceController im
@Override @Override
public void onStart() { public void onStart() {
if (mLiveData != null) { if (mLiveData == null) {
return;
}
try {
mLiveData.observeForever(this); mLiveData.observeForever(this);
} catch (SecurityException e) {
Log.w(TAG, "observeForever - no permission");
} }
} }
@Override @Override
public void onStop() { public void onStop() {
if (mLiveData != null) { if (mLiveData == null) {
return;
}
try {
mLiveData.removeObserver(this); mLiveData.removeObserver(this);
} catch (SecurityException e) {
Log.w(TAG, "removeObserver - no permission");
} }
} }

View File

@@ -96,12 +96,6 @@ public class BluetoothDetailsProfilesController extends BluetoothDetailsControll
protected void init(PreferenceScreen screen) { protected void init(PreferenceScreen screen) {
mProfilesContainer = (PreferenceCategory)screen.findPreference(getPreferenceKey()); mProfilesContainer = (PreferenceCategory)screen.findPreference(getPreferenceKey());
mProfilesContainer.setLayoutResource(R.layout.preference_bluetooth_profile_category); mProfilesContainer.setLayoutResource(R.layout.preference_bluetooth_profile_category);
mIsLeContactSharingEnabled = DeviceConfig.getBoolean(DeviceConfig.NAMESPACE_SETTINGS_UI,
SettingsUIDeviceConfig.BT_LE_AUDIO_CONTACT_SHARING_ENABLED, true);
mIsLeAudioToggleEnabled = DeviceConfig.getBoolean(DeviceConfig.NAMESPACE_SETTINGS_UI,
SettingsUIDeviceConfig.BT_LE_AUDIO_DEVICE_DETAIL_ENABLED, true)
|| DeviceConfig.getBoolean(DeviceConfig.NAMESPACE_BLUETOOTH,
CONFIG_LE_AUDIO_ENABLED_BY_DEFAULT, false);
// Call refresh here even though it will get called later in onResume, to avoid the // Call refresh here even though it will get called later in onResume, to avoid the
// list of switches appearing to "pop" into the page. // list of switches appearing to "pop" into the page.
refresh(); refresh();
@@ -437,6 +431,7 @@ public class BluetoothDetailsProfilesController extends BluetoothDetailsControll
@Override @Override
public void onResume() { public void onResume() {
updateLeAudioConfig();
for (CachedBluetoothDevice item : mAllOfCachedDevices) { for (CachedBluetoothDevice item : mAllOfCachedDevices) {
item.registerCallback(this); item.registerCallback(this);
} }
@@ -444,6 +439,20 @@ public class BluetoothDetailsProfilesController extends BluetoothDetailsControll
refresh(); refresh();
} }
private void updateLeAudioConfig() {
mIsLeContactSharingEnabled = DeviceConfig.getBoolean(DeviceConfig.NAMESPACE_SETTINGS_UI,
SettingsUIDeviceConfig.BT_LE_AUDIO_CONTACT_SHARING_ENABLED, true);
boolean isLeDeviceDetailEnabled = DeviceConfig.getBoolean(
DeviceConfig.NAMESPACE_SETTINGS_UI,
SettingsUIDeviceConfig.BT_LE_AUDIO_DEVICE_DETAIL_ENABLED, true);
boolean isLeEnabledByDefault = DeviceConfig.getBoolean(DeviceConfig.NAMESPACE_BLUETOOTH,
CONFIG_LE_AUDIO_ENABLED_BY_DEFAULT, false);
mIsLeAudioToggleEnabled = isLeDeviceDetailEnabled || isLeEnabledByDefault;
Log.d(TAG, "BT_LE_AUDIO_CONTACT_SHARING_ENABLED:" + mIsLeContactSharingEnabled
+ ", BT_LE_AUDIO_DEVICE_DETAIL_ENABLED:" + isLeDeviceDetailEnabled
+ ", CONFIG_LE_AUDIO_ENABLED_BY_DEFAULT:" + isLeEnabledByDefault);
}
@Override @Override
public void onDeviceAttributesChanged() { public void onDeviceAttributesChanged() {
for (CachedBluetoothDevice item : mAllOfCachedDevices) { for (CachedBluetoothDevice item : mAllOfCachedDevices) {

View File

@@ -23,6 +23,7 @@ import android.bluetooth.BluetoothDevice;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.os.Bundle; import android.os.Bundle;
import android.util.Log;
import androidx.annotation.VisibleForTesting; import androidx.annotation.VisibleForTesting;
import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AlertDialog;
@@ -63,6 +64,13 @@ public class ForgetDeviceDialogFragment extends InstrumentedDialogFragment {
@Override @Override
public Dialog onCreateDialog(Bundle inState) { public Dialog onCreateDialog(Bundle inState) {
Context context = getContext();
mDevice = getDevice(context);
if (mDevice == null) {
Log.e(TAG, "onCreateDialog: Device is null.");
return null;
}
DialogInterface.OnClickListener onConfirm = (dialog, which) -> { DialogInterface.OnClickListener onConfirm = (dialog, which) -> {
mDevice.unpair(); mDevice.unpair();
Activity activity = getActivity(); Activity activity = getActivity();
@@ -70,9 +78,6 @@ public class ForgetDeviceDialogFragment extends InstrumentedDialogFragment {
activity.finish(); activity.finish();
} }
}; };
Context context = getContext();
mDevice = getDevice(context);
AlertDialog dialog = new AlertDialog.Builder(context) AlertDialog dialog = new AlertDialog.Builder(context)
.setPositiveButton(R.string.bluetooth_unpair_dialog_forget_confirm_button, .setPositiveButton(R.string.bluetooth_unpair_dialog_forget_confirm_button,
onConfirm) onConfirm)

View File

@@ -60,6 +60,12 @@ public final class CustomizableLockScreenUtils {
@VisibleForTesting @VisibleForTesting
static final String AFFORDANCE_NAME = "affordance_name"; static final String AFFORDANCE_NAME = "affordance_name";
@VisibleForTesting
static final String WALLPAPER_LAUNCH_SOURCE = "com.android.wallpaper.LAUNCH_SOURCE";
@VisibleForTesting
static final String LAUNCH_SOURCE_SETTINGS = "app_launched_settings";
private CustomizableLockScreenUtils() {} private CustomizableLockScreenUtils() {}
/** /**
@@ -163,7 +169,14 @@ public final class CustomizableLockScreenUtils {
* activity. * activity.
*/ */
public static Intent newIntent() { public static Intent newIntent() {
return new Intent(Intent.ACTION_SET_WALLPAPER); final Intent intent = new Intent(Intent.ACTION_SET_WALLPAPER);
// By adding the launch source here, we tell our destination (in this case, the wallpaper
// picker app) that it's been launched from within settings. That way, if we are in a
// multi-pane configuration (for example, for large screens), the wallpaper picker app can
// safely skip redirecting to the multi-pane version of its activity, as it's already opened
// within a multi-pane configuration context.
intent.putExtra(WALLPAPER_LAUNCH_SOURCE, LAUNCH_SOURCE_SETTINGS);
return intent;
} }
private static boolean isWallpaperPickerInstalled(Context context) { private static boolean isWallpaperPickerInstalled(Context context) {

View File

@@ -44,7 +44,6 @@ public class SlicePreferenceController extends BasePreferenceController implemen
LiveData<Slice> mLiveData; LiveData<Slice> mLiveData;
@VisibleForTesting @VisibleForTesting
SlicePreference mSlicePreference; SlicePreference mSlicePreference;
private boolean mIsObservering = false;
private Uri mUri; private Uri mUri;
public SlicePreferenceController(Context context, String preferenceKey) { public SlicePreferenceController(Context context, String preferenceKey) {
@@ -74,9 +73,14 @@ public class SlicePreferenceController extends BasePreferenceController implemen
@Override @Override
public void onStart() { public void onStart() {
if (mLiveData != null && !mIsObservering) { if (mLiveData == null) {
mIsObservering = true; return;
}
try {
mLiveData.observeForever(this); mLiveData.observeForever(this);
} catch (SecurityException e) {
Log.w(TAG, "observeForever - no permission");
} }
} }
@@ -91,9 +95,14 @@ public class SlicePreferenceController extends BasePreferenceController implemen
} }
private void removeLiveDataObserver() { private void removeLiveDataObserver() {
if (mLiveData != null && mIsObservering && mLiveData.hasActiveObservers()) { if (mLiveData == null) {
mIsObservering = false; return;
}
try {
mLiveData.removeObserver(this); mLiveData.removeObserver(this);
} catch (SecurityException e) {
Log.w(TAG, "removeLiveDataObserver - no permission");
} }
} }
} }

View File

@@ -114,6 +114,9 @@ public class CustomizableLockScreenQuickAffordancesPreferenceControllerTest {
assertThat(intentCaptor.getValue().getPackage()).isEqualTo( assertThat(intentCaptor.getValue().getPackage()).isEqualTo(
mContext.getString(R.string.config_wallpaper_picker_package)); mContext.getString(R.string.config_wallpaper_picker_package));
assertThat(intentCaptor.getValue().getAction()).isEqualTo(Intent.ACTION_SET_WALLPAPER); assertThat(intentCaptor.getValue().getAction()).isEqualTo(Intent.ACTION_SET_WALLPAPER);
assertThat(intentCaptor.getValue().getStringExtra(
CustomizableLockScreenUtils.WALLPAPER_LAUNCH_SOURCE)).isEqualTo(
CustomizableLockScreenUtils.LAUNCH_SOURCE_SETTINGS);
assertThat(intentCaptor.getValue().getStringExtra("destination")) assertThat(intentCaptor.getValue().getStringExtra("destination"))
.isEqualTo("quick_affordances"); .isEqualTo("quick_affordances");
} }