Don't remove default directories from directories table
The directories table should always contain the DEFAULT and LOCAL_INVISIBLE
directories. Otherwise search would break.
Also re-create all directoires next time the provider starts as a part of
upgrade.
Details:
ContactDirectoryManager has two public methods to update the table:
scanAllPackages() to scan all directories from all installed packages, and
onPackageChanged() to scan only a specific package.
scanAllPackages() is called when an account is added or removed. It always
rules out the default ones when it deletes rows, so this method shouldn't
possibly remove the default ones.
However, onPackageChanged(), which is called when an app is installed or
uninstalled, doesn't check the given package name. If this method is given
the package name of the contacts provider itself, it *will* remove all the
directories that belong to the contacts provider, which are the default ones,
but doesn't re-create them because these are not exported from the provider
like a normal directory.
With this CL onPackageChanged() now checks if the given package name is
of itself, and will ignore the request if so.
Bug 6005231
Change-Id: Ia19dfb1890160315ef9de8aa0530978e547abf7d
2 files changed