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

Commit 582f78f3 authored by Xin Li's avatar Xin Li Committed by Gerrit Code Review
Browse files

Merge "Merge Android R"

parents 7397e3b9 20946538
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -70,6 +70,7 @@
    <uses-permission android:name="android.permission.UPDATE_DEVICE_STATS"/>
    <uses-permission android:name="android.permission.PACKAGE_USAGE_STATS"/>
    <uses-permission android:name="android.permission.QUERY_ALL_PACKAGES"/>
    <uses-permission android:name="android.permission.MANAGE_COMPANION_DEVICES"/>

    <uses-sdk android:minSdkVersion="14"/>

+3 −0
Original line number Diff line number Diff line
@@ -114,4 +114,7 @@
    <!-- Flag whether or not to keep polling AG with CLCC for call information every 2 seconds -->
    <bool name="hfp_clcc_poll_during_call">true</bool>

    <!-- Package that is providing the exposure notification service -->
    <string name="exposure_notification_package">com.google.android.gms</string>

</resources>
+10 −1
Original line number Diff line number Diff line
@@ -485,6 +485,15 @@ public final class Utils {
                        == PackageManager.PERMISSION_GRANTED;
    }

    /**
     * Returns true if the caller holds RADIO_SCAN_WITHOUT_LOCATION
     */
    public static boolean checkCallerHasScanWithoutLocationPermission(Context context) {
        return context.checkCallingOrSelfPermission(
                android.Manifest.permission.RADIO_SCAN_WITHOUT_LOCATION)
                == PackageManager.PERMISSION_GRANTED;
    }

    public static boolean isQApp(Context context, String pkgName) {
        try {
            return context.getPackageManager().getApplicationInfo(pkgName, 0).targetSdkVersion
@@ -497,7 +506,7 @@ public final class Utils {

    private static boolean isAppOppAllowed(AppOpsManager appOps, String op, String callingPackage,
            @NonNull String callingFeatureId) {
        return appOps.noteOp(op, Binder.getCallingUid(), callingPackage)
        return appOps.noteOp(op, Binder.getCallingUid(), callingPackage, callingFeatureId, null)
                == AppOpsManager.MODE_ALLOWED;
    }

+0 −11
Original line number Diff line number Diff line
@@ -555,14 +555,7 @@ public class A2dpService extends ProfileService {
            updateAndBroadcastActiveDevice(device);
            // Make sure the Audio Manager knows the previous Active device is disconnected,
            // and the new Active device is connected.
            // Also, mute and unmute the output during the switch to avoid audio glitches.
            boolean wasMuted = false;
            if (previousActiveDevice != null) {
                if (!mAudioManager.isStreamMute(AudioManager.STREAM_MUSIC)) {
                    mAudioManager.adjustStreamVolume(AudioManager.STREAM_MUSIC,
                            AudioManager.ADJUST_MUTE, AudioManager.FLAG_BLUETOOTH_ABS_VOLUME);
                    wasMuted = true;
                }
                mAudioManager.setBluetoothA2dpDeviceConnectionStateSuppressNoisyIntent(
                        previousActiveDevice, BluetoothProfile.STATE_DISCONNECTED,
                        BluetoothProfile.A2DP, true, -1);
@@ -598,10 +591,6 @@ public class A2dpService extends ProfileService {
            // change, so the Audio Service can reset accordingly the audio
            // feeding parameters in the Audio HAL to the Bluetooth stack.
            mAudioManager.handleBluetoothA2dpDeviceConfigChange(newActiveDevice);
            if (wasMuted) {
                mAudioManager.adjustStreamVolume(AudioManager.STREAM_MUSIC,
                        AudioManager.ADJUST_UNMUTE, AudioManager.FLAG_BLUETOOTH_ABS_VOLUME);
            }
        }
        return true;
    }
+22 −0
Original line number Diff line number Diff line
@@ -182,6 +182,7 @@ class AdapterProperties {
    AdapterProperties(AdapterService service) {
        mService = service;
        mAdapter = BluetoothAdapter.getDefaultAdapter();
        invalidateBluetoothCaches();
    }

    public void init(RemoteDevices remoteDevices) {
@@ -223,6 +224,7 @@ class AdapterProperties {
        filter.addAction(BluetoothPbapClient.ACTION_CONNECTION_STATE_CHANGED);
        mService.registerReceiver(mReceiver, filter);
        mReceiverRegistered = true;
        invalidateBluetoothCaches();
    }

    public void cleanup() {
@@ -234,6 +236,22 @@ class AdapterProperties {
        }
        mService = null;
        mBondedDevices.clear();
        invalidateBluetoothCaches();
    }

    private static void invalidateGetProfileConnectionStateCache() {
        BluetoothAdapter.invalidateGetProfileConnectionStateCache();
    }
    private static void invalidateIsOffloadedFilteringSupportedCache() {
        BluetoothAdapter.invalidateIsOffloadedFilteringSupportedCache();
    }
    private static void invalidateGetBondStateCache() {
        BluetoothDevice.invalidateBluetoothGetBondStateCache();
    }
    private static void invalidateBluetoothCaches() {
        invalidateGetProfileConnectionStateCache();
        invalidateIsOffloadedFilteringSupportedCache();
        invalidateGetBondStateCache();
    }

    @Override
@@ -538,6 +556,7 @@ class AdapterProperties {
                    debugLog("Failed to remove device: " + device);
                }
            }
            invalidateGetBondStateCache();
        } catch (Exception ee) {
            Log.w(TAG, "onBondStateChanged: Exception ", ee);
        }
@@ -765,6 +784,7 @@ class AdapterProperties {

        if (update) {
            mProfileConnectionState.put(profile, new Pair<Integer, Integer>(newHashState, numDev));
            invalidateGetProfileConnectionStateCache();
        }
    }

@@ -890,6 +910,7 @@ class AdapterProperties {
                + " mIsLeExtendedAdvertisingSupported = " + mIsLeExtendedAdvertisingSupported
                + " mIsLePeriodicAdvertisingSupported = " + mIsLePeriodicAdvertisingSupported
                + " mLeMaximumAdvertisingDataLength = " + mLeMaximumAdvertisingDataLength);
        invalidateIsOffloadedFilteringSupportedCache();
    }

    void onBluetoothReady() {
@@ -900,6 +921,7 @@ class AdapterProperties {
            // Reset adapter and profile connection states
            setConnectionState(BluetoothAdapter.STATE_DISCONNECTED);
            mProfileConnectionState.clear();
            invalidateGetProfileConnectionStateCache();
            mProfilesConnected = 0;
            mProfilesConnecting = 0;
            mProfilesDisconnecting = 0;
Loading