Updating developer winscope tile to start sysui tracing

Bug: 144854916
Test: Manual, toggle winscope tile, ensure the sysui trace
      is written to disk

Change-Id: I26b5ca41c7538eb90723c5d8f52a0df1d5ce9812
This commit is contained in:
Winson Chung
2019-11-20 12:08:48 -08:00
parent 5a4e364475
commit d9fcb5109e

View File

@@ -233,9 +233,22 @@ public abstract class DevelopmentTiles extends TileService {
return layerTraceEnabled;
}
private boolean isSystemUiTracingEnabled() {
try {
final IStatusBarService statusBarService = IStatusBarService.Stub.asInterface(
ServiceManager.checkService(Context.STATUS_BAR_SERVICE));
if (statusBarService != null) {
return statusBarService.isTracing();
}
} catch (RemoteException e) {
Log.e(TAG, "Could not get system ui tracing status." + e.toString());
}
return false;
}
@Override
protected boolean isEnabled() {
return isWindowTraceEnabled() || isLayerTraceEnabled();
return isWindowTraceEnabled() || isLayerTraceEnabled() || isSystemUiTracingEnabled();
}
private void setWindowTraceEnabled(boolean isEnabled) {
@@ -269,10 +282,27 @@ public abstract class DevelopmentTiles extends TileService {
}
}
private void setSystemUiTracing(boolean isEnabled) {
try {
final IStatusBarService statusBarService = IStatusBarService.Stub.asInterface(
ServiceManager.checkService(Context.STATUS_BAR_SERVICE));
if (statusBarService != null) {
if (isEnabled) {
statusBarService.startTracing();
} else {
statusBarService.stopTracing();
}
}
} catch (RemoteException e) {
Log.e(TAG, "Could not set system ui tracing." + e.toString());
}
}
@Override
protected void setIsEnabled(boolean isEnabled) {
setWindowTraceEnabled(isEnabled);
setLayerTraceEnabled(isEnabled);
setSystemUiTracing(isEnabled);
if (!isEnabled) {
mToast.show();
}