diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 6689645..f82f970 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -3017,23 +3017,6 @@
             </intent-filter>
         </activity>
 
-        <!-- NFC settings -->
-        <activity
-            android:name="Settings$AndroidBeamSettingsActivity"
-            android:exported="true"
-            android:label="@string/android_beam_settings_title">
-            <intent-filter android:priority="1">
-                <action android:name="android.settings.NFCSHARING_SETTINGS" />
-                <category android:name="android.intent.category.DEFAULT" />
-            </intent-filter>
-            <meta-data android:name="com.android.settings.FRAGMENT_CLASS"
-                android:value="com.android.settings.nfc.AndroidBeam" />
-            <meta-data android:name="com.android.settings.HIGHLIGHT_MENU_KEY"
-                       android:value="@string/menu_key_connected_devices"/>
-            <meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
-                android:value="true" />
-        </activity>
-
         <activity
             android:name="Settings$WifiDisplaySettingsActivity"
             android:label="@string/wifi_display_settings_title"
diff --git a/res/xml/connected_devices_advanced.xml b/res/xml/connected_devices_advanced.xml
index 11e3288..df97043 100644
--- a/res/xml/connected_devices_advanced.xml
+++ b/res/xml/connected_devices_advanced.xml
@@ -47,14 +47,6 @@
         settings:keywords="@string/keywords_wifi_display_settings"/>
 
     <com.android.settingslib.RestrictedPreference
-        android:fragment="com.android.settings.nfc.AndroidBeam"
-        android:key="android_beam_settings"
-        android:title="@string/android_beam_settings_title"
-        settings:controller="com.android.settings.nfc.AndroidBeamPreferenceController"
-        android:icon="@drawable/ic_android"
-        android:order="-5"/>
-
-    <com.android.settingslib.RestrictedPreference
         android:key="connected_device_printing"
         android:title="@string/print_settings"
         android:summary="@string/summary_placeholder"
diff --git a/src/com/android/settings/Settings.java b/src/com/android/settings/Settings.java
index a8fa527..14d978b 100644
--- a/src/com/android/settings/Settings.java
+++ b/src/com/android/settings/Settings.java
@@ -331,7 +331,6 @@
     public static class ConfigureWifiSettingsActivity extends SettingsActivity { /* empty */ }
     public static class SavedAccessPointsSettingsActivity extends SettingsActivity { /* empty */ }
     public static class TextToSpeechSettingsActivity extends SettingsActivity { /* empty */ }
-    public static class AndroidBeamSettingsActivity extends SettingsActivity { /* empty */ }
     public static class WifiDisplaySettingsActivity extends SettingsActivity { /* empty */ }
     public static class DreamSettingsActivity extends SettingsActivity { /* empty */ }
     /** Activity to manage communal settings */
diff --git a/src/com/android/settings/connecteddevice/AdvancedConnectedDeviceDashboardFragment.java b/src/com/android/settings/connecteddevice/AdvancedConnectedDeviceDashboardFragment.java
index e2d92c7..8e230cb 100644
--- a/src/com/android/settings/connecteddevice/AdvancedConnectedDeviceDashboardFragment.java
+++ b/src/com/android/settings/connecteddevice/AdvancedConnectedDeviceDashboardFragment.java
@@ -17,12 +17,10 @@
 
 import android.app.settings.SettingsEnums;
 import android.content.Context;
-import android.content.pm.PackageManager;
 import android.provider.SearchIndexableResource;
 
 import com.android.settings.R;
 import com.android.settings.dashboard.DashboardFragment;
-import com.android.settings.nfc.AndroidBeamPreferenceController;
 import com.android.settings.print.PrintSettingPreferenceController;
 import com.android.settings.search.BaseSearchIndexProvider;
 import com.android.settings.uwb.UwbPreferenceController;
@@ -112,17 +110,6 @@
                 }
 
                 @Override
-                public List<String> getNonIndexableKeys(Context context) {
-                    final List<String> keys = super.getNonIndexableKeys(context);
-                    PackageManager pm = context.getPackageManager();
-                    if (!pm.hasSystemFeature(PackageManager.FEATURE_NFC)) {
-                        keys.add(AndroidBeamPreferenceController.KEY_ANDROID_BEAM_SETTINGS);
-                    }
-
-                    return keys;
-                }
-
-                @Override
                 public List<AbstractPreferenceController> createPreferenceControllers(
                         Context context) {
                     return buildControllers(context, null /* lifecycle */);
diff --git a/src/com/android/settings/core/gateway/SettingsGateway.java b/src/com/android/settings/core/gateway/SettingsGateway.java
index 149d1f4..ff4b47f 100644
--- a/src/com/android/settings/core/gateway/SettingsGateway.java
+++ b/src/com/android/settings/core/gateway/SettingsGateway.java
@@ -141,7 +141,6 @@
 import com.android.settings.network.telephony.MobileNetworkSettings;
 import com.android.settings.network.telephony.NetworkSelectSettings;
 import com.android.settings.network.tether.TetherSettings;
-import com.android.settings.nfc.AndroidBeam;
 import com.android.settings.nfc.PaymentSettings;
 import com.android.settings.notification.ConfigureNotificationSettings;
 import com.android.settings.notification.NotificationAccessSettings;
@@ -258,7 +257,6 @@
             PrivateVolumeForget.class.getName(),
             PublicVolumeSettings.class.getName(),
             DevelopmentSettingsDashboardFragment.class.getName(),
-            AndroidBeam.class.getName(),
             WifiDisplaySettings.class.getName(),
             PowerUsageSummary.class.getName(),
             AccountSyncSettings.class.getName(),
diff --git a/src/com/android/settings/nfc/AndroidBeam.java b/src/com/android/settings/nfc/AndroidBeam.java
deleted file mode 100644
index b1fcd57..0000000
--- a/src/com/android/settings/nfc/AndroidBeam.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * Copyright (C) 2011 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.nfc;
-
-import static com.android.settingslib.RestrictedLockUtils.EnforcedAdmin;
-
-import android.app.settings.SettingsEnums;
-import android.content.Context;
-import android.content.pm.PackageManager;
-import android.nfc.NfcAdapter;
-import android.os.Bundle;
-import android.os.UserHandle;
-import android.os.UserManager;
-import android.view.LayoutInflater;
-import android.view.Menu;
-import android.view.MenuInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.ImageView;
-import android.widget.Switch;
-import android.widget.TextView;
-
-import com.android.settings.R;
-import com.android.settings.SettingsActivity;
-import com.android.settings.core.InstrumentedFragment;
-import com.android.settings.enterprise.ActionDisabledByAdminDialogHelper;
-import com.android.settings.widget.SettingsMainSwitchBar;
-import com.android.settingslib.HelpUtils;
-import com.android.settingslib.RestrictedLockUtilsInternal;
-import com.android.settingslib.widget.OnMainSwitchChangeListener;
-
-public class AndroidBeam extends InstrumentedFragment
-        implements OnMainSwitchChangeListener {
-    private View mView;
-    private NfcAdapter mNfcAdapter;
-    private SettingsMainSwitchBar mSwitchBar;
-    private CharSequence mOldActivityTitle;
-    private boolean mBeamDisallowedByBase;
-    private boolean mBeamDisallowedByOnlyAdmin;
-
-    @Override
-    public void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-        final Context context = getActivity();
-        mNfcAdapter = NfcAdapter.getDefaultAdapter(context);
-        final PackageManager pm = context.getPackageManager();
-        if (mNfcAdapter == null || !pm.hasSystemFeature(PackageManager.FEATURE_NFC_BEAM))
-            getActivity().finish();
-        setHasOptionsMenu(true);
-    }
-
-    @Override
-    public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
-        super.onCreateOptionsMenu(menu, inflater);
-        HelpUtils.prepareHelpMenuItem(getActivity(), menu, R.string.help_uri_beam,
-                getClass().getName());
-    }
-
-    @Override
-    public View onCreateView(LayoutInflater inflater, ViewGroup container,
-            Bundle savedInstanceState) {
-        final EnforcedAdmin admin = RestrictedLockUtilsInternal.checkIfRestrictionEnforced(
-                getActivity(), UserManager.DISALLOW_OUTGOING_BEAM, UserHandle.myUserId());
-        final UserManager um = UserManager.get(getActivity());
-        mBeamDisallowedByBase = RestrictedLockUtilsInternal.hasBaseUserRestriction(getActivity(),
-                UserManager.DISALLOW_OUTGOING_BEAM, UserHandle.myUserId());
-        if (!mBeamDisallowedByBase && admin != null) {
-            new ActionDisabledByAdminDialogHelper(getActivity())
-                    .prepareDialogBuilder(UserManager.DISALLOW_OUTGOING_BEAM, admin).show();
-            mBeamDisallowedByOnlyAdmin = true;
-            return new View(getContext());
-        }
-        mView = inflater.inflate(R.layout.preference_footer, container, false);
-
-        ImageView iconInfo = mView.findViewById(android.R.id.icon);
-        iconInfo.setImageResource(R.drawable.ic_info_outline_24dp);
-        TextView textInfo = mView.findViewById(android.R.id.title);
-        textInfo.setText(R.string.android_beam_explained);
-
-        return mView;
-    }
-
-    @Override
-    public void onActivityCreated(Bundle savedInstanceState) {
-        super.onActivityCreated(savedInstanceState);
-        SettingsActivity activity = (SettingsActivity) getActivity();
-
-        mOldActivityTitle = activity.getActionBar().getTitle();
-
-        mSwitchBar = activity.getSwitchBar();
-        if (mBeamDisallowedByOnlyAdmin) {
-            mSwitchBar.hide();
-        } else {
-            mSwitchBar.setChecked(!mBeamDisallowedByBase && mNfcAdapter.isNdefPushEnabled());
-            mSwitchBar.addOnSwitchChangeListener(this);
-            mSwitchBar.setEnabled(!mBeamDisallowedByBase);
-            mSwitchBar.show();
-        }
-
-        activity.setTitle(R.string.android_beam_settings_title);
-    }
-
-    @Override
-    public void onDestroyView() {
-        super.onDestroyView();
-        if (mOldActivityTitle != null) {
-            getActivity().getActionBar().setTitle(mOldActivityTitle);
-        }
-        if (!mBeamDisallowedByOnlyAdmin) {
-            mSwitchBar.removeOnSwitchChangeListener(this);
-            mSwitchBar.hide();
-        }
-    }
-
-    @Override
-    public void onSwitchChanged(Switch switchView, boolean desiredState) {
-        boolean success = false;
-        mSwitchBar.setEnabled(false);
-        if (desiredState) {
-            success = mNfcAdapter.enableNdefPush();
-        } else {
-            success = mNfcAdapter.disableNdefPush();
-        }
-        if (success) {
-            mSwitchBar.setChecked(desiredState);
-        }
-        mSwitchBar.setEnabled(true);
-    }
-
-    @Override
-    public int getMetricsCategory() {
-        return SettingsEnums.NFC_BEAM;
-    }
-}
diff --git a/src/com/android/settings/nfc/AndroidBeamEnabler.java b/src/com/android/settings/nfc/AndroidBeamEnabler.java
deleted file mode 100644
index 31ef702..0000000
--- a/src/com/android/settings/nfc/AndroidBeamEnabler.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright (C) 2018 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.nfc;
-
-import android.content.Context;
-import android.nfc.NfcAdapter;
-import android.os.UserHandle;
-import android.os.UserManager;
-
-import com.android.settings.R;
-import com.android.settingslib.RestrictedLockUtilsInternal;
-import com.android.settingslib.RestrictedPreference;
-
-/**
- * AndroidBeanEnabler is a helper to manage the Android Beam preference. It turns on/off
- * Android Beam and ensures the summary of the preference reflects the current state.
- */
-public class AndroidBeamEnabler extends BaseNfcEnabler {
-    private final boolean mBeamDisallowedBySystem;
-    private final RestrictedPreference mPreference;
-
-    public AndroidBeamEnabler(Context context, RestrictedPreference preference) {
-        super(context);
-        mPreference = preference;
-        mBeamDisallowedBySystem = RestrictedLockUtilsInternal.hasBaseUserRestriction(context,
-                UserManager.DISALLOW_OUTGOING_BEAM, UserHandle.myUserId());
-        if (!isNfcAvailable()) {
-            // NFC is not supported
-            mPreference.setEnabled(false);
-            return;
-        }
-        if (mBeamDisallowedBySystem) {
-            mPreference.setEnabled(false);
-        }
-    }
-
-    @Override
-    protected void handleNfcStateChanged(int newState) {
-        switch (newState) {
-            case NfcAdapter.STATE_OFF:
-                mPreference.setEnabled(false);
-                mPreference.setSummary(R.string.nfc_disabled_summary);
-                break;
-            case NfcAdapter.STATE_ON:
-                if (mBeamDisallowedBySystem) {
-                    mPreference.setDisabledByAdmin(null);
-                    mPreference.setEnabled(false);
-                } else {
-                    mPreference.checkRestrictionAndSetDisabled(UserManager.DISALLOW_OUTGOING_BEAM);
-                }
-                if (mNfcAdapter.isNdefPushEnabled() && mPreference.isEnabled()) {
-                    mPreference.setSummary(R.string.android_beam_on_summary);
-                } else {
-                    mPreference.setSummary(R.string.android_beam_off_summary);
-                }
-                break;
-            case NfcAdapter.STATE_TURNING_ON:
-                mPreference.setEnabled(false);
-                break;
-            case NfcAdapter.STATE_TURNING_OFF:
-                mPreference.setEnabled(false);
-                break;
-        }
-    }
-}
diff --git a/src/com/android/settings/nfc/AndroidBeamPreferenceController.java b/src/com/android/settings/nfc/AndroidBeamPreferenceController.java
deleted file mode 100644
index 15c15aa..0000000
--- a/src/com/android/settings/nfc/AndroidBeamPreferenceController.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright (C) 2018 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.nfc;
-
-import android.content.Context;
-import android.content.pm.PackageManager;
-import android.nfc.NfcAdapter;
-
-import androidx.preference.PreferenceScreen;
-
-import com.android.settings.core.BasePreferenceController;
-import com.android.settingslib.RestrictedPreference;
-import com.android.settingslib.core.lifecycle.LifecycleObserver;
-import com.android.settingslib.core.lifecycle.events.OnPause;
-import com.android.settingslib.core.lifecycle.events.OnResume;
-
-public class AndroidBeamPreferenceController extends BasePreferenceController
-        implements LifecycleObserver, OnResume, OnPause {
-
-    public static final String KEY_ANDROID_BEAM_SETTINGS = "android_beam_settings";
-    private final NfcAdapter mNfcAdapter;
-    private AndroidBeamEnabler mAndroidBeamEnabler;
-
-    public AndroidBeamPreferenceController(Context context, String key) {
-        super(context, key);
-        mNfcAdapter = NfcAdapter.getDefaultAdapter(context);
-    }
-
-    @Override
-    public void displayPreference(PreferenceScreen screen) {
-        super.displayPreference(screen);
-        if (!isAvailable()) {
-            mAndroidBeamEnabler = null;
-            return;
-        }
-
-        final RestrictedPreference restrictedPreference = screen.findPreference(getPreferenceKey());
-        mAndroidBeamEnabler = new AndroidBeamEnabler(mContext, restrictedPreference);
-    }
-
-    @Override
-    @AvailabilityStatus
-    public int getAvailabilityStatus() {
-        PackageManager pm = mContext.getPackageManager();
-        if (!pm.hasSystemFeature(PackageManager.FEATURE_NFC_BEAM)) {
-            return UNSUPPORTED_ON_DEVICE;
-        }
-        return mNfcAdapter != null
-                ? AVAILABLE
-                : UNSUPPORTED_ON_DEVICE;
-    }
-
-    @Override
-    public void onResume() {
-        if (mAndroidBeamEnabler != null) {
-            mAndroidBeamEnabler.resume();
-        }
-    }
-
-    @Override
-    public void onPause() {
-        if (mAndroidBeamEnabler != null) {
-            mAndroidBeamEnabler.pause();
-        }
-    }
-}
diff --git a/tests/robotests/src/com/android/settings/connecteddevice/AdvancedConnectedDeviceDashboardFragmentTest.java b/tests/robotests/src/com/android/settings/connecteddevice/AdvancedConnectedDeviceDashboardFragmentTest.java
index aed3787..107d77c 100644
--- a/tests/robotests/src/com/android/settings/connecteddevice/AdvancedConnectedDeviceDashboardFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/connecteddevice/AdvancedConnectedDeviceDashboardFragmentTest.java
@@ -23,7 +23,6 @@
 import android.nfc.NfcAdapter;
 import android.provider.SearchIndexableResource;
 
-import com.android.settings.nfc.AndroidBeamPreferenceController;
 import com.android.settings.testutils.shadow.ShadowConnectivityManager;
 import com.android.settings.testutils.shadow.ShadowNfcAdapter;
 import com.android.settings.testutils.shadow.ShadowUserManager;
@@ -78,14 +77,4 @@
     public void testGetCategoryKey_returnCategoryDevice() {
         assertThat(mFragment.getCategoryKey()).isEqualTo(CategoryKey.CATEGORY_DEVICE);
     }
-
-    @Test
-    public void testSearchIndexProvider_correctNonIndexables() {
-        mShadowNfcAdapter.setSecureNfcSupported(true);
-        final List<String> niks =
-                AdvancedConnectedDeviceDashboardFragment.SEARCH_INDEX_DATA_PROVIDER
-                        .getNonIndexableKeys(mContext);
-
-        assertThat(niks).contains(AndroidBeamPreferenceController.KEY_ANDROID_BEAM_SETTINGS);
-    }
-}
\ No newline at end of file
+}
diff --git a/tests/robotests/src/com/android/settings/nfc/AndroidBeamPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/nfc/AndroidBeamPreferenceControllerTest.java
deleted file mode 100644
index 7e15618..0000000
--- a/tests/robotests/src/com/android/settings/nfc/AndroidBeamPreferenceControllerTest.java
+++ /dev/null
@@ -1,175 +0,0 @@
-/*
- * Copyright (C) 2018 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.nfc;
-
-import static com.google.common.truth.Truth.assertThat;
-
-import static org.mockito.Mockito.spy;
-import static org.mockito.Mockito.when;
-
-import android.content.Context;
-import android.content.pm.PackageManager;
-import android.nfc.NfcAdapter;
-import android.nfc.NfcManager;
-import android.os.UserHandle;
-import android.os.UserManager;
-import android.provider.Settings;
-
-import androidx.preference.PreferenceScreen;
-
-import com.android.settings.testutils.shadow.ShadowNfcAdapter;
-import com.android.settingslib.RestrictedLockUtilsInternal;
-import com.android.settingslib.RestrictedPreference;
-
-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.annotation.Config;
-import org.robolectric.shadow.api.Shadow;
-import org.robolectric.util.ReflectionHelpers;
-
-import java.util.ArrayList;
-import java.util.List;
-
-@RunWith(RobolectricTestRunner.class)
-@Config(shadows = ShadowNfcAdapter.class)
-public class AndroidBeamPreferenceControllerTest {
-
-    Context mContext;
-    @Mock
-    NfcManager mNfcManager;
-    @Mock
-    private UserManager mUserManager;
-    @Mock
-    private PreferenceScreen mScreen;
-    @Mock
-    private PackageManager mPackageManager;
-
-    private RestrictedPreference mAndroidBeamPreference;
-    private AndroidBeamPreferenceController mAndroidBeamController;
-    private ShadowNfcAdapter mShadowNfcAdapter;
-
-    @Before
-    public void setUp() {
-        MockitoAnnotations.initMocks(this);
-        mContext = spy(RuntimeEnvironment.application);
-        mShadowNfcAdapter = Shadow.extract(NfcAdapter.getDefaultAdapter(mContext));
-
-        when(mContext.getApplicationContext()).thenReturn(mContext);
-        when(mContext.getSystemService(Context.USER_SERVICE)).thenReturn(mUserManager);
-        when(mContext.getSystemService(Context.NFC_SERVICE)).thenReturn(mNfcManager);
-        when(RestrictedLockUtilsInternal.hasBaseUserRestriction(mContext,
-                UserManager.DISALLOW_OUTGOING_BEAM, UserHandle.myUserId())).thenReturn(false);
-
-        mAndroidBeamController = new AndroidBeamPreferenceController(mContext,
-                AndroidBeamPreferenceController.KEY_ANDROID_BEAM_SETTINGS);
-        mAndroidBeamPreference = new RestrictedPreference(RuntimeEnvironment.application);
-        when(mScreen.findPreference(mAndroidBeamController.getPreferenceKey())).thenReturn(
-                mAndroidBeamPreference);
-        when(mContext.getPackageManager()).thenReturn(mPackageManager);
-        when(mPackageManager.hasSystemFeature(PackageManager.FEATURE_NFC_BEAM)).thenReturn(true);
-
-        Settings.Global.putString(mContext.getContentResolver(),
-                Settings.Global.AIRPLANE_MODE_TOGGLEABLE_RADIOS,
-                Settings.Global.RADIO_NFC);
-        Settings.Global.putInt(mContext.getContentResolver(),
-                Settings.Global.AIRPLANE_MODE_ON,
-                0);
-        mAndroidBeamController.displayPreference(mScreen);
-    }
-
-    @Test
-    public void isAvailable_hasNfc_shouldReturnTrue() {
-        mShadowNfcAdapter.setEnabled(true);
-        assertThat(mAndroidBeamController.isAvailable()).isTrue();
-    }
-
-    @Test
-    public void isAvailable_noNfcFeature_shouldReturnFalse() {
-        mShadowNfcAdapter.setEnabled(true);
-        when(mPackageManager.hasSystemFeature(PackageManager.FEATURE_NFC_BEAM)).thenReturn(false);
-        assertThat(mAndroidBeamController.isAvailable()).isFalse();
-    }
-
-    @Test
-    public void isAvailable_noNfcAdapter_shouldReturnFalse() {
-        ReflectionHelpers.setField(mAndroidBeamController, "mNfcAdapter", null);
-        assertThat(mAndroidBeamController.isAvailable()).isFalse();
-    }
-
-    @Test
-    public void isBeamEnable_disAllowBeam_shouldReturnFalse() {
-        mShadowNfcAdapter.setAdapterState(NfcAdapter.STATE_OFF);
-
-        when(RestrictedLockUtilsInternal.hasBaseUserRestriction(mContext,
-                UserManager.DISALLOW_OUTGOING_BEAM, UserHandle.myUserId())).thenReturn(true);
-        mAndroidBeamController.displayPreference(mScreen);
-
-        assertThat(mAndroidBeamPreference.isEnabled()).isFalse();
-    }
-
-    @Test
-    public void isBeamEnable_nfcStateOn_shouldReturnTrue() {
-        mShadowNfcAdapter.setAdapterState(NfcAdapter.STATE_ON);
-        try {
-            mAndroidBeamController.onResume();
-        } catch (NullPointerException e) {
-            // skip because it's just test
-            // it will meet NullPointerException in checkRestrictionAndSetDisabled
-        }
-        assertThat(mAndroidBeamPreference.isEnabled()).isTrue();
-    }
-
-    @Test
-    public void isBeamEnable_nfcStateNotOn_shouldReturnFalse() {
-        mShadowNfcAdapter.setAdapterState(NfcAdapter.STATE_OFF);
-        mAndroidBeamController.onResume();
-        assertThat(mAndroidBeamPreference.isEnabled()).isFalse();
-
-        mShadowNfcAdapter.setAdapterState(NfcAdapter.STATE_TURNING_ON);
-        mAndroidBeamController.onResume();
-        assertThat(mAndroidBeamPreference.isEnabled()).isFalse();
-
-        mShadowNfcAdapter.setAdapterState(NfcAdapter.STATE_TURNING_OFF);
-        mAndroidBeamController.onResume();
-        assertThat(mAndroidBeamPreference.isEnabled()).isFalse();
-    }
-
-    @Test
-    public void updateNonIndexableKeys_available_shouldNotUpdate() {
-        mShadowNfcAdapter.setEnabled(true);
-        final List<String> keys = new ArrayList<>();
-
-        mAndroidBeamController.updateNonIndexableKeys(keys);
-
-        assertThat(keys).isEmpty();
-    }
-
-    @Test
-    public void updateNonIndexableKeys_notAvailable_shouldUpdate() {
-        ReflectionHelpers.setField(mAndroidBeamController, "mNfcAdapter", null);
-        final List<String> keys = new ArrayList<>();
-
-        mAndroidBeamController.updateNonIndexableKeys(keys);
-
-        assertThat(keys).hasSize(1);
-    }
-}
