summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher2/ApplicationInfo.java
diff options
context:
space:
mode:
authorPatrick Dubroy <dubroy@google.com>2010-07-29 13:59:29 -0700
committerPatrick Dubroy <dubroy@google.com>2010-07-29 16:09:27 -0700
commit3d605d5bbef35e3b8aded44c5ef7fe3948f8f7d5 (patch)
tree216edf8f43ee0bf95fc14311b5540ff41c5f2a5d /src/com/android/launcher2/ApplicationInfo.java
parent9460f884233b009ada4e99fcdc50d2a0246b4fcc (diff)
downloadandroid_packages_apps_Trebuchet-3d605d5bbef35e3b8aded44c5ef7fe3948f8f7d5.tar.gz
android_packages_apps_Trebuchet-3d605d5bbef35e3b8aded44c5ef7fe3948f8f7d5.tar.bz2
android_packages_apps_Trebuchet-3d605d5bbef35e3b8aded44c5ef7fe3948f8f7d5.zip
Make tabs in all apps actually filter the list of apps.
Diffstat (limited to 'src/com/android/launcher2/ApplicationInfo.java')
-rw-r--r--src/com/android/launcher2/ApplicationInfo.java36
1 files changed, 30 insertions, 6 deletions
diff --git a/src/com/android/launcher2/ApplicationInfo.java b/src/com/android/launcher2/ApplicationInfo.java
index 7b00f4fb1..6d78a4404 100644
--- a/src/com/android/launcher2/ApplicationInfo.java
+++ b/src/com/android/launcher2/ApplicationInfo.java
@@ -16,18 +16,21 @@
package com.android.launcher2;
-import java.util.ArrayList;
-
import android.content.ComponentName;
import android.content.Intent;
+import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
+import android.content.pm.PackageManager.NameNotFoundException;
import android.graphics.Bitmap;
import android.util.Log;
+import java.util.ArrayList;
+
/**
* Represents an app in AllAppsView.
*/
class ApplicationInfo extends ItemInfo {
+ private static final String TAG = "Launcher2.ApplicationInfo";
/**
* The application name.
@@ -51,6 +54,10 @@ class ApplicationInfo extends ItemInfo {
ComponentName componentName;
+ static final int APP_FLAG = 1;
+ static final int GAME_FLAG = 2;
+ static final int DOWNLOADED_FLAG = 4;
+ int flags = 0;
ApplicationInfo() {
itemType = LauncherSettings.BaseLauncherColumns.ITEM_TYPE_SHORTCUT;
@@ -59,15 +66,32 @@ class ApplicationInfo extends ItemInfo {
/**
* Must not hold the Context.
*/
- public ApplicationInfo(ResolveInfo info, IconCache iconCache) {
- this.componentName = new ComponentName(
- info.activityInfo.applicationInfo.packageName,
- info.activityInfo.name);
+ public ApplicationInfo(PackageManager pm, ResolveInfo info, IconCache iconCache) {
+ final String packageName = info.activityInfo.applicationInfo.packageName;
+ this.componentName = new ComponentName(packageName, info.activityInfo.name);
this.container = ItemInfo.NO_ID;
this.setActivity(componentName,
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 |= DOWNLOADED_FLAG;
+ }
+ // TODO: Figure out how to determine what is a game
+
+ // If it's not a game, it's an app
+ if ((flags & GAME_FLAG) == 0) {
+ flags |= APP_FLAG;
+ }
+ } catch (NameNotFoundException e) {
+ Log.d(TAG, "PackageManager.getApplicationInfo failed for " + packageName);
+ }
+
iconCache.getTitleAndIcon(this, info);
}