use of com.android.launcher3.pm.PackageInstallInfo in project android_packages_apps_Launcher3 by AOSPA.
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.pm.PackageInstallInfo in project android_packages_apps_Trebuchet by LineageOS.
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);
}
use of com.android.launcher3.pm.PackageInstallInfo in project android_packages_apps_Trebuchet by LineageOS.
the class AllAppsList method updatePromiseInstallInfo.
public PromiseAppInfo updatePromiseInstallInfo(PackageInstallInfo installInfo) {
UserHandle user = Process.myUserHandle();
for (int i = 0; i < data.size(); i++) {
final AppInfo appInfo = data.get(i);
final ComponentName tgtComp = appInfo.getTargetComponent();
if (tgtComp != null && tgtComp.getPackageName().equals(installInfo.packageName) && appInfo.user.equals(user) && appInfo instanceof PromiseAppInfo) {
final PromiseAppInfo promiseAppInfo = (PromiseAppInfo) appInfo;
if (installInfo.state == PackageInstallInfo.STATUS_INSTALLING) {
promiseAppInfo.level = installInfo.progress;
return promiseAppInfo;
} else if (installInfo.state == PackageInstallInfo.STATUS_FAILED) {
removeApp(i);
}
}
}
return null;
}
use of com.android.launcher3.pm.PackageInstallInfo in project android_packages_apps_Trebuchet by LineageOS.
the class AllAppsList method addPromiseApp.
public void addPromiseApp(Context context, PackageInstallInfo installInfo) {
ApplicationInfo applicationInfo = new PackageManagerHelper(context).getApplicationInfo(installInfo.packageName, installInfo.user, 0);
// only if not yet installed
if (applicationInfo == null) {
PromiseAppInfo info = new PromiseAppInfo(installInfo);
mIconCache.getTitleAndIcon(info, info.usingLowResIcon());
info.sectionName = mIndex.computeSectionName(info.title);
data.add(info);
mDataChanged = true;
}
}
use of com.android.launcher3.pm.PackageInstallInfo in project android_packages_apps_Trebuchet by LineageOS.
the class InstallSessionTracker method onFinished.
@Override
public void onFinished(int sessionId, boolean success) {
// For a finished session, we can't get the session info. So use the
// packageName from our local cache.
SparseArray<PackageUserKey> activeSessions = getActiveSessionMap();
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);
mCallback.onPackageStateChanged(info);
if (!success && mInstallerCompat.promiseIconAddedForId(sessionId)) {
mCallback.onSessionFailure(packageName, key.mUser);
// If it is successful, the id is removed in the the package added flow.
mInstallerCompat.removePromiseIconId(sessionId);
}
}
}
Aggregations