1 package com.android.launcher3;
2 
3 import android.content.ComponentName;
4 import android.text.TextUtils;
5 import android.util.Log;
6 
7 public abstract class AppFilter {
8 
9     private static final boolean DBG = false;
10     private static final String TAG = "AppFilter";
11 
shouldShowApp(ComponentName app)12     public abstract boolean shouldShowApp(ComponentName app);
13 
loadByName(String className)14     public static AppFilter loadByName(String className) {
15         if (TextUtils.isEmpty(className)) return null;
16         if (DBG) Log.d(TAG, "Loading AppFilter: " + className);
17         try {
18             Class<?> cls = Class.forName(className);
19             return (AppFilter) cls.newInstance();
20         } catch (ClassNotFoundException e) {
21             Log.e(TAG, "Bad AppFilter class", e);
22             return null;
23         } catch (InstantiationException e) {
24             Log.e(TAG, "Bad AppFilter class", e);
25             return null;
26         } catch (IllegalAccessException e) {
27             Log.e(TAG, "Bad AppFilter class", e);
28             return null;
29         } catch (ClassCastException e) {
30             Log.e(TAG, "Bad AppFilter class", e);
31             return null;
32         }
33     }
34 
35 }
36