Ejemplo n.º 1
0
 public static void init() {
   service = new TestingModeService();
   Field[] modes = service.getClass().getDeclaredFields();
   try {
     for (Field mode : modes) {
       String name = mode.getName();
       if (!name.equals("service") && mode.getBoolean(service)) {
         Log.w("TestingModeService", "Testing Mode Enabled: " + name);
       }
     }
   } catch (IllegalAccessException e) {
     Log.e("TestingModeService", "init()", e);
   }
 }
Ejemplo n.º 2
0
 public static List<String> getEnabledTestModes() {
   Field[] modes = service.getClass().getDeclaredFields();
   List<String> enabled = new ArrayList<>(modes.length);
   try {
     for (Field mode : modes) {
       String name = mode.getName();
       if (!name.equals("service") && mode.getBoolean(service)) {
         enabled.add(name);
       }
     }
   } catch (IllegalAccessException e) {
     Log.e("TestingModeService", "getEnabledTestModes()", e);
     enabled.clear();
     enabled.add(e.getLocalizedMessage());
   }
   return enabled;
 }