use of android.webkit.WebViewProviderInfo in project android_frameworks_base by crdroidandroid.
the class WebViewUpdateServiceImpl method isFallbackPackage.
boolean isFallbackPackage(String packageName) {
if (packageName == null || !mSystemInterface.isFallbackLogicEnabled())
return false;
WebViewProviderInfo[] webviewPackages = mSystemInterface.getWebViewPackages();
WebViewProviderInfo fallbackProvider = getFallbackProvider(webviewPackages);
return (fallbackProvider != null && packageName.equals(fallbackProvider.packageName));
}
use of android.webkit.WebViewProviderInfo in project android_frameworks_base by DirtyUnicorns.
the class WebViewUpdateServiceImpl method updateFallbackState.
private void updateFallbackState(WebViewProviderInfo[] webviewProviders, boolean isBoot) {
// If there exists a valid and enabled non-fallback package - disable the fallback
// package, otherwise, enable it.
WebViewProviderInfo fallbackProvider = getFallbackProvider(webviewProviders);
if (fallbackProvider == null)
return;
boolean existsValidNonFallbackProvider = existsValidNonFallbackProvider(webviewProviders);
boolean isFallbackEnabled = false;
try {
isFallbackEnabled = isEnabledPackage(mSystemInterface.getPackageInfoForProvider(fallbackProvider));
} catch (NameNotFoundException e) {
// No fallback package installed -> early out.
return;
}
if (existsValidNonFallbackProvider && // ignore the state of that user during boot.
(isFallbackEnabled || isBoot)) {
mSystemInterface.uninstallAndDisablePackageForAllUsers(mContext, fallbackProvider.packageName);
} else if (!existsValidNonFallbackProvider && // ignore the state of that user during boot.
(!isFallbackEnabled || isBoot)) {
// Enable the fallback package for all users.
mSystemInterface.enablePackageForAllUsers(mContext, fallbackProvider.packageName, true);
}
}
use of android.webkit.WebViewProviderInfo in project platform_frameworks_base by android.
the class WebViewUpdateServiceImpl method updateFallbackState.
private void updateFallbackState(WebViewProviderInfo[] webviewProviders, boolean isBoot) {
// If there exists a valid and enabled non-fallback package - disable the fallback
// package, otherwise, enable it.
WebViewProviderInfo fallbackProvider = getFallbackProvider(webviewProviders);
if (fallbackProvider == null)
return;
boolean existsValidNonFallbackProvider = existsValidNonFallbackProvider(webviewProviders);
boolean isFallbackEnabled = false;
try {
isFallbackEnabled = isEnabledPackage(mSystemInterface.getPackageInfoForProvider(fallbackProvider));
} catch (NameNotFoundException e) {
// No fallback package installed -> early out.
return;
}
if (existsValidNonFallbackProvider && // ignore the state of that user during boot.
(isFallbackEnabled || isBoot)) {
mSystemInterface.uninstallAndDisablePackageForAllUsers(mContext, fallbackProvider.packageName);
} else if (!existsValidNonFallbackProvider && // ignore the state of that user during boot.
(!isFallbackEnabled || isBoot)) {
// Enable the fallback package for all users.
mSystemInterface.enablePackageForAllUsers(mContext, fallbackProvider.packageName, true);
}
}
use of android.webkit.WebViewProviderInfo in project platform_frameworks_base by android.
the class WebViewUpdateServiceImpl method updateFallbackStateOnPackageChange.
/**
* Handle the enabled-state of our fallback package, i.e. if there exists some non-fallback
* package that is valid (and available by default) then disable the fallback package,
* otherwise, enable the fallback package.
*/
private void updateFallbackStateOnPackageChange(String changedPackage, int changedState) {
if (!mSystemInterface.isFallbackLogicEnabled())
return;
WebViewProviderInfo[] webviewProviders = mSystemInterface.getWebViewPackages();
// A package was changed / updated / downgraded, early out if it is not one of the
// webview packages that are available by default.
boolean changedPackageAvailableByDefault = false;
for (WebViewProviderInfo provider : webviewProviders) {
if (provider.packageName.equals(changedPackage)) {
if (provider.availableByDefault) {
changedPackageAvailableByDefault = true;
}
break;
}
}
if (!changedPackageAvailableByDefault)
return;
updateFallbackState(webviewProviders, false);
}
use of android.webkit.WebViewProviderInfo in project platform_frameworks_base by android.
the class WebViewUpdateServiceImpl method handleNewUser.
/**
* Called when a new user has been added to update the state of its fallback package.
*/
void handleNewUser(int userId) {
if (!mSystemInterface.isFallbackLogicEnabled())
return;
WebViewProviderInfo[] webviewProviders = mSystemInterface.getWebViewPackages();
WebViewProviderInfo fallbackProvider = getFallbackProvider(webviewProviders);
if (fallbackProvider == null)
return;
mSystemInterface.enablePackageForUser(fallbackProvider.packageName, !existsValidNonFallbackProvider(webviewProviders), userId);
}
Aggregations