Move ViewCapture On/Off controls to QuickSettings Tile.
When users enable Winscope tracing, ViewCapture tracing will also be enabled. Winscope tracing is currently enabled via a quicksettings tile hidden in the developer options menu. Bug: 224595733 Test: Verified that the new QuickSettings tile doesn't crash via normal interactions (pressing, long-pressing, etc.). Also verified that ViewCapture is turned on when the QuickSettings tile is in the enabled state and is turned off when it is in the disabled state. Change-Id: Ie43d307806dece5748e22ed2af12ed3514c1148a
This commit is contained in:
@@ -212,6 +212,7 @@ public abstract class DevelopmentTiles extends TileService {
|
|||||||
static final int SURFACE_FLINGER_LAYER_TRACE_CONTROL_CODE = 1025;
|
static final int SURFACE_FLINGER_LAYER_TRACE_CONTROL_CODE = 1025;
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
static final int SURFACE_FLINGER_LAYER_TRACE_STATUS_CODE = 1026;
|
static final int SURFACE_FLINGER_LAYER_TRACE_STATUS_CODE = 1026;
|
||||||
|
private static final String VIEW_CAPTURE_ENABLED = "view_capture_enabled";
|
||||||
private IBinder mSurfaceFlinger;
|
private IBinder mSurfaceFlinger;
|
||||||
private IWindowManager mWindowManager;
|
private IWindowManager mWindowManager;
|
||||||
private ImeTracing mImeTracing;
|
private ImeTracing mImeTracing;
|
||||||
@@ -279,10 +280,19 @@ public abstract class DevelopmentTiles extends TileService {
|
|||||||
return mImeTracing.isEnabled();
|
return mImeTracing.isEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isViewCaptureEnabled() {
|
||||||
|
// Add null checking to avoid test case failure.
|
||||||
|
if (getApplicationContext() != null) {
|
||||||
|
return Settings.Global.getInt(getApplicationContext().getContentResolver(),
|
||||||
|
VIEW_CAPTURE_ENABLED, 0) != 0;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean isEnabled() {
|
protected boolean isEnabled() {
|
||||||
return isWindowTraceEnabled() || isLayerTraceEnabled() || isSystemUiTracingEnabled()
|
return isWindowTraceEnabled() || isLayerTraceEnabled() || isSystemUiTracingEnabled()
|
||||||
|| isImeTraceEnabled();
|
|| isImeTraceEnabled() || isViewCaptureEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setWindowTraceEnabled(boolean isEnabled) {
|
private void setWindowTraceEnabled(boolean isEnabled) {
|
||||||
@@ -340,12 +350,21 @@ public abstract class DevelopmentTiles extends TileService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setViewCaptureEnabled(boolean isEnabled) {
|
||||||
|
// Add null checking to avoid test case failure.
|
||||||
|
if (getApplicationContext() != null) {
|
||||||
|
Settings.Global.putInt(getApplicationContext()
|
||||||
|
.getContentResolver(), VIEW_CAPTURE_ENABLED, isEnabled ? 1 : 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setIsEnabled(boolean isEnabled) {
|
protected void setIsEnabled(boolean isEnabled) {
|
||||||
setWindowTraceEnabled(isEnabled);
|
setWindowTraceEnabled(isEnabled);
|
||||||
setLayerTraceEnabled(isEnabled);
|
setLayerTraceEnabled(isEnabled);
|
||||||
setSystemUiTracing(isEnabled);
|
setSystemUiTracing(isEnabled);
|
||||||
setImeTraceEnabled(isEnabled);
|
setImeTraceEnabled(isEnabled);
|
||||||
|
setViewCaptureEnabled(isEnabled);
|
||||||
if (!isEnabled) {
|
if (!isEnabled) {
|
||||||
mToast.show();
|
mToast.show();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user