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

Commit cda7efb9 authored by Zoey Chen's avatar Zoey Chen
Browse files

[Provider Model] Implement Calls & SMS controller

Screenshot of Provider Model:
Single SIM:
https://screenshot.googleplex.com/4pGBU7XK55CwJ7o.png
Dual SIM:
https://screenshot.googleplex.com/bXaFjsfGkgyHoYF.png

Screenshot of current: https://screenshot.googleplex.com/BtCgYmnpvT97SQs.png

Doc: https://docs.google.com/presentation/d/1azrZVS54pxM2lt9LkZHtFh_6W3fyDw_kTTPVQ_mJCi4/edit#slide=id.g9c7123c172_0_448

New controller: NetworkProviderCallsSmsController

Bug: 172053880
Test: manual
Change-Id: I86e9fc71d2b8562d838c5b5c6bd9c443656e2624
parent 1ad41f5b
Loading
Loading
Loading
Loading
+30 −0
Original line number Diff line number Diff line
<!--
    Copyright (C) 2020 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"
    android:viewportHeight="24"
    android:tint="?android:attr/colorControlNormal">
    <path
        android:fillColor="@android:color/white"
        android:pathData="M15.2,18.21c1.21,0.41 2.48,0.67 3.8,0.76v-1.5c-0.88,-0.07 -1.75,-0.22 -2.6,-0.45l-1.2,1.19zM6.54,5h-1.5c0.09,1.32 0.35,2.59 0.75,3.79l1.2,-1.21c-0.24,-0.83 -0.39,-1.7 -0.45,-2.58zM14,8h5V5h-5z"
        android:strokeAlpha="0.3"
        android:fillAlpha="0"/>
    <path
        android:fillColor="@android:color/white"
        android:pathData="M20,15.5c-1.25,0 -2.45,-0.2 -3.57,-0.57 -0.1,-0.03 -0.21,-0.05 -0.31,-0.05 -0.26,0 -0.51,0.1 -0.71,0.29l-2.2,2.2c-2.83,-1.44 -5.15,-3.75 -6.59,-6.58l2.2,-2.21c0.28,-0.27 0.36,-0.66 0.25,-1.01C8.7,6.45 8.5,5.25 8.5,4c0,-0.55 -0.45,-1 -1,-1L4,3c-0.55,0 -1,0.45 -1,1 0,9.39 7.61,17 17,17 0.55,0 1,-0.45 1,-1v-3.5c0,-0.55 -0.45,-1 -1,-1zM5.03,5h1.5c0.07,0.88 0.22,1.75 0.46,2.59L5.79,8.8c-0.41,-1.21 -0.67,-2.48 -0.76,-3.8zM19,18.97c-1.32,-0.09 -2.6,-0.35 -3.8,-0.76l1.2,-1.2c0.85,0.24 1.72,0.39 2.6,0.45v1.51zM12,3v10l3,-3h6L21,3h-9zM19,8h-5L14,5h5v3z"/>
</vector>
 No newline at end of file
+25 −0
Original line number Diff line number Diff line
<!--
  ~ Copyright (C) 2020 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,2L4,2c-1.1,0 -1.99,0.9 -1.99,2L2,22l4,-4h14c1.1,0 2,-0.9 2,-2L22,4c0,-1.1 -0.9,-2 -2,-2zM9,11L7,11L7,9h2v2zM13,11h-2L11,9h2v2zM17,11h-2L15,9h2v2z"/>
</vector>
 No newline at end of file
+2 −2
Original line number Diff line number Diff line
@@ -12447,9 +12447,9 @@
    <!-- Provider Model: Name for call settings category [CHAR LIMIT=NONE] -->
    <string name="calls_and_sms_category">Wi\u2011Fi Calling</string>
    <!-- Provider Model: Summary for calling preference -->
    <string name="calls_sms_wfc_summary">Make and receive calls over non-carrier networks like Wi\u2011Fi</string>
    <string name="calls_sms_wfc_summary">Make and receive calls over non\u2011carrier networks like Wi\u2011Fi</string>
    <!-- Provider Model: Label for footnote on calling preference -->
    <string name="calls_sms_footnote">Wi-Fi calling allows you to make and receive calls over non-carrier networks such as some Wi\u2011Fi networks.\n\nCross-SIM calling allows you to leverage the mobile data of a SIM to make and receive calls from another SIM.</string>
    <string name="calls_sms_footnote">Wi\u2011Fi calling allows you to make and receive calls over non\u2011carrier networks such as some Wi\u2011Fi networks.</string>
    <!-- Provider Model: Calls preference title -->
    <string name="calls_preference_title">Calls</string>
    <!-- Provider Model: SMS preference title -->
+3 −1
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@
        android:title="@string/calls_preference_title"
        settings:controller="com.android.settings.network.telephony.CallsDefaultSubscriptionController"
        android:order="10"
        android:icon="@drawable/ic_phone"
        />

    <ListPreference
@@ -32,13 +33,14 @@
        android:title="@string/sms_preference_title"
        settings:controller="com.android.settings.network.telephony.SmsDefaultSubscriptionController"
        android:order="15"
        android:icon="@drawable/ic_sms"
        />

    <PreferenceCategory
        android:key="provider_model_calling_category"
        android:title="@string/calls_and_sms_category"
        android:order="20"
        settings:controller="com.android.settings.network.telephony.CallingPreferenceCategoryController"
        settings:controller="com.android.settings.network.telephony.NetworkProviderWifiCallingPreferenceController"
        settings:allowDividerAbove="true"
        />

+10 −9
Original line number Diff line number Diff line
@@ -21,13 +21,13 @@ import android.app.Dialog;
import android.app.settings.SettingsEnums;
import android.content.Context;
import android.os.Bundle;
import android.util.FeatureFlagUtils;
import android.util.Log;

import androidx.appcompat.app.AlertDialog;
import androidx.fragment.app.Fragment;

import com.android.settings.R;
import com.android.settings.Utils;
import com.android.settings.dashboard.DashboardFragment;
import com.android.settings.network.MobilePlanPreferenceController.MobilePlanPreferenceHost;
import com.android.settings.search.BaseSearchIndexProvider;
@@ -58,7 +58,7 @@ public class NetworkDashboardFragment extends DashboardFragment implements

    @Override
    protected int getPreferenceScreenResId() {
        if (isProviderModelEnabled(getContext())) {
        if (Utils.isProviderModelEnabled(getContext())) {
            return R.xml.network_provider_internet;
        } else {
            return R.xml.network_and_internet;
@@ -69,7 +69,7 @@ public class NetworkDashboardFragment extends DashboardFragment implements
    public void onAttach(Context context) {
        super.onAttach(context);

        if (!isProviderModelEnabled(context)) {
        if (!Utils.isProviderModelEnabled(context)) {
            use(MultiNetworkHeaderController.class).init(getSettingsLifecycle());
        }
        use(AirplaneModePreferenceController.class).setFragment(this);
@@ -104,13 +104,15 @@ public class NetworkDashboardFragment extends DashboardFragment implements
        final MobilePlanPreferenceController mobilePlanPreferenceController =
                new MobilePlanPreferenceController(context, mobilePlanHost);
        final WifiPrimarySwitchPreferenceController wifiPreferenceController =
                isProviderModelEnabled(context)
                Utils.isProviderModelEnabled(context)
                        ? null
                        : new WifiPrimarySwitchPreferenceController(
                                context,
                                metricsFeatureProvider);
        final InternetPreferenceController internetPreferenceController =
                isProviderModelEnabled(context) ? new InternetPreferenceController(context) : null;
                Utils.isProviderModelEnabled(context)
                        ? new InternetPreferenceController(context)
                        : null;

        final VpnPreferenceController vpnPreferenceController =
                new VpnPreferenceController(context);
@@ -143,6 +145,9 @@ public class NetworkDashboardFragment extends DashboardFragment implements
            controllers.add(internetPreferenceController);
        }
        controllers.add(privateDnsPreferenceController);
        if (Utils.isProviderModelEnabled(context)) {
            controllers.add(new NetworkProviderCallsSmsController(context, lifecycle));
        }
        return controllers;
    }

@@ -187,8 +192,4 @@ public class NetworkDashboardFragment extends DashboardFragment implements
                            null /* mobilePlanHost */);
                }
            };

    private static boolean isProviderModelEnabled(Context context) {
        return FeatureFlagUtils.isEnabled(context, FeatureFlagUtils.SETTINGS_PROVIDER_MODEL);
    }
}
Loading