Merge "Merge sc-v2-dev-plus-aosp-without-vendor@8084891" into stage-aosp-master

This commit is contained in:
Xin Li
2022-02-14 17:30:11 +00:00
committed by Android (Google) Code Review
704 changed files with 54456 additions and 61773 deletions

View File

@@ -1,85 +0,0 @@
/*
* Copyright (C) 2017 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.app.settings.SettingsEnums;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import androidx.annotation.VisibleForTesting;
import androidx.preference.Preference;
import com.android.settings.core.BasePreferenceController;
import com.android.settings.core.PreferenceControllerMixin;
import com.android.settings.overlay.FeatureFactory;
import com.android.settingslib.core.instrumentation.MetricsFeatureProvider;
/**
* Controller that shows received files
*/
public class BluetoothFilesPreferenceController extends BasePreferenceController
implements PreferenceControllerMixin {
private static final String TAG = "BluetoothFilesPrefCtrl";
public static final String KEY_RECEIVED_FILES = "bt_received_files";
/* Private intent to show the list of received files */
@VisibleForTesting
static final String ACTION_OPEN_FILES = "com.android.bluetooth.action.TransferHistory";
@VisibleForTesting
static final String EXTRA_SHOW_ALL_FILES = "android.btopp.intent.extra.SHOW_ALL";
@VisibleForTesting
static final String EXTRA_DIRECTION = "direction";
private MetricsFeatureProvider mMetricsFeatureProvider;
public BluetoothFilesPreferenceController(Context context) {
super(context, KEY_RECEIVED_FILES);
mMetricsFeatureProvider = FeatureFactory.getFactory(context).getMetricsFeatureProvider();
}
@Override
public int getAvailabilityStatus() {
return mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_BLUETOOTH)
? AVAILABLE
: UNSUPPORTED_ON_DEVICE;
}
@Override
public String getPreferenceKey() {
return KEY_RECEIVED_FILES;
}
@Override
public boolean handlePreferenceTreeClick(Preference preference) {
if (KEY_RECEIVED_FILES.equals(preference.getKey())) {
mMetricsFeatureProvider.action(mContext,
SettingsEnums.ACTION_BLUETOOTH_FILES);
Intent intent = new Intent(ACTION_OPEN_FILES);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
intent.putExtra(EXTRA_DIRECTION, 1 /* DIRECTION_INBOUND */);
intent.putExtra(EXTRA_SHOW_ALL_FILES, true);
mContext.startActivity(intent);
return true;
}
return false;
}
}

View File

@@ -188,7 +188,8 @@ public final class BluetoothPairingService extends Service {
}
PendingIntent pairIntent = PendingIntent.getService(this, 0, pairingDialogIntent,
PendingIntent.FLAG_ONE_SHOT | PendingIntent.FLAG_IMMUTABLE);
PendingIntent.FLAG_ONE_SHOT | PendingIntent.FLAG_UPDATE_CURRENT
| PendingIntent.FLAG_IMMUTABLE);
Intent serviceIntent = new Intent(ACTION_DISMISS_PAIRING);
serviceIntent.setClass(this, BluetoothPairingService.class);

View File

@@ -98,7 +98,8 @@ public class BluetoothSliceBuilder {
SettingsSlicesContract.KEY_BLUETOOTH).build();
return SliceBuilderUtils.buildSearchResultPageIntent(context,
BluetoothDashboardFragment.class.getName(), null /* key */, screenTitle,
SettingsEnums.SETTINGS_CONNECTED_DEVICE_CATEGORY)
SettingsEnums.SETTINGS_CONNECTED_DEVICE_CATEGORY,
R.string.menu_key_connected_devices)
.setClassName(context.getPackageName(), SubSettings.class.getName())
.setData(contentUri);
}

View File

@@ -29,7 +29,6 @@ import androidx.appcompat.app.AlertDialog;
import com.android.settings.R;
import com.android.settings.core.instrumentation.InstrumentedDialogFragment;
import com.android.settingslib.bluetooth.BluetoothUtils;
import com.android.settingslib.bluetooth.CachedBluetoothDevice;
import com.android.settingslib.bluetooth.LocalBluetoothManager;
@@ -73,8 +72,6 @@ public class ForgetDeviceDialogFragment extends InstrumentedDialogFragment {
};
Context context = getContext();
mDevice = getDevice(context);
final boolean untetheredHeadset = BluetoothUtils.getBooleanMetaData(
mDevice.getDevice(), BluetoothDevice.METADATA_IS_UNTETHERED_HEADSET);
AlertDialog dialog = new AlertDialog.Builder(context)
.setPositiveButton(R.string.bluetooth_unpair_dialog_forget_confirm_button,
@@ -82,9 +79,7 @@ public class ForgetDeviceDialogFragment extends InstrumentedDialogFragment {
.setNegativeButton(android.R.string.cancel, null)
.create();
dialog.setTitle(R.string.bluetooth_unpair_dialog_title);
dialog.setMessage(context.getString(untetheredHeadset
? R.string.bluetooth_untethered_unpair_dialog_body
: R.string.bluetooth_unpair_dialog_body,
dialog.setMessage(context.getString(R.string.bluetooth_unpair_dialog_body,
mDevice.getName()));
return dialog;
}