Snap for 9769041 from dbfc04cb2d to udc-release

Change-Id: I8f8e32083cdb4029a92b36146a3a5946d24c93f6
This commit is contained in:
Android Build Coastguard Worker
2023-03-18 03:27:28 +00:00
16 changed files with 226 additions and 82 deletions

View File

@@ -132,6 +132,8 @@
<string name="bluetooth_device_controls_summary">Hearing device shortcut, hearing aid compatibility</string>
<!-- Connected devices settings. Title of the preference to show the entrance of the audio output page. It can change different types of audio are played on phone or other bluetooth devices. [CHAR LIMIT=35] -->
<string name="bluetooth_audio_routing_title">Audio output</string>
<!-- Title for bluetooth audio routing page footer. [CHAR LIMIT=30] -->
<string name="bluetooth_audio_routing_about_title">About audio output</string>
<!-- Connected devices settings. Summary of the preference to show the entrance of the audio output page. [CHAR LIMIT=NONE] -->
<string name="bluetooth_audio_routing_summary">Route sounds to your hearing device or phone speaker</string>
<!-- Title for related tools section. This section will list related tools below. [CHAR LIMIT=15] -->
@@ -4630,6 +4632,8 @@
<string name="accessibility_hearingaid_more_device_summary"><xliff:g id="device_name" example="GN Hearing Aids">%1$s</xliff:g> +1 more</string>
<!-- Title for the hearing device pairing preference. [CHAR LIMIT=20] -->
<string name="accessibility_hearing_device_pairing_title">Pair new device</string>
<!-- Title for accessibility pair new hearing device page footer. [CHAR LIMIT=60] -->
<string name="accessibility_pair_hearing_device_about_title">About Pair new device</string>
<!-- Title for the preference category containing the connected hearing device group. [CHAR LIMIT=20]-->
<string name="accessibility_hearing_device_connected_title">Hearing devices</string>
<!-- Title for the preference category containing the previously connected hearing device group. [CHAR LIMIT=20]-->
@@ -4642,6 +4646,8 @@
<string name="accessibility_hac_mode_title">Hearing aid compatibility</string>
<!--Summary for the Hearing Aid Compatibility preference in the accessibility page. [CHAR LIMIT=NONE] -->
<string name="accessibility_hac_mode_summary">Improves compatibility with telecoils and reduces unwanted noise</string>
<!-- Title for accessibility hearing device page footer. [CHAR LIMIT=40] -->
<string name="accessibility_hearing_device_about_title">About hearing devices</string>
<!-- Description for text in accessibility hearing aids footer. [CHAR LIMIT=NONE] -->
<string name="accessibility_hearing_device_footer_summary">Make sure your hearing device is turned on and ready to pair</string>
<!-- Title for the pair hearing device page. [CHAR LIMIT=25] -->
@@ -11865,7 +11871,8 @@
<string name="find_broadcast_password_dialog_connection_error">Can\u2019t connect. Try again.</string>
<!-- The error message of enter password dialog in bluetooth find broadcast page [CHAR LIMIT=none] -->
<string name="find_broadcast_password_dialog_password_error">Wrong password</string>
<!-- The error message of join the broadcast session by scanning the QR code [CHAR LIMIT=none] -->
<string name="find_broadcast_join_broadcast_error">Can\u2019t join the broadcast</string>
<!-- [CHAR LIMIT=NONE] Le audio QR code scanner sub-title -->
<string name="bt_le_audio_scan_qr_code_scanner">To start listening, center the QR code below</string>
@@ -11914,8 +11921,10 @@
<string name="accessibility_fingerprint_label">Fingerprint sensor</string>
<!-- Accessibility Flash Notification -->
<!-- Title of the Flash Notification entry [CHAR LIMIT=NONE] -->
<!-- Title of the Flash Notification entry [CHAR LIMIT=35] -->
<string name="flash_notifications_title">Flash notifications</string>
<!-- Title for flash notifications page footer. [CHAR LIMIT=45] -->
<string name="flash_notifications_about_title">About flash notifications</string>
<!-- Summary of the Flash Notification preference if all flash alerts are off. [CHAR LIMIT=60] -->
<string name="flash_notifications_summary_off">Off</string>
<!-- Summary of the Flash Notification preference if only camera flash is on. [CHAR LIMIT=60] -->

View File

@@ -57,5 +57,6 @@
android:key="hearing_device_footer"
android:title="@string/accessibility_hearing_device_footer_summary"
android:selectable="false"
settings:searchable="false" />
settings:searchable="false"
settings:controller="com.android.settings.accessibility.HearingDeviceFooterPreferenceController"/>
</PreferenceScreen>

View File

@@ -64,6 +64,7 @@
android:key="hearing_device_footer"
android:title="@string/bluetooth_audio_routing_footer_summary"
android:selectable="false"
settings:searchable="false" />
settings:searchable="false"
settings:controller="com.android.settings.bluetooth.BluetoothDetailsAudioRoutingFooterPreferenceController"/>
</PreferenceScreen>

View File

@@ -46,10 +46,11 @@
android:title="@string/flash_notifications_preview"
settings:controller="com.android.settings.accessibility.FlashNotificationsPreviewPreferenceController" />
<com.android.settingslib.widget.FooterPreference
<com.android.settings.accessibility.AccessibilityFooterPreference
android:key="flash_notifications_footer"
android:selectable="false"
android:title="@string/flash_notifications_note"
settings:searchable="false" />
android:selectable="false"
settings:searchable="false"
settings:controller="com.android.settings.accessibility.FlashNotificationsFooterPreferenceController"/>
</PreferenceScreen>

View File

@@ -37,6 +37,7 @@
android:key="hearing_device_footer"
android:title="@string/accessibility_hearing_device_footer_summary"
android:selectable="false"
settings:searchable="false" />
settings:searchable="false"
settings:controller="com.android.settings.accessibility.PairHearingDeviceFooterPreferenceController"/>
</PreferenceScreen>

View File

@@ -0,0 +1,35 @@
/*
* Copyright (C) 2023 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.settings.accessibility;
import android.content.Context;
import com.android.settings.R;
/** Preference controller for footer in flash notifications page. */
public class FlashNotificationsFooterPreferenceController extends
AccessibilityFooterPreferenceController {
public FlashNotificationsFooterPreferenceController(Context context,
String key) {
super(context, key);
}
@Override
protected String getIntroductionTitle() {
return mContext.getString(R.string.flash_notifications_about_title);
}
}

View File

@@ -0,0 +1,35 @@
/*
* Copyright (C) 2023 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.settings.accessibility;
import android.content.Context;
import com.android.settings.R;
/** Preference controller for footer in hearing device page. */
public class HearingDeviceFooterPreferenceController extends
AccessibilityFooterPreferenceController {
public HearingDeviceFooterPreferenceController(Context context,
String key) {
super(context, key);
}
@Override
protected String getIntroductionTitle() {
return mContext.getString(R.string.accessibility_hearing_device_about_title);
}
}

View File

@@ -0,0 +1,35 @@
/*
* Copyright (C) 2023 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.settings.accessibility;
import android.content.Context;
import com.android.settings.R;
/** Preference controller for footer in pair hearing device page. */
public class PairHearingDeviceFooterPreferenceController extends
AccessibilityFooterPreferenceController {
public PairHearingDeviceFooterPreferenceController(Context context,
String key) {
super(context, key);
}
@Override
protected String getIntroductionTitle() {
return mContext.getString(R.string.accessibility_pair_hearing_device_about_title);
}
}

View File

@@ -19,6 +19,7 @@ package com.android.settings.bluetooth;
import android.app.Dialog;
import android.app.settings.SettingsEnums;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
@@ -27,6 +28,7 @@ import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog;
import com.android.settings.R;
@@ -128,6 +130,12 @@ public class BluetoothBroadcastDialog extends InstrumentedDialogFragment {
return SettingsEnums.DIALOG_LE_AUDIO_BROADCAST;
}
@Override
public void onCancel(@NonNull DialogInterface dialog) {
dismiss();
getActivity().finish();
}
private void launchFindBroadcastsActivity() {
Bundle bundle = new Bundle();
bundle.putString(KEY_DEVICE_ADDRESS, mDeviceAddress);

View File

@@ -0,0 +1,36 @@
/*
* Copyright (C) 2023 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.settings.bluetooth;
import android.content.Context;
import com.android.settings.R;
import com.android.settings.accessibility.AccessibilityFooterPreferenceController;
/** Preference controller for footer in bluetooth details audio routing page. */
public class BluetoothDetailsAudioRoutingFooterPreferenceController extends
AccessibilityFooterPreferenceController {
public BluetoothDetailsAudioRoutingFooterPreferenceController(Context context,
String key) {
super(context, key);
}
@Override
protected String getIntroductionTitle() {
return mContext.getString(R.string.bluetooth_audio_routing_about_title);
}
}

View File

@@ -19,6 +19,7 @@ package com.android.settings.bluetooth;
import static android.bluetooth.BluetoothDevice.BOND_NONE;
import static android.os.UserManager.DISALLOW_CONFIG_BLUETOOTH;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.settings.SettingsEnums;
import android.bluetooth.BluetoothDevice;
@@ -27,6 +28,7 @@ import android.bluetooth.BluetoothLeBroadcastMetadata;
import android.bluetooth.BluetoothLeBroadcastReceiveState;
import android.bluetooth.le.ScanFilter;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
@@ -34,6 +36,7 @@ import android.view.View;
import android.view.WindowManager;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.VisibleForTesting;
@@ -43,6 +46,7 @@ import com.android.settings.R;
import com.android.settings.dashboard.RestrictedDashboardFragment;
import com.android.settingslib.bluetooth.CachedBluetoothDevice;
import com.android.settingslib.bluetooth.LocalBluetoothLeBroadcastAssistant;
import com.android.settingslib.bluetooth.LocalBluetoothLeBroadcastMetadata;
import com.android.settingslib.bluetooth.LocalBluetoothManager;
import com.android.settingslib.bluetooth.LocalBluetoothProfileManager;
import com.android.settingslib.core.AbstractPreferenceController;
@@ -65,6 +69,7 @@ public class BluetoothFindBroadcastsFragment extends RestrictedDashboardFragment
public static final String KEY_DEVICE_ADDRESS = "device_address";
public static final String PREF_KEY_BROADCAST_SOURCE_LIST = "broadcast_source_list";
public static final int REQUEST_SCAN_BT_BROADCAST_QR_CODE = 0;
@VisibleForTesting
String mDeviceAddress;
@@ -79,6 +84,7 @@ public class BluetoothFindBroadcastsFragment extends RestrictedDashboardFragment
BluetoothFindBroadcastsHeaderController mBluetoothFindBroadcastsHeaderController;
private LocalBluetoothLeBroadcastAssistant mLeBroadcastAssistant;
private LocalBluetoothLeBroadcastMetadata mLocalBroadcastMetadata;
private Executor mExecutor;
private int mSourceId;
@@ -183,6 +189,7 @@ public class BluetoothFindBroadcastsFragment extends RestrictedDashboardFragment
mCachedDevice = getCachedDevice(mDeviceAddress);
mLeBroadcastAssistant = getLeBroadcastAssistant();
mExecutor = Executors.newSingleThreadExecutor();
mLocalBroadcastMetadata = new LocalBluetoothLeBroadcastMetadata();
super.onAttach(context);
if (mCachedDevice == null || mLeBroadcastAssistant == null) {
@@ -229,6 +236,34 @@ public class BluetoothFindBroadcastsFragment extends RestrictedDashboardFragment
}
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
Log.d(TAG, "onActivityResult: " + requestCode + ", resultCode: " + resultCode);
if (requestCode == REQUEST_SCAN_BT_BROADCAST_QR_CODE) {
if (resultCode == Activity.RESULT_OK) {
//Get BroadcastMetadata
String broadcastMetadata = data.getStringExtra(
QrCodeScanModeFragment.KEY_BROADCAST_METADATA);
BluetoothLeBroadcastMetadata source = convertToBroadcastMetadata(broadcastMetadata);
if (source != null) {
Log.d(TAG, "onActivityResult source Id = " + source.getBroadcastId());
//Create preference for the broadcast source
updateListCategoryFromBroadcastMetadata(source, false);
//Add Source
addSource(mBroadcastSourceListCategory.findPreference(
Integer.toString(source.getBroadcastId())));
} else {
Toast.makeText(getContext(),
R.string.find_broadcast_join_broadcast_error, Toast.LENGTH_SHORT).show();
return;
}
}
}
}
@VisibleForTesting
void finishFragmentIfNecessary() {
if (mCachedDevice.getBondState() == BOND_NONE) {
@@ -466,4 +501,8 @@ public class BluetoothFindBroadcastsFragment extends RestrictedDashboardFragment
public void setSourceId(int sourceId) {
mSourceId = sourceId;
}
private BluetoothLeBroadcastMetadata convertToBroadcastMetadata(String qrCodeString) {
return mLocalBroadcastMetadata.convertToBroadcastMetadata(qrCodeString);
}
}

View File

@@ -137,7 +137,8 @@ public class BluetoothFindBroadcastsHeaderController extends BluetoothDetailsCon
.putExtra(BluetoothBroadcastUtils.EXTRA_BLUETOOTH_SINK_IS_GROUP, true)
.putExtra(BluetoothBroadcastUtils.EXTRA_BLUETOOTH_DEVICE_SINK,
mCachedDevice.getDevice());
mContext.startActivity(intent);
mBluetoothFindBroadcastsFragment.startActivityForResult(intent,
BluetoothFindBroadcastsFragment.REQUEST_SCAN_BT_BROADCAST_QR_CODE);
}
@Override

View File

@@ -1,63 +0,0 @@
/**
* Copyright (C) 2022 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.settings.bluetooth;
import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothLeBroadcastMetadata;
import android.content.Context;
import android.util.Log;
import com.android.settingslib.bluetooth.BluetoothUtils;
import com.android.settingslib.bluetooth.CachedBluetoothDeviceManager;
import com.android.settingslib.bluetooth.LocalBluetoothLeBroadcastAssistant;
import com.android.settingslib.bluetooth.LocalBluetoothLeBroadcastMetadata;
import com.android.settingslib.bluetooth.LocalBluetoothManager;
import com.android.settingslib.bluetooth.LocalBluetoothProfileManager;
public class QrCodeScanModeController {
private static final boolean DEBUG = BluetoothUtils.D;
private static final String TAG = "QrCodeScanModeController";
private LocalBluetoothLeBroadcastMetadata mLocalBroadcastMetadata;
private LocalBluetoothLeBroadcastAssistant mLocalBroadcastAssistant;
private LocalBluetoothManager mLocalBluetoothManager;
private LocalBluetoothProfileManager mProfileManager;
public QrCodeScanModeController(Context context) {
if (DEBUG) {
Log.d(TAG, "QrCodeScanModeController constructor.");
}
mLocalBluetoothManager = Utils.getLocalBtManager(context);
mProfileManager = mLocalBluetoothManager.getProfileManager();
mLocalBroadcastMetadata = new LocalBluetoothLeBroadcastMetadata();
CachedBluetoothDeviceManager cachedDeviceManager = new CachedBluetoothDeviceManager(context,
mLocalBluetoothManager);
mLocalBroadcastAssistant = new LocalBluetoothLeBroadcastAssistant(context,
cachedDeviceManager, mProfileManager);
}
private BluetoothLeBroadcastMetadata convertToBroadcastMetadata(String qrCodeString) {
return mLocalBroadcastMetadata.convertToBroadcastMetadata(qrCodeString);
}
public void addSource(BluetoothDevice sink, String sourceMetadata,
boolean isGroupOp) {
mLocalBroadcastAssistant.addSource(sink,
convertToBroadcastMetadata(sourceMetadata), isGroupOp);
}
}

View File

@@ -16,9 +16,11 @@
package com.android.settings.bluetooth;
import android.app.Activity;
import android.app.settings.SettingsEnums;
import android.bluetooth.BluetoothDevice;
import android.content.Context;
import android.content.Intent;
import android.graphics.Matrix;
import android.graphics.Outline;
import android.graphics.Rect;
@@ -67,13 +69,14 @@ public class QrCodeScanModeFragment extends InstrumentedFragment implements
private static final Duration VIBRATE_DURATION_QR_CODE_RECOGNITION = Duration.ofMillis(3);
public static final String KEY_BROADCAST_METADATA = "key_broadcast_metadata";
private boolean mIsGroupOp;
private int mCornerRadius;
private BluetoothDevice mSink;
private String mBroadcastMetadata;
private Context mContext;
private QrCamera mCamera;
private QrCodeScanModeController mController;
private TextureView mTextureView;
private TextView mSummary;
private TextView mErrorMessage;
@@ -87,7 +90,6 @@ public class QrCodeScanModeFragment extends InstrumentedFragment implements
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mContext = getContext();
mController = new QrCodeScanModeController(mContext);
}
@Override
@@ -215,10 +217,10 @@ public class QrCodeScanModeFragment extends InstrumentedFragment implements
break;
case MESSAGE_SCAN_BROADCAST_SUCCESS:
/* TODO(b/265281156) : Move the logic to BluetoothFindBroadcastsFragment.
* We only pass the QR code string to the previous page.
*/
mController.addSource(mSink, mBroadcastMetadata, mIsGroupOp);
Log.d(TAG, "scan success");
final Intent resultIntent = new Intent();
resultIntent.putExtra(KEY_BROADCAST_METADATA, mBroadcastMetadata);
getActivity().setResult(Activity.RESULT_OK, resultIntent);
notifyUserForQrCodeRecognition();
break;
default:

View File

@@ -224,6 +224,10 @@ public class DreamSettings extends DashboardFragment implements OnMainSwitchChan
mPreviewButton.setOnClickListener(v -> dreamBackend.preview(dreamBackend.getActiveDream()));
mRecyclerView = super.onCreateRecyclerView(inflater, parent, bundle);
// The enable/disable status change of the nested RecyclerView(Dream Picker) causes the
// focus moving. Make the RecyclerView unfocusable to prevent the unexpected scrolling when
// the focus changes in the TalkBack mode.
mRecyclerView.setFocusable(false);
updatePaddingForPreviewButton();
return mRecyclerView;
}

View File

@@ -211,6 +211,7 @@ public class AutoSelectPreferenceController extends TelephonyTogglePreferenceCon
mSwitchPreference.setChecked(isChecked());
}
mRecursiveUpdate.decrementAndGet();
updateListenerValue();
dismissProgressBar();
});
});
@@ -245,13 +246,13 @@ public class AutoSelectPreferenceController extends TelephonyTogglePreferenceCon
ThreadUtils.postOnBackgroundThread(() -> {
queryNetworkSelectionMode(INTERNAL_LOG_TAG_INIT);
//Update UI in UI thread
mUiHandler.post(() -> {
if (mSwitchPreference != null) {
mRecursiveUpdate.getAndIncrement();
mSwitchPreference.setChecked(isChecked());
mRecursiveUpdate.decrementAndGet();
updateListenerValue();
}
});
});
@@ -267,7 +268,6 @@ public class AutoSelectPreferenceController extends TelephonyTogglePreferenceCon
private void queryNetworkSelectionMode(String tag) {
mCacheOfModeStatus = mTelephonyManager.getNetworkSelectionMode();
Log.d(LOG_TAG, tag + ": query commend done. mCacheOfModeStatus: " + mCacheOfModeStatus);
updateListenerValue();
}
@VisibleForTesting
@@ -284,12 +284,11 @@ public class AutoSelectPreferenceController extends TelephonyTogglePreferenceCon
}
mCacheOfModeStatus = networkSelectionMode;
Log.d(LOG_TAG, "updateUiAutoSelectValue: mCacheOfModeStatus: " + mCacheOfModeStatus);
updateListenerValue();
mRecursiveUpdate.getAndIncrement();
updateState(mSwitchPreference);
mRecursiveUpdate.decrementAndGet();
updateListenerValue();
}
}