diff options
author | Dmitri Plotnikov <dplotnikov@google.com> | 2010-10-21 17:21:24 -0700 |
---|---|---|
committer | Dmitri Plotnikov <dplotnikov@google.com> | 2010-10-21 17:21:24 -0700 |
commit | e0e24418cba10a5184e2966aaa32d5458fa6a387 (patch) | |
tree | 16907a8a7d8c006379035862db20e6195089c063 /tests | |
parent | d0ab3293cc2f3c252b0c1f7e6db7d08dcfe15f3c (diff) | |
download | packages_providers_ContactsProvider-e0e24418cba10a5184e2966aaa32d5458fa6a387.zip packages_providers_ContactsProvider-e0e24418cba10a5184e2966aaa32d5458fa6a387.tar.gz packages_providers_ContactsProvider-e0e24418cba10a5184e2966aaa32d5458fa6a387.tar.bz2 |
Backing up cached resource IDs with resource names
During an OTA or an adb sync some resource IDs may
change without an android.intent.action.PACKAGE_* broadcast.
We will now verify resource IDs against their names
and if anything does not match, rescan all packages.
Bug: 3117701
Change-Id: I293c5578b7092482e8dd4637554831f3e6f93cc1
Diffstat (limited to 'tests')
-rw-r--r-- | tests/src/com/android/providers/contacts/ContactsActor.java | 6 | ||||
-rw-r--r-- | tests/src/com/android/providers/contacts/ContactsMockPackageManager.java | 12 |
2 files changed, 18 insertions, 0 deletions
diff --git a/tests/src/com/android/providers/contacts/ContactsActor.java b/tests/src/com/android/providers/contacts/ContactsActor.java index b31748c..95b4a7d 100644 --- a/tests/src/com/android/providers/contacts/ContactsActor.java +++ b/tests/src/com/android/providers/contacts/ContactsActor.java @@ -26,6 +26,7 @@ import android.content.pm.PackageManager; import android.content.pm.ProviderInfo; import android.content.res.Configuration; import android.content.res.Resources; +import android.content.res.Resources.NotFoundException; import android.database.Cursor; import android.net.Uri; import android.provider.BaseColumns; @@ -218,6 +219,11 @@ public class ContactsActor { public CharSequence getText(int id) throws NotFoundException { return mRes.getText(id); } + + @Override + public String getResourceName(int resid) throws NotFoundException { + return String.valueOf(resid); + } } static String sCallingPackage = null; diff --git a/tests/src/com/android/providers/contacts/ContactsMockPackageManager.java b/tests/src/com/android/providers/contacts/ContactsMockPackageManager.java index edd5017..03a86c2 100644 --- a/tests/src/com/android/providers/contacts/ContactsMockPackageManager.java +++ b/tests/src/com/android/providers/contacts/ContactsMockPackageManager.java @@ -19,8 +19,10 @@ import android.content.Context; import android.content.pm.ApplicationInfo; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; +import android.content.res.Resources; import android.os.Binder; import android.test.mock.MockPackageManager; +import android.test.mock.MockResources; import java.util.HashMap; import java.util.List; @@ -87,4 +89,14 @@ public class ContactsMockPackageManager extends MockPackageManager { } throw new NameNotFoundException(); } + + @Override + public Resources getResourcesForApplication(String appPackageName) { + return new MockResources() { + @Override + public String getResourceName(int resid) throws NotFoundException { + return String.valueOf(resid); + } + }; + } } |