OSDN Git Service

Remove all reference to SmsMirroring in Android Settings.
authorLeslie Watkins <lesliewatkins@google.com>
Sat, 10 Feb 2018 00:43:06 +0000 (16:43 -0800)
committerLeslie Watkins <lesliewatkins@google.com>
Mon, 12 Feb 2018 22:05:56 +0000 (22:05 +0000)
Test: Robotests

Change-Id: I3318c6915cae95522f09838f00a3c567fe9e5fc5

15 files changed:
res/drawable/ic_sms_mirroring_24dp.xml [deleted file]
res/values/strings.xml
res/xml/connected_devices_advanced.xml
res/xml/connected_devices_old.xml
src/com/android/settings/connecteddevice/AdvancedConnectedDeviceDashboardFragment.java
src/com/android/settings/connecteddevice/ConnectedDeviceDashboardFragmentOld.java
src/com/android/settings/connecteddevice/SmsMirroringFeatureProvider.java [deleted file]
src/com/android/settings/connecteddevice/SmsMirroringFeatureProviderImpl.java [deleted file]
src/com/android/settings/connecteddevice/SmsMirroringPreferenceController.java [deleted file]
src/com/android/settings/overlay/FeatureFactory.java
src/com/android/settings/overlay/FeatureFactoryImpl.java
tests/robotests/src/com/android/settings/connecteddevice/AdvancedConnectedDeviceDashboardFragmentTest.java
tests/robotests/src/com/android/settings/connecteddevice/ConnectedDeviceDashboardFragment2Test.java
tests/robotests/src/com/android/settings/testutils/FakeFeatureFactory.java
tests/unit/src/com/android/settings/core/UniquePreferenceTest.java

diff --git a/res/drawable/ic_sms_mirroring_24dp.xml b/res/drawable/ic_sms_mirroring_24dp.xml
deleted file mode 100644 (file)
index 5fe3003..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- 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.
--->
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
-        android:width="24dp"
-        android:height="24dp"
-        android:viewportWidth="24.0"
-        android:viewportHeight="24.0"
-        android:tint="?android:attr/colorControlNormal">
-    <path
-        android:fillColor="#FF000000"
-        android:pathData="M20,2C21.1,2 22,2.9 22,4L22,16C22,17.1 21.1,18 20,18L6,18L2,22L2.01,4C2.01,2.9 2.9,2 4,2L20,2ZM8,8L4,12L8,16L8,13L14,13L14,11L8,11L8,8ZM19.666,7.872L16.038,4.372L16.038,6.997L10,6.997L10,9L16.038,9L16.038,11.372L19.666,7.872Z"/>
-</vector>
index 72db253..b1278a6 100644 (file)
          and powering other device [CHAR LIMIT=NONE] -->
     <string name="usb_summary_MIDI_power">MIDI and supplying power</string>
 
-    <!-- Settings item title for SMS Mirroring preference [CHAR LIMIT=35] -->
-    <string name="sms_mirroring_pref">SMS Mirroring</string>
-
     <!-- Settings item title for background check prefs [CHAR LIMIT=35] -->
     <string name="background_check_pref">Background check</string>
 
index 83a63e4..4ad94c8 100644 (file)
         android:icon="@drawable/ic_android"
         android:order="-4"/>
 
-    <Preference
-        android:key="sms_mirroring"
-        android:title="@string/sms_mirroring_pref"
-        android:icon="@drawable/ic_sms_mirroring_24dp"
-        android:summary="@string/summary_placeholder"
-        android:order="-3"/>
-
     <SwitchPreference
         android:key="bluetooth_on_while_driving"
         android:title="@string/bluetooth_on_while_driving_pref"
index cc7b5b4..1b69fe1 100644 (file)
         android:order="-4"/>
 
     <Preference
-        android:key="sms_mirroring"
-        android:title="@string/sms_mirroring_pref"
-        android:icon="@drawable/ic_sms_mirroring_24dp"
-        android:summary="@string/summary_placeholder"
-        android:order="-3"/>
-
-    <Preference
         android:key="usb_mode"
         android:title="@string/usb_pref"
         android:icon="@drawable/ic_usb"
index 9ac6ebd..d8838f2 100644 (file)
@@ -81,11 +81,6 @@ public class AdvancedConnectedDeviceDashboardFragment extends DashboardFragment
         lifecycle.addObserver(bluetoothPreferenceController);
         controllers.add(bluetoothPreferenceController);
 
-        SmsMirroringFeatureProvider smsMirroringFeatureProvider =
-                FeatureFactory.getFactory(context).getSmsMirroringFeatureProvider();
-        AbstractPreferenceController smsMirroringController =
-                smsMirroringFeatureProvider.getController(context);
-        controllers.add(smsMirroringController);
         controllers.add(new BluetoothFilesPreferenceController(context));
         controllers.add(new BluetoothOnWhileDrivingPreferenceController(context));
         return controllers;
@@ -114,12 +109,6 @@ public class AdvancedConnectedDeviceDashboardFragment extends DashboardFragment
                     }
                     keys.add(BluetoothMasterSwitchPreferenceController.KEY_TOGGLE_BLUETOOTH);
 
-                    SmsMirroringFeatureProvider smsMirroringFeatureProvider =
-                            FeatureFactory.getFactory(context).getSmsMirroringFeatureProvider();
-                    SmsMirroringPreferenceController smsMirroringController =
-                            smsMirroringFeatureProvider.getController(context);
-                    smsMirroringController.updateNonIndexableKeys(keys);
-
                     return keys;
                 }
             };
index bde5e81..b732e1e 100644 (file)
@@ -90,11 +90,6 @@ public class ConnectedDeviceDashboardFragmentOld extends DashboardFragment {
         lifecycle.addObserver(bluetoothPreferenceController);
         controllers.add(bluetoothPreferenceController);
 
-        SmsMirroringFeatureProvider smsMirroringFeatureProvider =
-                FeatureFactory.getFactory(context).getSmsMirroringFeatureProvider();
-        AbstractPreferenceController smsMirroringController =
-                smsMirroringFeatureProvider.getController(context);
-        controllers.add(smsMirroringController);
         return controllers;
     }
 
@@ -157,12 +152,6 @@ public class ConnectedDeviceDashboardFragmentOld extends DashboardFragment {
                     }
                     keys.add(BluetoothMasterSwitchPreferenceController.KEY_TOGGLE_BLUETOOTH);
 
-                    SmsMirroringFeatureProvider smsMirroringFeatureProvider =
-                            FeatureFactory.getFactory(context).getSmsMirroringFeatureProvider();
-                    SmsMirroringPreferenceController smsMirroringController =
-                            smsMirroringFeatureProvider.getController(context);
-                    smsMirroringController.updateNonIndexableKeys(keys);
-
                     return keys;
                 }
             };
diff --git a/src/com/android/settings/connecteddevice/SmsMirroringFeatureProvider.java b/src/com/android/settings/connecteddevice/SmsMirroringFeatureProvider.java
deleted file mode 100644 (file)
index 9064c81..0000000
+++ /dev/null
@@ -1,28 +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.connecteddevice;
-
-import android.content.Context;
-
-public interface SmsMirroringFeatureProvider {
-
-    /** Returns whether to show SMS mirroring. */
-    boolean shouldShowSmsMirroring(Context context);
-
-    /** Returns a preference controller for SMS mirroring. */
-    SmsMirroringPreferenceController getController(Context context);
-}
diff --git a/src/com/android/settings/connecteddevice/SmsMirroringFeatureProviderImpl.java b/src/com/android/settings/connecteddevice/SmsMirroringFeatureProviderImpl.java
deleted file mode 100644 (file)
index c41d8f5..0000000
+++ /dev/null
@@ -1,31 +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.connecteddevice;
-
-import android.content.Context;
-
-public class SmsMirroringFeatureProviderImpl implements SmsMirroringFeatureProvider {
-    @Override
-    public boolean shouldShowSmsMirroring(Context context) {
-        return false;
-    }
-
-    @Override
-    public SmsMirroringPreferenceController getController(Context context) {
-        return new SmsMirroringPreferenceController(context);
-    }
-}
-
diff --git a/src/com/android/settings/connecteddevice/SmsMirroringPreferenceController.java b/src/com/android/settings/connecteddevice/SmsMirroringPreferenceController.java
deleted file mode 100644 (file)
index c293481..0000000
+++ /dev/null
@@ -1,45 +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.connecteddevice;
-
-import android.content.Context;
-
-import com.android.settings.core.PreferenceControllerMixin;
-import com.android.settings.overlay.FeatureFactory;
-import com.android.settingslib.core.AbstractPreferenceController;
-
-public class SmsMirroringPreferenceController extends AbstractPreferenceController
-        implements PreferenceControllerMixin {
-
-    static final String KEY_SMS_MIRRORING = "sms_mirroring";
-
-    private SmsMirroringFeatureProvider mFeatureProvider;
-
-    public SmsMirroringPreferenceController(Context context) {
-        super(context);
-        mFeatureProvider = FeatureFactory.getFactory(context).getSmsMirroringFeatureProvider();
-    }
-
-    @Override
-    public boolean isAvailable() {
-        return mFeatureProvider.shouldShowSmsMirroring(mContext);
-    }
-
-    @Override
-    public String getPreferenceKey() {
-        return KEY_SMS_MIRRORING;
-    }
-}
index 585a2c1..7cf437f 100644 (file)
@@ -24,7 +24,6 @@ import com.android.settings.R;
 import com.android.settings.accounts.AccountFeatureProvider;
 import com.android.settings.applications.ApplicationFeatureProvider;
 import com.android.settings.bluetooth.BluetoothFeatureProvider;
-import com.android.settings.connecteddevice.SmsMirroringFeatureProvider;
 import com.android.settings.dashboard.DashboardFeatureProvider;
 import com.android.settings.dashboard.suggestions.SuggestionFeatureProvider;
 import com.android.settings.enterprise.EnterprisePrivacyFeatureProvider;
@@ -103,8 +102,6 @@ public abstract class FeatureFactory {
 
     public abstract BluetoothFeatureProvider getBluetoothFeatureProvider(Context context);
 
-    public abstract SmsMirroringFeatureProvider getSmsMirroringFeatureProvider();
-
     public abstract SlicesFeatureProvider getSlicesFeatureProvider();
 
     public abstract AccountFeatureProvider getAccountFeatureProvider();
index 965bfb1..5fc8627 100644 (file)
@@ -29,8 +29,6 @@ import com.android.settings.applications.ApplicationFeatureProvider;
 import com.android.settings.applications.ApplicationFeatureProviderImpl;
 import com.android.settings.bluetooth.BluetoothFeatureProvider;
 import com.android.settings.bluetooth.BluetoothFeatureProviderImpl;
-import com.android.settings.connecteddevice.SmsMirroringFeatureProvider;
-import com.android.settings.connecteddevice.SmsMirroringFeatureProviderImpl;
 import com.android.settings.dashboard.DashboardFeatureProvider;
 import com.android.settings.dashboard.DashboardFeatureProviderImpl;
 import com.android.settings.dashboard.suggestions.SuggestionFeatureProvider;
@@ -75,7 +73,6 @@ public class FeatureFactoryImpl extends FeatureFactory {
     private AssistGestureFeatureProvider mAssistGestureFeatureProvider;
     private UserFeatureProvider mUserFeatureProvider;
     private BluetoothFeatureProvider mBluetoothFeatureProvider;
-    private SmsMirroringFeatureProvider mSmsMirroringFeatureProvider;
     private SlicesFeatureProvider mSlicesFeatureProvider;
     private AccountFeatureProvider mAccountFeatureProvider;
 
@@ -197,14 +194,6 @@ public class FeatureFactoryImpl extends FeatureFactory {
     }
 
     @Override
-    public SmsMirroringFeatureProvider getSmsMirroringFeatureProvider() {
-        if (mSmsMirroringFeatureProvider == null) {
-            mSmsMirroringFeatureProvider = new SmsMirroringFeatureProviderImpl();
-        }
-        return mSmsMirroringFeatureProvider;
-    }
-
-    @Override
     public SlicesFeatureProvider getSlicesFeatureProvider() {
         if (mSlicesFeatureProvider == null) {
             mSlicesFeatureProvider = new SlicesFeatureProviderImpl();
index 37ccb76..24cb9b3 100644 (file)
@@ -53,37 +53,15 @@ public class AdvancedConnectedDeviceDashboardFragmentTest {
     private PackageManager mManager;
 
     private FakeFeatureFactory mFeatureFactory;
-    private SmsMirroringFeatureProvider mFeatureProvider;
     private AdvancedConnectedDeviceDashboardFragment mFragment;
-    private TestSmsMirroringPreferenceController mSmsMirroringPreferenceController;
-
-    private static final class TestSmsMirroringPreferenceController
-            extends SmsMirroringPreferenceController implements PreferenceControllerMixin {
-
-        private boolean mIsAvailable;
-
-        public TestSmsMirroringPreferenceController(Context context) {
-            super(context);
-        }
-
-        @Override
-        public boolean isAvailable() {
-            return mIsAvailable;
-        }
-    }
 
     @Before
     public void setUp() {
         MockitoAnnotations.initMocks(this);
         mFeatureFactory = FakeFeatureFactory.setupForTest();
-        mFeatureProvider = mFeatureFactory.smsMirroringFeatureProvider;
 
         mFragment = new AdvancedConnectedDeviceDashboardFragment();
         when(mContext.getPackageManager()).thenReturn(mManager);
-
-        mSmsMirroringPreferenceController = new TestSmsMirroringPreferenceController(mContext);
-        when(mFeatureProvider.getController(mContext)).thenReturn(
-                mSmsMirroringPreferenceController);
     }
 
     @Test
@@ -124,30 +102,6 @@ public class AdvancedConnectedDeviceDashboardFragmentTest {
     }
 
     @Test
-    public void testSearchIndexProvider_NoSmsMirroring_KeyAdded() {
-        when(mFeatureProvider.shouldShowSmsMirroring(mContext)).thenReturn(false);
-        mSmsMirroringPreferenceController.mIsAvailable = false;
-
-        final List<String> keys = mFragment.SEARCH_INDEX_DATA_PROVIDER.getNonIndexableKeys(
-                mContext);
-
-        assertThat(keys).isNotNull();
-        assertThat(keys).contains(mSmsMirroringPreferenceController.getPreferenceKey());
-    }
-
-    @Test
-    public void testSearchIndexProvider_SmsMirroring_KeyNotAdded() {
-        when(mFeatureProvider.shouldShowSmsMirroring(mContext)).thenReturn(true);
-        mSmsMirroringPreferenceController.mIsAvailable = true;
-
-        final List<String> keys = mFragment.SEARCH_INDEX_DATA_PROVIDER.getNonIndexableKeys(
-                mContext);
-
-        assertThat(keys).isNotNull();
-        assertThat(keys).doesNotContain(mSmsMirroringPreferenceController.getPreferenceKey());
-    }
-
-    @Test
     public void testGetCategoryKey_returnCategoryDevice() {
         assertThat(mFragment.getCategoryKey()).isEqualTo(CategoryKey.CATEGORY_DEVICE);
     }
index 1bc8a1b..3eacd7a 100644 (file)
@@ -60,37 +60,15 @@ public class ConnectedDeviceDashboardFragment2Test {
     private PackageManager mManager;
 
     private FakeFeatureFactory mFeatureFactory;
-    private SmsMirroringFeatureProvider mFeatureProvider;
     private ConnectedDeviceDashboardFragmentOld mFragment;
-    private TestSmsMirroringPreferenceController mSmsMirroringPreferenceController;
-
-    private static final class TestSmsMirroringPreferenceController
-            extends SmsMirroringPreferenceController implements PreferenceControllerMixin {
-
-        private boolean mIsAvailable;
-
-        public TestSmsMirroringPreferenceController(Context context) {
-            super(context);
-        }
-
-        @Override
-        public boolean isAvailable() {
-            return mIsAvailable;
-        }
-    }
 
     @Before
     public void setUp() {
         MockitoAnnotations.initMocks(this);
         mFeatureFactory = FakeFeatureFactory.setupForTest();
-        mFeatureProvider = mFeatureFactory.smsMirroringFeatureProvider;
 
         mFragment = new ConnectedDeviceDashboardFragmentOld();
         when(mContext.getPackageManager()).thenReturn(mManager);
-
-        mSmsMirroringPreferenceController = new TestSmsMirroringPreferenceController(mContext);
-        when(mFeatureProvider.getController(mContext)).thenReturn(
-                mSmsMirroringPreferenceController);
     }
 
     @Test
@@ -131,30 +109,6 @@ public class ConnectedDeviceDashboardFragment2Test {
     }
 
     @Test
-    public void testSearchIndexProvider_NoSmsMirroring_KeyAdded() {
-        when(mFeatureProvider.shouldShowSmsMirroring(mContext)).thenReturn(false);
-        mSmsMirroringPreferenceController.mIsAvailable = false;
-
-        final List<String> keys = mFragment.SEARCH_INDEX_DATA_PROVIDER.getNonIndexableKeys(
-                mContext);
-
-        assertThat(keys).isNotNull();
-        assertThat(keys).contains(mSmsMirroringPreferenceController.getPreferenceKey());
-    }
-
-    @Test
-    public void testSearchIndexProvider_SmsMirroring_KeyNotAdded() {
-        when(mFeatureProvider.shouldShowSmsMirroring(mContext)).thenReturn(true);
-        mSmsMirroringPreferenceController.mIsAvailable = true;
-
-        final List<String> keys = mFragment.SEARCH_INDEX_DATA_PROVIDER.getNonIndexableKeys(
-                mContext);
-
-        assertThat(keys).isNotNull();
-        assertThat(keys).doesNotContain(mSmsMirroringPreferenceController.getPreferenceKey());
-    }
-
-    @Test
     public void testNonIndexableKeys_existInXmlLayout() {
         final Context context = RuntimeEnvironment.application;
         when(mManager.hasSystemFeature(PackageManager.FEATURE_NFC)).thenReturn(false);
index 57244c1..6011640 100644 (file)
@@ -24,7 +24,6 @@ import android.content.Context;
 import com.android.settings.accounts.AccountFeatureProvider;
 import com.android.settings.applications.ApplicationFeatureProvider;
 import com.android.settings.bluetooth.BluetoothFeatureProvider;
-import com.android.settings.connecteddevice.SmsMirroringFeatureProvider;
 import com.android.settings.dashboard.DashboardFeatureProvider;
 import com.android.settings.dashboard.suggestions.SuggestionFeatureProvider;
 import com.android.settings.enterprise.EnterprisePrivacyFeatureProvider;
@@ -61,7 +60,6 @@ public class FakeFeatureFactory extends FeatureFactory {
     public final UserFeatureProvider userFeatureProvider;
     public final AssistGestureFeatureProvider assistGestureFeatureProvider;
     public final BluetoothFeatureProvider bluetoothFeatureProvider;
-    public final SmsMirroringFeatureProvider smsMirroringFeatureProvider;
     public final SlicesFeatureProvider slicesFeatureProvider;
     public SearchFeatureProvider searchFeatureProvider;
     public final AccountFeatureProvider mAccountFeatureProvider;
@@ -101,7 +99,6 @@ public class FakeFeatureFactory extends FeatureFactory {
         userFeatureProvider = mock(UserFeatureProvider.class);
         assistGestureFeatureProvider = mock(AssistGestureFeatureProvider.class);
         bluetoothFeatureProvider = mock(BluetoothFeatureProvider.class);
-        smsMirroringFeatureProvider = mock(SmsMirroringFeatureProvider.class);
         slicesFeatureProvider = mock(SlicesFeatureProvider.class);
         mAccountFeatureProvider = mock(AccountFeatureProvider.class);
     }
@@ -177,11 +174,6 @@ public class FakeFeatureFactory extends FeatureFactory {
     }
 
     @Override
-    public SmsMirroringFeatureProvider getSmsMirroringFeatureProvider() {
-        return smsMirroringFeatureProvider;
-    }
-
-    @Override
     public SlicesFeatureProvider getSlicesFeatureProvider() {
         return slicesFeatureProvider;
     }
index 3daecce..aa1b55f 100644 (file)
@@ -74,7 +74,6 @@ public class UniquePreferenceTest {
             "toggle_bluetooth",
             "toggle_nfc",
             "android_beam_settings",
-            "sms_mirroring",
             // Dup keys from About Phone v2 experiment.
             "ims_reg_state",
             "bt_address",