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

Commit 28e1b8a3 authored by Hemant Gupta's avatar Hemant Gupta Committed by Myles Watson
Browse files

PBAP: Send correct Get response when storage is locked.

Precondition:
1) DUT is in Direct Boot mode, and user has not unlocked.
2) DUT is connected to carkit supporting PBAP

Usecase:
Carkit sends request for get phonebook size or get phonebook.

Expected Result:
DUT should return error as Service unavailable as per BT PBAP Spec,
instead of sending 0 as length of phonebook, or sending xml with
no vcard in above usecase.

Observed behaviour:
DUT sends 0 as length of phonebook, and sends empty xml for phonebook request.

Fix:
During get request from carkit, return OBEX_SERVICE_UNAVAILABLE error if DUT is in
direct boot mode.

Test: Checked if error code is sent out when storage is not accessible in Direct
boot mode.

Bug: 38302549
Change-Id: I906cf7cef5caf650d0bea6bdf0ff71100ecf761a
parent e42bd8ae
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@ import android.content.Context;
import android.database.Cursor;
import android.os.Handler;
import android.os.Message;
import android.os.UserManager;
import android.provider.CallLog;
import android.provider.CallLog.Calls;
import android.text.TextUtils;
@@ -431,6 +432,12 @@ public class BluetoothPbapObexServer extends ServerRequestHandler {
        if (type == null) {
            return ResponseCodes.OBEX_HTTP_NOT_ACCEPTABLE;
        }

        if (!UserManager.get(mContext).isUserUnlocked()) {
            Log.e(TAG, "Storage locked, " + type + " failed");
            return ResponseCodes.OBEX_HTTP_UNAVAILABLE;
        }

        // Accroding to specification,the name header could be omitted such as
        // sony erriccsonHBH-DS980