use of com.android.launcher3.compat.PackageInstallerCompat in project Neo-Launcher by NeoApplications.
the class ItemClickHandler method startMarketIntentForPackage.
private static void startMarketIntentForPackage(View v, Launcher launcher, String packageName) {
ItemInfo item = (ItemInfo) v.getTag();
if (Utilities.ATLEAST_Q) {
PackageInstallerCompat pkgInstaller = PackageInstallerCompat.getInstance(launcher);
SessionInfo sessionInfo = pkgInstaller.getActiveSessionInfo(item.user, packageName);
if (sessionInfo != null) {
LauncherApps launcherApps = launcher.getSystemService(LauncherApps.class);
try {
launcherApps.startPackageInstallerSessionDetailsActivity(sessionInfo, null, launcher.getActivityLaunchOptionsAsBundle(v));
return;
} catch (Exception e) {
Log.e(TAG, "Unable to launch market intent for package=" + packageName, e);
}
}
}
// Fallback to using custom market intent.
Intent intent = new PackageManagerHelper(launcher).getMarketIntent(packageName);
launcher.startActivitySafely(v, intent, item, null);
}
use of com.android.launcher3.compat.PackageInstallerCompat in project android_packages_apps_Trebuchet by LineageOS.
the class SessionCommitReceiver method onReceive.
@Override
public void onReceive(Context context, Intent intent) {
if (!isEnabled(context) || !Utilities.ATLEAST_OREO) {
// User has decided to not add icons on homescreen.
return;
}
SessionInfo info = intent.getParcelableExtra(PackageInstaller.EXTRA_SESSION);
UserHandle user = intent.getParcelableExtra(Intent.EXTRA_USER);
if (!PackageInstaller.ACTION_SESSION_COMMITTED.equals(intent.getAction()) || info == null || user == null) {
// Invalid intent.
return;
}
InstallSessionHelper packageInstallerCompat = InstallSessionHelper.INSTANCE.get(context);
packageInstallerCompat.restoreDbIfApplicable(info);
if (TextUtils.isEmpty(info.getAppPackageName()) || info.getInstallReason() != PackageManager.INSTALL_REASON_USER || packageInstallerCompat.promiseIconAddedForId(info.getSessionId())) {
packageInstallerCompat.removePromiseIconId(info.getSessionId());
return;
}
queueAppIconAddition(context, info.getAppPackageName(), user);
}
use of com.android.launcher3.compat.PackageInstallerCompat in project android_packages_apps_Launcher3 by ArrowOS.
the class SessionCommitReceiver method processIntent.
@WorkerThread
private static void processIntent(Context context, Intent intent) {
if (!isEnabled(context)) {
// User has decided to not add icons on homescreen.
return;
}
SessionInfo info = intent.getParcelableExtra(PackageInstaller.EXTRA_SESSION);
UserHandle user = intent.getParcelableExtra(Intent.EXTRA_USER);
if (!PackageInstaller.ACTION_SESSION_COMMITTED.equals(intent.getAction()) || info == null || user == null) {
// Invalid intent.
return;
}
InstallSessionHelper packageInstallerCompat = InstallSessionHelper.INSTANCE.get(context);
packageInstallerCompat.restoreDbIfApplicable(info);
if (TextUtils.isEmpty(info.getAppPackageName()) || info.getInstallReason() != PackageManager.INSTALL_REASON_USER || packageInstallerCompat.promiseIconAddedForId(info.getSessionId())) {
packageInstallerCompat.removePromiseIconId(info.getSessionId());
return;
}
FileLog.d(LOG, "Adding package name to install queue. Package name: " + info.getAppPackageName() + ", has app icon: " + (info.getAppIcon() != null) + ", has app label: " + !TextUtils.isEmpty(info.getAppLabel()));
ItemInstallQueue.INSTANCE.get(context).queueItem(info.getAppPackageName(), user);
}
use of com.android.launcher3.compat.PackageInstallerCompat in project android_packages_apps_Launcher3 by ProtonAOSP.
the class SessionCommitReceiver method processIntent.
@WorkerThread
private static void processIntent(Context context, Intent intent) {
if (!isEnabled(context)) {
// User has decided to not add icons on homescreen.
return;
}
SessionInfo info = intent.getParcelableExtra(PackageInstaller.EXTRA_SESSION);
UserHandle user = intent.getParcelableExtra(Intent.EXTRA_USER);
if (!PackageInstaller.ACTION_SESSION_COMMITTED.equals(intent.getAction()) || info == null || user == null) {
// Invalid intent.
return;
}
InstallSessionHelper packageInstallerCompat = InstallSessionHelper.INSTANCE.get(context);
packageInstallerCompat.restoreDbIfApplicable(info);
if (TextUtils.isEmpty(info.getAppPackageName()) || info.getInstallReason() != PackageManager.INSTALL_REASON_USER || packageInstallerCompat.promiseIconAddedForId(info.getSessionId())) {
packageInstallerCompat.removePromiseIconId(info.getSessionId());
return;
}
FileLog.d(LOG, "Adding package name to install queue. Package name: " + info.getAppPackageName() + ", has app icon: " + (info.getAppIcon() != null) + ", has app label: " + !TextUtils.isEmpty(info.getAppLabel()));
ItemInstallQueue.INSTANCE.get(context).queueItem(info.getAppPackageName(), user);
}
Aggregations