import com.android.internal.policy.DecorView;
import com.android.internal.policy.PhoneWindow;
+import org.android_x86.analytics.AnalyticsHelper;
+
import java.io.FileDescriptor;
import java.io.PrintWriter;
import java.lang.annotation.Retention;
boolean mFinished;
boolean mStartedActivity;
private boolean mDestroyed;
+ private boolean mAppsStatistics;
private boolean mDoReportFullyDrawn = true;
private boolean mRestoredFromBundle;
}
mRestoredFromBundle = savedInstanceState != null;
mCalled = true;
+ mAppsStatistics = SystemProperties.getBoolean("persist.sys.apps_statistics", false);
}
/**
mFragments.doLoaderStart();
+ // region @android-x86-analytics
+ // screen view
+ if (mAppsStatistics) {
+ AnalyticsHelper.hitScreen(this);
+ }
+ // endregion
getApplication().dispatchActivityStarted(this);
if (mAutoFillResetNeeded) {
import java.util.logging.LogManager;
import org.apache.harmony.luni.internal.util.TimezoneGetter;
+import org.android_x86.analytics.AnalyticsHelper;
+
/**
* Main entry point for runtime initialization. Not for
* public consumption.
return Log.printlns(Log.LOG_ID_CRASH, Log.ERROR, tag, msg, tr);
}
+ // region @android-x86-analytics
+ // delay 120 seconds if Analytics failed to capture exception
+ private static final long ANDROID_X86_ANALYTICS_FAILED_DELAY = 120 * 1000;
+ private static long mAnalyticsEnableTime = 0;
+ // endregion
+
/**
* Logs a message when a thread encounters an uncaught exception. By
* default, {@link KillApplicationHandler} will terminate this process later,
if (mCrashing) return;
mCrashing = true;
+ // region @android-x86-analytics
+ if (System.currentTimeMillis() > mAnalyticsEnableTime &&
+ SystemProperties.getBoolean("persist.sys.apps_statistics", false)) {
+ try {
+ AnalyticsHelper.captureException(
+ ActivityThread.currentActivityThread().getSystemContext(),
+ e,
+ t.getName(),
+ ActivityThread.currentPackageName());
+ } catch (Throwable ex) {
+ // delay some time to avoid endless loop exception
+ mAnalyticsEnableTime =
+ System.currentTimeMillis() + ANDROID_X86_ANALYTICS_FAILED_DELAY;
+ }
+ }
+ // endregion
+
// Try to end profiling. If a profiler is running at this point, and we kill the
// process (below), the in-memory buffer will be lost. So try to stop, which will
// flush the buffer. (This makes method trace profiling useful to debug crashes.)