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

Commit 0cb3743e authored by Michael Chan's avatar Michael Chan
Browse files

b/2219381 Gray out Bluetooth Settings for the emulator

Change-Id: I11ae2e6c7652ba550aeadf0dadb6f520c19dedc6
parent dd45a47b
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -48,6 +48,7 @@
        android:dependency="toggle_airplane" />

    <PreferenceScreen
        android:key="bt_settings"
        android:title="@string/bluetooth_settings_title"
        android:summary="@string/bluetooth_settings_summary"
        android:dependency="toggle_airplane">
+14 −4
Original line number Diff line number Diff line
@@ -16,21 +16,23 @@

package com.android.settings;

import com.android.settings.bluetooth.BluetoothEnabler;
import com.android.settings.wifi.WifiEnabler;

import android.bluetooth.BluetoothAdapter;
import android.content.Intent;
import android.net.wifi.WifiManager;
import android.os.Bundle;
import android.os.IBinder;
import android.os.ServiceManager;
import android.os.SystemProperties;
import android.preference.CheckBoxPreference;
import android.preference.Preference;
import android.preference.PreferenceScreen;
import android.preference.PreferenceActivity;
import android.preference.PreferenceScreen;
import android.provider.Settings;

import com.android.internal.telephony.TelephonyIntents;
import com.android.internal.telephony.TelephonyProperties;
import com.android.settings.bluetooth.BluetoothEnabler;
import com.android.settings.wifi.WifiEnabler;

public class WirelessSettings extends PreferenceActivity {

@@ -38,6 +40,7 @@ public class WirelessSettings extends PreferenceActivity {
    private static final String KEY_TOGGLE_BLUETOOTH = "toggle_bluetooth";
    private static final String KEY_TOGGLE_WIFI = "toggle_wifi";
    private static final String KEY_WIFI_SETTINGS = "wifi_settings";
    private static final String KEY_BT_SETTINGS = "bt_settings";
    private static final String KEY_VPN_SETTINGS = "vpn_settings";
    public static final String EXIT_ECM_RESULT = "exit_ecm_result";
    public static final int REQUEST_CODE_EXIT_ECM = 1;
@@ -106,6 +109,13 @@ public class WirelessSettings extends PreferenceActivity {
        Preference wifiSettings = findPreference(KEY_WIFI_SETTINGS);
        Preference vpnSettings = findPreference(KEY_VPN_SETTINGS);

        IBinder b = ServiceManager.getService(BluetoothAdapter.BLUETOOTH_SERVICE);
        if (b == null) {
            // Disable BT Settings if BT service is not available.
            Preference btSettings = findPreference(KEY_BT_SETTINGS);
            btSettings.setEnabled(false);
        }

        mWifiEnabler = new WifiEnabler(
                this, (WifiManager) getSystemService(WIFI_SERVICE),
                (CheckBoxPreference) wifiPreference);