diff options
author | Bjorn Bringert <bringert@google.com> | 2013-10-03 22:31:03 +0100 |
---|---|---|
committer | Bjorn Bringert <bringert@google.com> | 2013-10-03 23:40:34 +0100 |
commit | 1307f63f8a93541bf6e2d29c11fab69778a25e42 (patch) | |
tree | 79053e8699baa59b49acc16c3020879f74143bbf /src/com/android/launcher3/AppFilter.java | |
parent | f0481bf3c9571dd7f6ec734f400706ea6439766c (diff) | |
download | android_packages_apps_Trebuchet-1307f63f8a93541bf6e2d29c11fab69778a25e42.tar.gz android_packages_apps_Trebuchet-1307f63f8a93541bf6e2d29c11fab69778a25e42.tar.bz2 android_packages_apps_Trebuchet-1307f63f8a93541bf6e2d29c11fab69778a25e42.zip |
Add a better app filtering mechanism and filter widgets
The old one didn't use the app filter when packages
were added or updated, only in the initial load.
The app filter is now also used for appwidget providers.
Bug: 10895858
Bug: 10898990
Change-Id: Id29bbc3cf7bdb0c360edd92f768b86684bd338ed
Diffstat (limited to 'src/com/android/launcher3/AppFilter.java')
-rw-r--r-- | src/com/android/launcher3/AppFilter.java | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/com/android/launcher3/AppFilter.java b/src/com/android/launcher3/AppFilter.java new file mode 100644 index 000000000..e01436d7a --- /dev/null +++ b/src/com/android/launcher3/AppFilter.java @@ -0,0 +1,35 @@ +package com.android.launcher3; + +import android.content.ComponentName; +import android.text.TextUtils; +import android.util.Log; + +public abstract class AppFilter { + + private static final boolean DBG = false; + private static final String TAG = "AppFilter"; + + public abstract boolean shouldShowApp(ComponentName app); + + public static AppFilter loadByName(String className) { + if (TextUtils.isEmpty(className)) return null; + if (DBG) Log.d(TAG, "Loading AppFilter: " + className); + try { + Class<?> cls = Class.forName(className); + return (AppFilter) cls.newInstance(); + } catch (ClassNotFoundException e) { + Log.e(TAG, "Bad AppFilter class", e); + return null; + } catch (InstantiationException e) { + Log.e(TAG, "Bad AppFilter class", e); + return null; + } catch (IllegalAccessException e) { + Log.e(TAG, "Bad AppFilter class", e); + return null; + } catch (ClassCastException e) { + Log.e(TAG, "Bad AppFilter class", e); + return null; + } + } + +} |