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

Commit de2ac03f authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 9454839 from 59613bcd to tm-qpr2-release

Change-Id: If4229b11b50caaa31ebc87c8b288640d9f85b2bf
parents 29bfb303 59613bcd
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -62,9 +62,6 @@
    <!-- For enabling browsed cover art with the AVRCP Controller Cover Artwork feature -->
    <bool name="avrcp_controller_cover_art_browsed_images">false</bool>

    <!-- For enabling the hfp client connection service -->
    <bool name="hfp_client_connection_service_enabled">false</bool>

    <!-- For supporting emergency call through the hfp client connection service  -->
    <bool name="hfp_client_connection_service_support_emergency_call">true</bool>

+2 −15
Original line number Diff line number Diff line
@@ -408,9 +408,6 @@ public final class Utils {

    @RequiresPermission(android.Manifest.permission.BLUETOOTH_PRIVILEGED)
    public static void enforceBluetoothPrivilegedPermission(Context context) {
        if (isInstrumentationTestMode()) {
            return;
        }
        context.enforceCallingOrSelfPermission(
                android.Manifest.permission.BLUETOOTH_PRIVILEGED,
                "Need BLUETOOTH PRIVILEGED permission");
@@ -418,9 +415,6 @@ public final class Utils {

    @RequiresPermission(android.Manifest.permission.LOCAL_MAC_ADDRESS)
    public static void enforceLocalMacAddressPermission(Context context) {
        if (isInstrumentationTestMode()) {
            return;
        }
        context.enforceCallingOrSelfPermission(
                android.Manifest.permission.LOCAL_MAC_ADDRESS,
                "Need LOCAL_MAC_ADDRESS permission");
@@ -428,14 +422,13 @@ public final class Utils {

    @RequiresPermission(android.Manifest.permission.DUMP)
    public static void enforceDumpPermission(Context context) {
        if (isInstrumentationTestMode()) {
            return;
        }
        context.enforceCallingOrSelfPermission(
                android.Manifest.permission.DUMP,
                "Need DUMP permission");
    }

    /**
     */
    public static AttributionSource getCallingAttributionSource(Context context) {
        int callingUid = Binder.getCallingUid();
        if (callingUid == android.os.Process.ROOT_UID) {
@@ -470,9 +463,6 @@ public final class Utils {
    @SuppressLint("AndroidFrameworkRequiresPermission")
    private static boolean checkPermissionForDataDelivery(Context context, String permission,
            AttributionSource attributionSource, String message) {
        if (isInstrumentationTestMode()) {
            return true;
        }
        // STOPSHIP(b/188391719): enable this security enforcement
        // attributionSource.enforceCallingUid();
        AttributionSource currentAttribution = new AttributionSource
@@ -679,9 +669,6 @@ public final class Utils {
    }

    public static boolean checkCallerIsSystemOrActiveOrManagedUser(Context context, String tag) {
        if (isInstrumentationTestMode()) {
            return true;
        }
        final boolean res = checkCallerIsSystemOrActiveOrManagedUser(context);
        if (!res) {
            Log.w(TAG, tag + " - Not allowed for"
+7 −19
Original line number Diff line number Diff line
@@ -247,13 +247,7 @@ public class AdapterService extends Service {
        return sAdapterService;
    }

    /**
     * Sets AdapterService for testing.
     *
     * @hide
     */
    @VisibleForTesting
    public static synchronized void setAdapterService(AdapterService instance) {
    private static synchronized void setAdapterService(AdapterService instance) {
        Log.d(TAG, "setAdapterService() - trying to set service to " + instance);
        if (instance == null) {
            return;
@@ -268,8 +262,7 @@ public class AdapterService extends Service {
    }

    private BluetoothAdapter mAdapter;
    @VisibleForTesting
    AdapterProperties mAdapterProperties;
    private AdapterProperties mAdapterProperties;
    private AdapterState mAdapterStateMachine;
    private BondStateMachine mBondStateMachine;
    private JniCallbacks mJniCallbacks;
@@ -1368,8 +1361,7 @@ public class AdapterService extends Service {
    }

    @BluetoothAdapter.RfcommListenerResult
    @VisibleForTesting
    int stopRfcommListener(ParcelUuid uuid, AttributionSource attributionSource) {
    private int stopRfcommListener(ParcelUuid uuid, AttributionSource attributionSource) {
        RfcommListenerData listenerData = mBluetoothServerSockets.get(uuid.getUuid());

        if (listenerData == null) {
@@ -1388,8 +1380,7 @@ public class AdapterService extends Service {
        return listenerData.closeServerAndPendingSockets(mHandler);
    }

    @VisibleForTesting
    IncomingRfcommSocketInfo retrievePendingSocketForServiceRecord(
    private IncomingRfcommSocketInfo retrievePendingSocketForServiceRecord(
            ParcelUuid uuid, AttributionSource attributionSource) {
        IncomingRfcommSocketInfo socketInfo = new IncomingRfcommSocketInfo();

@@ -1557,8 +1548,7 @@ public class AdapterService extends Service {
        }
    }

    @VisibleForTesting
    boolean isAvailable() {
    private boolean isAvailable() {
        return !mCleaningUp;
    }

@@ -3874,8 +3864,7 @@ public class AdapterService extends Service {
        return mAdapterProperties.getName().length();
    }

    @VisibleForTesting
    static boolean isValidIoCapability(int capability) {
    private static boolean isValidIoCapability(int capability) {
        if (capability < 0 || capability >= BluetoothAdapter.IO_CAPABILITY_MAX) {
            Log.e(TAG, "Invalid IO capability value - " + capability);
            return false;
@@ -4804,8 +4793,7 @@ public class AdapterService extends Service {
        return mAdapterProperties.isA2dpOffloadEnabled();
    }

    @VisibleForTesting
    BluetoothActivityEnergyInfo reportActivityInfo() {
    private BluetoothActivityEnergyInfo reportActivityInfo() {
        if (mAdapterProperties.getState() != BluetoothAdapter.STATE_ON
                || !mAdapterProperties.isActivityAndEnergyReportingSupported()) {
            return null;
+23 −18
Original line number Diff line number Diff line
@@ -73,10 +73,13 @@ public class BluetoothMapContent {
    private static final int MASK_SUBJECT = 0x00000001;
    @VisibleForTesting
    static final int MASK_DATETIME = 0x00000002;
    private static final int MASK_SENDER_NAME = 0x00000004;
    private static final int MASK_SENDER_ADDRESSING = 0x00000008;
    @VisibleForTesting
    static final int MASK_SENDER_NAME = 0x00000004;
    @VisibleForTesting
    static final int MASK_SENDER_ADDRESSING = 0x00000008;
    private static final int MASK_RECIPIENT_NAME = 0x00000010;
    private static final int MASK_RECIPIENT_ADDRESSING = 0x00000020;
    @VisibleForTesting
    static final int MASK_RECIPIENT_ADDRESSING = 0x00000020;
    private static final int MASK_TYPE = 0x00000040;
    private static final int MASK_SIZE = 0x00000080;
    private static final int MASK_RECEPTION_STATUS = 0x00000100;
@@ -999,7 +1002,8 @@ public class BluetoothMapContent {
        return sb.toString();
    }

    private void setRecipientAddressing(BluetoothMapMessageListingElement e, Cursor c,
    @VisibleForTesting
    void setRecipientAddressing(BluetoothMapMessageListingElement e, Cursor c,
            FilterInfo fi, BluetoothMapAppParams ap) {
        if ((ap.getParameterMask() & MASK_RECIPIENT_ADDRESSING) != 0) {
            String address = null;
@@ -1079,7 +1083,8 @@ public class BluetoothMapContent {
        }
    }

    private void setSenderAddressing(BluetoothMapMessageListingElement e, Cursor c, FilterInfo fi,
    @VisibleForTesting
    void setSenderAddressing(BluetoothMapMessageListingElement e, Cursor c, FilterInfo fi,
            BluetoothMapAppParams ap) {
        if ((ap.getParameterMask() & MASK_SENDER_ADDRESSING) != 0) {
            String address = "";
@@ -1146,10 +1151,10 @@ public class BluetoothMapContent {
                // TODO: This is a BAD hack, that we map the contact ID to a conversation ID!!!
                //       We need to reach a conclusion on what to do
                Uri contactsUri = Uri.parse(mBaseUri + BluetoothMapContract.TABLE_CONVOCONTACT);
                Cursor contacts =
                        mResolver.query(contactsUri, BluetoothMapContract.BT_CONTACT_PROJECTION,
                                BluetoothMapContract.ConvoContactColumns.CONVO_ID + " = "
                                        + contactId, null, null);
                Cursor contacts = BluetoothMethodProxy.getInstance().contentResolverQuery(mResolver,
                        contactsUri, BluetoothMapContract.BT_CONTACT_PROJECTION,
                        BluetoothMapContract.ConvoContactColumns.CONVO_ID + " = " + contactId, null,
                        null);
                try {
                    // TODO this will not work for group-chats
                    if (contacts != null && contacts.moveToFirst()) {
@@ -1173,7 +1178,8 @@ public class BluetoothMapContent {
        }
    }

    private void setSenderName(BluetoothMapMessageListingElement e, Cursor c, FilterInfo fi,
    @VisibleForTesting
    void setSenderName(BluetoothMapMessageListingElement e, Cursor c, FilterInfo fi,
            BluetoothMapAppParams ap) {
        if ((ap.getParameterMask() & MASK_SENDER_NAME) != 0) {
            String name = "";
@@ -1227,10 +1233,10 @@ public class BluetoothMapContent {
                // For IM we add the contact ID in the addressing
                long contactId = c.getLong(fi.mMessageColFromAddress);
                Uri contactsUri = Uri.parse(mBaseUri + BluetoothMapContract.TABLE_CONVOCONTACT);
                Cursor contacts =
                        mResolver.query(contactsUri, BluetoothMapContract.BT_CONTACT_PROJECTION,
                                BluetoothMapContract.ConvoContactColumns.CONVO_ID + " = "
                                        + contactId, null, null);
                Cursor contacts = BluetoothMethodProxy.getInstance().contentResolverQuery(mResolver,
                        contactsUri, BluetoothMapContract.BT_CONTACT_PROJECTION,
                        BluetoothMapContract.ConvoContactColumns.CONVO_ID + " = " + contactId, null,
                        null);
                try {
                    // TODO this will not work for group-chats
                    if (contacts != null && contacts.moveToFirst()) {
@@ -1278,9 +1284,8 @@ public class BluetoothMapContent {
        }
    }


    private void setLastActivity(BluetoothMapConvoListingElement e, Cursor c, FilterInfo fi,
            BluetoothMapAppParams ap) {
    @VisibleForTesting
    void setLastActivity(BluetoothMapConvoListingElement e, Cursor c, FilterInfo fi) {
        long date = 0;
        if (fi.mMsgType == FilterInfo.TYPE_SMS || fi.mMsgType == FilterInfo.TYPE_MMS) {
            date = c.getLong(MMS_SMS_THREAD_COL_DATE);
@@ -1392,7 +1397,7 @@ public class BluetoothMapContent {
    private BluetoothMapConvoListingElement createConvoElement(Cursor c, FilterInfo fi,
            BluetoothMapAppParams ap) {
        BluetoothMapConvoListingElement e = new BluetoothMapConvoListingElement();
        setLastActivity(e, c, fi, ap);
        setLastActivity(e, c, fi);
        e.setType(getType(c, fi));
//        setConvoRead(e, c, fi, ap);
        e.setCursorIndex(c.getPosition());
+6 −10
Original line number Diff line number Diff line
@@ -166,7 +166,8 @@ public class BluetoothPbapService extends ProfileService implements IObexConnect

    private PbapHandler mSessionStatusHandler;
    private HandlerThread mHandlerThread;
    private final HashMap<BluetoothDevice, PbapStateMachine> mPbapStateMachineMap = new HashMap<>();
    @VisibleForTesting
    final HashMap<BluetoothDevice, PbapStateMachine> mPbapStateMachineMap = new HashMap<>();
    private volatile int mNextNotificationId = PBAP_NOTIFICATION_ID_START;

    // package and class name to which we send intent to check phone book access permission
@@ -276,7 +277,8 @@ public class BluetoothPbapService extends ProfileService implements IObexConnect
        }
    }

    private BroadcastReceiver mPbapReceiver = new BroadcastReceiver() {
    @VisibleForTesting
    BroadcastReceiver mPbapReceiver = new BroadcastReceiver() {
        @Override
        public void onReceive(Context context, Intent intent) {
            parseIntent(intent);
@@ -446,10 +448,6 @@ public class BluetoothPbapService extends ProfileService implements IObexConnect
    public int getConnectionState(BluetoothDevice device) {
        enforceCallingOrSelfPermission(
                BLUETOOTH_PRIVILEGED, "Need BLUETOOTH_PRIVILEGED permission");
        if (mPbapStateMachineMap == null) {
            return BluetoothProfile.STATE_DISCONNECTED;
        }

        synchronized (mPbapStateMachineMap) {
            PbapStateMachine sm = mPbapStateMachineMap.get(device);
            if (sm == null) {
@@ -460,9 +458,6 @@ public class BluetoothPbapService extends ProfileService implements IObexConnect
    }

    List<BluetoothDevice> getConnectedDevices() {
        if (mPbapStateMachineMap == null) {
            return new ArrayList<>();
        }
        synchronized (mPbapStateMachineMap) {
            return new ArrayList<>(mPbapStateMachineMap.keySet());
        }
@@ -470,7 +465,7 @@ public class BluetoothPbapService extends ProfileService implements IObexConnect

    List<BluetoothDevice> getDevicesMatchingConnectionStates(int[] states) {
        List<BluetoothDevice> devices = new ArrayList<>();
        if (mPbapStateMachineMap == null || states == null) {
        if (states == null) {
            return devices;
        }
        synchronized (mPbapStateMachineMap) {
@@ -631,6 +626,7 @@ public class BluetoothPbapService extends ProfileService implements IObexConnect
        getContentResolver().unregisterContentObserver(mContactChangeObserver);
        mContactChangeObserver = null;
        setComponentAvailable(PBAP_ACTIVITY, false);
        mPbapStateMachineMap.clear();
        return true;
    }

Loading