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

Commit 6d8c84c4 authored by Linux Build Service Account's avatar Linux Build Service Account
Browse files

Promotion of android_ui.lnx.2.1-00026.

CRs      Change ID                                   Subject
--------------------------------------------------------------------------------------------------------------
1079132   I651f6a6285a3cd2b31be404d3b701c2105f88885   Settings: Tap and Pay UI needs to be long clickable
1070422   Ic3dd7cf7b4fa746b21d7ed96df0809f4e99aedb0   Settings: Add TMO control config for new code.
1070422   Ic91afe656477c4012d78a3d53669fa6b227c8bac   HotSpot: Mandatory Inactivity timer options
1070422   Ie8cf5080c637e342c17e9bc5a06814cc73ce9fdd   HotSpot learning after initialize activated

Change-Id: Iba2b5c784a7ec6c57f2cdaeb8a564d4dc7c1b6e9
CRs-Fixed: 1070422, 1079132
parents ff39d743 ed0525a3
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -92,4 +92,7 @@
    <bool name="config_regional_security_show_password_enable">false</bool>
    <!-- Config to show bluetooth menu-->
    <bool name="config_hide_bluetooth_menu">false</bool>
    <bool name="config_hotspot_need_show_activated_dialog">false</bool>
    <bool name="config_keep_hotspot_on_10mins_default">false</bool>
    <bool name="hotspot_show_alert_for_open_security">false</bool>
</resources>
+8 −2
Original line number Diff line number Diff line
@@ -7594,7 +7594,7 @@
    <string name="tethering_no_sim_alert_title">No SIM Card</string>
    <string name="tethering_no_sim_card_text">Please install SIM card in order to share your data connection with other devices using Mobile HotSpot or USB tethering for Internet access.</string>
    <string name="tether_settings_launch_title">Mobile HotSpot</string>
    <string name="wifi_tether_first_use_message">Set up Mobile HotSpot at the First Use</string>
    <string name="wifi_tether_first_use_message">Set up Wi-Fi hotspot at the First Use</string>
    <string name="lte_data_and_voice_calling_enabled">LTE data and Voice Calling (IMS/VoLTE) service enabled </string>
    <string name="lte_data_service_enabled">LTE data service enabled </string>
    <string name="turn_off_wifi_dialog_title">Turn off Wi-Fi</string>
@@ -7603,10 +7603,13 @@
    <string name="show_battery_percentage">Show battery percentage</string>
    <string name="show_battery_percentage_summary">Show battery level percentage inside the status bar</string>
    <string name="learn_usb_dialog_title">First Time Notification Use</string>
    <string name="learn_usb_dialog_title">USB tethering is activated</string>
    <string name="learn_usb_dialog_text">Would you like to learn more about USB Tethering on your phone?</string>
    <string name="mobile_tether_help_dialog_title">Mobile HotSpot Help</string>
    <string name="mobile_usb_help_dialog_text">You can tether your Android device to your computer with a USB cable, to share your device\'s Internet connection with your computer. \n\n1. USB tethering works with Windows Vista, Windows 7, and Linux, the USB drivers for tethering may be needed.\n\n2. If your device has an SD card or USB storage, you can\'t mount it on your computer when USB tethered</string>
    <string name="mobile_hotspot_help_dialog_title">Mobile HotSpot Help</string>
    <string name="mobile_hotspot_help_dialog_text">You can turn your Android device into a portable Wi-Fi hotspot, to share your Android device\'s Internet connection with one or more computers or other devices. \n\n1.When your device is serving as a Wi-Fi hotspot, you can not use your device\'s applications to access the Internet via its Wi-Fi connection (but of course you remain connected to the Internet via your mobile data network). \n\n2.You configure the hotspot with the Wi-Fi hotspot settings</string>
    <string name="wifiap_mobile_hotspot_help">Status</string>
    <string name="dialog_font_warining_title">Information</string>
@@ -7630,4 +7633,7 @@
    <string name="qtifeedback_package">com.qti.smq.qualcommFeedback</string>
    <string name="qtifeedback_activity">com.qti.smq.ui.QtiFeedbackActivity</string>
    <string name="learn_hotspot_dialog_title">Wi-Fi tethering is activated</string>
    <string name="learn_hotspot_dialog_text">Would you like to learn more about wifi Tethering on your phone?</string>
    <string name="open_security_settings_note">With Open security, any device can connect to your Mobile HotSpot and use your mobile data connection.</string>
</resources>
+18 −21
Original line number Diff line number Diff line
@@ -157,7 +157,6 @@ public class TetherSettings extends RestrictedSettingsFragment
    private boolean mUsbEnable = false;
    private WifiManager mWifiStatusManager;
    private boolean mIsWifiEnabled = false;
    private boolean mHaveWifiApConfig = false;

    @Override
    protected int getMetricsCategory() {
@@ -283,24 +282,6 @@ public class TetherSettings extends RestrictedSettingsFragment
                Context.WIFI_SERVICE);
    }

    @Override
    public void onResume() {
        super.onResume();
        if(mWifiManager != null) {
            WifiConfiguration config = mWifiManager.getWifiApConfiguration();
            boolean isNotNoneSecurity = config.getAuthType() > WifiConfiguration.KeyMgmt.NONE;
            // WifiConfiguration.KeyMgmt be used to management schemes,
            // WifiConfiguration.preSharedKey for use with WPA-PSK, it's password,
            // if preSharedKey is empty, the WifiConfiguration need to set password.
            if(isNotNoneSecurity) {
                mHaveWifiApConfig = config.preSharedKey != null &&
                    !config.preSharedKey.isEmpty();
            } else {
                mHaveWifiApConfig = true;
            }
        }
    }

    @Override
    public void onDestroy() {
        mDataSaverBackend.remListener(this);
@@ -628,6 +609,20 @@ public class TetherSettings extends RestrictedSettingsFragment
                == TelephonyManager.SIM_STATE_READY);
    }

    private boolean checkWifiApConfig() {
        WifiConfiguration config = mWifiManager.getWifiApConfiguration();
        boolean isNotNoneSecurity = config.getAuthType() > WifiConfiguration.KeyMgmt.NONE;
        // WifiConfiguration.KeyMgmt be used to management schemes,
        // WifiConfiguration.preSharedKey for use with WPA-PSK, it's password,
        // if preSharedKey is empty, the WifiConfiguration need to set password.
        if(isNotNoneSecurity) {
            return config.preSharedKey != null &&
                !config.preSharedKey.isEmpty();
        } else {
            return true;
        }
    }

    @Override
    public boolean onPreferenceChange(Preference preference, Object value) {
        boolean enable = (Boolean) value;
@@ -638,7 +633,7 @@ public class TetherSettings extends RestrictedSettingsFragment
                ((HotspotPreference)preference).setChecked(false);
                return false;
            } else if(enableWifiApSettingsExt &&
                (isNeedShowHelp(getPrefContext()) || !mHaveWifiApConfig)) {
                (isNeedShowHelp(getPrefContext()) || !checkWifiApConfig())) {
                Intent intent = new Intent();
                intent.setAction(ACTION_HOTSPOT_PRE_CONFIGURE);
                intent.setPackage("com.qualcomm.qti.extsettings");
@@ -728,7 +723,7 @@ public class TetherSettings extends RestrictedSettingsFragment
        }

        if (choice == TETHERING_USB) {
            if(mUsbTether.isChecked()) {
            if(mUsbTether.isChecked() && mUsbEnable) {
                mWifiManager.setWifiEnabled(false);
            }
        }
@@ -747,6 +742,8 @@ public class TetherSettings extends RestrictedSettingsFragment
                }
                if (isFirstUseUSBTethering(getActivity())) {
                    showFirstUseUSBTetheringDialog(getActivity());
                } else if(checkWifiConnectivityState(getActivity())) {
                    showTurnOffWifiDialog(getActivity());
                }
                startTethering(TETHERING_USB);
            } else {
+29 −3
Original line number Diff line number Diff line
/*
 * Copyright (c) 2016, The Linux Foundation. All rights reserved.
 * Not a Contribution.
 *
 * Copyright (C) 2015 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
@@ -30,7 +33,7 @@ import android.widget.BaseAdapter;
import android.widget.CompoundButton;
import android.widget.ImageView;
import android.widget.RadioButton;

import android.content.pm.PackageManager;
import com.android.settings.CustomDialogPreference;
import com.android.settings.R;
import com.android.settings.dashboard.SummaryLoader;
@@ -134,7 +137,7 @@ public class NfcPaymentPreference extends CustomDialogPreference implements
    }

    class NfcPaymentAdapter extends BaseAdapter implements CompoundButton.OnCheckedChangeListener,
            View.OnClickListener {
            View.OnClickListener, View.OnLongClickListener {
        // Only modified on UI thread
        private PaymentAppInfo[] appInfos;

@@ -180,7 +183,7 @@ public class NfcPaymentPreference extends CustomDialogPreference implements
            holder.imageView.setTag(appInfo);
            holder.imageView.setContentDescription(appInfo.label);
            holder.imageView.setOnClickListener(this);

            holder.imageView.setOnLongClickListener(this);
            // Prevent checked callback getting called on recycled views
            holder.radioButton.setOnCheckedChangeListener(null);
            holder.radioButton.setChecked(appInfo.isDefault);
@@ -207,6 +210,29 @@ public class NfcPaymentPreference extends CustomDialogPreference implements
            makeDefault(appInfo);
        }

        @Override
        public boolean onLongClick(View view){
            PaymentAppInfo appInfo = (PaymentAppInfo) view.getTag();
            if (appInfo.componentName != null) {
                Log.d(TAG, "LongClick: " + appInfo.componentName.toString());
                PackageManager pm = mContext.getPackageManager();
                Intent gsmaIntent =
                pm.getLaunchIntentForPackage(appInfo.componentName.getPackageName());
                if (gsmaIntent != null) {
                    gsmaIntent.setAction("com.gsma.services.nfc.SELECT_DEFAULT_SERVICE");
                    gsmaIntent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
                    gsmaIntent.setPackage(gsmaIntent.getPackage());
                    try {
                        mContext.startActivity(gsmaIntent);
                    } catch (ActivityNotFoundException e) {
                        Log.e(TAG, "Settings activity for " + appInfo.componentName.toString() +
                            " not found.");
                    }
                }
            }
            return true;
        }

        void makeDefault(PaymentAppInfo appInfo) {
            if (!appInfo.isDefault) {
                mPaymentBackend.setDefaultPaymentApp(appInfo.componentName);
+57 −2
Original line number Diff line number Diff line
@@ -16,10 +16,14 @@

package com.android.settings.wifi;

import android.app.Activity;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.content.DialogInterface;
import android.net.ConnectivityManager;
import android.net.wifi.WifiConfiguration;
import android.net.wifi.WifiManager;
@@ -28,10 +32,12 @@ import android.os.UserHandle;
import android.support.v14.preference.SwitchPreference;
import android.support.v7.preference.Preference;
import com.android.settings.HotspotPreference;
import com.android.settings.TetherSettings;
import com.android.settings.R;
import com.android.settings.datausage.DataSaverBackend;
import com.android.settingslib.TetherUtil;

import android.app.AlertDialog;
import android.app.Dialog;
import java.util.ArrayList;

public class WifiApEnabler {
@@ -48,6 +54,8 @@ public class WifiApEnabler {
    private boolean mEnabling = false;
    private static final String ACTION_HOTSPOT_POST_CONFIGURE = "Hotspot_PostConfigure";
    private static final String ACTION_EXTRA = "choice";
    private static final String KEY_FIRST_HOTSPOT_ACTIVATED = "FirstHotspotActivated";
    private static final String MY_PREF_FILE = "MY_PERFS";
    public static final int TETHERING_WIFI = 0;

    private final BroadcastReceiver mReceiver = new BroadcastReceiver() {
@@ -164,6 +172,52 @@ public class WifiApEnabler {
        }
    }

    private void showWifiTetheringLearning(final Context ctx) {
        final AlertDialog.Builder builder = new AlertDialog.Builder(ctx);
        builder.setTitle(ctx.getResources().getString(R.string.mobile_hotspot_help_dialog_title));
        builder.setMessage(ctx.getResources().getString(R.string.mobile_hotspot_help_dialog_text));
        builder.setPositiveButton(ctx.getResources().getString(R.string.yes), null);
        builder.setCancelable(false);
        builder.show();
    }


    private void showWifiTetheringActivatedDialog(final Context ctx) {
        final AlertDialog.Builder builder = new AlertDialog.Builder(ctx);
        builder.setTitle(ctx.getResources().getString(R.string.learn_hotspot_dialog_title));
        builder.setMessage(ctx.getResources().getString(R.string.learn_hotspot_dialog_text));
        builder.setPositiveButton(ctx.getResources().getString(R.string.yes),
                new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface arg0, int arg1) {
                        showWifiTetheringLearning(ctx);
                    }
                });
        builder.setNegativeButton(ctx.getResources().getString(R.string.skip_label), null);
        builder.setCancelable(false);
        builder.show();
    }

    private boolean isNeedShowActivated (final Context ctx) {
        SharedPreferences sharedPreferences = ctx.getSharedPreferences(
                MY_PREF_FILE, Activity.MODE_PRIVATE);
        Editor editor = sharedPreferences.edit();
        boolean isFirstUse = sharedPreferences.getBoolean(KEY_FIRST_HOTSPOT_ACTIVATED,true);
        if (isFirstUse) {
            editor = sharedPreferences.edit();
            editor.putBoolean(KEY_FIRST_HOTSPOT_ACTIVATED, false);
            editor.commit();
        }
        return isFirstUse;
    }

    private void showActivatedDialog(final Context ctx) {
        if (ctx.getResources().getBoolean(R.bool.config_hotspot_need_show_activated_dialog)
                && isNeedShowActivated(ctx)) {
            showWifiTetheringActivatedDialog(ctx);
        }
    }

    private void handleWifiApStateChanged(int state, int reason) {
        boolean enableWifiApSettingsExt = mContext.getResources().getBoolean(
                R.bool.show_wifi_hotspot_settings);
@@ -183,6 +237,7 @@ public class WifiApEnabler {
                    hSwitch.setChecked(true);
                    /* Doesnt need the airplane check */
                    hSwitch.setEnabled(!mDataSaverBackend.isDataSaverEnabled());
                    showActivatedDialog(mContext);
                    break;
                case WifiManager.WIFI_AP_STATE_DISABLING:
                    hSwitch.setSummary(R.string.wifi_tether_stopping);