-
public class InstrumentUtility
-
-
Field Summary
Fields Modifier and Type Field Description private final StringANALYSIS_REPORT_PREFIXprivate final StringANR_REPORT_PREFIXprivate final StringCRASH_REPORT_PREFIXprivate final StringCRASH_SHIELD_PREFIXprivate final StringTHREAD_CHECK_PREFIXprivate final StringERROR_REPORT_PREFIXpublic final static InstrumentUtilityINSTANCE
-
Method Summary
Modifier and Type Method Description final static StringgetCause(Throwable e)Get the cause of the raised exception. final static StringgetStackTrace(Throwable e)Get the iterated call stack traces of the raised exception. final static StringgetStackTrace(Thread thread)Get the stack trace of the input Thread. final static BooleanisSDKRelatedException(Throwable e)Check whether a Throwable is related to Facebook SDK by looking at iterated stack traces and return true if one of the traces has prefix "com.facebook". final static BooleanisSDKRelatedThread(Thread thread)Check whether an Thread is related to Facebook SDK by looking at iterated stack traces final static Array<File>listAnrReportFiles()Get the list of anr report files from instrument report directory defined in InstrumentUtility.getInstrumentReportDir method. final static Array<File>listExceptionAnalysisReportFiles()Get the list of exception analysis report files from instrument report directory defined in InstrumentUtility.getInstrumentReportDir method. final static Array<File>listExceptionReportFiles()Get the list of exception report files from instrument report directory defined in method. final static JSONObjectreadFile(String filename, Boolean deleteOnException)Read the content from the file which is denoted by filename and the directory is the instrument report directory defined in InstrumentUtility.getInstrumentReportDir method. final static UnitwriteFile(String filename, String content)Write the content to the file which is denoted by filename and the file will be put in instrument report directory defined in InstrumentUtility.getInstrumentReportDir method. final static BooleandeleteFile(String filename)Deletes the cache file under instrument report directory. final static UnitsendReports(String key, JSONArray reports, GraphRequest.Callback callback)Create Graph Request for Instrument reports and send the reports to Facebook. final static FilegetInstrumentReportDir()Get the instrument directory for report if the directory exists. final StringgetANALYSIS_REPORT_PREFIX()final StringgetANR_REPORT_PREFIX()final StringgetCRASH_REPORT_PREFIX()final StringgetCRASH_SHIELD_PREFIX()final StringgetTHREAD_CHECK_PREFIX()final StringgetERROR_REPORT_PREFIX()-
-
Method Detail
-
getCause
final static String getCause(Throwable e)
Get the cause of the raised exception.
- Parameters:
e- The Throwable containing the exception that was raised
-
getStackTrace
final static String getStackTrace(Throwable e)
Get the iterated call stack traces of the raised exception.
- Parameters:
e- The Throwable containing the exception that was raised
-
getStackTrace
final static String getStackTrace(Thread thread)
Get the stack trace of the input Thread.
- Parameters:
thread- The Thread to obtain the stack trace
-
isSDKRelatedException
final static Boolean isSDKRelatedException(Throwable e)
Check whether a Throwable is related to Facebook SDK by looking at iterated stack traces and return true if one of the traces has prefix "com.facebook".
- Parameters:
e- The Throwable containing the exception that was raised
-
isSDKRelatedThread
final static Boolean isSDKRelatedThread(Thread thread)
Check whether an Thread is related to Facebook SDK by looking at iterated stack traces
- Parameters:
thread- The Thread to obtain the stack trace
-
listAnrReportFiles
final static Array<File> listAnrReportFiles()
Get the list of anr report files from instrument report directory defined in InstrumentUtility.getInstrumentReportDir method.
Note that the function should be called after FacebookSdk is initialized. Otherwise, exception FacebookSdkNotInitializedException will be thrown.
-
listExceptionAnalysisReportFiles
final static Array<File> listExceptionAnalysisReportFiles()
Get the list of exception analysis report files from instrument report directory defined in InstrumentUtility.getInstrumentReportDir method.
Note that the function should be called after FacebookSdk is initialized. Otherwise, exception FacebookSdkNotInitializedException will be thrown.
-
listExceptionReportFiles
final static Array<File> listExceptionReportFiles()
-
readFile
final static JSONObject readFile(String filename, Boolean deleteOnException)
Read the content from the file which is denoted by filename and the directory is the instrument report directory defined in InstrumentUtility.getInstrumentReportDir method.
Note that the function should be called after FacebookSdk is initialized. Otherwise, exception FacebookSdkNotInitializedException will be thrown.
-
writeFile
final static Unit writeFile(String filename, String content)
Write the content to the file which is denoted by filename and the file will be put in instrument report directory defined in InstrumentUtility.getInstrumentReportDir method.
Note that the function should be called after FacebookSdk is initialized. Otherwise, exception FacebookSdkNotInitializedException will be thrown.
-
deleteFile
final static Boolean deleteFile(String filename)
Deletes the cache file under instrument report directory. If the instrument report directory exists and the file exists under the directory, the file will be deleted.
Note that the function should be called after FacebookSdk is initialized. Otherwise, exception FacebookSdkNotInitializedException will be thrown.
-
sendReports
final static Unit sendReports(String key, JSONArray reports, GraphRequest.Callback callback)
Create Graph Request for Instrument reports and send the reports to Facebook.
-
getInstrumentReportDir
final static File getInstrumentReportDir()
Get the instrument directory for report if the directory exists. If the directory doesn't exist, will attempt to create the directory. Note that, the instrument directory is under cache directory of the Application.
Note that the function should be called after FacebookSdk is initialized. Otherwise, exception FacebookSdkNotInitializedException will be thrown.
-
getANALYSIS_REPORT_PREFIX
final String getANALYSIS_REPORT_PREFIX()
-
getANR_REPORT_PREFIX
final String getANR_REPORT_PREFIX()
-
getCRASH_REPORT_PREFIX
final String getCRASH_REPORT_PREFIX()
-
getCRASH_SHIELD_PREFIX
final String getCRASH_SHIELD_PREFIX()
-
getTHREAD_CHECK_PREFIX
final String getTHREAD_CHECK_PREFIX()
-
getERROR_REPORT_PREFIX
final String getERROR_REPORT_PREFIX()
-
-
-
-