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

Commit e1f4692b authored by Jack He's avatar Jack He Committed by android-build-merger
Browse files

Merge "Remove disk IO read/write blocks in AdapterService for main thread"

am: 19d5b627

Change-Id: I8013f6532301fe8d26c68eb68b5588d0741fdacc
parents f859de9f 19d5b627
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -1383,7 +1383,7 @@ public final class Avrcp {
                Context.MODE_PRIVATE);
                Context.MODE_PRIVATE);
        SharedPreferences.Editor editor = pref.edit();
        SharedPreferences.Editor editor = pref.edit();
        editor.putBoolean(mAddress, true);
        editor.putBoolean(mAddress, true);
        editor.commit();
        editor.apply();
    }
    }


    private int modifyRcFeatureFromBlacklist(int feature, String address) {
    private int modifyRcFeatureFromBlacklist(int feature, String address) {
@@ -1403,7 +1403,7 @@ public final class Avrcp {
                Context.MODE_PRIVATE);
                Context.MODE_PRIVATE);
        SharedPreferences.Editor editor = pref.edit();
        SharedPreferences.Editor editor = pref.edit();
        editor.remove(address);
        editor.remove(address);
        editor.commit();
        editor.apply();
    }
    }


    /**
    /**
+22 −3
Original line number Original line Diff line number Diff line
@@ -37,6 +37,7 @@ import android.content.Context;
import android.content.Intent;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.IntentFilter;
import android.content.SharedPreferences;
import android.content.SharedPreferences;
import android.os.AsyncTask;
import android.os.BatteryStats;
import android.os.BatteryStats;
import android.os.Binder;
import android.os.Binder;
import android.os.Bundle;
import android.os.Bundle;
@@ -549,6 +550,21 @@ public class AdapterService extends Service {
        mProfileObserver.start();
        mProfileObserver.start();


        setAdapterService(this);
        setAdapterService(this);

        // First call to getSharedPreferences will result in a file read into
        // memory cache. Call it here asynchronously to avoid potential ANR
        // in the future
        new AsyncTask<Void, Void, Void>() {
            @Override
            protected Void doInBackground(Void... params) {
                getSharedPreferences(
                        PHONEBOOK_ACCESS_PERMISSION_PREFERENCE_FILE, Context.MODE_PRIVATE);
                getSharedPreferences(
                        MESSAGE_ACCESS_PERMISSION_PREFERENCE_FILE, Context.MODE_PRIVATE);
                getSharedPreferences(SIM_ACCESS_PERMISSION_PREFERENCE_FILE, Context.MODE_PRIVATE);
                return null;
            }
        }.execute();
    }
    }


    @Override
    @Override
@@ -2155,7 +2171,8 @@ public class AdapterService extends Service {
        } else {
        } else {
            editor.putBoolean(device.getAddress(), value == BluetoothDevice.ACCESS_ALLOWED);
            editor.putBoolean(device.getAddress(), value == BluetoothDevice.ACCESS_ALLOWED);
        }
        }
        return editor.commit();
        editor.apply();
        return true;
    }
    }


    int getMessageAccessPermission(BluetoothDevice device) {
    int getMessageAccessPermission(BluetoothDevice device) {
@@ -2180,7 +2197,8 @@ public class AdapterService extends Service {
        } else {
        } else {
            editor.putBoolean(device.getAddress(), value == BluetoothDevice.ACCESS_ALLOWED);
            editor.putBoolean(device.getAddress(), value == BluetoothDevice.ACCESS_ALLOWED);
        }
        }
        return editor.commit();
        editor.apply();
        return true;
    }
    }


    int getSimAccessPermission(BluetoothDevice device) {
    int getSimAccessPermission(BluetoothDevice device) {
@@ -2205,7 +2223,8 @@ public class AdapterService extends Service {
        } else {
        } else {
            editor.putBoolean(device.getAddress(), value == BluetoothDevice.ACCESS_ALLOWED);
            editor.putBoolean(device.getAddress(), value == BluetoothDevice.ACCESS_ALLOWED);
        }
        }
        return editor.commit();
        editor.apply();
        return true;
    }
    }


     void sendConnectionStateChange(BluetoothDevice
     void sendConnectionStateChange(BluetoothDevice