+++ /dev/null
-<?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>
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>
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"
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"
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;
}
keys.add(BluetoothMasterSwitchPreferenceController.KEY_TOGGLE_BLUETOOTH);
- SmsMirroringFeatureProvider smsMirroringFeatureProvider =
- FeatureFactory.getFactory(context).getSmsMirroringFeatureProvider();
- SmsMirroringPreferenceController smsMirroringController =
- smsMirroringFeatureProvider.getController(context);
- smsMirroringController.updateNonIndexableKeys(keys);
-
return keys;
}
};
lifecycle.addObserver(bluetoothPreferenceController);
controllers.add(bluetoothPreferenceController);
- SmsMirroringFeatureProvider smsMirroringFeatureProvider =
- FeatureFactory.getFactory(context).getSmsMirroringFeatureProvider();
- AbstractPreferenceController smsMirroringController =
- smsMirroringFeatureProvider.getController(context);
- controllers.add(smsMirroringController);
return controllers;
}
}
keys.add(BluetoothMasterSwitchPreferenceController.KEY_TOGGLE_BLUETOOTH);
- SmsMirroringFeatureProvider smsMirroringFeatureProvider =
- FeatureFactory.getFactory(context).getSmsMirroringFeatureProvider();
- SmsMirroringPreferenceController smsMirroringController =
- smsMirroringFeatureProvider.getController(context);
- smsMirroringController.updateNonIndexableKeys(keys);
-
return keys;
}
};
+++ /dev/null
-/*
- * 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);
-}
+++ /dev/null
-/*
- * 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);
- }
-}
-
+++ /dev/null
-/*
- * 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;
- }
-}
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;
public abstract BluetoothFeatureProvider getBluetoothFeatureProvider(Context context);
- public abstract SmsMirroringFeatureProvider getSmsMirroringFeatureProvider();
-
public abstract SlicesFeatureProvider getSlicesFeatureProvider();
public abstract AccountFeatureProvider getAccountFeatureProvider();
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;
private AssistGestureFeatureProvider mAssistGestureFeatureProvider;
private UserFeatureProvider mUserFeatureProvider;
private BluetoothFeatureProvider mBluetoothFeatureProvider;
- private SmsMirroringFeatureProvider mSmsMirroringFeatureProvider;
private SlicesFeatureProvider mSlicesFeatureProvider;
private AccountFeatureProvider mAccountFeatureProvider;
}
@Override
- public SmsMirroringFeatureProvider getSmsMirroringFeatureProvider() {
- if (mSmsMirroringFeatureProvider == null) {
- mSmsMirroringFeatureProvider = new SmsMirroringFeatureProviderImpl();
- }
- return mSmsMirroringFeatureProvider;
- }
-
- @Override
public SlicesFeatureProvider getSlicesFeatureProvider() {
if (mSlicesFeatureProvider == null) {
mSlicesFeatureProvider = new SlicesFeatureProviderImpl();
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
}
@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);
}
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
}
@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);
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;
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;
userFeatureProvider = mock(UserFeatureProvider.class);
assistGestureFeatureProvider = mock(AssistGestureFeatureProvider.class);
bluetoothFeatureProvider = mock(BluetoothFeatureProvider.class);
- smsMirroringFeatureProvider = mock(SmsMirroringFeatureProvider.class);
slicesFeatureProvider = mock(SlicesFeatureProvider.class);
mAccountFeatureProvider = mock(AccountFeatureProvider.class);
}
}
@Override
- public SmsMirroringFeatureProvider getSmsMirroringFeatureProvider() {
- return smsMirroringFeatureProvider;
- }
-
- @Override
public SlicesFeatureProvider getSlicesFeatureProvider() {
return slicesFeatureProvider;
}
"toggle_bluetooth",
"toggle_nfc",
"android_beam_settings",
- "sms_mirroring",
// Dup keys from About Phone v2 experiment.
"ims_reg_state",
"bt_address",