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

Commit 142f43e9 authored by Prem Kumar's avatar Prem Kumar Committed by Android (Google) Code Review
Browse files

Merge "Revert "Bluetooth: Added Shared Preferences to restore tethering...

Merge "Revert "Bluetooth: Added Shared Preferences to restore tethering preference"" into lmp-mr1-dev
parents cbe713fe 07a7db58
Loading
Loading
Loading
Loading
+2 −17
Original line number Diff line number Diff line
@@ -50,9 +50,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;

import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;

/**
 * Provides Bluetooth Pan Device profile, as a service in
 * the Bluetooth application.
@@ -76,8 +73,6 @@ public class PanService extends ProfileService {
    private static final int MESSAGE_DISCONNECT = 2;
    private static final int MESSAGE_CONNECT_STATE_CHANGED = 11;
    private boolean mTetherOn = false;
    private static final String PAN_PREFERENCE_FILE = "PANMGR";
    private static final String PAN_TETHER_SETTING = "TETHERSTATE";

    private BluetoothTetheringNetworkFactory mNetworkFactory;

@@ -109,10 +104,6 @@ public class PanService extends ProfileService {
        mNetworkFactory = new BluetoothTetheringNetworkFactory(getBaseContext(), getMainLooper(),
                this);

        // Set mTetherOn based on the last saved tethering preference while starting the Pan service
        SharedPreferences tetherSetting = getSharedPreferences(PAN_PREFERENCE_FILE, 0);
        mTetherOn = tetherSetting.getBoolean(PAN_TETHER_SETTING, false);

        return true;
    }

@@ -238,6 +229,7 @@ public class PanService extends ProfileService {
            return service.isPanUOn();
        }
        public boolean isTetheringOn() {
            // TODO(BT) have a variable marking the on/off state
            PanService service = getService();
            if (service == null) return false;
            return service.isTetheringOn();
@@ -297,6 +289,7 @@ public class PanService extends ProfileService {
        return (getPanLocalRoleNative() & BluetoothPan.LOCAL_PANU_ROLE) != 0;
    }
     boolean isTetheringOn() {
        // TODO(BT) have a variable marking the on/off state
        return mTetherOn;
    }

@@ -309,14 +302,6 @@ public class PanService extends ProfileService {
            throw new SecurityException("DISALLOW_CONFIG_TETHERING is enabled for this user.");
        }
        if(mTetherOn != value) {

            SharedPreferences tetherSetting = getSharedPreferences(PAN_PREFERENCE_FILE, 0);
            SharedPreferences.Editor editor = tetherSetting.edit();

            editor.putBoolean(PAN_TETHER_SETTING, value);

            // Commit the edit!
            editor.commit();
            //drop any existing panu or pan-nap connection when changing the tethering state
            mTetherOn = value;
            List<BluetoothDevice> DevList = getConnectedDevices();