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

Commit bb57ad91 authored by Arne Coucheron's avatar Arne Coucheron
Browse files

Revert "Settings: add enhanced Wi-Fi Calling menu"

This reverts commit 4bbee19c.

Change-Id: I8ae0c410e5b0f3c6581ccb1e49bd61a1e5ddb9f5
parent b3e77e2f
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -29,8 +29,6 @@ LOCAL_MODULE_TAGS := optional
LOCAL_SRC_FILES := \
        $(call all-java-files-under, src) \
        src/com/android/settings/EventLogTags.logtags
LOCAL_SRC_FILES += src/org/codeaurora/wfcservice/IWFCService.aidl \
                   src/org/codeaurora/wfcservice/IWFCServiceCB.aidl

LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res \
    frameworks/support/v7/preference/res \
+0 −12
Original line number Diff line number Diff line
@@ -29,18 +29,6 @@
        settings:keywords="@string/keywords_wifi_calling"
        android:fragment="com.android.settings.WifiCallingSettings" />

    <PreferenceScreen
        android:key="wifi_calling_enhanced_settings"
        android:title="@string/wifi_calling_settings_title"
        android:summaryOff="@null"
        android:summaryOn="@null"
        android:persistent="false">
        <intent
            android:action="android.intent.action.MAIN"
            android:targetPackage="com.qualcomm.qti.wfcservice"
            android:targetClass="com.qualcomm.qti.wfcservice.WifiCallingEnhancedSettings" />
    </PreferenceScreen>

    <com.android.settingslib.RestrictedPreference
        android:fragment="com.android.settings.TetherSettings"
        android:key="tether_settings"
+3 −102
Original line number Diff line number Diff line
@@ -58,12 +58,6 @@ import com.android.settings.search.BaseSearchIndexProvider;
import com.android.settings.search.Indexable;
import com.android.settingslib.RestrictedLockUtils;
import com.android.settingslib.RestrictedPreference;
import org.codeaurora.wfcservice.IWFCService;
import org.codeaurora.wfcservice.IWFCServiceCB;

import android.content.ServiceConnection;
import android.os.IBinder;
import android.os.RemoteException;

import java.util.ArrayList;
import java.util.Arrays;
@@ -72,7 +66,6 @@ import java.util.List;

public class WirelessSettings extends SettingsPreferenceFragment implements Indexable {
    private static final String TAG = "WirelessSettings";
    private static final boolean DEBUG = true;

    private static final String KEY_TOGGLE_AIRPLANE = "toggle_airplane";
    private static final String KEY_TOGGLE_NFC = "toggle_nfc";
@@ -84,7 +77,6 @@ public class WirelessSettings extends SettingsPreferenceFragment implements Inde
    private static final String KEY_MOBILE_NETWORK_SETTINGS = "mobile_network_settings";
    private static final String KEY_MANAGE_MOBILE_PLAN = "manage_mobile_plan";
    private static final String KEY_WFC_SETTINGS = "wifi_calling_settings";
    private static final String KEY_WFC_ENHANCED_SETTINGS = "wifi_calling_enhanced_settings";

    private static final String KEY_NETWORK_RESET = "network_reset";
    private static final String KEY_NFC_CATEGORY_SETTINGS = "nfc_category_settings";
@@ -112,69 +104,6 @@ public class WirelessSettings extends SettingsPreferenceFragment implements Inde
    private static final String SAVED_MANAGE_MOBILE_PLAN_MSG = "mManageMobilePlanMessage";

    private PreferenceScreen mButtonWfc;
    private boolean mEnhancedWFCSettingsEnabled = false;

    private IWFCService mWFCService;

    private ServiceConnection mConnection = new ServiceConnection() {

        public void onServiceConnected(ComponentName className, IBinder service) {
            Log.i(TAG, "AIDLExample connect service");
            mWFCService = IWFCService.Stub.asInterface(service);
            try {
                mWFCService.registerCallback(mCallback);
            } catch (RemoteException re) {
            }
        }

        public void onServiceDisconnected(ComponentName className) {
            Log.i(TAG, " AIDLExample disconnect service");
            mWFCService = null;
        }
    };

    private IWFCServiceCB mCallback = new IWFCServiceCB.Stub() {
        public void updateWFCMessage(String s) {
            if (!mEnhancedWFCSettingsEnabled || (s == null)) {
                if(DEBUG) Log.e(TAG, "updateWFCMessage fail.");
                return ;
            }
            getActivity().runOnUiThread(new Runnable() {
                public void run() {
                    if(DEBUG) Log.d (TAG, "new UI thread.");
                    mButtonWfc.setSummary(s);
                }
            });

        }
    };

    private void updateCallback() {
        Log.i(TAG, "call back from settings is called");
    }

    private void unbindWFCService() {
        if (!mEnhancedWFCSettingsEnabled) {
            return;
        }
        if (mWFCService != null) {
            try {
                Log.d(TAG, "WFCService unbindService");
                mWFCService.unregisterCallback(mCallback);
            } catch (RemoteException e) {
                Log.e(TAG, "WFCService unregister error " + e);
            }
        }

        getActivity().unbindService(mConnection);
        Log.d(TAG, "WFCService unbind error ");
    }

    @Override
    public void onDestroy() {
        unbindWFCService();
        super.onDestroy();
    }

    private static final String VOICE_OVER_LTE = "voice_over_lte";
    private SwitchPreference mVoLtePreference;
@@ -357,23 +286,7 @@ public class WirelessSettings extends SettingsPreferenceFragment implements Inde
        mAirplaneModeEnabler = new AirplaneModeEnabler(activity, mAirplaneModePreference);
        mNfcEnabler = new NfcEnabler(activity, nfc, androidBeam, nfcPayment);

        mEnhancedWFCSettingsEnabled = getActivity().getResources().getBoolean(
                    R.bool.wifi_call_enhanced_setting);
        if (mEnhancedWFCSettingsEnabled) {
            mButtonWfc = (PreferenceScreen) findPreference(KEY_WFC_ENHANCED_SETTINGS);
            removePreference(KEY_WFC_SETTINGS);
        } else {
        mButtonWfc = (PreferenceScreen) findPreference(KEY_WFC_SETTINGS);
            removePreference(KEY_WFC_ENHANCED_SETTINGS);
        }

        if (mEnhancedWFCSettingsEnabled) {
            //bind WFC service
            final Intent intentWfc = new Intent();
            intentWfc.setAction("com.qualcomm.qti.wfcservice.IWFCService");
            intentWfc.setPackage("com.qualcomm.qti.wfcservice");
            activity.bindService(intentWfc, mConnection, Context.BIND_AUTO_CREATE);
        }

        String toggleable = Settings.Global.getString(activity.getContentResolver(),
                Settings.Global.AIRPLANE_MODE_TOGGLEABLE_RADIOS);
@@ -529,28 +442,16 @@ public class WirelessSettings extends SettingsPreferenceFragment implements Inde
            mNfcEnabler.resume();
        }

        // update Wi-Fi Calling setting
        // update WFC setting
        final Context context = getActivity();
        if (ImsManager.isWfcEnabledByPlatform(context) &&
                ImsManager.isWfcProvisionedOnDevice(context)) {
            getPreferenceScreen().addPreference(mButtonWfc);

            if (!mEnhancedWFCSettingsEnabled) {
                mButtonWfc.setSummary(WifiCallingSettings.getWfcModeSummary(
                        context, ImsManager.getWfcMode(context)));
            } else {
                if (!ImsManager.isWfcEnabledByUser(context)) {
                    mButtonWfc.setSummary(R.string.disabled);
                } else {
                    mButtonWfc.setSummary(SystemProperties.get("sys.wificall.status.msg"));
                }
            }

            mButtonWfc.setSummary(WifiCallingSettings.getWfcModeSummary(
                    context, ImsManager.getWfcMode(context, mTm.isNetworkRoaming())));
        } else {
            log("WFC not supported. Remove WFC menu");
            if (mButtonWfc != null) getPreferenceScreen().removePreference(mButtonWfc);
            removePreference(KEY_WFC_SETTINGS);
        }
        RestrictedPreference broadcastSettingsPref = (RestrictedPreference) findPreference(
                KEY_CELL_BROADCAST_SETTINGS);
+0 −39
Original line number Diff line number Diff line
/**
 * Copyright (c) 2016, The Linux Foundation. All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are
 * met:
 * * Redistributions of source code must retain the above copyright
 * notice, this list of conditions and the following disclaimer.
 * * Redistributions in binary form must reproduce the above
 * copyright notice, this list of conditions and the following
 * disclaimer in the documentation and/or other materials provided
 * with the distribution.
 * * Neither the name of The Linux Foundation nor the names of its
 * contributors may be used to endorse or promote products derived
 * from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 **/
package org.codeaurora.wfcservice;
import org.codeaurora.wfcservice.IWFCServiceCB;

/**
 * WFC service interface.
 */
interface IWFCService {
    void registerCallback(IWFCServiceCB cb);
    void unregisterCallback(IWFCServiceCB cb);
}
+0 −37
Original line number Diff line number Diff line
/**
 * Copyright (c) 2016, The Linux Foundation. All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are
 * met:
 * * Redistributions of source code must retain the above copyright
 * notice, this list of conditions and the following disclaimer.
 * * Redistributions in binary form must reproduce the above
 * copyright notice, this list of conditions and the following
 * disclaimer in the documentation and/or other materials provided
 * with the distribution.
 * * Neither the name of The Linux Foundation nor the names of its
 * contributors may be used to endorse or promote products derived
 * from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 **/
package org.codeaurora.wfcservice;

/**
 * Presence service callback interface.
 */
interface IWFCServiceCB {
    void updateWFCMessage(String s);
}