/**
 * Copyright (C) 2014 android10.org. All rights reserved.
 * @author Fernando Cejas (the android10 coder)
 */
package com.fernandocejas.android10.gandalf.aspect;

import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.DeclarePrecedence;
import org.aspectj.lang.annotation.Pointcut;

@Aspect
@DeclarePrecedence("com.fernandocejas.android10.gandalf.aspect.TrackingAspect")
public class InspectingAspect {

  private static final String POINTCUT_ACTIVITY_CREATE =
      "execution(void *android.app.Activity+.*onCreate(..))";

  private static final String POINTCUT_FRAGMENT_CREATE =
      "execution(void *android.app.Fragment+.*onCreate(..))";

  private static final String POINTCUT_FRAGMENT_SUPPORT_CREATE =
      "execution(void *android.support.v4.app.Fragment+.*onCreate(..))";

  private int activitiesCreated = 0;
  private int fragmentsCreated = 0;

  @Pointcut(POINTCUT_ACTIVITY_CREATE)
  public void onActivityCreated(){}

  @Pointcut(POINTCUT_FRAGMENT_CREATE)
  public void onFragmentCreated(){}

  @Pointcut(POINTCUT_FRAGMENT_SUPPORT_CREATE)
  public void onFragmentSupportCreated(){}

  @After("onActivityCreated()")
  public void afterActivityCreated() {
    this.activitiesCreated++;
  }

  @After("onFragmentCreated() || onFragmentSupportCreated()")
  public void afterFragmentCreated() {
    this.fragmentsCreated++;
  }
}

@@ -837,32 +837,150 @@
 nCreate(..))%22;%0A%0A
+  private static final String POINTCUT_SERVICE_CREATE =%0A      %22execution(void *android.app.Service+.*onCreate(..))%22;%0A%0A
   private int ac
@@ -1000,16 +1000,16 @@
 ed = 0;%0A
-
   privat
@@ -1035,16 +1035,51 @@
 ted = 0;
+%0A  private int servicesCreated = 0;
 %0A%0A  @Poi
@@ -1312,16 +1312,89 @@
 ed()%7B%7D%0A%0A
+  @Pointcut(POINTCUT_SERVICE_CREATE)%0A  public void onServiceCreated()%7B%7D%0A%0A
   @After
@@ -1584,32 +1584,32 @@
 mentCreated() %7B%0A
-
     this.fragmen
@@ -1624,11 +1624,113 @@
 d++;%0A  %7D
+%0A%0A  @After(%22onServiceCreated()%22)%0A  public void afterServiceCreated() %7B%0A    this.servicesCreated++;%0A  %7D
 %0A%7D%0A

Add services created counting.