Android SDK Version


public class InstrumentUtility
Field Summary
Modifier and TypeFieldDescription
private final StringANALYSIS_REPORT_PREFIX
private final StringANR_REPORT_PREFIX
private final StringCRASH_REPORT_PREFIX
private final StringCRASH_SHIELD_PREFIX
private final StringTHREAD_CHECK_PREFIX
private final StringERROR_REPORT_PREFIX
public final static InstrumentUtilityINSTANCE
Method Summary
Modifier and TypeMethodDescription
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 static BooleanisFromFbOrMeta(StackTraceElement element)
final StringgetANALYSIS_REPORT_PREFIX()
final StringgetANR_REPORT_PREFIX()
final StringgetCRASH_REPORT_PREFIX()
final StringgetCRASH_SHIELD_PREFIX()
final StringgetTHREAD_CHECK_PREFIX()
final StringgetERROR_REPORT_PREFIX()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Method Detail

getCause

 final static StringgetCause(Throwable e)
Get the cause of the raised exception.
Parameters:
e - The Throwable containing the exception that was raised

getStackTrace

 final static StringgetStackTrace(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 StringgetStackTrace(Thread thread)
Get the stack trace of the input Thread.
Parameters:
thread - The Thread to obtain the stack trace

isSDKRelatedException

 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".
Parameters:
e - The Throwable containing the exception that was raised

isSDKRelatedThread

 final static BooleanisSDKRelatedThread(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()
Get the list of exception report files from instrument report directory defined in method.
Note that the function should be called after FacebookSdk is initialized. Otherwise, exception FacebookSdkNotInitializedException will be thrown.

readFile

 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.
Note that the function should be called after FacebookSdk is initialized. Otherwise, exception FacebookSdkNotInitializedException will be thrown.

writeFile

 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.
Note that the function should be called after FacebookSdk is initialized. Otherwise, exception FacebookSdkNotInitializedException will be thrown.

deleteFile

 final static BooleandeleteFile(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 UnitsendReports(String key, JSONArray reports, GraphRequest.Callback callback)
Create Graph Request for Instrument reports and send the reports to Facebook.

getInstrumentReportDir

 final static FilegetInstrumentReportDir()
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.

isFromFbOrMeta

 final static BooleanisFromFbOrMeta(StackTraceElement element)

getANALYSIS_REPORT_PREFIX

 final StringgetANALYSIS_REPORT_PREFIX()

getANR_REPORT_PREFIX

 final StringgetANR_REPORT_PREFIX()

getCRASH_REPORT_PREFIX

 final StringgetCRASH_REPORT_PREFIX()

getCRASH_SHIELD_PREFIX

 final StringgetCRASH_SHIELD_PREFIX()

getTHREAD_CHECK_PREFIX

 final StringgetTHREAD_CHECK_PREFIX()

getERROR_REPORT_PREFIX

 final StringgetERROR_REPORT_PREFIX()