本文整理汇总了Java中android.os.Debug.isDebuggerConnected方法的典型用法代码示例。如果您正苦于以下问题:Java Debug.isDebuggerConnected方法的具体用法?Java Debug.isDebuggerConnected怎么用?Java Debug.isDebuggerConnected使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.os.Debug
的用法示例。
在下文中一共展示了Debug.isDebuggerConnected方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleMessage
import android.os.Debug; //导入方法依赖的package包/类
@Override
public boolean handleMessage(Message msg) {
// TODO uncomment below code when release
if (Debug.isDebuggerConnected()) {
return true;
}
Event event = (Event) msg.obj;
if (event != null) {
try {
processEvent(event);
} catch (Exception e) {
e.printStackTrace();
}
event.recycle();
}
// return true, so handler won't process this msg again, since we have event recycled here
return true;
}
示例2: println
import android.os.Debug; //导入方法依赖的package包/类
@Override
public void println(String x) {
if (mStopWhenDebugging && Debug.isDebuggerConnected()) {
return;
}
if (!mPrintingStarted) {
mStartTimestamp = System.currentTimeMillis();
mStartThreadTimestamp = SystemClock.currentThreadTimeMillis();
mPrintingStarted = true;
startDump();
} else {
final long endTime = System.currentTimeMillis();
mPrintingStarted = false;
if (isBlock(endTime)) {
notifyBlockEvent(endTime);
}
stopDump();
}
}
示例3: println
import android.os.Debug; //导入方法依赖的package包/类
@Override
public void println(String x) {
this.mStartedPrinting = !this.mStartedPrinting;
if (this.mStartedPrinting) {
this.mDebuggerConnected = Debug.isDebuggerConnected();
}
if (this.mDebuggerConnected) {
if (this.mStartedPrinting) {
this.mStartUpTime = SystemClock.uptimeMillis();
this.mStartThreadTime = SystemClock.currentThreadTimeMillis();
this.mLooperLog = x;
this.beginTrace(this.mStartUpTime);
} else {
long costTime = SystemClock.uptimeMillis() - this.mStartUpTime;
this.endTrace();
if (this.isBlock(costTime)) {
this.notifyBlock(costTime);
}
}
}
}
示例4: showBlockTips
import android.os.Debug; //导入方法依赖的package包/类
private void showBlockTips() {
if (!BuildConfig.DEBUG) {
return;
}
if (Debug.isDebuggerConnected()) {
return;
}
String msg = "打开Logcat,设置过滤级别为:DEBUG,过滤字符串为:BlockUtils," +
"可以看到BlockUtils检测到的卡顿代码位置。";
Log.w(TAG, msg);
Toast.makeText(this, msg, Toast.LENGTH_LONG).show();
}
示例5: run
import android.os.Debug; //导入方法依赖的package包/类
@Override
public void run() {
while (dialog != null && !Debug.isDebuggerConnected()) {
try {
Thread.sleep(200);
} catch (InterruptedException e) {
}
}
sendEmptyMessage(2);
}
示例6: keepScreenOnWhileDebugging
import android.os.Debug; //导入方法依赖的package包/类
/**
* Keep screen on while debugging.
*
* @param activity the activity
* @param debugging the debugging
*/
public static void keepScreenOnWhileDebugging(Activity activity, boolean debugging) {
if (debugging) { // don't even consider it otherwise
if (Debug.isDebuggerConnected()) {
Log.d("SCREEN",
"Keeping screen on for debugging, detach debugger and force an onResume to turn it off.");
activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
} else {
activity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
Log.d("SCREEN", "Keeping screen on for debugging is now deactivated.");
}
}
}
示例7: ServiceProxy
import android.os.Debug; //导入方法依赖的package包/类
public ServiceProxy(Context context, Intent intent) {
mContext = context;
mIntent = intent;
mTag = getClass().getSimpleName();
if (Debug.isDebuggerConnected()) {
mTimeout <<= 2;
}
mLogger = LoggerManager.getLogger(getClass());
}
示例8: wait_for_manual_attachment_of_debugger
import android.os.Debug; //导入方法依赖的package包/类
/**
* Wait for the debugger to be manually attached to this running process.
* Use this to debug test execution by adding this step to your test scenario and
* when the test is running in Android Studio choose menu "Run - Attach debugger to Android process",
* finally select the name of your app package from the list of processes displayed.
*/
@Given("^I wait for manual attachment of the debugger$")
public void wait_for_manual_attachment_of_debugger() throws InterruptedException {
while (!Debug.isDebuggerConnected()) {
Thread.sleep(1000);
}
}
示例9: run
import android.os.Debug; //导入方法依赖的package包/类
@Override
public void run() {
int lastTickNumber;
while (!isStop) {
lastTickNumber = tickCounter;
uiHandler.post(ticker);
try {
Thread.sleep(frequency);
} catch (InterruptedException e) {
e.printStackTrace();
break;
}
if (lastTickNumber == tickCounter) {
if (!ignoreDebugger && Debug.isDebuggerConnected()) {
Log.w(TAG, "当前由调试模式引起消息阻塞引起ANR,可以通过setIgnoreDebugger(true)来忽略调试模式造成的ANR");
continue;
}
BlockError blockError;
if (!reportAllThreadInfo) {
blockError = BlockError.getUiThread();
} else {
blockError = BlockError.getAllThread();
}
if (onBlockListener != null) {
onBlockListener.onBlock(blockError);
}
if (saveLog) {
if (StorageUtils.isMounted()) {
File logDir = getLogDirectory();
saveLogToSdcard(blockError, logDir);
} else {
Log.w(TAG, "sdcard is unmounted");
}
}
}
}
}
示例10: isDebuggerAttached
import android.os.Debug; //导入方法依赖的package包/类
public static boolean isDebuggerAttached() {
return Debug.isDebuggerConnected() || Debug.waitingForDebugger();
}
示例11: isDebuggerAttached
import android.os.Debug; //导入方法依赖的package包/类
public boolean isDebuggerAttached() {
return Debug.isDebuggerConnected();
}
示例12: isDebuggerAttached
import android.os.Debug; //导入方法依赖的package包/类
@Override public boolean isDebuggerAttached() {
return Debug.isDebuggerConnected();
}
示例13: run
import android.os.Debug; //导入方法依赖的package包/类
@Override
public void run() {
int lastTickNumber;
while (!isStop) {
lastTickNumber = tickCounter;
uiHandler.post(ticker);
try {
Thread.sleep(frequency);
} catch (InterruptedException e) {
e.printStackTrace();
break;
}
if (lastTickNumber == tickCounter) {
if (!ignoreDebugger && Debug.isDebuggerConnected()) {
Log.w(TAG, "当前由调试模式引起消息阻塞引起ANR,可以通过setIgnoreDebugger(true)来忽略调试模式造成的ANR");
continue;
}
BlockError blockError;
if (!reportAllThreadInfo) {
blockError = BlockError.getUiThread();
} else {
blockError = BlockError.getAllThread();
}
if (onBlockListener != null) {
onBlockListener.onBlock(blockError);
}
if (saveLog) {
if (SdCradUtils.isSDCardEnable()) {
File logDir = getLogDirectory();
saveLogToSdcard(blockError, logDir);
} else {
Log.w(TAG, "sdcard is unmounted");
}
}
}
}
}
示例14: process
import android.os.Debug; //导入方法依赖的package包/类
/**
* Called internally by the stage to render the touch map and process queued touch events.
*
* @param context The rendering context
*/
public void process(RenderingContext context) {
if (target == null) {
return;
}
context.bindTarget(target);
context.clear(0, 0, 1);
ShaderProgram shaderBackup = context.getShader();
context.setShader(shader);
for (Map.Entry<Integer, TouchButton> entry : buttons.entrySet()) {
final TouchButton button = entry.getValue();
shader.feedObjectId((entry.getKey() + 256) % 256);
context.pushMatrix(button.popLatestMatrix());
button.render(context, Renderable.FLAG_PRESERVE_SHADER_PROGRAM);
context.popMatrix();
}
while (!processQueue.isEmpty()) {
final TouchEvent event = processQueue.poll();
pixelBuffer.position(0);
GLES20.glReadPixels(
(int) event.x >> 1, target.getHeight() - ((int) event.y >> 1), 1, 1,
GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, pixelBuffer
);
dispatchQueue.offer(new Pair<>(buttons.get((int) pixelBuffer.get(0)), event));
}
context.bindTarget(null);
if (show && Debug.isDebuggerConnected()) {
TextureShaderProgram program = (TextureShaderProgram) TextureManager.getShaderProgram();
context.setShader(program);
context.setColorFilter(0.75f, 0.75f, 0.75f, 0.75f);
context.pushMatrix();
context.identity();
program.feed(target.getTextureHandle());
program.feedTexCoords(TextureShaderProgram.getDefaultTextureBuffer());
context.translate(520, 280);
context.rotate(0);
context.scale(1000, -600);
context.rect();
context.popMatrix();
}
GLES20.glViewport(0, 0, context.getScreenWidth(), context.getScreenHeight());
context.setShader(shaderBackup);
}
示例15: setState
import android.os.Debug; //导入方法依赖的package包/类
void setState(CacheState newState){
if (Debug.isDebuggerConnected())
Log.i(TAG,String.format("cacheState old=%s new=%s",state.toString(),newState.toString()));
state = newState;
}