RESTRICT AUTOMERGE Remove connection preferences "Files received via Bluetooth" am: 1b9a21ffb5

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/16048451

Change-Id: I7a693b6644e200a7aa66f09704e39c178aa2baa7
This commit is contained in:
Chienyuan
2021-10-21 15:18:13 +00:00
committed by Automerger Merge Worker
5 changed files with 0 additions and 169 deletions

View File

@@ -212,8 +212,6 @@
<string name="bluetooth_notif_message">Tap to pair with <xliff:g id="device_name">%1$s</xliff:g>.</string>
<!-- Item in bluetooth settings screen, used to show the list of received files [CHAR LIMIT=30] -->
<string name="bluetooth_show_received_files">Received files</string>
<!-- Item in bluetooth settings screen, used to show the list of Files received via Bluetooth [CHAR LIMIT=NONE] -->
<string name="bluetooth_show_files_received_via_bluetooth">Files received via Bluetooth</string>
<!-- Title for contextual Bluetooth devices card when Bluetooth is off [CHAR LIMIT=NONE]-->
<string name="bluetooth_devices_card_off_title">Bluetooth is off</string>

View File

@@ -60,11 +60,6 @@
android:fragment="com.android.settings.print.PrintSettingsFragment"
android:order="-3"/>
<Preference
android:key="bt_received_files"
android:icon="@drawable/ic_folder_vd_theme_24"
android:title="@string/bluetooth_show_files_received_via_bluetooth"/>
<SwitchPreference
android:key="uwb_settings"
android:title="@string/uwb_settings_title"

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

@@ -21,7 +21,6 @@ import android.content.pm.PackageManager;
import android.provider.SearchIndexableResource;
import com.android.settings.R;
import com.android.settings.bluetooth.BluetoothFilesPreferenceController;
import com.android.settings.dashboard.DashboardFragment;
import com.android.settings.nfc.AndroidBeamPreferenceController;
import com.android.settings.print.PrintSettingPreferenceController;
@@ -84,8 +83,6 @@ public class AdvancedConnectedDeviceDashboardFragment extends DashboardFragment
Lifecycle lifecycle) {
final List<AbstractPreferenceController> controllers = new ArrayList<>();
controllers.add(new BluetoothFilesPreferenceController(context));
final PrintSettingPreferenceController printerController =
new PrintSettingPreferenceController(context);

View File

@@ -1,74 +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 static com.google.common.truth.Truth.assertThat;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.spy;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.Bundle;
import androidx.preference.Preference;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.RuntimeEnvironment;
import org.robolectric.shadows.ShadowApplication;
@RunWith(RobolectricTestRunner.class)
public class BluetoothFilesPreferenceControllerTest {
private Context mContext;
private BluetoothFilesPreferenceController mController;
private Preference mPreference;
@Mock
private PackageManager mPackageManager;
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
mContext = spy(RuntimeEnvironment.application);
mController = new BluetoothFilesPreferenceController(mContext);
mPreference = new Preference(mContext);
mPreference.setKey(BluetoothFilesPreferenceController.KEY_RECEIVED_FILES);
doReturn(mPackageManager).when(mContext).getPackageManager();
doReturn(true).when(mPackageManager).hasSystemFeature(PackageManager.FEATURE_BLUETOOTH);
}
@Test
public void testHandlePreferenceTreeClick_sendBroadcast() {
mController.handlePreferenceTreeClick(mPreference);
final Intent intent = ShadowApplication.getInstance().getNextStartedActivity();
assertThat(intent).isNotNull();
assertThat(intent.getAction())
.isEqualTo(BluetoothFilesPreferenceController.ACTION_OPEN_FILES);
final Bundle bundle = intent.getExtras();
assertThat(bundle.getInt(BluetoothFilesPreferenceController.EXTRA_DIRECTION)).isEqualTo(1);
assertThat(bundle.getBoolean(BluetoothFilesPreferenceController.EXTRA_SHOW_ALL_FILES))
.isTrue();
}
}