Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 98d219cd authored by Stefan Andonian's avatar Stefan Andonian Committed by Automerger Merge Worker
Browse files

Merge "Move ViewCapture On/Off controls to QuickSettings Tile." into tm-qpr-dev am: d0e6bddb

parents 789071c8 d0e6bddb
Loading
Loading
Loading
Loading
+20 −1
Original line number Diff line number Diff line
@@ -212,6 +212,7 @@ public abstract class DevelopmentTiles extends TileService {
        static final int SURFACE_FLINGER_LAYER_TRACE_CONTROL_CODE = 1025;
        @VisibleForTesting
        static final int SURFACE_FLINGER_LAYER_TRACE_STATUS_CODE = 1026;
        private static final String VIEW_CAPTURE_ENABLED = "view_capture_enabled";
        private IBinder mSurfaceFlinger;
        private IWindowManager mWindowManager;
        private ImeTracing mImeTracing;
@@ -279,10 +280,19 @@ public abstract class DevelopmentTiles extends TileService {
            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
        protected boolean isEnabled() {
            return isWindowTraceEnabled() || isLayerTraceEnabled() || isSystemUiTracingEnabled()
                    || isImeTraceEnabled();
                    || isImeTraceEnabled() || isViewCaptureEnabled();
        }

        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
        protected void setIsEnabled(boolean isEnabled) {
            setWindowTraceEnabled(isEnabled);
            setLayerTraceEnabled(isEnabled);
            setSystemUiTracing(isEnabled);
            setImeTraceEnabled(isEnabled);
            setViewCaptureEnabled(isEnabled);
            if (!isEnabled) {
                mToast.show();
            }