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

Commit 8c78865c authored by Shufeng Hou's avatar Shufeng Hou Committed by Steve Kondik
Browse files

SystemUI: Do not turn on Wifi hotspot in APM Mode

Do not turn on hotspot in APM Mode and show clear alert message

Change-Id: I3afcc92a93707e15cd436ebc1cffb74567443483
CRs-Fixed: 926474
parent d97c3417
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -433,4 +433,5 @@
    <string name="enable_bluetooth_title" msgid="5027037706500635269">"要开启蓝牙吗?"</string>
    <string name="enable_bluetooth_message" msgid="9106595990708985385">"要将您的键盘连接到平板电脑,您必须先开启蓝牙。"</string>
    <string name="enable_bluetooth_confirmation_ok" msgid="6258074250948309715">"开启"</string>
    <string name="hotspot_apm_message">"飞行模式开启的情况下不能够链接到移动网络,请关闭飞行模式后重试。"</string>
</resources>
+1 −0
Original line number Diff line number Diff line
@@ -433,4 +433,5 @@
    <string name="enable_bluetooth_title" msgid="5027037706500635269">"要開啟藍牙嗎?"</string>
    <string name="enable_bluetooth_message" msgid="9106595990708985385">"如要將鍵盤連接至平板電腦,請先開啟藍牙。"</string>
    <string name="enable_bluetooth_confirmation_ok" msgid="6258074250948309715">"開啟"</string>
    <string name="hotspot_apm_message">"飛行模式開啟的情況下不能夠鏈接到移動網絡,請關閉飛行模式後重試。"</string>
</resources>
+2 −0
Original line number Diff line number Diff line
@@ -1135,5 +1135,7 @@

    <!-- Bluetooth enablement ok text [CHAR LIMIT=40] -->
    <string name="enable_bluetooth_confirmation_ok">Turn on</string>
    <!-- Hotspot dialog message -->
    <string name="hotspot_apm_message">Unable to connect to mobile networks while Airplane mode is enabled. Disable Airplane mode and try again.</string>

</resources>
+13 −0
Original line number Diff line number Diff line
@@ -21,12 +21,14 @@ import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.provider.Settings;

import com.android.internal.logging.MetricsLogger;
import com.android.systemui.Prefs;
import com.android.systemui.R;
import com.android.systemui.qs.QSTile;
import com.android.systemui.qs.UsageTracker;
import com.android.systemui.statusbar.phone.SystemUIDialog;
import com.android.systemui.statusbar.policy.HotspotController;

/** Quick settings tile: Hotspot **/
@@ -72,6 +74,17 @@ public class HotspotTile extends QSTile<QSTile.BooleanState> {

    @Override
    protected void handleClick() {
        boolean airplaneMode = (Settings.Global.getInt(mContext.getContentResolver(),
                Settings.Global.AIRPLANE_MODE_ON, 0) == 1);
        if (airplaneMode) {
            SystemUIDialog d = new SystemUIDialog(mContext);
            d.setTitle(R.string.quick_settings_hotspot_label);
            d.setMessage(R.string.hotspot_apm_message);
            d.setPositiveButton(com.android.internal.R.string.ok, null);
            d.setShowForAllUsers(true);
            d.show();
            return;
        }
        final boolean isEnabled = (Boolean) mState.value;
        MetricsLogger.action(mContext, getMetricsCategory(), !isEnabled);
        mController.setHotspotEnabled(!isEnabled);