mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-19 10:48:19 +00:00
Changing minimum supported Launcher version to 26
Change-Id: I49fcf874430ac53c3246371e179fbd828e14e4da
This commit is contained in:
@@ -18,7 +18,9 @@ package com.android.launcher3.pm;
|
||||
|
||||
import static com.android.launcher3.Utilities.getPrefs;
|
||||
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.LauncherApps;
|
||||
import android.content.pm.PackageInstaller;
|
||||
@@ -32,6 +34,7 @@ import android.text.TextUtils;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.RequiresApi;
|
||||
|
||||
import com.android.launcher3.InstallShortcutReceiver;
|
||||
import com.android.launcher3.LauncherSettings;
|
||||
import com.android.launcher3.SessionCommitReceiver;
|
||||
import com.android.launcher3.Utilities;
|
||||
@@ -167,7 +170,7 @@ public class InstallSessionHelper {
|
||||
* Attempt to restore workspace layout if the session is triggered due to device restore.
|
||||
*/
|
||||
public boolean restoreDbIfApplicable(@NonNull final SessionInfo info) {
|
||||
if (!Utilities.ATLEAST_OREO || !FeatureFlags.ENABLE_DATABASE_RESTORE.get()) {
|
||||
if (!FeatureFlags.ENABLE_DATABASE_RESTORE.get()) {
|
||||
return false;
|
||||
}
|
||||
if (isRestore(info)) {
|
||||
@@ -203,7 +206,7 @@ public class InstallSessionHelper {
|
||||
* - A promise icon for the session has not already been created
|
||||
*/
|
||||
void tryQueuePromiseAppIcon(PackageInstaller.SessionInfo sessionInfo) {
|
||||
if (Utilities.ATLEAST_OREO && FeatureFlags.PROMISE_APPS_NEW_INSTALLS.get()
|
||||
if (FeatureFlags.PROMISE_APPS_NEW_INSTALLS.get()
|
||||
&& SessionCommitReceiver.isEnabled(mAppContext)
|
||||
&& verify(sessionInfo) != null
|
||||
&& sessionInfo.getInstallReason() == PackageManager.INSTALL_REASON_USER
|
||||
@@ -212,7 +215,21 @@ public class InstallSessionHelper {
|
||||
&& !mPromiseIconIds.contains(sessionInfo.getSessionId())
|
||||
&& new PackageManagerHelper(mAppContext).getApplicationInfo(
|
||||
sessionInfo.getAppPackageName(), getUserHandle(sessionInfo), 0) == null) {
|
||||
SessionCommitReceiver.queuePromiseAppIconAddition(mAppContext, sessionInfo);
|
||||
|
||||
String packageName = sessionInfo.getAppPackageName();
|
||||
if (mAppContext.getSystemService(LauncherApps.class)
|
||||
.getActivityList(packageName, getUserHandle(sessionInfo)).isEmpty()) {
|
||||
// Ensure application isn't already installed.
|
||||
Intent data = new Intent();
|
||||
data.putExtra(Intent.EXTRA_SHORTCUT_INTENT, new Intent().setComponent(
|
||||
new ComponentName(packageName, "")).setPackage(packageName));
|
||||
data.putExtra(Intent.EXTRA_SHORTCUT_NAME, sessionInfo.getAppLabel());
|
||||
data.putExtra(Intent.EXTRA_SHORTCUT_ICON, sessionInfo.getAppIcon());
|
||||
|
||||
InstallShortcutReceiver.queueApplication(data, getUserHandle(sessionInfo),
|
||||
mAppContext);
|
||||
}
|
||||
|
||||
mPromiseIconIds.add(sessionInfo.getSessionId());
|
||||
updatePromiseIconPrefs();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user