Search in sources :

Example 6 with HookAnnotation

use of com.kunpeng.pit.HookAnnotation in project GT by Tencent.

the class FragmentHookList_v4 method performStart.

@HookAnnotation(className = "android.support.v4.app.Fragment", methodName = "performStart", methodSig = "()V")
public static void performStart(Object thiz) {
    GTRLog.e(TAG, "performStart");
    long start = System.currentTimeMillis();
    performStart_backup(thiz);
    long end = System.currentTimeMillis();
    String activityClassName = "";
    String activityHashCode = "";
    String fragmentClassName = "";
    String fragmentHashCode = "";
    Object fragment = thiz;
    if (fragment instanceof android.support.v4.app.Fragment) {
        fragmentClassName = ((android.support.v4.app.Fragment) fragment).getClass().getName();
        fragmentHashCode = "" + thiz.hashCode();
        Activity activity = ((android.support.v4.app.Fragment) fragment).getActivity();
        if (activity != null) {
            activityClassName = activity.getClass().getName();
            activityHashCode = "" + activity.hashCode();
        }
    }
    GTRClient.pushData(new StringBuilder().append("FragmentV4.performStart").append(GTConfig.separator).append(activityClassName).append(GTConfig.separator).append(activityHashCode).append(GTConfig.separator).append(fragmentClassName).append(GTConfig.separator).append(fragmentHashCode).append(GTConfig.separator).append(start).append(GTConfig.separator).append(end).toString());
}
Also used : Activity(android.app.Activity) HookAnnotation(com.kunpeng.pit.HookAnnotation)

Example 7 with HookAnnotation

use of com.kunpeng.pit.HookAnnotation in project GT by Tencent.

the class FragmentHookList_v4 method performDetach.

@HookAnnotation(className = "android.support.v4.app.Fragment", methodName = "performDetach", methodSig = "()V")
public static void performDetach(Object thiz) {
    GTRLog.e(TAG, "performDetach");
    long start = System.currentTimeMillis();
    performDetach_backup(thiz);
    long end = System.currentTimeMillis();
    String activityClassName = "";
    String activityHashCode = "";
    String fragmentClassName = "";
    String fragmentHashCode = "";
    Object fragment = thiz;
    if (fragment instanceof android.support.v4.app.Fragment) {
        fragmentClassName = ((android.support.v4.app.Fragment) fragment).getClass().getName();
        fragmentHashCode = "" + thiz.hashCode();
        Activity activity = ((android.support.v4.app.Fragment) fragment).getActivity();
        if (activity != null) {
            activityClassName = activity.getClass().getName();
            activityHashCode = "" + activity.hashCode();
        }
    }
    GTRClient.pushData(new StringBuilder().append("FragmentV4.performDetach").append(GTConfig.separator).append(activityClassName).append(GTConfig.separator).append(activityHashCode).append(GTConfig.separator).append(fragmentClassName).append(GTConfig.separator).append(fragmentHashCode).append(GTConfig.separator).append(start).append(GTConfig.separator).append(end).toString());
}
Also used : Activity(android.app.Activity) HookAnnotation(com.kunpeng.pit.HookAnnotation)

Example 8 with HookAnnotation

use of com.kunpeng.pit.HookAnnotation in project GT by Tencent.

the class FragmentHookList_v4 method performPause.

@HookAnnotation(className = "android.support.v4.app.Fragment", methodName = "performPause", methodSig = "()V")
public static void performPause(Object thiz) {
    GTRLog.e(TAG, "performPause");
    long start = System.currentTimeMillis();
    performPause_backup(thiz);
    long end = System.currentTimeMillis();
    String activityClassName = "";
    String activityHashCode = "";
    String fragmentClassName = "";
    String fragmentHashCode = "";
    Object fragment = thiz;
    if (fragment instanceof android.support.v4.app.Fragment) {
        fragmentClassName = ((android.support.v4.app.Fragment) fragment).getClass().getName();
        fragmentHashCode = "" + thiz.hashCode();
        Activity activity = ((android.support.v4.app.Fragment) fragment).getActivity();
        if (activity != null) {
            activityClassName = activity.getClass().getName();
            activityHashCode = "" + activity.hashCode();
        }
    }
    GTRClient.pushData(new StringBuilder().append("FragmentV4.performPause").append(GTConfig.separator).append(activityClassName).append(GTConfig.separator).append(activityHashCode).append(GTConfig.separator).append(fragmentClassName).append(GTConfig.separator).append(fragmentHashCode).append(GTConfig.separator).append(start).append(GTConfig.separator).append(end).toString());
}
Also used : Activity(android.app.Activity) HookAnnotation(com.kunpeng.pit.HookAnnotation)

Example 9 with HookAnnotation

use of com.kunpeng.pit.HookAnnotation in project GT by Tencent.

the class DBHookList method rawQueryWithFactory.

/* 对sql的执行函数进行监控 */
@HookAnnotation(className = "android.database.sqlite.SQLiteDatabase", methodName = "rawQueryWithFactory", methodSig = "(Landroid/database/sqlite/SQLiteDatabase$CursorFactory;" + "Ljava/lang/String;" + "[Ljava/lang/String;" + "Ljava/lang/String;" + "Landroid/os/CancellationSignal;)" + "Landroid/database/Cursor;")
public static Cursor rawQueryWithFactory(Object thiz, SQLiteDatabase.CursorFactory cursorFactory, String sql, String[] selectionArgs, String editTable, CancellationSignal cancellationSignal) {
    GTRLog.e(TAG, "SQLiteDatabase.rawQueryWithFactory");
    long start = System.currentTimeMillis();
    Cursor result = rawQueryWithFactory_backup(thiz, cursorFactory, sql, selectionArgs, editTable, cancellationSignal);
    long end = System.currentTimeMillis();
    int dbHashCode = thiz.hashCode();
    String threadName = Thread.currentThread().getName();
    long threadID = android.os.Process.myTid();
    GTRClient.pushData(new StringBuilder().append("SQLiteDatabase.rawQueryWithFactory").append(GTConfig.separator).append(dbHashCode).append(GTConfig.separator).append(sql.replace("\n", "")).append(GTConfig.separator).append(threadName).append(GTConfig.separator).append(threadID).append(GTConfig.separator).append(start).append(GTConfig.separator).append(end).toString());
    return result;
}
Also used : Cursor(android.database.Cursor) HookAnnotation(com.kunpeng.pit.HookAnnotation)

Example 10 with HookAnnotation

use of com.kunpeng.pit.HookAnnotation in project GT by Tencent.

the class DBHookList method openDatabase.

/* 检测数据库打开的时长*/
@HookAnnotation(className = "android.database.sqlite.SQLiteDatabase", methodName = "openDatabase", methodSig = "(Ljava/lang/String;" + "Landroid/database/sqlite/SQLiteDatabase$CursorFactory;" + "ILandroid/database/DatabaseErrorHandler;)" + "Landroid/database/sqlite/SQLiteDatabase;")
public static SQLiteDatabase openDatabase(String path, SQLiteDatabase.CursorFactory factory, int flags, DatabaseErrorHandler errorHandler) {
    GTRLog.e(TAG, "SQLiteDatabase.openDatabase");
    long start = System.currentTimeMillis();
    SQLiteDatabase result = openDatabase_backup(path, factory, flags, errorHandler);
    long end = System.currentTimeMillis();
    int dbHashCode = result.hashCode();
    String threadName = Thread.currentThread().getName();
    long threadID = android.os.Process.myTid();
    GTRClient.pushData(new StringBuilder().append("SQLiteDatabase.openDatabase").append(GTConfig.separator).append(dbHashCode).append(GTConfig.separator).append(path).append(GTConfig.separator).append(threadName).append(GTConfig.separator).append(threadID).append(GTConfig.separator).append(start).append(GTConfig.separator).append(end).toString());
    return result;
}
Also used : SQLiteDatabase(android.database.sqlite.SQLiteDatabase) HookAnnotation(com.kunpeng.pit.HookAnnotation)

Aggregations

HookAnnotation (com.kunpeng.pit.HookAnnotation)30 Activity (android.app.Activity)26 View (android.view.View)3 Instrumentation (android.app.Instrumentation)1 ActivityResult (android.app.Instrumentation.ActivityResult)1 Cursor (android.database.Cursor)1 SQLiteDatabase (android.database.sqlite.SQLiteDatabase)1