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

Commit 9741eb71 authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 6174161 from 347c14cb to qt-qpr3-release

Change-Id: Ie4868be24d63717a342b4e986e2f33a331bb18aa
parents 9102835f 347c14cb
Loading
Loading
Loading
Loading
+6 −19
Original line number Original line Diff line number Diff line
@@ -172,13 +172,6 @@ public class GraphicsEnvironment {
        return 0;
        return 0;
    }
    }


    /**
     * Check whether application is debuggable
     */
    private static boolean isDebuggable(Context context) {
        return (context.getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE) > 0;
    }

    /**
    /**
     * Store the layer paths available to the loader.
     * Store the layer paths available to the loader.
     */
     */
@@ -233,7 +226,7 @@ public class GraphicsEnvironment {
        // 2. ENABLE_GPU_DEBUG_LAYERS is true
        // 2. ENABLE_GPU_DEBUG_LAYERS is true
        // 3. Package name is equal to GPU_DEBUG_APP
        // 3. Package name is equal to GPU_DEBUG_APP


        if (isDebuggable(context) || (getCanLoadSystemLibraries() == 1)) {
        if (isDebuggable()) {


            final int enable = coreSettings.getInt(Settings.Global.ENABLE_GPU_DEBUG_LAYERS, 0);
            final int enable = coreSettings.getInt(Settings.Global.ENABLE_GPU_DEBUG_LAYERS, 0);


@@ -414,9 +407,7 @@ public class GraphicsEnvironment {
     * Check for ANGLE debug package, but only for apps that can load them (dumpable)
     * Check for ANGLE debug package, but only for apps that can load them (dumpable)
     */
     */
    private String getAngleDebugPackage(Context context, Bundle coreSettings) {
    private String getAngleDebugPackage(Context context, Bundle coreSettings) {
        final boolean appIsDebuggable = isDebuggable(context);
        if (isDebuggable()) {
        final boolean deviceIsDebuggable = getCanLoadSystemLibraries() == 1;
        if (appIsDebuggable || deviceIsDebuggable) {
            String debugPackage;
            String debugPackage;


            if (coreSettings != null) {
            if (coreSettings != null) {
@@ -451,12 +442,8 @@ public class GraphicsEnvironment {
         *  - devices that are running a userdebug build (ro.debuggable) or can inject libraries for
         *  - devices that are running a userdebug build (ro.debuggable) or can inject libraries for
         *    debugging (PR_SET_DUMPABLE).
         *    debugging (PR_SET_DUMPABLE).
         */
         */
        final boolean appIsDebuggable = isDebuggable(context);
        if (!isDebuggable()) {
        final boolean deviceIsDebuggable = getCanLoadSystemLibraries() == 1;
            Log.v(TAG, "Skipping loading temporary rules file");
        if (!(appIsDebuggable || deviceIsDebuggable)) {
            Log.v(TAG, "Skipping loading temporary rules file: "
                    + "appIsDebuggable = " + appIsDebuggable + ", "
                    + "adbRootEnabled = " + deviceIsDebuggable);
            return false;
            return false;
        }
        }


@@ -725,7 +712,7 @@ public class GraphicsEnvironment {


        final boolean enablePrereleaseDriver =
        final boolean enablePrereleaseDriver =
                (ai.metaData != null && ai.metaData.getBoolean(METADATA_DEVELOPER_DRIVER_ENABLE))
                (ai.metaData != null && ai.metaData.getBoolean(METADATA_DEVELOPER_DRIVER_ENABLE))
                || getCanLoadSystemLibraries() == 1;
                || isDebuggable();


        // Priority for Game Driver settings global on confliction (Higher priority comes first):
        // Priority for Game Driver settings global on confliction (Higher priority comes first):
        // 1. GAME_DRIVER_ALL_APPS
        // 1. GAME_DRIVER_ALL_APPS
@@ -901,7 +888,7 @@ public class GraphicsEnvironment {
        return "";
        return "";
    }
    }


    private static native int getCanLoadSystemLibraries();
    private static native boolean isDebuggable();
    private static native void setLayerPaths(ClassLoader classLoader, String layerPaths);
    private static native void setLayerPaths(ClassLoader classLoader, String layerPaths);
    private static native void setDebugLayers(String layers);
    private static native void setDebugLayers(String layers);
    private static native void setDebugLayersGLES(String layers);
    private static native void setDebugLayersGLES(String layers);
+3 −3
Original line number Original line Diff line number Diff line
@@ -23,8 +23,8 @@


namespace {
namespace {


int getCanLoadSystemLibraries_native() {
bool isDebuggable_native() {
    return android::GraphicsEnv::getInstance().getCanLoadSystemLibraries();
    return android::GraphicsEnv::getInstance().isDebuggable();
}
}


void setDriverPathAndSphalLibraries_native(JNIEnv* env, jobject clazz, jstring path,
void setDriverPathAndSphalLibraries_native(JNIEnv* env, jobject clazz, jstring path,
@@ -90,7 +90,7 @@ void hintActivityLaunch_native(JNIEnv* env, jobject clazz) {
}
}


const JNINativeMethod g_methods[] = {
const JNINativeMethod g_methods[] = {
    { "getCanLoadSystemLibraries", "()I", reinterpret_cast<void*>(getCanLoadSystemLibraries_native) },
    { "isDebuggable", "()Z", reinterpret_cast<void*>(isDebuggable_native) },
    { "setDriverPathAndSphalLibraries", "(Ljava/lang/String;Ljava/lang/String;)V", reinterpret_cast<void*>(setDriverPathAndSphalLibraries_native) },
    { "setDriverPathAndSphalLibraries", "(Ljava/lang/String;Ljava/lang/String;)V", reinterpret_cast<void*>(setDriverPathAndSphalLibraries_native) },
    { "setGpuStats", "(Ljava/lang/String;Ljava/lang/String;JJLjava/lang/String;I)V", reinterpret_cast<void*>(setGpuStats_native) },
    { "setGpuStats", "(Ljava/lang/String;Ljava/lang/String;JJLjava/lang/String;I)V", reinterpret_cast<void*>(setGpuStats_native) },
    { "setAngleInfo", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/io/FileDescriptor;JJ)V", reinterpret_cast<void*>(setAngleInfo_native) },
    { "setAngleInfo", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/io/FileDescriptor;JJ)V", reinterpret_cast<void*>(setAngleInfo_native) },
+41 −68
Original line number Original line Diff line number Diff line
@@ -35,12 +35,12 @@ import androidx.annotation.VisibleForTesting;


import com.android.settingslib.R;
import com.android.settingslib.R;


import java.util.ArrayList;
import java.util.Collection;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashMap;
import java.util.Map;
import java.util.Map;
import java.util.Objects;
import java.util.Objects;
import java.util.Set;
import java.util.Set;
import java.util.concurrent.CopyOnWriteArrayList;


/**
/**
 * BluetoothEventManager receives broadcasts and callbacks from the Bluetooth
 * BluetoothEventManager receives broadcasts and callbacks from the Bluetooth
@@ -56,7 +56,7 @@ public class BluetoothEventManager {
    private final Map<String, Handler> mHandlerMap;
    private final Map<String, Handler> mHandlerMap;
    private final BroadcastReceiver mBroadcastReceiver = new BluetoothBroadcastReceiver();
    private final BroadcastReceiver mBroadcastReceiver = new BluetoothBroadcastReceiver();
    private final BroadcastReceiver mProfileBroadcastReceiver = new BluetoothBroadcastReceiver();
    private final BroadcastReceiver mProfileBroadcastReceiver = new BluetoothBroadcastReceiver();
    private final Collection<BluetoothCallback> mCallbacks = new ArrayList<>();
    private final Collection<BluetoothCallback> mCallbacks = new CopyOnWriteArrayList<>();
    private final android.os.Handler mReceiverHandler;
    private final android.os.Handler mReceiverHandler;
    private final UserHandle mUserHandle;
    private final UserHandle mUserHandle;
    private final Context mContext;
    private final Context mContext;
@@ -93,8 +93,10 @@ public class BluetoothEventManager {
                new ConnectionStateChangedHandler());
                new ConnectionStateChangedHandler());


        // Discovery broadcasts
        // Discovery broadcasts
        addHandler(BluetoothAdapter.ACTION_DISCOVERY_STARTED, new ScanningStateChangedHandler(true));
        addHandler(BluetoothAdapter.ACTION_DISCOVERY_STARTED,
        addHandler(BluetoothAdapter.ACTION_DISCOVERY_FINISHED, new ScanningStateChangedHandler(false));
                new ScanningStateChangedHandler(true));
        addHandler(BluetoothAdapter.ACTION_DISCOVERY_FINISHED,
                new ScanningStateChangedHandler(false));
        addHandler(BluetoothDevice.ACTION_FOUND, new DeviceFoundHandler());
        addHandler(BluetoothDevice.ACTION_FOUND, new DeviceFoundHandler());
        addHandler(BluetoothDevice.ACTION_NAME_CHANGED, new NameChangedHandler());
        addHandler(BluetoothDevice.ACTION_NAME_CHANGED, new NameChangedHandler());
        addHandler(BluetoothDevice.ACTION_ALIAS_CHANGED, new NameChangedHandler());
        addHandler(BluetoothDevice.ACTION_ALIAS_CHANGED, new NameChangedHandler());
@@ -128,17 +130,13 @@ public class BluetoothEventManager {


    /** Register to start receiving callbacks for Bluetooth events. */
    /** Register to start receiving callbacks for Bluetooth events. */
    public void registerCallback(BluetoothCallback callback) {
    public void registerCallback(BluetoothCallback callback) {
        synchronized (mCallbacks) {
        mCallbacks.add(callback);
        mCallbacks.add(callback);
    }
    }
    }


    /** Unregister to stop receiving callbacks for Bluetooth events. */
    /** Unregister to stop receiving callbacks for Bluetooth events. */
    public void unregisterCallback(BluetoothCallback callback) {
    public void unregisterCallback(BluetoothCallback callback) {
        synchronized (mCallbacks) {
        mCallbacks.remove(callback);
        mCallbacks.remove(callback);
    }
    }
    }


    @VisibleForTesting
    @VisibleForTesting
    void registerProfileIntentReceiver() {
    void registerProfileIntentReceiver() {
@@ -189,65 +187,50 @@ public class BluetoothEventManager {
    }
    }


    void dispatchDeviceAdded(CachedBluetoothDevice cachedDevice) {
    void dispatchDeviceAdded(CachedBluetoothDevice cachedDevice) {
        synchronized (mCallbacks) {
        for (BluetoothCallback callback : mCallbacks) {
        for (BluetoothCallback callback : mCallbacks) {
            callback.onDeviceAdded(cachedDevice);
            callback.onDeviceAdded(cachedDevice);
        }
        }
    }
    }
    }


    void dispatchDeviceRemoved(CachedBluetoothDevice cachedDevice) {
    void dispatchDeviceRemoved(CachedBluetoothDevice cachedDevice) {
        synchronized (mCallbacks) {
        for (BluetoothCallback callback : mCallbacks) {
        for (BluetoothCallback callback : mCallbacks) {
            callback.onDeviceDeleted(cachedDevice);
            callback.onDeviceDeleted(cachedDevice);
        }
        }
    }
    }
    }


    void dispatchProfileConnectionStateChanged(CachedBluetoothDevice device, int state,
    void dispatchProfileConnectionStateChanged(CachedBluetoothDevice device, int state,
            int bluetoothProfile) {
            int bluetoothProfile) {
        synchronized (mCallbacks) {
        for (BluetoothCallback callback : mCallbacks) {
        for (BluetoothCallback callback : mCallbacks) {
            callback.onProfileConnectionStateChanged(device, state, bluetoothProfile);
            callback.onProfileConnectionStateChanged(device, state, bluetoothProfile);
        }
        }
    }
    }
    }


    private void dispatchConnectionStateChanged(CachedBluetoothDevice cachedDevice, int state) {
    private void dispatchConnectionStateChanged(CachedBluetoothDevice cachedDevice, int state) {
        synchronized (mCallbacks) {
        for (BluetoothCallback callback : mCallbacks) {
        for (BluetoothCallback callback : mCallbacks) {
            callback.onConnectionStateChanged(cachedDevice, state);
            callback.onConnectionStateChanged(cachedDevice, state);
        }
        }
    }
    }
    }


    private void dispatchAudioModeChanged() {
    private void dispatchAudioModeChanged() {
        mDeviceManager.dispatchAudioModeChanged();
        mDeviceManager.dispatchAudioModeChanged();
        synchronized (mCallbacks) {
        for (BluetoothCallback callback : mCallbacks) {
        for (BluetoothCallback callback : mCallbacks) {
            callback.onAudioModeChanged();
            callback.onAudioModeChanged();
        }
        }
    }
    }
    }


    private void dispatchActiveDeviceChanged(CachedBluetoothDevice activeDevice,
    private void dispatchActiveDeviceChanged(CachedBluetoothDevice activeDevice,
            int bluetoothProfile) {
            int bluetoothProfile) {
        mDeviceManager.onActiveDeviceChanged(activeDevice, bluetoothProfile);
        mDeviceManager.onActiveDeviceChanged(activeDevice, bluetoothProfile);
        synchronized (mCallbacks) {
        for (BluetoothCallback callback : mCallbacks) {
        for (BluetoothCallback callback : mCallbacks) {
            callback.onActiveDeviceChanged(activeDevice, bluetoothProfile);
            callback.onActiveDeviceChanged(activeDevice, bluetoothProfile);
        }
        }
    }
    }
    }


    private void dispatchAclStateChanged(CachedBluetoothDevice activeDevice,
    private void dispatchAclStateChanged(CachedBluetoothDevice activeDevice, int state) {
            int state) {
        synchronized (mCallbacks) {
        for (BluetoothCallback callback : mCallbacks) {
        for (BluetoothCallback callback : mCallbacks) {
            callback.onAclConnectionStateChanged(activeDevice, state);
            callback.onAclConnectionStateChanged(activeDevice, state);
        }
        }
    }
    }
    }


    @VisibleForTesting
    @VisibleForTesting
    void addHandler(String action, Handler handler) {
    void addHandler(String action, Handler handler) {
@@ -270,18 +253,15 @@ public class BluetoothEventManager {
    }
    }


    private class AdapterStateChangedHandler implements Handler {
    private class AdapterStateChangedHandler implements Handler {
        public void onReceive(Context context, Intent intent,
        public void onReceive(Context context, Intent intent, BluetoothDevice device) {
                BluetoothDevice device) {
            int state = intent.getIntExtra(BluetoothAdapter.EXTRA_STATE,
            int state = intent.getIntExtra(BluetoothAdapter.EXTRA_STATE,
                    BluetoothAdapter.ERROR);
                    BluetoothAdapter.ERROR);
            // update local profiles and get paired devices
            // update local profiles and get paired devices
            mLocalAdapter.setBluetoothStateInt(state);
            mLocalAdapter.setBluetoothStateInt(state);
            // send callback to update UI and possibly start scanning
            // send callback to update UI and possibly start scanning
            synchronized (mCallbacks) {
            for (BluetoothCallback callback : mCallbacks) {
            for (BluetoothCallback callback : mCallbacks) {
                callback.onBluetoothStateChanged(state);
                callback.onBluetoothStateChanged(state);
            }
            }
            }
            // Inform CachedDeviceManager that the adapter state has changed
            // Inform CachedDeviceManager that the adapter state has changed
            mDeviceManager.onBluetoothStateChanged(state);
            mDeviceManager.onBluetoothStateChanged(state);
        }
        }
@@ -293,13 +273,11 @@ public class BluetoothEventManager {
        ScanningStateChangedHandler(boolean started) {
        ScanningStateChangedHandler(boolean started) {
            mStarted = started;
            mStarted = started;
        }
        }
        public void onReceive(Context context, Intent intent,

                BluetoothDevice device) {
        public void onReceive(Context context, Intent intent, BluetoothDevice device) {
            synchronized (mCallbacks) {
            for (BluetoothCallback callback : mCallbacks) {
            for (BluetoothCallback callback : mCallbacks) {
                callback.onScanningStateChanged(mStarted);
                callback.onScanningStateChanged(mStarted);
            }
            }
            }
            mDeviceManager.onScanningStateChanged(mStarted);
            mDeviceManager.onScanningStateChanged(mStarted);
        }
        }
    }
    }
@@ -350,8 +328,7 @@ public class BluetoothEventManager {
    }
    }


    private class BondStateChangedHandler implements Handler {
    private class BondStateChangedHandler implements Handler {
        public void onReceive(Context context, Intent intent,
        public void onReceive(Context context, Intent intent, BluetoothDevice device) {
                BluetoothDevice device) {
            if (device == null) {
            if (device == null) {
                Log.e(TAG, "ACTION_BOND_STATE_CHANGED with no EXTRA_DEVICE");
                Log.e(TAG, "ACTION_BOND_STATE_CHANGED with no EXTRA_DEVICE");
                return;
                return;
@@ -365,11 +342,9 @@ public class BluetoothEventManager {
                cachedDevice = mDeviceManager.addDevice(device);
                cachedDevice = mDeviceManager.addDevice(device);
            }
            }


            synchronized (mCallbacks) {
            for (BluetoothCallback callback : mCallbacks) {
            for (BluetoothCallback callback : mCallbacks) {
                callback.onDeviceBondStateChanged(cachedDevice, bondState);
                callback.onDeviceBondStateChanged(cachedDevice, bondState);
            }
            }
            }
            cachedDevice.onBondingStateChanged(bondState);
            cachedDevice.onBondingStateChanged(bondState);


            if (bondState == BluetoothDevice.BOND_NONE) {
            if (bondState == BluetoothDevice.BOND_NONE) {
@@ -410,7 +385,8 @@ public class BluetoothEventManager {
                    errorMsg = R.string.bluetooth_pairing_error_message;
                    errorMsg = R.string.bluetooth_pairing_error_message;
                    break;
                    break;
                default:
                default:
                    Log.w(TAG, "showUnbondMessage: Not displaying any message for reason: " + reason);
                    Log.w(TAG,
                            "showUnbondMessage: Not displaying any message for reason: " + reason);
                    return;
                    return;
            }
            }
            BluetoothUtils.showError(context, name, errorMsg);
            BluetoothUtils.showError(context, name, errorMsg);
@@ -418,8 +394,7 @@ public class BluetoothEventManager {
    }
    }


    private class ClassChangedHandler implements Handler {
    private class ClassChangedHandler implements Handler {
        public void onReceive(Context context, Intent intent,
        public void onReceive(Context context, Intent intent, BluetoothDevice device) {
                BluetoothDevice device) {
            CachedBluetoothDevice cachedDevice = mDeviceManager.findDevice(device);
            CachedBluetoothDevice cachedDevice = mDeviceManager.findDevice(device);
            if (cachedDevice != null) {
            if (cachedDevice != null) {
                cachedDevice.refresh();
                cachedDevice.refresh();
@@ -428,8 +403,7 @@ public class BluetoothEventManager {
    }
    }


    private class UuidChangedHandler implements Handler {
    private class UuidChangedHandler implements Handler {
        public void onReceive(Context context, Intent intent,
        public void onReceive(Context context, Intent intent, BluetoothDevice device) {
                BluetoothDevice device) {
            CachedBluetoothDevice cachedDevice = mDeviceManager.findDevice(device);
            CachedBluetoothDevice cachedDevice = mDeviceManager.findDevice(device);
            if (cachedDevice != null) {
            if (cachedDevice != null) {
                cachedDevice.onUuidChanged();
                cachedDevice.onUuidChanged();
@@ -438,8 +412,7 @@ public class BluetoothEventManager {
    }
    }


    private class BatteryLevelChangedHandler implements Handler {
    private class BatteryLevelChangedHandler implements Handler {
        public void onReceive(Context context, Intent intent,
        public void onReceive(Context context, Intent intent, BluetoothDevice device) {
                BluetoothDevice device) {
            CachedBluetoothDevice cachedDevice = mDeviceManager.findDevice(device);
            CachedBluetoothDevice cachedDevice = mDeviceManager.findDevice(device);
            if (cachedDevice != null) {
            if (cachedDevice != null) {
                cachedDevice.refresh();
                cachedDevice.refresh();
+10 −11
Original line number Original line Diff line number Diff line
@@ -39,6 +39,7 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.Collection;
import java.util.Collections;
import java.util.Collections;
import java.util.List;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;


/**
/**
 * CachedBluetoothDevice represents a remote Bluetooth device. It contains
 * CachedBluetoothDevice represents a remote Bluetooth device. It contains
@@ -75,7 +76,7 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice>


    boolean mJustDiscovered;
    boolean mJustDiscovered;


    private final Collection<Callback> mCallbacks = new ArrayList<>();
    private final Collection<Callback> mCallbacks = new CopyOnWriteArrayList<>();


    /**
    /**
     * Last time a bt profile auto-connect was attempted.
     * Last time a bt profile auto-connect was attempted.
@@ -661,6 +662,10 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice>
        return Collections.unmodifiableList(mProfiles);
        return Collections.unmodifiableList(mProfiles);
    }
    }


    public List<LocalBluetoothProfile> getProfileListCopy() {
        return new ArrayList<>(mProfiles);
    }

    public List<LocalBluetoothProfile> getConnectableProfiles() {
    public List<LocalBluetoothProfile> getConnectableProfiles() {
        List<LocalBluetoothProfile> connectableProfiles =
        List<LocalBluetoothProfile> connectableProfiles =
                new ArrayList<LocalBluetoothProfile>();
                new ArrayList<LocalBluetoothProfile>();
@@ -679,24 +684,18 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice>
    }
    }


    public void registerCallback(Callback callback) {
    public void registerCallback(Callback callback) {
        synchronized (mCallbacks) {
        mCallbacks.add(callback);
        mCallbacks.add(callback);
    }
    }
    }


    public void unregisterCallback(Callback callback) {
    public void unregisterCallback(Callback callback) {
        synchronized (mCallbacks) {
        mCallbacks.remove(callback);
        mCallbacks.remove(callback);
    }
    }
    }


    void dispatchAttributesChanged() {
    void dispatchAttributesChanged() {
        synchronized (mCallbacks) {
        for (Callback callback : mCallbacks) {
        for (Callback callback : mCallbacks) {
            callback.onDeviceAttributesChanged();
            callback.onDeviceAttributesChanged();
        }
        }
    }
    }
    }


    @Override
    @Override
    public String toString() {
    public String toString() {
+1 −1
Original line number Original line Diff line number Diff line
@@ -277,7 +277,7 @@ public class BluetoothControllerImpl implements BluetoothController, BluetoothCa
        boolean otherProfileConnected = false;
        boolean otherProfileConnected = false;


        for (CachedBluetoothDevice device : getDevices()) {
        for (CachedBluetoothDevice device : getDevices()) {
            for (LocalBluetoothProfile profile : device.getProfiles()) {
            for (LocalBluetoothProfile profile : device.getProfileListCopy()) {
                int profileId = profile.getProfileId();
                int profileId = profile.getProfileId();
                boolean isConnected = device.isConnectedProfile(profile);
                boolean isConnected = device.isConnectedProfile(profile);
                if (profileId == BluetoothProfile.HEADSET
                if (profileId == BluetoothProfile.HEADSET
Loading