From bdc55e77f74c655cc2aeb97a5684c266cd75a85c Mon Sep 17 00:00:00 2001 From: Dan Zivkovic Date: Wed, 6 May 2015 09:30:47 -0700 Subject: [PATCH] Metadata URI does not need additionalId. Bug 20701628. Change-Id: Ifba1e7dd7f9934c8c13279dfb95bf02c0e30e650 --- .../inputmethod/dictionarypack/MetadataUriGetter.java | 9 ++------- .../inputmethod/dictionarypack/MetadataDbHelper.java | 7 ++++--- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/java-overridable/src/com/android/inputmethod/dictionarypack/MetadataUriGetter.java b/java-overridable/src/com/android/inputmethod/dictionarypack/MetadataUriGetter.java index d8951df86..512d426aa 100644 --- a/java-overridable/src/com/android/inputmethod/dictionarypack/MetadataUriGetter.java +++ b/java-overridable/src/com/android/inputmethod/dictionarypack/MetadataUriGetter.java @@ -19,16 +19,11 @@ package com.android.inputmethod.dictionarypack; import android.content.Context; /** - * Helper to get the metadata URI from its base URI and the additional ID, if any. + * Helper to get the metadata URI from its base URI. */ @SuppressWarnings("unused") public class MetadataUriGetter { - private MetadataUriGetter() { - // This helper class is not instantiable. - } - - public static String getUri(final Context context, final String baseUri, - final String additionalId) { + public static String getUri(final Context context, final String baseUri) { return baseUri; } } diff --git a/java/src/com/android/inputmethod/dictionarypack/MetadataDbHelper.java b/java/src/com/android/inputmethod/dictionarypack/MetadataDbHelper.java index fbc899192..c6a7b9112 100644 --- a/java/src/com/android/inputmethod/dictionarypack/MetadataDbHelper.java +++ b/java/src/com/android/inputmethod/dictionarypack/MetadataDbHelper.java @@ -345,6 +345,8 @@ public class MetadataDbHelper extends SQLiteOpenHelper { return null != getMetadataUriAsString(context, clientId); } + private static final MetadataUriGetter sMetadataUriGetter = new MetadataUriGetter(); + /** * Returns the metadata URI as a string. * @@ -358,13 +360,12 @@ public class MetadataDbHelper extends SQLiteOpenHelper { public static String getMetadataUriAsString(final Context context, final String clientId) { SQLiteDatabase defaultDb = MetadataDbHelper.getDb(context, null); final Cursor cursor = defaultDb.query(MetadataDbHelper.CLIENT_TABLE_NAME, - new String[] { MetadataDbHelper.CLIENT_METADATA_URI_COLUMN, - MetadataDbHelper.CLIENT_METADATA_ADDITIONAL_ID_COLUMN }, + new String[] { MetadataDbHelper.CLIENT_METADATA_URI_COLUMN }, MetadataDbHelper.CLIENT_CLIENT_ID_COLUMN + " = ?", new String[] { clientId }, null, null, null, null); try { if (!cursor.moveToFirst()) return null; - return MetadataUriGetter.getUri(context, cursor.getString(0), cursor.getString(1)); + return sMetadataUriGetter.getUri(context, cursor.getString(0)); } finally { cursor.close(); }