Loading android/app/.clang-format +2 −5 Original line number Diff line number Diff line Loading @@ -25,8 +25,5 @@ DerivePointerAlignment: false --- Language: Java BasedOnStyle: Google IndentWidth: 4 ContinuationIndentWidth: 8 ColumnLimit: 100 AllowShortIfStatementsOnASingleLine: true # Java format is handled by check_style hook DisableFormat: true android/app/PREUPLOAD.cfg +5 −0 Original line number Diff line number Diff line Loading @@ -4,3 +4,8 @@ ignore_merged_commits = true [Builtin Hooks] clang_format = true [Hook Scripts] checkstyle_hook = ${REPO_ROOT}/prebuilts/checkstyle/checkstyle.py --sha ${PREUPLOAD_COMMIT} -fw src/com/android/bluetooth/ lib/mapapi/com/android/bluetooth/mapapi/ tests/src/com/android/bluetooth/ android/app/lib/mapapi/com/android/bluetooth/mapapi/BluetoothMapContract.java +145 −139 Original line number Diff line number Diff line Loading @@ -43,13 +43,13 @@ import android.net.Uri; * this interface, the {@code provider} tag for the Bluetooth related content provider must * have an intent-filter like the following in the manifest: * <pre class="prettyprint"><provider android:authorities="[PROVIDER AUTHORITY]" android:exported="true" android:enabled="true" android:permission="android.permission.BLUETOOTH_MAP"> * android:exported="true" * android:enabled="true" * android:permission="android.permission.BLUETOOTH_MAP"> * ... * <intent-filter> <action android:name="android.content.action.BLEUETOOT_MAP_PROVIDER" /> </intent-filter> * <action android:name="android.content.action.BLEUETOOT_MAP_PROVIDER" /> * </intent-filter> * ... * </provider> * [PROVIDER AUTHORITY] shall be the providers authority value which implements this Loading Loading @@ -162,8 +162,11 @@ public final class BluetoothMapContract { */ public static Uri buildAccountUri(String authority) { return new Uri.Builder().scheme(ContentResolver.SCHEME_CONTENT) .authority(authority).appendPath(TABLE_ACCOUNT).build(); .authority(authority) .appendPath(TABLE_ACCOUNT) .build(); } /** * Build URI representing the given Account data-set with specific Id in a * Bluetooth provider. When queried, the direct URI for the account Loading @@ -176,6 +179,7 @@ public final class BluetoothMapContract { .appendPath(accountId) .build(); } /** * Build URI representing the entire Message table in a * Bluetooth provider. Loading @@ -186,6 +190,7 @@ public final class BluetoothMapContract { .appendPath(TABLE_MESSAGE) .build(); } /** * Build URI representing the given Message data-set in a * Bluetooth provider. When queried, the URI for the Messages Loading @@ -198,6 +203,7 @@ public final class BluetoothMapContract { .appendPath(TABLE_MESSAGE) .build(); } /** * Build URI representing the given Message data-set with specific messageId in a * Bluetooth provider. When queried, the direct URI for the account Loading @@ -211,6 +217,7 @@ public final class BluetoothMapContract { .appendPath(messageId) .build(); } /** * Build URI representing the given Message data-set in a * Bluetooth provider. When queried, the direct URI for the folder Loading Loading @@ -261,6 +268,7 @@ public final class BluetoothMapContract { .appendPath(TABLE_CONVOCONTACT) .build(); } /** * Build URI representing the given Contact data-set in a * Bluetooth provider. When queried, the direct URI for the contact Loading @@ -275,6 +283,7 @@ public final class BluetoothMapContract { .appendPath(contactId) .build(); } /** * @hide */ Loading Loading @@ -510,6 +519,7 @@ public final class BluetoothMapContract { String RAW_DATA = "raw_data"; } /** * The actual message table containing all messages. * Content that must support filtering using WHERE clauses: Loading Loading @@ -665,7 +675,6 @@ public final class BluetoothMapContract { public interface EmailMessageColumns { /** * A comma-delimited list of CC addresses in RFC2822 format. * The list must be compatible with Rfc822Tokenizer.tokenize(); Loading Loading @@ -1117,9 +1126,7 @@ public final class BluetoothMapContract { * A projection of all the columns in the Account table */ public static final String[] BT_ACCOUNT_PROJECTION = new String[]{ AccountColumns._ID, AccountColumns.ACCOUNT_DISPLAY_NAME, AccountColumns.FLAG_EXPOSE, AccountColumns._ID, AccountColumns.ACCOUNT_DISPLAY_NAME, AccountColumns.FLAG_EXPOSE, }; /** Loading Loading @@ -1201,8 +1208,7 @@ public final class BluetoothMapContract { * A projection of all the columns in the Chat Status table */ public static final String[] BT_CHATSTATUS_PROJECTION = new String[]{ ChatStatusColumns.CHAT_STATE, ChatStatusColumns.LAST_ACTIVE, ChatStatusColumns.CHAT_STATE, ChatStatusColumns.LAST_ACTIVE, }; /** Loading android/app/lib/mapapi/com/android/bluetooth/mapapi/BluetoothMapEmailProvider.java +129 −96 Original line number Diff line number Diff line Loading @@ -73,8 +73,7 @@ public abstract class BluetoothMapEmailProvider extends ContentProvider { * @throws IOException */ protected abstract void WriteMessageToStream(long accountId, long messageId, boolean includeAttachment, boolean download, FileOutputStream out) throws IOException; boolean includeAttachment, boolean download, FileOutputStream out) throws IOException; /** * @return the CONTENT_URI exposed. This will be used to send out notifications. Loading @@ -99,8 +98,8 @@ public abstract class BluetoothMapEmailProvider extends ContentProvider { } // Enforce correct permissions are used if (!android.Manifest.permission.BLUETOOTH_MAP.equals(info.writePermission)) { throw new SecurityException("Provider must be protected by " + android.Manifest.permission.BLUETOOTH_MAP); throw new SecurityException( "Provider must be protected by " + android.Manifest.permission.BLUETOOTH_MAP); } mResolver = context.getContentResolver(); super.attachInfo(context, info); Loading Loading @@ -135,8 +134,8 @@ public abstract class BluetoothMapEmailProvider extends ContentProvider { * Use the message to do an update of the message specified by the URI. */ @Override public void readDataFromPipe(ParcelFileDescriptor input, Uri uri, String mimeType, Bundle opts, Cursor args) { public void readDataFromPipe(ParcelFileDescriptor input, Uri uri, String mimeType, Bundle opts, Cursor args) { Log.v(TAG, "readDataFromPipe(): uri=" + uri.toString()); FileInputStream fIn = null; try { Loading @@ -146,13 +145,15 @@ public abstract class BluetoothMapEmailProvider extends ContentProvider { UpdateMimeMessageFromStream(fIn, accountId, messageId); } catch (IOException e) { Log.w(TAG, "IOException: ", e); /* TODO: How to signal the error to the calling entity? Had expected readDataFromPipe /* TODO: How to signal the error to the calling entity? Had expected readDataFromPipe * to throw IOException? */ } finally { try { if(fIn != null) if (fIn != null) { fIn.close(); } } catch (IOException e) { Log.w(TAG, e); } Loading Loading @@ -181,8 +182,10 @@ public abstract class BluetoothMapEmailProvider extends ContentProvider { @Override public void writeDataToPipe(ParcelFileDescriptor output, Uri uri, String mimeType, Bundle opts, Cursor c) { if (D) Log.d(TAG, "writeDataToPipe(): uri=" + uri.toString() + " - getLastPathSegment() = " + uri.getLastPathSegment()); if (D) { Log.d(TAG, "writeDataToPipe(): uri=" + uri.toString() + " - getLastPathSegment() = " + uri.getLastPathSegment()); } FileOutputStream fout = null; Loading @@ -198,7 +201,8 @@ public abstract class BluetoothMapEmailProvider extends ContentProvider { String format = segments.get(3); if (format.equalsIgnoreCase(BluetoothMapContract.FILE_MSG_NO_ATTACHMENTS)) { includeAttachments = false; } else if(format.equalsIgnoreCase(BluetoothMapContract.FILE_MSG_DOWNLOAD_NO_ATTACHMENTS)) { } else if (format.equalsIgnoreCase( BluetoothMapContract.FILE_MSG_DOWNLOAD_NO_ATTACHMENTS)) { includeAttachments = false; download = true; } else if (format.equalsIgnoreCase(BluetoothMapContract.FILE_MSG_DOWNLOAD)) { Loading Loading @@ -244,7 +248,9 @@ public abstract class BluetoothMapEmailProvider extends ContentProvider { } else { newUri = BluetoothMapContract.buildAccountUriwithId(mAuthority, accountId); } if(D) Log.d(TAG,"onAccountChanged() accountId = " + accountId + " URI: " + newUri); if (D) { Log.d(TAG, "onAccountChanged() accountId = " + accountId + " URI: " + newUri); } mResolver.notifyChange(newUri, null); } Loading @@ -266,14 +272,17 @@ public abstract class BluetoothMapEmailProvider extends ContentProvider { if (accountId == null) { newUri = BluetoothMapContract.buildMessageUri(mAuthority); } else { if(messageId == null) { if (messageId == null) { newUri = BluetoothMapContract.buildMessageUri(mAuthority, accountId); } else { newUri = BluetoothMapContract.buildMessageUriWithId(mAuthority,accountId, messageId); newUri = BluetoothMapContract.buildMessageUriWithId(mAuthority, accountId, messageId); } } if (D) { Log.d(TAG, "onMessageChanged() accountId = " + accountId + " messageId = " + messageId + " URI: " + newUri); } if(D) Log.d(TAG,"onMessageChanged() accountId = " + accountId + " messageId = " + messageId + " URI: " + newUri); mResolver.notifyChange(newUri, null); } Loading Loading @@ -318,8 +327,10 @@ public abstract class BluetoothMapEmailProvider extends ContentProvider { @Override public ParcelFileDescriptor openFile(Uri uri, String mode) throws FileNotFoundException { long callingId = Binder.clearCallingIdentity(); if(D)Log.d(TAG, "openFile(): uri=" + uri.toString() + " - getLastPathSegment() = " + uri.getLastPathSegment()); if (D) { Log.d(TAG, "openFile(): uri=" + uri.toString() + " - getLastPathSegment() = " + uri.getLastPathSegment()); } try { /* To be able to do abstraction of the file IO, we simply ignore the URI at this * point and let the read/write function implementations parse the URI. */ Loading Loading @@ -387,28 +398,35 @@ public abstract class BluetoothMapEmailProvider extends ContentProvider { */ @Override public int delete(Uri uri, String where, String[] selectionArgs) { if (D) Log.d(TAG, "delete(): uri=" + uri.toString() ); if (D) { Log.d(TAG, "delete(): uri=" + uri.toString()); } int result = 0; String table = uri.getPathSegments().get(1); if(table == null) if (table == null) { throw new IllegalArgumentException("Table missing in URI"); } // the id of the entry to be deleted from the database String messageId = uri.getLastPathSegment(); if (messageId == null) if (messageId == null) { throw new IllegalArgumentException("Message ID missing in update values!"); } String accountId = getAccountId(uri); if (accountId == null) if (accountId == null) { throw new IllegalArgumentException("Account ID missing in update values!"); } long callingId = Binder.clearCallingIdentity(); try { if (table.equals(BluetoothMapContract.TABLE_MESSAGE)) { return deleteMessage(accountId, messageId); } else { if (D) Log.w(TAG, "Unknown table name: " + table); if (D) { Log.w(TAG, "Unknown table name: " + table); } return result; } } finally { Loading Loading @@ -446,12 +464,14 @@ public abstract class BluetoothMapEmailProvider extends ContentProvider { String id; // the id of the entry inserted into the database long callingId = Binder.clearCallingIdentity(); Log.d(TAG, "insert(): uri=" + uri.toString() + " - getLastPathSegment() = " + uri.getLastPathSegment()); Log.d(TAG, "insert(): uri=" + uri.toString() + " - getLastPathSegment() = " + uri.getLastPathSegment()); try { if (table.equals(BluetoothMapContract.TABLE_MESSAGE)) { id = insertMessage(accountId, folderId.toString()); if(D) Log.i(TAG, "insert() ID: " + id); if (D) { Log.i(TAG, "insert() ID: " + id); } return Uri.parse(uri.toString() + "/" + id); } else { Log.w(TAG, "Unknown table name: " + table); Loading Loading @@ -491,7 +511,8 @@ public abstract class BluetoothMapEmailProvider extends ContentProvider { } /** * This query needs to map from the data used in the e-mail client to BluetoothMapContract type of data. * This query needs to map from the data used in the e-mail client to BluetoothMapContract * type of data. */ @Override public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, Loading Loading @@ -526,8 +547,8 @@ public abstract class BluetoothMapEmailProvider extends ContentProvider { * @param sortOrder * @return a cursor to the accounts that are subject to exposure over BT. */ protected abstract Cursor queryAccount(String[] projection, String selection, String[] selectionArgs, String sortOrder); protected abstract Cursor queryAccount(String[] projection, String selection, String[] selectionArgs, String sortOrder); /** * Filter out the non usable folders and ensure to name the mandatory folders Loading @@ -539,8 +560,9 @@ public abstract class BluetoothMapEmailProvider extends ContentProvider { * @param sortOrder * @return */ protected abstract Cursor queryFolder(String accountId, String[] projection, String selection, String[] selectionArgs, String sortOrder); protected abstract Cursor queryFolder(String accountId, String[] projection, String selection, String[] selectionArgs, String sortOrder); /** * For the message table the selection (where clause) can only include the following columns: * date: less than, greater than and equals Loading @@ -559,8 +581,8 @@ public abstract class BluetoothMapEmailProvider extends ContentProvider { * @param sortOrder * @return a cursor to query result */ protected abstract Cursor queryMessage(String accountId, String[] projection, String selection, String[] selectionArgs, String sortOrder); protected abstract Cursor queryMessage(String accountId, String[] projection, String selection, String[] selectionArgs, String sortOrder); /** * update() Loading @@ -580,19 +602,23 @@ public abstract class BluetoothMapEmailProvider extends ContentProvider { throw new IllegalArgumentException("Table missing in URI"); } if (selection != null) { throw new IllegalArgumentException("selection shall not be used, ContentValues shall contain the data"); throw new IllegalArgumentException( "selection shall not be used, ContentValues shall contain the data"); } long callingId = Binder.clearCallingIdentity(); if(D)Log.w(TAG, "update(): uri=" + uri.toString() + " - getLastPathSegment() = " + uri.getLastPathSegment()); if (D) { Log.w(TAG, "update(): uri=" + uri.toString() + " - getLastPathSegment() = " + uri.getLastPathSegment()); } try { if (table.equals(BluetoothMapContract.TABLE_ACCOUNT)) { String accountId = values.getAsString(BluetoothMapContract.AccountColumns._ID); if (accountId == null) { throw new IllegalArgumentException("Account ID missing in update values!"); } Integer exposeFlag = values.getAsInteger(BluetoothMapContract.AccountColumns.FLAG_EXPOSE); Integer exposeFlag = values.getAsInteger(BluetoothMapContract.AccountColumns.FLAG_EXPOSE); if (exposeFlag == null) { throw new IllegalArgumentException("Expose flag missing in update values!"); } Loading @@ -606,10 +632,13 @@ public abstract class BluetoothMapEmailProvider extends ContentProvider { throw new IllegalArgumentException("Message ID missing in update values!"); } Long folderId = values.getAsLong(BluetoothMapContract.MessageColumns.FOLDER_ID); Boolean flagRead = values.getAsBoolean(BluetoothMapContract.MessageColumns.FLAG_READ); Boolean flagRead = values.getAsBoolean(BluetoothMapContract.MessageColumns.FLAG_READ); return updateMessage(accountId, messageId, folderId, flagRead); } else { if(D)Log.w(TAG, "Unknown table name: " + table); if (D) { Log.w(TAG, "Unknown table name: " + table); } return 0; } } finally { Loading @@ -634,13 +663,17 @@ public abstract class BluetoothMapEmailProvider extends ContentProvider { * @param flagRead the new flagRead value to set - ignore if null. * @return */ protected abstract int updateMessage(String accountId, Long messageId, Long folderId, Boolean flagRead); protected abstract int updateMessage(String accountId, Long messageId, Long folderId, Boolean flagRead); @Override public Bundle call(String method, String arg, Bundle extras) { long callingId = Binder.clearCallingIdentity(); if(D)Log.d(TAG, "call(): method=" + method + " arg=" + arg + "ThreadId: " + Thread.currentThread().getId()); if (D) { Log.d(TAG, "call(): method=" + method + " arg=" + arg + "ThreadId: " + Thread.currentThread().getId()); } try { if (method.equals(BluetoothMapContract.METHOD_UPDATE_FOLDER)) { Loading android/app/lib/mapapi/com/android/bluetooth/mapapi/BluetoothMapIMProvider.java +134 −110 File changed.Preview size limit exceeded, changes collapsed. Show changes Loading
android/app/.clang-format +2 −5 Original line number Diff line number Diff line Loading @@ -25,8 +25,5 @@ DerivePointerAlignment: false --- Language: Java BasedOnStyle: Google IndentWidth: 4 ContinuationIndentWidth: 8 ColumnLimit: 100 AllowShortIfStatementsOnASingleLine: true # Java format is handled by check_style hook DisableFormat: true
android/app/PREUPLOAD.cfg +5 −0 Original line number Diff line number Diff line Loading @@ -4,3 +4,8 @@ ignore_merged_commits = true [Builtin Hooks] clang_format = true [Hook Scripts] checkstyle_hook = ${REPO_ROOT}/prebuilts/checkstyle/checkstyle.py --sha ${PREUPLOAD_COMMIT} -fw src/com/android/bluetooth/ lib/mapapi/com/android/bluetooth/mapapi/ tests/src/com/android/bluetooth/
android/app/lib/mapapi/com/android/bluetooth/mapapi/BluetoothMapContract.java +145 −139 Original line number Diff line number Diff line Loading @@ -43,13 +43,13 @@ import android.net.Uri; * this interface, the {@code provider} tag for the Bluetooth related content provider must * have an intent-filter like the following in the manifest: * <pre class="prettyprint"><provider android:authorities="[PROVIDER AUTHORITY]" android:exported="true" android:enabled="true" android:permission="android.permission.BLUETOOTH_MAP"> * android:exported="true" * android:enabled="true" * android:permission="android.permission.BLUETOOTH_MAP"> * ... * <intent-filter> <action android:name="android.content.action.BLEUETOOT_MAP_PROVIDER" /> </intent-filter> * <action android:name="android.content.action.BLEUETOOT_MAP_PROVIDER" /> * </intent-filter> * ... * </provider> * [PROVIDER AUTHORITY] shall be the providers authority value which implements this Loading Loading @@ -162,8 +162,11 @@ public final class BluetoothMapContract { */ public static Uri buildAccountUri(String authority) { return new Uri.Builder().scheme(ContentResolver.SCHEME_CONTENT) .authority(authority).appendPath(TABLE_ACCOUNT).build(); .authority(authority) .appendPath(TABLE_ACCOUNT) .build(); } /** * Build URI representing the given Account data-set with specific Id in a * Bluetooth provider. When queried, the direct URI for the account Loading @@ -176,6 +179,7 @@ public final class BluetoothMapContract { .appendPath(accountId) .build(); } /** * Build URI representing the entire Message table in a * Bluetooth provider. Loading @@ -186,6 +190,7 @@ public final class BluetoothMapContract { .appendPath(TABLE_MESSAGE) .build(); } /** * Build URI representing the given Message data-set in a * Bluetooth provider. When queried, the URI for the Messages Loading @@ -198,6 +203,7 @@ public final class BluetoothMapContract { .appendPath(TABLE_MESSAGE) .build(); } /** * Build URI representing the given Message data-set with specific messageId in a * Bluetooth provider. When queried, the direct URI for the account Loading @@ -211,6 +217,7 @@ public final class BluetoothMapContract { .appendPath(messageId) .build(); } /** * Build URI representing the given Message data-set in a * Bluetooth provider. When queried, the direct URI for the folder Loading Loading @@ -261,6 +268,7 @@ public final class BluetoothMapContract { .appendPath(TABLE_CONVOCONTACT) .build(); } /** * Build URI representing the given Contact data-set in a * Bluetooth provider. When queried, the direct URI for the contact Loading @@ -275,6 +283,7 @@ public final class BluetoothMapContract { .appendPath(contactId) .build(); } /** * @hide */ Loading Loading @@ -510,6 +519,7 @@ public final class BluetoothMapContract { String RAW_DATA = "raw_data"; } /** * The actual message table containing all messages. * Content that must support filtering using WHERE clauses: Loading Loading @@ -665,7 +675,6 @@ public final class BluetoothMapContract { public interface EmailMessageColumns { /** * A comma-delimited list of CC addresses in RFC2822 format. * The list must be compatible with Rfc822Tokenizer.tokenize(); Loading Loading @@ -1117,9 +1126,7 @@ public final class BluetoothMapContract { * A projection of all the columns in the Account table */ public static final String[] BT_ACCOUNT_PROJECTION = new String[]{ AccountColumns._ID, AccountColumns.ACCOUNT_DISPLAY_NAME, AccountColumns.FLAG_EXPOSE, AccountColumns._ID, AccountColumns.ACCOUNT_DISPLAY_NAME, AccountColumns.FLAG_EXPOSE, }; /** Loading Loading @@ -1201,8 +1208,7 @@ public final class BluetoothMapContract { * A projection of all the columns in the Chat Status table */ public static final String[] BT_CHATSTATUS_PROJECTION = new String[]{ ChatStatusColumns.CHAT_STATE, ChatStatusColumns.LAST_ACTIVE, ChatStatusColumns.CHAT_STATE, ChatStatusColumns.LAST_ACTIVE, }; /** Loading
android/app/lib/mapapi/com/android/bluetooth/mapapi/BluetoothMapEmailProvider.java +129 −96 Original line number Diff line number Diff line Loading @@ -73,8 +73,7 @@ public abstract class BluetoothMapEmailProvider extends ContentProvider { * @throws IOException */ protected abstract void WriteMessageToStream(long accountId, long messageId, boolean includeAttachment, boolean download, FileOutputStream out) throws IOException; boolean includeAttachment, boolean download, FileOutputStream out) throws IOException; /** * @return the CONTENT_URI exposed. This will be used to send out notifications. Loading @@ -99,8 +98,8 @@ public abstract class BluetoothMapEmailProvider extends ContentProvider { } // Enforce correct permissions are used if (!android.Manifest.permission.BLUETOOTH_MAP.equals(info.writePermission)) { throw new SecurityException("Provider must be protected by " + android.Manifest.permission.BLUETOOTH_MAP); throw new SecurityException( "Provider must be protected by " + android.Manifest.permission.BLUETOOTH_MAP); } mResolver = context.getContentResolver(); super.attachInfo(context, info); Loading Loading @@ -135,8 +134,8 @@ public abstract class BluetoothMapEmailProvider extends ContentProvider { * Use the message to do an update of the message specified by the URI. */ @Override public void readDataFromPipe(ParcelFileDescriptor input, Uri uri, String mimeType, Bundle opts, Cursor args) { public void readDataFromPipe(ParcelFileDescriptor input, Uri uri, String mimeType, Bundle opts, Cursor args) { Log.v(TAG, "readDataFromPipe(): uri=" + uri.toString()); FileInputStream fIn = null; try { Loading @@ -146,13 +145,15 @@ public abstract class BluetoothMapEmailProvider extends ContentProvider { UpdateMimeMessageFromStream(fIn, accountId, messageId); } catch (IOException e) { Log.w(TAG, "IOException: ", e); /* TODO: How to signal the error to the calling entity? Had expected readDataFromPipe /* TODO: How to signal the error to the calling entity? Had expected readDataFromPipe * to throw IOException? */ } finally { try { if(fIn != null) if (fIn != null) { fIn.close(); } } catch (IOException e) { Log.w(TAG, e); } Loading Loading @@ -181,8 +182,10 @@ public abstract class BluetoothMapEmailProvider extends ContentProvider { @Override public void writeDataToPipe(ParcelFileDescriptor output, Uri uri, String mimeType, Bundle opts, Cursor c) { if (D) Log.d(TAG, "writeDataToPipe(): uri=" + uri.toString() + " - getLastPathSegment() = " + uri.getLastPathSegment()); if (D) { Log.d(TAG, "writeDataToPipe(): uri=" + uri.toString() + " - getLastPathSegment() = " + uri.getLastPathSegment()); } FileOutputStream fout = null; Loading @@ -198,7 +201,8 @@ public abstract class BluetoothMapEmailProvider extends ContentProvider { String format = segments.get(3); if (format.equalsIgnoreCase(BluetoothMapContract.FILE_MSG_NO_ATTACHMENTS)) { includeAttachments = false; } else if(format.equalsIgnoreCase(BluetoothMapContract.FILE_MSG_DOWNLOAD_NO_ATTACHMENTS)) { } else if (format.equalsIgnoreCase( BluetoothMapContract.FILE_MSG_DOWNLOAD_NO_ATTACHMENTS)) { includeAttachments = false; download = true; } else if (format.equalsIgnoreCase(BluetoothMapContract.FILE_MSG_DOWNLOAD)) { Loading Loading @@ -244,7 +248,9 @@ public abstract class BluetoothMapEmailProvider extends ContentProvider { } else { newUri = BluetoothMapContract.buildAccountUriwithId(mAuthority, accountId); } if(D) Log.d(TAG,"onAccountChanged() accountId = " + accountId + " URI: " + newUri); if (D) { Log.d(TAG, "onAccountChanged() accountId = " + accountId + " URI: " + newUri); } mResolver.notifyChange(newUri, null); } Loading @@ -266,14 +272,17 @@ public abstract class BluetoothMapEmailProvider extends ContentProvider { if (accountId == null) { newUri = BluetoothMapContract.buildMessageUri(mAuthority); } else { if(messageId == null) { if (messageId == null) { newUri = BluetoothMapContract.buildMessageUri(mAuthority, accountId); } else { newUri = BluetoothMapContract.buildMessageUriWithId(mAuthority,accountId, messageId); newUri = BluetoothMapContract.buildMessageUriWithId(mAuthority, accountId, messageId); } } if (D) { Log.d(TAG, "onMessageChanged() accountId = " + accountId + " messageId = " + messageId + " URI: " + newUri); } if(D) Log.d(TAG,"onMessageChanged() accountId = " + accountId + " messageId = " + messageId + " URI: " + newUri); mResolver.notifyChange(newUri, null); } Loading Loading @@ -318,8 +327,10 @@ public abstract class BluetoothMapEmailProvider extends ContentProvider { @Override public ParcelFileDescriptor openFile(Uri uri, String mode) throws FileNotFoundException { long callingId = Binder.clearCallingIdentity(); if(D)Log.d(TAG, "openFile(): uri=" + uri.toString() + " - getLastPathSegment() = " + uri.getLastPathSegment()); if (D) { Log.d(TAG, "openFile(): uri=" + uri.toString() + " - getLastPathSegment() = " + uri.getLastPathSegment()); } try { /* To be able to do abstraction of the file IO, we simply ignore the URI at this * point and let the read/write function implementations parse the URI. */ Loading Loading @@ -387,28 +398,35 @@ public abstract class BluetoothMapEmailProvider extends ContentProvider { */ @Override public int delete(Uri uri, String where, String[] selectionArgs) { if (D) Log.d(TAG, "delete(): uri=" + uri.toString() ); if (D) { Log.d(TAG, "delete(): uri=" + uri.toString()); } int result = 0; String table = uri.getPathSegments().get(1); if(table == null) if (table == null) { throw new IllegalArgumentException("Table missing in URI"); } // the id of the entry to be deleted from the database String messageId = uri.getLastPathSegment(); if (messageId == null) if (messageId == null) { throw new IllegalArgumentException("Message ID missing in update values!"); } String accountId = getAccountId(uri); if (accountId == null) if (accountId == null) { throw new IllegalArgumentException("Account ID missing in update values!"); } long callingId = Binder.clearCallingIdentity(); try { if (table.equals(BluetoothMapContract.TABLE_MESSAGE)) { return deleteMessage(accountId, messageId); } else { if (D) Log.w(TAG, "Unknown table name: " + table); if (D) { Log.w(TAG, "Unknown table name: " + table); } return result; } } finally { Loading Loading @@ -446,12 +464,14 @@ public abstract class BluetoothMapEmailProvider extends ContentProvider { String id; // the id of the entry inserted into the database long callingId = Binder.clearCallingIdentity(); Log.d(TAG, "insert(): uri=" + uri.toString() + " - getLastPathSegment() = " + uri.getLastPathSegment()); Log.d(TAG, "insert(): uri=" + uri.toString() + " - getLastPathSegment() = " + uri.getLastPathSegment()); try { if (table.equals(BluetoothMapContract.TABLE_MESSAGE)) { id = insertMessage(accountId, folderId.toString()); if(D) Log.i(TAG, "insert() ID: " + id); if (D) { Log.i(TAG, "insert() ID: " + id); } return Uri.parse(uri.toString() + "/" + id); } else { Log.w(TAG, "Unknown table name: " + table); Loading Loading @@ -491,7 +511,8 @@ public abstract class BluetoothMapEmailProvider extends ContentProvider { } /** * This query needs to map from the data used in the e-mail client to BluetoothMapContract type of data. * This query needs to map from the data used in the e-mail client to BluetoothMapContract * type of data. */ @Override public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, Loading Loading @@ -526,8 +547,8 @@ public abstract class BluetoothMapEmailProvider extends ContentProvider { * @param sortOrder * @return a cursor to the accounts that are subject to exposure over BT. */ protected abstract Cursor queryAccount(String[] projection, String selection, String[] selectionArgs, String sortOrder); protected abstract Cursor queryAccount(String[] projection, String selection, String[] selectionArgs, String sortOrder); /** * Filter out the non usable folders and ensure to name the mandatory folders Loading @@ -539,8 +560,9 @@ public abstract class BluetoothMapEmailProvider extends ContentProvider { * @param sortOrder * @return */ protected abstract Cursor queryFolder(String accountId, String[] projection, String selection, String[] selectionArgs, String sortOrder); protected abstract Cursor queryFolder(String accountId, String[] projection, String selection, String[] selectionArgs, String sortOrder); /** * For the message table the selection (where clause) can only include the following columns: * date: less than, greater than and equals Loading @@ -559,8 +581,8 @@ public abstract class BluetoothMapEmailProvider extends ContentProvider { * @param sortOrder * @return a cursor to query result */ protected abstract Cursor queryMessage(String accountId, String[] projection, String selection, String[] selectionArgs, String sortOrder); protected abstract Cursor queryMessage(String accountId, String[] projection, String selection, String[] selectionArgs, String sortOrder); /** * update() Loading @@ -580,19 +602,23 @@ public abstract class BluetoothMapEmailProvider extends ContentProvider { throw new IllegalArgumentException("Table missing in URI"); } if (selection != null) { throw new IllegalArgumentException("selection shall not be used, ContentValues shall contain the data"); throw new IllegalArgumentException( "selection shall not be used, ContentValues shall contain the data"); } long callingId = Binder.clearCallingIdentity(); if(D)Log.w(TAG, "update(): uri=" + uri.toString() + " - getLastPathSegment() = " + uri.getLastPathSegment()); if (D) { Log.w(TAG, "update(): uri=" + uri.toString() + " - getLastPathSegment() = " + uri.getLastPathSegment()); } try { if (table.equals(BluetoothMapContract.TABLE_ACCOUNT)) { String accountId = values.getAsString(BluetoothMapContract.AccountColumns._ID); if (accountId == null) { throw new IllegalArgumentException("Account ID missing in update values!"); } Integer exposeFlag = values.getAsInteger(BluetoothMapContract.AccountColumns.FLAG_EXPOSE); Integer exposeFlag = values.getAsInteger(BluetoothMapContract.AccountColumns.FLAG_EXPOSE); if (exposeFlag == null) { throw new IllegalArgumentException("Expose flag missing in update values!"); } Loading @@ -606,10 +632,13 @@ public abstract class BluetoothMapEmailProvider extends ContentProvider { throw new IllegalArgumentException("Message ID missing in update values!"); } Long folderId = values.getAsLong(BluetoothMapContract.MessageColumns.FOLDER_ID); Boolean flagRead = values.getAsBoolean(BluetoothMapContract.MessageColumns.FLAG_READ); Boolean flagRead = values.getAsBoolean(BluetoothMapContract.MessageColumns.FLAG_READ); return updateMessage(accountId, messageId, folderId, flagRead); } else { if(D)Log.w(TAG, "Unknown table name: " + table); if (D) { Log.w(TAG, "Unknown table name: " + table); } return 0; } } finally { Loading @@ -634,13 +663,17 @@ public abstract class BluetoothMapEmailProvider extends ContentProvider { * @param flagRead the new flagRead value to set - ignore if null. * @return */ protected abstract int updateMessage(String accountId, Long messageId, Long folderId, Boolean flagRead); protected abstract int updateMessage(String accountId, Long messageId, Long folderId, Boolean flagRead); @Override public Bundle call(String method, String arg, Bundle extras) { long callingId = Binder.clearCallingIdentity(); if(D)Log.d(TAG, "call(): method=" + method + " arg=" + arg + "ThreadId: " + Thread.currentThread().getId()); if (D) { Log.d(TAG, "call(): method=" + method + " arg=" + arg + "ThreadId: " + Thread.currentThread().getId()); } try { if (method.equals(BluetoothMapContract.METHOD_UPDATE_FOLDER)) { Loading
android/app/lib/mapapi/com/android/bluetooth/mapapi/BluetoothMapIMProvider.java +134 −110 File changed.Preview size limit exceeded, changes collapsed. Show changes