mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-17 01:28:21 +00:00
Fix crash below 12
This commit is contained in:
@@ -26,6 +26,7 @@ import static com.android.launcher3.LauncherSettings.Favorites.ITEM_TYPE_DEEP_SH
|
||||
import static com.android.launcher3.Utilities.getDevicePrefs;
|
||||
import static com.android.launcher3.hybridhotseat.HotseatPredictionModel.convertDataModelToAppTargetBundle;
|
||||
|
||||
import android.Manifest;
|
||||
import android.app.prediction.AppPredictionContext;
|
||||
import android.app.prediction.AppPredictionManager;
|
||||
import android.app.prediction.AppPredictor;
|
||||
@@ -36,6 +37,7 @@ import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.pm.LauncherActivityInfo;
|
||||
import android.content.pm.LauncherApps;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.ShortcutInfo;
|
||||
import android.os.UserHandle;
|
||||
import android.util.Log;
|
||||
@@ -46,6 +48,7 @@ import androidx.annotation.WorkerThread;
|
||||
import com.android.launcher3.InvariantDeviceProfile;
|
||||
import com.android.launcher3.InvariantDeviceProfile.OnIDPChangeListener;
|
||||
import com.android.launcher3.LauncherAppState;
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.logging.InstanceId;
|
||||
import com.android.launcher3.logging.InstanceIdSequence;
|
||||
import com.android.launcher3.model.BgDataModel.FixedContainerItems;
|
||||
@@ -200,6 +203,10 @@ public class QuickstepModelDelegate extends ModelDelegate implements OnIDPChange
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Utilities.ATLEAST_Q) return;
|
||||
int usagePerm = mApp.getContext().checkCallingOrSelfPermission(Manifest.permission.PACKAGE_USAGE_STATS);
|
||||
if (usagePerm != PackageManager.PERMISSION_GRANTED) return;
|
||||
|
||||
registerPredictor(mAllAppsState, apm.createAppPredictionSession(
|
||||
new AppPredictionContext.Builder(context)
|
||||
.setUiSurface("home")
|
||||
|
||||
Reference in New Issue
Block a user