Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d33dcf13 authored by Oren Blasberg's avatar Oren Blasberg
Browse files

Settings: Add SMS Mirroring.

Bug: 37546615

Test: Updated Robolectric suite with new unit tests.

Change-Id: I02e1723e1b125b004ff679d6242df14bca4f08ce
parent 84040fdb
Loading
Loading
Loading
Loading
+26 −0
Original line number Diff line number Diff line
<?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="M9.01,14L2,14v2h7.01v3L13,15l-3.99,-4v3zM14.99,13v-3L22,10L22,8h-7.01L14.99,5L11,9l3.99,4z"/>
</vector>
+3 −0
Original line number Diff line number Diff line
@@ -7747,6 +7747,9 @@
    <!-- Settings item summary for USB preference when set to entering MIDI mode [CHAR LIMIT=NONE] -->
    <string name="usb_summary_MIDI">Using device as MIDI</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>
+8 −2
Original line number Diff line number Diff line
@@ -38,11 +38,17 @@
        android:icon="@drawable/ic_android"
        android:order="-4"/>

    <Preference
        android:key="sms_mirroring"
        android:title="@string/sms_mirroring_pref"
        android:icon="@drawable/ic_compare_arrows_24dp"
        android:order="-3"/>

    <Preference
        android:key="usb_mode"
        android:title="@string/usb_pref"
        android:icon="@drawable/ic_usb"
        android:order="-3">
        android:order="-2">
        <intent android:action="android.intent.action.MAIN"
                android:targetPackage="com.android.settings"
                android:targetClass="com.android.settings.deviceinfo.UsbModeChooserActivity"/>
+14 −0
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@ import com.android.settings.dashboard.DashboardFragment;
import com.android.settings.dashboard.SummaryLoader;
import com.android.settings.deviceinfo.UsbBackend;
import com.android.settings.nfc.NfcPreferenceController;
import com.android.settings.overlay.FeatureFactory;
import com.android.settings.search.BaseSearchIndexProvider;
import com.android.settings.search.Indexable;
import com.android.settingslib.core.AbstractPreferenceController;
@@ -81,6 +82,12 @@ public class ConnectedDeviceDashboardFragment extends DashboardFragment {
                        (SettingsActivity) getActivity());
        lifecycle.addObserver(bluetoothPreferenceController);
        controllers.add(bluetoothPreferenceController);

        SmsMirroringFeatureProvider smsMirroringFeatureProvider =
                FeatureFactory.getFactory(context).getSmsMirroringFeatureProvider();
        AbstractPreferenceController smsMirroringController =
                smsMirroringFeatureProvider.getController(context);
        controllers.add(smsMirroringController);
        return controllers;
    }

@@ -143,6 +150,13 @@ public class ConnectedDeviceDashboardFragment extends DashboardFragment {
                        keys.add(NfcPreferenceController.KEY_ANDROID_BEAM_SETTINGS);
                    }
                    keys.add(BluetoothMasterSwitchPreferenceController.KEY_TOGGLE_BLUETOOTH);

                    SmsMirroringFeatureProvider smsMirroringFeatureProvider =
                            FeatureFactory.getFactory(context).getSmsMirroringFeatureProvider();
                    SmsMirroringPreferenceController smsMirroringController =
                            smsMirroringFeatureProvider.getController(context);
                    smsMirroringController.updateNonIndexableKeys(keys);

                    return keys;
                }
            };
+28 −0
Original line number Diff line number Diff line
/*
 * 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);
}
Loading