diff options
author | Dianne Hackborn <hackbod@google.com> | 2011-08-22 00:36:26 -0700 |
---|---|---|
committer | Dianne Hackborn <hackbod@google.com> | 2011-08-22 13:42:35 -0700 |
commit | fb667e943650a431bc132c4c50d772ed37d0c245 (patch) | |
tree | 69c8f851c6b6b265767c8c0c834756527e83cb4d /src/com/android/providers/contacts/ContactsUpgradeReceiver.java | |
parent | 90922870e47428eca4a633aeac16cd6c5cf5e45c (diff) | |
download | packages_providers_ContactsProvider-fb667e943650a431bc132c4c50d772ed37d0c245.zip packages_providers_ContactsProvider-fb667e943650a431bc132c4c50d772ed37d0c245.tar.gz packages_providers_ContactsProvider-fb667e943650a431bc132c4c50d772ed37d0c245.tar.bz2 |
Add boot message when upgrading database.
Change-Id: I3f17aed690066ed4d2ab645a059c66a1bdd7a1f1
Diffstat (limited to 'src/com/android/providers/contacts/ContactsUpgradeReceiver.java')
-rw-r--r-- | src/com/android/providers/contacts/ContactsUpgradeReceiver.java | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/com/android/providers/contacts/ContactsUpgradeReceiver.java b/src/com/android/providers/contacts/ContactsUpgradeReceiver.java index 747ecca..f27eae8 100644 --- a/src/com/android/providers/contacts/ContactsUpgradeReceiver.java +++ b/src/com/android/providers/contacts/ContactsUpgradeReceiver.java @@ -16,12 +16,14 @@ package com.android.providers.contacts; +import android.app.ActivityManagerNative; import android.content.BroadcastReceiver; import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.content.pm.PackageManager; +import android.os.RemoteException; import android.util.Log; /** @@ -57,14 +59,21 @@ public class ContactsUpgradeReceiver extends BroadcastReceiver { // is attempted to be conservative. If the upgrade fails for some reason and we // crash and burn we don't want to get into a loop doing so. prefs.edit().putInt( - PREF_DB_VERSION, ContactsDatabaseHelper.DATABASE_VERSION).apply(); + PREF_DB_VERSION, ContactsDatabaseHelper.DATABASE_VERSION).commit(); // Ask for a reference to the database to force the helper to either // create the database or open it up, performing any necessary upgrades // in the process. - Log.i(TAG, "Creating or opening contacts database"); ContactsDatabaseHelper helper = ContactsDatabaseHelper.getInstance(context); - helper.getWritableDatabase(); + if (context.getDatabasePath(helper.getDatabaseName()).exists()) { + Log.i(TAG, "Creating or opening contacts database"); + try { + ActivityManagerNative.getDefault().showBootMessage( + context.getText(R.string.upgrade_msg), true); + } catch (RemoteException e) { + } + helper.getWritableDatabase(); + } helper.close(); // Log the total time taken for the receiver to perform the operation |