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

Commit 9b18c447 authored by Sal Savage's avatar Sal Savage Committed by Automerger Merge Worker
Browse files

Merge "Refactor PBAP Client logging to be unguarded" into main am: 14267b21

parents 19eee147 14267b21
Loading
Loading
Loading
Loading
+7 −8
Original line number Diff line number Diff line
@@ -26,7 +26,6 @@ import android.util.Log;

public class Authenticator extends AbstractAccountAuthenticator {
    private static final String TAG = "PbapClientAuthenticator";
    private static final boolean DBG = Log.isLoggable(TAG, Log.DEBUG);

    public Authenticator(Context context) {
        super(context);
@@ -35,7 +34,7 @@ public class Authenticator extends AbstractAccountAuthenticator {
    // Editing properties is not supported
    @Override
    public Bundle editProperties(AccountAuthenticatorResponse r, String s) {
        if (DBG) Log.d(TAG, "got call", new Exception());
        Log.d(TAG, "got call", new Exception());
        throw new UnsupportedOperationException();
    }

@@ -43,7 +42,7 @@ public class Authenticator extends AbstractAccountAuthenticator {
    @Override
    public Bundle addAccount(AccountAuthenticatorResponse r, String s, String s2, String[] strings,
            Bundle bundle) throws NetworkErrorException {
        if (DBG) Log.d(TAG, "got call", new Exception());
        Log.d(TAG, "got call", new Exception());
        // Don't allow accounts to be added.
        throw new UnsupportedOperationException();
    }
@@ -52,7 +51,7 @@ public class Authenticator extends AbstractAccountAuthenticator {
    @Override
    public Bundle confirmCredentials(AccountAuthenticatorResponse r, Account account, Bundle bundle)
            throws NetworkErrorException {
        if (DBG) Log.d(TAG, "got call", new Exception());
        Log.d(TAG, "got call", new Exception());
        return null;
    }

@@ -60,14 +59,14 @@ public class Authenticator extends AbstractAccountAuthenticator {
    @Override
    public Bundle getAuthToken(AccountAuthenticatorResponse r, Account account, String s,
            Bundle bundle) throws NetworkErrorException {
        if (DBG) Log.d(TAG, "got call", new Exception());
        Log.d(TAG, "got call", new Exception());
        throw new UnsupportedOperationException();
    }

    // Getting a label for the auth token is not supported
    @Override
    public String getAuthTokenLabel(String s) {
        if (DBG) Log.d(TAG, "got call", new Exception());
        Log.d(TAG, "got call", new Exception());
        return null;
    }

@@ -75,7 +74,7 @@ public class Authenticator extends AbstractAccountAuthenticator {
    @Override
    public Bundle updateCredentials(AccountAuthenticatorResponse r, Account account, String s,
            Bundle bundle) throws NetworkErrorException {
        if (DBG) Log.d(TAG, "got call", new Exception());
        Log.d(TAG, "got call", new Exception());
        return null;
    }

@@ -83,7 +82,7 @@ public class Authenticator extends AbstractAccountAuthenticator {
    @Override
    public Bundle hasFeatures(AccountAuthenticatorResponse r, Account account, String[] strings)
            throws NetworkErrorException {
        if (DBG) Log.d(TAG, "got call", new Exception());
        Log.d(TAG, "got call", new Exception());

        final Bundle result = new Bundle();
        result.putBoolean(AccountManager.KEY_BOOLEAN_RESULT, false);
+5 −10
Original line number Diff line number Diff line
@@ -29,10 +29,7 @@ import java.util.Arrays;
 * authentication is implementation defined.
 */
class BluetoothPbapObexAuthenticator implements Authenticator {

    private static final String TAG = "PbapClientObexAuth";
    private static final boolean DBG = Log.isLoggable(TAG, Log.DEBUG);
    private static final boolean VDBG = Log.isLoggable(TAG, Log.VERBOSE);

    //Default session key for legacy devices is 0000
    @VisibleForTesting
@@ -42,16 +39,14 @@ class BluetoothPbapObexAuthenticator implements Authenticator {
    public PasswordAuthentication onAuthenticationChallenge(String description,
            boolean isUserIdRequired, boolean isFullAccess) {
        PasswordAuthentication pa = null;
        if (DBG) Log.d(TAG, "onAuthenticationChallenge: starting");
        Log.d(TAG, "onAuthenticationChallenge: starting");

        if (mSessionKey != null && mSessionKey.length() != 0) {
            if (DBG) Log.d(TAG, "onAuthenticationChallenge: mSessionKey=" + mSessionKey);
            Log.d(TAG, "onAuthenticationChallenge: mSessionKey=" + mSessionKey);
            pa = new PasswordAuthentication(null, mSessionKey.getBytes());
        } else {
            if (DBG) {
            Log.d(TAG,
                        "onAuthenticationChallenge: mSessionKey is empty, timeout/cancel occured");
            }
                    "onAuthenticationChallenge: mSessionKey is empty, timeout/cancel occurred");
        }

        return pa;
@@ -59,7 +54,7 @@ class BluetoothPbapObexAuthenticator implements Authenticator {

    @Override
    public byte[] onAuthenticationResponse(byte[] userName) {
        if (VDBG) Log.v(TAG, "onAuthenticationResponse: " + Arrays.toString(userName));
        Log.v(TAG, "onAuthenticationResponse: " + Arrays.toString(userName));
        /* required only in case PCE challenges PSE which we don't do now */
        return null;
    }
+5 −7
Original line number Diff line number Diff line
@@ -27,9 +27,7 @@ import java.io.IOException;
import java.io.InputStream;

abstract class BluetoothPbapRequest {

    static final String TAG = "PbapClient.BaseRequest";
    private static final boolean DBG = Log.isLoggable(TAG, Log.DEBUG);

    protected static final byte OAP_TAGID_ORDER = 0x01;
    protected static final byte OAP_TAGID_SEARCH_VALUE = 0x02;
@@ -59,7 +57,7 @@ abstract class BluetoothPbapRequest {
    }

    public void execute(ClientSession session) throws IOException {
        if (DBG) Log.v(TAG, "execute");
        Log.v(TAG, "execute");

        /* in case request is aborted before can be executed */
        if (mAborted) {
@@ -89,7 +87,7 @@ abstract class BluetoothPbapRequest {

            mResponseCode = mOp.getResponseCode();

            if (DBG) Log.d(TAG, "mResponseCode=" + mResponseCode);
            Log.d(TAG, "mResponseCode=" + mResponseCode);

            checkResponseCode(mResponseCode);
        } catch (IOException e) {
@@ -113,19 +111,19 @@ abstract class BluetoothPbapRequest {
    }

    protected void readResponse(InputStream stream) throws IOException {
        if (DBG) Log.v(TAG, "readResponse");
        Log.v(TAG, "readResponse");

        /* nothing here by default */
    }

    protected void readResponseHeaders(HeaderSet headerset) {
        if (DBG) Log.v(TAG, "readResponseHeaders");
        Log.v(TAG, "readResponseHeaders");

        /* nothing here by dafault */
    }

    protected void checkResponseCode(int responseCode) throws IOException {
        if (DBG) Log.v(TAG, "checkResponseCode");
        Log.v(TAG, "checkResponseCode");

        /* nothing here by dafault */
    }
+3 −6
Original line number Diff line number Diff line
@@ -29,7 +29,6 @@ import java.util.ArrayList;

final class BluetoothPbapRequestPullPhoneBook extends BluetoothPbapRequest {
    private static final String TAG = "PbapClient.PullPb";
    private static final boolean VDBG = Log.isLoggable(TAG, Log.VERBOSE);

    private static final String TYPE = "x-bt/phonebook";

@@ -91,17 +90,15 @@ final class BluetoothPbapRequestPullPhoneBook extends BluetoothPbapRequest {

    @Override
    protected void readResponse(InputStream stream) throws IOException {
        if (VDBG) Log.v(TAG, "readResponse");
        Log.v(TAG, "readResponse");

        mResponse = new BluetoothPbapVcardList(mAccount, stream, mFormat);
        if (VDBG) {
            Log.d(TAG, "Read " + mResponse.getCount() + " entries.");
        }
        Log.d(TAG, "Read " + mResponse.getCount() + " entries");
    }

    @Override
    protected void readResponseHeaders(HeaderSet headerset) {
        if (VDBG) Log.v(TAG, "readResponseHeaders");
        Log.v(TAG, "readResponseHeaders");

        ObexAppParameters oap = ObexAppParameters.fromHeaderSet(headerset);

+1 −4
Original line number Diff line number Diff line
@@ -23,7 +23,6 @@ import com.android.obex.HeaderSet;

final class BluetoothPbapRequestPullPhoneBookSize extends BluetoothPbapRequest {
    private static final String TAG = "PbapClient.PullPbSize";
    private static final boolean VDBG = Log.isLoggable(TAG, Log.VERBOSE);

    private static final String TYPE = "x-bt/phonebook";

@@ -48,9 +47,7 @@ final class BluetoothPbapRequestPullPhoneBookSize extends BluetoothPbapRequest {

    @Override
    protected void readResponseHeaders(HeaderSet headerset) {
        if (VDBG) {
        Log.v(TAG, "readResponseHeaders");
        }

        ObexAppParameters oap = ObexAppParameters.fromHeaderSet(headerset);

Loading