當前位置: 首頁>>代碼示例>>Java>>正文


Java Debug.isDebuggerConnected方法代碼示例

本文整理匯總了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;
}
 
開發者ID:zhangjianli,項目名稱:StallBuster,代碼行數:19,代碼來源:EventProcessor.java

示例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();
    }
}
 
開發者ID:markzhai,項目名稱:AndroidPerformanceMonitor,代碼行數:20,代碼來源:LooperMonitor.java

示例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);
            }
        }
    }
}
 
開發者ID:succlz123,項目名稱:S1-Go,代碼行數:23,代碼來源:BlockPrinter.java

示例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();
}
 
開發者ID:aesean,項目名稱:ActivityStack,代碼行數:13,代碼來源:MainActivity.java

示例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);
}
 
開發者ID:Mastermiao,項目名稱:APK,代碼行數:12,代碼來源:DevLoaderActivity.java

示例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.");
        }
    }
}
 
開發者ID:nisrulz,項目名稱:android-utils,代碼行數:19,代碼來源:DebugUtils.java

示例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());
}
 
開發者ID:NickAndroid,項目名稱:Accessories_Android,代碼行數:10,代碼來源:ServiceProxy.java

示例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);
    }
}
 
開發者ID:sebaslogen,項目名稱:CleanGUITestArchitecture,代碼行數:13,代碼來源:StepDefinitions.java

示例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");
                }
            }
        }

    }
}
 
開發者ID:D-clock,項目名稱:AndroidPerformanceTools,代碼行數:44,代碼來源:BlockLooper.java

示例10: isDebuggerAttached

import android.os.Debug; //導入方法依賴的package包/類
public static boolean isDebuggerAttached() {
    return Debug.isDebuggerConnected() || Debug.waitingForDebugger();
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:4,代碼來源:CommonUtils.java

示例11: isDebuggerAttached

import android.os.Debug; //導入方法依賴的package包/類
public boolean isDebuggerAttached() {
    return Debug.isDebuggerConnected();
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:4,代碼來源:AndroidDebuggerControl.java

示例12: isDebuggerAttached

import android.os.Debug; //導入方法依賴的package包/類
@Override public boolean isDebuggerAttached() {
  return Debug.isDebuggerConnected();
}
 
開發者ID:shengxiadeyu,項目名稱:leakcannary,代碼行數:4,代碼來源:AndroidDebuggerControl.java

示例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");
                }
            }
        }

    }
}
 
開發者ID:Alex-Jerry,項目名稱:LLApp,代碼行數:44,代碼來源:BlockLooper.java

示例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);
}
 
開發者ID:hessan,項目名稱:artenus,代碼行數:48,代碼來源:TouchMap.java

示例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;
}
 
開發者ID:androidmalin,項目名稱:WorldmapLibrary,代碼行數:6,代碼來源:Scene.java


注:本文中的android.os.Debug.isDebuggerConnected方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。