use of org.chromium.chrome.browser.banners.InstallerDelegate in project AndroidChromium by JackyAndroid.
the class WebApkInstaller method installAsyncAndMonitorInstallationFromNative.
/**
* Installs a WebAPK and monitors the installation process.
* @param filePath File to install.
* @param packageName Package name to install WebAPK at.
* @return True if the install was started. A "true" return value does not guarantee that the
* install succeeds.
*/
@CalledByNative
private boolean installAsyncAndMonitorInstallationFromNative(String filePath, String packageName) {
if (!installingFromUnknownSourcesAllowed()) {
Log.e(TAG, "WebAPK install failed because installation from unknown sources is disabled.");
return false;
}
mIsInstall = true;
mWebApkPackageName = packageName;
// Start monitoring the installation.
PackageManager packageManager = ContextUtils.getApplicationContext().getPackageManager();
mInstallTask = new InstallerDelegate(Looper.getMainLooper(), packageManager, createInstallerDelegateObserver(), mWebApkPackageName);
mInstallTask.start();
// Start monitoring the application state changes.
mListener = createApplicationStateListener();
ApplicationStatus.registerApplicationStateListener(mListener);
return installDownloadedWebApk(filePath);
}
use of org.chromium.chrome.browser.banners.InstallerDelegate in project AndroidChromium by JackyAndroid.
the class AppBannerInfoBarDelegateAndroid method createIntentCallback.
private WindowAndroid.IntentCallback createIntentCallback(final AppData appData) {
return new WindowAndroid.IntentCallback() {
@Override
public void onIntentCompleted(WindowAndroid window, int resultCode, ContentResolver contentResolver, Intent data) {
boolean isInstalling = resultCode == Activity.RESULT_OK;
if (isInstalling) {
// Start monitoring the install.
PackageManager pm = getPackageManager(ContextUtils.getApplicationContext());
mInstallTask = new InstallerDelegate(Looper.getMainLooper(), pm, createInstallerDelegateObserver(), appData.packageName());
mInstallTask.start();
}
nativeOnInstallIntentReturned(mNativePointer, isInstalling);
}
};
}
Aggregations