RESTRICT AUTOMERGE Remove connection preferences "Files received via Bluetooth"

Bug: 197609370
Bug: 201630499
Test: manual
Change-Id: I597a2105ca851dd41d92109f7b1a5d0137942601
(cherry picked from commit 5be9255ddf12c747d229049cb51205169e4eb491)
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 8f2c34e..e7c6085 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -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>
diff --git a/res/xml/connected_devices_advanced.xml b/res/xml/connected_devices_advanced.xml
index 85e4a76..152446c 100644
--- a/res/xml/connected_devices_advanced.xml
+++ b/res/xml/connected_devices_advanced.xml
@@ -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"
diff --git a/src/com/android/settings/bluetooth/BluetoothFilesPreferenceController.java b/src/com/android/settings/bluetooth/BluetoothFilesPreferenceController.java
deleted file mode 100644
index e96fba3..0000000
--- a/src/com/android/settings/bluetooth/BluetoothFilesPreferenceController.java
+++ /dev/null
@@ -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;
-    }
-
-
-}
diff --git a/src/com/android/settings/connecteddevice/AdvancedConnectedDeviceDashboardFragment.java b/src/com/android/settings/connecteddevice/AdvancedConnectedDeviceDashboardFragment.java
index 8509ca0..a2cad1b 100644
--- a/src/com/android/settings/connecteddevice/AdvancedConnectedDeviceDashboardFragment.java
+++ b/src/com/android/settings/connecteddevice/AdvancedConnectedDeviceDashboardFragment.java
@@ -21,7 +21,6 @@
 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;
@@ -73,8 +72,6 @@
             Lifecycle lifecycle) {
         final List<AbstractPreferenceController> controllers = new ArrayList<>();
 
-        controllers.add(new BluetoothFilesPreferenceController(context));
-
         final PrintSettingPreferenceController printerController =
                 new PrintSettingPreferenceController(context);
 
diff --git a/tests/robotests/src/com/android/settings/bluetooth/BluetoothFilesPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/bluetooth/BluetoothFilesPreferenceControllerTest.java
deleted file mode 100644
index 4048998..0000000
--- a/tests/robotests/src/com/android/settings/bluetooth/BluetoothFilesPreferenceControllerTest.java
+++ /dev/null
@@ -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();
-    }
-}