Merge "Notify registered packages of visible accounts change when authenticators get uninstalled." into oc-dev
am: 8d5b58a660
Change-Id: I21f8e344b794a5e24f92a0895843b7875b764eba
This commit is contained in:
@@ -751,6 +751,11 @@ public class AccountManagerService
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isVisible(int visibility) {
|
||||||
|
return visibility == AccountManager.VISIBILITY_VISIBLE ||
|
||||||
|
visibility == AccountManager.VISIBILITY_USER_MANAGED_VISIBLE;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates visibility for given account name and package.
|
* Updates visibility for given account name and package.
|
||||||
*
|
*
|
||||||
@@ -803,8 +808,10 @@ public class AccountManagerService
|
|||||||
if (notify) {
|
if (notify) {
|
||||||
for (Entry<String, Integer> packageToVisibility : packagesToVisibility
|
for (Entry<String, Integer> packageToVisibility : packagesToVisibility
|
||||||
.entrySet()) {
|
.entrySet()) {
|
||||||
if (shouldNotifyOnVisibilityChange(packageToVisibility.getValue(),
|
int oldVisibility = packageToVisibility.getValue();
|
||||||
resolveAccountVisibility(account, packageName, accounts))) {
|
int currentVisibility =
|
||||||
|
resolveAccountVisibility(account, packageName, accounts);
|
||||||
|
if (isVisible(oldVisibility) != isVisible(currentVisibility)) {
|
||||||
notifyPackage(packageToVisibility.getKey(), accounts);
|
notifyPackage(packageToVisibility.getKey(), accounts);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1181,8 +1188,7 @@ public class AccountManagerService
|
|||||||
|
|
||||||
for (Entry<String, Integer> packageToVisibility :
|
for (Entry<String, Integer> packageToVisibility :
|
||||||
packagesToVisibility.entrySet()) {
|
packagesToVisibility.entrySet()) {
|
||||||
if (shouldNotifyOnVisibilityChange(packageToVisibility.getValue(),
|
if (isVisible(packageToVisibility.getValue())) {
|
||||||
AccountManager.VISIBILITY_NOT_VISIBLE)) {
|
|
||||||
notifyPackage(packageToVisibility.getKey(), accounts);
|
notifyPackage(packageToVisibility.getKey(), accounts);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1218,14 +1224,6 @@ public class AccountManagerService
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean shouldNotifyOnVisibilityChange(int oldVisibility, int newVisibility) {
|
|
||||||
boolean oldVisible = (oldVisibility == AccountManager.VISIBILITY_VISIBLE) ||
|
|
||||||
(oldVisibility == AccountManager.VISIBILITY_USER_MANAGED_VISIBLE);
|
|
||||||
boolean newVisible = (newVisibility == AccountManager.VISIBILITY_VISIBLE) ||
|
|
||||||
(newVisibility == AccountManager.VISIBILITY_USER_MANAGED_VISIBLE);
|
|
||||||
return oldVisible == newVisible;
|
|
||||||
}
|
|
||||||
|
|
||||||
private SparseBooleanArray getUidsOfInstalledOrUpdatedPackagesAsUser(int userId) {
|
private SparseBooleanArray getUidsOfInstalledOrUpdatedPackagesAsUser(int userId) {
|
||||||
// Get the UIDs of all apps that might have data on the device. We want
|
// Get the UIDs of all apps that might have data on the device. We want
|
||||||
// to preserve user data if the app might otherwise be storing data.
|
// to preserve user data if the app might otherwise be storing data.
|
||||||
|
|||||||
Reference in New Issue
Block a user