mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-04 01:46:49 +00:00
Implement ability to uninstall shortcuts from workspace
Change-Id: I14ca94ea719825c4de19ab85d67537155098d50c
This commit is contained in:
@@ -20,6 +20,7 @@ import android.content.ComponentName;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.PackageManager.NameNotFoundException;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.ResolveInfo;
|
||||
import android.graphics.Bitmap;
|
||||
import android.util.Log;
|
||||
@@ -72,15 +73,9 @@ class ApplicationInfo extends ItemInfo {
|
||||
Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
|
||||
|
||||
try {
|
||||
int appFlags = pm.getApplicationInfo(packageName, 0).flags;
|
||||
if ((appFlags & android.content.pm.ApplicationInfo.FLAG_SYSTEM) == 0) {
|
||||
flags |= DOWNLOADED_FLAG;
|
||||
|
||||
if ((appFlags & android.content.pm.ApplicationInfo.FLAG_UPDATED_SYSTEM_APP) != 0) {
|
||||
flags |= UPDATED_SYSTEM_APP_FLAG;
|
||||
}
|
||||
}
|
||||
firstInstallTime = pm.getPackageInfo(packageName, 0).firstInstallTime;
|
||||
PackageInfo pi = pm.getPackageInfo(packageName, 0);
|
||||
flags = initFlags(pi);
|
||||
firstInstallTime = initFirstInstallTime(pi);
|
||||
} catch (NameNotFoundException e) {
|
||||
Log.d(TAG, "PackageManager.getApplicationInfo failed for " + packageName);
|
||||
}
|
||||
@@ -88,6 +83,23 @@ class ApplicationInfo extends ItemInfo {
|
||||
iconCache.getTitleAndIcon(this, info, labelCache);
|
||||
}
|
||||
|
||||
public static int initFlags(PackageInfo pi) {
|
||||
int appFlags = pi.applicationInfo.flags;
|
||||
int flags = 0;
|
||||
if ((appFlags & android.content.pm.ApplicationInfo.FLAG_SYSTEM) == 0) {
|
||||
flags |= DOWNLOADED_FLAG;
|
||||
|
||||
if ((appFlags & android.content.pm.ApplicationInfo.FLAG_UPDATED_SYSTEM_APP) != 0) {
|
||||
flags |= UPDATED_SYSTEM_APP_FLAG;
|
||||
}
|
||||
}
|
||||
return flags;
|
||||
}
|
||||
|
||||
public static long initFirstInstallTime(PackageInfo pi) {
|
||||
return pi.firstInstallTime;
|
||||
}
|
||||
|
||||
public ApplicationInfo(ApplicationInfo info) {
|
||||
super(info);
|
||||
componentName = info.componentName;
|
||||
|
||||
Reference in New Issue
Block a user