use of com.android.launcher3.compat.PackageInstallerCompat.PackageInstallInfo in project android_packages_apps_Launcher3 by ArrowOS.
the class InstallSessionTracker method onFinished.
@Override
public void onFinished(int sessionId, boolean success) {
InstallSessionHelper helper = mWeakHelper.get();
Callback callback = mWeakCallback.get();
if (callback == null || helper == null) {
return;
}
// For a finished session, we can't get the session info. So use the
// packageName from our local cache.
SparseArray<PackageUserKey> activeSessions = getActiveSessionMap(helper);
PackageUserKey key = activeSessions.get(sessionId);
activeSessions.remove(sessionId);
if (key != null && key.mPackageName != null) {
String packageName = key.mPackageName;
PackageInstallInfo info = PackageInstallInfo.fromState(success ? STATUS_INSTALLED : STATUS_FAILED, packageName, key.mUser);
callback.onPackageStateChanged(info);
if (!success && helper.promiseIconAddedForId(sessionId)) {
callback.onSessionFailure(packageName, key.mUser);
// If it is successful, the id is removed in the the package added flow.
helper.removePromiseIconId(sessionId);
}
}
}
use of com.android.launcher3.compat.PackageInstallerCompat.PackageInstallInfo in project android_packages_apps_Launcher3 by ArrowOS.
the class AllAppsList method addPromiseApp.
@Nullable
public AppInfo addPromiseApp(Context context, PackageInstallInfo installInfo, boolean loadIcon) {
// only if not yet installed
if (new PackageManagerHelper(context).isAppInstalled(installInfo.packageName, installInfo.user)) {
return null;
}
AppInfo promiseAppInfo = new AppInfo(installInfo);
if (loadIcon) {
mIconCache.getTitleAndIcon(promiseAppInfo, promiseAppInfo.usingLowResIcon());
promiseAppInfo.sectionName = mIndex.computeSectionName(promiseAppInfo.title);
}
data.add(promiseAppInfo);
mDataChanged = true;
return promiseAppInfo;
}
use of com.android.launcher3.compat.PackageInstallerCompat.PackageInstallInfo in project android_packages_apps_Launcher3 by ProtonAOSP.
the class AllAppsList method addPromiseApp.
@Nullable
public AppInfo addPromiseApp(Context context, PackageInstallInfo installInfo, boolean loadIcon) {
// only if not yet installed
if (new PackageManagerHelper(context).isAppInstalled(installInfo.packageName, installInfo.user)) {
return null;
}
AppInfo promiseAppInfo = new AppInfo(installInfo);
if (loadIcon) {
mIconCache.getTitleAndIcon(promiseAppInfo, promiseAppInfo.usingLowResIcon());
promiseAppInfo.sectionName = mIndex.computeSectionName(promiseAppInfo.title);
}
data.add(promiseAppInfo);
mDataChanged = true;
return promiseAppInfo;
}
use of com.android.launcher3.compat.PackageInstallerCompat.PackageInstallInfo in project android_packages_apps_404Launcher by P-404.
the class PackageIncrementalDownloadUpdatedTask method execute.
@Override
public void execute(LauncherAppState app, BgDataModel dataModel, AllAppsList appsList) {
PackageInstallInfo downloadInfo = new PackageInstallInfo(mPackageName, PackageInstallInfo.STATUS_INSTALLED_DOWNLOADING, mProgress, mUser);
synchronized (appsList) {
List<AppInfo> updatedAppInfos = appsList.updatePromiseInstallInfo(downloadInfo);
if (!updatedAppInfos.isEmpty()) {
for (AppInfo appInfo : updatedAppInfos) {
appInfo.runtimeStatusFlags &= ~ItemInfoWithIcon.FLAG_INSTALL_SESSION_ACTIVE;
scheduleCallbackTask(c -> c.bindIncrementalDownloadProgressUpdated(appInfo));
}
}
bindApplicationsIfNeeded();
}
final ArrayList<WorkspaceItemInfo> updatedWorkspaceItems = new ArrayList<>();
synchronized (dataModel) {
dataModel.forAllWorkspaceItemInfos(mUser, si -> {
if (mPackageName.equals(si.getTargetPackage())) {
si.runtimeStatusFlags &= ~ItemInfoWithIcon.FLAG_INSTALL_SESSION_ACTIVE;
si.setProgressLevel(downloadInfo);
updatedWorkspaceItems.add(si);
}
});
}
bindUpdatedWorkspaceItems(updatedWorkspaceItems);
}
use of com.android.launcher3.compat.PackageInstallerCompat.PackageInstallInfo in project android_packages_apps_404Launcher by P-404.
the class PackageInstallStateChangedTaskTest method newTask.
private PackageInstallStateChangedTask newTask(String pkg, int progress) {
int state = PackageInstallInfo.STATUS_INSTALLING;
PackageInstallInfo installInfo = new PackageInstallInfo(pkg, state, progress, android.os.Process.myUserHandle());
return new PackageInstallStateChangedTask(installInfo);
}
Aggregations